コード例 #1
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;
 }
コード例 #2
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');
 }
コード例 #3
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);
 }
コード例 #4
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.');
 }
コード例 #5
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;
 }
コード例 #6
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');
 }
コード例 #7
0
 /**
  * Returns the value of a component configuration parameter
  *
  * @param   string $key     The parameter to get
  * @param   mixed  $default Default value
  *
  * @return  mixed
  */
 public static function getParam($key, $default = null)
 {
     if (!is_object(self::$params)) {
         JLoader::import('joomla.application.component.helper');
         self::$params = JComponentHelper::getParams('com_ars');
     }
     return self::$params->get($key, $default);
 }
コード例 #8
0
 /**
  * upload
  *
  * @param \JInput    $input
  */
 public static function upload(\JInput $input)
 {
     try {
         $editorPlugin = \JPluginHelper::getPlugin('editors', 'akmarkdown');
         if (!$editorPlugin) {
             throw new \Exception('Editor Akmarkdown not exists');
         }
         $params = new Registry($editorPlugin->params);
         $files = $input->files;
         $field = $input->get('field', 'file');
         $type = $input->get('type', 'post');
         $allows = $params->get('Upload_AllowExtension', '');
         $allows = array_map('strtolower', array_map('trim', explode(',', $allows)));
         $file = $files->getVar($field);
         $src = $file['tmp_name'];
         $name = $file['name'];
         $tmp = new \SplFileInfo(JPATH_ROOT . '/tmp/ak-upload/' . $name);
         if (empty($file['tmp_name'])) {
             throw new \Exception('File not upload');
         }
         $ext = pathinfo($name, PATHINFO_EXTENSION);
         if (!in_array($ext, $allows)) {
             throw new \Exception('File extension now allowed.');
         }
         // Move file to tmp
         if (!is_dir($tmp->getPath())) {
             \JFolder::create($tmp->getPath());
         }
         if (is_file($tmp->getPathname())) {
             \JFile::delete($tmp->getPathname());
         }
         \JFile::upload($src, $tmp->getPathname());
         $src = $tmp;
         $dest = static::getDest($name, $params->get('Upload_S3_Subfolder', 'ak-upload'));
         $s3 = new \S3($params->get('Upload_S3_Key'), $params->get('Upload_S3_SecretKey'));
         $bucket = $params->get('Upload_S3_Bucket');
         $result = $s3::putObject(\S3::inputFile($src->getPathname(), false), $bucket, $dest, \S3::ACL_PUBLIC_READ);
         if (is_file($tmp->getPathname())) {
             \JFile::delete($tmp->getPathname());
         }
         if (!$result) {
             throw new \Exception('Upload fail.');
         }
     } catch (\Exception $e) {
         $response = new Response();
         $response->setBody(json_encode(['error' => $e->getMessage()]));
         $response->setMimeType('text/json');
         $response->respond();
         exit;
     }
     $return = new \JRegistry();
     $return['filename'] = 'https://' . $bucket . '.s3.amazonaws.com/' . $dest;
     $return['file'] = 'https://' . $bucket . '.s3.amazonaws.com/' . $dest;
     $response = new Response();
     $response->setBody((string) $return);
     $response->setMimeType('text/json');
     $response->respond();
 }
コード例 #9
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;
 }
コード例 #10
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'));
 }
コード例 #11
0
ファイル: Php.php プロジェクト: dextercowley/jissues
 /**
  * Get a global template var.
  *
  * @param   string  $key  The template var key.
  *
  * @return  mixed
  *
  * @since   1.0
  */
 public function __get($key)
 {
     if ($this->globals->exists($key)) {
         return $this->globals->get($key);
     }
     if ($this->debug) {
         trigger_error('No template var: ' . $key);
     }
     return '';
 }
コード例 #12
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;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
 }
コード例 #13
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;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->sortFields = array('a.name' => JText::_('COM_GAMIFICATION_NAME'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
コード例 #14
0
ファイル: mailchimp.php プロジェクト: jfquestiaux/fabrik
 /**
  * Get Mailchimp email groups
  *
  * @param   \Joomla\Registry\Registry  $params  Params
  *
  * @throws RuntimeException
  *
  * @return  array groups
  */
 protected function getGroups($params)
 {
     $listId = $params->get('mailchimp_listid');
     $apiKey = $params->get('mailchimp_apikey');
     if ($apiKey == '') {
         throw new RuntimeException('Mailchimp: no api key specified');
     }
     if ($listId == '') {
         throw new RuntimeException('Mailchimp: no list id specified');
     }
     $api = new MCAPI($params->get('mailchimp_apikey'));
     $groups = $api->listInterestGroupings($listId);
     return $groups;
 }
コード例 #15
0
 public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     // Load the component parameters.
     $params = $this->state->get('params');
     $filesystemHelper = new Prism\Filesystem\Helper($params);
     $this->mediaFolder = $filesystemHelper->getMediaFolder();
     // Prepare actions, behaviors, scripts and document
     $this->addToolbar();
     $this->setDocument();
     parent::display($tpl);
 }
コード例 #16
0
ファイル: helper.php プロジェクト: ziyou-liu/1line
 /**
  * Get users sorted by activation date
  * 
  * @param   \Joomla\Registry\Registry  $params  module parameters
  * 
  * @return  array  The array of users
  * 
  * @since   1.6
  */
 public static function getUsers($params)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select($db->quoteName(array('a.id', 'a.name', 'a.username', 'a.registerDate')))->order($db->quoteName('a.registerDate') . ' DESC')->from('#__users AS a');
     $user = JFactory::getUser();
     if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1) {
         $groups = $user->getAuthorisedGroups();
         if (empty($groups)) {
             return array();
         }
         $query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = a.id')->join('LEFT', '#__usergroups AS ug ON ug.id = m.group_id')->where('ug.id in (' . implode(',', $groups) . ')')->where('ug.id <> 1');
     }
     $db->setQuery($query, 0, $params->get('shownumber'));
     $result = $db->loadObjectList();
     return (array) $result;
 }
コード例 #17
0
 /**
  * Return money formatter.
  *
  * <code>
  * $this->prepareMoneyFormatter($container, $params);
  * $money = $this->getMoneyFormatter($container, $params);
  * </code>
  *
  * @param Registry $params
  *
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @throws \OutOfBoundsException
  *
  * @return Money
  */
 protected function getMoneyFormatter($params)
 {
     $currencyId = $params->get('project_currency');
     // Get the currency.
     $currency = $this->getCurrency($currencyId);
     // Prepare decimal pattern.
     $fractionDigits = (int) $params->get('fraction_digits', 2);
     $pattern = '#,##0';
     if ($fractionDigits > 0) {
         $pattern .= '.' . str_repeat('0', $fractionDigits);
     }
     $formatter = LocaleHelper::getNumberFormatter($pattern);
     $money = new Money($formatter);
     $money->setCurrency($currency);
     return $money;
 }
コード例 #18
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>';
 }
コード例 #19
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');
 }
コード例 #20
0
 /**
  * Render view.
  *
  * @return string|void
  */
 public function doRender()
 {
     // Init some API objects
     // ================================================================================
     $container = $this->getContainer();
     $input = $container->get('input');
     $config = new Registry($this->config);
     // Set E_ALL for debugging
     error_reporting($config->get('error_reporting', 0));
     $elfinder_path = WINDWALKER . '/src/Elfinder/Connect/';
     include_once $elfinder_path . 'elFinderConnector.class.php';
     include_once $elfinder_path . 'elFinder.class.php';
     include_once $elfinder_path . 'elFinderVolumeDriver.class.php';
     /**
      * Simple function to demonstrate how to control file access using "accessControl" callback.
      * This method will disable accessing files/folders starting from '.' (dot)
      *
      * @param  string $attr attribute name (read|write|locked|hidden)
      * @param  string $path file path relative to volume root directory started with directory separator
      *
      * @return bool|null
      */
     function access($attr, $path)
     {
         // If file/folder begins with '.' (dot). Set read+write to false, other (locked+hidden) set to true
         if (strpos(basename($path), '.') === 0) {
             return !($attr == 'read' || $attr == 'write');
         } else {
             return null;
         }
     }
     // Get Some Request
     $root = $input->getPath('root', '/');
     $start_path = $input->getPath('start_path', '/');
     $this->createFolder($root);
     $this->createFolder($root . '/' . $start_path);
     $opts = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => JPath::clean(JPATH_ROOT . '/' . $root, '/'), 'startPath' => JPath::clean(JPATH_ROOT . '/' . $root . '/' . $start_path . '/'), 'URL' => JPath::clean(JURI::root(true) . '/' . $root . '/' . $start_path, '/'), 'tmbPath' => JPath::clean(JPATH_ROOT . '/cache/windwalker-finder-thumb'), 'tmbURL' => JURI::root(true) . '/cache/windwalker-finder-thumb', 'tmp' => JPath::clean(JPATH_ROOT . '/cache/windwalker-finder-temp'), 'accessControl' => 'access', 'uploadDeny' => array('text/x-php'), 'disabled' => array('archive', 'extract', 'rename', 'mkfile'))));
     $opts = (array) $config->get('option') ?: $opts;
     foreach ($opts['roots'] as $driver) {
         include_once $elfinder_path . 'elFinderVolume' . $driver['driver'] . '.class.php';
     }
     // Run elFinder
     $connector = new elFinderConnector(new elFinder($opts));
     $connector->run();
     exit;
 }
コード例 #21
0
 /**
  * Method to build and return a full request URL for the request.
  *
  * This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.
  *
  * @param   string   $path     Path to process
  * @param   integer  $page     Page to request
  * @param   integer  $limit    Number of results to return per page
  * @param   array    $headers  The headers to send with the request
  *
  * @return  array  Associative array containing the prepared URL and request headers
  *
  * @since   3.0.0
  */
 protected function prepareRequest($path, $page = 0, $limit = 0, array $headers = array())
 {
     $url = $this->fetchUrl($path, $page, $limit);
     if ($token = $this->options->get('gh.token', false)) {
         $headers['Authorization'] = "token {$token}";
     }
     return array('url' => $url, 'headers' => $headers);
 }
コード例 #22
0
 public static function getData(Registry $params)
 {
     if ($params->get('ajax')) {
         return;
     }
     $instance = new static($params);
     return $instance->getInternalData();
 }
コード例 #23
0
ファイル: JoomlaStorage.php プロジェクト: Rai-Ka/joomla-cms
 /**
  * Set data into the session store
  *
  * @param   string  $name   Name of a variable.
  * @param   mixed   $value  Value of a variable.
  *
  * @return  mixed  Old value of a variable.
  *
  * @since   4.0
  */
 public function set($name, $value = null)
 {
     if (!$this->isStarted()) {
         $this->start();
     }
     $old = $this->data->get($name);
     $this->data->set($name, $value);
     return $old;
 }
コード例 #24
0
ファイル: Plugin.php プロジェクト: bharatthakkar/CrowdFunding
 protected function getCancelUrl($slug, $catslug)
 {
     $page = String::trim($this->params->get('cancel_url'));
     if (!$page) {
         $uri = \JUri::getInstance();
         $page = $uri->toString(array("scheme", "host")) . \JRoute::_(\CrowdfundingHelperRoute::getBackingRoute($slug, $catslug, "default"), false);
     }
     return $page;
 }
コード例 #25
0
 /**
  * Return user profile.
  *
  * <code>
  * $userId = 1;
  *
  * $this->prepareProfile($container, $params, $userId);
  * $profile = $this->getProfile($container, $params, $userId);
  * </code>
  *
  * @param Container $container
  * @param Registry $params
  * @param int $userId
  *
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @throws \UnexpectedValueException
  * @throws \OutOfBoundsException
  *
  * @return Project
  */
 protected function getProfile($container, $params, $userId)
 {
     $userId = (int) abs($userId);
     $options = array('platform' => $params->get('integration_social_platform'), 'user_id' => $userId);
     $hash = StringHelper::generateMd5Hash(Constants::CONTAINER_PROFILE, $options);
     if (!$container->exists($hash) and $userId > 0) {
         $this->prepareProfile($container, $params, $userId);
     }
     return $container->get($hash);
 }
コード例 #26
0
ファイル: tag.php プロジェクト: brenot/forumdesenvolvimento
 /**
  * Determine if the field has to be tagnested
  *
  * @return  boolean
  *
  * @since   3.1
  */
 public function isNested()
 {
     if (is_null($this->isNested)) {
         // If mode="nested" || ( mode not set & config = nested )
         if (isset($this->element['mode']) && $this->element['mode'] == 'nested' || !isset($this->element['mode']) && $this->comParams->get('tag_field_ajax_mode', 1) == 0) {
             $this->isNested = true;
         }
     }
     return $this->isNested;
 }
コード例 #27
0
 /**
  * @param string $url
  * @param bool $persistent
  *
  * @return mixed JHttpResponse|string
  */
 protected function getRemote($url, $persistent = false)
 {
     $cache = JFactory::getCache('wow', 'output');
     $cache->setCaching(1);
     $cache->setLifeTime($this->params->get('cache_timeout', 30) * ($persistent ? 172800 : 60) + rand(0, 60));
     // randomize cache time a little bit for each url
     $key = md5($url);
     if (!($result = $cache->get($key))) {
         try {
             $http = JHttpFactory::getHttp();
             $http->setOption('userAgent', 'Joomla/' . JVERSION . '; WoW Library/@REVISION@; php/' . phpversion());
             $result = $http->get($url, null, $this->params->get('socket_timeout', 10));
         } catch (Exception $e) {
             return $e->getMessage();
         }
         $cache->store($result, $key);
     }
     return $result;
 }
コード例 #28
0
 /**
  * Constructor.
  *
  * @param   Registry  $config  The config object.
  *
  * @since   1.0
  * @throws  \RuntimeException
  */
 public function __construct(Registry $config)
 {
     // Check for a custom configuration.
     $type = trim(getenv('JTRACKER_ENVIRONMENT'));
     $name = $type ? 'config.' . $type : 'config';
     // Set the configuration file path for the application.
     $file = JPATH_ROOT . '/etc/' . $name . '.json';
     // Verify the configuration exists and is readable.
     if (!is_readable($file)) {
         throw new \RuntimeException('Configuration file does not exist or is unreadable.');
     }
     // Load the configuration file into an object.
     $configObject = json_decode(file_get_contents($file));
     if ($configObject === null) {
         throw new \RuntimeException(sprintf('Unable to parse the configuration file %s.', $file));
     }
     $config->loadObject($configObject);
     defined('JDEBUG') || define('JDEBUG', $config->get('debug.system') || $config->get('debug.database'));
     $this->config = $config;
 }
コード例 #29
0
ファイル: helper.php プロジェクト: adjaika/J3Base
 /**
  * Get users sorted by activation date
  *
  * @param   \Joomla\Registry\Registry  $params  module parameters
  *
  * @return  array  The array of users
  *
  * @since   1.6
  */
 public static function getUsers($params)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select($db->quoteName(array('a.id', 'a.name', 'a.username', 'a.registerDate')))->order($db->quoteName('a.registerDate') . ' DESC')->from('#__users AS a');
     $user = JFactory::getUser();
     if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1) {
         $groups = $user->getAuthorisedGroups();
         if (empty($groups)) {
             return array();
         }
         $query->join('LEFT', '#__user_usergroup_map AS m ON m.user_id = a.id')->join('LEFT', '#__usergroups AS ug ON ug.id = m.group_id')->where('ug.id in (' . implode(',', $groups) . ')')->where('ug.id <> 1');
     }
     $db->setQuery($query, 0, $params->get('shownumber'));
     try {
         return (array) $db->loadObjectList();
     } catch (RuntimeException $e) {
         JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
         return array();
     }
 }
コード例 #30
0
ファイル: helper.php プロジェクト: grchis/Site-Auto
 /**
  * Retrieve the url where the user should be returned after logging in
  *
  * @param   \Joomla\Registry\Registry  $params  module parameters
  * @param   string                     $type    return type
  *
  * @return string
  */
 public static function getReturnURL($params, $type)
 {
     $app = JFactory::getApplication();
     $item = $app->getMenu()->getItem($params->get($type));
     if ($item) {
         $vars = $item->query;
     } else {
         // Stay on the same page
         $vars = $app::getRouter()->getVars();
     }
     return base64_encode('index.php?' . JUri::buildQuery($vars));
 }