Server : Apache
System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 5.6.40
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/saimikebio.com/mobile/include/kernel/vendor/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/saimikebio.com/mobile/include/kernel/vendor/Template_ext.php
<?php



// +----------------------------------------------------------------------

// | EcTouch [ 专注移动电商: 商创网络科技 ]

// +----------------------------------------------------------------------

// | Copyright (c) 2014 http://ectouch.cn All rights reserved.

// +----------------------------------------------------------------------

// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )

// +----------------------------------------------------------------------

// | Author: EcTouch Team <zhong@ecmoban.com> (QQ: 2880175560)

// +----------------------------------------------------------------------



if (!function_exists('tpl_parse_ext')) {



    function tpl_parse_ext($template) {

        return template_ext($template);

    }



}



//模板扩展函数

function template_ext($template) {

    //php标签

    /*

      {php echo phpinfo();}	=>	<?php echo phpinfo(); ?>

     */

    $template = preg_replace("/\{php\s+(.+)\}/", "<?php \\1?>", $template);



    //if 标签

    /*

      {if $name==1}		=>	<?php if ($name==1){ ?>

      {elseif $name==2}	=>	<?php } elseif ($name==2){ ?>

      {else}				=>	<?php } else { ?>

      {/if}				=>	<?php } ?>

     */

    $template = preg_replace("/\{if\s+(.+?)\}/", "<?php if(\\1) { ?>", $template);

    $template = preg_replace("/\{else\}/", "<?php } else { ?>", $template);

    $template = preg_replace("/\{elseif\s+(.+?)\}/", "<?php } elseif (\\1) { ?>", $template);

    $template = preg_replace("/\{\/if\}/", "<?php } ?>", $template);





    //for 标签

    /*

      {for $i=0;$i<10;$i++}	=>	<?php for($i=0;$i<10;$i++) { ?>

      {/for}					=>	<?php } ?>

     */

    $template = preg_replace("/\{for\s+(.+?)\}/", "<?php for(\\1) { ?>", $template);

    $template = preg_replace("/\{\/for\}/", "<?php } ?>", $template);



    //loop 标签

    /*

      {loop $arr $vo}			=>	<?php $n=1; if (is_array($arr) foreach($arr as $vo){ ?>

      {loop $arr $key $vo}	=>	<?php $n=1; if (is_array($array) foreach($arr as $key => $vo){ ?>

      {/loop}					=>	<?php $n++;}unset($n) ?>

     */

    $template = preg_replace("/\{loop\s+(\S+)\s+(\S+)\}/", "<?php \$n=1;if(is_array(\\1)) foreach(\\1 AS \\2) { ?>", $template);

    $template = preg_replace("/\{loop\s+(\S+)\s+(\S+)\s+(\S+)\}/", "<?php \$n=1; if(is_array(\\1)) foreach(\\1 AS \\2 => \\3) { ?>", $template);

    $template = preg_replace("/\{\/loop\}/", "<?php \$n++;}unset(\$n); ?>", $template);



    //函数 标签

    /*

      {date('Y-m-d H:i:s')}	=>	<?php echo date('Y-m-d H:i:s');?>

      {$date('Y-m-d H:i:s')}	=>	<?php echo $date('Y-m-d H:i:s');?>

     */

    $template = preg_replace("/\{([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff:]*\(([^{}]*)\))\}/", "<?php echo \\1;?>", $template);

    $template = preg_replace("/\{(\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff:]*\(([^{}]*)\))\}/", "<?php echo \\1;?>", $template);



    //变量/常量 标签

    /*

      {$name}	=>	<?php echo $name; ?>

      {CONSTANCE}	=> <?php echo CONSTANCE;?>

     */

    /* $template = preg_replace ( "/\{(\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\}/", "<?php echo \\1;?>", $template ); */

    /* $template = preg_replace("/\{(\\$[a-zA-Z0-9_\[\]\'\"\$\x7f-\xff]+)\}/es", "\$this->addquote('<?php echo \\1;?>')",$template); */

    $template = preg_replace("/\{([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)\}/s", "<?php echo \\1;?>", $template);

    return $template;

}



?>