/** * @param string $host * @param int $port */ public function __construct($host, $port) { parent::__construct(); $this->host = $host; $this->port = $port; $this->socket = $this->createSocket(); }
function __construct($params = null) { if ($params) { $this->params = $params; } parent::__construct(); }
public function __construct($name, $value, $prompt = '') { parent::__construct(); $this->setName($name); $this->setValue($value); $this->setPrompt($prompt); }
/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options * @return DatabaseRowsetAbstract */ public function __construct(ObjectConfig $config) { parent::__construct($config); //Set the prototypable $this->_prototypable = $config->prototypable; //Set the table identifier $this->_table = $config->table; // Set the table identifier if (isset($config->identity_column)) { $this->_identity_column = $config->identity_column; } // Clear the rowset $this->clear(); // Insert the data, if exists if (!empty($config->data)) { foreach ($config->data->toArray() as $properties) { $this->insert($properties, $config->status); } // Unset data to save memory unset($config->data); } //Set the status message if (!empty($config->status_message)) { $this->setStatusMessage($config->status_message); } }
public function __construct($filename = null) { // If we're working with image resampling, things could take a while. Bump up the time-limit increase_time_limit_to(300); if ($filename && is_readable($filename)) { // We use getimagesize instead of extension checking, because sometimes extensions are wrong. list($width, $height, $type, $attr) = getimagesize($filename); switch ($type) { case 1: if (function_exists('imagecreatefromgif')) { $this->setImageResource(imagecreatefromgif($filename)); } break; case 2: if (function_exists('imagecreatefromjpeg')) { $this->setImageResource(imagecreatefromjpeg($filename)); } break; case 3: if (function_exists('imagecreatefrompng')) { $img = imagecreatefrompng($filename); imagesavealpha($img, true); // save alphablending setting (important) $this->setImageResource($img); } break; } } parent::__construct(); $this->quality = $this->config()->default_quality; $this->interlace = $this->config()->image_interlace; }
public function __construct($content) { if (extension_loaded('tidy')) { // using the tidy php extension $tidy = new tidy(); $tidy->parseString($content, array('output-xhtml' => true, 'numeric-entities' => true, 'wrap' => 0), 'utf8'); $tidy->cleanRepair(); $tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"', '', $tidy); $tidy = str_replace(' ', '', $tidy); } elseif (@shell_exec('which tidy')) { // using tiny through cli $CLI_content = escapeshellarg($content); $tidy = `echo {$CLI_content} | tidy --force-output 1 -n -q -utf8 -asxhtml -w 0 2> /dev/null`; $tidy = str_replace('xmlns="http://www.w3.org/1999/xhtml"', '', $tidy); $tidy = str_replace(' ', '', $tidy); } else { // no tidy library found, hence no sanitizing $tidy = $content; } $this->simpleXML = @simplexml_load_string($tidy, 'SimpleXMLElement', LIBXML_NOWARNING); if (!$this->simpleXML) { throw new Exception('CSSContentParser::__construct(): Could not parse content.' . ' Please check the PHP extension tidy is installed.'); } parent::__construct(); }
/** * Constructor * */ public function __construct() { parent::__construct(); App::uses('AclNode', 'Model'); $this->Aro = ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro')); $this->Aco = ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco')); }
/** * * @name __construct * @param MariaBlockChain\MariaBlockChain $blockchain the scope * @since 0.1.0 * @return object */ public function __construct($blockchain) { if (!isset($this->_cachePrefix)) { $this->_cachePrefix = ""; } parent::__construct($blockchain); }
/** * __constructor * * @param FormField $field The field we're validating against */ function __construct(FormField $field = null) { if ($field) { $this->setField($field); } $this->setMessageType($this->getRuleName()); parent::__construct(); }
/** * SshKey constructor. * @param array $json * @param array $headers * @param int $status */ public function __construct(array $json = [], array $headers = [], $status = 200) { parent::__construct($json, $headers, $status); $this->setFromJson('id'); $this->setFromJson('title'); $this->setFromJson('content'); }
/** * WebhookRequest constructor. * @param array $json * @param array $headers * @param int $status */ public function __construct(array $json = [], array $headers = [], $status = 200) { parent::__construct($json, $headers, $status); $this->setFromJson('postDate', 'post_date'); $this->setFromJson('responseStatus', 'response_status'); $this->setFromJson('body'); }
/** * Constructor * * @param array $options optional load object properties */ function __construct($options = array()) { parent::__construct(); if (empty($options['name'])) { $this->name = preg_replace('/schema$/i', '', get_class($this)); } if (!empty($options['plugin'])) { $this->plugin = $options['plugin']; } if (strtolower($this->name) === 'cake') { $this->name = Inflector::camelize(Inflector::slug(Configure::read('App.dir'))); } if (empty($options['path'])) { if (is_dir(CONFIGS . 'schema')) { $this->path = CONFIGS . 'schema'; } else { $this->path = CONFIGS . 'sql'; } } $options = array_merge(get_object_vars($this), $options); $this->_build($options); }
function __construct($arr = null, $arr_pre = "t_") { parent::__construct($arr, $arr_pre); $this->date = strtotime($this->date); $this->time = TrainingLog::getSecondsFromFormat($this->time); //$this->route = new Route($arr); }
/** * Constructor * * @param ObjectConfig $config An optional ObjectConfig object with configuration options. */ public function __construct(ObjectConfig $config) { //Bypass DatabaseRowAbstract constructor to prevent data from being added twice Object::__construct($config); //Set the table identifier $this->_table = $config->table; // Set the table identifier if (isset($config->identity_column)) { $this->_identity_column = $config->identity_column; } // Reset the row $this->reset(); //Set the status if (isset($config->status)) { $this->setStatus($config->status); } // Set the row data if (isset($config->data)) { $this->setData($config->data->toArray(), $this->isNew()); } //Set the status message if (!empty($config->status_message)) { $this->setStatusMessage($config->status_message); } }
function __construct($filename = null) { // If we're working with image resampling, things could take a while. Bump up the time-limit increase_time_limit_to(300); if ($filename) { // We use getimagesize instead of extension checking, because sometimes extensions are wrong. list($width, $height, $type, $attr) = getimagesize($filename); switch ($type) { case 1: if (function_exists('imagecreatefromgif')) { $this->setGD(imagecreatefromgif($filename)); } break; case 2: if (function_exists('imagecreatefromjpeg')) { $this->setGD(imagecreatefromjpeg($filename)); } break; case 3: if (function_exists('imagecreatefrompng')) { $this->setGD(imagecreatefrompng($filename)); } break; } } $this->quality = self::$default_quality; parent::__construct(); }
function __construct(array $params = null) { if (!is_null($params)) { $this->Parameters = $params; } parent::__construct(); }
/** * setup the model stuff * * */ function __construct() { $model = Configure::read('LDAP.Model'); $this->userModel = empty($model) ? 'Idbroker.LdapAuth' : $model; $this->model =& $this->getModel(); parent::__construct(); }
/** * Construct * @param array $data */ public function __construct(array $data = array()) { parent::__construct($data); if (isset($data['id'])) { $this->ID = $data['id']; } }
/** * @see parent::__construct() */ public function __construct(Order $Order = null) { parent::__construct(); if ($Order) { $this->OrderId = $Order->Id; } }
public function __construct(Table $table, $name, array $options = array()) { $columnTypes = array(self::TYPE_COLUMN_FIX_SIZE, self::TYPE_COLUMN_VAR_SIZE, self::TYPE_COLUMN_INDEX); if ($this->isObjectResource($name, $columnTypes)) { parent::__construct($name); return; } $ctx = $table->getContext(); $path = null; $flags = 0; $type = null; foreach (array('path', 'flags', 'type') as $option) { if (isset($options[$option])) { if ($option === 'type') { ${$option} = $this->fetchResource($options[$option], $ctx); } else { ${$option} = $options[$option]; } } } $previous = ini_set('track_errors', '1'); $column = @grn_column_open_or_create($table->getResource(), $name, $path, $flags, $type); ini_set('track_errors', $previous); if (!$column) { throw new Exception($php_errormsg); } parent::__construct($column); }
/** * Constroi o gerenciador de cookies que grava as informações * em um arquivo. * @param string $dirname Diretório onde os cookies serão * gravados, caso não informado o diretório temporário do * sistema será utilizado. */ public function __construct( $dirname = null ) { parent::__construct(); if ( $dirname == null ) { $dirname = sys_get_temp_dir(); } if ( is_readable( $dirname ) && is_writable( $dirname ) ) { $cookieFile = realpath( $dirname ) . '/cookie.jar'; if ( !is_file( $cookieFile ) ) { touch( $cookieFile ); } else { $cookieManager = unserialize( file_get_contents( $cookieFile ) ); if ( $cookieManager instanceof HTTPCookieManager ) { $this->cookies = $cookieManager->cookies; } } $this->cookieFile = $cookieFile; } else { throw new RuntimeException( 'O diretório ' . $dirname . ' precisa ter permissões de leitura e gravação.' ); } }
/** * Group constructor. * @param array $json * @param array $headers * @param int $status */ public function __construct(array $json = [], array $headers = [], $status = 200) { parent::__construct($json, $headers, $status); $this->setFromJson('id'); $this->setFromJson('name'); $this->setFromJson('description'); }
public function __construct($settings = array()) { parent::__construct(); $this->initialize($settings); $this->_consumerKey = Configure::read('Twitter.consumerKey'); $this->_consumerSecret = Configure::read('Twitter.consumerSecret'); }
/** * The class constructor. * * @access public * @param object $User The User. */ public function __construct(User $User = null) { parent::__construct(); if ($User) { $this->User = $User; } }
/** * A key value pair of values that should be searched for. * The keys should match the field names specified in {@link self::$fields}. * Usually these values come from a submitted searchform * in the form of a $_REQUEST object. * CAUTION: All values should be treated as insecure client input. * * @param string $modelClass The base {@link DataObject} class that search properties related to. * Also used to generate a set of result objects based on this class. * @param FieldList $fields Optional. FormFields mapping to {@link DataObject::$db} properties * which are to be searched. Derived from modelclass using * {@link DataObject::scaffoldSearchFields()} if left blank. * @param array $filters Optional. Derived from modelclass if left blank */ public function __construct($modelClass, $fields = null, $filters = null) { $this->modelClass = $modelClass; $this->fields = $fields ? $fields : new FieldList(); $this->filters = $filters ? $filters : array(); parent::__construct(); }
/** * @param $name */ function __construct($name = null) { $this->name = ($name) ? $name : self::get_default_name(); // only regenerate if the token isn't already set in the session if(!$this->getValue()) $this->setValue($this->generate()); parent::__construct(); }
/** * Constructor * */ public function __construct() { parent::__construct(); $this->Permission = ClassRegistry::init(array('class' => 'Permission', 'alias' => 'Permission')); $this->Aro = $this->Permission->Aro; $this->Aco = $this->Permission->Aco; }
/** * Constructor * * @param ObjectConfig|null $config An optional ObjectConfig object with configuration options * @return UserSession */ public function __construct(ObjectConfig $config) { parent::__construct($config); //Session write and close handlers are called after destructing objects since PHP 5.0.5. if (version_compare(phpversion(), '5.4.0', '>=')) { session_register_shutdown(); } else { register_shutdown_function('session_write_close'); } //Set the session options $this->setOptions($config->options); //Set the session name if (!empty($config->name)) { $this->setName($config->name); } //Set the session identifier if (!empty($config->id)) { $this->setId($config->id); } //Set the session namespace $this->setNamespace($config->namespace); //Set lifetime time $this->getContainer('metadata')->setLifetime($config->lifetime); //Set the session handler $this->setHandler($config->handler, ObjectConfig::unbox($config)); }
/** * @param $locale */ public function __construct($locale = null) { $this->defaultLocale = $locale ? $locale : i18n::get_lang_from_locale(i18n::default_locale()); $this->basePath = Director::baseFolder(); $this->baseSavePath = Director::baseFolder(); parent::__construct(); }
/** * Create a dataobject importer * * @param LegacyImportTask $task Parent task * @param array $parameters Parameter input * @param array $helpers List of helper classes * @throws InvalidArgumentException */ public function __construct(LegacyImportTask $task, $parameters, $helpers = array()) { parent::__construct(); // Save running task $this->task = $task; $this->helpers = $helpers; }