Exemplo n.º 1
0
 /**
  * Import a helper (aka "template plugin").
  * @param string $name Helper name
  *
  */
 function &import_helper($name)
 {
     foreach (func_get_args() as $name) {
         $class =& Factory::plugin($name, 'template');
         if ($class === false) {
             trigger_error("Helper {$name} does not exist");
             die;
         }
     }
     if ($class) {
         return $class;
     }
 }
Exemplo n.º 2
0
 /**
  * Load another plugin as a dependency of this one.  Plugins can
  * only load dependencies of their own kind.  Templates plugins
  * load template plugins, page plugins load page plugins.
  *
  * @param string $plugin The name of the plugin to import.  Will be
  *                       saved as $this->depends->$plugin
  */
 function depend($plugin)
 {
     switch (substr(get_class($this), 0, 2)) {
         case 'tp':
             $type = 'template';
             break;
         case 'pp':
             $type = 'page';
             break;
     }
     foreach (func_get_args() as $arg) {
         $this->depends->{$arg} =& Factory::plugin($arg, $type);
     }
 }
Exemplo n.º 3
0
// TODO: this should be unset, left for back-compat for now...
//unset($db);
/************************************************************************
 * INTERNATIONALIZATION
 ************************************************************************/
$i18n = new I18N();
$i18n->autoset_language('en');
define('LANG', $i18n->get_language());
Registry::set('pronto:i18n', $i18n);
unset($i18n);
/************************************************************************
 * PRELOAD PLUGINS
 ************************************************************************/
foreach (explode(' ', PLUGINS) as $p) {
    if ($p) {
        Factory::plugin($p, 'page');
    }
}
unset($p);
// left in the symbol table for the cmdline script
$plugins =& Registry::get('pronto:plugins');
/************************************************************************
 * REMAINING UTILITY CLASSES
 ************************************************************************/
$p = new Validator();
Registry::set('pronto:validator', $p);
unset($p);
/************************************************************************
 * HANDLE ERRORS/DEBUGGING/PROFILING
 ************************************************************************/
error_reporting(E_ALL & ~E_NOTICE);
Exemplo n.º 4
0
 /**
  * Import a plugin (aka "page plugin").
  * @param string $name Plugin name
  */
 function &import_plugin($name)
 {
     foreach (func_get_args() as $name) {
         $class =& Factory::plugin($name, 'page');
         if ($class === false) {
             trigger_error("Plugin {$name} does not exist");
             die;
         }
     }
     // reload $this->plugins
     $this->plugins =& Registry::get('pronto:plugins');
     if ($class) {
         return $class;
     }
 }
Exemplo n.º 5
0
 /**
  * Return a new helper (aka "template plugin") object
  * If an existing helper object already exists, it will be used.
  *
  * @param string $name
  * @return object
  */
 function &helper($name)
 {
     return Factory::plugin($name, 'template');
 }