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


PHP vRequest::getFormToken方法代码示例

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


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

示例1: addStandardEditViewCommandsNoValidate

    function addStandardEditViewCommandsNoValidate($id = 0, $object = null)
    {
        $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
        if (!class_exists('JToolBarHelper')) {
            require JPATH_ADMINISTRATOR . DS . 'includes' . DS . 'toolbar.php';
        }
        JToolBarHelper::divider();
        if (vmAccess::manager($view . '.edit')) {
            JToolBarHelper::save();
            JToolBarHelper::apply();
        }
        JToolBarHelper::cancel();
        //self::showHelp();
        //self::showACLPref($view);
        if ($view != 'shipmentmethod' and $view != 'paymentmethod' and $view != 'media') {
            $validate = true;
        } else {
            $validate = false;
        }
        $this->addJsJoomlaSubmitButtonNoValidate($validate);
        $editView = vRequest::getCmd('view', vRequest::getCmd('controller', ''));
        $params = JComponentHelper::getParams('com_languages');
        $selectedLangue = $params->get('site', 'en-GB');
        $this->lang = strtolower(strtr($selectedLangue, '-', '_'));
        // Get all the published languages defined in Language manager > Content
        $allLanguages = JLanguageHelper::getLanguages();
        foreach ($allLanguages as $jlang) {
            $languagesByCode[$jlang->lang_code] = $jlang;
        }
        // only add if ID and view not null
        if ($editView and $id and count(tsmConfig::get('active_languages')) > 1) {
            if ($editView == 'user') {
                $editView = 'vendor';
            }
            jimport('joomla.language.helper');
            $this->lang = vRequest::getVar('vmlang', $this->lang);
            // list of languages installed in #__extensions (may be more than the ones in the Language manager > Content if the user did not added them)
            $languages = JLanguageHelper::createLanguageList($selectedLangue, constant('VMPATH_ROOT'), true);
            $activeVmLangs = tsmConfig::get('active_languages');
            $flagCss = "";
            foreach ($languages as $k => &$joomlaLang) {
                if (!in_array($joomlaLang['value'], $activeVmLangs)) {
                    unset($languages[$k]);
                } else {
                    $key = $joomlaLang['value'];
                    if (!isset($languagesByCode[$key])) {
                        $img = substr($key, 0, 2);
                        //We try a fallback
                        vmdebug('com_tsmart_MISSING_FLAG', $img, $joomlaLang['text']);
                    } else {
                        $img = $languagesByCode[$key]->image;
                    }
                    $image_flag = VMPATH_ROOT . "/media/mod_languages/images/" . $img . ".gif";
                    $image_flag_url = JURI::root() . "media/mod_languages/images/" . $img . ".gif";
                    if (!file_exists($image_flag)) {
                        vmerror(tsmText::sprintf('com_tsmart_MISSING_FLAG', $image_flag, $joomlaLang['text']));
                    } else {
                        $flagCss .= "td.flag-" . $key . ",.flag-" . $key . "{background: url( " . $image_flag_url . ") no-repeat 0 0; padding-left:20px !important;}\n";
                    }
                }
            }
            JFactory::getDocument()->addStyleDeclaration($flagCss);
            $this->langList = JHtml::_('select.genericlist', $languages, 'vmlang', 'class="inputbox" style="width:176px;"', 'value', 'text', $selectedLangue, 'vmlang');
            if ($editView == 'product') {
                $productModel = tmsModel::getModel('product');
                $childproducts = $productModel->getProductChilds($id) ? $productModel->getProductChilds($id) : '';
            }
            $token = vRequest::getFormToken();
            $j = '
			jQuery(function($) {
				var oldflag = "";
				$("select#vmlang").chosen().change(function() {
					langCode = $(this).find("option:selected").val();
					flagClass = "flag-"+langCode;
					jQuery.ajax({
						type: "GET",
						cache: false,
        				dataType: "json",
        				url: "index.php?option=com_tsmart&view=translate&task=paste&format=json&lg="+langCode+"&id=' . $id . '&editView=' . $editView . '&' . $token . '=1",
    				}).done(
						function(data) {
							var items = [];

							var theForm = document.forms["adminForm"];
							if(typeof theForm.vmlang==="undefined"){
							 	var input = document.createElement("input");
								input.type = "hidden";
								input.name = "vmlang";
								input.value = langCode;
								theForm.appendChild(input);
							} else {
								theForm.vmlang.value = langCode;
							}
							if (data.fields !== "error" ) {
								if (data.structure == "empty") alert(data.msg);
								$.each(data.fields , function(key, val) {
									cible = jQuery("#"+key);
									if (oldflag !== "") cible.parent().removeClass(oldflag)
									var tmce_ver = 0;
									if(typeof window.tinyMCE!=="undefined"){
//.........这里部分代码省略.........
开发者ID:cuongnd,项目名称:etravelservice,代码行数:101,代码来源:tsmviewadmin.php


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