コード例 #1
0
ファイル: select.php プロジェクト: esorone/efcpw
 /**
  * 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
0
	/**
	 * 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
0
ファイル: menu.php プロジェクト: Radek-Suski/joomla-platform
 /**
  * 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
0
ファイル: pathway.php プロジェクト: nikosdion/Akeeba-Example
	/**
	 * 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
0
ファイル: application.php プロジェクト: joebushi/joomla
 /**
  * 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
0
ファイル: templates.php プロジェクト: vstorm83/propertease
 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
0
 /**
  * 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
0
 /**
  * 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
0
ファイル: helper.php プロジェクト: justinlyon/scc
 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
0
ファイル: template.php プロジェクト: vuchannguyen/hoctap
 /**
  * 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
0
ファイル: discover.php プロジェクト: joebushi/joomla
 /**
  * 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
0
ファイル: router.php プロジェクト: stonyyi/anahita
 /**
  * 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
0
ファイル: menu.php プロジェクト: RangerWalt/ecci
 /**
  * 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
0
ファイル: application.php プロジェクト: raeldc/com_learn
	/**
	* 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
0
ファイル: extension.php プロジェクト: joebushi/joomla
 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;
     }
 }
コード例 #16
0
ファイル: view.html.php プロジェクト: justinlyon/scc
 function display($tpl = null)
 {
     global $mainframe;
     // we need to add these paths so the component can work in both site and administrator
     $this->addTemplatePath(dirname(__FILE__) . DS . 'tmpl');
     // client information (site, administrator, ... )
     jimport('joomla.application.helper');
     $client = JApplicationHelper::getClientInfo($mainframe->getClientID());
     // make sure we only show the component
     JRequest::setVar('tmpl', 'component');
     $document =& JFactory::getDocument();
     $document->setTitle('J!Dump - ' . ucfirst($client->name));
     $document->addScriptDeclaration("var imageFolder =  '" . DUMP_URL . "assets/images/'");
     // Path to images
     $document->addStyleSheet(DUMP_URL . 'assets/css/folder-tree-static.css');
     $document->addStyleSheet(DUMP_URL . 'assets/css/dump.css');
     $document->addScript(DUMP_URL . 'assets/js/folder-tree-static.js');
     $document->addScript(DUMP_URL . 'assets/js/dump.js');
     // render tree and assign to template
     $tree =& $this->renderTree();
     $this->assignRef('tree', $tree);
     $this->assignRef('application', $client->name);
     $this->assign('version', DUMP_VERSION);
     $this->assign('closebutton', JRequest::getVar('closebutton', 1));
     parent::display($tpl);
 }
コード例 #17
0
 /**
  * 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   1.5
  * @throws  RuntimeException
  */
 public static function getInstance($client, $options = array())
 {
     if (empty(self::$instances[$client])) {
         // Create a JPathway object
         $classname = 'JPathway' . ucfirst($client);
         if (!class_exists($classname)) {
             // @deprecated 4.0 Everything in this block is deprecated but the warning is only logged after the file_exists
             // Load the pathway object
             $info = JApplicationHelper::getClientInfo($client, true);
             if (is_object($info)) {
                 $path = $info->path . '/includes/pathway.php';
                 if (file_exists($path)) {
                     JLog::add('Non-autoloadable JPathway subclasses are deprecated, support will be removed in 4.0.', JLog::WARNING, 'deprecated');
                     include_once $path;
                 }
             }
         }
         if (class_exists($classname)) {
             self::$instances[$client] = new $classname($options);
         } else {
             throw new RuntimeException(JText::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client), 500);
         }
     }
     return self::$instances[$client];
 }
コード例 #18
0
 /**
  *
  * Disable JT3 infomode
  *
  * @return: Save setting to file params.ini
  */
 public function disableInfoMode()
 {
     JSNFactory::localimport('libraries.joomlashine.database');
     $template = JSNDatabase::getDefaultTemplate();
     $client = JApplicationHelper::getClientInfo($template->client_id);
     $file = $client->path . '/templates/' . $template->element . '/params.ini';
     $data = JFile::read($file);
     $data = explode("\n", $data);
     $params = array();
     $needChange = false;
     foreach ($data as $val) {
         $spos = strpos($val, "=");
         $key = substr($val, 0, $spos);
         $value = substr($val, $spos + 1, strlen($val) - $spos);
         if ($key == 'infomode') {
             if ($value == '"1"') {
                 $value = '"0"';
                 $needChange = true;
             }
         }
         $params[$key] = $value;
     }
     if ($needChange) {
         $data = array();
         foreach ($params as $key => $val) {
             $data[] = $key . '=' . $val;
         }
         $data = implode("\n", $data);
         if (JFile::exists($file)) {
             @chmod($file, 0777);
         }
         JFile::write($file, $data);
     }
 }
コード例 #19
0
ファイル: view.html.php プロジェクト: joebushi/joomla
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('Template Manager'), 'thememanager');
     JToolBarHelper::custom('edit', 'back.png', 'back_f2.png', 'Back', false, false);
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'templates.php';
     // Initialise some variables
     $option = JRequest::getCmd('option');
     $id = JRequest::getVar('id', '', 'method', 'int');
     $template = TemplatesHelper::getTemplateName($id);
     $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     $tp = true;
     $url = $client->id ? JURI::base() : JURI::root();
     if (!$template) {
         return JError::raiseWarning(500, JText::_('Template not specified'));
     }
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     $this->assignRef('option', $option);
     $this->assignRef('client', $client);
     $this->assignRef('id', $id);
     $this->assignRef('template', $template);
     $this->assignRef('tp', $tp);
     $this->assignRef('url', $url);
     parent::display($tpl);
 }
コード例 #20
0
ファイル: collection.php プロジェクト: akksi/jcg
 /**
  * Opening an XML element
  * @param object parser object
  * @param string name of element that is opened
  * @param array array of attributes for the element
  */
 public function _startElement($parser, $name, $attrs = array())
 {
     array_push($this->_stack, $name);
     $tag = $this->_getStackLocation();
     // reset the data
     eval('$this->' . $tag . '->_data = "";');
     switch ($name) {
         case 'CATEGORY':
             if (isset($attrs['REF'])) {
                 $this->update_sites[] = array('type' => 'collection', 'location' => $attrs['REF'], 'update_site_id' => $this->_update_site_id);
             } else {
                 // This item will have children, so prepare to attach them
                 $this->pop_parent = 1;
             }
             break;
         case 'EXTENSION':
             $update = JTable::getInstance('update');
             $update->set('update_site_id', $this->_update_site_id);
             foreach ($this->_updatecols as $col) {
                 // reset the values if it doesn't exist
                 if (!array_key_exists($col, $attrs)) {
                     $attrs[$col] = '';
                     if ($col == 'CLIENT') {
                         $attrs[$col] = 'site';
                     }
                 }
             }
             $client = JApplicationHelper::getClientInfo($attrs['CLIENT'], 1);
             $attrs['CLIENT_ID'] = $client->id;
             // lower case all of the fields
             foreach ($attrs as $key => $attr) {
                 $values[strtolower($key)] = $attr;
             }
             // only add the update if it is on the same platform and release as we are
             $ver = new JVersion();
             $product = strtolower(JFilterInput::getInstance()->clean($ver->PRODUCT, 'cmd'));
             // lower case and remove the exclamation mark
             // set defaults, the extension file should clarify in case but it may be only available in one version
             // this allows an update site to specify a targetplatform
             // targetplatformversion can be a regexp, so 1.[56] would be valid for an extension that supports 1.5 and 1.6
             // Note: whilst the version is a regexp here, the targetplatform is not (new extension per platform)
             //		Additionally, the version is a regexp here and it may also be in an extension file if the extension is
             //		compatible against multiple versions of the same platform (e.g. a library)
             if (!isset($values['targetplatform'])) {
                 $values['targetplatform'] = $product;
             }
             // set this to ourself as a default
             if (!isset($values['targetplatformversion'])) {
                 $values['targetplatformversion'] = $ver->RELEASE;
             }
             // set this to ourself as a default
             // validate that we can install the extension
             if ($product == $values['targetplatform'] && preg_match('/' . $values['targetplatformversion'] . '/', $ver->RELEASE)) {
                 $update->bind($values);
                 $this->updates[] = $update;
             }
             break;
     }
 }
コード例 #21
0
ファイル: languages.php プロジェクト: raeldc/com_learn
	public function getList()
	{
		if (!isset($this->_list))
		{
			$state = $this->_state;

			//Get application information
			$client	= JApplicationHelper::getClientInfo($state->application, true);
			if(!empty($client)) 
			{
			    $default = JComponentHelper::getParams('com_extensions')->get('language_'.$client->name, 'en-GB');
			    
			    //Find the languages
			    $languages = array();
                $path      = $client->path.'/language';

                foreach(new DirectoryIterator($path) as $folder)
                {
                    if($folder->isDir())
                    {
                       if(file_exists($folder->getRealPath().'/'.$folder->getFilename().'.xml')) 
                       { 
                           $languages[] = array(
                        		'path'        => $folder->getRealPath(),
                        		'application' => $client->name
                            );
                       }
                    }
                }
                
                //Set the total
			    $this->_total = count($languages);
                
			    //Apply limit and offset
                if($state->limit) {
                    $languages = array_slice($languages, $state->offset, $state->limit ? $state->limit : $this->_total);
                }
                
                //Apply direction
			    if(strtolower($state->direction) == 'desc') {
				    $languages = array_reverse($languages);
			    }

			    $rowset = KFactory::get('com://admin/extensions.database.rowset.languages');
			    foreach ($languages as $language)
			    {
				    $row = $rowset->getRow()->setData($language);
				    $row->default = ($row->name == $default);

				    $rowset->insert($row);
			    }

			    $this->_list = $rowset;	    
			} 
			else  throw new KModelException('Invalid application');
		}

		return parent::getList();
	}
コード例 #22
0
ファイル: cache.php プロジェクト: RuDers/JoomlaSQL
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', 0, 'int');
     $this->setState('clientId', $clientId == 1 ? 1 : 0);
     $client = JApplicationHelper::getClientInfo($clientId);
     $this->setState('client', $client);
     parent::populateState('group', 'asc');
 }
コード例 #23
0
ファイル: admin.cache.php プロジェクト: RangerWalt/ecci
 function deleteCache($cid)
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
     $cmData = new CacheData($client->path . DS . 'cache');
     $cmData->cleanCacheList($cid);
 }
コード例 #24
0
 /**
  * Override parent getItems to add extra XML metadata.
  *
  * @return  array
  *
  * @since   1.6
  */
 public function getItems()
 {
     $items = parent::getItems();
     foreach ($items as &$item) {
         $client = JApplicationHelper::getClientInfo($item->client_id);
         $item->xmldata = TemplatesHelper::parseXMLTemplateFile($client->path, $item->element);
     }
     return $items;
 }
コード例 #25
0
ファイル: helper.php プロジェクト: optimosolution/marhk
 /**
  * Clear Joomla Cache By groups, just apply for the front-page.
  *
  * @param array $group
  */
 function clearCacheByGroups($params, $groups)
 {
     // include cache model from the cache component
     $file = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_cache' . DS . 'cache.class.php';
     if (file_exists($file)) {
         $client =& JApplicationHelper::getClientInfo(0);
         $cmData = new CacheData($client->path . DS . 'cache');
         return $cmData->cleanCacheList($groups);
     }
 }
コード例 #26
0
 /**
  * Completely purges the cache
  */
 private function purgeCache()
 {
     JLoader::import('joomla.application.helper');
     JLoader::import('joomla.cms.application.helper');
     // Site client
     $client = JApplicationHelper::getClientInfo(0);
     $er = @error_reporting(0);
     $cache = JFactory::getCache('');
     $cache->clean('sillylongnamewhichcantexistunlessyouareacompletelyparanoiddeveloperinwhichcaseyoushouldnotbewritingsoftwareokay', 'notgroup');
     @error_reporting($er);
 }
コード例 #27
0
ファイル: style.php プロジェクト: kosmosby/medicine-prof
 public function getForm($data = array(), $loadData = true)
 {
     if ($data) {
         $data = (object) $data;
     } else {
         $data = $this->getItem();
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $style_xml_path = JPath::find(JForm::addFormPath(), strtolower('style') . '.xml');
     $style_xml = JFactory::getXML($style_xml_path, true);
     if (isset($data->template_id) && $data->template_id) {
         $styleObject = JUDownloadFrontHelperTemplate::getTemplateStyleObject($data->id);
         $folder = $styleObject->folder;
         $folder = strtolower(str_replace(' ', '', $folder));
         if ($folder) {
             $xml_file = JPath::clean(JPATH_SITE . "/components/com_judownload/templates/" . $folder . "/" . $folder . '.xml');
             if (JFile::exists($xml_file)) {
                 $xml = JFactory::getXML($xml_file);
                 if ($xml->config) {
                     foreach ($xml->config->children() as $child) {
                         $style_params_xpath = $style_xml->xpath('//fieldset[@name="params"]');
                         JUDownloadHelper::appendXML($style_params_xpath[0], $child);
                     }
                     if ($xml->languages->count()) {
                         foreach ($xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDownloadFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
     }
     $form = $this->loadForm('com_judownload.style', $style_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     $app = JFactory::getApplication();
     $id = $app->input->get('id', 0);
     if ($id) {
         $form->setFieldAttribute('template_id', 'disabled', 'true');
         $form->setFieldAttribute('template_id', 'filter', 'unset');
         if (isset($data->home) && $data->home == 1) {
             $form->setFieldAttribute('home', 'disabled', 'true');
         }
     }
     return $form;
 }
コード例 #28
0
	/**
	 * Method to get the field input markup.
	 *
	 * @return	string	The field input markup.
	 * @since	1.6
	 */
	protected function getInput()
	{
        $language =& JFactory::getLanguage();
        $language->load('mod_roknavmenu',JPATH_SITE);

		// 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&amp;view=positions&amp;layout=modal&amp;tmpl=component&amp;function=jSelectPosition_'.$this->id.'&amp;client_id='.$clientId;

		// The current user display field.
		$html[] = '<div class="fltlft">';
		$html[] = parent::getInput();
		$html[] = '</div>';

		// The user select button.
		$html[] = '<div class="button2-left">';
		$html[] = '  <div class="blank">';
		$html[] = '	<a class="modal" title="'.JText::_('MOD_ROKNAVMENU_SELECT_MODULE_POSITION').'"  href="'.$link.'" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('MOD_ROKNAVMENU_SELECT_MODULE_POSITION').'</a>';
		$html[] = '  </div>';
		$html[] = '</div>';

		return implode("\n", $html);
	}
コード例 #29
0
ファイル: quantitydisplay.php プロジェクト: q0821/esportshop
 function getLayout($template = '')
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     static $values = null;
     if ($values !== null) {
         return $values;
     }
     $client = JApplicationHelper::getClientInfo(0);
     // 0: Front client
     $tplDir = $client->path . DS . 'templates' . DS;
     $values = array();
     if (empty($template)) {
         $templates = JFolder::folders($tplDir);
         if (empty($templates)) {
             return null;
         }
     } else {
         $templates = array($template);
     }
     $groupAdded = false;
     foreach ($templates as $tpl) {
         $t = $tplDir . $tpl . DS . 'html' . DS . HIKASHOP_COMPONENT . DS;
         if (!JFolder::exists($t)) {
             continue;
         }
         $folders = JFolder::folders($t);
         if (empty($folders)) {
             continue;
         }
         foreach ($folders as $folder) {
             $files = JFolder::files($t . $folder . DS);
             if (empty($files)) {
                 continue;
             }
             foreach ($files as $file) {
                 if (substr($file, -4) == '.php') {
                     $file = substr($file, 0, -4);
                 }
                 if (substr($file, 0, 14) == 'show_quantity_' && !in_array($file, $this->default)) {
                     if (!$groupAdded) {
                         $values[] = '#' . $tpl;
                         $groupAdded = true;
                     }
                     $values[] = $file;
                 }
             }
         }
     }
     return $values;
 }
コード例 #30
-1
ファイル: field.php プロジェクト: ranrolls/ras-full-portal
 public function getForm($data = array(), $loadData = true)
 {
     if ($data) {
         $data = (object) $data;
     } else {
         $data = $this->getItem();
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $field_xml_path = JPath::find(JForm::addFormPath(), 'field.xml');
     $field_xml = JFactory::getXML($field_xml_path, true);
     if ($data->plugin_id) {
         $db = JFactory::getDbo();
         $query = 'SELECT folder, type' . ' FROM #__judirectory_plugins' . ' WHERE (id =' . $data->plugin_id . ')';
         $db->setQuery($query);
         $pluginObj = $db->loadObject();
         if ($pluginObj && $pluginObj->folder) {
             $folder = strtolower(str_replace(' ', '', $pluginObj->folder));
             $xml_file = JPATH_SITE . "/components/com_judirectory/fields/" . $folder . "/" . $folder . '.xml';
             if (JFile::exists($xml_file)) {
                 $field_plugin_xml = JFactory::getXML($xml_file);
                 if ($field_plugin_xml->config) {
                     foreach ($field_plugin_xml->config->children() as $child) {
                         $field_params_xpath = $field_xml->xpath('//fieldset[@name="params"]');
                         JUDirectoryHelper::appendXML($field_params_xpath[0], $child);
                     }
                     if ($field_plugin_xml->languages->count()) {
                         foreach ($field_plugin_xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDirectoryFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
     }
     $form = $this->loadForm('com_judirectory.field', $field_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     $ignored_options = explode(",", $data->ignored_options);
     foreach ($ignored_options as $ignored_option) {
         $form->setFieldAttribute($ignored_option, 'disabled', 'true');
         $form->setFieldAttribute($ignored_option, 'filter', 'unset');
     }
     if (!$this->canEditState($data)) {
         $form->setFieldAttribute('ordering', 'disabled', 'true');
         $form->setFieldAttribute('published', 'disabled', 'true');
         $form->setFieldAttribute('ordering', 'filter', 'unset');
         $form->setFieldAttribute('published', 'filter', 'unset');
     }
     return $form;
 }