本文整理汇总了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);
}
示例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 );
}
}
示例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);
}