当前位置: 首页>>代码示例>>PHP>>正文


PHP JApplicationHelper::getHash方法代码示例

本文整理汇总了PHP中JApplicationHelper::getHash方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationHelper::getHash方法的具体用法?PHP JApplicationHelper::getHash怎么用?PHP JApplicationHelper::getHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JApplicationHelper的用法示例。


在下文中一共展示了JApplicationHelper::getHash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * Display method for the raw track data.
  *
  * @param   boolean  $cachable   If true, the view output will be cached
  * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return  BannersControllerTracks  This object to support chaining.
  *
  * @since   1.5
  * @todo    This should be done as a view, not here!
  */
 public function display($cachable = false, $urlparams = array())
 {
     // Get the document object.
     $vName = 'tracks';
     // Get and render the view.
     if ($view = $this->getView($vName, 'raw')) {
         // Get the model for the view.
         /** @var BannersModelTracks $model */
         $model = $this->getModel($vName);
         // Load the filter state.
         $app = JFactory::getApplication();
         $model->setState('filter.type', $app->getUserState($this->context . '.filter.type'));
         $model->setState('filter.begin', $app->getUserState($this->context . '.filter.begin'));
         $model->setState('filter.end', $app->getUserState($this->context . '.filter.end'));
         $model->setState('filter.category_id', $app->getUserState($this->context . '.filter.category_id'));
         $model->setState('filter.client_id', $app->getUserState($this->context . '.filter.client_id'));
         $model->setState('list.limit', 0);
         $model->setState('list.start', 0);
         $form = $this->input->get('jform', array(), 'array');
         $model->setState('basename', $form['basename']);
         $model->setState('compressed', $form['compressed']);
         $config = JFactory::getConfig();
         $cookie_domain = $config->get('cookie_domain', '');
         $cookie_path = $config->get('cookie_path', '/');
         setcookie(JApplicationHelper::getHash($this->context . '.basename'), $form['basename'], time() + 365 * 86400, $cookie_path, $cookie_domain);
         setcookie(JApplicationHelper::getHash($this->context . '.compressed'), $form['compressed'], time() + 365 * 86400, $cookie_path, $cookie_domain);
         // Push the model into the view (as default).
         $view->setModel($model, true);
         // Push document object into the view.
         $view->document = JFactory::getDocument();
         $view->display();
     }
     return $this;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:45,代码来源:tracks.raw.php

示例2: hideModule

 protected function hideModule($moduleName)
 {
     $module = JModuleHelper::getModule($moduleName);
     if (is_object($module) and $module->id > 0) {
         $seed = substr(md5(uniqid(time() * rand(), true)), 0, 10);
         $module->position = 'fp' . JApplicationHelper::getHash($seed);
     }
 }
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:8,代码来源:crowdfundingmodules.php

示例3: hideModule

 protected function hideModule($moduleName)
 {
     $module = JModuleHelper::getModule($moduleName);
     if (is_object($module) and $module->id > 0) {
         $seed = Prism\Utilities\StringHelper::generateRandomString(16);
         $module->position = 'fp' . JApplicationHelper::getHash($seed);
     }
 }
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:8,代码来源:crowdfundingmodules.php

示例4: populateState

 /**
  * Auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState()
 {
     $input = JFactory::getApplication()->input;
     $basename = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.basename'), '__SITE__');
     $this->setState('basename', $basename);
     $compressed = $input->cookie->getInt(JApplicationHelper::getHash($this->_context . '.compressed'), 1);
     $this->setState('compressed', $compressed);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:17,代码来源:download.php

示例5: onUserLogout

 /**
  * Method to handle any logout logic and report back to the subject.
  *
  * @param   array  $user     Holds the user data.
  * @param   array  $options  Array holding options (client, ...).
  *
  * @return  boolean  Always returns true.
  *
  * @since   1.6
  */
 public function onUserLogout($user, $options = array())
 {
     if (JFactory::getApplication()->isSite()) {
         // Create the cookie.
         $hash = JApplicationHelper::getHash('PlgSystemLogout');
         $conf = JFactory::getConfig();
         $cookie_domain = $conf->get('cookie_domain', '');
         $cookie_path = $conf->get('cookie_path', '/');
         setcookie($hash, true, time() + 86400, $cookie_path, $cookie_domain);
     }
     return true;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:22,代码来源:logout.php

示例6: getCurrentLanguage

 /**
  * Gets the current language
  *
  * @param   boolean  $detectBrowser  Flag indicating whether to use the browser language as a fallback.
  *
  * @return  string  The language string
  *
  * @since   3.2
  */
 public function getCurrentLanguage($detectBrowser = true)
 {
     $app = JFactory::getApplication();
     $langCode = $app->input->cookie->getString(JApplicationHelper::getHash('language'));
     // No cookie - let's try to detect browser language or use site default
     if (!$langCode) {
         if ($detectBrowser) {
             $langCode = JLanguageHelper::detectLanguage();
         } else {
             $langCode = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
         }
     }
     return $langCode;
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:23,代码来源:helper.php

示例7: getInstance

 /**
  * Create an instance of the object and load data.
  *
  * <code>
  * // create object points by ID
  * $pointsId   = 1;
  * $points     = Gamification\Points\Points::getInstance(\JFactory::getDbo(), $pointsId);
  *
  * // create object points by abbreviation
  * $keys = array(
  *    "abbr" => "P"
  * );
  * $points     = Gamification\Points\Points::getInstance(\JFactory::getDbo(), $keys);
  * </code>
  *
  * @param \JDatabaseDriver $db
  * @param int|array $keys
  *
  * @return null|self
  */
 public static function getInstance($db, $keys)
 {
     if (is_array($keys)) {
         $index = ArrayHelper::getValue($keys, "abbr");
     } else {
         $index = (int) $keys;
     }
     $index = \JApplicationHelper::getHash($index);
     if (!isset(self::$instances[$index])) {
         $item = new Points($db);
         $item->load($keys);
         self::$instances[$index] = $item;
     }
     return self::$instances[$index];
 }
开发者ID:bellodox,项目名称:GamificationPlatform,代码行数:35,代码来源:Points.php

示例8: populateState

 /**
  * Auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   3.5.0
  */
 protected function populateState()
 {
     // Joomla 3
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $input = JFactory::getApplication()->input;
         $basename = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.basename'), '__SITE__');
         $this->setState('basename', $basename);
         $compressed = $input->cookie->getInt(JApplicationHelper::getHash($this->_context . '.compressed'), 1);
         $this->setState('compressed', $compressed);
     } else {
         $basename = JRequest::getString(JApplication::getHash($this->_context . '.basename'), '__SITE__', 'cookie');
         $this->setState('basename', $basename);
         $compressed = JRequest::getInt(JApplication::getHash($this->_context . '.compressed'), 1, 'cookie');
         $this->setState('compressed', $compressed);
     }
 }
开发者ID:esorone,项目名称:efcpw,代码行数:25,代码来源:download.php

示例9: register

 /**
  * Registers the service provider with a DI container.
  *
  * @param   Container  $container  The DI container.
  *
  * @return  void
  *
  * @since   4.0
  */
 public function register(Container $container)
 {
     $container->alias('session', 'Joomla\\Session\\SessionInterface')->alias('JSession', 'Joomla\\Session\\SessionInterface')->alias('Joomla\\Session\\Session', 'Joomla\\Session\\SessionInterface')->share('Joomla\\Session\\SessionInterface', function (Container $container) {
         $app = JFactory::getApplication();
         // Generate a session name.
         $name = JApplicationHelper::getHash($app->get('session_name', get_class($app)));
         // Calculate the session lifetime.
         $lifetime = $app->get('lifetime') ? $app->get('lifetime') * 60 : 900;
         // Initialize the options for the Session object.
         $options = array('name' => $name, 'expire' => $lifetime);
         // Set up the storage handler
         $handler = new FilesystemHandler(JPATH_INSTALLATION . '/sessions');
         $input = $app->input;
         $storage = new JoomlaStorage($input, $handler);
         $dispatcher = $container->get('Joomla\\Event\\DispatcherInterface');
         $dispatcher->addListener('onAfterSessionStart', array($app, 'afterSessionStart'));
         $session = new JSession($storage, $dispatcher, $options);
         $session->addValidator(new AddressValidator($input, $session));
         $session->addValidator(new ForwardedValidator($input, $session));
         return $session;
     }, true);
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:31,代码来源:session.php

示例10: populateState

 /**
  * Method to auto-populate the model state.
  */
 protected function populateState()
 {
     // Get the data
     $input = JFactory::getApplication()->input;
     $name = $input->get('name');
     $standalone = $input->get('standalone');
     $author = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.author'), '');
     $copyright = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.copyright'), '');
     $email = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.email'), '');
     $url = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.url'), '');
     $version = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.version'), '');
     $license = $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.license'), '');
     // Set the state
     $this->setState('downloadpackage.name', $name);
     $this->setState('downloadpackage.standalone', $standalone);
     $this->setState('downloadpackage.author', $author);
     $this->setState('downloadpackage.copyright', $copyright);
     $this->setState('downloadpackage.email', $email);
     $this->setState('downloadpackage.url', $url);
     $this->setState('downloadpackage.version', $version);
     $this->setState('downloadpackage.license', $license);
 }
开发者ID:svenbluege,项目名称:com_localise,代码行数:25,代码来源:downloadpackage.php

示例11: populateState

 /**
  * Method to auto-populate the model state.
  */
 protected function populateState()
 {
     // Get the data
     $data = JFactory::getApplication()->input->post->get('jform', array(), 'array');
     // Initialise variables
     $config = JFactory::getConfig();
     $cookie_domain = $config->get('config.cookie_domain', '');
     $cookie_path = $config->get('config.cookie_path', '/');
     // Set the cookies
     setcookie(JApplicationHelper::getHash($this->_context . '.author'), $data['author'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     setcookie(JApplicationHelper::getHash($this->_context . '.copyright'), $data['copyright'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     setcookie(JApplicationHelper::getHash($this->_context . '.email'), $data['email'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     setcookie(JApplicationHelper::getHash($this->_context . '.url'), $data['url'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     setcookie(JApplicationHelper::getHash($this->_context . '.version'), $data['version'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     setcookie(JApplicationHelper::getHash($this->_context . '.license'), $data['license'], time() + 365 * 86400, $cookie_path, $cookie_domain);
     // Set the state
     $this->setState('exportpackage.name', $data['name']);
     $this->setState('exportpackage.author', $data['author']);
     $this->setState('exportpackage.copyright', $data['copyright']);
     $this->setState('exportpackage.email', $data['email']);
     $this->setState('exportpackage.url', $data['url']);
     $this->setState('exportpackage.version', $data['version']);
     $this->setState('exportpackage.license', $data['license']);
 }
开发者ID:svenbluege,项目名称:com_localise,代码行数:27,代码来源:exportpackage.php

示例12: getFormToken

 /**
  * Method to determine a hash for anti-spoofing variable names
  *
  * @param   boolean  $forceNew  If true, force a new token to be created
  *
  * @return  string  Hashed var name
  *
  * @since   11.1
  */
 public static function getFormToken($forceNew = false)
 {
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     return JApplicationHelper::getHash($user->get('id', 0) . $session->getToken($forceNew));
 }
开发者ID:klas,项目名称:joomla-cms,代码行数:15,代码来源:session.php

示例13: syncSessions

 /**
  * Sync user session
  *
  * @param   bool  $keepalive  Keep session alive
  *
  * @return number
  */
 function syncSessions($keepalive = false)
 {
     $debug = defined('DEBUG_SYSTEM_PLUGIN') ? true : false;
     if ($debug) {
         JError::raiseNotice('500', 'XenForo syncSessions called');
     }
     $helper =& JFusionFactory::getHelper($this->getJname());
     $params =& JFusionFactory::getParams($this->getJname());
     $options = array();
     $options['action'] = 'core.login.site';
     $expiry = 60 * 60 * 24 * 365;
     $JUser =& JFactory::getUser();
     // Do we have a Joomla persistant session ?
     if (JPluginHelper::isEnabled('system', 'remember')) {
         jimport('joomla.utilities.utility');
         $hash = JApplicationHelper::getHash('JLOGIN_REMEMBER');
         $joomla_persistant_cookie = JRequest::getString($hash, '', 'cookie', JREQUEST_ALLOWRAW | JREQUEST_NOTRIM);
     } else {
         $joomla_persistant_cookie = '';
     }
     if (!$JUser->get('guest', true)) {
         // User logged into Joomla so check for active XenForo session
         if ($helper->persistantUser()) {
             // We have a persistant cookie for XenForo
             // Lets check that the user's match
             $xenforo_user = (object) $helper->xenUserFromSession();
             if (isset($xenforo_user->email) && isset($xenforo_user->username)) {
                 if ($xenforo_user->email == $JUser->email && $xenforo_user->username == $JUser->username) {
                     // Users match, so do nothing.  XenForo  auto login
                     // will sort out the sessions.
                 } else {
                     // TODO User mismatch, terminate both sessions
                     // for security reasons
                 }
             } else {
                 // Unknown XenForo user, do nothing
             }
         } else {
             // Do we have an active XenForo session ?
             if ($helper->sessionCookie()) {
                 // Is this a user session ?
                 $xenuser = $helper->xenUserFromSession();
                 if (empty($xenuser['user_id'])) {
                     // This is a Xenforo guest session
                     // Log user into XenForo
                     $userinfo = $helper->xenUserFromJUser($JUser);
                     if (isset($userinfo['username'])) {
                         $helper->createSession($userinfo['userid'], $expiry, $userinfo['remember_key']);
                     } else {
                         // No matching user, so do nothing
                     }
                 } else {
                     if (isset($xenuser->email) && isset($xenforo_user->username)) {
                         if ($xenuser->email == $JUser->email && $xenuser->username == $JUser->username) {
                             // Users match, so do nothing.
                             // We are already logged in
                         } else {
                             // TODO User mismatch, terminate both sessions
                             // for security reasons
                         }
                     } else {
                         // Unknown XenForo user, do nothing
                     }
                 }
             }
         }
     } else {
         // Not logged into Joomla
         if ($helper->persistantUser()) {
             // Login to Joomla persistant
             // First identify the xenforo user
             $xenuser = (object) $helper->xenUserFromSession();
             // Verify that this is a user session
             if (!empty($xenuser->email) && !empty($xenuser->username)) {
                 // We have a XenForo user session, try to find matching Joomla user
                 $JoomlaUser = JFusionFactory::getUser('joomla_int');
                 $userinfo = $JoomlaUser->getUser($xenuser);
                 if (!empty($userinfo)) {
                     // We have a valid Joomla user, so create user session.
                     global $JFusionActivePlugin;
                     $JFusionActivePlugin = $this->getJname();
                     $options['remember'] = true;
                     $status = $JoomlaUser->createSession($userinfo, $options);
                     if ($debug) {
                         JFusionFunction::raiseWarning('500', $status);
                     }
                     // No refresh needed
                     return 0;
                 } else {
                     // No Joomla user, so lets create one.
                     $status = array();
                     $userinfo = $this->getUser($xenuser);
                     JFusionJplugin::createUser($userinfo, $status, 'joomla_int');
//.........这里部分代码省略.........
开发者ID:Fabrik,项目名称:website,代码行数:101,代码来源:user.php

示例14: onAfterDispatch

 /**
  * Method to add alternative meta tags for associated menu items.
  *
  * @return  void
  *
  * @since   1.7
  */
 public function onAfterDispatch()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $menu = $app->getMenu();
     $server = JUri::getInstance()->toString(array('scheme', 'host', 'port'));
     $option = $app->input->get('option');
     $eName = JString::ucfirst(JString::str_ireplace('com_', '', $option));
     if ($app->isSite() && $this->params->get('alternate_meta') && $doc->getType() == 'html') {
         // Get active menu item.
         $active = $menu->getActive();
         // Load menu associations.
         if ($active) {
             // Get menu item link.
             if ($app->get('sef')) {
                 $active_link = JRoute::_('index.php?Itemid=' . $active->id, false);
             } else {
                 $active_link = JRoute::_($active->link . '&Itemid=' . $active->id, false);
             }
             if ($active_link == JUri::base(true) . '/') {
                 $active_link .= 'index.php';
             }
             // Get current link.
             $current_link = JUri::getInstance()->toString(array('path', 'query'));
             if ($current_link == JUri::base(true) . '/') {
                 $current_link .= 'index.php';
             }
             // Check the exact menu item's URL.
             if ($active_link == $current_link) {
                 $associations = MenusHelper::getAssociations($active->id);
                 unset($associations[$active->language]);
             }
         }
         // Load component associations.
         $cName = JString::ucfirst($eName . 'HelperAssociation');
         JLoader::register($cName, JPath::clean(JPATH_COMPONENT_SITE . '/helpers/association.php'));
         if (class_exists($cName) && is_callable(array($cName, 'getAssociations'))) {
             $cassociations = call_user_func(array($cName, 'getAssociations'));
             $lang_code = $app->input->cookie->getString(JApplicationHelper::getHash('language'));
             // No cookie - let's try to detect browser language or use site default.
             if (!$lang_code) {
                 if ($this->params->get('detect_browser', 1)) {
                     $lang_code = JLanguageHelper::detectLanguage();
                 } else {
                     $lang_code = self::$default_lang;
                 }
             }
             unset($cassociations[$lang_code]);
         }
         // Handle the default associations.
         if ((!empty($associations) || !empty($cassociations)) && $this->params->get('item_associations')) {
             foreach (JLanguageHelper::getLanguages() as $language) {
                 if (!JLanguage::exists($language->lang_code)) {
                     continue;
                 }
                 if (isset($cassociations[$language->lang_code])) {
                     $link = JRoute::_($cassociations[$language->lang_code] . '&lang=' . $language->sef);
                     $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                 } elseif (isset($associations[$language->lang_code])) {
                     $item = $menu->getItem($associations[$language->lang_code]);
                     if ($item) {
                         if ($app->get('sef')) {
                             $link = JRoute::_('index.php?Itemid=' . $item->id . '&lang=' . $language->sef);
                         } else {
                             $link = JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef);
                         }
                         $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                     }
                 }
             }
         } elseif ($active && $active->home) {
             foreach (JLanguageHelper::getLanguages() as $language) {
                 if (!JLanguage::exists($language->lang_code)) {
                     continue;
                 }
                 $item = $menu->getDefault($language->lang_code);
                 if ($item && $item->language != $active->language && $item->language != '*') {
                     if ($app->get('sef')) {
                         $link = JRoute::_('index.php?Itemid=' . $item->id . '&lang=' . $language->sef);
                     } else {
                         $link = JRoute::_($item->link . '&Itemid=' . $item->id . '&lang=' . $language->sef);
                     }
                     $doc->addHeadLink($server . $link, 'alternate', 'rel', array('hreflang' => $language->lang_code));
                 }
             }
         }
     }
 }
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:95,代码来源:languagefilter.php

示例15: download

 /**
  * Todo: description missing
  *
  * @return void
  */
 public function download()
 {
     // Redirect to the export view
     $app = JFactory::getApplication();
     $name = $app->getUserState('com_localise.package.name');
     $path = JPATH_COMPONENT_ADMINISTRATOR . '/packages/' . $name . '.xml';
     $id = LocaliseHelper::getFileId($path);
     // Check if the package exists
     if (empty($id)) {
         $this->setRedirect(JRoute::_('index.php?option=' . $this->_option . '&view=packages', false), JText::sprintf('COM_LOCALISE_ERROR_DOWNLOADPACKAGE_UNEXISTING', $name), 'error');
     } else {
         $model = $this->getModel();
         $package = $model->getItem();
         if (!$package->standalone) {
             $msg = JText::sprintf('COM_LOCALISE_NOTICE_DOWNLOADPACKAGE_NOTSTANDALONE', $name);
             $type = 'notice';
         } else {
             $msg = '';
             $type = 'message';
         }
         setcookie(JApplicationHelper::getHash($this->_context . '.author'), $package->author, time() + 60 * 60 * 24 * 30);
         setcookie(JApplicationHelper::getHash($this->_context . '.copyright'), $package->copyright, time() + 60 * 60 * 24 * 30);
         setcookie(JApplicationHelper::getHash($this->_context . '.email'), $package->email, time() + 60 * 60 * 24 * 30);
         setcookie(JApplicationHelper::getHash($this->_context . '.url'), $package->url, time() + 60 * 60 * 24 * 30);
         setcookie(JApplicationHelper::getHash($this->_context . '.version'), $package->version, time() + 60 * 60 * 24 * 30);
         setcookie(JApplicationHelper::getHash($this->_context . '.license'), $package->license, time() + 60 * 60 * 24 * 30);
         $this->setRedirect(JRoute::_('index.php?option=com_localise&tmpl=component&view=downloadpackage&name=' . $name . '&standalone=' . $package->standalone, false), $msg, $type);
     }
 }
开发者ID:svenbluege,项目名称:com_localise,代码行数:34,代码来源:package.php


注:本文中的JApplicationHelper::getHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。