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


PHP App::isSite方法代码示例

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


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

示例1: onAfterRoute

 /**
  * Method to catch the onAfterRoute event.
  *
  * @return  boolean
  */
 public function onAfterRoute()
 {
     $task = Request::getVar('task', 'none');
     if (User::isGuest() || !App::isSite() || $task == 'user.logout') {
         return false;
     }
     $menuId = $this->params->get('menuId', 0);
     if (!$menuId) {
         return false;
     }
     $menu = App::get('menu');
     $activeMenu = $menu->getActive();
     $defaultMenu = $menu->getDefault();
     // If routing to the home page...
     if ($activeMenu == $defaultMenu) {
         // Reset the active menu item and
         // overwrite request vars
         $menu->setActive($menuId);
         $menu->setDefault($menuId, $defaultMenu->language);
         $item = $menu->getItem($menuId);
         $vars = $item->query;
         $vars['Itemid'] = $menuId;
         foreach ($vars as $key => $var) {
             Request::setVar($key, $var);
         }
     }
     return true;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:33,代码来源:memberhome.php

示例2: onAfterRoute

 /**
  * Hook for after routing application
  * 
  * @return  void
  */
 public function onAfterRoute()
 {
     if (!App::isAdmin() && !App::isSite()) {
         return;
     }
     $client = 'Site';
     if (App::isAdmin()) {
         $client = 'Admin';
         return;
     }
     // Check if active for this client (Site|Admin)
     if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') {
         return;
     }
     Html::behavior('framework');
     if ($this->params->get('jqueryui')) {
         Html::behavior('framework', true);
     }
     if ($this->params->get('jqueryfb')) {
         Html::behavior('modal');
     }
     if ($this->params->get('noconflict' . $client)) {
         Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js');
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:30,代码来源:jquery.php

示例3: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (User::isGuest()) {
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (App::isSite()) {
             $pages = ['com_users.login'];
             $granted = Session::get('user_consent', false);
             if (in_array($current, $pages) && !$granted) {
                 Request::setVar('option', 'com_users');
                 Request::setVar('view', 'userconsent');
             }
         } else {
             if (App::isAdmin()) {
                 $exceptions = ['com_login.grantconsent'];
                 $granted = Session::get('user_consent', false);
                 if (!in_array($current, $exceptions) && !$granted) {
                     Request::setVar('option', 'com_login');
                     Request::setVar('task', 'consent');
                 }
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:userconsent.php

示例4: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_members.changepassword', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         $badpassword = Session::get('badpassword', false);
         $expiredpassword = Session::get('expiredpassword', false);
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && ($badpassword || $expiredpassword)) {
             Request::setVar('option', 'com_members');
             Request::setVar('task', 'changepassword');
             Request::setVar('id', 0);
             if ($badpassword) {
                 Request::setVar('Your password does not meet current site requirements. Please change your password now.');
             }
             if ($expiredpassword) {
                 Request::setVar('Your password has expired. Please change your password now.');
             }
             $this->event->stop();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:30,代码来源:password.php

示例5: onAfterRoute

 /**
  * Constructor
  *
  * @return  boolean
  */
 public function onAfterRoute()
 {
     $task = Request::getVar('task', 'none');
     if (User::isGuest() || !App::isSite() || $task == 'user.logout') {
         return false;
     }
     /*$ignoredURLs = (string) $this->params->get('ignore_urls', '');
     
     		if ($ignoredURLs)
     		{
     			$ignoredURLArray = explode("\r\n",$ignoredURLs);
     
     			$fullURL = Request::current();
     
     			foreach ($ignoredURLArray as $str)
     			{
     				$pos = strpos($fullURL, $str);
     				if ($pos !== false)
     				{
     					return false;
     				}
     			}
     		}
     
     		$ignoredOptions = (string) $this->params->get('ignore_options', '');
     
     		if ($ignoredOptions)
     		{
     			$option = Request::getCmd('option', '');
     			$ignoredOptionsArray = explode("\r\n", $ignoredOptions);
     
     			foreach ($ignoredOptionsArray as $str)
     			{
     				if ($str == $option)
     				{
     					return false;
     				}
     			}
     		}*/
     $menuId = $this->params->get('menuId', 0);
     if (!$menuId) {
         return false;
     }
     $menu = App::get('menu');
     $activeMenu = $menu->getActive();
     $defaultMenu = $menu->getDefault();
     if ($activeMenu == $defaultMenu) {
         $menu->setActive($menuId);
         $menu->setDefault($menuId, $defaultMenu->language);
         $item = $menu->getItem($menuId);
         $vars = $item->query;
         $vars['Itemid'] = $menuId;
         foreach ($vars as $key => $var) {
             Request::setVar($key, $var);
         }
         //Request::set($vars, 'method', true);
         //App::redirect(Route::url('index.php?Itemid=' . $menuId, false));
     }
     return true;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:65,代码来源:memberhome.php

示例6: __construct

 /**
  * Object Constructor.
  *
  * @param	object	The object to observe -- event dispatcher.
  * @param	object	The configuration object for the plugin.
  * @return	void
  * @since	1.0
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     if (App::isSite()) {
         // Set the error handler for E_ERROR to be the class handleError method.
         set_exception_handler(array('plgSystemRedirect', 'handleError'));
     }
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:16,代码来源:redirect.php

示例7: onAfterDispatch

 /**
  * Check if caching should be re-enabled for this page if it was disabled and
  * set the site config accordingly
  *
  * @return  void
  */
 public function onAfterDispatch()
 {
     if ($this->_checkRules() && \App::isSite()) {
         if ($this->params->def('reenable_afterdispatch', 0)) {
             \Config::set('caching', $this->_caching);
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:14,代码来源:disablecache.php

示例8: onContentBeforeSave

 /**
  * Before save content method
  *
  * Article is passed by reference, but after the save, so no changes will be saved.
  * Method is called right after the content is saved
  *
  * @param   string   $context  The context of the content passed to the plugin (added in 1.6)
  * @param   object   $article  Model
  * @param   boolean  $isNew    If the content is just about to be created
  * @return  void
  * @since   2.5
  */
 public function onContentBeforeSave($context, $article, $isNew)
 {
     if (!App::isSite()) {
         return;
     }
     if ($article instanceof \Hubzero\Base\Object || $article instanceof \Hubzero\Database\Relational) {
         $key = $this->_key($context);
         $content = ltrim($article->get($key));
     } else {
         if (is_object($article) || is_array($article)) {
             return;
         } else {
             $content = $article;
         }
     }
     $content = preg_replace('/^<!-- \\{FORMAT:.*\\} -->/i', '', $content);
     $content = trim($content);
     if (!$content) {
         return;
     }
     // Get the detector manager
     $service = new \Hubzero\Spam\Checker();
     foreach (Event::trigger('antispam.onAntispamDetector') as $detector) {
         if (!$detector) {
             continue;
         }
         $service->registerDetector($detector);
     }
     // Check content
     $data = array('name' => User::get('name'), 'email' => User::get('email'), 'username' => User::get('username'), 'id' => User::get('id'), 'ip' => Request::ip(), 'user_agent' => Request::getVar('HTTP_USER_AGENT', null, 'server'), 'text' => $content);
     $result = $service->check($data);
     // Log errors any of the service providers may have thrown
     if ($service->getError() && App::has('log')) {
         App::get('log')->logger('debug')->info(implode(' ', $service->getErrors()));
     }
     // If the content was detected as spam...
     if ($result->isSpam()) {
         // Learn from it?
         if ($this->params->get('learn_spam', 1)) {
             Event::trigger('antispam.onAntispamTrain', array($content, true));
         }
         // If a message was set...
         if ($message = $this->params->get('message')) {
             Notify::error($message);
         }
         // Increment spam hits count...go to spam jail!
         \Hubzero\User\User::oneOrFail(User::get('id'))->reputation->incrementSpamCount();
         if ($this->params->get('log_spam')) {
             $this->log($result->isSpam(), $data);
         }
         return false;
     }
     // Content was not spam.
     // Learn from it?
     if ($this->params->get('learn_ham', 0)) {
         Event::trigger('antispam.onAntispamTrain', array($content, false));
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:70,代码来源:antispam.php

示例9: logActivity

 /**
  * Log an activity
  *
  * @param   array  $activity
  * @param   array  $recipients
  * @return  void
  */
 public function logActivity($activity, $recipients = array())
 {
     if (!App::isSite()) {
         return;
     }
     if (!$activity) {
         return;
     }
     \Hubzero\Activity\Log::log($activity, $recipients);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:17,代码来源:activity.php

示例10: onAfterInitialise

 public function onAfterInitialise()
 {
     // No remember me for admin
     if (!App::isSite()) {
         return;
     }
     if (User::isGuest()) {
         $hash = App::hash('JLOGIN_REMEMBER');
         if ($str = Request::getString($hash, '', 'cookie', 1 | 2)) {
             $credentials = array();
             $goodCookie = true;
             $filter = JFilterInput::getInstance();
             // Create the encryption key, apply extra hardening using the user agent string.
             // Since we're decoding, no UA validity check is required.
             $privateKey = App::hash(@$_SERVER['HTTP_USER_AGENT']);
             $crypt = new \Hubzero\Encryption\Encrypter(new \Hubzero\Encryption\Cipher\Simple(), new \Hubzero\Encryption\Key('simple', $privateKey, $privateKey));
             try {
                 $str = $crypt->decrypt($str);
                 if (!is_string($str)) {
                     throw new Exception('Decoded cookie is not a string.');
                 }
                 $cookieData = json_decode($str);
                 if (null === $cookieData) {
                     throw new Exception('JSON could not be docoded.');
                 }
                 if (!is_object($cookieData)) {
                     throw new Exception('Decoded JSON is not an object.');
                 }
                 // json_decoded cookie could be any object structure, so make sure the
                 // credentials are well structured and only have user and password.
                 if (isset($cookieData->username) && is_string($cookieData->username)) {
                     $credentials['username'] = $filter->clean($cookieData->username, 'username');
                 } else {
                     throw new Exception('Malformed username.');
                 }
                 if (isset($cookieData->password) && is_string($cookieData->password)) {
                     $credentials['password'] = $filter->clean($cookieData->password, 'string');
                 } else {
                     throw new Exception('Malformed password.');
                 }
                 // We're only doing this for the site app, so we explicitly set the action here
                 $return = App::get('auth')->login($credentials, array('silent' => true, 'action' => 'core.login.site'));
                 if (!$return) {
                     throw new Exception('Log-in failed.');
                 }
             } catch (Exception $e) {
                 $cookie_domain = Config::get('cookie_domain', '');
                 $cookie_path = Config::get('cookie_path', '/');
                 // Clear the remember me cookie
                 setcookie(App::hash('JLOGIN_REMEMBER'), false, time() - 86400, $cookie_path, $cookie_domain);
                 Log::warning('A remember me cookie was unset for the following reason: ' . $e->getMessage());
             }
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:55,代码来源:remember.php

示例11: handleError

 /**
  * Handle an error
  *
  * @param   object  $error
  * @return  void
  */
 public static function handleError(&$error)
 {
     // Make sure the error is a 403 and we are in the frontend.
     if ($error->getCode() == 403 and App::isSite()) {
         // Redirect to the home page
         App::redirect('index.php', Lang::txt('PLG_SYSTEM_LOGOUT_REDIRECT'), null, true, false);
     } else {
         // Render the error page.
         $renderer = new \Hubzero\Error\Renderer\Page(App::get('document'), App::get('template')->template, App::get('config')->get('debug'));
         $renderer->render($error);
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:18,代码来源:logout.php

示例12: onContentBeforeSave

 /**
  * Before save content method
  *
  * Article is passed by reference, but after the save, so no changes will be saved.
  * Method is called right after the content is saved
  *
  * @param   string   $context  The context of the content passed to the plugin (added in 1.6)
  * @param   object   $article  A JTableContent object
  * @param   boolean  $isNew    If the content is just about to be created
  * @return  void
  * @since   2.5
  */
 public function onContentBeforeSave($context, $article, $isNew)
 {
     if (!App::isSite()) {
         return;
     }
     if ($article instanceof \Hubzero\Base\Object) {
         $key = $this->_key($context);
         $content = ltrim($article->get($key));
     } else {
         if (is_object($article) || is_array($article)) {
             return;
         } else {
             $content = $article;
         }
     }
     $content = preg_replace('/^<!-- \\{FORMAT:.*\\} -->/i', '', $content);
     $content = trim($content);
     if (!$content) {
         return;
     }
     // Get the detector manager
     $service = new \Hubzero\Spam\Checker();
     foreach (Event::trigger('antispam.onAntispamDetector') as $detector) {
         if (!$detector) {
             continue;
         }
         $service->registerDetector($detector);
     }
     // Check content
     $data = array('name' => User::get('name'), 'email' => User::get('email'), 'username' => User::get('username'), 'id' => User::get('id'), 'text' => $content);
     $result = $service->check($data);
     // If the content was detected as spam...
     if ($result->isSpam()) {
         // Learn from it?
         if ($this->params->get('learn_spam', 1)) {
             Event::trigger('antispam.onAntispamTrain', array($content, true));
         }
         // If a message was set...
         if ($message = $this->params->get('message')) {
             Notify::error($message);
         }
         // Increment spam hits count...go to spam jail!
         \Hubzero\User\User::oneOrFail(User::get('id'))->reputation->incrementSpamCount();
         return false;
     }
     // Content was not spam.
     // Learn from it?
     if ($this->params->get('learn_ham', 0)) {
         Event::trigger('antispam.onAntispamTrain', array($content, false));
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:63,代码来源:antispam.php

示例13: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_support.tickets.save.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && User::getInstance()->reputation->isJailed()) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'spamjail');
         }
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:20,代码来源:spamjail.php

示例14: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles', 'com_members.register.unconfirmed.profiles', 'com_members.register.change.profiles', 'com_members.register.resend.profiles', 'com_members.register.resend', 'com_members.register.confirm.profiles', 'com_members.register.confirm', 'com_members.save.profiles', 'com_members.profiles.save', 'com_members.profiles.save.profiles', 'com_members.changepassword'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (User::get('id') && User::get('activation') != 1 && User::get('activation') != 3 && !in_array($current, $exceptions)) {
             Request::setVar('option', 'com_members');
             Request::setVar('controller', 'register');
             Request::setVar('task', 'unconfirmed');
             $this->event->stop();
         }
     }
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:21,代码来源:unconfirmed.php

示例15: onAfterRoute

 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && !User::get('approved')) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'unapproved');
             $this->event->stop();
         }
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:21,代码来源:unapproved.php


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