选择显示字体大小

3


   {
                    if (is_array($value) && ! $delete)
                    {
                        foreach ($value as $suboption => $subvalue)
                        {
                            $this->{$option}["$suboption"] = $subvalue;
                        }
                    }
                    else
                    {
                          $this->$option = $value;
                    }
                }
            }
        }
    }

    // these are the functions, which are intended to be overriden in user classes

    /**
    *
    * @param    mixed
    * @return   object  domnode
    * @access   private
    */
    function insertnewresult(&$metadata)
    {
        if ($this->xmlroot)
            return $this->xmlroot->new_child($this->tagnameresult, null);
        else
        {
            $this->xmlroot = $this->xmldoc->add_root($this->tagnameresult);
            //php 4.0.6 had $root->name as tagname, check for that here...
            if (!isset($this->xmlroot->{$this->tagname}))
            {
                $this->tagname = "name";
            }
            return $this->xmlroot;

        }
    }


    /**
    *   to be written
    *
    * @param    object domnode $parent_row
    * @param    mixed $res
    * @param    mixed $key
    * @param    mixed &metadata
    * @return   object domnode
    * @access private
    */
    function insertnewrow($parent_row, $res, $key, &$metadata)
    {
        return  $parent_row->new_child($this->tagnamerow, null);
    }


    /**
    *   to be written
    *
    * @param    object domnode $parent
    * @param    mixed $res
    * @param    mixed $key
    * @param    mixed &$metadata
    * @param    mixed &$subrow
    * @return   object domnode
    * @access private
    */
    function insertnewelement($parent, $res, $key, &$metadata, &$subrow)
    {
        return  $parent->new_child($metadata[$key]["name"], $this->xml_encode(trim$res[$key]));
    }


    /**
    *   to be written
    *
    * @param    mixed $key
    * @param    mixed $value
    * @param    mixed &$metadata
    * @access private
    */
    function addtableinfo($key, $value, &$metadata) {

    }

    // end functions, which are intended to be overriden in user classes

    // here come some helper functions...

    /**
    * make utf8 out of the input data and escape & with & and &quot;< &quot; with &quot;< &quot;
    * (we assume that when there&#39;s no space after < it&#39;s a tag, which we need in the xml)
    *  i&#39;m not sure, if this is the standard way, but it works for me.
    *
    * @param    string text to be utfed.
    * @access private
    */
    function xml_encode (&#36;text)
    {
        if (function_exists(&quot;iconv&quot;) && isset(&#36;this->encoding_from) && isset(&#36;this->encoding_to))
        {
             ini_set(&quot;track_errors&quot;,1);
             &#36;text = iconv(&#36;this->encoding_from,&#36;this->encoding_to,ereg_replace(&quot;&&quot;,&quot;&&quot;,ereg_replace(&quot;< &quot;,&quot;< &quot;,&#36;text)));

             if (! isset(&#36;text) )
             {
                if (isset(&#36;php_errormsg))
                {
                    &#36;errormsg = &quot;error: &#36;php_errormsg&quot;;
                }
                else
                {
                    &#36;errormsg = &quot;undefined iconv error, turn on track_errors in php.ini to get more details&quot;;
                }
                return pear::raiseerror(&#36;errormsg,null,pear_error_die);
             }
             else {
                return &#36;text;
             }
        }
        else
        {
            //&#36;text = utf8_encode(ereg_replace(&quot;&&quot;,&quot;&&quot;,ereg_replace(&quot;< &quot;,&quot;< &quot;,&#36;text)));
            &#36;text = trim(ereg_replace(&quot;&&quot;,&quot;&&quot;,ereg_replace(&quot;< &quot;,&quot;< &quot;,&#36;text)));
//            echo &#36;text;
        }
        return &#36;text;
    }

    //taken from kc@hireability.com at http://www.php.net/manual/en/function.array-merge-recursive.php
    /**
    * there seemed to be no built in function that would merge two arrays recursively and clobber
    *   any existing key/value pairs. array_merge() is not recursive, and array_merge_recursive
    *   seemed to give unsatisfactory results... it would append duplicate key/values.
    *
    *   so here&#39;s a cross between array_merge and array_merge_recursive
    **/
    /**
    *
    * @param    array first array to be merged
    * @param    array second array to be merged
    * @return   array merged array
    * @access private
    */
    function array_merge_clobber(&#36;a1,&#36;a2)
    {
        if(!is_array(&#36;a1) !is_array(&#36;a2)) return false;
        &#36;newarray = &#36;a1;
        while (list(&#36;key, &#36;val) = each(&#36;a2))
        {
            if (is_array(&#36;val) && is_array(&#36;newarray[&#36;key]))
            {
                &#36;newarray[&#36;key] = &#36;this->array_merge_clobber(&#36;newarray[&#36;key], &#36;val);
            }
            else
            {
                &#36;newarray[&#36;key] = &#36;val;
            }
        }
        return &#36;newarray;
    }

    /**
    * adds a xml string to &#36;this->xmldoc.
    * it&#39;s inserted on the same level as a &quot;normal&quot; resultset, means just as a children of <root>
    * if a xpath expression is supplied, it takes that for selecting only part of the xml-file
    *
    * the clean code works only with php 4.0.7
    * for php4.0.6 :
    * i found no cleaner method than the below one. it&#39;s maybe nasty (xmlobject->string->xmlobject),
    *  but it works. if someone knows how to add whole domnodes to another one, let me know...
    *
    * @param    string xml string
    * @param    mixed xpath  either a string with the xpath expression or an array with &quot;xpath&quot;=>xpath expression  and &quot;root&quot;=tag/subtag/etc, which are the tags to be inserted before the result
    * @access private
    */

    function doxmlstring2xml (&#36;string,&#36;xpath = null)
    {

        //check if we have a recent domxml. otherwise use the workaround...
        &#36;version = explode(&quot;.&quot;,phpversion());

        if (! (&#36;version[0] <= 4 and &#36;version[1] <= 0 and &#36;version[2] < 7) ){

            if (is_array(&#36;xpath))
            {
                if (isset(&#36;xpath[&quot;root&quot;]))
                {
                    &#36;root = &#36;xpath[&quot;root&quot;];
                }
                &#36;xpath = &#36;xpath[&quot;xpath&quot;];
            }

            &#36;tmpxml = xmldoc(&#36;string);
            &#36;subroot = &#36;this->xmlroot;

            if (isset(&#36;root))
            {
                &#36;roots = explode(&quot;/&quot;,&#36;root);
                foreach (&#36;roots as &#36;rootelement)
                {
                    if ( strlen(&#36;rootelement) > 0 )
                    {
                        &#36;subroot = &#36;subroot->new_child(&#36;rootelement,&quot;&quot;);
                    }
                }
            }


            //&#36;this->xmlroot->addchild does some strange things when added nodes from xpath.... so this comment helps out
            &#36;newchild = &#36;subroot->add_child(&#36;this->xmldoc->create_comment(&quot;the purpose of this comment is a workaround in sql2php.php line &quot;.__line__));


            // if no xpath is given, just take the whole file
            if ( (is_null(&#36;xpath)))
            {
                &#36;newchild->append_child(&#36;tmpxml->root());
            }
            else
            {
                &#36;xctx = &#36;tmpxml->xpath_new_context();
                &#36;xnode = xpath_eval(&#36;xctx,&#36;xpath);
                foreach (&#36;xnode->nodeset as &#36;node)
                {
                    &#36;newchild->append_child(&#36;node);
                }
            }

         }
        else {
            &#36;mainxmlstring = &#36;this->xmldoc->dumpmem();
            &#36;string = preg_replace(&quot;/<\?xml.*\?>/&quot;,&quot;&quot;,&#36;string);

            &#36;mainxmlstring = preg_replace(&quot;/<&quot;.&#36;this->xmlroot->{&#36;this->tagname}.&quot;\/>/&quot;,&quot;<&quot;.&#36;this->xmlroot->{&#36;this->tagname}.&quot;></&quot;.&#36;this->xmlroot->{&#36;this->tagname}.&quot;>&quot;,&#36;mainxmlstring);
            &#36;mainxmlstring = preg_replace(&quot;/<\/&quot;.&#36;this->xmlroot->{&#36;this->tagname}.&quot;>/&quot;,&#36;string.&quot;</&quot;.&#36;this->xmlroot->{&#36;this->tagname}.&quot;>&quot;,&#36;mainxmlstring);

            &#36;this->xmldoc = xmldoc(&#36;mainxmlstring);
            &#36;this->xmlroot = &#36;this->xmldoc->root();

        }
    }

    /**
    * sets the encoding for the db2xml transformation
    * @param    string &#36;encoding_from encoding to transform from
    * @param    string &#36;encoding_to encoding to transform to
    * @access public
    */
    function setencoding (&#36;encoding_from = &quot;iso-8859-1&quot;, &#36;encoding_to =&quot;utf-8&quot;)
    {
        &#36;this->encoding_from = &#36;encoding_from;
        &#36;this->encoding_to = &#36;encoding_to;
    }
    /**
    * @param array &#36;parenttables parent to child relation
    * @access public
    */

    function setparenttables(&#36;parenttables)
    {
        foreach (&#36;parenttables as &#36;table => &#36;parent)
        {
            &#36;table_info[&quot;parent_table&quot;][&#36;table]=&#36;parent;
        }
        &#36;this->setoptions(array(&quot;user_tableinfo&quot;=>&#36;table_info));
    }


    /**
    * returns the content of the first match of the xpath expression
    *
    * @param    string &#36;expr xpath expression
    * @return   mixed content of the evaluated xpath expression
    * @access   public
    */

    function getxpathvalue (&#36;expr)
    {

        &#36;xpth = &#36;this->xmldoc->xpath_new_context();
        &#36;xnode = xpath_eval(&#36;xpth,&#36;expr);

        if (isset (&#36;xnode->nodeset[0]))
        {
            &#36;firstnode = &#36;xnode->nodeset[0];

            &#36;children = &#36;firstnode->children();
            &#36;value = &#36;children[0]->content;
                return &#36;value;
        }

        else
        {
            return null;
        }
    }

    /**
    * get the values as an array from the childtags from the first match of the xpath expression
    *
    * @param    string xpath expression
    * @return   array with key->value of subtags
    * @access   public
    */

    function getxpathchildvalues (&#36;expr)
    {
        &#36;xpth = &#36;this->xmldoc->xpath_new_context();
        &#36;xnode = xpath_eval(&#36;xpth,&#36;expr);

        if (isset (&#36;xnode->nodeset[0]))
        {
            foreach (&#36;xnode->nodeset[0]->children() as &#36;child)
            {
                &#36;children = &#36;child->children();
                &#36;value[&#36;child->{&#36;this->tagname}] = &#36;children[0]->content;
            }
            return &#36;value;
        }
        else
        {
            return null;
        }
    }

}
?>


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons