⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tag.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 3 页
字号:
                if ($mergeWithName) {            $name = $this->element->getAttribute('NAME');            //if ((strtolower($this->element->getAttribute('TYPE')) == 'checkbox') && (substr($name,-2) == '[]')) {            //    $name = substr($name,0,-2);            //}            return  $ret .                 '$element = $this->elements[\''.$id.'\'];                $element = $this->mergeElement($element,$this->elements[\''.$name.'\']);                echo  $element->toHtml();' . $unset;                 }        return $ret . 'echo $this->elements[\''.$id.'\']->toHtml();'. $unset;
            }        /**    * Reads an Script tag - check if PHP is allowed.    *    * @return   false|PEAR_Error     * @access   public    */    function parseTagScript()     {                        $lang = $this->element->getAttribute('LANGUAGE');        if (!$lang) {            return false;        }        $lang = strtoupper($lang);        $allow = $GLOBALS['_HTML_TEMPLATE_FLEXY']['currentOptions']['allowPHP'];                if ($allow === true) {                      return false;        }                if ($lang == "PHP") {            if ($allow == 'delete') {                return '';            }            return HTML_Template_Flexy::raiseError('PHP code found in script (script)',                HTML_TEMPLATE_FLEXY_ERROR_SYNTAX,HTML_TEMPLATE_FLEXY_ERROR_RETURN            );        }        return false;        }    /**    * Reads an Input tag - build a element object for it    *    *    * @return   string | false = html output or ignore (just output the tag)    * @access   public    */          function parseTagInput()     {        global $_HTML_TEMPLATE_FLEXY;                if (in_array(strtoupper($this->element->getAttribute('TYPE')), array('SUBMIT','BUTTON','INPUT','')))  {            $this->compiler->addStringToGettext($this->element->getAttribute('VALUE'));        }        // form elements : format:        //value - fill out as PHP CODE                // as a general rule, this uses name, rather than ID except on         // radio        $mergeWithName = false;
        $id = $this->element->getAttribute('NAME');                        if (isset($this->element->ucAttributes['FLEXY:RAW'])) {            return HTML_Template_Flexy::raiseError(                    "Error:{$_HTML_TEMPLATE_FLEXY['filename']} on Line {$this->element->line} ".                    "in Tag &lt;{$this->element->tag}&gt;:<BR>".                    "Flexy:raw can only be used with flexy:ignore, to prevent conversion of html ".                    "elements to flexy elements",                    null, HTML_TEMPLATE_FLEXY_ERROR_DIE            );        }        // checkboxes need more work.. - at the momemnt assume one with the same value...        if (in_array(strtoupper($this->element->getAttribute('TYPE')), array('RADIO'))) {                        if (!isset($_HTML_TEMPLATE_FLEXY['elements'][$id])) {                // register it..  - so we dont overwrite it...                $_HTML_TEMPLATE_FLEXY['elements'][$id] = false;            } else if ($_HTML_TEMPLATE_FLEXY['elements'][$id] != false) {                                           return HTML_Template_Flexy::raiseError(                    "Error:{$_HTML_TEMPLATE_FLEXY['filename']} on Line {$this->element->line} ".                    "in Tag &lt;{$this->element->tag}&gt;:<BR>".                    "The Dynamic tag Name '$id' has already been used previously by ".                    "tag &lt;{$_HTML_TEMPLATE_FLEXY['elements'][$id]->tag}&gt;",                     null, HTML_TEMPLATE_FLEXY_ERROR_DIE                );            }                       $id = $this->element->getAttribute('ID');            if (!$id) {                return HTML_Template_Flexy::raiseError("Error on Line {$this->element->line} &lt;{$this->element->tag}&gt;:                  Radio Input's require an ID attribute (eg &lt;input type='radio' id='1' name='xxxx' value='yyy'&gt;..",                 null, HTML_TEMPLATE_FLEXY_ERROR_DIE);            }            $mergeWithName = true;                    }        if (!$id) {            return false;        }        return $this->compiler->appendPhp($this->getElementPhp( $id,$mergeWithName));    }        /**    * Deal with a TextArea tag - build a element object for it    *    * @return   string | false = html output or ignore (just output the tag)    * @access   public    */      function parseTagTextArea()     {                 return $this->compiler->appendPhp(            $this->getElementPhp( $this->element->getAttribute('NAME')));                                }    /**    * Deal with Selects - build a element object for it (unless flexyignore is set)    *    *    * @return   string | false = html output or ignore (just output the tag)    * @access   public    */      function parseTagSelect()     {        return $this->compiler->appendPhp(            $this->getElementPhp( $this->element->getAttribute('NAME')));    }                       /**    * Reads an Form tag - and set up the element object header etc.    *        * @return   string | false = html output or ignore (just output the tag)    * @access   public    */      function parseTagForm()     {        global $_HTML_TEMPLATE_FLEXY;        $copy = clone($this->element);        $copy->children = array();        $id = $this->element->getAttribute('NAME');        // dont make forms dynamic if they dont have a name..        if (!$id) {            return false;        }                // this adds the element to the elements array.        $old = clone($this->element);        $this->element = $copy;        list($prefix,$suffix) = $this->getElementPhp($id,false,true);        $this->element= $old;                        return             $this->compiler->appendPhp($prefix .'echo $this->elements[\''.$id.'\']->toHtmlnoClose();'.$suffix) .            $this->element->compileChildren($this->compiler) .            $this->compiler->appendHtml( "</{$copy->oTag}>");        }                                         /**    * reWriteURL - can using the config option 'url_rewrite'    *  format "from:to,from:to"    * only handle left rewrite.     * so     *  "/images:/myroot/images"    * would change    *   /images/xyz.gif to /myroot/images/xyz.gif    *   /images/stylesheet/imagestyles.css to  /myroot/images/stylesheet/imagestyles.css    *   note /imagestyles did not get altered.    * will only work on strings (forget about doing /images/{someimage}    *    *    * @param    string attribute to rewrite    * @return   none    * @access   public    */    function reWriteURL($which)     {        global  $_HTML_TEMPLATE_FLEXY;                        if (!is_string($original = $this->element->getAttribute($which))) {            return;        }                if ($original == '') {            return;        }                if (empty($_HTML_TEMPLATE_FLEXY['currentOptions']['url_rewrite'])) {            return;        }                $bits = explode(",",$_HTML_TEMPLATE_FLEXY['currentOptions']['url_rewrite']);        $new = $original;                foreach ($bits as $bit) {            if (!strlen(trim($bit))) {                continue;            }            $parts = explode (':', $bit);            if (!isset($parts[1])) {                return HTML_Template_Flexy::raiseError('HTML_Template_Flexy: url_rewrite syntax incorrect'.                     print_r(array($bits,$bits),true),null,HTML_TEMPLATE_FLEXY_ERROR_DIE);            }            $new = preg_replace('#^'.$parts[0].'#',$parts[1], $new);        }                        if ($original == $new) {            return;        }        $this->element->ucAttributes[$which] = '"'. $new . '"';    } 
        /**    * Convert flexy tokens to HTML_Template_Flexy_Elements.    *    * @param    object token to convert into a element.    * @return   object HTML_Template_Flexy_Element    * @access   public    */    function toElement($element)     {        require_once 'HTML/Template/Flexy/Element.php';        $ret = new HTML_Template_Flexy_Element;                if (strtolower(get_class($element)) != 'html_template_flexy_token_tag') {            $this->compiler->addStringToGettext($element->value);            return $element->value;        }                        $ret->tag = strtolower($element->tag);                $ats = $element->getAttributes();                if (isset($element->attributes['flexy:xhtml'])) {            $ats['flexy:xhtml'] = true;        }                foreach(array_keys($ats)  as $a) {             $ret->attributes[$a] = $this->unHtmlEntities($ats[$a]);        }        //print_r($ats);        if (!$element->children) {            return $ret;        }                // children - normally to deal with <element>                //print_r($this->children);        foreach(array_keys($element->children) as $i) {            // not quite sure why this happens - but it does.            if (!is_object($element->children[$i])) {                continue;            }            $ret->children[] = $this->toElement($element->children[$i]);        }        return $ret;    }
              /**    * do the reverse of htmlspecialchars on an attribute..    *    * copied from get-html-translation-table man page     *     * @param   mixed       from attribute values    *    * @return   string          return     * @access   public    * @see      see also methods.....    */      function unHtmlEntities ($in)      {        if (!is_string($in)) {            return $in;        }        $trans_tbl = get_html_translation_table (HTML_ENTITIES);        $trans_tbl = array_flip ($trans_tbl);        $ret = strtr ($in, $trans_tbl);        return preg_replace('/&#(\d+);/me', "chr('\\1')",$ret);    }             /**    * Deal with XUL MenuItems    *    * @return   string | false = html output or ignore (just output the tag)    * @access   public    */      function parseTagMenuList()     {                // does it contain any flexy tags??        if ($this->elementUsesDynamic($this->element)) {            return false;        }                 return $this->compiler->appendPhp(            $this->getElementPhp( $this->element->getAttribute('ID')));    }     /**    * Recursively search for any flexy:if flexy:foreach or {xxxx} tags inside tags..    *    * @param    HTML_Template_Flexy_Token   element to check.    * @return   boolean true if it finds a  dynamic tag.    * @access   public    */          function elementUsesDynamic($e)     {        if (is_a($e,'HTML_Template_Flexy_Token_Var')) {            return true;        }        if (is_a($e,'HTML_Template_Flexy_Token_Foreach')) {            return true;        }        if (is_a($e,'HTML_Template_Flexy_Token_If')) {            return true;        }        if (is_a($e,'HTML_Template_Flexy_Token_Method')) {            return true;        }        if (!is_a($e,'HTML_Template_Flexy_Token_Tag')) {            return false;        }        if  ($e->getAttribute('FLEXY:IF')  !== false) {            return true;        }        if  ($e->getAttribute('FLEXY:FOREACH')  !== false) {            return true;        }           foreach($e->attributes as $k=>$v) {            if (is_array($v) || is_object($v)) {                return true;            }        }        foreach($e->children as $c) {            if ($this->elementUsesDynamic($c)) {                return true;            }        }        return false;                         }          } 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -