Staticpages are now included in the What's New Block. Configuration option included to disable staticpages from displaying in the block if a centerblock and/or execute PHP code.
Staticpages now have the option to not be included in the search results of Geeklog. This can be limited to just pages that are centerblocks and/or execute PHP code.
1.1 --- a/plugins/staticpages/functions.inc Thu Oct 29 19:50:58 2009 +0100
1.2 +++ b/plugins/staticpages/functions.inc Thu Oct 15 13:05:28 2009 -0400
1.3 @@ -572,11 +572,13 @@
1.4 */
1.5 function plugin_searchtypes_staticpages()
1.6 {
1.7 - global $LANG_STATIC;
1.8 + global $LANG_STATIC, $_SP_CONF;
1.9
1.10 - $tmp['staticpages'] = $LANG_STATIC['staticpages'];
1.11 -
1.12 - return $tmp;
1.13 + if ($_SP_CONF['includesearch'] == 1) {
1.14 + $tmp['staticpages'] = $LANG_STATIC['staticpages'];
1.15 +
1.16 + return $tmp;
1.17 + }
1.18 }
1.19
1.20
1.21 @@ -1253,6 +1255,97 @@
1.22 }
1.23
1.24 /**
1.25 +* Return headlines for New Static Pages section in the What's New block, if enabled
1.26 +*
1.27 +* @return mixed array(headline, byline), or boolean false if disabled
1.28 +*
1.29 +*/
1.30 +function plugin_whatsnewsupported_staticpages()
1.31 +{
1.32 + global $_SP_CONF, $LANG_STATIC, $LANG_WHATSNEW;
1.33 +
1.34 + if ($_SP_CONF['hidenewstaticpages'] == 0) {
1.35 + $retval = array($LANG_STATIC['pages'],
1.36 + COM_formatTimeString($LANG_WHATSNEW['new_last'],
1.37 + $_SP_CONF['newstaticpagesinterval'])
1.38 + );
1.39 + } else {
1.40 + $retval = false;
1.41 + }
1.42 +
1.43 + return $retval;
1.44 +}
1.45 +
1.46 +/**
1.47 +* Return new Static Pages for the What's New block
1.48 +*
1.49 +* @return string HTML list of new staticpages
1.50 +*
1.51 +*/
1.52 +function plugin_getwhatsnew_staticpages()
1.53 +{
1.54 + global $_CONF, $_TABLES, $_SP_CONF, $LANG_STATIC;
1.55 +
1.56 + $retval = '';
1.57 +
1.58 + $extra_sql = "";
1.59 + if ($_SP_CONF['includecenterblocks'] == 0) {
1.60 + $extra_sql =' AND sp_centerblock = 0';
1.61 + }
1.62 + if ($_SP_CONF['includephp'] == 0) {
1.63 + $extra_sql .=' AND sp_php = 0';
1.64 + }
1.65 +
1.66 + $sql = "SELECT sp_id, sp_title
1.67 + FROM {$_TABLES['staticpage']}
1.68 + WHERE NOT ISNULL(sp_content) AND (sp_date >= (date_sub(NOW(), INTERVAL {$_SP_CONF['newstaticpagesinterval']} SECOND)))
1.69 + {$extra_sql}
1.70 + " . COM_getPermSQL( 'AND' ) . "
1.71 + ORDER BY sp_date DESC LIMIT 15";
1.72 +
1.73 + $result = DB_query( $sql );
1.74 +
1.75 + $nrows = DB_numRows( $result );
1.76 +
1.77 + if( $nrows > 0)
1.78 + {
1.79 + $newstaticpages = array();
1.80 +
1.81 + for( $x = 0; $x < $nrows; $x++ )
1.82 + {
1.83 + $A = DB_fetchArray( $result );
1.84 +
1.85 + $url = COM_buildUrl( $_CONF['site_url']
1.86 + . '/staticpages/index.php?page=' . $A['sp_id'] );
1.87 +
1.88 + $title = COM_undoSpecialChars( stripslashes( $A['sp_title'] ));
1.89 + $titletouse = COM_truncate( $title, $_SP_CONF['title_trim_length'],
1.90 + '...' );
1.91 + if( $title != $titletouse )
1.92 + {
1.93 + $attr = array('title' => htmlspecialchars($title));
1.94 + }
1.95 + else
1.96 + {
1.97 + $attr = array();
1.98 + }
1.99 + $astaticpage = str_replace( '$', '$', $titletouse );
1.100 + $astaticpage = str_replace( ' ', ' ', $astaticpage );
1.101 +
1.102 + $newstaticpages[] = COM_createLink($astaticpage, $url, $attr);
1.103 + }
1.104 +
1.105 + $retval .= COM_makeList( $newstaticpages, 'list-new-comments' );
1.106 + }
1.107 + else
1.108 + {
1.109 + $retval .= $LANG_STATIC['no_new_pages'] . '<br' . XHTML . '>' . LB;
1.110 + }
1.111 +
1.112 + return $retval;
1.113 +}
1.114 +
1.115 +/**
1.116 * Return information for a static page
1.117 *
1.118 * @param string $sp_id static page ID or '*'
2.1 --- a/plugins/staticpages/install_defaults.php Thu Oct 29 19:50:58 2009 +0100
2.2 +++ b/plugins/staticpages/install_defaults.php Thu Oct 15 13:05:28 2009 -0400
2.3 @@ -97,6 +97,24 @@
2.4 $_SP_DEFAULT['filter_html'] = 0;
2.5 $_SP_DEFAULT['censor'] = 1;
2.6
2.7 +// What's New Block
2.8 +$_SP_DEFAULT['new_staticpages_interval'] = 1209600; // 2 weeks
2.9 +$_SP_DEFAULT['hide_new_staticpages'] = 0;
2.10 +$_SP_DEFAULT['title_trim_length'] = 20;
2.11 +$_SP_DEFAULT['include_centerblocks'] = 0;
2.12 +$_SP_DEFAULT['include_PHP'] = 0;
2.13 +
2.14 +// Search Results Filter
2.15 +$_SP_DEFAULT['include_search'] = 1;
2.16 +$_SP_DEFAULT['include_search_centerblocks'] = 0;
2.17 +$_SP_DEFAULT['include_search_PHP'] = 0;
2.18 +
2.19 +// The maximum number of items displayed when an Atom feed is requested
2.20 +$_SP_DEFAULT['atom_max_items'] = 10;
2.21 +
2.22 +// Display Meta Tags for static pages (1 = show, 0 = don't)
2.23 +$_SP_DEFAULT['meta_tags'] = 0;
2.24 +
2.25 // Define default permissions for new pages created from the Admin panel.
2.26 // Permissions are perm_owner, perm_group, perm_members, perm_anon (in that
2.27 // order). Possible values:
2.28 @@ -106,11 +124,6 @@
2.29 // (a value of 1, ie. write-only, does not make sense and is not allowed)
2.30 $_SP_DEFAULT['default_permissions'] = array(3, 2, 2, 2);
2.31
2.32 -// The maximum number of items displayed when an Atom feed is requested
2.33 -$_SP_DEFAULT['atom_max_items'] = 10;
2.34 -
2.35 -// Display Meta Tags for static pages (1 = show, 0 = don't)
2.36 -$_SP_DEFAULT['meta_tags'] = 0;
2.37
2.38 /**
2.39 * Initialize Static Pages plugin configuration
2.40 @@ -161,11 +174,33 @@
2.41 0, 0, null, 110, true, 'staticpages');
2.42 $c->add('meta_tags', $_SP_DEFAULT['meta_tags'], 'select',
2.43 0, 0, 0, 120, true, 'staticpages');
2.44 +
2.45 + $c->add('fs_whatsnew', NULL, 'fieldset',
2.46 + 0, 1, NULL, 0, true, 'staticpages');
2.47 + $c->add('newstaticpagesinterval',$_SP_DEFAULT['new_staticpages_interval'],'text',
2.48 + 0, 1, NULL, 10, TRUE, 'staticpages');
2.49 + $c->add('hidenewstaticpages',$_SP_DEFAULT['hide_new_staticpages'],'select',
2.50 + 0, 1, 0, 20, TRUE, 'staticpages');
2.51 + $c->add('title_trim_length',$_SP_DEFAULT['title_trim_length'],'text',
2.52 + 0, 1, NULL, 30, TRUE, 'staticpages');
2.53 + $c->add('includecenterblocks',$_SP_DEFAULT['include_centerblocks'],'select',
2.54 + 0, 1, 0, 40, TRUE, 'staticpages');
2.55 + $c->add('includephp',$_SP_DEFAULT['include_PHP'],'select',
2.56 + 0, 1, 0, 50, TRUE, 'staticpages');
2.57 +
2.58 + $c->add('fs_search', NULL, 'fieldset',
2.59 + 0, 2, NULL, 0, true, 'staticpages');
2.60 + $c->add('includesearch', $_SP_DEFAULT['include_search'], 'select',
2.61 + 0, 2, 0, 10, true, 'staticpages');
2.62 + $c->add('includesearchcenterblocks',$_SP_DEFAULT['include_search_centerblocks'],'select',
2.63 + 0, 2, 0, 20, TRUE, 'staticpages');
2.64 + $c->add('includesearchphp',$_SP_DEFAULT['include_search_PHP'],'select',
2.65 + 0, 2, 0, 30, TRUE, 'staticpages');
2.66
2.67 $c->add('fs_permissions', NULL, 'fieldset',
2.68 - 0, 1, NULL, 0, true, 'staticpages');
2.69 - $c->add('default_permissions', $_SP_DEFAULT['default_permissions'],
2.70 - '@select', 0, 1, 12, 120, true, 'staticpages');
2.71 + 0, 3, NULL, 0, true, 'staticpages');
2.72 + $c->add('default_permissions', $_SP_DEFAULT['default_permissions'],'@select',
2.73 + 0, 3, 12, 120, true, 'staticpages');
2.74
2.75 }
2.76
3.1 --- a/plugins/staticpages/language/english.php Thu Oct 29 19:50:58 2009 +0100
3.2 +++ b/plugins/staticpages/language/english.php Thu Oct 15 13:05:28 2009 -0400
3.3 @@ -108,7 +108,9 @@
3.4 'copy' => 'Copy',
3.5 'limit_results' => 'Limit Results',
3.6 'search' => 'Search',
3.7 - 'submit' => 'Submit'
3.8 + 'submit' => 'Submit',
3.9 + 'no_new_pages' => 'No new pages',
3.10 + 'pages' => 'Pages'
3.11 );
3.12
3.13 $PLG_staticpages_MESSAGE15 = 'Your comment has been submitted for review and will be published when approved by a moderator.';
3.14 @@ -139,7 +141,15 @@
3.15 'default_permissions' => 'Page Default Permissions',
3.16 'aftersave' => 'After Saving Page',
3.17 'atom_max_items' => 'Max. Pages in Webservices Feed',
3.18 - 'meta_tags' => 'Enable Meta Tags'
3.19 + 'meta_tags' => 'Enable Meta Tags',
3.20 + 'newstaticpagesinterval' => 'New Static Page Interval',
3.21 + 'hidenewstaticpages' => 'Hide New Static Pages',
3.22 + 'title_trim_length' => 'Title Trim Length',
3.23 + 'includecenterblocks' => 'Include Center Block Static Pages',
3.24 + 'includephp' => 'Include Static Pages with PHP',
3.25 + 'includesearch' => 'Enable Static Pages in Search',
3.26 + 'includesearchcenterblocks' => 'Include Center Block Static Pages',
3.27 + 'includesearchphp' => 'Include Static Pages with PHP'
3.28 );
3.29
3.30 $LANG_configsubgroups['staticpages'] = array(
3.31 @@ -148,6 +158,8 @@
3.32
3.33 $LANG_fs['staticpages'] = array(
3.34 'fs_main' => 'Static Pages Main Settings',
3.35 + 'fs_whatsnew' => 'What\'s New Block',
3.36 + 'fs_search' => 'Search Results',
3.37 'fs_permissions' => 'Default Permissions'
3.38 );
3.39
4.1 --- a/plugins/staticpages/language/english_utf-8.php Thu Oct 29 19:50:58 2009 +0100
4.2 +++ b/plugins/staticpages/language/english_utf-8.php Thu Oct 15 13:05:28 2009 -0400
4.3 @@ -108,7 +108,9 @@
4.4 'copy' => 'Copy',
4.5 'limit_results' => 'Limit Results',
4.6 'search' => 'Search',
4.7 - 'submit' => 'Submit'
4.8 + 'submit' => 'Submit',
4.9 + 'no_new_pages' => 'No new pages',
4.10 + 'pages' => 'Pages'
4.11 );
4.12
4.13 $PLG_staticpages_MESSAGE15 = 'Your comment has been submitted for review and will be published when approved by a moderator.';
4.14 @@ -139,7 +141,15 @@
4.15 'default_permissions' => 'Page Default Permissions',
4.16 'aftersave' => 'After Saving Page',
4.17 'atom_max_items' => 'Max. Pages in Webservices Feed',
4.18 - 'meta_tags' => 'Enable Meta Tags'
4.19 + 'meta_tags' => 'Enable Meta Tags',
4.20 + 'newstaticpagesinterval' => 'New Static Page Interval',
4.21 + 'hidenewstaticpages' => 'Hide New Static Pages',
4.22 + 'title_trim_length' => 'Title Trim Length',
4.23 + 'includecenterblocks' => 'Include Center Block Static Pages',
4.24 + 'includephp' => 'Include Static Pages with PHP',
4.25 + 'includesearch' => 'Enable Static Pages in Search',
4.26 + 'includesearchcenterblocks' => 'Include Center Block Static Pages',
4.27 + 'includesearchphp' => 'Include Static Pages with PHP'
4.28 );
4.29
4.30 $LANG_configsubgroups['staticpages'] = array(
4.31 @@ -148,6 +158,8 @@
4.32
4.33 $LANG_fs['staticpages'] = array(
4.34 'fs_main' => 'Static Pages Main Settings',
4.35 + 'fs_whatsnew' => 'What\'s New Block',
4.36 + 'fs_search' => 'Search Results',
4.37 'fs_permissions' => 'Default Permissions'
4.38 );
4.39
5.1 --- a/plugins/staticpages/sql/mssql_updates.php Thu Oct 29 19:50:58 2009 +0100
5.2 +++ b/plugins/staticpages/sql/mssql_updates.php Thu Oct 15 13:05:28 2009 -0400
5.3 @@ -73,6 +73,20 @@
5.4 }
5.5 }
5.6
5.7 + // What's New Block
5.8 + $c->add('fs_whatsnew', NULL, 'fieldset', 0, 1, NULL, 0, true, 'staticpages');
5.9 + $c->add('newstaticpagesinterval',$_SP_DEFAULT['new_staticpages_interval'],'text', 0, 1, NULL, 10, TRUE, 'staticpages');
5.10 + $c->add('hidenewstaticpages',$_SP_DEFAULT['hide_new_staticpages'],'select', 0, 1, 0, 20, TRUE, 'staticpages');
5.11 + $c->add('title_trim_length',$_SP_DEFAULT['title_trim_length'],'text', 0, 1, NULL, 30, TRUE, 'staticpages');
5.12 + $c->add('includecenterblocks',$_SP_DEFAULT['include_centerblocks'],'select', 0, 1, 0, 40, TRUE, 'staticpages');
5.13 + $c->add('includephp',$_SP_DEFAULT['include_PHP'],'select', 0, 1, 0, 50, TRUE, 'staticpages');
5.14 +
5.15 + // Search Results
5.16 + $c->add('fs_search', NULL, 'fieldset', 0, 2, NULL, 0, true, 'staticpages');
5.17 + $c->add('includesearch', $_SP_DEFAULT['include_search'], 'select', 0, 2, 0, 10, true, 'staticpages');
5.18 + $c->add('includesearchcenterblocks',$_SP_DEFAULT['include_search_centerblocks'],'select', 0, 2, 0, 20, TRUE, 'staticpages');
5.19 + $c->add('includesearchphp',$_SP_DEFAULT['include_search_PHP'],'select', 0, 2, 0, 30, TRUE, 'staticpages');
5.20 +
5.21 return true;
5.22 }
5.23
6.1 --- a/plugins/staticpages/sql/mysql_updates.php Thu Oct 29 19:50:58 2009 +0100
6.2 +++ b/plugins/staticpages/sql/mysql_updates.php Thu Oct 15 13:05:28 2009 -0400
6.3 @@ -74,6 +74,20 @@
6.4 }
6.5 }
6.6
6.7 + // What's New Block
6.8 + $c->add('fs_whatsnew', NULL, 'fieldset', 0, 1, NULL, 0, true, 'staticpages');
6.9 + $c->add('newstaticpagesinterval',$_SP_DEFAULT['new_staticpages_interval'],'text', 0, 1, NULL, 10, TRUE, 'staticpages');
6.10 + $c->add('hidenewstaticpages',$_SP_DEFAULT['hide_new_staticpages'],'select', 0, 1, 0, 20, TRUE, 'staticpages');
6.11 + $c->add('title_trim_length',$_SP_DEFAULT['title_trim_length'],'text', 0, 1, NULL, 30, TRUE, 'staticpages');
6.12 + $c->add('includecenterblocks',$_SP_DEFAULT['include_centerblocks'],'select', 0, 1, 0, 40, TRUE, 'staticpages');
6.13 + $c->add('includephp',$_SP_DEFAULT['include_PHP'],'select', 0, 1, 0, 50, TRUE, 'staticpages');
6.14 +
6.15 + // Search Results
6.16 + $c->add('fs_search', NULL, 'fieldset', 0, 2, NULL, 0, true, 'staticpages');
6.17 + $c->add('includesearch', $_SP_DEFAULT['include_search'], 'select', 0, 2, 0, 10, true, 'staticpages');
6.18 + $c->add('includesearchcenterblocks',$_SP_DEFAULT['include_search_centerblocks'],'select', 0, 2, 0, 20, TRUE, 'staticpages');
6.19 + $c->add('includesearchphp',$_SP_DEFAULT['include_search_PHP'],'select', 0, 2, 0, 30, TRUE, 'staticpages');
6.20 +
6.21 return true;
6.22 }
6.23
7.1 --- a/public_html/docs/english/staticpages.html Thu Oct 29 19:50:58 2009 +0100
7.2 +++ b/public_html/docs/english/staticpages.html Thu Oct 15 13:05:28 2009 -0400
7.3 @@ -155,26 +155,26 @@
7.4 </tr>
7.5 <tr>
7.6 <td><a name="desc_allow_php">allow_php</a></td>
7.7 - <td><code>true</code></td>
7.8 + <td>true</td>
7.9 <td>Allows you to globally allow or disallow the <a href="#php">use of PHP</a>
7.10 in static pages, i.e. it overrides the setting on individual pages.</td>
7.11 </tr>
7.12 <tr class="r2">
7.13 <td><a name="desc_sort_by">sort_by</a></td>
7.14 - <td><tt>'id'</tt></td>
7.15 + <td>'id'</td>
7.16 <td>Define sort order when more than one static page is displayed in
7.17 centerblocks. Allows sorting by page ID, page title, and date of last
7.18 change.</td>
7.19 </tr>
7.20 <tr>
7.21 <td><a name="desc_sort_menu_by">sort_menu_by</a></td>
7.22 - <td><tt>'label'</tt></td>
7.23 + <td>'label'</td>
7.24 <td>Define sort order for static pages in the site's menu. Allows sorting by
7.25 page label, page ID, page title, and date of last change.</td>
7.26 </tr>
7.27 <tr class="r2">
7.28 <td><a name="desc_delete_pages">delete_pages</a></td>
7.29 - <td><tt>false</tt></td>
7.30 + <td>false</td>
7.31 <td>Specify what should happen to a static page when its owner (i.e. the user
7.32 who created the page) is deleted. 'True' would delete the page, 'False'
7.33 will assign it to a user in the "Root" group (usually the user with the
7.34 @@ -182,35 +182,35 @@
7.35 </tr>
7.36 <tr>
7.37 <td><a name="desc_in_block">in_block</a></td>
7.38 - <td><tt>true</tt></td>
7.39 + <td>true</td>
7.40 <td>Whether to display the content of static pages inside a block template or
7.41 not. This is the default setting and can be overridden per page.</td>
7.42 </tr>
7.43 <tr class="r2">
7.44 <td><a name="desc_show_hits">show_hits</a></td>
7.45 - <td><tt>true</tt></td>
7.46 + <td>true</td>
7.47 <td>Whether to show the number of hits for a static page.</td>
7.48 <tr>
7.49 <tr>
7.50 <td><a name="desc_show_date">show_date</a></td>
7.51 - <td><tt>true</tt></td>
7.52 + <td>true</td>
7.53 <td>Whether to show the date and time of the last change to a static page.</td>
7.54 </tr>
7.55 <tr class="r2">
7.56 <td><a name="desc_filter_html">filter_html</a></td>
7.57 - <td><tt>false</tt></td>
7.58 + <td>false</td>
7.59 <td>Whether HTML in static pages should be run through Geeklog's HTML filter
7.60 option.</td>
7.61 </tr>
7.62 <tr>
7.63 <td><a name="desc_censor">censor</a></td>
7.64 - <td><tt>false</tt></td>
7.65 + <td>false</td>
7.66 <td>Whether the content of the static page should be run through Geeklog's
7.67 "bad words" filter.</td>
7.68 </tr>
7.69 <tr class="r2">
7.70 <td><a name="desc_aftersave">aftersave</a></td>
7.71 - <td><tt>'list'</tt></td>
7.72 + <td>'list'</td>
7.73 <td>Which page to go to after a static page has been saved:
7.74 <ul>
7.75 <li>'item': display the page</li>
7.76 @@ -232,6 +232,55 @@
7.77 </tr>
7.78 </table>
7.79
7.80 +<h3><a name="whatsnew">What's New Block</a></h3>
7.81 +
7.82 +<table>
7.83 +<tr><th style="width:25%">Variable</th>
7.84 + <th style="width:25%">Default Value</th>
7.85 + <th style="width:50%">Description</th>
7.86 +</tr>
7.87 + <td valign="top"><a name="desc_newstaticpagesinterval">newstaticpagesinterval</a></td>
7.88 + <td valign="top">1209600</td>
7.89 + <td valign="top">Static pages are "new" if they are this many seconds old.</td></tr>
7.90 +<tr>
7.91 + <td valign="top"><a name="desc_hidenewstaticpages">hidenewstaticpages</a></td>
7.92 + <td valign="top">false</td>
7.93 + <td valign="top">Set to true to hide new static pages from the What's New block.</td></tr>
7.94 +<tr class="r2">
7.95 + <td valign="top"><a name="desc_title_trim_length">title_trim_length</a></td>
7.96 + <td valign="top">20</td>
7.97 + <td valign="top">Max. length of the title of items listed in the What's New block.</td></tr>
7.98 +<tr>
7.99 + <td valign="top"><a name="desc_includecenterblocks">includecenterblocks</a></td>
7.100 + <td valign="top">false</td>
7.101 + <td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
7.102 +<tr class="r2">
7.103 + <td valign="top"><a name="desc_includephp">includephp</a></td>
7.104 + <td valign="top">false</td>
7.105 + <td valign="top">Set to true to include static pages that execute PHP.</td></tr>
7.106 +</table>
7.107 +
7.108 +
7.109 +<h3><a name="search">Search Results</a></h3>
7.110 +
7.111 +<table>
7.112 +<tr><th style="width:25%">Variable</th>
7.113 + <th style="width:25%">Default Value</th>
7.114 + <th style="width:50%">Description</th>
7.115 +</tr>
7.116 + <td valign="top"><a name="desc_includesearch">includesearch</a></td>
7.117 + <td valign="top">true</td>
7.118 + <td valign="top">Set to true to enable static pages in search results.</td></tr>
7.119 +<tr class="r2">
7.120 + <td valign="top"><a name="desc_includesearchcenterblocks">includesearchcenterblocks</a></td>
7.121 + <td valign="top">false</td>
7.122 + <td valign="top">Set to true to include static pages that are displayed as a center block.</td></tr>
7.123 +<tr>
7.124 + <td valign="top"><a name="desc_includesearchphp">includesearchphp</a></td>
7.125 + <td valign="top">false</td>
7.126 + <td valign="top">Set to true to include static pages that execute PHP.</td></tr>
7.127 +</table>
7.128 +
7.129 <div class="footer">
7.130 <a href="http://wiki.geeklog.net/">The Geeklog Documentation Project</a><br>
7.131 All trademarks and copyrights on this page are owned by their respective owners. Geeklog is copyleft.