Exemplo n.º 1
0
function newautop($text)
{
    $newtext = "";
    $pos = 0;
    $tags = array('<!-- noformat on -->', '<!-- noformat off -->');
    $status = 0;
    while (!(($newpos = strpos($text, $tags[$status], $pos)) === FALSE)) {
        $sub = substr($text, $pos, $newpos - $pos);
        if ($status) {
            $newtext .= $sub;
        } else {
            $newtext .= convert_chars(wptexturize(wpautop($sub)));
        }
        //Apply both functions (faster)
        $pos = $newpos + strlen($tags[$status]);
        $status = $status ? 0 : 1;
    }
    $sub = substr($text, $pos, strlen($text) - $pos);
    if ($status) {
        $newtext .= $sub;
    } else {
        $newtext .= convert_chars(wptexturize(wpautop($sub)));
    }
    //Apply both functions (faster)
    //To remove the tags
    $newtext = str_replace($tags[0], "", $newtext);
    $newtext = str_replace($tags[1], "", $newtext);
    return $newtext;
}
 /**
  * Update the credits text.
  *
  * @since 1.0.0
  *
  * @param string $text Credits text.
  * @return string
  */
 public function credits_text($text)
 {
     $settings = wp_parse_args((array) get_option('footer_credits'), array('placement' => '', 'text' => ''));
     switch ($settings['placement']) {
         case 'after':
             $text .= ' ' . $settings['text'];
             break;
         case 'before':
             $text = $settings['text'] . ' ' . $text;
             break;
         case 'remove':
             $text = '';
             break;
         case 'replace':
             $text = $settings['text'];
             break;
     }
     $search = array('{{year}}');
     $replace = array(date('Y'));
     $text = str_replace($search, $replace, $text);
     $text = wptexturize(trim($text));
     $text = convert_chars($text);
     $text = $this->allowed_tags($text);
     return $text;
 }
 public function get()
 {
     $license = $this->get_license();
     $downloads = $this->get_downloads();
     $config = ["alwaysShowHours" => true, "alwaysShowControls" => true, "chaptersVisible" => true, "permalink" => get_permalink($this->post->ID), "publicationDate" => mysql2date("c", $this->post->post_date), "title" => get_the_title($this->post->ID), "subtitle" => wptexturize(convert_chars(trim($this->episode->subtitle))), "summary" => nl2br(wptexturize(convert_chars(trim($this->episode->summary)))), "poster" => $this->episode->cover_art_with_fallback()->setWidth(500)->url(), "show" => ['title' => $this->podcast->title, 'subtitle' => $this->podcast->subtitle, 'summary' => $this->podcast->summary, 'poster' => $this->podcast->cover_art()->setWidth(500)->url(), 'url' => \Podlove\get_landing_page_url()], "license" => ["name" => $license['name'], "url" => $license['url']], "downloads" => $downloads, "duration" => $this->episode->get_duration(), "features" => ["current", "progress", "duration", "tracks", "fullscreen", "volume"], "chapters" => json_decode($this->episode->get_chapters('json')), "languageCode" => $this->podcast->language];
     return $config;
 }
Exemplo n.º 4
0
 function wpsight_format_content($content)
 {
     if (!$content) {
         return;
     }
     $content = do_shortcode(shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($content))))));
     return apply_filters('wpsight_format_content', $content);
 }
Exemplo n.º 5
0
function em_rss()
{
    global $post, $wp_query;
    if (!empty($_REQUEST['dbem_rss']) || is_object($post) && $post->ID == get_option('dbem_events_page') && $wp_query->get('rss')) {
        header("Content-type: text/xml");
        ob_start();
        echo "<?xml version='1.0'?>\n";
        ?>
<rss version="2.0">
	<channel>
		<title><?php 
        echo get_option('dbem_rss_main_title');
        ?>
</title>
		<link><?php 
        echo get_permalink(get_option('dbem_events_page'));
        ?>
</link>
		<description><?php 
        echo get_option('dbem_rss_main_description');
        ?>
</description>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>Weblog Editor 2.0</generator>
				
		<?php 
        $description_format = str_replace(">", "&gt;", str_replace("<", "&lt;", get_option('dbem_rss_description_format')));
        $events = EM_Events::get(array('limit' => 5, 'owner' => false));
        foreach ($events as $event) {
            $description = $event->output(get_option('dbem_rss_description_format'), "rss");
            $description = ent2ncr(convert_chars(strip_tags($description)));
            //Some RSS filtering
            ?>
			<item>
				<title><?php 
            echo $event->output(get_option('dbem_rss_title_format'), "rss");
            ?>
</title>
				<link><?php 
            echo $event->output('#_EVENTURL');
            ?>
</link>
				<description><?php 
            echo $description;
            ?>
</description>
			</item>
			<?php 
        }
        ?>
		
	</channel>
</rss>
		<?php 
        echo apply_filters('em_rss', ob_get_clean());
        die;
    }
}
function bloginfo($show='') {
	$info = get_bloginfo($show);
	if ( ! (strstr($info, 'url') || strstr($info, 'directory')) ) {
		$info = apply_filters('bloginfo', $info, $show);
		$info = convert_chars($info);
	}

	echo $info;
}
Exemplo n.º 7
0
/** 
 * Custom text sanitization and filtering
 * @version 2.0
 */
function apoc_custom_kses($content)
{
    $content = wp_filter_post_kses($content);
    $content = wptexturize($content);
    $content = wpautop($content);
    $content = convert_chars($content);
    $content = force_balance_tags($content);
    return $content;
}
Exemplo n.º 8
0
/**
 * Return feed description.
 * 
 * @return string 
 */
function get_feed_description()
{
    $info = strip_tags(Settings\get_site_option('description'));
    $description = apply_filters('get_bloginfo_rss', convert_chars($info));
    if (!$description) {
        $description = get_bloginfo_rss('description');
    }
    return apply_filters('inpsmf_feed_description', $description);
}
Exemplo n.º 9
0
function seed_ucp_description()
{
    $o = seed_ucp_get_settings();
    extract($o);
    $output = '';
    if (!empty($description)) {
        $output .= '<div id="seed-ucp-description">' . shortcode_unautop(wpautop(convert_chars(wptexturize($description)))) . '</div>';
    }
    return $output;
}
Exemplo n.º 10
0
function toni_css()
{
    $toni_color = get_toni_color();
    $url = get_bloginfo('stylesheet_url');
    if (!empty($toni_color)) {
        $url = str_replace('style.css', "style_{$toni_color}.css", $url);
    }
    $url = apply_filters('bloginfo', $url, 'stylesheet_url');
    $url = convert_chars($url);
    echo $url;
}
function bloginfo($show='') {
	$info = get_bloginfo($show);
	if (!strstr($show, 'url') && //don't filter URLs
		!strstr($show, 'directory') &&
		!strstr($show, 'home')) {
		$info = apply_filters('bloginfo', $info, $show);
		$info = convert_chars($info);
	}

	echo $info;
}
function bloginfo($show = '')
{
    $info = get_bloginfo($show);
    // Don't filter URL's.
    if (strpos($show, 'url') === false && strpos($show, 'directory') === false && strpos($show, 'home') === false) {
        $info = apply_filters('bloginfo', $info, $show);
        $info = convert_chars($info);
    } else {
        $info = apply_filters('bloginfo_url', $info, $show);
    }
    echo $info;
}
Exemplo n.º 13
0
 function the_excerpt_rss($content)
 {
     global $post, $EM_Event;
     if ($post->post_type == EM_POST_TYPE_EVENT) {
         if (get_option('dbem_cp_events_formats')) {
             $EM_Event = em_get_event($post);
             $content = $EM_Event->output(get_option('dbem_rss_description_format'), "rss");
             $content = ent2ncr(convert_chars($content));
             //Some RSS filtering
         }
     }
     return $content;
 }
Exemplo n.º 14
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = $instance['title'];
        $num_comments = $instance['number_comments'];
        $args = array('number' => $num_comments, 'status' => 'approve');
        $comments = get_comments($args);
        if (count($comments) == 0) {
            ?>
		<!-- Note, MBU: Recent Comments Widget not shown. No comments to display -->
		<?php 
        } else {
            /* Before widget (defined by themes). */
            echo $before_widget;
            ?>
			<div id="recent-comments" >
				<h2><?php 
            echo $title;
            ?>
</h2>
				<ul>
				<?php 
            foreach ($comments as $comment) {
                $commented_post = get_post($comment->comment_post_ID);
                $commented_post_link = convert_chars(get_post_permalink($comment->comment_post_ID)) . '#comment-' . $comment->comment_ID;
                ?>
					
					<li>
					<a href="<?php 
                echo $commented_post_link;
                ?>
"  title="<?php 
                printf(_x('By %1$s on %2$s.', ' By [comment author] on [post title]', TEMPLATE_DOMAIN), $comment->comment_author, $commented_post->post_title);
                ?>
" ><?php 
                echo $comment->comment_content;
                ?>
</a>
					</li>
				<?php 
            }
            ?>
				</ul>
			</div>
			<?php 
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
function sdm_get_item_description_output($id)
{
    $item_description = get_post_meta($id, 'sdm_description', true);
    $isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
    //$isset_item_description = apply_filters('the_content', $isset_item_description);
    $isset_item_description = do_shortcode($isset_item_description);
    $isset_item_description = wptexturize($isset_item_description);
    $isset_item_description = convert_smilies($isset_item_description);
    $isset_item_description = convert_chars($isset_item_description);
    $isset_item_description = wpautop($isset_item_description);
    $isset_item_description = shortcode_unautop($isset_item_description);
    $isset_item_description = prepend_attachment($isset_item_description);
    return $isset_item_description;
}
Exemplo n.º 16
0
function inline_autop($content)
{
    global $_inline_autop;
    $str = str_replace(array('[inline]', '[/inline]'), '', $content);
    if ($str != $content) {
        $_inline_autop = false;
    }
    if ($_inline_autop) {
        $content = wpautop($content);
        $content = wptexturize($content);
        $content = convert_chars($content);
    }
    return $content;
}
function the_title($before = '', $after = '', $echo = true)
{
    $title = get_the_title();
    $title = convert_smilies($title);
    if (!empty($title)) {
        $title = convert_chars($before . $title . $after);
        $title = apply_filters('the_title', $title);
        if ($echo) {
            echo $title;
        } else {
            return $title;
        }
    }
}
Exemplo n.º 18
0
/**
 * RSS container for the bloginfo function.
 *
 * You can retrieve anything that you can using the get_bloginfo() function.
 * Everything will be stripped of tags and characters converted, when the values
 * are retrieved for use in the feeds.
 *
 * @since 1.5.1
 * @see get_bloginfo() For the list of possible values to display.
 *
 * @param string $show See get_bloginfo() for possible values.
 * @return string
 */
function get_bloginfo_rss($show = '') {
	$info = strip_tags(get_bloginfo($show));
	/**
	 * Filter the bloginfo for use in RSS feeds.
	 *
	 * @since 2.2.0
	 *
	 * @see convert_chars()
	 * @see get_bloginfo()
	 *
	 * @param string $info Converted string value of the blog information.
	 * @param string $show The type of blog information to retrieve.
	 */
	return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
}
 /**
  * Gets the content of a post, its excerpt as well as its title and returns it as an array
  *
  * @param string $content_type
  * @param string $excerpt_type
  * @param int    $trid
  * @param string $lang
  *
  * @return array containing all the fields information
  */
 public static function copy_from_original_fields($content_type, $excerpt_type, $trid, $lang)
 {
     global $wpdb;
     $post_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $lang));
     $post = get_post($post_id);
     $fields_to_copy = array('content' => 'post_content', 'title' => 'post_title', 'excerpt' => 'post_excerpt');
     $fields_contents = array();
     if (!empty($post)) {
         foreach ($fields_to_copy as $editor_key => $editor_field) {
             //loops over the three fields to be inserted into the array
             if ($editor_key === 'content' || $editor_key === 'excerpt') {
                 //
                 $editor_var = 'rich';
                 if ($editor_key === 'content') {
                     $editor_var = $content_type;
                     //these variables are supplied by a javascript call in scripts.js icl_copy_from_original(lang, trid)
                 } elseif ($editor_key === 'excerpt') {
                     $editor_var = $excerpt_type;
                 }
                 if (function_exists('format_for_editor')) {
                     // WordPress 4.3 uses format_for_editor
                     $html_pre = $post->{$editor_field};
                     if ($editor_var == 'rich') {
                         $html_pre = convert_chars($html_pre);
                         $html_pre = wpautop($html_pre);
                     }
                     $html_pre = format_for_editor($html_pre, $editor_var);
                 } else {
                     // Backwards compatible for WordPress < 4.3
                     if ($editor_var === 'rich') {
                         $html_pre = wp_richedit_pre($post->{$editor_field});
                     } else {
                         $html_pre = wp_htmledit_pre($post->{$editor_field});
                     }
                 }
                 $fields_contents[$editor_key] = htmlspecialchars_decode($html_pre);
             } elseif ($editor_key === 'title') {
                 $fields_contents[$editor_key] = strip_tags($post->{$editor_field});
             }
         }
         $fields_contents['customfields'] = apply_filters('wpml_copy_from_original_custom_fields', self::copy_from_original_custom_fields($post));
     } else {
         $fields_contents['error'] = __('Post not found', 'sitepress');
     }
     do_action('icl_copy_from_original', $post_id);
     return $fields_contents;
 }
 function create_posts($args)
 {
     if (!empty($args) && is_array($args)) {
         $valid_type = function_exists('post_type_exists') && post_type_exists($args['post_type']);
         if (!$valid_type) {
             return false;
         }
         $__post_content = !empty($_POST['post_content']) ? $_POST['post_content'] : $args['post_content'];
         $__post_content = !empty($__post_content) ? wpautop(convert_chars(stripslashes($__post_content))) : null;
         // author id
         $current_user = wp_get_current_user();
         $author_id = $current_user instanceof WP_User ? $current_user->ID : (!empty($args['author_id']) ? $args['author_id'] : 1);
         $new_post = array('post_title' => wp_strip_all_tags($args['post_title']), 'post_content' => $__post_content, 'post_status' => $args['post_status'], 'post_type' => $args['post_type'], 'post_name' => sanitize_title($args['post_title']), 'post_author' => $author_id);
         return wp_insert_post($new_post);
     } else {
         return false;
     }
 }
Exemplo n.º 21
0
 public function parseUploadedMajesticFile()
 {
     $file = $_FILES['ebn_import']['tmp_name'];
     $this->stripBOM($file);
     $skipped = 0;
     $imported_posts = array();
     if (($handle = fopen($file, "r")) !== false) {
         $data = fgetcsv($handle, filesize($file));
         $mappings = $data;
         if (in_array('ReferringExtBackLinks', $mappings) && in_array('Title', $mappings) && in_array('URL', $mappings)) {
             while (($data = fgetcsv($handle, filesize($file))) !== false) {
                 if ($data[0]) {
                     $line = array();
                     foreach ($data as $key => $value) {
                         $line[$mappings[$key]] = addslashes($value);
                     }
                     if (isset($line['Title']) && isset($line['URL']) && isset($line['ReferringExtBackLinks'])) {
                         $externalBacklinks = convert_chars($line['ReferringExtBackLinks']);
                         if ($externalBacklinks >= $this->options['opt_min_backlinks']) {
                             $post = new Post(addslashes($line['Title']), addslashes($line['URL']));
                             array_push($imported_posts, $post);
                         } else {
                             $skipped++;
                         }
                     }
                 }
             }
         } else {
             fclose($handle);
             return $imported_posts;
         }
         fclose($handle);
     } else {
         $this->log['error'][] = 'Failed to load file, aborting.';
         return $imported_posts;
     }
     if (file_exists($file)) {
         @unlink($file);
     }
     if ($skipped) {
         $this->log['notice'][] = "<b>Skipped {$skipped} pages .</b>";
     }
     return $imported_posts;
 }
Exemplo n.º 22
0
function create_unit($data)
{
    $fields = array('unit_number', 'element', 'rarity', 'cost', 'hit_count', 'bb_hits', 'sbb_hits', 'bb_fill', 'sbb_fill', 'lord_hp', 'lord_atk', 'lord_def', 'lord_rec', 'anima_hp', 'anima_atk', 'anima_def', 'anima_rec', 'breaker_hp', 'breaker_atk', 'breaker_def', 'breaker_rec', 'guardian_hp', 'guardian_atk', 'guardian_def', 'guardian_rec', 'oracle_hp', 'oracle_atk', 'oracle_def', 'oracle_rec', 'leaders_skill_effect', 'brave_burst_effect', 'super_brave_burst_effect');
    $type = 'unit';
    $valid_type = function_exists('post_type_exists') && post_type_exists($type);
    if (!$valid_type) {
        //$this->log['error']["type-{$type}"] = sprintf('Unknown post type "%s".', $type);
    }
    $new_post = array('post_title' => convert_chars($data['unit_name']), 'post_content' => 'Not available', 'post_status' => 'publish', 'post_type' => $type, 'post_date' => parse_date(time()));
    // create!
    $id = wp_insert_post($new_post);
    //Now that we have a new post ID update the associated field data
    foreach ($fields as $field) {
        if (array_key_exists($field, $data)) {
            update_field($field, $data[$field], $id);
        } else {
            return "<b>The field {$field} does not exist.</b>";
        }
    }
    return $id;
}
Exemplo n.º 23
0
function cfct_about_text()
{
    $about_text = get_option('cfct_about_text');
    if (!empty($about_text)) {
        $about_text = wptexturize($about_text);
        $about_text = convert_smilies($about_text);
        $about_text = convert_chars($about_text);
        $about_text = wpautop($about_text);
    } else {
        global $post;
        remove_filter('the_excerpt', 'st_add_widget');
        $about_query = new WP_Query('pagename=about');
        while ($about_query->have_posts()) {
            $about_query->the_post();
            $about_text = get_the_excerpt() . sprintf(__('<a class="more" href="%s">more &rarr;</a>', 'carrington'), get_permalink());
        }
    }
    if (function_exists('st_add_widget')) {
        add_filter('the_excerpt', 'st_add_widget');
    }
    return $about_text;
}
Exemplo n.º 24
0
/**
 * Formats text for the rich text editor.
 *
 * The filter 'richedit_pre' is applied here. If $text is empty the filter will
 * be applied to an empty string.
 *
 * @since 2.0.0
 *
 * @param string $text The text to be formatted.
 * @return string The formatted text after filter is applied.
 */
function wp_richedit_pre($text)
{
    // Filtering a blank results in an annoying <br />\n
    if (empty($text)) {
        return apply_filters('richedit_pre', '');
    }
    $output = convert_chars($text);
    $output = wpautop($output);
    $output = htmlspecialchars($output, ENT_NOQUOTES);
    return apply_filters('richedit_pre', $output);
}
 $title = strlen($title) > 255 ? substr($title, 0, 252) . '...' : $title;
 $excerpt = strip_tags($excerpt);
 $excerpt = strlen($excerpt) > 255 ? substr($excerpt, 0, 252) . '...' : $excerpt;
 $blog_name = htmlspecialchars($blog_name);
 $blog_name = strlen($blog_name) > 255 ? substr($blog_name, 0, 252) . '...' : $blog_name;
 $comment = '<trackback />';
 $comment .= "<strong>{$title}</strong>\n{$excerpt}";
 $author = addslashes(stripslashes(stripslashes($blog_name)));
 $email = '';
 $original_comment = $comment;
 $comment_post_ID = $tb_id;
 $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
 $user_domain = gethostbyaddr($user_ip);
 $time_difference = get_settings('time_difference');
 $now = current_time('mysql');
 $comment = convert_chars($comment);
 $comment = format_to_post($comment);
 $comment_author = $author;
 $comment_author_email = $email;
 $comment_author_url = $tb_url;
 $author = addslashes($author);
 $comment_moderation = get_settings('comment_moderation');
 $moderation_notify = get_settings('moderation_notify');
 if ('manual' == $comment_moderation) {
     $approved = 0;
 } else {
     if ('auto' == $comment_moderation) {
         $approved = 0;
     } else {
         // none
         $approved = 1;
function jetpack_og_tags()
{
    /**
     * Allow Jetpack to output Open Graph Meta Tags.
     *
     * @module sharedaddy, publicize
     *
     * @since 2.0.0
     * @deprecated 2.0.3 Duplicative filter. Use `jetpack_enable_open_graph`.
     *
     * @param bool true Should Jetpack's Open Graph Meta Tags be enabled. Default to true.
     */
    if (false === apply_filters('jetpack_enable_opengraph', true)) {
        _deprecated_function('jetpack_enable_opengraph', '2.0.3', 'jetpack_enable_open_graph');
        return;
    }
    // Disable the widont filter on WP.com to avoid stray &nbsps
    $disable_widont = remove_filter('the_title', 'widont');
    $og_output = "\n<!-- Jetpack Open Graph Tags -->\n";
    $tags = array();
    /**
     * Filter the minimum width of the images used in Jetpack Open Graph Meta Tags.
     *
     * @module sharedaddy, publicize
     *
     * @since 2.0.0
     *
     * @param int 200 Minimum image width used in Jetpack Open Graph Meta Tags.
     */
    $image_width = absint(apply_filters('jetpack_open_graph_image_width', 200));
    /**
     * Filter the minimum height of the images used in Jetpack Open Graph Meta Tags.
     *
     * @module sharedaddy, publicize
     *
     * @since 2.0.0
     *
     * @param int 200 Minimum image height used in Jetpack Open Graph Meta Tags.
     */
    $image_height = absint(apply_filters('jetpack_open_graph_image_height', 200));
    $description_length = 197;
    if (is_home() || is_front_page()) {
        $site_type = get_option('open_graph_protocol_site_type');
        $tags['og:type'] = !empty($site_type) ? $site_type : 'website';
        $tags['og:title'] = get_bloginfo('name');
        $tags['og:description'] = get_bloginfo('description');
        $front_page_id = get_option('page_for_posts');
        if ($front_page_id && is_home()) {
            $tags['og:url'] = get_permalink($front_page_id);
        } else {
            $tags['og:url'] = home_url('/');
        }
        // Associate a blog's root path with one or more Facebook accounts
        $facebook_admins = get_option('facebook_admins');
        if (!empty($facebook_admins)) {
            $tags['fb:admins'] = $facebook_admins;
        }
    } else {
        if (is_author()) {
            $tags['og:type'] = 'profile';
            $author = get_queried_object();
            $tags['og:title'] = $author->display_name;
            if (!empty($author->user_url)) {
                $tags['og:url'] = $author->user_url;
            } else {
                $tags['og:url'] = get_author_posts_url($author->ID);
            }
            $tags['og:description'] = $author->description;
            $tags['profile:first_name'] = get_the_author_meta('first_name', $author->ID);
            $tags['profile:last_name'] = get_the_author_meta('last_name', $author->ID);
        } else {
            if (is_singular()) {
                global $post;
                $data = $post;
                // so that we don't accidentally explode the global
                $tags['og:type'] = 'article';
                if (empty($data->post_title)) {
                    $tags['og:title'] = ' ';
                } else {
                    /** This filter is documented in core/src/wp-includes/post-template.php */
                    $tags['og:title'] = wp_kses(apply_filters('the_title', $data->post_title, $data->ID), array());
                }
                $tags['og:url'] = get_permalink($data->ID);
                if (!post_password_required()) {
                    if (!empty($data->post_excerpt)) {
                        $tags['og:description'] = preg_replace('@https?://[\\S]+@', '', strip_shortcodes(wp_kses($data->post_excerpt, array())));
                    } else {
                        $exploded_content_on_more_tag = explode('<!--more-->', $data->post_content);
                        $tags['og:description'] = wp_trim_words(preg_replace('@https?://[\\S]+@', '', strip_shortcodes(wp_kses($exploded_content_on_more_tag[0], array()))));
                    }
                }
                if (empty($tags['og:description'])) {
                    /**
                     * Filter the fallback `og:description` used when no excerpt information is provided.
                     *
                     * @module sharedaddy, publicize
                     *
                     * @since 3.9.0
                     *
                     * @param string $var  Fallback og:description. Default is translated `Visit the post for more'.
                     * @param object $data Post object for the current post.
                     */
                    $tags['og:description'] = apply_filters('jetpack_open_graph_fallback_description', __('Visit the post for more.', 'jetpack'), $data);
                } else {
                    // Intentionally not using a filter to prevent pollution. @see https://github.com/Automattic/jetpack/pull/2899#issuecomment-151957382
                    $tags['og:description'] = wp_kses(trim(convert_chars(wptexturize($tags['og:description']))), array());
                }
                $tags['article:published_time'] = date('c', strtotime($data->post_date_gmt));
                $tags['article:modified_time'] = date('c', strtotime($data->post_modified_gmt));
                if (post_type_supports(get_post_type($data), 'author') && isset($data->post_author)) {
                    $publicize_facebook_user = get_post_meta($data->ID, '_publicize_facebook_user', true);
                    if (!empty($publicize_facebook_user)) {
                        $tags['article:author'] = esc_url($publicize_facebook_user);
                    }
                }
            }
        }
    }
    /**
     * Allow plugins to inject additional template-specific Open Graph tags.
     *
     * @module sharedaddy, publicize
     *
     * @since 3.0.0
     *
     * @param array $tags Array of Open Graph Meta tags.
     * @param array $args Array of image size parameters.
     */
    $tags = apply_filters('jetpack_open_graph_base_tags', $tags, compact('image_width', 'image_height'));
    // Re-enable widont if we had disabled it
    if ($disable_widont) {
        add_filter('the_title', 'widont');
    }
    /**
     * Do not return any Open Graph Meta tags if we don't have any info about a post.
     *
     * @module sharedaddy, publicize
     *
     * @since 3.0.0
     *
     * @param bool true Do not return any Open Graph Meta tags if we don't have any info about a post.
     */
    if (empty($tags) && apply_filters('jetpack_open_graph_return_if_empty', true)) {
        return;
    }
    $tags['og:site_name'] = get_bloginfo('name');
    // Get image info and build tags
    if (!post_password_required()) {
        $image_info = jetpack_og_get_image($image_width, $image_height);
        $tags['og:image'] = $image_info['src'];
        if (!empty($image_info['width'])) {
            $tags['og:image:width'] = $image_info['width'];
        }
        if (!empty($image_info['height'])) {
            $tags['og:image:height'] = $image_info['height'];
        }
    }
    // Facebook whines if you give it an empty title
    if (empty($tags['og:title'])) {
        $tags['og:title'] = __('(no title)', 'jetpack');
    }
    // Shorten the description if it's too long
    if (isset($tags['og:description'])) {
        $tags['og:description'] = strlen($tags['og:description']) > $description_length ? mb_substr($tags['og:description'], 0, $description_length) . '…' : $tags['og:description'];
    }
    // Try to add OG locale tag if the WP->FB data mapping exists
    if (defined('JETPACK__GLOTPRESS_LOCALES_PATH') && file_exists(JETPACK__GLOTPRESS_LOCALES_PATH)) {
        require_once JETPACK__GLOTPRESS_LOCALES_PATH;
        $_locale = get_locale();
        // We have to account for w.org vs WP.com locale divergence
        if (defined('IS_WPCOM') && IS_WPCOM) {
            $gp_locale = GP_Locales::by_field('slug', $_locale);
        } else {
            $gp_locale = GP_Locales::by_field('wp_locale', $_locale);
        }
    }
    if (isset($gp_locale->facebook_locale) && !empty($gp_locale->facebook_locale)) {
        $tags['og:locale'] = $gp_locale->facebook_locale;
    }
    /**
     * Allow the addition of additional Open Graph Meta tags, or modify the existing tags.
     *
     * @module sharedaddy, publicize
     *
     * @since 2.0.0
     *
     * @param array $tags Array of Open Graph Meta tags.
     * @param array $args Array of image size parameters.
     */
    $tags = apply_filters('jetpack_open_graph_tags', $tags, compact('image_width', 'image_height'));
    // secure_urls need to go right after each og:image to work properly so we will abstract them here
    $secure = $tags['og:image:secure_url'] = empty($tags['og:image:secure_url']) ? '' : $tags['og:image:secure_url'];
    unset($tags['og:image:secure_url']);
    $secure_image_num = 0;
    foreach ((array) $tags as $tag_property => $tag_content) {
        // to accommodate multiple images
        $tag_content = (array) $tag_content;
        $tag_content = array_unique($tag_content);
        foreach ($tag_content as $tag_content_single) {
            if (empty($tag_content_single)) {
                continue;
            }
            // Don't ever output empty tags
            $og_tag = sprintf('<meta property="%s" content="%s" />', esc_attr($tag_property), esc_attr($tag_content_single));
            /**
             * Filter the HTML Output of each Open Graph Meta tag.
             *
             * @module sharedaddy, publicize
             *
             * @since 2.0.0
             *
             * @param string $og_tag HTML HTML Output of each Open Graph Meta tag.
             */
            $og_output .= apply_filters('jetpack_open_graph_output', $og_tag);
            $og_output .= "\n";
            if ('og:image' == $tag_property) {
                if (is_array($secure) && !empty($secure[$secure_image_num])) {
                    $og_tag = sprintf('<meta property="og:image:secure_url" content="%s" />', esc_url($secure[$secure_image_num]));
                    /** This filter is documented in functions.opengraph.php */
                    $og_output .= apply_filters('jetpack_open_graph_output', $og_tag);
                    $og_output .= "\n";
                } else {
                    if (!is_array($secure) && !empty($secure)) {
                        $og_tag = sprintf('<meta property="og:image:secure_url" content="%s" />', esc_url($secure));
                        /** This filter is documented in functions.opengraph.php */
                        $og_output .= apply_filters('jetpack_open_graph_output', $og_tag);
                        $og_output .= "\n";
                    }
                }
                $secure_image_num++;
            }
        }
    }
    echo $og_output;
}
function bloginfo_unicode($show = '')
{
    $info = get_bloginfo($show);
    echo convert_chars($info);
}
 /**
  * Escapes and beautifies title.
  *
  * @since 2.5.2
  *
  * @param string $title The title to escape and beautify.
  * @param bool $trim Whether to trim the title from whitespaces.
  * @return string Escaped and beautified title.
  */
 public function escape_title($title = '', $trim = true)
 {
     $title = wptexturize($title);
     $title = convert_chars($title);
     $title = esc_html($title);
     $title = capital_P_dangit($title);
     $title = $trim ? trim($title) : $title;
     return $title;
 }
Exemplo n.º 29
0
		<pubDate><?php 
echo get_option('em_rss_pubdate', date('D, d M Y H:i:s T'));
?>
</pubDate>
		<atom:link href="<?php 
echo esc_attr(EM_RSS_URI);
?>
" rel="self" type="application/rss+xml" />
		<?php 
$description_format = str_replace(">", "&gt;", str_replace("<", "&lt;", get_option('dbem_rss_description_format')));
//$EM_Events = new EM_Events( array('limit'=>5, 'owner'=>false) );
$EM_Events = EM_Events::get(array('scope' => 'future', 'owner' => false));
foreach ($EM_Events as $EM_Event) {
    /* @var $EM_Event EM_Event */
    $description = $EM_Event->output(get_option('dbem_rss_description_format'), "rss");
    $description = ent2ncr(convert_chars($description));
    //Some RSS filtering
    $event_url = $EM_Event->output('#_EVENTURL');
    ?>
			<item>
				<title><?php 
    echo $EM_Event->output(get_option('dbem_rss_title_format'), "rss");
    ?>
</title>
				<link><?php 
    echo $event_url;
    ?>
</link>
				<guid><?php 
    echo $event_url;
    ?>
function comment_text_rss($with_html = false)
{
    global $blog_charset;
    global $comment;
    $comment_text = stripslashes($comment->comment_content);
    $comment_text = str_replace('<trackback />', '', $comment_text);
    $comment_text = str_replace('<pingback />', '', $comment_text);
    $comment_text = convert_chars($comment_text);
    $comment_text = convert_bbcode($comment_text);
    $comment_text = convert_gmcode($comment_text);
    $comment_text = convert_smilies($comment_text);
    $comment_text = apply_filters('comment_text', $comment_text);
    if (!$with_html) {
        $comment_text = strip_tags($comment_text);
        $comment_text = htmlspecialchars($comment_text);
    }
    $rss_charset = wp_get_rss_charset();
    if ($blog_charset != $rss_charset) {
        echo mb_convert_encoding($comment_text, $rss_charset, $blog_charset);
    } else {
        echo $comment_text;
    }
}