当前位置: 首页>>代码示例>>PHP>>正文


PHP __autoload函数代码示例

本文整理汇总了PHP中__autoload函数的典型用法代码示例。如果您正苦于以下问题:PHP __autoload函数的具体用法?PHP __autoload怎么用?PHP __autoload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了__autoload函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 function run()
 {
     global $SITE, $DB, $Templates;
     $_POST->setType('vis', 'any', true);
     $_POST->setType('def', 'string', true);
     $_REQUEST->setType('upd', 'any');
     $properties = $DB->setset->asArray(false, false, false, false, 'property');
     if ($_POST['def']) {
         $vis = $_POST['vis'];
         $def = $_POST['def'];
         foreach ($properties as $property) {
             $property = $property['property'];
             Settings::changeSetting($property, false, false, $vis[$property]);
             $SITE->settings[$property] = $def[$property];
         }
         redirect(url(array('upd' => 1), true));
     }
     if ($_REQUEST['upd']) {
         Flash::create(__('Settings updated'), 'confirmation');
     }
     __autoload('Form');
     $TRs = array();
     $settings_types = array(__('Administrator-specified'), __('User level, pre-specified'), __('User level, self-specified'), __('User- or group level, pre-specified'), __('User- or group level , self-specified'), __('Group level, pre-specified'), __('Group level, self-specified'));
     foreach ($properties as $property) {
         $TRs[] = new Tablerow(Settings::name($property['property']), new Select(false, 'vis[' . $property['property'] . ']', $settings_types, $property['visible']), Settings::display($property['type'], false, 'def[' . $property['property'] . ']', $SITE->settings[$property['property']], $property['description'], $property['set']));
     }
     $form = new Form('sitesettings');
     $this->setContent('header', __('Default user settings'));
     $this->setContent('main', $form->collection(new Table(new Tableheader(__('Property'), __('Type'), __('Property default')), $TRs)));
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:31,代码来源:UserSettings.php

示例2: tabularize

 function tabularize($ids, $fields)
 {
     global $Controller;
     __autoload('Table');
     $r = array(new Tableheader($fields));
     foreach ($ids as $id) {
         $row = array();
         foreach ($fields as $field) {
             switch ($field) {
                 case 'attendance':
                     $row[] = new Table(new Tablerow(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null));
                     break;
                 case 'group':
                     $s = (array) @$this->interesting_groups;
                     $ig = array();
                     foreach ($s as $g) {
                         $g = $Controller->get($g, OVERRIDE, false, true, 'Group');
                         if ($g && $g->isMember($id)) {
                             $ig[] = $g;
                         }
                     }
                     $row[] = implode(',', $ig);
                     break;
                 default:
                     $row[] = $Controller->get($id)->userinfo[$field];
                     break;
             }
         }
         $r[] = new Tablerow($row);
     }
     return new Table($r);
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:32,代码来源:Matrikel.php

示例3: factory

 /**
  * Craft new object
  *
  * @param string $name
  * @param array $params
  * @param string $func
  * @return object
  */
 public static function factory($name, $params = null, $func = '__instance')
 {
     if (!class_exists($name) && is_callable("__autoload")) {
         __autoload($name);
     }
     if (class_exists($name)) {
         if (is_callable(array($name, $func))) {
             return call_user_func_array(array($name, $func), $params);
             // метод $name::$func вызван статично
         } else {
             if (!$params) {
                 // пытаемся сэкономить время
                 return new $name();
             } else {
                 $reflection = new ReflectionClass($name);
                 return $reflection->newInstanceArgs($params);
             }
         }
     } else {
         $factory = ucfirst($name) . "Factory";
         if (!class_exists($factory) && is_callable("__autoload")) {
             __autoload($factory);
         }
         if (class_exists($factory) && is_callable(array($factory, "factory"), true)) {
             return call_user_func_array(array($factory, "factory"), $params);
         }
     }
     // если мы до сюда дошли и ничего не вернули то бросаем исключение
     throw new FactoryException("Class '{$name}' doesn't declared and can't be loaded so does it's factory");
 }
开发者ID:manachyn,项目名称:trainings,代码行数:38,代码来源:Factory2.php

示例4: feng__autoload

/**
 * Gets called, when an undefined class is being instanciated
 *d
 * @param_string $load_class_name
 */
function feng__autoload($load_class_name)
{
    static $loader = null;
    $class_name = strtoupper($load_class_name);
    // Try to get this data from index...
    if (isset($GLOBALS[AutoLoader::GLOBAL_VAR])) {
        if (isset($GLOBALS[AutoLoader::GLOBAL_VAR][$class_name])) {
            return include $GLOBALS[AutoLoader::GLOBAL_VAR][$class_name];
        }
        // if
    }
    // if
    if (!$loader) {
        $loader = new AutoLoader();
        $loader->addDir(ROOT . '/application');
        $loader->addDir(ROOT . '/environment');
        $loader->addDir(ROOT . '/library');
        $loader->setIndexFilename(ROOT . '/cache/autoloader.php');
    }
    // if
    try {
        $loader->loadClass($class_name);
    } catch (Exception $e) {
        try {
            if (function_exists("__autoload")) {
                __autoload($class_name);
            }
        } catch (Exception $ex) {
            die('Caught Exception in AutoLoader: ' . $ex->__toString());
        }
    }
    // try
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:38,代码来源:functions.php

示例5: mover

 function mover()
 {
     __autoload('Form');
     $this->setContent('header', __('Moving ' . strtolower(get_class($this->that))) . ': ' . $this->that->basename);
     $_REQUEST->addType('to', '#^\\$$#');
     // Placeholder
     return new Formsection(__('Select destination'), $this->fullStructure(url(array('to' => '$'), array('id', 'action'))));
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:8,代码来源:FileMover.php

示例6: model_exists

/**
 * Checks to see if the specified model exists.
 */
function model_exists($model)
{
    try {
        __autoload(ucfirst($model));
    } catch (ClassException $e) {
        return false;
    }
    return true;
}
开发者ID:asteig,项目名称:rabidcore,代码行数:12,代码来源:bootstrapper.php

示例7: run

 function run()
 {
     __autoload('Form');
     if ($this->saveChanges()) {
         redirect(array('id' => $this->that->ID));
     }
     global $Templates;
     $this->setContent('main', Form::quick(false, null, $this->editTab()));
     $Templates->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:10,代码来源:PageEditor.php

示例8: __construct

 /**
  * Constructor - Extracts its name and instanciates the corresponding model
  */
 public function __construct()
 {
     // Détection du nom du contrôleur
     preg_match('#^(.*)_Controller$#', get_class($this), $match);
     $this->name = $match[1];
     // Chargement du modèle s'il existe
     $model_name = $this->name . '_Model';
     if (__autoload($model_name)) {
         $this->model = new $model_name();
     }
 }
开发者ID:Godefroy,项目名称:confeature,代码行数:14,代码来源:class.Controller.php

示例9: run

 function run()
 {
     __autoload('Form');
     if ($this->saveChanges()) {
         redirect(array('id' => $this->that->ID));
     }
     global $Templates;
     $this->setContent('header', __('Edit calendar-viewer settings'));
     $this->setContent('main', Form::quick(false, null, $this->editTab()));
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:11,代码来源:CalendarViewerEditor.php

示例10: registry

 /**
  * This is a simple registry of objects created by the application. This
  * method makes use of the registry design pattern to create objects
  * @param string $name The class name
  * @return object Will return an object of the class
  */
 public function registry($name)
 {
     # Check if the object has already been created
     if (!isset($this->objects[$name])) {
         # Load the class
         __autoload($name);
         # Create an object of the class
         $this->objects[$name] = new $name();
     }
     # Return the object of the class
     return $this->objects[$name];
 }
开发者ID:swordfishtest,项目名称:bootstart,代码行数:18,代码来源:bootstart.php

示例11: getLogger

 function getLogger()
 {
     if (isset($this->logger)) {
         return $this->logger;
     }
     isset(self::$logStream) || (self::$logStream = fopen(self::$logFile, 'ab'));
     // http://bugs.php.net/42098 workaround
     class_exists('Patchwork\\Logger') || eval(';') || __autoload('Patchwork\\Logger');
     $l = new Logger(self::$logStream, $_SERVER['REQUEST_TIME_FLOAT']);
     $l->lock = false;
     $l->lineFormat = sprintf('%010d', substr(mt_rand(), -10)) . ": %s";
     return $this->logger = $l;
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-sandbox,代码行数:13,代码来源:ErrorHandler.php

示例12: maksa_ps_autoload

function maksa_ps_autoload($className)
{
    $path = str_replace(array("_", "\\"), "/", $className);
    $parts = explode('/', $path);
    if ($parts[0] == 'Ulink') {
        require_once '../ulink/src/' . $path . ".php";
        return true;
    } else {
        if (function_exists('__autoload') and __autoload($className)) {
            return true;
        }
    }
    return false;
}
开发者ID:ribozz,项目名称:maksa_prestashop_module,代码行数:14,代码来源:UlinkService.php

示例13: GetPager

 public function GetPager($PagerType, $Sender)
 {
     $PagerType = $PagerType . 'Module';
     if (!class_exists($PagerType, FALSE)) {
         __autoload($PagerType);
     }
     if (!class_exists($PagerType, FALSE)) {
         $PagerType = 'PagerModule';
         __autoload($PagerType);
     }
     if (!class_exists($PagerType, FALSE)) {
         return FALSE;
     }
     return new $PagerType($Sender);
 }
开发者ID:kerphi,项目名称:Garden,代码行数:15,代码来源:class.pagerfactory.php

示例14: writeEvent

 function writeEvent($type, $data)
 {
     if ('php-error' === $type || 'php-exception' === $type) {
         \Patchwork::setMaxage(0);
         \Patchwork::setExpires('onmaxage');
         $GLOBALS['patchwork_private'] = true;
     }
     if ($this->isFirstEvent) {
         // http://bugs.php.net/42098 workaround
         class_exists('Patchwork\\PHP\\Walker') || eval(';') || __autoload('Patchwork\\PHP\\Walker');
         class_exists('Patchwork\\PHP\\Dumper') || eval(';') || __autoload('Patchwork\\PHP\\Dumper');
         class_exists('Patchwork\\PHP\\JsonDumper') || eval(';') || __autoload('Patchwork\\PHP\\JsonDumper');
         $data['patchwork'] = array('i18n' => PATCHWORK_I18N, 'debug' => DEBUG, 'turbo' => Superloader::$turbo, 'level' => PATCHWORK_PATH_LEVEL, 'zcache' => PATCHWORK_ZCACHE, 'paths' => $GLOBALS['patchwork_path']);
     }
     return parent::writeEvent($type, $data);
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-sandbox,代码行数:16,代码来源:Logger.php

示例15: feng__autoload

/**
 * Gets called, when an undefined class is being instanciated
 *d
 * @param_string $load_class_name
 */
function feng__autoload($load_class_name) {
	static  $loader ;
	//$loader = null;
	$class_name = strtoupper($load_class_name);

	// Try to get this data from index...
	if(isset($GLOBALS[AutoLoader::GLOBAL_VAR])) {
		if(isset($GLOBALS[AutoLoader::GLOBAL_VAR][$class_name])) {
			return include $GLOBALS[AutoLoader::GLOBAL_VAR][$class_name];
		} // if
	} // if
	//pre_print_r($loader) ;exit;
	
	if(!$loader) {
		$loader = new AutoLoader();
		$loader->addDir(ROOT . '/application');
		$loader->addDir(ROOT . '/environment');
		$loader->addDir(ROOT . '/library');
		
		//TODO Pepe: No tengo la conexion ni las clases de DB en este momento.. me conecto derecho 
		$temp_link  = mysql_connect(DB_HOST, DB_USER, DB_PASS) ;
		mysql_select_db(DB_NAME) ;
		$res = mysql_query("SELECT name FROM ".TABLE_PREFIX."plugins WHERE is_installed = 1 AND is_activated = 1;");
		while ($row = mysql_fetch_object($res)) {	
			$plugin_name =  strtolower($row->name) ;
			$dir  = ROOT . '/plugins/'.$plugin_name.'/application' ;
			if (is_dir($dir)) {
				$loader->addDir($dir); 
			}
		}
		mysql_close($temp_link);
		
		
		$loader->setIndexFilename(CACHE_DIR . '/autoloader.php');
		
	} // if

	try {
		$loader->loadClass($class_name);
	} catch(Exception $e) {
		try {
			if (function_exists("__autoload")) __autoload($class_name);
		} catch(Exception $ex) {
			die('Caught Exception in AutoLoader: ' . $ex->__toString());
		}
	} // try
} // __autoload
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:52,代码来源:functions.php


注:本文中的__autoload函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。