osdate_smarty.class.php

来自「太烦了」· PHP 代码 · 共 63 行

PHP
63
字号
<?php

/* Smarty class is extended for use with osdate.
Vijay Nair      25 May 2006    */

class osDate_Smarty extends Smarty{

	/**
	 * assigns values to template variables
	 *
	 * @param array|string $tpl_var the template variable name(s)
	 * @param mixed $value the value to assign
	 */
	/**
	 * assigns values to template variables
	 *
	 * @param array|string $tpl_var the template variable name(s)
	 * @param mixed $value the value to assign
	 */
	function assign($tpl_var, $value = null)
	{
		if (is_array($tpl_var)){
			foreach ($tpl_var as $key => $val) {
				if ($key != '') {

					if ( !is_array( $value ) ) {
						$this->_tpl_vars[$key] = stripslashes( $val );
					}
					else {
						foreach( $val as $index => $v ) {
							if ( !is_array( $v ) )
								$val[ $index ] = stripslashes( $v );
							else
								$val[ $index ] = $v;
						}

						$this->_tpl_vars[$key] = $val;
					}
				}
			}
		} else {
			if ($tpl_var != '') {

				if ( !is_array( $value ) ) {
					$this->_tpl_vars[$tpl_var] = stripslashes( $value );
				}
				else {
					foreach( $value as $index => $v ) {
						if ( !is_array( $v ) )
							$value[ $index ] = stripslashes( $v );
						else
							$value[ $index ] = $v;
					}

					$this->_tpl_vars[$tpl_var] = $value;
				}
			}
		}
	}



}

⌨️ 快捷键说明

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