]> git.mjollnir.org Git - s9y.git/commitdiff
Encody title
authorgarvinhicking <garvinhicking>
Sat, 30 Jun 2007 11:31:15 +0000 (11:31 +0000)
committergarvinhicking <garvinhicking>
Sat, 30 Jun 2007 11:31:15 +0000 (11:31 +0000)
plugins/serendipity_plugin_history/serendipity_plugin_history.php

index db7cc974a4b44b8eeddf6a8280c1a447340c04ff..246db044cb732f7745fb7873569b7c70b7bb67b7 100644 (file)
@@ -22,7 +22,7 @@ class serendipity_plugin_history extends serendipity_plugin
         $propbag->add('description',   PLUGIN_HISTORY_DESC);
         $propbag->add('stackable',     true);
         $propbag->add('author',        'Jannis Hermanns');
-        $propbag->add('version',       '1.1');
+        $propbag->add('version',       '1.3');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -40,6 +40,7 @@ class serendipity_plugin_history extends serendipity_plugin
                                              'full',
                                              'amount',
                                              'displaydate',
+                                             'displayauthor',
                                              'dateformat'));
     }
 
@@ -109,6 +110,13 @@ class serendipity_plugin_history extends serendipity_plugin
                 $propbag->add('select_values', array('false','true'));
                 $propbag->add('default',     'true');
             break;
+            case 'displayauthor':
+                $propbag->add('type',         'select');
+                $propbag->add('name',         PLUGIN_HISTORY_DISPLAYAUTHOR);
+                $propbag->add('description',  '');
+                $propbag->add('select_values', array('false','true'));
+                $propbag->add('default',     'false');
+            break;
             case 'dateformat':
                 $propbag->add('type', 'string');
                 $propbag->add('name', GENERAL_PLUGIN_DATEFORMAT);
@@ -135,6 +143,7 @@ class serendipity_plugin_history extends serendipity_plugin
         $displaydate = $this->get_config('displaydate', 'true');
         $dateformat  = $this->get_config('dateformat');
         $full        = ($this->get_config('full', 'false') != 'true') ? false : true;
+        $displayauthor = serendipity_db_bool($this->get_config('displayauthor', false));
 
         if (!is_numeric($min_age) || $min_age < 0 || $specialage == 'year') {
             $min_age = 365 + date('L', serendipity_serverOffsetHour());
@@ -177,11 +186,12 @@ class serendipity_plugin_history extends serendipity_plugin
                                           true,
                                           array('timestamp' => $e[$x]['timestamp'])
             );
-            $date = ($displaydate=='0') ? '' : serendipity_strftime($dateformat,$e[$x]['timestamp']);
+            $date   = ($displaydate=='0') ? '' : serendipity_strftime($dateformat,$e[$x]['timestamp']);
+            $author = ($displayauthor) ? $e[$x]['author'] . ': ' : '';
             $t = ($maxlength==0 || strlen($e[$x]['title'])<=$maxlength) ?
                     $e[$x]['title'] :
                     (trim(serendipity_mb('substr', $e[$x]['title'], 0, $maxlength-3)).' [...]');
-            echo $date . "<a href='$url' title='".str_replace("'", '`', $e[$x][title])."'>".$t."</a> " .
+            echo $author . $date . "<a href='$url' title='".str_replace("'", '`', htmlspecialchars($e[$x]['title']))."'>". htmlspecialchars($t) ."</a> " .
                  strip_tags($e[$x]['body']) . '<br />';
         }
         echo $outro;
@@ -189,4 +199,3 @@ class serendipity_plugin_history extends serendipity_plugin
 }
 
 /* vim: set sts=4 ts=4 expandtab : */
-?>