Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4426/include
Modified Files:
Tag: branch-smarty
functions.inc.php plugin_api.inc.php
Log Message:
* Performance improvements for Plugin API (only fetch authorids of plugins once)
* Make TrackExits plugin cacheable like the markup plugins
* Remove obsolete legacy code
Index: plugin_api.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/plugin_api.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- plugin_api.inc.php 6 Nov 2004 11:22:49 -0000 1.1.2.1
+++ plugin_api.inc.php 16 Nov 2004 14:55:18 -0000 1.1.2.2
@@ -77,7 +77,7 @@
serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}plugins (name, sort_order, placement, authorid) values ('$key', $nextidx, '$default_placement', '$authorid')");
/* Check for multiple dependencies */
- $plugin =& serendipity_plugin_api::load_plugin($key);
+ $plugin =& serendipity_plugin_api::load_plugin($key, $authorid);
$plugin->install();
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
@@ -268,7 +268,7 @@
}
/* Creates an instance of a named plugin */
- function &load_plugin($instance_id)
+ function &load_plugin($instance_id, $authorid = null)
{
global $serendipity;
@@ -296,10 +296,13 @@
}
$p =& new $class_name($instance_id);
-
- $sql = "SELECT authorid from {$serendipity['dbPrefix']}plugins WHERE name = '" . $instance_id . "'";
- $owner = serendipity_db_query($sql, true);
- $p->serendipity_owner = $owner[0];
+ if (!is_null($authorid)) {
+ $p->serendipity_owner = $authorid;
+ } else {
+ $sql = "SELECT authorid from {$serendipity['dbPrefix']}plugins WHERE name = '" . $instance_id . "'";
+ $owner = serendipity_db_query($sql, true);
+ $p->serendipity_owner = $owner[0];
+ }
return $p;
}
@@ -348,7 +351,7 @@
$pluginData = array();
foreach ($plugins as $plugin_data) {
- $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name']);
+ $plugin =& serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid']);
$class = get_class($plugin);
$title = '';
@@ -404,7 +407,7 @@
function &get_event_plugins($getInstance = false) {
static $event_plugins;
- if ( isset($event_plugins) && is_array($event_plugins) ) {
+ if (isset($event_plugins) && is_array($event_plugins)) {
return $event_plugins;
}
@@ -416,11 +419,13 @@
$event_plugins = array();
foreach ($plugins as $plugin_data) {
- if ($event_plugins[$plugin_data['name']]['p'] = &serendipity_plugin_api::load_plugin($plugin_data['name'])) {
+ if ($event_plugins[$plugin_data['name']]['p'] = &serendipity_plugin_api::load_plugin($plugin_data['name'], $plugin_data['authorid'])) {
/* query for its name, description and configuration data */
$event_plugins[$plugin_data['name']]['b'] = new serendipity_property_bag;
$event_plugins[$plugin_data['name']]['p']->introspect($event_plugins[$plugin_data['name']]['b']);
$event_plugins[$plugin_data['name']]['t'] = serendipity_plugin_api::get_plugin_title($event_plugins[$plugin_data['name']]['p']);
+ } else {
+ unset($event_plugins[$plugin_data['name']]); // Unset failed plugins
}
}
Index: functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/functions.inc.php,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- functions.inc.php 12 Nov 2004 15:43:23 -0000 1.1.2.3
+++ functions.inc.php 16 Nov 2004 14:55:18 -0000 1.1.2.4
@@ -261,15 +261,6 @@
'y');
- // For pretty urls we want to have a '+' as word separator. But GUIDs need to stay used to using '_' to not break bc.
- // (For performance reasons this changes the static array instead of using a second str_replace call only for the ' ' case,
- // and to avoid a costy call to array_merge()
- if ($compat !== true) {
- $to[0] = '-';
- } else {
- $to[0] = '_';
- }
-
// Replace international chars not detected by every locale
$str = str_replace($from, $to, $str);
|