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


PHP Overloadable类代码示例

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


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

示例1: overload

                        overload(get_class($class));
                    } elseif (is_string($class)) {
                        overload($class);
                    }
                }
            } else {
                overload(get_class($this));
            }
        }
    }
    function __call($method, $params, &$return)
    {
        if (!method_exists($this, 'call__')) {
            trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
        }
        $return = $this->call__($method, $params);
        return true;
    }
    function __get($name, &$value)
    {
        $value = $this->get__($name);
        return true;
    }
    function __set($name, $value)
    {
        $this->set__($name, $value);
        return true;
    }
}
Overloadable::overload('Overloadable2');
开发者ID:vuong93st,项目名称:w-game,代码行数:30,代码来源:overloadable_php4.php

示例2: __overload

 /**
  * Used to overload objects as needed.
  *
  * @param string $type Model or Helper
  * @param string $name Class name to overload
  * @access private
  */
 function __overload($type, $name, $parent)
 {
     if (($type === 'Model' || $type === 'Helper') && $parent !== false) {
         Overloadable::overload($name);
     }
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:13,代码来源:configure.php

示例3: __overload

 /**
  * Used to overload objects as needed.
  *
  * @param string $type Model or Helper
  * @param string $name Class name to overload
  * @access private
  */
 function __overload($type, $name)
 {
     if (($type === 'Model' || $type === 'Helper') && strtolower($name) != 'schema') {
         Overloadable::overload($name);
     }
 }
开发者ID:afzet,项目名称:connectivo-crm,代码行数:13,代码来源:configure.php

示例4: loadPluginModels

/**
 * @deprecated
 * @see App::import('Model', 'PluginName.PluginModel');
 */
function loadPluginModels($plugin)
{
    if (!class_exists('AppModel')) {
        loadModel();
    }
    $plugin = Inflector::underscore($plugin);
    $pluginAppModel = Inflector::camelize($plugin . '_app_model');
    $pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php';
    if (!class_exists($pluginAppModel)) {
        if (file_exists($pluginAppModelFile)) {
            require $pluginAppModelFile;
            Overloadable::overload($pluginAppModel);
        }
    }
    $pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS;
    if (is_dir($pluginModelDir)) {
        foreach (listClasses($pluginModelDir) as $modelFileName) {
            list($name) = explode('.', $modelFileName);
            $className = Inflector::camelize($name);
            if (!class_exists($className)) {
                require $pluginModelDir . $modelFileName;
                Overloadable::overload($className);
            }
        }
    }
    trigger_error('loadPluginModels is deprecated see App::import(\'Model\', \'PluginName.PluginModel\');', E_USER_WARNING);
}
开发者ID:kaz0636,项目名称:openflp,代码行数:31,代码来源:basics.php

示例5: __overload

 /**
  * Used to overload Objects as needed
  *
  * @param string $type Model or Helper
  * @param string $name Class name to overload
  * @access private
  */
 function __overload($type, $name)
 {
     $overload = array('Model', 'Helper');
     if (in_array($type, $overload)) {
         Overloadable::overload($name);
     }
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:14,代码来源:configure.php

示例6: loadHelper

/**
 * Loads a helper
 *
 * @param string $name Name of helper
 * @return boolean Success
 */
function loadHelper($name)
{
    if (!class_exists('AppHelper')) {
        if (file_exists(APP . 'app_helper.php')) {
            require APP . 'app_helper.php';
        } else {
            require CAKE . 'app_helper.php';
        }
        Overloadable::overload('AppHelper');
    }
    if ($name === null) {
        return true;
    }
    if (strpos($name, '.') !== false) {
        list($plugin, $name) = explode('.', $name);
    }
    $className = $name . 'Helper';
    if (!class_exists($className)) {
        $name = Inflector::underscore($name);
        $helpers = Configure::read('Helpers');
        if (is_array($helpers)) {
            if (array_key_exists($className, $helpers)) {
                require $helpers[$className]['path'];
                return true;
            } elseif (isset($helpers['Core']) && array_key_exists($className, $helpers['Core'])) {
                require $helpers['Core'][$className]['path'];
                return true;
            }
        }
        $paths = Configure::getInstance();
        foreach ($paths->helperPaths as $path) {
            if (file_exists($path . $name . '.php')) {
                Configure::store('Helpers', 'class.paths', array($className => array('path' => $path . $name . '.php')));
                require $path . $name . '.php';
                return true;
            }
        }
        if ($helperFilename = fileExistsInPath(LIBS . 'view' . DS . 'helpers' . DS . $name . '.php')) {
            if (file_exists($helperFilename)) {
                Configure::store('Helpers\'][\'Core', 'class.paths', array($className => array('path' => $helperFilename)));
                require $helperFilename;
                return true;
            } else {
                return false;
            }
        }
        return false;
    }
    return true;
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:56,代码来源:basics.php

示例7: extract

 /**
  * Constructor. Binds the model's database table to the object.
  *
  * @param integer $id Set this ID for this model on startup
  * @param string $table Name of database table to use.
  * @param object $ds DataSource connection object.
  */
 function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct();
     if (is_array($id)) {
         extract(array_merge(array('id' => $this->id, 'table' => $this->useTable, 'ds' => $this->useDbConfig, 'name' => $this->name, 'alias' => $this->alias), $id));
     }
     if ($this->name === null) {
         $this->name = isset($name) ? $name : get_class($this);
     }
     if ($this->alias === null) {
         $this->alias = isset($alias) ? $alias : $this->name;
     }
     if ($this->primaryKey === null) {
         $this->primaryKey = 'id';
     }
     ClassRegistry::addObject($this->alias, $this);
     $this->id = $id;
     unset($id);
     if ($table === false) {
         $this->useTable = false;
     } elseif ($table) {
         $this->useTable = $table;
     }
     if (is_subclass_of($this, 'AppModel')) {
         $appVars = get_class_vars('AppModel');
         $merge = array('_findMethods');
         if ($this->actsAs !== null || $this->actsAs !== false) {
             $merge[] = 'actsAs';
         }
         $parentClass = get_parent_class($this);
         if (strtolower($parentClass) !== 'appmodel') {
             $parentVars = get_class_vars($parentClass);
             foreach ($merge as $var) {
                 if (isset($parentVars[$var]) && !empty($parentVars[$var])) {
                     $appVars[$var] = Set::merge($appVars[$var], $parentVars[$var]);
                 }
             }
         }
         foreach ($merge as $var) {
             if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
                 $this->{$var} = Set::merge($appVars[$var], $this->{$var});
             }
         }
     }
     $this->Behaviors = new BehaviorCollection();
     if ($this->useTable !== false) {
         $this->setDataSource($ds);
         if ($this->useTable === null) {
             $this->useTable = Inflector::tableize($this->name);
         }
         if (method_exists($this, 'setTablePrefix')) {
             $this->setTablePrefix();
         }
         $this->setSource($this->useTable);
         if ($this->displayField == null) {
             $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey));
         }
     } elseif ($this->table === false) {
         $this->table = Inflector::tableize($this->name);
     }
     $this->__createLinks();
     $this->Behaviors->init($this->alias, $this->actsAs);
 }
开发者ID:masayukiando,项目名称:cakephp1.3-mailmagazine,代码行数:70,代码来源:model.php

示例8: extract

 /**
  * Constructor. Binds the Model's database table to the object.
  *
  * @param integer $id Set this ID for this model on startup
  * @param string $table Name of database table to use.
  * @param object $ds DataSource connection object.
  */
 function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct();
     if (is_array($id)) {
         extract(array_merge(array('id' => false, 'table' => null, 'ds' => null, 'name' => null, 'alias' => null), $id));
         $this->name = $name;
         $this->alias = $alias;
     }
     if ($this->name === null) {
         $this->name = get_class($this);
     }
     if ($this->alias === null) {
         $this->alias = $this->name;
     }
     if ($this->primaryKey === null) {
         $this->primaryKey = 'id';
     }
     ClassRegistry::addObject($this->alias, $this);
     $this->id = $id;
     unset($id);
     if ($table === false) {
         $this->useTable = false;
     } elseif ($table) {
         $this->useTable = $table;
     }
     if ($this->useTable !== false) {
         $this->setDataSource($ds);
         if ($this->useTable === null) {
             $this->useTable = Inflector::tableize($this->name);
         }
         if (in_array('settableprefix', get_class_methods($this))) {
             $this->setTablePrefix();
         }
         $this->setSource($this->useTable);
         $this->__createLinks();
         if ($this->displayField == null) {
             $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey));
         }
     }
     if (is_subclass_of($this, 'AppModel')) {
         $appVars = get_class_vars('AppModel');
         $merge = array();
         if ($this->actsAs !== null || $this->actsAs !== false) {
             $merge[] = 'actsAs';
         }
         foreach ($merge as $var) {
             if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
                 $this->{$var} = Set::merge($appVars[$var], $this->{$var});
             }
         }
     }
     $this->Behaviors = new BehaviorCollection();
     $this->Behaviors->init($this->alias, $this->actsAs);
 }
开发者ID:BLisa90,项目名称:cakecart,代码行数:61,代码来源:model.php

示例9: am

 /**
  * Constructor. Binds the Model's database table to the object.
  *
  * @param integer $id
  * @param string $table Name of database table to use.
  * @param DataSource $ds DataSource connection object.
  */
 function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct();
     if (is_array($id) && isset($id['name'])) {
         $options = am(array('id' => false, 'table' => null, 'ds' => null, 'alias' => null), $id);
         list($id, $table, $ds) = array($options['id'], $options['table'], $options['ds']);
         $this->name = $options['name'];
     }
     if ($this->name === null) {
         $this->name = get_class($this);
     }
     if ($this->primaryKey === null) {
         $this->primaryKey = 'id';
     }
     if (isset($options['alias']) || !empty($options['alias'])) {
         $this->currentModel = Inflector::underscore($options['alias']);
         unset($options);
     } else {
         $this->currentModel = Inflector::underscore($this->name);
     }
     ClassRegistry::addObject($this->currentModel, $this);
     ClassRegistry::map($this->currentModel, $this->currentModel);
     $this->id = $id;
     unset($id);
     if ($table === false) {
         $this->useTable = false;
     } elseif ($table) {
         $this->useTable = $table;
     }
     if ($this->useTable !== false) {
         $this->setDataSource($ds);
         if ($this->useTable === null) {
             $this->useTable = Inflector::tableize($this->name);
         }
         if (in_array('settableprefix', get_class_methods($this))) {
             $this->setTablePrefix();
         }
         $this->setSource($this->useTable);
         $this->__createLinks();
         if ($this->displayField == null) {
             if ($this->hasField('title')) {
                 $this->displayField = 'title';
             }
             if ($this->hasField('name')) {
                 $this->displayField = 'name';
             }
             if ($this->displayField == null) {
                 $this->displayField = $this->primaryKey;
             }
         }
     }
     if (is_subclass_of($this, 'AppModel')) {
         $appVars = get_class_vars('AppModel');
         $actsAs = $appVars['actsAs'];
         $merge = array('actsAs');
         if ($this->actsAs !== null || $this->actsAs !== false) {
             $merge[] = 'actsAs';
         }
         foreach ($merge as $var) {
             if (isset($appVars[$var]) && !empty($appVars[$var]) && is_array($this->{$var})) {
                 $this->{$var} = array_merge($this->{$var}, array_diff($appVars[$var], $this->{$var}));
             }
         }
     }
     if ($this->actsAs !== null && empty($this->behaviors)) {
         $callbacks = array('setup', 'beforeFind', 'afterFind', 'beforeSave', 'afterSave', 'beforeDelete', 'afterDelete', 'afterError');
         $this->actsAs = Set::normalize($this->actsAs);
         foreach ($this->actsAs as $behavior => $config) {
             $className = $behavior . 'Behavior';
             if (!loadBehavior($behavior)) {
                 // Raise an error
             } else {
                 if (ClassRegistry::isKeySet($className)) {
                     if (PHP5) {
                         $this->behaviors[$behavior] = ClassRegistry::getObject($className);
                     } else {
                         $this->behaviors[$behavior] =& ClassRegistry::getObject($className);
                     }
                 } else {
                     if (PHP5) {
                         $this->behaviors[$behavior] = new $className();
                     } else {
                         $this->behaviors[$behavior] =& new $className();
                     }
                     ClassRegistry::addObject($className, $this->behaviors[$behavior]);
                 }
                 $this->behaviors[$behavior]->setup($this, $config);
                 $methods = $this->behaviors[$behavior]->mapMethods;
                 foreach ($methods as $method => $alias) {
                     if (!array_key_exists($method, $this->__behaviorMethods)) {
                         $this->__behaviorMethods[$method] = array($alias, $behavior);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:101,代码来源:model.php


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