本文整理汇总了PHP中Zend_Config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config::get方法的具体用法?PHP Zend_Config::get怎么用?PHP Zend_Config::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config
的用法示例。
在下文中一共展示了Zend_Config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mapSlavesConfig
/**
* @param $databaseConfig
* @param $masterParams
* @return array
*/
private function mapSlavesConfig(Zend_Config $databaseConfig, $masterParams)
{
$slaves = $databaseConfig->get('slaves');
if (!$slaves || !$slaves instanceof Zend_Config || $slaves->count() === 0) {
$slaves = array();
}
$slavesParams = array();
foreach ($slaves as $slaveId) {
$slaveConfig = $databaseConfig->get($slaveId);
if (!$slaveConfig || !$slaveConfig instanceof Zend_Config) {
$this->logger->warning(sprintf("Listed slave '%s' has no configuration. Skipping candidate slave.", $slaveId));
continue;
}
$slaveParams = $this->getParamsFromConfig($slaveConfig);
if ($slaveParams['driver'] !== $masterParams['driver']) {
$this->logger->warning(sprintf("Listed slave '%s' has different driver ('%s') than master ('%s'). This is not supported. " . 'Skipping candidate slave.', $slaveId, $slaveParams['driver'], $masterParams['driver']));
continue;
}
$slavesParams[] = $slaveParams;
}
if (empty($slavesParams)) {
$this->logger->warning('No (properly) configured slaves, using master as slave.');
$slavesParams[] = $masterParams;
}
return $slavesParams;
}
示例2: setup
/**
* Setup db
*
*/
public function setup(Zend_Config $config)
{
$sessionConfig = $config->get('config');
$configArray = $sessionConfig->toArray();
// save_path handler
$configArray = $this->_prependSavePath($configArray);
// name handler
$configArray = $this->_parseName($configArray);
// Setup config
Zend_Session::setOptions($configArray);
// Setup save handling?
$saveHandlerConfig = $config->get('save_handler');
if ($className = $saveHandlerConfig->get('class_name')) {
if ($args = $saveHandlerConfig->get('constructor_args')) {
if ($args instanceof Zend_Config) {
$args = $args->toArray();
} else {
$args = (array) $args;
}
} else {
$args = array();
}
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($className);
$saveHandler = new ReflectionClass($className);
$saveHandler = $saveHandler->newInstanceArgs($args);
Zend_Session::setSaveHandler($saveHandler);
}
// Autostart session?
if ($config->get('auto_start')) {
// Start session
Zend_Session::start();
}
}
示例3: getDevice
/**
* Get device features
*
* @return Application_Model_Device
*/
public function getDevice()
{
if ($this->device == null) {
$this->device = false;
$devices = Application_Model_DevicesMapper::i()->fetchAll();
/* @var Application_Model_Device $device */
foreach ($devices as $device) {
// if exact do an == comparison
if ($device->isExact() && $device->getPattern() == $_SERVER['HTTP_USER_AGENT'] || !$device->isExact() && preg_match($device->getPattern(), $_SERVER['HTTP_USER_AGENT']) > 0) {
// valid $device found;
$this->device = $device;
break;
}
}
if ($this->device == false) {
// load things from default
$this->device = new Application_Model_Device();
if (X_VlcShares_Plugins::broker()->isRegistered('wiimc')) {
$this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WiimcPlxRenderer'));
} else {
$this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WebkitRenderer'));
}
$this->device->setIdProfile($this->options->get('profile', 1))->setLabel("Unknown device");
}
}
return $this->device;
}
示例4: setup
/**
* Setup navigation
*
* @return void
*/
public function setup(Zend_Config $config)
{
// determine registry key
$confKey = $config->get('registry_key');
$key = is_string($confKey) && strlen($confKey) ? $confKey : self::DEFAULT_REGISTRY_KEY;
$nav = new Zym_Navigation($config->get('pages'));
Zend_Registry::set($key, $nav);
}
示例5: validateConfig
/**
* Validate config
*
* @todo finish
* @param Zend_Config $config
*/
public function validateConfig(Zend_Config $config)
{
// Convert string to object
if (is_string($config->get('inflector'))) {
// TODO: finish
}
if (is_string($config->get('view'))) {
// TODO: finish
}
}
示例6: hasNext
/**
* Return true if a next page is possible
* @return boolean
* @throws Exception invalid $items type
*/
public function hasNext($items, $page = 1, $perPage = null)
{
if ($perPage === null) {
$perPage = $this->options->get('perpage', 25);
}
if (is_array($items)) {
return count($items) > $page * $perPage;
} elseif ($items instanceof X_Page_ItemList) {
$items = $items->getItems();
return count($items) > $page * $perPage;
} else {
throw new Exception("Items must be an array or an X_Page_ItemList");
}
}
示例7: setup
/**
* Setup db
*
*/
public function setup(Zend_Config $config)
{
$sessionConfig = $config->get('config');
$configArray = $sessionConfig->toArray();
// save_path handler
$configArray = $this->_prependSavePath($configArray);
// name handler
$configArray = $this->_parseName($configArray);
// Setup config
Zend_Session::setOptions($configArray);
// Autostart session?
if ($config->get('auto_start')) {
// Start session
Zend_Session::start();
}
}
示例8: setup
/**
* Setup Doctrine
*
* @return void
*/
public function setup(Zend_Config $config)
{
if (is_array($config->path_config)) {
$this->setPathConfig($config->path_config);
} elseif ($config->path_config instanceof Zend_Config) {
$this->setPathConfig($config->path_config->toArray());
}
if ($charset = $config->get('charset')) {
$listener = new Zym_App_Resource_Doctrine_ConnectionListener();
$listener->setCharset($charset);
Doctrine_Manager::getInstance()->addListener($listener);
}
// determine if config is for a single-db or a multi-db site
$connections = $config->connection instanceof Zend_Config ? $config->connection->toArray() : (array) $config->connection;
// add connection(s) to doctrine
foreach ($connections as $name => $connection) {
if ($connection instanceof Zend_Config) {
$connection = $connection->toArray();
}
if (is_string($name)) {
Doctrine_Manager::connection($connection, $name);
} else {
Doctrine_Manager::connection($connection);
}
}
}
示例9: getTransport
/**
* Get transport
*
* @param Zend_Config $config
* @return Zend_Mail_Transport_Sendmail
*/
public static function getTransport(Zend_Config $config = null)
{
$host = isset($config->host) ? $config->get('host') : null;
$otherConfig = ($config instanceof Zend_Config) ? $config->toArray() : null;
return new Zend_Mail_Transport_Smtp($host, $otherConfig);
}
示例10: create
/**
* add one record
*
* @param Tinebase_Record_Interface $_record
* @return Tinebase_Record_Interface
*/
public function create(Tinebase_Record_Interface $_record)
{
$course = parent::create($_record);
// add teacher account
$i18n = Tinebase_Translation::getTranslation('Courses');
$courseName = strtolower($course->name);
$loginName = strtolower($i18n->_('teacher') . '-' . $course->name);
$schoolName = strtolower(Tinebase_Department::getInstance()->get($course->type)->name);
$account = new Tinebase_Model_FullUser(array('accountLoginName' => $loginName, 'accountLoginShell' => '/bin/false', 'accountStatus' => 'enabled', 'accountPrimaryGroup' => $course->group_id, 'accountLastName' => $i18n->_('Teacher'), 'accountDisplayName' => $course->name . ' ' . $i18n->_('Teacher Account'), 'accountFirstName' => $course->name, 'accountExpires' => NULL, 'accountEmailAddress' => isset($this->_config->domain) && !empty($this->_config->domain) ? $loginName . '@' . $this->_config->domain : '', 'accountHomeDirectory' => isset($this->_config->basehomedir) ? $this->_config->basehomedir . $schoolName . '/' . $courseName . '/' . $loginName : ''));
if (isset($this->_config->samba)) {
$samUser = new Tinebase_Model_SAMUser(array('homePath' => $this->_config->samba->basehomepath . $loginName, 'homeDrive' => $this->_config->samba->homedrive, 'logonScript' => $courseName . $this->_config->samba->logonscript_postfix_teacher, 'profilePath' => $this->_config->samba->baseprofilepath . $schoolName . '\\' . $courseName . '\\' . $loginName));
$account->sambaSAM = $samUser;
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Created teacher account for course ' . $course->name . ': ' . print_r($account->toArray(), true));
}
#$event = new Courses_Event_BeforeAddTeacher($account, $course);
#Tinebase_Event::fireEvent($event);
$password = $this->_config->get('teacher_password', $account->accountLoginName);
$account = Admin_Controller_User::getInstance()->create($account, $password, $password);
// add to teacher group if available
if (isset($this->_config->teacher_group) && !empty($this->_config->teacher_group)) {
Admin_Controller_Group::getInstance()->addGroupMember($this->_config->teacher_group, $account->getId());
}
// add to students group if available
if (isset($this->_config->students_group) && !empty($this->_config->students_group)) {
Admin_Controller_Group::getInstance()->addGroupMember($this->_config->students_group, $account->getId());
}
return $course;
}
示例11: getArgConfig
/**
* @param Zend_Config $testConfig
* @param ReflectionParameter $arg
* @throws Exception
* @throws KalturaTestException
* @return Ambigous
*/
protected function getArgConfig(Zend_Config $testConfig, ReflectionParameter $arg)
{
$argName = $arg->getName();
$argConfig = $testConfig->get($argName);
KalturaLog::debug("Tests data [{$argName}] config [" . print_r($argConfig, true) . "]");
if (!$argConfig) {
if (!$arg->allowsNull()) {
throw new Exception("Argument [{$argName}] can't be null for test [" . $this->getName() . "]");
}
return null;
}
if (is_string($argConfig)) {
return $argConfig;
}
switch ($argConfig->objectType) {
case 'dependency':
throw new KalturaTestException("Argument [{$argName}] taken from dependency");
case 'array':
return $this->populateArray($argConfig);
case 'native':
return $argConfig->value;
case 'file':
return $argConfig->path;
default:
return $this->populateObject($argConfig);
}
}
示例12: getConfigFor
/**
* Returns the configuration of the provided template.
*
* @param string $template The name of the template.
* @return Zend_Config
* @throws InvalidArgumentException If the template does not exist.
*/
protected function getConfigFor($template)
{
if (!isset($this->templates->{$template})) {
$message = 'The template "' . $template . '" does not exist.';
throw new InvalidArgumentException($message);
}
return $this->templates->get($template);
}
示例13: get
/**
* //
*
* @param string $option
* @param mixed $default
* @return
*/
public function get($option, $default = null)
{
$result = parent::get($option, $default);
if ($result instanceof Zend_Config) {
$result = $result->toArray();
}
return $result;
}
示例14: _loadTransport
/**
* Load transport settings
*
* @param Zend_Config $config
* @return Zend_Mail_Transport_Abstract
*/
protected function _loadTransport(Zend_Config $config)
{
// Make lowercase
$defaultTransport = strtolower($config->get('default_transport'));
$transportMap = array_change_key_case($config->get('transport_map')->toArray(), CASE_LOWER);
// Load transport
$transportConfig = $config->get('transport')->get($defaultTransport);
$transportClass = $this->_parseTransportMap($defaultTransport, $transportMap);
$transport = call_user_func(array($transportClass, 'getTransport'), $transportConfig);
if (!$transport instanceof Zend_Mail_Transport_Abstract) {
/**
* @see Zym_App_Resource_Mail_Exception
*/
require_once 'Zym/App/Resource/Mail/Exception.php';
throw new Zym_App_Resource_Mail_Exception('Could not load mail transport "' . $defaultTransport . '"');
}
return $transport;
}
示例15: init
public function init(Zend_Config $options)
{
$language = new X_VlcShares_Plugins_Helper_Language($options->get('language', new Zend_Config(array())));
$ffmpeg = new X_VlcShares_Plugins_Helper_FFMpeg($options->get('ffmpeg', new Zend_Config(array())));
$devices = new X_VlcShares_Plugins_Helper_Devices($options->get('devices', new Zend_Config(array())));
$stream = new X_VlcShares_Plugins_Helper_Stream($options->get('stream', new Zend_Config(array())));
$paginator = new X_VlcShares_Plugins_Helper_Paginator($options->get('paginator', new Zend_Config(array())));
$hoster = new X_VlcShares_Plugins_Helper_Hoster();
$rtmpdump = new X_VlcShares_Plugins_Helper_RtmpDump($options->get('rtmpdump', new Zend_Config(array())));
$sopcast = new X_VlcShares_Plugins_Helper_SopCast($options->get('sopcast', new Zend_Config(array())));
//$vlc = new X_VlcShares_Plugins_Helper_Vlc($options->get('vlc', new Zend_Config(array())));
$streamer = new X_VlcShares_Plugins_Helper_Streamer($options->get('streamer', new Zend_Config(array())));
$acl = X_VlcShares_Plugins_Helper_Acl::instance($options->get('acl', new Zend_Config(array())));
$this->registerHelper('language', $language, true)->registerHelper('ffmpeg', $ffmpeg, true)->registerHelper('devices', $devices, true)->registerHelper('stream', $stream, true)->registerHelper('paginator', $paginator, true)->registerHelper('hoster', $hoster, true)->registerHelper('rtmpdump', $rtmpdump, true)->registerHelper('streamer', $streamer, true)->registerHelper('sopcast', $sopcast, true)->registerHelper('acl', $acl, true);
}