private function wp2_trim_excerpt($text) { // Fakes an excerpt if needed if ($text != "") { $text = MediaPass_ContentHelper::strip_all_shortcodes($text); $text = str_replace('\\]\\]\\>', ']]>', $text); $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); $text = strip_tags($text, '<p>'); $text = strip_tags($text); $excerpt_length = 15; // number of words to show $words = explode(' ', $text, $excerpt_length + 1); if (count($words) > $excerpt_length) { array_pop($words); array_push($words, '...'); $text = implode(' ', $words); } } return $text; }
function mp_content_placement_exemptions($content, $CheckEditPermission = true) { global $post; $excluded_posts = get_option(MediaPass_Plugin::OPT_EXCLUDED_POSTS); $included_posts = get_option(MediaPass_Plugin::OPT_INCLUDED_POSTS); $enable = false; if (current_user_can('edit_posts') && !CheckEditPermission) { // when the user is editing the content, we want to show the short codes $enable = false; // has premium meta } else { if (MediaPass_Plugin::has_premium_meta($post) && (count($excluded_posts) == 0 || !isset($excluded_posts[$post->ID]))) { $enable = true; } else { if (MediaPass_Plugin::has_premium_meta($post) && isset($excluded_posts[$post->ID])) { $enable = false; // following doesn't have premium meta } else { if (isset($included_posts[$post->ID])) { $enable = $included_posts[$post->ID]; // will take the form of true or false } else { if (MediaPass_ContentHelper::has_existing_protection($content)) { $enable = true; } } } } } // either enable or disable the short codes / overlay if ($enable) { $content = MediaPass_ContentHelper::enable_overlay($content, "", !$CheckEditPermission); } else { $content = MediaPass_ContentHelper::strip_all_shortcodes($content); } /* if (current_user_can('edit_posts') || (!MediaPass_Plugin::has_premium_meta($post) && (isset($excluded_posts[$post->ID]) || !$included_posts[$post->ID]))){ $content = MediaPass_ContentHelper::strip_all_shortcodes($content); } else if (MediaPass_ContentHelper::has_existing_protection($content)){ $content = MediaPass_ContentHelper::enable_overlay($content); } else { $content = MediaPass_ContentHelper::enable_overlay($content); } */ return $content; }