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


PHP JSession::getFormToken方法代码示例

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


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

示例1: boot

 public function boot()
 {
     \JHtml::_('behavior.keepalive');
     $app = \JFactory::getApplication();
     $input = $app->input;
     /** @var Request $request */
     $request = $this->container['request'];
     $this->method = $request->getMethod();
     $this->path = explode('/', $input->getString('view'));
     $this->resource = array_shift($this->path) ?: 'themes';
     $this->format = $input->getCmd('format', 'html');
     $ajax = $this->format == 'json';
     $this->params = ['user' => \JFactory::getUser(), 'ajax' => $ajax, 'location' => $this->resource, 'method' => $this->method, 'format' => $this->format, 'params' => isset($_POST['params']) && is_string($_POST['params']) ? json_decode($_POST['params'], true) : []];
     // If style is set, resolve the template and load it.
     $style = $input->getInt('style', 0);
     if ($style) {
         \JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/tables');
         $table = \JTable::getInstance('Style', 'TemplatesTable');
         $table->load($style);
         $template = $table->template;
         $path = JPATH_SITE . '/templates/' . $template;
         $this->container['theme.path'] = $path;
         $this->container['theme.name'] = $template;
         // Load language file for the template.
         $languageFile = 'tpl_' . $template;
         $lang = \JFactory::getLanguage();
         $lang->load($languageFile, JPATH_SITE) || $lang->load($languageFile, $path) || $lang->load($languageFile, $path, 'en-GB');
     }
     $this->container['base_url'] = \JUri::base(true) . '/index.php?option=com_gantry5';
     $this->container['ajax_suffix'] = '&format=json';
     $token = \JSession::getFormToken();
     $this->container['routes'] = ['1' => "&view=%s&style={$style}&{$token}=1", 'themes' => '&view=themes', 'picker/layouts' => "&view=layouts&style={$style}&{$token}=1", 'picker/particles' => "&view=particles&style={$style}&{$token}=1"];
 }
开发者ID:Acidburn0zzz,项目名称:gantry5,代码行数:33,代码来源:Router.php

示例2: onBeforeInstanceLoaded

 public function onBeforeInstanceLoaded(&$params)
 {
     $app = JFactory::getApplication();
     $option = $app->input->get('option');
     if ($app->isSite()) {
         $id = $app->input->get('a_id', 0);
     } else {
         $id = $app->input->get('id', 0);
     }
     if ($option == 'com_content') {
         $typeid = 1;
         $type = 'com_content.article';
     } else {
         if ($option == 'com_modules') {
             $typeTable = JTable::getInstance('Contenttype', 'JTable');
             $typeid = $typeTable->getTypeId('com_modules.custom');
             $type = 'com_module.custom';
         } else {
             $typeid = 6;
             $type = 'com_content.category';
         }
     }
     $temp = JComponentHelper::getParams('com_arkeditor');
     $params->merge($this->params);
     //merge with plugin parameters
     $temp->merge($params);
     //merge with editor parameters
     return " \t\r\n\t\t    editor.on( 'configLoaded', function()\r\n\t\t    {\r\n\t\t\t    editor.config.enableModuleHistory = " . (int) $temp->get('enable_modulehistory', 1) . ";\r\n\t\t    });\t\r\n\t\t\t \r\n\t\t editor.on('instanceReady', function()\r\n\t\t {\r\n\t\t\tvar editable = this.editable();\r\n\t\t\tvar versionsURL = 'index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&item_id=" . $id . "&type_id=" . $typeid . "&type_alias=" . $type . "&" . JSession::getFormToken() . "=1';\r\n\t\t\teditable.setCustomData('versionsURL',versionsURL); \r\n\t\t });\r\n\t\t";
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:29,代码来源:versions.php

示例3: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the modal behavior script.
     JHtml::_('behavior.modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function onBulletsSelect(data){';
     $script[] = '		alert("do something: " + data)';
     $script[] = '		SqueezeBox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_unitehcarousel&view=slider&layout=bullets&tmpl=component';
     $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />';
     $bulletsText = "Change Bullets";
     $buttonID = $this->id . "-btn";
     $desc = UniteFunctionsHCar::getVal($this->element, "description");
     $htmlAddon = "";
     if (!empty($desc)) {
         $htmlAddon = ' title="' . $desc . '"';
         //$class .= " hasTip";	//making problems with rel
     }
     // The user select button.
     $html[] = '	<a id="' . $buttonID . '" class="modal panel_button" ' . $htmlAddon . '  href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">' . $bulletsText . '</a>';
     $html = implode("\n", $html);
     return $html;
 }
开发者ID:ashanrupasinghe,项目名称:slbcv1,代码行数:35,代码来源:bullets.php

示例4: display

 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/jnotification.php';
     $view = JRequest::getCmd('view', 'inbox');
     $layout = JRequest::getCmd('layout', 'default');
     $id = JRequest::getInt('id');
     $model = $this->getModel('Domains', 'JNotificationModel');
     $numberofdomains = (int) count($model->getItems());
     $app = JFactory::getApplication();
     $flagNotification = $app->getUserState('notification.flag');
     $flagDomains = $app->getUserState('domains.flag');
     if ($view != 'domain') {
         // Load the submenu.
         JNotificationHelper::addSubmenu(JRequest::getCmd('view', 'inbox'));
     }
     // Check for edit form.
     if ($view == 'notification' && $layout == 'edit' && !$this->checkEditId('com_jnotification.edit.notification', $id) || $view == 'notification' && $layout == 'edit' && $numberofdomains == 0) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(JRoute::_('index.php?option=com_jnotification&view=inbox', false));
         return false;
     }
     // Check for edit form.
     if ($view == 'notification' && $layout == 'viewMessage') {
         $model1 = $model = $this->getModel('Inbox', 'JNotificationModel');
         $items = $model1->getItems();
         for ($i = 0; $i < count($items); $i++) {
             if ((int) $items[$i]->id == (int) JRequest::getInt('id')) {
                 $app->setUserState('com_jnotification.edit.notification.id', (int) JRequest::getInt('id'));
             }
         }
         // Somehow the person just went to the form - we don't allow that.
         if (!$this->checkEditId('com_jnotification.edit.notification', $id)) {
             $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=com_jnotification&view=inbox', false));
             return false;
         }
     }
     if ($view == 'notification' && $layout == 'edit' && $flagNotification) {
         $flagNotification = $app->setUserState('notification.flag', false);
         //$this->releaseEditId('com_jnotification.edit.notification', $id);
         $this->setRedirect(JRoute::_('index.php?option=com_jnotification&view=domains&layout=default&id=' . (int) $postId . '&' . JSession::getFormToken() . '=1', false));
     }
     // Check for edit form.
     if ($view == 'domains' && $layout == 'default' && $flagDomains) {
         $app->setUserState('domains.flag', false);
     } else {
         if ($view == 'domains' && $layout == 'default' && !$flagDomains) {
             // Somehow the person just went to the form - we don't allow that.
             $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
             $this->setMessage($this->getError(), 'error');
             $this->setRedirect(JRoute::_('index.php?option=com_jnotification&view=inbox', false));
             return false;
         }
     }
     parent::display();
     return $this;
 }
开发者ID:konstantinosDMS,项目名称:jNotification,代码行数:60,代码来源:controller.php

示例5: getInput

    protected function getInput()
    {
        // Load the modal behavior script.
        JHtml::_('behavior.modal', 'a.modal');
        // Build the script.
        $script = array();
        $script[] = '	function jSelectArticle_' . $this->id . '(id, title, catid, object) {';
        $script[] = '		document.id("' . $this->id . '_id").value = id;';
        $script[] = '		document.id("' . $this->id . '_name").value = title;';
        $script[] = '		SqueezeBox.close();';
        $script[] = '	}';
        // Add the script to the document head.
        JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
        // Setup variables for display.
        $html = array();
        $link = 'index.php?option=com_articles&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_' . $this->id;
        $title = KService::get('com://site/articles.model.articles')->id($this->value)->getItem()->title;
        $html[] = '<span class="input-append">';
        $html[] = '<input type="text" class="inoutbox input=medium" id="' . $this->id . '_name" value="' . $title . '" readonly="readonly" disabled="disabled" size="40" placeholder="' . JText::_('COM_ARTICLES_SELECT_AN_ITEM') . '" /><a class="btn btn-primary modal" href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-list icon-white"></i>
' . JText::_('Select') . '</a>';
        // The active article id field.
        if (0 == (int) $this->value) {
            $value = '';
        } else {
            $value = (int) $this->value;
        }
        // class='required' for client side validation
        $class = '';
        if ($this->required) {
            $class = ' class="required modal-value"';
        }
        $html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
        return implode("\n", $html);
    }
开发者ID:kedweber,项目名称:com_articles,代码行数:34,代码来源:article.php

示例6: onDisplay

 public function onDisplay($name, $asset, $author)
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $allowed_in_frontend = $this->params->get('frontend', 0);
     $document->addStyleSheet(JURI::root() . 'plugins/editors-xtd/jdownloads/assets/css/jdownloads.css', 'text/css', null, array());
     /*
      * Javascript to insert the link
      * View element calls jSelectDownloadContent when an download is clicked
      * jSelectDownload creates the content tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n        function jSelectDownload(id, title, catid, object, link, lang)\n        {\n            var tag = '{jd_file file=='+ id + '}';\n            jInsertEditorText(tag, '" . $name . "');\n            SqueezeBox.close();\n        }";
     $document->addScriptDeclaration($js);
     $link = 'index.php?option=com_jdownloads&amp;view=list&amp;layout=modallist&amp;tmpl=component&amp;e_name=' . $name . '&amp;' . JSession::getFormToken() . '=1';
     JHtml::_('behavior.modal');
     $button = new JObject();
     $button->modal = true;
     $button->class = 'btn';
     $button->link = $link;
     $button->text = JText::_('PLG_EDITORS-XTD_JDOWNLOADS_CAT_BUTTON_TEXT');
     $button->name = 'file-add';
     $button->options = "{handler: 'iframe', size: {x: 950, y: 500}}";
     if ($allowed_in_frontend == 0 && !$app->isAdmin()) {
         $button = null;
     }
     return $button;
 }
开发者ID:ashanrupasinghe,项目名称:dnp,代码行数:28,代码来源:jdownloads.php

示例7: setTheme

 public function setTheme($theme, $style)
 {
     if ($style) {
         \JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_templates/tables');
         $table = \JTable::getInstance('Style', 'TemplatesTable');
         $table->load(['id' => $style, 'client_id' => 0]);
         $theme = $table->template;
     }
     if (!$theme) {
         $theme = StyleHelper::getDefaultStyle()->template;
     }
     $path = JPATH_SITE . '/templates/' . $theme;
     if (!is_file("{$path}/gantry/theme.yaml")) {
         $theme = null;
         $this->container['streams']->register();
         /** @var UniformResourceLocator $locator */
         $locator = $this->container['locator'];
         $this->container['file.yaml.cache.path'] = $locator->findResource('gantry-cache://theme/compiled/yaml', true, true);
     }
     $this->container['base_url'] = \JUri::base(true) . '/index.php?option=com_gantry5';
     $this->container['ajax_suffix'] = '&format=json';
     $token = \JSession::getFormToken();
     $this->container['routes'] = ['1' => "&view=%s&theme={$theme}&{$token}=1", 'themes' => '&view=themes', 'picker/layouts' => "&view=layouts&theme={$theme}&{$token}=1"];
     if (!$theme) {
         return $this;
     }
     $this->container['theme.path'] = $path;
     $this->container['theme.name'] = $theme;
     // Load language file for the template.
     $languageFile = 'tpl_' . $theme;
     $lang = \JFactory::getLanguage();
     $lang->load($languageFile, JPATH_SITE) || $lang->load($languageFile, $path) || $lang->load($languageFile, $path, 'en-GB');
     return $this;
 }
开发者ID:JozefAB,项目名称:neoacu,代码行数:34,代码来源:Router.php

示例8: getInput

 /**
  * Method to get the field input markup for a generic list.
  * Use the multiple attribute to enable multiselect.
  *
  * @return  string  The field input markup.
  */
 protected function getInput()
 {
     // Receive ajax URL
     $ajaxUrl = isset($this->element['url']) ? (string) $this->element['url'] : null;
     if ($ajaxUrl) {
         $siteUrl = JUri::root();
         $adminUrl = $siteUrl . 'administrator';
         $this->ajaxchildOptions['ajaxUrl'] = str_replace(array('{admin}', '{backend}', '{site}', '{frontend}'), array($adminUrl, $adminUrl, $siteUrl, $siteUrl), $ajaxUrl);
         // Automatically attach a token
         $this->ajaxchildOptions['ajaxUrl'] .= '&' . JSession::getFormToken() . '=1';
     }
     // Receive child field selector
     $childSelector = isset($this->element['child_selector']) ? (string) $this->element['child_selector'] : null;
     if ($childSelector) {
         $this->ajaxchildOptions['childSelector'] = $childSelector;
     }
     // Receive parent field selector
     $parentSelector = isset($this->element['parent_selector']) ? (string) $this->element['parent_selector'] : null;
     if ($parentSelector) {
         $this->ajaxchildOptions['parentSelector'] = $parentSelector;
     }
     // Receive parent request var
     $parentVarName = isset($this->element['parent_varname']) ? (string) $this->element['parent_varname'] : null;
     if ($parentVarName) {
         $this->ajaxchildOptions['parentVarName'] = $parentVarName;
     }
     return parent::getInput();
 }
开发者ID:thangredweb,项目名称:redCORE,代码行数:34,代码来源:childlist.php

示例9: getCategoryActions

 /**
  * Method to return array of actions sublayout
  *
  * @return array
  */
 public function getCategoryActions()
 {
     $category = $this->category;
     $token = '&' . JSession::getFormToken() . '=1';
     $actions = array();
     // Is user allowed to post new topic?
     $url = $category->getNewTopicUrl();
     if ($url) {
         $actions['create'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'create', 'scope' => 'topic', 'type' => 'communication', 'success' => true, 'icon' => 'icon-edit icon-white'));
     }
     if ($category->getTopics() > 0) {
         // Is user allowed to mark forums as read?
         $url = $category->getMarkReadUrl();
         if ($url) {
             $actions['markread'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'markread', 'scope' => 'category', 'type' => 'user', 'icon' => 'icon-drawer'));
         }
         // Is user allowed to subscribe category?
         if ($category->isAuthorised('subscribe')) {
             $subscribed = $category->getSubscribed($this->me->userid);
             if (!$subscribed) {
                 $url = "index.php?option=com_kunena&view=category&task=subscribe&catid={$category->id}{$token}";
                 $actions['subscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'subscribe', 'scope' => 'category', 'type' => 'user', 'icon' => 'icon-bookmark'));
             } else {
                 $url = "index.php?option=com_kunena&view=category&task=unsubscribe&catid={$category->id}{$token}";
                 $actions['unsubscribe'] = $this->subLayout('Widget/Button')->setProperties(array('url' => $url, 'name' => 'unsubscribe', 'scope' => 'category', 'type' => 'user'));
             }
         }
     }
     return $actions;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:35,代码来源:item.php

示例10: onDisplay

 function onDisplay($name)
 {
     /*
      * Javascript to insert the link
      * View element calls jSelectArticle when an article is clicked
      * jSelectArticle creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n\t\tfunction jSelectPerson(id, title, appid, apptitle, treeid) {\n\t\t\tvar tag = '{joaktree person|' + appid + '|' + id + '|extended}';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     JHtml::_('behavior.modal');
     /*
      * Use the built-in element view to select the article.
      * Currently uses blank class.
      */
     $link = 'index.php?option=com_joaktree&amp;view=jt_persons&amp;layout=element&amp;select=1&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     $button = new JObject();
     $button->set('modal', true);
     $button->class = 'btn';
     $button->set('link', $link);
     $button->set('text', JText::_('PLG_JOAKTREE_BUTTON_PERSONLINK'));
     $button->set('name', 'person_link');
     $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
     return $button;
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:26,代码来源:joaktree_link.php

示例11: before

 /**
  * Prepare message actions display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('id');
     $me = KunenaUserHelper::getMyself();
     $this->category = KunenaForumCategory::getInstance($catid);
     $token = JSession::getFormToken();
     $task = "index.php?option=com_kunena&view=category&task=%s&catid={$catid}&{$token}=1";
     $layout = "index.php?option=com_kunena&view=topic&layout=%s&catid={$catid}";
     $this->template = KunenaFactory::getTemplate();
     $this->categoryButtons = new JObject();
     // Is user allowed to post new topic?
     if ($this->category->getNewTopicCategory()->exists()) {
         $this->categoryButtons->set('create', $this->getButton(sprintf($layout, 'create'), 'create', 'topic', 'communication', true));
     }
     // Is user allowed to mark forums as read?
     if ($me->exists()) {
         $this->categoryButtons->set('markread', $this->getButton(sprintf($task, 'markread'), 'markread', 'category', 'user', true));
     }
     // Is user allowed to subscribe category?
     if ($this->category->isAuthorised('subscribe')) {
         $subscribed = $this->category->getSubscribed($me->userid);
         if (!$subscribed) {
             $this->categoryButtons->set('subscribe', $this->getButton(sprintf($task, 'subscribe'), 'subscribe', 'category', 'user', true));
         } else {
             $this->categoryButtons->set('unsubscribe', $this->getButton(sprintf($task, 'unsubscribe'), 'unsubscribe', 'category', 'user', true));
         }
     }
     JPluginHelper::importPlugin('kunena');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onKunenaGetButtons', array('category.action', $this->categoryButtons, $this));
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:37,代码来源:display.php

示例12: save

 /**
  * Method to save data
  * (non-PHPdoc)
  * @see F0FController::save()
  */
 public function save()
 {
     //security check
     JSession::checkToken() or die('Invalid Token');
     $app = JFactory::getApplication();
     $model = $this->getModel('configurations');
     $data = $app->input->getArray($_POST);
     $task = $this->getTask();
     $token = JSession::getFormToken();
     unset($data['option']);
     unset($data['task']);
     unset($data['view']);
     unset($data[$token]);
     if ($task == 'populatedata') {
         $this->getPopulatedData($data);
     }
     $db = JFactory::getDbo();
     $config = J2Store::config();
     $query = 'REPLACE INTO #__j2store_configurations (config_meta_key,config_meta_value) VALUES ';
     jimport('joomla.filter.filterinput');
     $filter = JFilterInput::getInstance(null, null, 1, 1);
     $conditions = array();
     foreach ($data as $metakey => $value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         //now clean up the value
         if ($metakey == 'store_billing_layout' || $metakey == 'store_shipping_layout' || $metakey == 'store_payment_layout') {
             $value = $app->input->get($metakey, '', 'raw');
             $clean_value = $filter->clean($value, 'html');
         } else {
             $clean_value = $filter->clean($value, 'string');
         }
         $config->set($metakey, $clean_value);
         $conditions[] = '(' . $db->q(strip_tags($metakey)) . ',' . $db->q($clean_value) . ')';
     }
     $query .= implode(',', $conditions);
     try {
         $db->setQuery($query);
         $db->execute();
         //update currencies
         F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->updateCurrencies(false);
         $msg = JText::_('J2STORE_CHANGES_SAVED');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $msgType = 'Warning';
     }
     switch ($task) {
         case 'apply':
             $url = 'index.php?option=com_j2store&view=configuration';
             break;
         case 'populatedata':
             $url = 'index.php?option=com_j2store&view=configuration';
             break;
         case 'save':
             $url = 'index.php?option=com_j2store&view=cpanels';
             break;
     }
     $this->setRedirect($url, $msg, $msgType);
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:65,代码来源:configurations.php

示例13: onDisplay

 /**
  * Display the button
  *
  * @param   string  $name  The name of the button to add
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     $app = JFactory::getApplication();
     if (!$app->isSite()) {
         return false;
     }
     /*
      * Javascript to insert the link
      * View element calls jSelectEvent when an event is clicked
      * jSelectEvent creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n\t\tfunction jSelectEvent(id, title, object, link, lang)\n\t\t{\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '')\n\t\t\t{\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     JHtml::_('behavior.modal');
     /*
      * Use the built-in element view to select the event.
      * Currently uses blank class.
      */
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $link = 'index.php?option=com_jem&amp;view=eventslist&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     } else {
         $link = 'index.php?option=com_jem&amp;view=events&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     }
     $button = new JObject();
     $button->modal = true;
     $button->class = 'btn';
     $button->link = $link;
     $button->text = JText::_('PLG_EVENT_BUTTON_EVENT');
     $button->name = 'calendar';
     $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
     return $button;
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:42,代码来源:event.php

示例14: onDisplay

 /**
  * Display the button
  *
  * @param   string  $name  The name of the button to add
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     /*
      * Javascript to insert the link
      * View element calls jSelectArticle when an article is clicked
      * jSelectArticle creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n\t\tfunction jSelectArticle(id, title, catid, object, link, lang)\n\t\t{\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '')\n\t\t\t{\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tjModalClose();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     /*
      * Use the built-in element view to select the article.
      * Currently uses blank class.
      */
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     $button = new JObject();
     $button->modal = true;
     $button->class = 'btn';
     $button->link = $link;
     $button->text = JText::_('PLG_ARTICLE_BUTTON_ARTICLE');
     $button->name = 'file-add';
     $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
     return $button;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:32,代码来源:article.php

示例15: doSSOLogout

 /**
  * Method for logging out with Magento (Single Sign On)
  * 
  * @param string $username
  * @return bool|exit
  */
 public static function doSSOLogout($username = null)
 {
     // Abort if the input is not valid
     if (empty($username)) {
         return false;
     }
     // Get system variables
     $application = JFactory::getApplication();
     $session = JFactory::getSession();
     // Determine the application
     $application_name = $application->isAdmin() ? 'admin' : 'frontend';
     // Get the security token
     $token = method_exists('JSession', 'getFormToken') ? JSession::getFormToken() : JUtility::getToken();
     // Set the redirection URL
     if ($application_name == 'admin') {
         $redirect = JURI::current();
     } else {
         $redirect = MageBridgeUrlHelper::current();
     }
     // Construct the URL
     $arguments = array('sso=logout', 'app=' . $application_name, 'redirect=' . base64_encode($redirect), 'userhash=' . MageBridgeEncryptionHelper::encrypt($username), 'token=' . $token);
     $url = MageBridgeModelBridge::getInstance()->getMagentoBridgeUrl() . '?' . implode('&', $arguments);
     // Redirect the browser to Magento
     MageBridgeModelDebug::getInstance()->notice("SSO: Logout of '{$username}' from " . $application_name);
     $application->redirect($url);
     return true;
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:33,代码来源:sso.php


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