/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('max_upload_limit' => ini_get('upload_max_filesize'))); parent::_initialize($config); $config->append(array('behaviors' => to_hash(array('com://site/search.controller.behavior.searchable', 'com://site/stories.controller.behavior.publisher', 'com://site/notifications.controller.behavior.notifier', 'followable', 'administrable', 'ownable', 'privatable', 'enablable', 'verifiable', 'subscribable', 'com://site/hashtags.controller.behavior.hashtagable', 'com://site/locations.controller.behavior.geolocatable', 'coverable')))); JFactory::getLanguage()->load('com_actors'); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('administratingIds' => array('type' => 'set', 'default' => 'set'), 'userId' => array('column' => 'person_userid', 'key' => true, 'type' => 'integer'), 'username' => array('column' => 'person_username', 'key' => true, 'format' => 'username'), 'userType' => array('column' => 'person_usertype', 'write' => 'protected'), 'email' => array('column' => 'person_useremail', 'key' => true, 'format' => 'email'), 'givenName' => array('column' => 'person_given_name', 'format' => 'string'), 'familyName' => array('column' => 'person_family_name', 'format' => 'string'), 'lastVisitDate' => array('type' => 'date', 'column' => 'person_lastvisitdate'), 'language' => array('column' => 'person_language'), 'timezone' => array('column' => 'person_time_zone'), 'gender' => array('column' => 'actor_gender')), 'aliases' => array('registrationDate' => 'creationTime', 'aboutMe' => 'description'), 'behaviors' => to_hash(array('describable' => array('searchable_properties' => array('username')), 'administrator', 'notifiable', 'leadable')))); $config->behaviors->append(array('followable' => array('subscribe_after_follow' => false))); parent::_initialize($config); AnHelperArray::unsetValues($config->behaviors, array('administrable')); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('abstract' => $this->getIdentifier()->classname == __CLASS__), 'attributes' => to_hash(array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY, 'format' => 'string', 'read' => 'public'), 'body' => array('format' => 'string'), 'status', 'statusUpdateTime')), 'behaviors' => to_hash(array('subscribable', 'modifiable', 'storable', 'describable', 'authorizer', 'privatable', 'administrable', 'enableable', 'verifiable', 'dictionariable', 'followable', 'com://site/hashtags.domain.behavior.hashtagable', 'com://site/locations.domain.behavior.geolocatable', 'coverable', 'portraitable' => array('sizes' => array('small' => '80xauto', 'medium' => '160xauto', 'large' => '480xauto', 'square' => 56)))))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => to_hash(array('coverFilename' => array('write' => 'protected'), 'coverMimetype')), 'keep_original' => true, 'sizes' => array('large' => '1600xauto', 'medium' => '640xauto'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY, 'format' => 'string', 'read' => 'public', 'unique' => true)), 'behaviors' => to_hash(array('modifiable', 'describable')), 'relationships' => array('tagables' => array('through' => 'tag', 'child_key' => 'hashtag', 'target' => 'com:tags.domain.entity.node', 'target_child_key' => 'tagable')))); parent::_initialize($config); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. * * @return void */ protected function _initialize(KConfig $config) { $config->append(array('toolbars' => array('menubar', $this->getIdentifier()->name), 'behaviors' => to_hash(array('serviceable', 'persistable')), 'request' => array('limit' => 20, 'sort' => 'id', 'direction' => 'ASC'))); parent::_initialize($config); }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { $config->append(array('behaviors' => to_hash(array('identifiable' => array('repository' => 'package'), 'committable', 'validatable')))); parent::_initialize($config); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => array('name' => array('required' => AnDomain::VALUE_NOT_EMPTY, 'format' => 'string', 'read' => 'public', 'unique' => true), 'geoLatitude' => array('format' => 'float', 'read' => 'public'), 'geoLongitude' => array('format' => 'float', 'read' => 'public'), 'geoAddress' => array('format' => 'string', 'read' => 'public'), 'geoCity' => array('format' => 'string', 'read' => 'public'), 'geoState_province' => array('format' => 'string', 'read' => 'public'), 'geoCountry' => array('format' => 'string', 'read' => 'public'), 'geoPostalcode' => array('format' => 'string', 'read' => 'public')), 'aliases' => array('latitude' => 'geoLatitude', 'longitude' => 'geoLongitude', 'address' => 'geoAddress', 'city' => 'geoCity', 'state_province' => 'geoState_province', 'country' => 'geoCountry', 'postalcode' => 'geoPostalcode'), 'behaviors' => to_hash(array('modifiable', 'describable', 'authorizer', 'dictionariable')), 'relationships' => array('tagables' => array('through' => 'tag', 'child_key' => 'location', 'target' => 'com:tags.domain.entity.node', 'target_child_key' => 'tagable')))); parent::_initialize($config); $this->_geocoder = KService::get('com://site/locations.geocoder')->getInstance($config); }
/** * @param array $commands * @param callable $onerror ($command,$code,$stderr) * @return array */ function parallel_exec($commands, $onerror = null) { $spec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')); $errors = array(); $ret = array(); foreach (array_chunk($commands, hw_core_get(), true) as $chunk) { $processes = array(); foreach ($chunk as $key => $command) { $key = to_hash($key); $process = proc_open($command, $spec, $pipes); if (is_resource($process)) { fclose($pipes[0]); $processes[$key] = array('cmd' => $command, 'res' => $process, 'out' => $pipes[1], 'err' => $pipes[2]); } else { $processes[$key] = $command; } } while (!empty($processes)) { foreach ($processes as $key => $v) { $resource = $v['res']; $cmd = $v['cmd']; if (is_resource($resource)) { $status = proc_get_status($resource); if (!$status['running']) { $code = $status['exitcode']; $out = stream_get_contents($v['out']); fclose($v['out']); $err = stream_get_contents($v['err']); fclose($v['err']); proc_close($resource); unset($processes[$key]); if (0 !== $code) { $errors[$key] = array('error' => "Error code '{$code}'", 'cmd' => $cmd, 'err' => $err); } else { $ret[$key] = $out; } } } else { unset($processes[$key]); $errors[$key] = array('error' => "Could not open process", 'cmd' => $cmd); } } } } if (null !== $onerror) { foreach ($errors as $error) { $onerror($error['cmd'], $error['error'], array_key_exists('err', $error) ? $error['err'] : null); } } else { $format_errors = function ($errors) { $errors = array_map_val($errors, function ($error) { global $cli_format_error; return $cli_format_error($error['cmd'], $error['error'], array_key_exists('err', $error) ? $error['err'] : null); }); return implode(PHP_EOL . '===' . PHP_EOL, $errors); }; debug_enforce(empty($errors), $format_errors($errors)); } return $ret; }
/** * Initializes the options for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('viewer' => $this->getService('com:people.viewer'), 'language' => 'com_' . $this->getIdentifier()->package, 'behaviors' => to_hash('com://site/application.controller.behavior.message'))); parent::_initialize($config); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('attributes' => to_hash(array('filename' => array('write' => 'protected'), 'mimetype')), 'keep_original' => true, 'sizes' => array('large' => '1024xauto', 'medium' => '640xauto', 'small' => '240xauto', 'square' => 100))); parent::_initialize($config); }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { parent::_initialize($config); $config->append(array('behaviors' => to_hash('serviceable'), 'toolbars' => array($this->getIdentifier()->name, 'menubar', 'actorbar'), 'request' => array('limit' => 20, 'offset' => 0, 'sort' => 'recent', 'scope' => ''))); }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { $config->append(array('inheritance' => array('abstract' => $this->getIdentifier()->classname === __CLASS__, 'column' => 'type', 'ignore' => array()), 'resources' => array(array('alias' => $this->getIdentifier()->name, 'name' => 'nodes')), 'identity_property' => 'id', 'attributes' => array('id' => array('key' => true, 'type' => 'integer', 'read' => 'public'), 'component' => array('required' => true, 'read' => 'public')), 'behaviors' => to_hash(array('node')))); parent::_initialize($config); }