[geeklog-cvs] geeklog: Added meta description and meta keywords to stories, st...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Aug 8 08:13:36 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/5524c9cdb063
changeset: 7228:5524c9cdb063
user:      Tom <websitemaster at cogeco.net>
date:      Tue Aug 04 09:23:31 2009 -0400
description:
Added meta description and meta keywords to stories, staticpages and polls.
Added autotags to polls to allow for linking directly to a poll and displaying polls in stories, etc.

diffstat:

 language/english.php                                                   |   12 +-
 language/english_utf-8.php                                             |   12 +-
 plugins/polls/autoinstall.php                                          |    2 +-
 plugins/polls/functions.inc                                            |  119 ++++++++-
 plugins/polls/language/english.php                                     |    2 +
 plugins/polls/language/english_utf-8.php                               |    2 +
 plugins/staticpages/autoinstall.php                                    |    2 +-
 plugins/staticpages/functions.inc                                      |   37 ++-
 plugins/staticpages/install_defaults.php                               |    6 +-
 plugins/staticpages/language/english.php                               |    5 +-
 plugins/staticpages/language/english_utf-8.php                         |    5 +-
 plugins/staticpages/services.inc.php                                   |   17 +-
 plugins/staticpages/sql/mssql_install.php                              |    2 +
 plugins/staticpages/sql/mssql_updates.php                              |   61 +++++
 plugins/staticpages/sql/mysql_install.php                              |    2 +
 plugins/staticpages/sql/mysql_updates.php                              |   60 +++++
 plugins/staticpages/templates/admin/editor.thtml                       |    8 +
 plugins/staticpages/templates/admin/editor_advanced.thtml              |    8 +
 public_html/admin/install/config-install.php                           |    3 +
 public_html/admin/install/lib-upgrade.php                              |   10 +
 public_html/admin/plugins/staticpages/index.php                        |   18 +-
 public_html/admin/story.php                                            |    4 +
 public_html/article.php                                                |    9 +
 public_html/docs/english/config.html                                   |   14 +
 public_html/docs/english/staticpages.html                              |    5 +
 public_html/layout/professional/admin/story/storyeditor.thtml          |    8 +
 public_html/layout/professional/admin/story/storyeditor_advanced.thtml |    8 +
 public_html/lib-common.php                                             |   95 +++++++-
 public_html/polls/style.css                                            |   21 +
 public_html/siteconfig.php.dist                                        |    2 +-
 sql/mssql_tableanddata.php                                             |    2 +
 sql/mysql_tableanddata.php                                             |    2 +
 sql/updates/mssql_1.6.0_to_1.6.1.php                                   |   25 ++
 sql/updates/mysql_1.6.0_to_1.6.1.php                                   |   24 ++
 system/classes/story.class.php                                         |   39 +++
 35 files changed, 610 insertions(+), 41 deletions(-)

diffs (truncated from 1320 to 300 lines):

diff -r 0c7207abb4e7 -r 5524c9cdb063 language/english.php
--- a/language/english.php	Fri Aug 07 10:00:40 2009 +0200
+++ b/language/english.php	Tue Aug 04 09:23:31 2009 -0400
@@ -825,7 +825,9 @@
     85 => 'Show All',
     86 => 'Advanced Editor',
     87 => 'Story Stats',
-    88 => 'Wiki-style format'
+    88 => 'Wiki-style format',
+    89 => 'Meta Description',
+    90 => 'Meta Keywords'
 );
 
 
@@ -1573,6 +1575,8 @@
     'addchild'      => 'Add child',
     'list'          => 'list',
     'list_all'      => 'List all',
+    'meta_description' => 'Meta Description',
+    'meta_keywords' => 'Meta Keywords',        
     'na'            => 'N/A'
 );
 
@@ -1845,6 +1849,9 @@
     'censorlist' => "Censor List",
     'ip_lookup' => "IP Lookup",
     'url_rewrite' => "Enable URL Rewrite",
+    'meta_tags' => "Meta Tags",
+    'meta_description' => "Default Meta Description",
+    'meta_keywords' => "Default Meta Keywords",    
     'default_permissions_block' => "Block Default Permissions",
     'default_permissions_story' => "Story Default Permissions",
     'default_permissions_topic' => "Topic Default Permissions",
@@ -1949,7 +1956,8 @@
     19 => array('Google' => 'google', 'Table' => 'table'),
     20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
     21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict'),
-    22 => array('Strict' => 'DENY', 'Same Origin' => 'SAMEORIGIN', '(disabled)' => '')
+    22 => array('Strict' => 'DENY', 'Same Origin' => 'SAMEORIGIN', '(disabled)' => ''),
+    23 => array('Disabled' => 0, 'Enabled' => 1, 'Enabled (Default for Homepage only)' => 2)
 );
 
 ?>
diff -r 0c7207abb4e7 -r 5524c9cdb063 language/english_utf-8.php
--- a/language/english_utf-8.php	Fri Aug 07 10:00:40 2009 +0200
+++ b/language/english_utf-8.php	Tue Aug 04 09:23:31 2009 -0400
@@ -825,7 +825,9 @@
     85 => 'Show All',
     86 => 'Advanced Editor',
     87 => 'Story Stats',
-    88 => 'Wiki-style format'
+    88 => 'Wiki-style format',
+    89 => 'Meta Description',
+    90 => 'Meta Keywords'
 );
 
 
@@ -1573,6 +1575,8 @@
     'addchild'      => 'Add child',
     'list'          => 'list',
     'list_all'      => 'List all',
+    'meta_description' => 'Meta Description',
+    'meta_keywords' => 'Meta Keywords',        
     'na'            => 'N/A'
 );
 
@@ -1845,6 +1849,9 @@
     'censorlist' => "Censor List",
     'ip_lookup' => "IP Lookup",
     'url_rewrite' => "Enable URL Rewrite",
+    'meta_tags' => "Meta Tags",
+    'meta_description' => "Default Meta Description",
+    'meta_keywords' => "Default Meta Keywords",
     'default_permissions_block' => "Block Default Permissions",
     'default_permissions_story' => "Story Default Permissions",
     'default_permissions_topic' => "Topic Default Permissions",
@@ -1949,7 +1956,8 @@
     19 => array('Google' => 'google', 'Table' => 'table'),
     20 => array('Exact Phrase' => 'phrase', 'All of The Words' => 'all', 'Any of The Words' => 'any'),
     21 => array('HTML 4.01 Transitional' => 'html401transitional', 'HTML 4.01 Strict' => 'html401strict', 'XHTML 1.0 Transitional' => 'xhtml10transitional', 'XHTML 1.0 Strict' => 'xhtml10strict'),
-    22 => array('Strict' => 'DENY', 'Same Origin' => 'SAMEORIGIN', '(disabled)' => '')
+    22 => array('Strict' => 'DENY', 'Same Origin' => 'SAMEORIGIN', '(disabled)' => ''),
+    23 => array('Disabled' => 0, 'Enabled' => 1, 'Enabled (Default for Homepage only)' => 2)
 );
 
 ?>
diff -r 0c7207abb4e7 -r 5524c9cdb063 plugins/polls/autoinstall.php
--- a/plugins/polls/autoinstall.php	Fri Aug 07 10:00:40 2009 +0200
+++ b/plugins/polls/autoinstall.php	Tue Aug 04 09:23:31 2009 -0400
@@ -51,7 +51,7 @@
     $info = array(
         'pi_name'         => $pi_name,
         'pi_display_name' => $pi_display_name,
-        'pi_version'      => '2.1.0',
+        'pi_version'      => '2.1.1',
         'pi_gl_version'   => '1.6.0',
         'pi_homepage'     => 'http://www.geeklog.net/'
     );
diff -r 0c7207abb4e7 -r 5524c9cdb063 plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Fri Aug 07 10:00:40 2009 +0200
+++ b/plugins/polls/functions.inc	Tue Aug 04 09:23:31 2009 -0400
@@ -450,13 +450,14 @@
 *
 * @param      string      $pid      ID for poll topic
 * @param      boolean     $showall  Show only the first question in the poll or all?
+* @param        int        $displaytype       Possible values 0 = Normal, 1 = In Block, 2 = autotag
 * @see function COM_pollResults
 * @see function COM_showPoll
 * @return       string  HTML Formatted Poll
 *
 */
 
-function POLLS_pollVote($pid, $showall = true)
+function POLLS_pollVote($pid, $showall = true, $displaytype = 0)
 {
     global $_CONF, $_TABLES, $LANG_POLLS, $LANG01, $_USER, $LANG25, $_IMAGE_TYPE;
     $retval = '';
@@ -471,6 +472,7 @@
     }
 
     $P = DB_fetchArray($topic);
+    
     if ((!isset($_COOKIE[$pid]) && !POLLS_ipAlreadyVoted($pid)) or ($P['is_open'] == 1)) {
         if ($ntopics == 1) {
             $questions_sql = "SELECT question,qid "
@@ -593,7 +595,7 @@
                 }
                 $retval =  $poll->finish($poll->parse('output', 'block')) . LB;
 
-                if ($showall && ($P['commentcode'] >= 0)) {
+                if ($showall && ($P['commentcode'] >= 0 AND $displaytype != 2)) {
                     $delete_option = (SEC_hasRights('polls.edit') &&
                         SEC_hasAccess($P['owner_id'], $P['group_id'],
                         $P['perm_owner'], $P['perm_group'], $P['perm_members'],
@@ -610,7 +612,7 @@
             }
         }
     } else {
-        $retval .= POLLS_pollResults($pid);
+        $retval .= POLLS_pollResults($pid, 0, '', '', $displaytype);
     }
 
     return $retval;
@@ -622,27 +624,33 @@
 * This will determine if a user needs to see the poll form OR the poll
 * result.
 *
-* @param        int        $sise       Size in pixels of poll results
+* @param        int        $size       Size in pixels of poll results
 * @param        string     $pid        topic ID to show (optional)
+* @param        int        $displaytype       Possible values 0 = Normal, 1 = In Block, 2 = autotag 
 * @see function COM_pollVote
 * @see function COM_pollResults
 * @return    String  HTML Formated string of Poll
 *
 */
 
-function POLLS_showPoll($size, $pid='', $showall = false )
+function POLLS_showPoll($size, $pid='', $showall = false, $displaytype = 0 )
 {
-    global $_CONF, $_PO_CONF, $_TABLES;
+    global $_CONF, $_PO_CONF, $_TABLES, $LANG_POLLS;
 
     $retval = '';
 
     DB_query("DELETE FROM {$_TABLES['pollvoters']} WHERE date < UNIX_TIMESTAMP() - {$_PO_CONF['polladdresstime']}");
+    
+    if(!empty($pid)) {
+        $Q['is_open'] = DB_getItem($_TABLES['polltopics'], 'is_open', "pid = '".$pid."'");
 
-    if(!empty($pid)) {
+        if ($displaytype == 2 && $Q['is_open'] == 0) {
+            $retval = '<div class="poll-autotag-message">' . $LANG_POLLS['pollclosed']. "</div>";
+        }        
         if(!isset($_COOKIE["poll-".$pid]) && !POLLS_ipAlreadyVoted($pid) && ($Q['is_open'] == 1)) {
-            $retval .= POLLS_pollVote($pid);
+            $retval .= POLLS_pollVote($pid, $showall, $displaytype);
         } else {
-            $retval .= POLLS_pollResults($pid, $size);
+            $retval .= POLLS_pollResults($pid, $size, '', '', $displaytype);
         }
     } else {
         $result = DB_query("SELECT pid,topic,is_open FROM {$_TABLES['polltopics']} WHERE display = 1 ORDER BY date DESC");
@@ -654,7 +662,8 @@
             for ($i = 1; $i <= $nrows; $i++) {
                 $Q = DB_fetchArray($result);
                 $pid = $Q['pid'];
-                if ($size < 120) { // assume we're in the poll block
+                //if ($size < 120) { // assume we're in the poll block
+                if ($displaytype == 1) { // In the poll block
                     $showall = false;
                 } else { // assume we're in polls/index.php
                     $retval .= COM_startBlock($title);
@@ -662,9 +671,9 @@
                 }
 
                 if (!isset($_COOKIE["poll-".$pid]) && !POLLS_ipAlreadyVoted($pid) && ($Q['is_open'] == 1)) {
-                    $retval .= POLLS_pollVote($pid, $showall);
+                    $retval .= POLLS_pollVote($pid, $showall, $displaytype);
                 } else {
-                    $retval .= POLLS_pollResults($pid, $size);
+                    $retval .= POLLS_pollResults($pid, $size, '', '', $displaytype);
                 }
 
                 if ($size < 120) {
@@ -738,12 +747,13 @@
 * @param        int         $scale      Size in pixels to scale formatted results to
 * @param        string      $order      'ASC' or 'DESC' for Comment ordering (SQL statment ordering)
 * @param        string      $mode       Comment Mode possible values 'nocomment', 'flat', 'nested', 'threaded'
+* @param        int        $displaytype       Possible values 0 = Normal, 1 = In Block, 2 = autotag
 * @see POLLS_pollVote
 * @see POLLS_showPoll
 * @return     string   HTML Formated Poll Results
 *
 */
-function POLLS_pollResults($pid, $scale=400, $order='', $mode='')
+function POLLS_pollResults($pid, $scale=400, $order='', $mode='', $displaytype = 0)
 {
     global $_CONF, $_TABLES, $_USER, $_IMAGE_TYPE,
            $_PO_CONF, $LANG01, $LANG_POLLS, $_COM_VERBOSE, $LANG25;
@@ -771,9 +781,13 @@
     ) {
         $retval = '';
     } else {
+        if ($displaytype == 2) {
+            $retval = '<div class="poll-autotag-message">' . $LANG_POLLS['pollhidden']. "</div>";
+        }
+        
         return $retval;
     }
-
+    
     $ntopic = DB_numRows($topic );
     if ($ntopic == 1) {
         $questions_sql = "SELECT qid,pid,question "
@@ -896,7 +910,7 @@
 
             $retval .= $poll->finish($poll->parse('output', 'result' ));
 
-            if($scale > 399 && $P['commentcode'] >= 0 ) {
+            if($scale > 399 && $P['commentcode'] >= 0 && $displaytype != 2) {
                 $delete_option = (SEC_hasRights('polls.edit') &&
                     SEC_hasAccess($P['owner_id'], $P['group_id'],
                     $P['perm_owner'], $P['perm_group'], $P['perm_members'],
@@ -941,7 +955,7 @@
 
 function phpblock_polls()
 {
-    $retval = POLLS_showPoll(60);
+    $retval = POLLS_showPoll(60, '', false, 1);
     return $retval;
 }
 
@@ -1096,7 +1110,7 @@
     global $_CONF;
 
     $str = null;
-    $str = '<link rel="stylesheet" type="text/css" href="'
+    $str = LB . '<link rel="stylesheet" type="text/css" href="'
         . $_CONF['site_url'] . '/polls/style.css"' . XHTML . '>';
 
     return $str;
@@ -1143,7 +1157,8 @@
                     DB_query($sql);
                 }
             }
-            $current_version = '2.1.0';
+            
+            $current_version = '2.1.1';
             break;
 
         default:
@@ -1181,7 +1196,7 @@
 }
 
 /**
-* Return information for a poll
+* Return information for a poll                                                                                                                     
 *
 * @param    string  $pid        poll ID or '*'
 * @param    string  $what       comma-separated list of properties
@@ -1365,4 +1380,70 @@
     return $tmp;
 }
 
+/**
+* Poll Autotags
+* [poll: pid] - Displays a link to a poll using the Poll Topic as the title. A alternate title may be specified. 
+* [poll-vote: pid pid class:poll-autotag showall:1] - Width and showall not required. Class specifies the css class and Showall if set to 1, shows all questions
+* [poll-result: pid class:poll-autotag] - Width and showall not required. Class specifies the css class
+*
+*/
+function plugin_autotags_polls ($op, $content = '', $autotag = '')
+{
+    global $_TABLES;
+    
+    if ($op == 'tagname' ) {
+        return array('poll-vote','poll-result','poll');
+    } else if ($op == 'parse') {
+        $pid = COM_applyFilter ($autotag['parm1']);



More information about the geeklog-cvs mailing list