Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_contentrewrite
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29422/plugins/serendipity_event_contentrewrite
Modified Files:
serendipity_event_contentrewrite.php
Log Message:
* Move Smarty object instancing to a function call, so that is not
created when not needed (like for CSS)
* make head_title / head_subtitle globally available, so that plugins
can also use it
* Code optimizations: Queries, referenced variables, plugin API
* Improved entryproperties cache
* Improved Plugin API calls to fetch titles of entries
* Improved Plugin aPI calls to set the authorid of a plugin
* Improved some plugins to not create costy introspect() calls, and move
them to the introspect_config_item() part
* Fixed trackexits plugin to not abuse the query() function too often
Index: serendipity_event_contentrewrite.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_contentrewrite/serendipity_event_contentrewrite.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- serendipity_event_contentrewrite.php 19 Nov 2004 11:05:38 -0000 1.10
+++ serendipity_event_contentrewrite.php 19 Nov 2004 11:24:53 -0000 1.11
@@ -48,7 +48,8 @@
class serendipity_event_contentrewrite extends serendipity_event
{
-var $rewrite_from, $rewrite_to;
+ var $title = PLUGIN_EVENT_CONTENTREWRITE_NAME;
+ var $rewrite_from, $rewrite_to;
function cleanup() {
// Cleanup. Remove all empty configs on SAVECONF-Submit.
@@ -61,11 +62,13 @@
{
global $serendipity;
+ $this->title = $this->get_config('title', $this->title);
$propbag->add('name', PLUGIN_EVENT_CONTENTREWRITE_NAME);
$propbag->add('description', PLUGIN_EVENT_CONTENTREWRITE_DESCRIPTION);
$propbag->add('stackable', true);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '1.0');
+ $propbag->add('cachable_events', array('frontend_display' => true));
$propbag->add('event_hooks', array(
'frontend_display' => true
));
@@ -145,6 +148,15 @@
$this->counter = $counter;
}
+ function install() {
+ serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
+ }
+
+ function uninstall() {
+ serendipity_plugin_api::hook_event('backend_cache_purge', $this->title);
+ serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
+ }
+
function introspect_config_item($name, &$propbag)
{
foreach($this->markup_elements as $element) {
@@ -163,7 +175,6 @@
$switch[2] = 'empty';
}
-
switch($switch[1]) {
case 'title':
@@ -216,7 +227,7 @@
function generate_content(&$title)
{
- $title = $this->get_config('title');
+ $title = $this->get_config('title', $this->title);
?>
<table>
<?php
@@ -242,10 +253,6 @@
if (isset($hooks[$event])) {
switch($event) {
case 'frontend_display':
- if (isset($eventData['is_cached']) && $eventData['is_cached']) {
- continue;
- }
-
$char = &$this->get_config('rewrite_char');
$string = &$this->get_config('rewrite_string');
foreach($this->rewrite_from AS $nr => $v_from) {
|