本文整理汇总了PHP中JApplicationHelper::getClientInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationHelper::getClientInfo方法的具体用法?PHP JApplicationHelper::getClientInfo怎么用?PHP JApplicationHelper::getClientInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplicationHelper
的用法示例。
在下文中一共展示了JApplicationHelper::getClientInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Method to get a list of items.
*
* @return mixed An array of objects on success, false on failure.
*/
public function getItems()
{
// Get the list of items from the database.
$items = parent::getItems();
$client = JApplicationHelper::getClientInfo($this->getState('filter.client_id', 0));
$lang = JFactory::getLanguage();
// Loop through the results to add the XML metadata,
// and load language support.
foreach ($items as &$item) {
$path = JPath::clean($client->path . '/modules/' . $item->module . '/' . $item->module . '.xml');
if (file_exists($path)) {
$item->xml = simplexml_load_file($path);
} else {
$item->xml = null;
}
// 1.5 Format; Core files or language packs then
// 1.6 3PD Extension Support
$lang->load($item->module . '.sys', $client->path, null, false, true) || $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, null, false, true);
$item->name = JText::_($item->name);
if (isset($item->xml) && ($text = trim($item->xml->description))) {
$item->desc = JText::_($text);
} else {
$item->desc = JText::_('COM_MODULES_NODESCRIPTION');
}
}
$items = JArrayHelper::sortObjects($items, 'name', 1, true, true);
// TODO: Use the cached XML from the extensions table?
return $items;
}
示例2: getGroups
/**
* Method to get the list of template style options
* grouped by template.
* Use the client attribute to specify a specific client.
* Use the template attribute to specify a specific template
*
* @return array The field option objects as a nested array in groups.
*
* @since 11.1
*/
protected function getGroups()
{
// Initialize variables.
$groups = array();
$lang = JFactory::getLanguage();
// Get the client and client_id.
$clientName = $this->element['client'] ? (string) $this->element['client'] : 'site';
$client = JApplicationHelper::getClientInfo($clientName, true);
// Get the template.
$template = (string) $this->element['template'];
// Get the database object and a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Build the query.
$query->select('s.id, s.title, e.name as name, s.template');
$query->from('#__template_styles as s');
$query->where('s.client_id = ' . (int) $client->id);
$query->order('template');
$query->order('title');
if ($template)
{
$query->where('s.template = ' . $db->quote($template));
}
$query->join('LEFT', '#__extensions as e on e.element=s.template');
$query->where('e.enabled=1');
// Set the query and load the styles.
$db->setQuery($query);
$styles = $db->loadObjectList();
// Build the grouped list array.
if ($styles)
{
foreach ($styles as $style)
{
$template = $style->template;
$lang->load('tpl_' . $template . '.sys', $client->path, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, null, false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path, $lang->getDefault(), false, false)
|| $lang->load('tpl_' . $template . '.sys', $client->path . '/templates/' . $template, $lang->getDefault(), false, false);
$name = JText::_($style->name);
// Initialize the group if necessary.
if (!isset($groups[$name]))
{
$groups[$name] = array();
}
$groups[$name][] = JHtml::_('select.option', $style->id, $style->title);
}
}
// Merge any additional groups in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}
示例3: getInstance
/**
* Returns a JMenu object
*
* @param string $client The name of the client
* @param array $options An associative array of options
*
* @return JMenu A menu object.
*
* @since 11.1
*/
public static function getInstance($client, $options = array())
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
if (empty($instances[$client])) {
//Load the router object
$info = JApplicationHelper::getClientInfo($client, true);
$path = $info->path . '/includes/menu.php';
if (file_exists($path)) {
include_once $path;
// Create a JPathway object
$classname = 'JMenu' . ucfirst($client);
$instance = new $classname($options);
} else {
//$error = JError::raiseError(500, 'Unable to load menu: '.$client);
//TODO: Solve this
$error = null;
return $error;
}
$instances[$client] =& $instance;
}
return $instances[$client];
}
示例4: getInstance
/**
* Returns a JPathway object
*
* @param string $client The name of the client
* @param array $options An associative array of options
*
* @return JPathway A JPathway object.
*
* @since 11.1
*/
public static function getInstance($client, $options = array())
{
static $instances;
if (!isset($instances))
{
$instances = array();
}
if (empty($instances[$client]))
{
//Load the router object
$info = JApplicationHelper::getClientInfo($client, true);
$path = $info->path . '/includes/pathway.php';
if (file_exists($path))
{
include_once $path;
// Create a JPathway object
$classname = 'JPathway' . ucfirst($client);
$instance = new $classname($options);
}
else
{
$error = JError::raiseError(500, JText::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client));
return $error;
}
$instances[$client] = & $instance;
}
return $instances[$client];
}
示例5: initialise
/**
* Initialise the application.
*
* @param array An optional associative array of configuration settings.
*/
function initialise($options = array())
{
$config =& JFactory::getConfig();
// if a language was specified it has priority
// otherwise use user or default language settings
if (empty($options['language'])) {
$user =& JFactory::getUser();
$lang = $user->getParam('admin_language');
// Make sure that the user's language exists
if ($lang && JLanguage::exists($lang)) {
$options['language'] = $lang;
} else {
$params = JComponentHelper::getParams('com_languages');
$client =& JApplicationHelper::getClientInfo($this->getClientId());
$options['language'] = $params->get($client->name, $config->getValue('config.language', 'en-GB'));
}
}
// One last check to make sure we have something
if (!JLanguage::exists($options['language'])) {
$lang = $config->getValue('config.language', 'en-GB');
if (JLanguage::exists($lang)) {
$options['language'] = $lang;
} else {
$options['language'] = 'en-GB';
// as a last ditch fail to english
}
}
parent::initialise($options);
}
示例6: getOptions
protected function getOptions()
{
$options = array();
$client = JApplicationHelper::getClientInfo('site', true);
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('s.id, s.title, e.name as name, s.template');
$query->from('#__template_styles as s');
$query->where('s.client_id = ' . (int) $client->id);
$query->order('template');
$query->order('title');
$query->join('LEFT', '#__extensions as e on e.element=s.template');
$query->where('e.enabled=1');
$query->where($db->quoteName('e.type') . '=' . $db->quote('template'));
$db->setQuery($query);
if ($error = $db->getErrorMsg()) {
throw new Exception($error);
}
$templates = $db->loadObjectList();
foreach ($templates as $item) {
$options[] = JHTML::_('select.option', $item->id, $item->title);
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例7: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 1.6
*/
protected function getInput()
{
// Get the client id.
$clientId = $this->element['client_id'];
if (!isset($clientId)) {
$clientName = $this->element['client'];
if (isset($clientName)) {
$client = JApplicationHelper::getClientInfo($clientName, true);
$clientId = $client->id;
}
}
if (!isset($clientId) && $this->form instanceof JForm) {
$clientId = $this->form->getValue('client_id');
}
$clientId = (int) $clientId;
// Load the modal behavior script.
JHtml::_('behavior.modal', 'a.modal');
// Build the script.
$script = array();
$script[] = ' function jSelectPosition_' . $this->id . '(name) {';
$script[] = ' document.id("' . $this->id . '").value = name;';
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_' . $this->id . '&client_id=' . $clientId;
// The current user display field.
$html[] = '<div class="input-append">';
$html[] = parent::getInput() . '<a class="btn modal" title="' . JText::_('COM_MODULES_CHANGE_POSITION_TITLE') . '" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . '<i class="icon-screenshot"></i> ' . JText::_('COM_MODULES_CHANGE_POSITION_BUTTON') . '</a>';
$html[] = '</div>';
return implode("\n", $html);
}
示例8: initialise
/**
* Initialise the application.
*
* @param array $options An optional associative array of configuration settings.
*
* @return void
* @since 1.5
*/
public function initialise($options = array())
{
$config = JFactory::getConfig();
// if a language was specified it has priority
// otherwise use user or default language settings
if (empty($options['language'])) {
$user = JFactory::getUser();
$lang = $user->getParam('admin_language');
// Make sure that the user's language exists
if ($lang && JLanguage::exists($lang)) {
$options['language'] = $lang;
} else {
$params = JComponentHelper::getParams('com_languages');
$client = JApplicationHelper::getClientInfo($this->getClientId());
$options['language'] = $params->get($client->name, $config->get('language', 'es-LA'));
}
}
// One last check to make sure we have something
if (!JLanguage::exists($options['language'])) {
$lang = $config->get('language', 'es-LA');
if (JLanguage::exists($lang)) {
$options['language'] = $lang;
} else {
$options['language'] = 'es-LA';
// as a last ditch fail to english
}
}
// Execute the parent initialise method.
parent::initialise($options);
// Load Library language
$lang = JFactory::getLanguage();
$lang->load('lib_joomla', JPATH_ADMINISTRATOR, null, false, true);
}
示例9: showPopup
function showPopup()
{
global $mainframe;
jimport('joomla.application.helper');
$client = JApplicationHelper::getClientInfo($mainframe->getClientID());
// settings from config.xml
$dumpConfig =& JComponentHelper::getParams('com_dump');
$w = $dumpConfig->get('popupwidth', 500);
$h = $dumpConfig->get('popupheight', 500);
// build the url
$url = JURI::base(true) . '/index.php?option=com_dump&view=tree&tmpl=component';
/* @TODO remove this and implement this in a later version using JRoute
// only add Itemid in Site
if ( $mainframe->isSite() ) {
$url .= '&Itemid=' . DumpHelper::getComponentItemid( 'com_dump' );
}
*/
// create the javascript
// We can't use $document, because it's already rendered
$nl = "\n";
$script = $nl . '<!-- J!Dump -->' . $nl . '<script type="text/javascript">' . $nl . '// <!--' . $nl . 'window.open( "' . $url . '", "dump_' . $client->name . '", "height=' . $h . ',width=' . $w . ',toolbar=0,status=0,menubar=0,scrollbars=1,resizable=1");' . $nl . '// -->' . $nl . '</script>' . $nl . '<!-- / J!Dump -->';
// add the code to the header (thanks jenscski)
// JResponse::appendBody( $script );
$body = JResponse::getBody();
$body = str_replace('</head>', $script . '</head>', $body);
JResponse::setBody($body);
}
示例10: getFiles
/**
* Method to get a list of all the files to edit in a template.
*
* @return array A nested array of relevant files.
* @since 1.6
*/
public function getFiles()
{
// Initialise variables.
$result = array();
if ($template = $this->getTemplate()) {
jimport('joomla.filesystem.folder');
$client = JApplicationHelper::getClientInfo($template->client_id);
$path = JPath::clean($client->path . '/templates/' . $template->element . '/');
$lang = JFactory::getLanguage();
// Load the core and/or local language file(s).
$lang->load('tpl_' . $template->element, $client->path, null, false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element, $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element, $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false);
// Check if the template path exists.
if (is_dir($path)) {
$result['main'] = array();
$result['css'] = array();
$result['clo'] = array();
$result['mlo'] = array();
$result['html'] = array();
// Handle the main PHP files.
$result['main']['index'] = $this->getFile($path, 'index.php');
$result['main']['error'] = $this->getFile($path, 'error.php');
$result['main']['print'] = $this->getFile($path, 'component.php');
$result['main']['offline'] = $this->getFile($path, 'offline.php');
// Handle the CSS files.
$files = JFolder::files($path . '/css', '\\.css$', false, false);
foreach ($files as $file) {
$result['css'][] = $this->getFile($path . '/css/', 'css/' . $file);
}
} else {
$this->setError(JText::_('COM_TEMPLATES_ERROR_TEMPLATE_FOLDER_NOT_FOUND'));
return false;
}
}
return $result;
}
示例11: _loadItems
/**
* Current discovered extension list
*/
function _loadItems()
{
jimport('joomla.filesystem.folder');
/* Get a database connector */
$db =& JFactory::getDBO();
$query = 'SELECT *' . ' FROM #__extensions' . ' WHERE state = -1' . ' ORDER BY type, client_id, folder, name';
$db->setQuery($query);
$rows = $db->loadObjectList();
$apps =& JApplicationHelper::getClientInfo();
$numRows = count($rows);
for ($i = 0; $i < $numRows; $i++) {
$row =& $rows[$i];
if (strlen($row->manifest_cache)) {
$data = unserialize($row->manifest_cache);
if ($data) {
foreach ($data as $key => $value) {
$row->{$key} = $value;
}
}
}
$row->jname = JString::strtolower(str_replace(" ", "_", $row->name));
if (isset($apps[$row->client_id])) {
$row->client = ucfirst($apps[$row->client_id]->name);
} else {
$row->client = $row->client_id;
}
}
$this->setState('pagination.total', $numRows);
if ($this->_state->get('pagination.limit') > 0) {
$this->_items = array_slice($rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit'));
} else {
$this->_items = $rows;
}
}
示例12: array
/**
* Returns a reference to the global JRouter object, only creating it if it
* doesn't already exist.
*
* This method must be invoked as:
* <pre> $menu = &JRouter::getInstance();</pre>
*
* @access public
* @param string $client The name of the client
* @param array $options An associative array of options
* @return JRouter A router object.
*/
function &getInstance($client, $options = array())
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
if (empty($instances[$client])) {
//Load the router object
$info =& JApplicationHelper::getClientInfo($client, true);
$classname = 'JRouter' . ucfirst($client);
if (!class_exists($classname)) {
$path = $info->path . DS . 'includes' . DS . 'router.php';
if (file_exists($path)) {
require_once $path;
}
}
if (!class_exists($classname)) {
$error = JError::raiseError(500, 'Unable to load router: ' . $client);
return $error;
}
$instance = new $classname($options);
$instances[$client] =& $instance;
}
return $instances[$client];
}
示例13: array
/**
* Returns a reference to a JMenu object
*
* This method must be invoked as:
* <pre> $menu = &JSite::getMenu();</pre>
*
* @access public
* @param string $client The name of the client
* @param array $options An associative array of options
* @return JMenu A menu object.
* @since 1.5
*/
function &getInstance($client, $options = array())
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
if (empty($instances[$client])) {
//Load the router object
$info =& JApplicationHelper::getClientInfo($client, true);
$path = $info->path . DS . 'includes' . DS . 'menu.php';
if (file_exists($path)) {
require_once $path;
// Create a JPathway object
$classname = 'JMenu' . ucfirst($client);
$instance = new $classname($options);
} else {
//$error = JError::raiseError( 500, 'Unable to load menu: '.$client);
$error = null;
//Jinx : need to fix this
return $error;
}
$instances[$client] =& $instance;
}
return $instances[$client];
}
示例14: initialise
/**
* Initialise the application.
*
* @access public
*/
function initialise( $options = array())
{
// if a language was specified it has priority
// otherwise use user or default language settings
if (empty($options['language']))
{
$user = & JFactory::getUser();
$lang = $user->getParam( 'language' );
// Make sure that the user's language exists
if ( $lang && JLanguage::exists($lang) ) {
$options['language'] = $lang;
}
else
{
$params = JComponentHelper::getParams('com_extensions');
$client =& JApplicationHelper::getClientInfo($this->getClientId());
$options['language'] = $params->get('language_'.$client->name, 'en-GB');
}
}
// One last check to make sure we have something
if ( ! JLanguage::exists($options['language']) ) {
$options['language'] = 'en-GB';
}
parent::initialise($options);
}
示例15: __construct
function __construct(JXMLElement $element = null)
{
if ($element && is_a($element, 'JXMLElement')) {
$this->type = (string) $element->attributes()->type;
$this->id = (string) $element->attributes()->id;
switch ($this->type) {
case 'component':
// by default a component doesn't have anything
break;
case 'module':
case 'template':
case 'language':
$this->client = (string) $element->attributes()->client;
$this->client_id = JApplicationHelper::getClientInfo($this->client, 1);
$this->client_id = $this->client_id->id;
break;
case 'plugin':
$this->group = (string) $element->attributes()->group;
break;
default:
// catch all
// get and set client and group if we don't recognise the extension
if ($client = (string) $element->attributes()->client) {
$this->client_id = JApplicationHelper::getClientInfo($this->client, 1);
$this->client_id = $this->client_id->id;
}
if ($group = (string) $element->attributes()->group) {
$this->group = (string) $element->attributes()->group;
}
break;
}
$this->filename = (string) $element;
}
}