本文整理汇总了PHP中PEAR::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR::__construct方法的具体用法?PHP PEAR::__construct怎么用?PHP PEAR::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR
的用法示例。
在下文中一共展示了PEAR::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Constructor
*
* @param $table string the name of the database table
*
* @param $keycolumn mixed string with name of key column, or array of
* strings if the table has a primary key of more than one column
*
* @param $dbh object database connection object
*
* @param $validator mixed function or method used to validate
* each new value, called with three parameters: the name of the
* field/column that is changing, a reference to the new value and
* a reference to this object
*
*/
function __construct($table, $keycolumn, &$dbh, $validator = null)
{
parent::__construct('DB_Error');
$this->_table = $table;
$this->_keycolumn = $keycolumn;
$this->_dbh = $dbh;
$this->_readonly = false;
$this->_validator = $validator;
}
示例2:
/**
*
*
* @version 02/11/22
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @return void
* @access public
*/
function I18N_Format($locale)
{
parent::__construct();
$this->_locale = $locale;
//FIXXME catch locales that we dont have a class for yet, and use default class, which
// translates using google or something ...
if (include_once "I18N/Common/{$locale}.php") {
$class = "I18N_Common_{$locale}";
$this->_localeObj = new $class();
}
}
示例3: Cache
/**
*
* @param string Name of container class
* @param array Array with container class options
*/
function Cache($container, $container_options = '')
{
parent::__construct();
$container = strtolower($container);
$container_class = 'Cache_Container_' . $container;
$container_classfile = 'Cache/Container/' . $container . '.php';
include_once $container_classfile;
$this->container = new $container_class($container_options);
}
示例4:
/**
* PEAR_Command_Common constructor.
*
* @access public
*/
function PEAR_Command_Common(&$ui, &$config)
{
parent::__construct();
$this->config =& $config;
$this->ui =& $ui;
}
示例5:
/**
* PEAR_Registry constructor.
*
* @param string (optional) PEAR install directory (for .php files)
* @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if
* default values are not desired. Only used the very first time a PEAR
* repository is initialized
* @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if
* default values are not desired. Only used the very first time a PEAR
* repository is initialized
*
* @access public
*/
function __construct($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false, $pecl_channel = false, $pear_metadata_dir = '')
{
parent::__construct();
$this->setInstallDir($pear_install_dir, $pear_metadata_dir);
$this->_pearChannel = $pear_channel;
$this->_peclChannel = $pecl_channel;
$this->_config = false;
}
示例6: getenv
/**
* Constructor.
*
* @param string file to read user-defined options from
* @param string file to read system-wide defaults from
* @param bool determines whether a registry object "follows"
* the value of php_dir (is automatically created
* and moved when php_dir is changed)
* @param bool if true, fails if configuration files cannot be loaded
*
* @access public
*
* @see PEAR_Config::singleton
*/
function __construct($user_file = '', $system_file = '', $ftp_file = false, $strict = true)
{
parent::__construct();
PEAR_Installer_Role::initializeConfig($this);
$sl = DIRECTORY_SEPARATOR;
if (empty($user_file)) {
if (OS_WINDOWS) {
$user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';
} else {
$user_file = getenv('HOME') . $sl . '.pearrc';
}
}
if (empty($system_file)) {
if (OS_WINDOWS) {
$system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini';
} else {
$system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf';
}
}
$this->layers = array_keys($this->configuration);
$this->files['user'] = $user_file;
$this->files['system'] = $system_file;
if ($user_file && file_exists($user_file)) {
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$this->readConfigFile($user_file, 'user', $strict);
$this->popErrorHandling();
if ($this->_errorsFound > 0) {
return;
}
}
if ($system_file && file_exists($system_file)) {
$this->mergeConfigFile($system_file, false, 'system', $strict);
if ($this->_errorsFound > 0) {
return;
}
}
if (!$ftp_file) {
$ftp_file = $this->get('remote_config');
}
if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) {
$this->readFTPConfigFile($ftp_file);
}
foreach ($this->configuration_info as $key => $info) {
$this->configuration['default'][$key] = $info['default'];
}
$this->_registry['default'] = new PEAR_Registry($this->configuration['default']['php_dir']);
$this->_registry['default']->setConfig($this);
$this->_regInitialized['default'] = false;
//$GLOBALS['_PEAR_Config_instance'] = &$this;
}
示例7:
/**
* Constructs a new Net_Whois object
*
* @access public
*/
function Net_Whois()
{
parent::__construct();
$this->setPort();
$this->setAuthoritative();
$this->setTimeout();
}
示例8:
function __construct(&$config)
{
parent::__construct();
$this->config =& $config;
$this->_registry =& $this->config->getRegistry();
}
示例9: __construct
/**
* Net_LDAP2 constructor
*
* Sets the config array
*
* Please note that the usual way of getting Net_LDAP2 to work is
* to call something like:
* <code>$ldap = Net_LDAP2::connect($ldap_config);</code>
*
* @param array $config Configuration array
*
* @access protected
* @return void
* @see $_config
*/
public function __construct($config = array())
{
parent::__construct('Net_LDAP2_Error');
$this->setConfig($config);
}
示例10:
/**
* Constructor.
*
* @param boolean $auto Automatically start timer
*
* @access public
*/
function Benchmark_Timer($auto = false)
{
$this->auto = $auto;
if ($this->auto) {
$this->start();
}
parent::__construct();
}
示例11:
/**
* Constructor
*
* @param mixed $options array containing options for the serialization
*
* @access public
*/
function XML_Serializer($options = null)
{
parent::__construct();
if (is_array($options)) {
$this->options = array_merge($this->_defaultOptions, $options);
} else {
$this->options = $this->_defaultOptions;
}
}
示例12: __construct
/**
* Constructor.
*
* @param boolean $auto
* @access public
*/
public function __construct($auto = FALSE)
{
$this->auto = $auto;
if ($this->auto) {
$this->start();
}
parent::__construct();
}
示例13: __construct
/**
* Constructor
*
* @param resource $search Search result identifier
* @param Net_LDAP2|resource $ldap Net_LDAP2 object or just a LDAP-Link resource
* @param array $attributes (optional) Array with searched attribute names. (see {@link $_searchedAttrs})
*
* @access public
*/
public function __construct($search, $ldap, $attributes = array())
{
parent::__construct('Net_LDAP2_Error');
$this->setSearch($search);
if ($ldap instanceof Net_LDAP2) {
$this->_ldap = $ldap;
$this->setLink($this->_ldap->getLink());
} else {
$this->setLink($ldap);
}
$this->_errorCode = @ldap_errno($this->_link);
if (is_array($attributes) && !empty($attributes)) {
$this->_searchedAttrs = $attributes;
}
}
示例14: __construct
/**
* Archive_Tar Class constructor. This flavour of the constructor only
* declare a new Archive_Tar object, identifying it by the name of the
* tar file.
* If the compress argument is set the tar will be read or created as a
* gzip or bz2 compressed TAR file.
*
* @param string $p_tarname The name of the tar archive to create
* @param string $p_compress can be null, 'gz', 'bz2' or 'lzma2'. This
* parameter indicates if gzip, bz2 or lzma2 compression
* is required. For compatibility reason the
* boolean value 'true' means 'gz'.
*
* @return bool
*/
public function __construct($p_tarname, $p_compress = null)
{
parent::__construct();
$this->_compress = false;
$this->_compress_type = 'none';
if ($p_compress === null || $p_compress == '') {
if (@file_exists($p_tarname)) {
if ($fp = @fopen($p_tarname, "rb")) {
// look for gzip magic cookie
$data = fread($fp, 2);
fclose($fp);
if ($data == "‹") {
$this->_compress = true;
$this->_compress_type = 'gz';
// No sure it's enought for a magic code ....
} elseif ($data == "BZ") {
$this->_compress = true;
$this->_compress_type = 'bz2';
} elseif (file_get_contents($p_tarname, false, null, 1, 4) == '7zXZ') {
$this->_compress = true;
$this->_compress_type = 'lzma2';
}
}
} else {
// probably a remote file or some file accessible
// through a stream interface
if (substr($p_tarname, -2) == 'gz') {
$this->_compress = true;
$this->_compress_type = 'gz';
} elseif (substr($p_tarname, -3) == 'bz2' || substr($p_tarname, -2) == 'bz') {
$this->_compress = true;
$this->_compress_type = 'bz2';
} else {
if (substr($p_tarname, -2) == 'xz') {
$this->_compress = true;
$this->_compress_type = 'lzma2';
}
}
}
} else {
if ($p_compress === true || $p_compress == 'gz') {
$this->_compress = true;
$this->_compress_type = 'gz';
} else {
if ($p_compress == 'bz2') {
$this->_compress = true;
$this->_compress_type = 'bz2';
} else {
if ($p_compress == 'lzma2') {
$this->_compress = true;
$this->_compress_type = 'lzma2';
} else {
$this->_error("Unsupported compression type '{$p_compress}'\n" . "Supported types are 'gz', 'bz2' and 'lzma2'.\n");
return false;
}
}
}
}
$this->_tarname = $p_tarname;
if ($this->_compress) {
// assert zlib or bz2 or xz extension support
if ($this->_compress_type == 'gz') {
$extname = 'zlib';
} else {
if ($this->_compress_type == 'bz2') {
$extname = 'bz2';
} else {
if ($this->_compress_type == 'lzma2') {
$extname = 'xz';
}
}
}
if (!extension_loaded($extname)) {
PEAR::loadExtension($extname);
}
if (!extension_loaded($extname)) {
$this->_error("The extension '{$extname}' couldn't be found.\n" . "Please make sure your version of PHP was built " . "with '{$extname}' support.\n");
return false;
}
}
}
示例15: __construct
/**
* Constructor
*
* @access public
*/
public function __construct()
{
// Init PEAR.
parent::__construct();
}