A Title must be defined for this page!'); SDV($EMTitlePattern,'/\\(:title\\s(.*?):\\)/i'); //same as in scripts/stdmarkup.php ## KEYWORDS SDV($EMKeywordsInputDisplay,"size='50%'");//attributes for Keywords must be defined for this page!'); SDV($EMKeywordsPattern,'/\\(:keywords\\s(.*?):\\)/i'); //same as in scripts/stdmarkup.php ## DESCRIPTION SDV($EMDescriptionInputDisplay,"size='50%'");//attributes for A Description must be defined for this page!'); SDV($EMDescriptionPattern,'/\\(:description\\s(.*?):\\)/i'); //same as in scripts/stdmarkup.php ## TAGS SDV($EMTagsInputDisplay,"size='50%'");//attributes for Tags must be defined for this page!'); SDV($EMTagsPattern,'/\\(:tags:(.*?):\\)/i'); //special pagetext definition ## NOTES SDV($EMNotesInputDisplay,"width='100%' rows='5'");//attributes for Notes must be defined for this page!'); SDV($EMNotesPattern,'/ \\(:notes:\\)(.*?)\\(:notesend:\\)/seix'); //special definition ## SUMMARY SDV($EMForceSummaryFmt,'

A Summary must be defined for this page!

'); ############################ CODE ############################ ## define pointers to functions (Note: order IS important) array_push($EditFunctions,'EditMoreRemove'); array_unshift($EditFunctions,'EditMoreRequire'); array_unshift($EditFunctions,'EditMoreAdd'); foreach($EMFields as $EMFieldsFall) array_unshift($EditFields,$EMFieldsFall); ### EditMoreRemove ### ## To collect information from the page function EditMoreRemove($pagename, &$page, &$new) { global $InputTags, $EMFields; # TITLE if(in_array('title',$EMFields)) { global $EMTitlePattern, $EMTitleFillEmpty, $EMTitleFillExclude, $name, $EMTitleInputDisplay; if (preg_match($EMTitlePattern, $new['text'], $matches)) { //fill with old title if it already exists $new['title'] = htmlspecialchars($matches[1], ENT_QUOTES); }else{ //fill empty if user wants it, else blank $EMTitleFill = ''; $EMNameCall = array_pop(explode('.',$pagename)); if($EMTitleFillEmpty > 0 && !in_array($EMNameCall,$EMTitleFillExclude)) { $EMTitleFill = $EMNameCall; $EMTitleFill = preg_replace("/([[:lower:]\\d])([[:upper:]])/", '$1 $2',$EMTitleFill); $EMTitleFill = preg_replace('/([^-\\d])(\\d[-\\d]*( |$))/','$1 $2',$EMTitleFill); $EMTitleFill = preg_replace("/([[:upper:]])([[:upper:]][[:lower:]\\d])/",'$1 $2',$EMTitleFill); } $new['title'] = htmlspecialchars($EMTitleFill, ENT_QUOTES); } $new['text'] = trim(preg_replace($EMTitlePattern,'', $new['text'] )); SDVA($InputTags["e_title"], array(':html' => "")); }else{ SDVA($InputTags["e_title"], array(':html' => '')); } # KEYWORDS if(in_array('keywords',$EMFields)) { global $EMKeywordsPattern, $EMKeywordsInputDisplay; if (preg_match($EMKeywordsPattern, $new['text'], $matches)) { //fill with old keywords if they already exist $new['keywords'] = htmlspecialchars($matches[1], ENT_QUOTES); }else{ //fill blank $new['keywords'] = ''; } $new['text'] = trim(preg_replace($EMKeywordsPattern,'', $new['text'] )); SDVA($InputTags["e_keywords"],array(':html' => "")); }else{ SDVA($InputTags["e_keywords"],array(':html' => '')); } # DESCRIPTION if(in_array('description',$EMFields)) { global $EMDescriptionPattern, $EMDescriptionInputDisplay; if (preg_match($EMDescriptionPattern, $new['text'], $matches)) { //fill with old description if they already exist $new['description'] = htmlspecialchars($matches[1], ENT_QUOTES); }else{ //fill blank $new['description'] = ''; } $new['text'] = trim(preg_replace($EMDescriptionPattern,'', $new['text'] )); SDVA($InputTags["e_description"],array(':html' => "")); }else{ SDVA($InputTags["e_description"], array(':html' => '')); } # TAGS if(in_array('tags',$EMFields)) { global $EMTagsPattern, $EMTagsInputDisplay; if (preg_match($EMTagsPattern, $new['text'], $matches)) { //fill with old description if they already exist $new['tags'] = htmlspecialchars($matches[1], ENT_QUOTES); }else{ //fill blank $new['tags'] = ''; } $new['text'] = trim(preg_replace($EMTagsPattern,'', $new['text'] )); SDVA($InputTags["e_tags"],array(':html' => "")); }else{ SDVA($InputTags["e_tags"], array(':html' => '')); } # NOTES if(in_array('notes',$EMFields)) { global $EMNotesPattern, $EMNotesInputDisplay; if (preg_match($EMNotesPattern, $new['text'], $matches)) { //fill with old description if they already exist $new['notes'] = trim(htmlspecialchars($matches[1], ENT_QUOTES)); }else{ //fill blank $new['notes'] = ''; } $new['text'] = trim(preg_replace($EMNotesPattern,'', $new['text'] )); SDVA($InputTags["e_notes"],array(':html' => "")); }else{ SDVA($InputTags["e_notes"], array(':html' => '')); } return; } /// EditMoreRemove /// ### EditMoreRequire ### ## To make sure fields are filled function EditMoreRequire($pagename, &$page, &$new) { global $EMFields, $EMForcefully, $DeleteKeyPattern, $MessageFmt, $EnablePost, $ChangeSummary, $EMTitlePattern, $EMKeywordsPattern, $EMDescriptionPattern, $EMTagsPattern, $EMNotesPattern; if(trim($new['text']) != $DeleteKeyPattern) { # TITLE if(in_array('title',$EMForcefully) && (!preg_match($EMTitlePattern, $new['text'])) ) { global $EMForceTitleFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceTitleFmt; } # KEYWORDS if(in_array('keywords',$EMForcefully) && (!preg_match($EMKeywordsPattern, $new['text'])) ) { global $EMForceKeywordsFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceKeywordsFmt; } # DESCRIPTION if(in_array('description',$EMForcefully) && (!preg_match($EMDescriptionPattern, $new['text'])) ) { global $EMForceDescriptionFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceDescriptionFmt; } # TAGS if(in_array('tags',$EMForcefully) && (!preg_match($EMTagsPattern, $new['text'])) ) { global $EMForceTagsFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceTagsFmt; } # NOTES if(in_array('notes',$EMForcefully) && (!preg_match($EMNotesPattern, $new['text'])) ) { global $EMForceNotesFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceNotesFmt; } # SUMMARY if(in_array('summary',$EMForcefully) && ($EnablePost && !$ChangeSummary)) { global $EMForceSummaryFmt; $EnablePost = 0; $MessagesFmt[] = $EMForceSummaryFmt; } } return; } /// EditMoreRequire /// ### EditMoreAdd ### ## To add the info back into the page function EditMoreAdd($pagename, &$page, &$new) { global $EMNotesPosition; # TITLE if($new['title'] > '') $new['text'] = "(:title ".$new['title'].":)\n".$new['text']; # KEYWORDS if($new['keywords'] > '') $new['text'] = "(:keywords ".$new['keywords'].":)\n".$new['text']; # DESCRIPTION if($new['description'] > '') $new['text'] = "(:description ".$new['description'].":)\n".$new['text']; # NOTES if($new['notes'] > '' && $EMNotesPosition == 'top') $new['text'] = "(:notes:)\n".$new['notes']."\n(:notesend:)\n".$new['text']; elseif($new['notes'] > '') $new['text'] = $new['text']."\n(:notes:)\n".$new['notes']."\n(:notesend:)"; # TAGS if($new['tags'] > '') { global $CategoryGroup; $EMTCategoryGroupLower = strtolower($CategoryGroup); $EMTCleanArray = array('[',']','!', 'Category:','category:',"$CategoryGroup:","$EMTCategoryGroupLower:", 'Category/','category/',"$CategoryGroup/","$EMTCategoryGroupLower/", 'Category.','category.',"$CategoryGroup.","$EMTCategoryGroupLower."); #Make into categories... $EMTMatches = $new['tags']; $EMTMatchesArray = explode(',',str_replace($EMTCleanArray,'',$EMTMatches)); Foreach($EMTMatchesArray as $EMTM) { $EMTM = trim($EMTM); if($EMTM == '') $EMTFixed .= ''; elseif(strstr($EMTM,'/') === FALSE && strstr($EMTM,'.') === FALSE) $EMTFixed .= '[[!'.$EMTM.']], '; else $EMTFixed .= '[['.$EMTM.']], '; } $new['tags'] = substr($EMTFixed,0,-2); #make the markup $new['text'] = "(:tags:".$new['tags'].":)\n".$new['text']; } return; } /// EditMoreAdd /// }elseif($EMFields != '' && $action != 'edit') { # NOTES //Displaying Notes Box if($EMNotesDisplay > '') { Markup('EditMoreNotes','