Currently creating your helper scripts, please wait...
';
}
/**
* Runs the passed content through the EASE parser and echoes the result
*
* @author Lucas Simmons
*
* @since 0.1.0
*
* @param string $content The content you want to run through the EASE parser
*/
function ease_filter( $content) {
session_start();
// Only run the plugin if there is an ease tag. No need to add this extra processing where it does not exist
if((strpos($content,"<#") !== false) || (strpos($content,"<#") !== false)){
$ease_core = ease_load_core();
// Sometimes and symbols are converted to their html equivalent
$content = str_replace("&",'&',$content);
// If they used the visual text editor, then their EASE tags will be converted into the html equivalent - replacing these values should work most of the time
$content = str_replace("<#","<#",$content);
$content = str_replace("#>","#>",$content);
if(version_compare(PHP_VERSION, '5.4.0')<0) {
echo "You need to be running a version of PHP greater than 5.4.0 for this plugin to work
";
echo $content;
}else{
require_once('ease_content_replace.php');
//if(!preg_match('/(.*?)(<#\s*([^\s\[\'"].*|$))/i', $body_line)) {
$content = replace_ease_urls($content);
$this_content = $ease_core->process_ease($content,true);
echo $this_content;
}
}else{
return $content;
}
if($_POST['ease_form_id']){
ob_flush();
}
}
/**
* Replaces EASE urls with the WordPress permalinks
*
* @author Lucas Simmons
*
* @since 0.1.1
*
* @param string $content The content you want to scan for ease links (/?page=page_name or ?page=page_name)
*/
function replace_ease_urls($content){
//$content = preg_replace('/bodypage\s*=\s*"(.*?)"\s*;/is', "$1" . get_permalink($link_id), $content);
$replace_urls = get_option( "ease_replace_urls");
// Replaces the urls with the wordpress permalink url
if($replace_urls){
foreach($replace_urls as $index => $link_id){
// Replaces any urls that end in (space/line break)#> for things like restrict access... probably should make this search through ease tags
$content = preg_replace('/(\/\?page=((' . $index . ')))(?=\s*#>)/', get_permalink($link_id), $content);
// Replace any urls that have a start of a quote and end of a quote or ? or & and are formatted like /?page=page_name with the permalink url
if(strpos(get_permalink($link_id),"?") === false){
$content = preg_replace('/(\'|")+(\/\?page=((' . $index . ')))(?=\?|&|"|\')/', "$1" . get_permalink($link_id), $content);
}
// Searches for any permalinks that have the syntax /& when they should be /?
if(get_permalink($link_id) !== false){
$content = preg_replace('/(' . preg_quote(get_permalink($link_id),'/') . '&)+/', get_permalink($link_id) . '?', $content);
}
}
//foreach($replace_urls as $index => $link_id){
// $content = preg_replace('/(\?page=((' . $index . ')))(?=\?|&|"|\')/', get_permalink($link_id), $content);
// $content = preg_replace('/(' . preg_quote(get_permalink($link_id),'/') . '(&))+/', get_permalink($link_id) . '?', $content);
//}
}
// Any extra /?page= should be replaced with the site url as the base
if(strpos(get_permalink($link_id),"?") === false){
$content = preg_replace('/((?:\'|")+\/\?page=)+/', site_url() . '?page=', $content);
}
return $content;
}
/**
* Removes the footer the the ease plugin settings page
*
* @author Lucas Simmons
*
* @since 0.1.0
*
* @param string $text The footer text
*
*/
function ease_remove_footer_admin ($text) {
if($_REQUEST['page'] != "ease_plugin_settings"){
echo $text;
}
}
/**
* The admin plugin settings page
*
* @author Lucas Simmons
*
* @since 0.1.0
*/
function ease_plugin_settings(){
$endpoint_page_id = get_option('ease_service_endpoint_page');
if($endpoint_page_id === false || !$endpoint_page_id){
ease_load_core();
$endpoint_page_id = get_option('ease_service_endpoint_page');
}
?>