コード例 #1
0
ファイル: helper.php プロジェクト: BillVGN/PortalPRP
	/**
	 * Get the component information.
	 *
	 * @param   string   $option  The component option.
	 * @param   boolean  $strict  If set and the component does not exist, the enabled attribute will be set to false.
	 *
	 * @return  stdClass   An object with the information for the component.
	 *
	 * @since   1.5
	 */
	public static function getComponent($option, $strict = false)
	{
		if (!isset(static::$components[$option]))
		{
			if (static::load($option))
			{
				$result = static::$components[$option];
			}
			else
			{
				$result = new stdClass;
				$result->enabled = $strict ? false : true;
				$result->params = new Registry;
			}
		}
		else
		{
			$result = static::$components[$option];
		}

		if (is_string($result->params))
		{
			$temp = new Registry;
			$temp->loadString(static::$components[$option]->params);
			static::$components[$option]->params = $temp;
		}

		return $result;
	}
コード例 #2
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->template)) {
             // base64 Decode template.
             $item->template = base64_decode($item->template);
         }
         if (!empty($item->php_view)) {
             // base64 Decode php_view.
             $item->php_view = base64_decode($item->php_view);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_componentbuilder.template');
         }
     }
     return $item;
 }
コード例 #3
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->interventions)) {
             // JSON Decode interventions.
             $item->interventions = json_decode($item->interventions);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention');
         }
     }
     return $item;
 }
コード例 #4
0
ファイル: categories.php プロジェクト: esorone/efcpw
 /**
  * Method to auto-populate the model state.
  *
  * @param	string		$ordering	Field used for order by clause
  * @param	string		$direction	Direction of order
  * 	
  * Note. Calling getState in this method will result in recursion.
  *
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $this->setState('filter.extension', $this->_extension);
     // Get the parent id if defined.
     $parent_id = $app->input->getInt('id');
     $this->setState('filter.parentId', $parent_id);
     // Load the parameters. Merge Global and Menu Item params into new object
     $params = $app->getParams();
     $menu_params = new Registry();
     if ($menu = $app->getMenu()->getActive()) {
         $menu_params->loadString($menu->params);
     }
     $merged_params = clone $menu_params;
     $merged_params->merge($params);
     $this->setState('params', $merged_params);
     $params = $merged_params;
     $this->setState('filter.published', 1);
     $this->setState('filter.language', $app->getLanguageFilter());
     // process show_category_noauth parameter
     if (!$params->get('show_category_noauth')) {
         $this->setState('filter.access', true);
     } else {
         $this->setState('filter.access', false);
     }
 }
コード例 #5
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = new Joomla\Registry\Registry(array(
  *    'platform' => 'socialcommunity',
  *    'user_id'  => 1,
  *    'title'    => 'Title...',
  *    'image'    => "http://mydomain.com/image.png",
  *    'url'      => "http://mydomain.com",
  *    'app'      => 'my_app'
  * ));
  *
  * $factory = new Prism\Integration\Activity\Factory($options);
  * $activity = $factory->create();
  * </code>
  */
 public function create()
 {
     $activity = null;
     switch ($this->options->get('platform')) {
         case 'socialcommunity':
             $activity = new Socialcommunity($this->options->get('user_id'));
             $activity->setUrl($this->options->get('url'));
             $activity->setImage($this->options->get('image'));
             break;
         case 'gamification':
             $activity = new Gamification($this->options->get('user_id'));
             $activity->setTitle($this->options->get('title'));
             $activity->setUrl($this->options->get('url'));
             $activity->setImage($this->options->get('image'));
             break;
         case 'jomsocial':
             // Register JomSocial Router
             if (!class_exists('CRoute')) {
                 \JLoader::register('CRoute', JPATH_SITE . '/components/com_community/libraries/core.php');
             }
             $activity = new JomSocial($this->options->get('user_id'));
             $activity->setApp($this->options->get('app'));
             break;
         case 'easysocial':
             $activity = new EasySocial($this->options->get('user_id'));
             $activity->setContextId($this->options->get('user_id'));
             break;
     }
     if ($activity !== null) {
         $activity->setDb(\JFactory::getDbo());
     }
     return $activity;
 }
コード例 #6
0
 /**
  * Execute the middleware. Don't call this method directly; it is used by the `Application` internally.
  *
  * @internal
  *
  * @param   ServerRequestInterface $request  The request object
  * @param   ResponseInterface      $response The response object
  * @param   callable               $next     The next middleware handler
  *
  * @return  ResponseInterface
  */
 public function handle(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
 {
     $attributes = $request->getAttributes();
     if (!isset($attributes['command'])) {
         switch (strtoupper($request->getMethod())) {
             case 'GET':
                 $params = new Registry($request->getQueryParams());
                 break;
             case 'POST':
             default:
                 $params = new Registry($request->getAttributes());
                 break;
         }
         $extension = ucfirst(strtolower($params->get('option', 'Article')));
         $action = ucfirst(strtolower($params->get('task', 'display')));
         $entity = $params->get('entity', 'error');
         $id = $params->get('id', null);
         $commandClass = "\\Joomla\\Extension\\{$extension}\\Command\\{$action}Command";
         if (class_exists($commandClass)) {
             $command = new $commandClass($entity, $id, $response->getBody());
             $request = $request->withAttribute('command', $command);
         }
         // @todo Emit afterRouting event
     }
     return $next($request, $response);
 }
コード例 #7
0
ファイル: giftd.php プロジェクト: Arkadiy-Sedelnikov/giftd
 public function onExtensionAfterSave($context, $table, $isNew)
 {
     if (!($context == 'com_plugins.plugin' && $table->element == 'giftd')) {
         return true;
     }
     $app = JFactory::getApplication();
     $code = $app->getUserState('plugins.system.giftd.code', '');
     $token_prefix = $app->getUserState('plugins.system.giftd.token_prefix', '');
     $app->setUserState('plugins.system.giftd.code', '');
     $app->setUserState('plugins.system.giftd.token_prefix', '');
     if (!empty($code) || !empty($token_prefix)) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select($db->quoteName('params'))->from($db->quoteName('#__extensions'))->where($db->quoteName('element') . ' = ' . $db->quote('giftd'))->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
         $params = new Registry($db->setQuery($query, 0, 1)->loadResult());
         if (!empty($code)) {
             $params->set('partner_code', $code);
         }
         if (!empty($token_prefix)) {
             $params->set('partner_token_prefix', $token_prefix);
         }
         $query->clear()->update($db->quoteName('#__extensions'));
         $query->set($db->quoteName('params') . '= ' . $db->quote((string) $params));
         $query->where($db->quoteName('element') . ' = ' . $db->quote('giftd'));
         $query->where($db->quoteName('type') . ' = ' . $db->quote('plugin'));
         $db->setQuery($query);
         $db->execute();
     }
     return true;
 }
コード例 #8
0
 /**
  * Prepare the statuses of the items.
  *
  * @param array $data
  * @param array $options
  */
 public function handle(&$data, array $options = array())
 {
     foreach ($data as $key => $item) {
         // Calculate funding end date
         if (is_numeric($item->funding_days) and $item->funding_days > 0) {
             $fundingStartDate = new Crowdfunding\Date($item->funding_start);
             $endDate = $fundingStartDate->calculateEndDate($item->funding_days);
             $item->funding_end = $endDate->format(Prism\Constants::DATE_FORMAT_SQL_DATE);
         }
         // Calculate funded percentage.
         $item->funded_percents = (string) MathHelper::calculatePercentage($item->funded, $item->goal, 0);
         // Calculate days left
         $today = new Crowdfunding\Date();
         $item->days_left = $today->calculateDaysLeft($item->funding_days, $item->funding_start, $item->funding_end);
         // Decode parameters.
         if ($item->params === null) {
             $item->params = '{}';
         }
         if (is_string($item->params) and $item->params !== '') {
             $params = new Registry();
             $params->loadString($item->params);
             $item->params = $params;
         }
     }
 }
コード例 #9
0
 public function bind($array, $ignore = '')
 {
     // Search for the {readmore} tag and split the text up accordingly.
     if (isset($array['value']) && is_array($array['value'])) {
         $registry = new Registry();
         $registry->loadArray($array['value']);
         $array['value'] = (string) $registry;
     }
     //        if (isset($array['media']) && is_array($array['media']))
     //        {
     //            $registry = new Registry;
     //            $registry->loadArray($array['media']);
     //            $array['media'] = (string) $registry;
     //        }
     //
     //        if (isset($array['metadata']) && is_array($array['metadata']))
     //        {
     //            $registry = new Registry;
     //            $registry->loadArray($array['metadata']);
     //            $array['metadata'] = (string) $registry;
     //        }
     //
     //        // Bind the rules.
     //        if (isset($array['rules']) && is_array($array['rules']))
     //        {
     //            $rules = new JAccessRules($array['rules']);
     //            $this->setRules($rules);
     //        }
     return parent::bind($array, $ignore);
 }
コード例 #10
0
 /**
  * Get config
  */
 static function getConfig($var = false)
 {
     // check if config is already loaded
     $app = self::getApp();
     if (isset($app->chclient->config)) {
         return $var ? $app->chclient->config->{$var} : $app->chclient->config;
     }
     // default config
     $config = (object) [];
     $registry = new Registry();
     $config_fields = $registry->loadFile(JPATH_ROOT . '/components/com_chclient/config.yml', 'yaml');
     foreach ($config_fields as $field => $properties) {
         $config->{$field} = $properties->value;
     }
     // get site config
     $site_config = json_decode(JFactory::getDbo()->setQuery('SELECT config FROM #__chclient_config AS a WHERE a.id = 1')->loadResult());
     foreach ($config as $field => $p) {
         if (isset($site_config->{$field})) {
             $config->{$field} = $site_config->{$field};
         }
     }
     // datepicker options
     $config->datepicker_min_date = CHLibDate::getDate()->format(CHLibDate::dateLocale());
     $config->datepicker_format = str_replace('Y', 'YYYY', str_replace('m', 'MM', str_replace('d', 'DD', CHLibDate::dateLocale())));
     // store config for later use
     $app->chclient->config = $config;
     return $var ? $app->chclient->config->{$var} : $app->chclient->config;
 }
コード例 #11
0
ファイル: eaccelerator.php プロジェクト: grlf/eyedock
/**
 * Disables the unsupported eAccelerator caching method, replacing it with the
 * "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = new JConfig();
    $prev = JArrayHelper::fromObject($prev);
    $data = array('cacheHandler' => 'file');
    $data = array_merge($prev, $data);
    $config = new Registry('config');
    $config->loadArray($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
コード例 #12
0
ファイル: add.php プロジェクト: RustyIngles/sp4k_php
 public function execute()
 {
     if ($this->state->get('children', false) && count($this->state->get('children', 0) > 1)) {
         foreach ($this->state->get('children') as $child_id) {
             $cartItemData['child_id'] = $child_id;
             $cartItemData['start_date'] = $this->state->get('startdates.' . $child_id);
             $cartItemData['dates'] = $this->state->get('dates.' . $child_id);
             $cartItemData['product_id'] = $this->state->get('product_id', false);
             $cartApp = Sp4kAppsCartApp::getInstance(new Registry($cartItemData));
             /** @var Registry $cartItem */
             $cartItem = new Registry($cartApp->getItem());
             $cartItems[$cartItem->get('cart_key')] = $cartItem;
         }
     } else {
         $cartApp = Sp4kAppsCartApp::getInstance($this->state);
         $cartItem = $cartApp->getItem();
         $cartItems[$cartItem->cartkey] = $cartItem;
     }
     /** @var JSession $cartSession */
     $cartSession = JFactory::getSession();
     $cartSessionData = $cartSession->get('cart', [], 'Sp4k');
     foreach ($cartItems as $cartKey => $cartItem) {
         $cartSessionData['items'][$cartKey] = $cartItem->toObject();
     }
     //$cartItemData['totals'] = $this->getCartTotals($cart);
     $cartSession->set('cart', $cartSessionData, 'Sp4k');
 }
コード例 #13
0
 /**
  * Overrides JGithub constructor to initialise the api property.
  *
  * @param   mixed  $input       An optional argument to provide dependency injection for the application's
  *                              input object.  If the argument is a JInputCli object that object will become
  *                              the application's input object, otherwise a default input object is created.
  * @param   mixed  $config      An optional argument to provide dependency injection for the application's
  *                              config object.  If the argument is a JRegistry object that object will become
  *                              the application's config object, otherwise a default config object is created.
  * @param   mixed  $dispatcher  An optional argument to provide dependency injection for the application's
  *                              event dispatcher.  If the argument is a JDispatcher object that object will become
  *                              the application's event dispatcher, if it is null then the default event dispatcher
  *                              will be created based on the application's loadDispatcher() method.
  *
  * @see     loadDispatcher()
  * @since   11.1
  */
 public function __construct()
 {
     parent::__construct();
     $options = new Registry();
     $options->set('headers.Accept', 'application/vnd.github.html+json');
     $this->api = new Github($options);
 }
コード例 #14
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->testcompanies)) {
             // JSON Decode testcompanies.
             $item->testcompanies = json_decode($item->testcompanies);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.service_provider');
         }
     }
     $this->service_providervvvx = $item->id;
     return $item;
 }
コード例 #15
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->causesrisks)) {
             // JSON Decode causesrisks.
             $item->causesrisks = json_decode($item->causesrisks);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_costbenefitprojection.country');
         }
     }
     $this->countryvvvy = $item->id;
     $this->countryvvvz = $item->id;
     $this->countryvvwa = $item->id;
     return $item;
 }
コード例 #16
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!empty($item->params)) {
             // Convert the params field to an array.
             $registry = new Registry();
             $registry->loadString($item->params);
             $item->params = $registry->toArray();
         }
         if (!empty($item->metadata)) {
             // Convert the metadata field to an array.
             $registry = new Registry();
             $registry->loadString($item->metadata);
             $item->metadata = $registry->toArray();
         }
         if (!empty($item->groups)) {
             // JSON Decode groups.
             $item->groups = json_decode($item->groups, true);
         }
         if (!empty($item->id)) {
             $item->tags = new JHelperTags();
             $item->tags->getTagIds($item->id, 'com_componentbuilder.help_document');
         }
     }
     return $item;
 }
コード例 #17
0
ファイル: icon.php プロジェクト: rdeutz/weblinks
 /**
  * Create a link to edit an existing weblink
  *
  * @param   object                     $weblink  Weblink data
  * @param   \Joomla\Registry\Registry  $params   Item params
  * @param   array                      $attribs  Unused
  *
  * @return  string
  */
 public static function edit($weblink, $params, $attribs = array())
 {
     $uri = JUri::getInstance();
     if ($params && $params->get('popup')) {
         return;
     }
     if ($weblink->state < 0) {
         return;
     }
     JHtml::_('bootstrap.tooltip');
     $url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
     $icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
     $text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
     if ($weblink->state == 0) {
         $overlib = JText::_('JUNPUBLISHED');
     } else {
         $overlib = JText::_('JPUBLISHED');
     }
     $date = JHtml::_('date', $weblink->created);
     $author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
     $button = JHtml::_('link', JRoute::_($url), $text);
     return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
 }
コード例 #18
0
ファイル: filter.php プロジェクト: Rai-Ka/joomla-cms
 /**
  * Method to perform sanity checks on the JTable instance properties to ensure
  * they are safe to store in the database.  Child classes should override this
  * method to make sure the data they are storing in the database is safe and
  * as expected before storage.
  *
  * @return  boolean  True if the instance is sane and able to be stored in the database.
  *
  * @since   2.5
  */
 public function check()
 {
     try {
         parent::check();
     } catch (\Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     if (trim($this->alias) == '') {
         $this->alias = $this->title;
     }
     $this->alias = JApplicationHelper::stringURLSafe($this->alias);
     if (trim(str_replace('-', '', $this->alias)) == '') {
         $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     $params = new Registry($this->params);
     $nullDate = $this->_db->getNullDate();
     $d1 = $params->get('d1', $nullDate);
     $d2 = $params->get('d2', $nullDate);
     // Check the end date is not earlier than the start date.
     if ($d2 > $nullDate && $d2 < $d1) {
         // Swap the dates.
         $params->set('d1', $d2);
         $params->set('d2', $d1);
         $this->params = (string) $params;
     }
     return true;
 }
コード例 #19
0
 /**
  * Stores a FamilyUnit
  *
  * @param   boolean  $updateNulls  True to update fields even if they are null.
  *
  * @return    boolean    True on success, false on failure.
  *
  * @since    1.7.0
  */
 public function store($updateNulls = false)
 {
     // Transform the params field
     if (is_array($this->params)) {
         $registry = new Registry();
         $registry->loadArray($this->params);
         $this->params = (string) $registry;
     }
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         // Existing item
         $this->modified = $date->toSql();
         $this->modified_by = $user->get('id');
     } else {
         // New newsfeed. A feed created and created_by field can be set by the user,
         // so we don't touch either of these if they are set.
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     // Attempt to store the data.
     return parent::store($updateNulls);
 }
コード例 #20
0
 /**
  * Execute the command.
  *
  * @return  void
  *
  * @since   1.0
  * @throws  AbortException
  * @throws  \RuntimeException
  * @throws  \UnexpectedValueException
  */
 public function execute()
 {
     try {
         // Check if the database "exists"
         $tables = $this->db->getTableList();
         if (!$this->app->input->get('reinstall')) {
             $this->app->out('<fg=black;bg=yellow>WARNING: A database has been found !!</fg=black;bg=yellow>')->out('Do you want to reinstall ? [y]es / [[n]]o :', false);
             $in = trim($this->app->in());
             if (!in_array($in, ['yes', 'y'])) {
                 throw new AbortException();
             }
         }
         $this->cleanDatabase($tables);
         $this->app->out("\nFinished!");
     } catch (\RuntimeException $e) {
         // Check if the message is "Could not connect to database."  Odds are, this means the DB isn't there or the server is down.
         if (strpos($e->getMessage(), 'Could not connect to database.') !== false) {
             // ? really..
             $this->app->out('No database found.')->out('Creating the database...', false);
             $this->db->setQuery('CREATE DATABASE ' . $this->db->quoteName($this->config->get('database.name')))->execute();
             $this->db->select($this->config->get('database.name'));
             $this->app->out("\nFinished!");
         } else {
             throw $e;
         }
     }
     // Perform the installation
     $this->processSql();
     $this->app->out('Installer has terminated successfully.');
 }
コード例 #21
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     $this->filterForm = $this->get('FilterForm');
 }
コード例 #22
0
ファイル: corecontent.php プロジェクト: grchis/Site-Auto
 /**
  * Overloaded bind function
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  An optional array or space separated list of properties
  *                          to ignore while binding.
  *
  * @return  mixed  Null if operation was satisfactory, otherwise returns an error string
  *
  * @see     JTable::bind()
  * @since   3.1
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['core_params']) && is_array($array['core_params'])) {
         $registry = new Registry();
         $registry->loadArray($array['core_params']);
         $array['core_params'] = (string) $registry;
     }
     if (isset($array['core_metadata']) && is_array($array['core_metadata'])) {
         $registry = new Registry();
         $registry->loadArray($array['core_metadata']);
         $array['core_metadata'] = (string) $registry;
     }
     if (isset($array['core_images']) && is_array($array['core_images'])) {
         $registry = new Registry();
         $registry->loadArray($array['core_images']);
         $array['core_images'] = (string) $registry;
     }
     if (isset($array['core_urls']) && is_array($array['core_urls'])) {
         $registry = new Registry();
         $registry->loadArray($array['core_urls']);
         $array['core_urls'] = (string) $registry;
     }
     if (isset($array['core_body']) && is_array($array['core_body'])) {
         $registry = new Registry();
         $registry->loadArray($array['core_body']);
         $array['core_body'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }
コード例 #23
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') === 0;
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
 }
コード例 #24
0
 public static function getData(Registry $params)
 {
     if ($params->get('ajax')) {
         return;
     }
     $instance = new static($params);
     return $instance->getInternalData();
 }
コード例 #25
0
 /**
  * Renders a module script and returns the results as a string
  *
  * @param   mixed   $module   The name of the module to render
  * @param   array   $attribs  Associative array of values
  * @param   string  $content  If present, module information from the buffer will be used
  *
  * @return  string  The output of the script
  *
  * @since   11.1
  */
 public function render($module, $attribs = array(), $content = null)
 {
     if (!is_object($module)) {
         $title = isset($attribs['title']) ? $attribs['title'] : null;
         $module = JModuleHelper::getModule($module, $title);
         if (!is_object($module)) {
             if (is_null($content)) {
                 return '';
             } else {
                 /**
                  * If module isn't found in the database but data has been pushed in the buffer
                  * we want to render it
                  */
                 $tmp = $module;
                 $module = new stdClass();
                 $module->params = null;
                 $module->module = $tmp;
                 $module->id = 0;
                 $module->user = 0;
             }
         }
     }
     // Get the user and configuration object
     // $user = JFactory::getUser();
     $conf = Factory::getConfig();
     // Set the module content
     if (!is_null($content)) {
         $module->content = $content;
     }
     // Get module parameters
     $params = new Registry();
     $params->loadString($module->params);
     // Use parameters from template
     if (isset($attribs['params'])) {
         $template_params = new Registry();
         $template_params->loadString(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8'));
         $params->merge($template_params);
         $module = clone $module;
         $module->params = (string) $params;
     }
     $contents = '';
     // Default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the
     // module instead
     $cachemode = $params->get('cachemode', 'oldstatic');
     if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') {
         // Default to itemid creating method and workarounds on
         $cacheparams = new stdClass();
         $cacheparams->cachemode = $cachemode;
         $cacheparams->class = 'JModuleHelper';
         $cacheparams->method = 'renderModule';
         $cacheparams->methodparams = array($module, $attribs);
         $contents = JModuleHelper::ModuleCache($module, $params, $cacheparams);
     } else {
         $contents = JModuleHelper::renderModule($module, $attribs);
     }
     return $contents;
 }
コード例 #26
0
 /**
  * Sets the state for the model object
  *
  * @param   \JModel  $model  Model object
  *
  * @return  Registry
  *
  * @since   2.0
  */
 protected function initializeState(\JModel $model)
 {
     $state = new Registry();
     // Load the parameters.
     $params = \JComponentHelper::getParams('com_patchtester');
     $state->set('github_user', $params->get('org', 'joomla'));
     $state->set('github_repo', $params->get('repo', 'joomla-cms'));
     return $state;
 }
コード例 #27
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     $this->filterForm = $this->get('FilterForm');
     $this->sortFields = array('b.name' => JText::_('COM_GAMIFICATION_USER'), 'a.created' => JText::_('COM_GAMIFICATION_CREATED'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
コード例 #28
0
 /**
  * Load config.
  *
  * @return  Registry Config registry object.
  */
 public function loadConfig()
 {
     $file = WINDWALKER . '/config.json';
     if (!is_file($file)) {
         \JFile::copy(WINDWALKER . '/config.dist.json', $file);
     }
     $config = new Registry();
     return $config->loadFile($file, 'json');
 }
コード例 #29
0
 /**
  * Constructor.
  *
  * @param   Registry     $options  Google options object
  * @param   JGoogleAuth  $auth     Google data http client object
  *
  * @since   12.3
  */
 public function __construct(Registry $options = null, JGoogleAuth $auth = null)
 {
     // Setup the default API url if not already set.
     $options->def('api.url', 'https://www.googleapis.com/plus/v1/');
     parent::__construct($options, $auth);
     if (isset($this->auth) && !$this->auth->getOption('scope')) {
         $this->auth->setOption('scope', 'https://www.googleapis.com/auth/plus.me');
     }
 }
コード例 #30
0
ファイル: filter.php プロジェクト: SysBind/joomla-cms
 /**
  * Method to bind an associative array or object to the JTable instance.  This
  * method only binds properties that are publicly accessible and optionally
  * takes an array of properties to ignore when binding.
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  An optional array or space separated list of properties
  *                          to ignore while binding. [optional]
  *
  * @return  mixed  Null if operation was satisfactory, otherwise returns an error string
  *
  * @since   2.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new Registry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     return parent::bind($array, $ignore);
 }