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


PHP SFUtils::loadScriptsForPopupForm方法代码示例

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


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

示例1: renderFormInput

    static function renderFormInput(&$parser)
    {
        global $wgHtml5;
        $params = func_get_args();
        array_shift($params);
        // don't need the parser
        // set defaults
        $inFormName = $inValue = $inButtonStr = $inQueryStr = '';
        $inQueryArr = array();
        $positionalParameters = false;
        $inAutocompletionSource = '';
        $inRemoteAutocompletion = false;
        $inSize = 25;
        $classStr = "sfFormInput";
        $inPlaceholder = "";
        // assign params - support unlabelled params, for backwards compatibility
        foreach ($params as $i => $param) {
            $elements = explode('=', $param, 2);
            // set param_name and value
            if (count($elements) > 1 && !$positionalParameters) {
                $param_name = trim($elements[0]);
                // parse (and sanitize) parameter values
                $value = trim($parser->recursiveTagParse($elements[1]));
            } else {
                $param_name = null;
                // parse (and sanitize) parameter values
                $value = trim($parser->recursiveTagParse($param));
            }
            if ($param_name == 'form') {
                $inFormName = $value;
            } elseif ($param_name == 'size') {
                $inSize = $value;
            } elseif ($param_name == 'default value') {
                $inValue = $value;
            } elseif ($param_name == 'button text') {
                $inButtonStr = $value;
            } elseif ($param_name == 'query string') {
                // Change HTML-encoded ampersands directly to
                // URL-encoded ampersands, so that the string
                // doesn't get split up on the '&'.
                $inQueryStr = str_replace('&', '%26', $value);
                // "Decode" any other HTML tags.
                $inQueryStr = html_entity_decode($inQueryStr, ENT_QUOTES);
                parse_str($inQueryStr, $arr);
                $inQueryArr = SFUtils::array_merge_recursive_distinct($inQueryArr, $arr);
            } elseif ($param_name == 'autocomplete on category') {
                $inAutocompletionSource = $value;
                $autocompletion_type = 'category';
            } elseif ($param_name == 'autocomplete on namespace') {
                $inAutocompletionSource = $value;
                $autocompletion_type = 'namespace';
            } elseif ($param_name == 'remote autocompletion') {
                $inRemoteAutocompletion = true;
            } elseif ($param_name == 'placeholder') {
                $inPlaceholder = $value;
            } elseif ($param_name == null && $value == 'popup') {
                SFUtils::loadScriptsForPopupForm($parser);
                $classStr .= ' popupforminput';
            } elseif ($param_name !== null && !$positionalParameters) {
                $value = urlencode($value);
                parse_str("{$param_name}={$value}", $arr);
                $inQueryArr = SFUtils::array_merge_recursive_distinct($inQueryArr, $arr);
            } elseif ($i == 0) {
                $inFormName = $value;
                $positionalParameters = true;
            } elseif ($i == 1) {
                $inSize = $value;
            } elseif ($i == 2) {
                $inValue = $value;
            } elseif ($i == 3) {
                $inButtonStr = $value;
            } elseif ($i == 4) {
                // Change HTML-encoded ampersands directly to
                // URL-encoded ampersands, so that the string
                // doesn't get split up on the '&'.
                $inQueryStr = str_replace('&', '%26', $value);
                parse_str($inQueryStr, $arr);
                $inQueryArr = SFUtils::array_merge_recursive_distinct($inQueryArr, $arr);
            }
        }
        $fs = SpecialPageFactory::getPage('FormStart');
        $fs_url = $fs->getTitle()->getLocalURL();
        $str = <<<END
\t\t\t<form name="createbox" action="{$fs_url}" method="get" class="{$classStr}">
\t\t\t<p>

END;
        $formInputAttrs = array('size' => $inSize);
        if ($wgHtml5) {
            $formInputAttrs['placeholder'] = $inPlaceholder;
            $formInputAttrs['autofocus'] = 'autofocus';
        }
        // Now apply the necessary settings and Javascript, depending
        // on whether or not there's autocompletion (and whether the
        // autocompletion is local or remote).
        $input_num = 1;
        if (empty($inAutocompletionSource)) {
            $formInputAttrs['class'] = 'formInput';
        } else {
            self::$num_autocompletion_inputs++;
//.........这里部分代码省略.........
开发者ID:Rikuforever,项目名称:wiki,代码行数:101,代码来源:SF_ParserFunctions.php

示例2: renderFormInput

 static function renderFormInput(&$parser)
 {
     $params = func_get_args();
     array_shift($params);
     // don't need the parser
     // Set defaults.
     $inFormName = $inValue = $inButtonStr = $inQueryStr = '';
     $inQueryArr = array();
     $inAutocompletionSource = '';
     $inRemoteAutocompletion = false;
     $inSize = 25;
     $classStr = "sfFormInput";
     $inPlaceholder = null;
     $inAutofocus = true;
     // Assign params.
     foreach ($params as $i => $param) {
         $elements = explode('=', $param, 2);
         // Set param name and value.
         if (count($elements) > 1) {
             $paramName = trim($elements[0]);
             // Parse (and sanitize) parameter values.
             // We call recursivePreprocess() and not
             // recursiveTagParse() so that URL values will
             // not be turned into links.
             $value = trim($parser->recursivePreprocess($elements[1]));
         } else {
             $paramName = trim($param);
             $value = null;
         }
         if ($paramName == 'form') {
             $inFormName = $value;
         } elseif ($paramName == 'size') {
             $inSize = $value;
         } elseif ($paramName == 'default value') {
             $inValue = $value;
         } elseif ($paramName == 'button text') {
             $inButtonStr = $value;
         } elseif ($paramName == 'query string') {
             // Change HTML-encoded ampersands directly to
             // URL-encoded ampersands, so that the string
             // doesn't get split up on the '&'.
             $inQueryStr = str_replace('&amp;', '%26', $value);
             // "Decode" any other HTML tags.
             $inQueryStr = html_entity_decode($inQueryStr, ENT_QUOTES);
             parse_str($inQueryStr, $arr);
             $inQueryArr = SFUtils::array_merge_recursive_distinct($inQueryArr, $arr);
         } elseif ($paramName == 'autocomplete on category') {
             $inAutocompletionSource = $value;
             $autocompletionType = 'category';
         } elseif ($paramName == 'autocomplete on namespace') {
             $inAutocompletionSource = $value;
             $autocompletionType = 'namespace';
         } elseif ($paramName == 'remote autocompletion') {
             $inRemoteAutocompletion = true;
         } elseif ($paramName == 'placeholder') {
             $inPlaceholder = $value;
         } elseif ($paramName == 'popup') {
             SFUtils::loadScriptsForPopupForm($parser);
             $classStr .= ' popupforminput';
         } elseif ($paramName == 'no autofocus') {
             $inAutofocus = false;
         } else {
             $value = urlencode($value);
             parse_str("{$paramName}={$value}", $arr);
             $inQueryArr = SFUtils::array_merge_recursive_distinct($inQueryArr, $arr);
         }
     }
     $formInputAttrs = array('size' => $inSize);
     if ($inPlaceholder != null) {
         $formInputAttrs['placeholder'] = $inPlaceholder;
     }
     if ($inAutofocus) {
         $formInputAttrs['autofocus'] = 'autofocus';
     }
     // Now apply the necessary settings and Javascript, depending
     // on whether or not there's autocompletion (and whether the
     // autocompletion is local or remote).
     $input_num = 1;
     if (empty($inAutocompletionSource)) {
         $formInputAttrs['class'] = 'formInput';
     } else {
         self::$num_autocompletion_inputs++;
         $input_num = self::$num_autocompletion_inputs;
         // Place the necessary Javascript on the page, and
         // disable the cache (so the Javascript will show up) -
         // if there's more than one autocompleted #forminput
         // on the page, we only need to do this the first time.
         if ($input_num == 1) {
             $parser->disableCache();
             $output = $parser->getOutput();
             $output->addModules('ext.semanticforms.main');
         }
         $inputID = 'input_' . $input_num;
         $formInputAttrs['id'] = $inputID;
         $formInputAttrs['class'] = 'autocompleteInput createboxInput formInput';
         global $sfgMaxLocalAutocompleteValues;
         $autocompletion_values = SFUtils::getAutocompleteValues($inAutocompletionSource, $autocompletionType);
         if (count($autocompletion_values) > $sfgMaxLocalAutocompleteValues || $inRemoteAutocompletion) {
             $formInputAttrs['autocompletesettings'] = $inAutocompletionSource;
             $formInputAttrs['autocompletedatatype'] = $autocompletionType;
//.........这里部分代码省略.........
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:101,代码来源:SF_ParserFunctions.php


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