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


PHP NNFrameworkFunctions::isEditPage方法代码示例

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


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

示例1: protectForm

 static function protectForm(&$string, $tags = array(), $protected = array())
 {
     if (!NNFrameworkFunctions::isEditPage()) {
         return;
     }
     if (!is_array($tags)) {
         $tags = array($tags);
     }
     if (empty($protected)) {
         $protected = array();
         foreach ($tags as $i => $tag) {
             $protected[$i] = base64_encode($tag);
         }
     }
     $string = preg_replace(NNFrameworkFunctions::getFormRegex(1), '<!-- TMP_START_EDITOR -->\\1', $string);
     $string = explode('<!-- TMP_START_EDITOR -->', $string);
     foreach ($string as $i => $str) {
         if (!empty($str) != '' && fmod($i, 2)) {
             $pass = 0;
             foreach ($tags as $tag) {
                 if (!(strpos($str, $tag) === false)) {
                     $pass = 1;
                     break;
                 }
             }
             if ($pass) {
                 $str = explode('</form>', $str, 2);
                 // protect tags only inside form fields
                 if (preg_match_all('#(<textarea[^>]*>.*?<\\/textarea>|<input[^>]*>)#si', $str['0'], $matches, PREG_SET_ORDER) > 0) {
                     foreach ($matches as $match) {
                         $field = str_replace($tags, $protected, $match['0']);
                         $str['0'] = str_replace($match['0'], $field, $str['0']);
                     }
                 }
                 $string[$i] = implode('</form>', $str);
             }
         }
     }
     $string = implode('', $string);
 }
开发者ID:naka211,项目名称:designcreations1,代码行数:40,代码来源:functions.php

示例2: protect

	function protect( &$string )
	{
		if ( NNFrameworkFunctions::isEditPage() ) {
			// Protect complete adminForm (to prevent articles from being created when editing articles and such)
			$unprotected = '{'.$this->params->module_tag;
			$protected = $this->protectStr( $unprotected );
			$string = preg_replace( '#(<'.'form [^>]*(id|name)="(adminForm|postform)")#si', '<!-- TMP_START_EDITOR -->\1', $string );
			$string = explode( '<!-- TMP_START_EDITOR -->', $string );
			foreach ( $string as $i => $str ) {
				if ( !empty( $str ) != '' && fmod( $i, 2 ) ) {
					if ( !( strpos( $str, $unprotected ) === false ) ) {
						$str = explode( '</form>', $str, 2 );
						$str['0'] = str_replace( $unprotected, $protected, $str['0'] );
						$string[$i] = implode( '</form>', $str );
					}
				}
			}
			$string = implode( '', $string );
		}
	}
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:20,代码来源:helper.php

示例3: protectForm

 static function protectForm(&$string, $tags = array(), $protected = array())
 {
     if (!NNFrameworkFunctions::isEditPage()) {
         return;
     }
     if (!is_array($tags)) {
         $tags = array($tags);
     }
     if (empty($protected)) {
         $protected = array();
         foreach ($tags as $i => $tag) {
             $protected[$i] = base64_encode($tag);
         }
     }
     $string = preg_replace(NNFrameworkFunctions::getFormRegex(1), '<!-- TMP_START_EDITOR -->\\1', $string);
     $string = explode('<!-- TMP_START_EDITOR -->', $string);
     foreach ($string as $i => $str) {
         if (!empty($str) != '' && fmod($i, 2)) {
             $pass = 0;
             foreach ($tags as $tag) {
                 if (!(strpos($str, $tag) === false)) {
                     $pass = 1;
                     break;
                 }
             }
             if ($pass) {
                 $str = explode('</form>', $str, 2);
                 $str['0'] = str_replace($tags, $protected, $str['0']);
                 $string[$i] = implode('</form>', $str);
             }
         }
     }
     $string = implode('', $string);
 }
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:34,代码来源:functions.php


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