本文整理汇总了PHP中Component::params方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::params方法的具体用法?PHP Component::params怎么用?PHP Component::params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPublication
/**
* Return data on a publication view (this will be some form of HTML)
*
* @param object $publication Current publication
* @param string $option Name of the component
* @param array $areas Active area(s)
* @param string $rtrn Data to be returned
* @param string $version Version name
* @param boolean $extended Whether or not to show panel
* @param string $authorized
* @return array
*/
public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true, $authorized = false)
{
$arr = array('html' => '', 'metadata' => '');
// Check if our area is in the array of areas we want to return results for
if (is_array($areas)) {
if (!array_intersect($areas, $this->onPublicationAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationAreas($publication)))) {
$rtrn = 'metadata';
}
}
$database = App::get('db');
// Get pub configs
$config = Component::params($option);
if ($rtrn == 'all' || $rtrn == 'html') {
$objV = new \Components\Publications\Tables\Version($database);
$versions = $objV->getVersions($publication->id, $filters = array('public' => 1));
// Instantiate a view
$view = new \Hubzero\Plugin\View(array('folder' => 'publications', 'element' => 'versions', 'name' => 'browse'));
// Are we allowing contributions
$view->contributable = Plugin::isEnabled('projects', 'publications') ? 1 : 0;
// Pass the view some info
$view->option = $option;
$view->publication = $publication;
$view->versions = $versions;
$view->config = $config;
$view->authorized = $authorized;
if ($this->getError()) {
$view->setError($this->getError());
}
// Return the output
$arr['html'] = $view->loadTemplate();
}
return $arr;
}
示例2: get_conf
function get_conf($db_id)
{
global $dv_conf, $com_name;
$db_dv_conf = array();
$db_name = $db_id['name'];
// Base directory
$dv_conf['db_base_dir'] = Component::params('com_databases')->get('base_dir');
if (!$dv_conf['db_base_dir'] || $dv_conf['db_base_dir'] == '') {
$dv_conf['db_base_dir'] = '/db/databases';
}
$db_conf_file = "{$dv_conf['db_base_dir']}/{$db_name}/database.json";
$db_conf = json_decode(file_get_contents($db_conf_file), true);
$dv_conf['db'] = array_merge($dv_conf['db'], $db_conf['database_ro']);
$dv_conf_file = "{$dv_conf['db_base_dir']}/{$db_name}/applications/{$com_name}/config.json";
if (file_exists($dv_conf_file)) {
$db_dv_conf = json_decode(file_get_contents($dv_conf_file), true);
if (!is_array($db_dv_conf)) {
$db_dv_conf = array();
}
if (isset($db_dv_conf['settings'])) {
$db_dv_conf['settings'] = array_merge($dv_conf['settings'], $db_dv_conf['settings']);
}
}
$dv_conf = array_merge($dv_conf, $db_dv_conf);
return $dv_conf;
}
示例3: __construct
/**
* Constructor
*
* @param object &$subject Event observer
* @param array $config Optional config values
* @return void
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$this->infolink = '/kb/points/';
$this->banking = Component::params('com_members')->get('bankAccounts');
include_once __DIR__ . DS . 'helper.php';
}
示例4: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication('administrator');
$search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', '');
$this->setState('filter.published', $published);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int');
$this->setState('filter.parent_id', $parentId);
$level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
$this->setState('filter.level', $level);
$menuType = Request::getVar('menutype', null);
if ($menuType) {
if ($menuType != $app->getUserState($this->context . '.filter.menutype')) {
$app->setUserState($this->context . '.filter.menutype', $menuType);
Request::setVar('limitstart', 0);
}
} else {
$menuType = $app->getUserState($this->context . '.filter.menutype');
if (!$menuType) {
$menuType = $this->getDefaultMenuType();
}
}
$this->setState('filter.menutype', $menuType);
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
$this->setState('filter.language', $language);
// Component parameters.
$params = Component::params('com_menus');
$this->setState('params', $params);
// List state information.
parent::populateState('a.lft', 'asc');
}
示例5: __construct
/**
* Constructor
*
* @param object &$subject Event observer
* @param array $config Optional config values
* @return void
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// load plugin parameters
$this->_config = Component::params('com_projects');
$this->_database = App::get('db');
}
示例6: getUDBO
/**
* Return a usage database object
*
* @return mixed
*/
public static function getUDBO()
{
static $instance;
if (!is_object($instance)) {
$config = \Component::params('com_usage');
$options['driver'] = $config->get('statsDBDriver');
$options['host'] = $config->get('statsDBHost');
$options['port'] = $config->get('statsDBPort');
$options['user'] = $config->get('statsDBUsername');
$options['password'] = $config->get('statsDBPassword');
$options['database'] = $config->get('statsDBDatabase');
$options['prefix'] = $config->get('statsDBPrefix');
$options['ssl_ca'] = $config->get('statsDBSSLCa');
if ((!isset($options['password']) || $options['password'] == '') && (!isset($options['user']) || $options['user'] == '') && (!isset($options['database']) || $options['database'] == '')) {
$instance = App::get('db');
} else {
try {
$options['driver'] = $options['driver'] == 'mysql' ? 'pdo' : $options['driver'];
$instance = \Hubzero\Database\Driver::getInstance($options);
} catch (Exception $e) {
$instance = App::get('db');
}
}
}
if ($instance instanceof Exception) {
return null;
}
return $instance;
}
示例7: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$this->setState('user.id', User::get('id'));
// Load the parameters.
$params = Component::params('com_messages');
$this->setState('params', $params);
}
示例8: __construct
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Ensure that constructor is called one time
self::$cookie = SID == '';
if (!self::$default_lang) {
$app = JFactory::getApplication();
$router = $app->getRouter();
if (App::isSite()) {
// setup language data
self::$mode_sef = $router->getMode() == JROUTER_MODE_SEF ? true : false;
self::$sefs = JLanguageHelper::getLanguages('sef');
self::$lang_codes = JLanguageHelper::getLanguages('lang_code');
self::$default_lang = Component::params('com_languages')->get('site', 'en-GB');
self::$default_sef = self::$lang_codes[self::$default_lang]->sef;
self::$homes = MultilangstatusHelper::getHomepages();
$user = User::getRoot();
$levels = $user->getAuthorisedViewLevels();
foreach (self::$sefs as $sef => &$language) {
if (isset($language->access) && $language->access && !in_array($language->access, $levels)) {
unset(self::$sefs[$sef]);
}
}
App::forget('language.filter');
App::set('language.filter', true);
$uri = JFactory::getURI();
if (self::$mode_sef) {
// Get the route path from the request.
$path = JString::substr($uri->toString(), JString::strlen($uri->base()));
// Apache mod_rewrite is Off
$path = Config::get('sef_rewrite') ? $path : JString::substr($path, 10);
// Trim any spaces or slashes from the ends of the path and explode into segments.
$path = JString::trim($path, '/ ');
$parts = explode('/', $path);
// The language segment is always at the beginning of the route path if it exists.
$sef = $uri->getVar('lang');
if (!empty($parts) && empty($sef)) {
$sef = reset($parts);
}
} else {
$sef = $uri->getVar('lang');
}
if (isset(self::$sefs[$sef])) {
$lang_code = self::$sefs[$sef]->lang_code;
// Create a cookie
$cookie_domain = Config::get('cookie_domain', '');
$cookie_path = Config::get('cookie_path', '/');
setcookie(App::hash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain);
// set the request var
Request::setVar('language', $lang_code);
}
}
parent::__construct($subject, $config);
// Detect browser feature
if (App::isSite()) {
$app->setDetectBrowser($this->params->get('detect_browser', '1') == '1');
}
}
}
示例9: execute
/**
* Execute a task
*
* @return void
*/
public function execute()
{
$this->config->set('banking', \Component::params('com_members')->get('bankAccounts'));
$this->registerTask('__default', 'search');
$this->registerTask('display', 'search');
$this->registerTask('latest', 'latest.rss');
parent::execute();
}
示例10: execute
/**
* Execute a task
*
* @return void
*/
public function execute()
{
$this->banking = \Component::params('com_members')->get('bankAccounts');
$this->registerTask('add', 'edit');
$this->registerTask('apply', 'save');
$this->registerTask('reject', 'accept');
parent::execute();
}
示例11: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
// Load the User state.
$pk = (int) Request::getInt('id');
$this->setState('style.id', $pk);
// Load the parameters.
$params = Component::params('com_templates');
$this->setState('params', $params);
}
示例12: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState()
{
$params = Component::params('com_languages');
// Load the User state.
$langId = (int) Request::getInt('lang_id');
$this->setState('language.id', $langId);
// Load the parameters.
$this->setState('params', $params);
}
示例13: fileSpacePath
/**
* Return imports filespace path
*
* @return string
*/
public function fileSpacePath()
{
// get com resources params
$params = \Component::params('com_resources');
// build upload path
$uploadPath = $params->get('import_hooks_uploadpath', '/site/resources/import/hooks');
$uploadPath = PATH_APP . DS . trim($uploadPath, DS) . DS . $this->get('id');
// return path
return $uploadPath;
}
示例14: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$app = JFactory::getApplication('administrator');
// Load the User state.
$id = (int) Request::getInt('id');
$this->setState('menu.id', $id);
// Load the parameters.
$params = Component::params('com_menus');
$this->setState('params', $params);
}
示例15: __construct
/**
* Constructor
*
* @return void
*/
public function __construct($path = NULL)
{
// Get component configs
$configs = Component::params('com_projects');
// Set path to git
$this->_gitpath = $configs->get('gitpath', '/opt/local/bin/git');
// Set repo path
$this->_path = $path;
// Set acting user
$this->_uid = User::get('id');
}