~quam-plures-core/quam-plures/qp5_colls-blogs_chaps-cats

« back to all changes in this revision

Viewing changes to qp_inc/plugins/model/_plugins.class.php

  • Committer: EdB
  • Date: 2013-03-12 06:26:03 UTC
  • Revision ID: 1912webworks@gmail.com-20130312062603-tnlb5zco5mglydqj
lots of changes in this branch. tested and functional, but not going into merge just yet ...

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
/**
18
18
 * Plugins base class
 
19
 *
19
20
 * @package plugins
20
21
 */
21
22
class Plugins
103
104
                global $plugins_subdir;
104
105
                global $Timer;
105
106
 
106
 
                // Set plugin path:
 
107
                // Set plugin path
107
108
                $this->plugins_path = $basepath.$plugins_subdir;
108
109
                $Timer->resume( 'plugin_init' );
109
110
 
110
 
                // Load events for enabled plugins:
 
111
                // Load events for enabled plugins
111
112
                $this->load_events();
112
113
                $Timer->pause( 'plugin_init' );
113
114
        }
115
116
 
116
117
        /**
117
118
         * Get a list of available Plugin groups
 
119
         *
118
120
         * @return array
119
121
         */
120
122
        function get_plugin_groups()
135
137
 
136
138
        /**
137
139
         * Get Plugins in group
 
140
         *
138
141
         * Will return an array that contents are references to plugins that have the same group.
 
142
         *
139
143
         * @return array
140
144
         */
141
145
        function get_Plugins_in_group( $group )
161
165
         * {@link Plugins_admin}, because we want to keep it in then in our indices. Note:
162
166
         * this should probably always get called on the {@link $Plugins} object, not
163
167
         * {@link $admin_Plugins}.
 
168
         *
164
169
         * @param Plugin
165
170
         * @param string New status ("enabled", "disabled", "needs_config", "broken")
166
171
         * @return boolean True on success, false on failure.
184
189
                }
185
190
                else
186
191
                {
187
 
                        // Notify the plugin that it has been disabled:
 
192
                        // Notify the plugin that it has been disabled
188
193
                        $Plugin->BeforeDisable();
189
194
                        $this->unregister( $Plugin );
190
195
                }
200
205
         * (anymore) and instantiates the Plugin's (User)Settings. Attention: The code of
201
206
         * the plugin is set to NULL if it is found to be not unique! To get the original
202
207
         * code, use the $orig_code parameter.
 
208
         *
203
209
         * @param string name of plugin class to instantiate and register
204
210
         * @param int ID in database (0 if not installed)
205
211
         * @param int Priority in database (-1 to keep default)
211
217
         * of the plugin we are registering, even if the code is found to be not unique.
212
218
         * @return Plugin Plugin ref to newly created plugin; string in case of error
213
219
         */
214
 
        function & register( $classname, $ID = 0, $priority = -1, $apply_rendering = NULL,
215
 
                $classfile_path = NULL, $must_exists = true, & $orig_code = NULL )
 
220
        function & register(
 
221
                $classname,
 
222
                $ID = 0,
 
223
                $priority = -1,
 
224
                $apply_rendering = NULL,
 
225
                $classfile_path = NULL,
 
226
                $must_exists = true,
 
227
                & $orig_code = NULL )
216
228
        {
217
229
                global $Messages;
218
230
                global $Timer;
248
260
                                $this->plugin_errors[$ID]['register'] = $r;
249
261
                                $this->set_Plugin_status( $Plugin, 'broken' );
250
262
 
251
 
                                // unregister:
 
263
                                // unregister
252
264
                                if( $this->unregister( $Plugin ) )
253
265
                                {
254
266
                                        // debuglog-add removed
278
290
                                $Plugin = & $this->register( $classname, $ID, $priority, $apply_rendering, $classfile_path, false );
279
291
                                $this->plugin_errors[$ID]['register'] = $r;
280
292
                                $this->set_Plugin_status( $Plugin, 'broken' );
281
 
                                // unregister:
 
293
                                // unregister
282
294
                                if( $this->unregister( $Plugin ) )
283
295
                                {
284
296
                                        // debuglog-add removed
323
335
                }
324
336
                // Tell him his name :)
325
337
                $Plugin->classname = $classname;
326
 
                // Tell him his priority:
 
338
                // Tell him his priority
327
339
                if( $priority > -1 ) { $Plugin->priority = $priority; }
328
340
 
329
341
                if( isset( $apply_rendering ) )
356
368
                        $this->sorted_IDs[] = & $Plugin->ID;
357
369
                }
358
370
 
359
 
                // Init the Plugins (User)Settings members.
 
371
                // Init the Plugins (User)Settings members
360
372
                $this->init_settings( $Plugin );
361
373
 
362
 
                // Stuff only for real/existing Plugins (which exist in DB):
 
374
                // Stuff only for real/existing Plugins (which exist in DB)
363
375
                if( $Plugin->ID > 0 )
364
376
                {
365
377
                        $tmp_params = array( 'db_row' => $this->index_ID_rows[$Plugin->ID], 'is_installed' => true );
373
385
                                // Version has changed since installation or last update
374
386
                                $db_deltas = array();
375
387
 
376
 
                                // Tell the Plugin that we've detected a version change:
 
388
                                // Tell the Plugin that we've detected a version change
377
389
                                $tmp_params = array( 'old_version' => $this->index_ID_rows[$Plugin->ID]['plug_version'], 'db_row' => $this->index_ID_rows[$Plugin->ID] );
378
390
 
379
391
                                if( $this->call_method( $Plugin->ID, 'PluginVersionChanged', $tmp_params ) === false )
381
393
                                        $this->set_Plugin_status( $Plugin, 'needs_config' );
382
394
                                        if( $this->unregister( $Plugin ) )
383
395
                                        {
384
 
                                                // only unregister the Plugin, if it's not the admin list's class:
 
396
                                                // only unregister the Plugin, if it's not the admin list's class
385
397
                                                $Plugin = '';
386
398
                                        }
387
399
                                }
388
400
                                else
389
401
                                {
390
 
                                        // Check if there are DB deltas required (also when downgrading!), without excluding any query type:
 
402
                                        // Check if there are DB deltas required (also when downgrading!), without excluding any query type
391
403
                                        load_funcs( '_core/model/db/_upgrade.funcs.php' );
392
404
                                        $db_deltas = db_delta( $Plugin->GetDbLayout() );
393
405
 
398
410
                                                // No DB changes needed, update (bump or decrease) the version
399
411
                                                $Plugins_admin = & get_Cache('Plugins_admin');
400
412
 
401
 
                                                // Update version in DB:
 
413
                                                // Update version in DB
402
414
                                                $DB->query( 'UPDATE T_plugins
403
415
                                                        SET plug_version = '.$DB->quote( $Plugin->version ).'
404
416
                                                        WHERE plug_ID = '.$Plugin->ID );
405
417
 
406
 
                                                // Update "plug_version" in indexes:
 
418
                                                // Update "plug_version" in indexes
407
419
                                                $this->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;
408
420
                                                if( isset( $Plugins_admin->index_ID_rows[$Plugin->ID] ) )
409
421
                                                {
410
422
                                                        $Plugins_admin->index_ID_rows[$Plugin->ID]['plug_version'] = $Plugin->version;
411
423
                                                }
412
424
 
413
 
                                                // Remove any prerenderered content for the Plugins renderer code:
 
425
                                                // Remove any prerenderered content for the Plugins renderer code
414
426
                                                if( ! empty( $Plugin->code ) )
415
427
                                                {
416
428
                                                        $DB->query( 'DELETE FROM T_items__prerendering
417
429
                                                                WHERE itpr_renderers REGEXP "^(.*\.)?'.$DB->escape( $Plugin->code ).'(\..*)?$"' );
418
430
                                                }
419
431
 
420
 
                                                // Detect new events (and delete obsolete ones - in case of downgrade):
 
432
                                                // Detect new events (and delete obsolete ones - in case of downgrade)
421
433
                                                if( $Plugins_admin->save_events( $Plugin, array() ) )
422
434
                                                {
423
435
                                                        $this->load_events(); // re-load for the current request
430
442
 
431
443
                                                if( $this->unregister( $Plugin ) )
432
444
                                                {
433
 
                                                        // only unregister the Plugin, if it's not the admin list's class:
 
445
                                                        // only unregister the Plugin, if it's not the admin list's class
434
446
                                                        $Plugin = '';
435
447
                                                }
436
448
                                        }
451
463
                }
452
464
                else
453
465
                {
454
 
                        // This gets called for non-installed Plugins:
 
466
                        // This gets called for non-installed Plugins
455
467
                        // We're not instantiating UserSettings/Settings, since that needs a DB backend.
456
468
                        $tmp_params = array( 'db_row' => array(), 'is_installed' => false );
457
469
                        if( $Plugin->PluginInit( $tmp_params ) === false && $this->unregister( $Plugin ) )
470
482
         * Un-register a plugin
471
483
         *
472
484
         * This does not un-install it from DB, just from the internal indexes.
 
485
         *
473
486
         * @param Plugin
474
487
         * @param boolean Force unregistering (ignored here, but used in Plugins_admin)
475
488
         * @return boolean True, if unregistered
478
491
        {
479
492
                $this->forget_events( $Plugin->ID );
480
493
 
481
 
                // Unset apply-rendering index:
 
494
                // Unset apply-rendering index
482
495
                if( isset( $this->index_apply_rendering_codes[$Plugin->apply_rendering] ) )
483
496
                {
484
497
                        while( ( $key = array_search( $Plugin->code, $this->index_apply_rendering_codes[$Plugin->apply_rendering] ) ) !== false )
521
534
         * This gets used when {@link unregister() unregistering} a Plugin or if
522
535
         * {@link Plugin::PluginInit()} returned false, which means
523
536
         * "do not use it for subsequent events in the request".
 
537
         *
524
538
         * @param integer Plugin ID
525
539
         */
526
540
        function forget_events( $plugin_ID )
527
541
        {
528
 
                // Forget events:
 
542
                // Forget events
529
543
                foreach( array_keys( $this->index_event_IDs ) as $l_event )
530
544
                {
531
545
                        while( ( $key = array_search( $plugin_ID, $this->index_event_IDs[$l_event] ) ) !== false )
538
552
 
539
553
        /**
540
554
         * Init {@link Plugin::$Settings} and {@link Plugin::$UserSettings}
 
555
         *
541
556
         * @param Plugin
542
557
         */
543
558
        function init_settings( & $Plugin )
553
568
         *
554
569
         * The plugin must provide setting definitions (through {@link Plugin::GetDefaultSettings()}
555
570
         * OR {@link Plugin::GetDefaultUserSettings()}).
 
571
         *
556
572
         * @param Plugin
557
573
         * @param string settings type: "Settings" or "UserSettings"
558
574
         * @return boolean NULL, if no Settings
563
579
 
564
580
                $Timer->resume( 'plugins_inst_'.$set_type );
565
581
 
566
 
                // Call Plugin::GetDefaultSettings() or Plugin::GetDefaultUserSettings():
567
 
                // This does not use call_method, since the plugin may not be accessible through get_by_ID().
568
 
                // This may happen, if Plugin(User)Settings get accessed in PluginInit (which is allowed
569
 
                // when is_installed=true).
 
582
                // Call Plugin::GetDefaultSettings() or Plugin::GetDefaultUserSettings()
 
583
                // This does not use call_method, since the plugin may not be accessible through
 
584
                // get_by_ID(). This may happen, if Plugin(User)Settings get accessed in PluginInit
 
585
                // (which is allowed when is_installed=true).
570
586
                $method = 'GetDefault'.$set_type;
571
587
                $params = array( 'for_editing' => false );
572
588
                $Timer->resume( $Plugin->classname.'_(#'.$Plugin->ID.')' );
575
591
 
576
592
                if( empty( $defaults ) )
577
593
                {
578
 
                        // No settings, no need to instantiate.
 
594
                        // No settings, no need to instantiate
579
595
                        $Timer->pause( 'plugins_inst_'.$set_type );
580
596
                        return NULL;
581
597
                }
583
599
                if( ! is_array( $defaults ) )
584
600
                {
585
601
                        // invalid data
586
 
                        return NULL; // fp> correct me if I'm wrong.
 
602
                        return NULL; // fp> correct me if I'm wrong
587
603
                }
588
604
 
589
605
                if( $set_type == 'UserSettings' )
601
617
                        $set_Obj = & $Plugin->Settings;
602
618
                }
603
619
 
604
 
                // Register default values:
 
620
                // Register default values
605
621
                foreach( $defaults as $l_name => $l_meta )
606
622
                {
607
623
                        if( isset( $l_meta['layout'] ) )
610
626
                                continue;
611
627
                        }
612
628
 
613
 
                        // Register settings as _defaults into Settings:
 
629
                        // Register settings as _defaults into Settings
614
630
                        if( isset( $l_meta['defaultvalue'] ) )
615
631
                        {
616
632
                                $set_Obj->_defaults[$l_name] = $l_meta['defaultvalue'];
647
663
         *
648
664
         * NOTE: You'll have to call {@link restart()} or {@link load_plugins_table()}
649
665
         * before using it.
 
666
         *
650
667
         * @return Plugin (false if no more plugin).
651
668
         */
652
669
        function & get_next()
685
702
 
686
703
        /**
687
704
         * Call all plugins for a given event
 
705
         *
688
706
         * @param string event name, see {@link Plugins_admin::get_supported_events()}
689
707
         * @param array Associative array of parameters for the Plugin
690
708
         * @return boolean True, if at least one plugin has been called.
703
721
 
704
722
                        if( ! empty( $this->_stop_propagation ) )
705
723
                        {
706
 
                                // A plugin has requested to stop propagation.
 
724
                                // A plugin has requested to stop propagation
707
725
                                $this->_stop_propagation = false;
708
726
                                break;
709
727
                        }
714
732
 
715
733
        /**
716
734
         * Call all plugins for a given event, until the first one returns true
 
735
         *
717
736
         * @param string event name, see {@link Plugins_admin::get_supported_events()}
718
737
         * @param array Associative array of parameters for the Plugin
719
738
         * @return array The (modified) params array with key "plugin_ID" set to the last called plugin;
742
761
 
743
762
        /**
744
763
         * Call all plugins for a given event, until the first one returns false
 
764
         *
745
765
         * @param string event name, see {@link Plugins_admin::get_supported_events()}
746
766
         * @param array Associative array of parameters for the Plugin
747
767
         * @return array The (modified) params array with key "plugin_ID" set to the last called plugin;
771
791
        /**
772
792
         * Call all plugins for a given event, until the first one returns a value
773
793
         * (not NULL) (and $search is fulfilled, if given)
 
794
         *
774
795
         * @param string event name, see {@link Plugins_admin::get_supported_events()}
775
796
         * @param array|NULL Associative array of parameters for the Plugin
776
797
         * @param array|NULL If provided, the return value gets checks against this criteria.
822
843
 
823
844
        /**
824
845
         * Trigger an event and return an index of params
 
846
         *
825
847
         * This is handy to collect return values from all plugins hooking an event.
 
848
         *
826
849
         * @param string Event name, see {@link Plugins_admin::get_supported_events()}
827
850
         * @param array Associative array of parameters for the Plugin
828
851
         * @param string Index of $params that should get returned
840
863
 
841
864
        /**
842
865
         * The same as {@link get_trigger_event()}, but stop when the first Plugin returns true
 
866
         *
843
867
         * @param string Event name, see {@link Plugins_admin::get_supported_events()}
844
868
         * @param array Associative array of parameters for the Plugin
845
869
         * @param string Index of $params that should get returned
857
881
 
858
882
        /**
859
883
         * Trigger an event and return the first return value of a plugin
 
884
         *
860
885
         * @param string Event name, see {@link Plugins_admin::get_supported_events()}
861
886
         * @param array Associative array of parameters for the Plugin
862
887
         * @return mixed NULL if no Plugin returned something or the return value of the first Plugin
876
901
 
877
902
        /**
878
903
         * Trigger an event and return an array of all return values of the relevant plugins
 
904
         *
879
905
         * @param string Event name, see {@link Plugins_admin::get_supported_events()}
880
906
         * @param array Associative array of parameters for the Plugin
881
907
         * @param boolean Ignore {@link empty() empty} return values?
990
1016
 
991
1017
 
992
1018
        /**
993
 
         * Call a method on a Plugin.
 
1019
         * Call a method on a Plugin
994
1020
         *
995
1021
         * This makes sure that the Timer for the Plugin gets resumed.
 
1022
         *
996
1023
         * @param integer Plugin ID
997
1024
         * @param string Method name.
998
1025
         * @param array Params (by reference).
1023
1050
         * This is a wrapper around {@link call_method()}.
1024
1051
         *
1025
1052
         * fp> why doesn't call_method always check if it's deactivated?
 
1053
         *
1026
1054
         * @param integer Plugin ID
1027
1055
         * @param string Method name.
1028
1056
         * @param array Params (by reference).
1043
1071
         * T-Tag: Call a specific plugin by its code
1044
1072
         *
1045
1073
         * This will call the {@link Plugin::TemplateTag()} event handler.
 
1074
         *
1046
1075
         * @uses Plugins::get_by_code()
1047
1076
         * @uses Plugins::call_method_if_active() TemplateTag
1048
1077
         * @param string plugin code
1066
1095
 
1067
1096
        /**
1068
1097
         * Render the content of an item by calling the relevant renderer plugins
 
1098
         *
1069
1099
         * @param string content to render (by reference)
1070
1100
         * @param array renderer codes to use for opt-out, opt-in and lazy
1071
1101
         * @param string Output format, see {@link format_to_output()}. Only 'htmlbody',
1102
1132
                        {
1103
1133
                                case 'stealth':
1104
1134
                                case 'always':
1105
 
                                        $this->call_method( $loop_RendererPlugin->ID, $event, $params );
1106
 
                                        break;
 
1135
                                $this->call_method( $loop_RendererPlugin->ID, $event, $params );
 
1136
                                break;
1107
1137
 
1108
1138
                                case 'opt-out':
1109
1139
                                case 'opt-in':
1110
1140
                                case 'lazy':
1111
 
                                        if( in_array( $loop_RendererPlugin->code, $renderers ) )
1112
 
                                        {
1113
 
                                                // Option is activated
1114
 
                                                $this->call_method( $loop_RendererPlugin->ID, $event, $params );
1115
 
                                        }
1116
 
                                        // else echo 'NOOPT ';
1117
 
                                        break;
 
1141
                                if( in_array( $loop_RendererPlugin->code, $renderers ) )
 
1142
                                {
 
1143
                                        // Option is activated
 
1144
                                        $this->call_method( $loop_RendererPlugin->ID, $event, $params );
 
1145
                                }
 
1146
                                // else echo 'NOOPT ';
 
1147
                                break;
1118
1148
 
1119
1149
                                case 'never':
1120
 
                                        break; // STOP, don't render, go to next renderer
 
1150
                                break; // STOP, don't render, go to next renderer
1121
1151
                        }
1122
1152
                }
1123
1153
 
1127
1157
 
1128
1158
        /**
1129
1159
         * Quick-render a string with a single plugin and format it for output
 
1160
         *
1130
1161
         * @todo (0000) rename
1131
1162
         * @see format_to_output()
1132
1163
         * @param string Plugin code (must have render() method)
1147
1178
                $Plugin = & $this->get_by_code( $plugin_code );
1148
1179
                if( $Plugin )
1149
1180
                {
1150
 
                        // Get the most appropriate handler:
 
1181
                        // Get the most appropriate handler
1151
1182
                        $events = $this->get_enabled_events( $Plugin->ID );
1152
1183
                        $event = false;
1153
1184
                        if( $params['format'] == 'htmlbody' || $params['format'] == 'htmlentityencoded' )
1198
1229
 
1199
1230
                foreach( $DB->get_results( $this->sql_load_plugins_table, ARRAY_A ) as $row )
1200
1231
                {
1201
 
                        // Loop through installed plugins:
 
1232
                        // Loop through installed plugins
1202
1233
                        $this->index_ID_rows[$row['plug_ID']] = $row; // remember the rows to instantiate the Plugin on request
1203
1234
                        if( ! empty( $row['plug_code'] ) )
1204
1235
                        {
1217
1248
         * Get a specific plugin by its ID
1218
1249
         *
1219
1250
         * This is the workhorse when it comes to lazy-instantiating a Plugin.
 
1251
         *
1220
1252
         * @param integer plugin ID
1221
1253
         * @return Plugin (false in case of error)
1222
1254
         */
1238
1270
 
1239
1271
                        $row = & $this->index_ID_rows[$plugin_ID];
1240
1272
 
1241
 
                        // Register the plugin:
 
1273
                        // Register the plugin
1242
1274
                        $Plugin = & $this->register( $row['plug_classname'], $row['plug_ID'], $row['plug_priority'], $row['plug_apply_rendering'] );
1243
1275
 
1244
1276
                        if( is_string( $Plugin ) )
1256
1288
 
1257
1289
        /**
1258
1290
         * Get a plugin by its classname
 
1291
         *
1259
1292
         * @param string
1260
1293
         * @return Plugin (false in case of error)
1261
1294
         */
1278
1311
 
1279
1312
        /**
1280
1313
         * Get a specific Plugin by its code
 
1314
         *
1281
1315
         * @param string plugin code
1282
1316
         * @return Plugin (false in case of error)
1283
1317
         */
1307
1341
 
1308
1342
        /**
1309
1343
         * Get a list of Plugins for a given event
 
1344
         *
1310
1345
         * @param string Event name
1311
1346
         * @return array plugin_ID => & Plugin
1312
1347
         */
1332
1367
 
1333
1368
        /**
1334
1369
         * Get a list of Plugins for a list of events. Every Plugin is only once in this list
 
1370
         *
1335
1371
         * @param array Array of events
1336
1372
         * @return array plugin_ID => & Plugin
1337
1373
         */
1357
1393
 
1358
1394
        /**
1359
1395
         * Get a list of plugins that provide all given events
 
1396
         *
1360
1397
         * @return array plugin_ID => & Plugin
1361
1398
         */
1362
1399
        function get_list_by_all_events( $events )
1401
1438
 
1402
1439
        /**
1403
1440
         * Get a list of (enabled) events for a given Plugin ID
 
1441
         *
1404
1442
         * @param integer Plugin ID
1405
1443
         * @return array
1406
1444
         */
1420
1458
 
1421
1459
        /**
1422
1460
         * Has a plugin a specific event registered and enabled?
 
1461
         *
1423
1462
         * @param integer
1424
1463
         * @param string
1425
1464
         * @return boolean
1433
1472
 
1434
1473
        /**
1435
1474
         * Check if the requested list of events is provided by any or one plugin
 
1475
         *
1436
1476
         * @param array|string A single event or a list thereof
1437
 
         * @param boolean Make sure there's at least one plugin that provides them all? This is useful for
1438
 
         * event pairs like "CaptchaPayload" and "CaptchaValidated", which should be served by the same plugin.
 
1477
         * @param boolean Make sure there's at least one plugin that provides them all?
 
1478
         * This is useful for event pairs like "CaptchaPayload" and "CaptchaValidated",
 
1479
         * which should be served by the same plugin.
1439
1480
         * @return boolean
1440
1481
         */
1441
1482
        function are_events_available( $events, $require_all_in_same_plugin = false )
1455
1496
 
1456
1497
 
1457
1498
        /**
1458
 
         * (Re)load Plugin Events for enabled (normal use) or all (admin use) plugins.
 
1499
         * (Re)load Plugin Events for enabled (normal use) or all (admin use) plugins
1459
1500
         */
1460
1501
        function load_events()
1461
1502
        {
1474
1515
 
1475
1516
 
1476
1517
        /**
 
1518
         * Load an object from a Cache plugin or create a new one 
 
1519
         *
 
1520
         * Load an object from a Cache plugin or create a new one if we have a cache miss
 
1521
         * or no caching plugins. It registers a shutdown function, that refreshes the
 
1522
         * data to the cache plugin which is not optimal, but we have no hook to see if
 
1523
         * data retrieved from a {@link DataObjectCache} derived class has changed.
1477
1524
         * Load an object from a Cache plugin or create a new one if we have a
1478
1525
         * cache miss or no caching plugins.
1479
1526
         *
1480
 
         * It registers a shutdown function, that refreshes the data to the cache plugin
1481
 
         * which is not optimal, but we have no hook to see if data retrieved from
1482
 
         * a {@link DataObjectCache} derived class has changed.
1483
1527
         * @param string object name
1484
1528
         * @param string eval this to create the object. Default is to create an object of class $objectName.
1485
1529
         * @return boolean True, if retrieved from cache; false if not
1503
1547
                        }
1504
1548
                }
1505
1549
 
1506
 
                // Cache miss, create it:
 
1550
                // Cache miss, create it
1507
1551
                if( empty( $eval_create_object ) )
1508
1552
                {
1509
1553
                        $GLOBALS[$objectName] = new $objectName(); // COPY (FUNC)
1513
1557
                        eval( '$GLOBALS[\''.$objectName.'\'] = '.$eval_create_object.';' );
1514
1558
                }
1515
1559
 
1516
 
                // Try to set in cache:
 
1560
                // Try to set in cache
1517
1561
                $set_return = $this->trigger_event_first_true( 'CacheObjects',
1518
1562
                        array( 'action' => 'set', 'key' => 'object_'.$objectName, 'data' => & $GLOBALS[$objectName] ) );
1519
1563
 
1530
1574
 
1531
1575
 
1532
1576
        /**
1533
 
         * Callback, which gets used for {@link Results}.
 
1577
         * Callback, which gets used for {@link Results}
1534
1578
         *
1535
1579
         * @return Plugin (false in case of error)
1536
1580
         */
1542
1586
 
1543
1587
        /**
1544
1588
         * Validate renderer list
 
1589
         *
1545
1590
         * @param array renderer codes ('default' will include all "opt-out"-ones)
1546
1591
         * @return array validated array of renderer codes
1547
1592
         */
1584
1629
                                }
1585
1630
                        }
1586
1631
                }
 
1632
 
1587
1633
                if( isset( $index['lazy'] ) )
1588
1634
                {
1589
1635
                        foreach( $index['lazy'] as $l_code )
1595
1641
                        }
1596
1642
                }
1597
1643
 
1598
 
                // Make sure there's no renderer code with a dot, as the list gets imploded by that when saved:
 
1644
                // Make sure there's no renderer code with a dot, as the list gets imploded by that when saved
1599
1645
                foreach( $validated_renderers as $k => $l_code )
1600
1646
                {
1601
1647
                        if( empty( $l_code ) || strpos( $l_code, '.' ) !== false )