本文整理汇总了PHP中JComponentHelper::GetParams方法的典型用法代码示例。如果您正苦于以下问题:PHP JComponentHelper::GetParams方法的具体用法?PHP JComponentHelper::GetParams怎么用?PHP JComponentHelper::GetParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JComponentHelper
的用法示例。
在下文中一共展示了JComponentHelper::GetParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBasePath
/**
* Method to get the base upload path for a project
*
* @param int $project Optional project id
*
* @return string $basepath The upload directory
*/
public static function getBasePath($project = null)
{
static $cache = array();
$project = (int) $project;
// Check the cache
if (isset($cache[$project])) {
return $cache[$project];
}
$params = JComponentHelper::GetParams('com_pfrepo');
$dest = $params->get('repo_basepath', '/media/com_projectfork/repo/');
$base = JPATH_SITE . '/';
$fchar = substr($dest, 0, 1);
$lchar = substr($dest, -1, 1);
if ($fchar == '/' || $fchar == '\\') {
$dest = substr($dest, 1);
}
if ($lchar == '/' || $lchar == '\\') {
$dest = substr($dest, 0, -1);
}
if ($project) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('path')->from('#__pf_repo_dirs')->where('project_id = ' . $project)->where('parent_id = 1');
$db->setQuery($query);
$path = $db->loadResult();
if (empty($path)) {
$query->clear()->select('alias')->from('#__pf_projects')->where('id = ' . $project);
$db->setQuery($query);
$path = $db->loadResult();
}
if ($path) {
$dest .= '/' . $path;
}
}
$cache[$project] = JPath::clean($base . $dest);
return $cache[$project];
}
示例2: getProjectParams
/**
* Method to get the Projectfork config settings merged into
* the project settings
*
* @param integer $id Optional project id. If not provided, will use the currently active project
*
* @return object $params The config settings
*/
public static function getProjectParams($id = 0)
{
static $cache = array();
$project = $id > 0 ? (int) $id : self::getActiveProjectId();
if (array_key_exists($project, $cache)) {
return $cache[$project];
}
$params = JComponentHelper::GetParams('com_projectfork');
// Get the project parameters if they exist
if ($project) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('attribs')->from('#__pf_projects')->where('id = ' . $db->quote($project));
$db->setQuery((string) $query);
$attribs = $db->loadResult();
if (!empty($attribs)) {
$registry = new JRegistry();
$registry->loadString($attribs);
$params->merge($registry);
}
}
$cache[$project] = $params;
return $cache[$project];
}
示例3: getBasePath
/**
* Method to get the base upload path for a design
*
* @param int $project Optional project id
*
* @return string $basepath The upload directory
*/
public static function getBasePath($project = NULL)
{
jimport('joomla.filesystem.path');
$params = JComponentHelper::GetParams('com_pfdesigns');
$base = JPATH_SITE . '/';
$dest = $params->get('design_basepath', '/images/com_projectfork/designs/');
$fchar = substr($dest, 0, 1);
$lchar = substr($dest, -1, 1);
if ($fchar == '/' || $fchar == '\\') {
$dest = substr($dest, 1);
}
if ($lchar == '/' || $lchar == '\\') {
$dest = substr($dest, 0, -1);
}
if (is_numeric($project)) {
$dest .= '/project_' . (int) $project;
}
$basepath = JPath::clean($base . $dest);
return $basepath;
}