本文整理匯總了PHP中Overloadable::overload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Overloadable::overload方法的具體用法?PHP Overloadable::overload怎麽用?PHP Overloadable::overload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Overloadable
的用法示例。
在下文中一共展示了Overloadable::overload方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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');
示例2: compact
{
//trigger_error(__('(Model::findCount) Deprecated, use Model::find("count")', true), E_USER_WARNING);
return $this->find('count', compact('conditions', 'recursive'));
}
/**
* @deprecated
* @see Model::find('threaded')
*/
function findAllThreaded($conditions = null, $fields = null, $order = null)
{
//trigger_error(__('(Model::findAllThreaded) Deprecated, use Model::find("threaded")', true), E_USER_WARNING);
return $this->find('threaded', compact('conditions', 'fields', 'order'));
}
/**
* @deprecated
* @see Model::find('neighbors')
*/
function findNeighbours($conditions = null, $field, $value)
{
//trigger_error(__('(Model::findNeighbours) Deprecated, use Model::find("neighbors")', true), E_USER_WARNING);
$query = compact('conditions', 'field', 'value');
$query['fields'] = $field;
if (is_array($field)) {
$query['field'] = $field[0];
}
return $this->find('neighbors', $query);
}
}
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
Overloadable::overload('Model');
}
示例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);
}
}
示例4: __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);
}
}
示例5: 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);
}
示例6: __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);
}
}
示例7: 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;
}