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


PHP overload函数代码示例

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


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

示例1: initialize

 function initialize()
 {
     # setup database configuration
     if (!$this->_table_name) {
         if (!$this->_base_class) {
             $class = get_class($this);
             while (get_parent_class($class) && !preg_match('/_Base$/i', get_parent_class($class))) {
                 $class = get_parent_class($class);
             }
             $this->_base_class = $class;
         }
         $this->_table_name = Inflector::tableize($this->_base_class);
     }
     $this->_type_name = get_class($this);
     $this->_columns = AdoDBRecord_Tools::get_columns();
     # dynamically overload current class in PHP4 because it doesn't
     # propagate through the class hierarchy
     if (version_compare(PHP_VERSION, "5.0.0") < 0) {
         $const = "OVERLOADED_" . $this->_type_name;
         if (!defined($const)) {
             define($const, $const);
             overload($this->_type_name);
         }
     }
     # call the setup hook
     $this->setup();
 }
开发者ID:kakra,项目名称:adodbrecord,代码行数:27,代码来源:Base.class.php

示例2: overload

 function overload()
 {
     if (function_exists('overload')) {
         if (func_num_args() > 0) {
             foreach (func_get_args() as $class) {
                 if (is_object($class)) {
                     overload(get_class($class));
                 } elseif (is_string($class)) {
                     overload($class);
                 }
             }
         } else {
             overload(get_class($this));
         }
     }
 }
开发者ID:vuong93st,项目名称:w-game,代码行数:16,代码来源:overloadable_php4.php

示例3: _add_to_pool

    /**
     *	@short Adds an object to the object pool.
     *	@param classname Name of the class for the desired object.
     *	@param id Primary key value for the desired object.
     *	@param obj The object to add to the pool.
     */
    private static function _add_to_pool($classname, $id, $obj)
    {
        if (!isset(self::$object_pool[$classname])) {
            self::$object_pool[$classname] = array();
        }
        self::$object_pool[$classname][$id] = $obj;
    }
    /**
     *	@short Retrieves an object from the object pool.
     *	@param classname Name of the class for the desired object.
     *	@param id Primary key value for the desired object.
     */
    private static function _get_from_pool($classname, $id)
    {
        if (!isset(self::$object_pool[$classname]) || !isset(self::$object_pool[$classname][$id])) {
            return NULL;
        }
        return self::$object_pool[$classname][$id];
    }
}
if (version_compare(PHP_VERSION, '5') < 0) {
    if (function_exists("overload")) {
        overload('ActiveRecord');
    }
}
开发者ID:emeraldion,项目名称:zelda,代码行数:31,代码来源:base.php

示例4: __call

    }
    /**
     * SOAP_Client::__call
     *
     * Overload extension support
     * if the overload extension is loaded, you can call the client class
     * with a soap method name
     * $soap = new SOAP_Client(....);
     * $value = $soap->getStockQuote('MSFT');
     *
     * @param string method
     * @param array  args
     * @param string retur_value
     *
     * @return boolean
     * @access public
     */
    function __call($method, $args, &$return_value)
    {
        if (!$this->wsdl) {
            return FALSE;
        }
        #$return_value = call_user_func_array(array(&$this, 'my_' . $method), $args);
        $this->wsdl->matchMethod($method);
        $return_value = $this->call($method, $args);
        return TRUE;
    }
}
if (extension_loaded('overload')) {
    overload('SOAP_Client');
}
开发者ID:GabrielDiniz,项目名称:FluxNetControl,代码行数:31,代码来源:client.php

示例5: make_object_extendable

function make_object_extendable($classname)
{
    if (_PHP_ < 5) {
        overload($classname);
    }
}
开发者ID:laiello,项目名称:hotel-os,代码行数:6,代码来源:obj.extendable.php

示例6: AddSibling

        }
        return $siblingList;
    }
    /**
     * Associates the sibling object to this one
     * @return 
     */
    function AddSibling($sibling)
    {
        if (is_a($sibling, "sibling")) {
            foreach (array_keys($sibling->_objectList) as $key) {
                $otherObject =& $sibling->_objectList[$key];
                if ($otherObject === $this) {
                    return false;
                }
            }
            $found = false;
            foreach ($this->_siblingList as $sibling2) {
                if ($sibling->siblingId > 0 && $sibling->siblingId == $sibling2->siblingId) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                $this->_siblingList[] =& $sibling;
            }
        }
    }
}
overload('object');
开发者ID:rafasashi,项目名称:php-object-generator,代码行数:30,代码来源:class.object.php

示例7: clearCache

                clearCache($assoc);
                return true;
            }
        } else {
            //Will use for query cache deleting
        }
    }
    /**
     * Called when serializing a model
     *
     * @return array
     * @access public
     */
    function __sleep()
    {
        $return = array_keys(get_object_vars($this));
        return $return;
    }
    /**
     * Called when unserializing a model
     *
     * @return void
     * @access public
     */
    function __wakeup()
    {
    }
}
// --- PHP4 Only
overload('Model');
// --- PHP4 Only
开发者ID:uwitec,项目名称:eduoa,代码行数:31,代码来源:model_php4.php

示例8: overload

 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright 2005-2007, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2007, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package			cake
 * @subpackage		cake.cake.libs.model
 * @since			CakePHP(tm) v 0.10.0.0
 * @version			$Revision: 4409 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 * Load the model class based on the version of PHP.
 *
 */
if (phpversion() < 5) {
    require LIBS . 'model' . DS . 'model_php4.php';
    if (function_exists("overload")) {
        overload("Model");
    }
} else {
    require LIBS . 'model' . DS . 'model_php5.php';
}
开发者ID:carriercomm,项目名称:pastebin-5,代码行数:31,代码来源:model.php

示例9: sub

    }
    function sub($part, $num = 1)
    {
        return $this->__dateOperation('-', $part, $num);
    }
    function substract($part, $num = 1)
    {
        return $this->__dateOperation('-', $part, $num);
    }
    function __toString()
    {
        return $this->getDateTime();
    }
}
if (function_exists('overload') && phpversion() < 5) {
    overload('HessDateTime');
}
/*
// Tests

$date1 = new DateTime('2004-09-06 8:00:00');
$date2 = new DateTime('2004-09-06 9:00:00');
$date3 = new DateTime('2004-09-06 8:00:00');


if($date1->isBefore($date2))
	echo 'si<br>';
if($date2->isAfter($date1))
	echo 'si<br>';
if($date1->equals($date3))
	echo 'si<br>';
开发者ID:kotishe,项目名称:API-for-AOServer,代码行数:31,代码来源:DateTime.php

示例10: SetObjectList

    function SetObjectList($list)
    {
        $this->_objectList = array();
        $existingObjectList = $this->GetObjectList();
        foreach ($existingObjectList as $object) {
            $object->parent_Id = '';
            $object->Save(false);
        }
        $this->_objectList =& $list;
    }
    /**
     * Associates the object object to this one
     * @return 
     */
    function AddObject($object)
    {
        $object->parent_Id = $this->parent_Id;
        $found = false;
        foreach ($this->_objectList as $object2) {
            if ($object->objectId > 0 && $object->objectId == $object2->objectId) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            $this->_objectList[] =& $object;
        }
    }
}
overload('parent_');
开发者ID:rafasashi,项目名称:php-object-generator,代码行数:30,代码来源:class.parent_.php

示例11: getCmdResult

    /**
     * getCmdResult 
     *  returns the result returned by the command, or error in case the command failed. 
     * @access public
     * @return mixed string on sucess, false and error on faliure.
     */
    function getCmdResult()
    {
        $descriptorspec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
        $proc = proc_open($this->getCmdForExec(), $descriptorspec, $pipes);
        //so long...
        fclose($pipes[0]);
        $stdout = NULL;
        $stderr = NULL;
        foreach (array('stdout' => $pipes[1], 'stderr' => $pipes[2]) as $pipename => $piperes) {
            while (!feof($piperes)) {
                ${$pipename} .= fgets($piperes);
            }
            fclose($piperes);
        }
        if (!empty($stderr)) {
            trigger_error(sprintf('Command %s failed : %s', htmlspecialchars($this->command), htmlspecialchars($stderr)));
            return false;
        }
        return $stdout;
    }
}
//PHP4 requires this non-sense
if (PHP_VERSION < 5) {
    overload('CommandExecution');
}
开发者ID:negram,项目名称:flyspray,代码行数:31,代码来源:class.commandexecution.php

示例12: __get_foo

    function __get_foo(&$value)
    {
        debug("Fetching foo...");
        $value = 'BAR';
    }
    function __set($propname, $value)
    {
        debug("Setting {$propname} to {$value}...");
        $this->props[$propname] = $value;
        return true;
    }
    function __call($methodname, $args, &$ret)
    {
        debug("Calling {$methodname}...");
        $func = $this->methods[$methodname];
        if (isset($func)) {
            $ret = call_user_func_array($func, $args);
        }
        return true;
    }
}
overload('OverloadMe');
$obj =& new OverloadMe();
// Property overloading
$obj->someprop = 'BAM BAM GO BAM';
print $obj->someprop;
// Print out property $foo which is a special case and
// directly handled
print $obj->foo;
// Method overloading
print $obj->convn2br("\n\nYABBADABBADOOOOO\n\n");
开发者ID:SandyS1,项目名称:presentations,代码行数:31,代码来源:overload.php

示例13: GetObject

                    }
                    if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET') {
                        $pog_query = $pog_query . "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " '" . $this->Escape($fcv_array[$i][2]) . "'";
                    } else {
                        $pog_query = $pog_query . "`" . $fcv_array[$i][0] . "` " . $fcv_array[$i][1] . " '" . $fcv_array[$i][2] . "'";
                    }
                }
            }
            return Database::NonQuery($pog_query, $connection);
        }
    }
    /**
     * Associates the object object to this one
     * @return boolean
     */
    function GetObject()
    {
        $object = new object();
        return $object->Get($this->objectId);
    }
    /**
     * Associates the object object to this one
     * @return 
     */
    function SetObject(&$object)
    {
        $this->objectId = $object->objectId;
    }
}
overload('child');
开发者ID:rafasashi,项目名称:php-object-generator,代码行数:30,代码来源:class.child.php

示例14: createDoceboDOMObject

        if ($contextnode === NULL) {
            $result = $xpath->xpath_eval($expression);
        } else {
            $result = $xpath->xpath_eval($expression, DoceboDOMNode::getRef($contextnode));
        }
        return createDoceboDOMObject($result->nodeset, FALSE);
    }
}
overload("DoceboDOMNode");
overload("DoceboDOMText");
overload("DoceboDOMDocument");
overload("DoceboDOMDocumentType");
overload("DoceboDOMAttr");
overload("DoceboDOMElement");
overload("DoceboDOMNodeList");
overload("DoceboDOMNamedNodeMap");
function _doceboNodePropertyGet(&$obj, $param, &$value)
{
    $ret_bool = TRUE;
    $secondChoice = FALSE;
    switch ($param) {
        case "nodeName":
            $value = $obj->nodeRef->node_name();
            return $ret_bool;
        case "nodeValue":
            $value = $obj->nodeRef->node_value();
            return $ret_bool;
        case "nodeType":
            $value = $obj->nodeRef->node_type();
            return $ret_bool;
        case "parentNode":
开发者ID:abhinay100,项目名称:forma_app,代码行数:31,代码来源:lib.domxml4.php

示例15: __call

} else {
    if (phpversion() < 5) {
        $class = <<<TEXT
        class XML_FastCreate_Overload extends PEAR {
            function __call(\$method, \$args, &\$return)
            {
                if (\$method != __CLASS__) {
                    \$return = \$this->_call(\$method, \$args);
                }
                return true;
            }
        }
TEXT;
        eval($class);
        if (function_exists('overload')) {
            overload('XML_FastCreate_Overload');
        }
    } else {
        $class = <<<TEXT
        class XML_FastCreate_Overload extends PEAR {
            function __call(\$method, \$args) 
            {
                if (\$method != __CLASS__) {
                    return \$this->_call(\$method, \$args);
                }
            }
        }
TEXT;
        eval($class);
    }
}
开发者ID:vinnivinsachi,项目名称:Vincent-DR,代码行数:31,代码来源:FastCreate.php


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