コード例 #1
0
function podPress_feedSafeContent($input, $aggressive = FALSE, $removescripts = FALSE)
{
    global $podPress;
    // All values should be plain text (no markup or HTML). [...] CDATA sections are strongly discouraged. (see http://www.apple.com/itunes/podcasts/specs.html#encoding)
    if (TRUE === $removescripts) {
        // this option is only reachable via php source code and via the WP backend
        $input = preg_replace('/<script[\\w\\W]*<\\/script>/i', '', $input);
    }
    $input = strip_tags($input);
    // replace the relevant characters with their HTML entities
    if (TRUE === $aggressive) {
        if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) {
            $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE);
        } else {
            $result = htmlentities($input, ENT_NOQUOTES, get_bloginfo('charset'));
        }
    } else {
        if (TRUE === version_compare(PHP_VERSION, '5.2.3', '>=')) {
            $result = htmlspecialchars($input, ENT_NOQUOTES, get_bloginfo('charset'), FALSE);
        } else {
            $result = htmlspecialchars($input, ENT_NOQUOTES, get_bloginfo('charset'));
        }
    }
    $input = $result;
    $result = str_replace('&nbsp;', ' ', $input);
    // transform all HTML entities in to their numeric equivalents
    $result = ent2ncr($result);
    return $result;
}
コード例 #2
0
    public function livePreview()
    {
        ?>
		<script>
			jQuery(document).ready(function ($) {
				<?php 
        foreach ($this->options as $option) {
            if (empty($option->settings['livepreview'])) {
                continue;
            }
            ?>
				wp.customize('<?php 
            echo esc_attr($option->getID());
            ?>
', function (v) {
					v.bind(function (value) {
						<?php 
            // Some options may want to insert custom jQuery code before manipulation of live preview
            if (!empty($option->settings['id'])) {
                do_action('tf_livepreview_pre_' . $this->owner->optionNamespace, $option->settings['id'], $option->settings['type'], $option);
            }
            echo ent2ncr($option->settings['livepreview']);
            ?>
					});
				});
				<?php 
        }
        ?>
			});
		</script>
	<?php 
    }
コード例 #3
0
    public function display()
    {
        wp_enqueue_script('wp-color-picker');
        wp_enqueue_style('wp-color-picker');
        $this->echoOptionHeader();
        ?>
        <input class="thim-color-control color-picker-hex wp-color-picker" type="text" name="<?php 
        echo esc_attr($this->getID());
        ?>
" id="<?php 
        echo esc_attr($this->getID());
        ?>
" value="<?php 
        echo ent2ncr($this->getValue());
        ?>
"  data-default-color="<?php 
        echo ent2ncr($this->getValue());
        ?>
"/>
        <?php 
        // load the javascript to init the colorpicker
        if (self::$firstLoad) {
            ?>
            <script>
                jQuery(document).ready(function ($) {
                    "use strict";
                    $('.tf-colorpicker').wpColorPicker();
                });
            </script>
            <?php 
        }
        $this->echoOptionFooter();
        self::$firstLoad = false;
    }
コード例 #4
0
    public function display()
    {
        $this->echoOptionHeader();
        $attributes = $this->echoAttributes();
        ?>
		<label for="<?php 
        echo esc_attr($this->getID());
        ?>
">
		<input name="<?php 
        echo esc_attr($this->getID());
        ?>
" type="checkbox" id="<?php 
        echo esc_attr($this->getID());
        ?>
" value="1" <?php 
        checked($this->getValue(), 1);
        echo '' . $attributes;
        ?>
>
		<?php 
        echo ent2ncr($this->getDesc(true));
        ?>
		</label>
		<?php 
        $this->echoOptionFooter(false);
    }
コード例 #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;
    }
}
コード例 #6
0
function jd_draw_template($array, $template, $type = 'list')
{
    $template = stripcslashes($template);
    foreach ($array as $key => $value) {
        // disallow anything not allowed in posts
        // fields where mc_kses_posts shouldn't run
        $retain = array('map', 'map_url', 'sitelink', 'icon', 'link', 'details_link', 'linking', 'gcal', 'ical_link', 'edit_link', 'register');
        $value = !in_array($key, $retain) ? mc_kses_post($value) : $value;
        if (is_object($value) && !empty($value)) {
            // null values return false...
        } else {
            if (strpos($template, "{" . $key) !== false) {
                if ($type != 'list') {
                    if ($key == 'link' && $value == '') {
                        $value = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? get_option('mc_uri') : home_url();
                    }
                    if ($key != 'guid') {
                        $value = htmlentities($value);
                    }
                }
                if (strpos($template, "{" . $key . " ") !== false) {
                    // only do preg_match if appropriate
                    preg_match_all('/{' . $key . '\\b(?>\\s+(?:before="([^"]*)"|after="([^"]*)"|format="([^"]*)")|[^\\s]+|\\s+){0,3}}/', $template, $matches, PREG_PATTERN_ORDER);
                    if ($matches) {
                        $number = count($matches[0]);
                        for ($i = 0; $i <= $number; $i++) {
                            $orig = $value;
                            $before = @$matches[1][$i];
                            $after = @$matches[2][$i];
                            $format = @$matches[3][$i];
                            if ($format != '') {
                                $value = date_i18n(stripslashes($format), strtotime(stripslashes($value)));
                            }
                            $value = $value == '' ? '' : $before . $value . $after;
                            $search = @$matches[0][$i];
                            $template = str_replace($search, $value, $template);
                            $value = $orig;
                        }
                    }
                } else {
                    // don't do preg match (never required for RSS)
                    $template = stripcslashes(str_replace("{" . $key . "}", $value, $template));
                }
            }
            // end {$key check
            // secondary search for RSS output
            $rss_search = "{rss_{$key}}";
            if (strpos($template, $rss_search) !== false) {
                $value = ent2ncr($value);
                // WP native function.
                $template = stripcslashes(str_replace($rss_search, $value, $template));
            }
        }
    }
    return stripslashes(trim($template));
}
コード例 #7
0
 public function generate_sitemap()
 {
     global $wds_options;
     if (is_admin() && defined('WDS_SITEMAP_SKIP_ADMIN_UPDATE') && WDS_SITEMAP_SKIP_ADMIN_UPDATE) {
         return false;
     }
     //this can take a whole lot of time on big blogs
     if (!(defined('WDS_SITEMAP_SKIP_TIME_LIMIT_SETTING') && WDS_SITEMAP_SKIP_TIME_LIMIT_SETTING)) {
         set_time_limit(120);
     }
     if (!$this->_items) {
         $this->_load_all_items();
     }
     $map = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     if (@$wds_options['sitemap-stylesheet']) {
         $map .= $this->_get_stylesheet('xml-sitemap');
     }
     $image_schema_url = 'http://www.google.com/schemas/sitemap-image/1.1';
     $image_schema = @$wds_options['sitemap-images'] ? "xmlns:image='{$image_schema_url}'" : '';
     $map .= "<urlset xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' {$image_schema}>\n";
     foreach ($this->_items as $item) {
         $map .= "<url>\n";
         foreach ($item as $key => $val) {
             if ('images' == $key) {
                 if (!$val) {
                     continue;
                 }
                 if (!@$wds_options['sitemap-images']) {
                     continue;
                 }
                 foreach ($item['images'] as $image) {
                     $text = $image['title'] ? $image['title'] : $image['alt'];
                     $map .= "<image:image>";
                     $map .= "<image:loc>" . esc_url($image['src']) . '</image:loc>';
                     $map .= "<image:title>" . ent2ncr($text) . '</image:title>';
                     $map .= "</image:image>\n";
                 }
             } else {
                 $map .= "<{$key}>{$val}</{$key}>\n";
             }
         }
         $map .= "</url>\n\n";
     }
     $map .= "</urlset>";
     if (!$this->_is_admin_mapped()) {
         $this->_write_sitemap($map);
         $this->_postprocess_sitemap();
     } else {
         $file = wds_get_sitemap_path();
         @unlink($file);
         @unlink("{$file}.gz");
     }
 }
コード例 #8
0
ファイル: rsscloud.php プロジェクト: voitto/dbscript
function rsscloud_notify_result($success, $msg)
{
    $success = strip_tags($success);
    $success = ent2ncr($success);
    $success = esc_html($success);
    $msg = strip_tags($msg);
    $msg = ent2ncr($msg);
    $msg = esc_html($msg);
    header('Content-Type: text/xml');
    echo "<?xml version='1.0'?>\n";
    echo "<notifyResult success='{$success}' msg='{$msg}' />\n";
    exit;
}
コード例 #9
0
ファイル: em-event-post.php プロジェクト: hscale/webento
 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;
 }
コード例 #10
0
function jd_draw_template($array, $template, $type = 'list')
{
    $template = stripcslashes($template);
    foreach ($array as $key => $value) {
        if (is_object($value) && !empty($value)) {
            // null values return false...
        } else {
            if (strpos($template, "{" . $key) !== false) {
                if ($type != 'list') {
                    if ($key == 'link' && $value == '') {
                        $value = get_option('mc_uri') != '' && !is_numeric(get_option('mc_uri')) ? get_option('mc_uri') : home_url();
                    }
                    if ($key != 'guid') {
                        $value = htmlentities($value);
                    }
                }
                if (strpos($template, "{" . $key . " ") !== false) {
                    // only do preg_match if appropriate
                    preg_match_all('/{' . $key . '\\b(?>\\s+(?:before="([^"]*)"|after="([^"]*)"|format="([^"]*)")|[^\\s]+|\\s+){0,2}}/', $template, $matches, PREG_PATTERN_ORDER);
                    if ($matches) {
                        $before = @$matches[1][0];
                        $after = @$matches[2][0];
                        $format = @$matches[3][0];
                        if ($format != '') {
                            $value = date_i18n(stripslashes($format), strtotime(stripslashes($value)));
                        }
                        $value = $value == '' ? '' : $before . $value . $after;
                        $search = @$matches[0][0];
                        $template = str_replace($search, $value, $template);
                    }
                } else {
                    // don't do preg match (never required for RSS)
                    $template = stripcslashes(str_replace("{" . $key . "}", $value, $template));
                }
            }
            // end {$key check
            // secondary search for RSS output
            $rss_search = "{rss_{$key}}";
            if (strpos($template, $rss_search) !== false) {
                $charset = get_option('blog_charset');
                if ($charset == '') {
                    $charset = 'UTF-8';
                }
                $value = ent2ncr($value);
                // WP native function.
                $template = stripcslashes(str_replace($rss_search, $value, $template));
            }
        }
    }
    return stripslashes(trim($template));
}
コード例 #11
0
ファイル: head.php プロジェクト: ravitechrlabs/wordpress
/**
 * This function prints out the title for the website.
 * If present, the theme will display customised site title structure.
*/
function franz_title($title, $sep = '-', $seplocation = '')
{
    global $franz_settings;
    $default_title = $title;
    if (is_feed()) {
        $title = $default_title;
    } elseif (is_front_page()) {
        $title = get_bloginfo('name');
        $title .= ($desc = get_bloginfo('description')) ? " - " . $desc : '';
    } else {
        $title = $default_title . " - " . get_bloginfo('name');
    }
    return ent2ncr(apply_filters('franz_title', trim($title)));
}
コード例 #12
0
ファイル: author.php プロジェクト: Creativebq/wp-istalker
/**
 *  author display_name
 *  
 */
function wpi_get_author_name($type = 'hcard')
{
    global $authordata;
    $name = $display_name = apply_filters('the_author', $authordata->display_name);
    $name = $display_name = ent2ncr(htmlentities2($name));
    $author_url = $authordata->user_url;
    $author_url = $author_url != 'http://' ? $author_url : WPI_URL;
    switch ($type) {
        case 'link':
            /** simple links
             *	
             */
            $attribs = array('href' => $author_url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . '&apos;s Website', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $display_name, $attribs);
            break;
        case 'hcard':
            /** convert to microformats
             *	address:a:span
             */
            // split the name
            $name = explode('name', $name);
            if (is_array($name)) {
                if (Wpi::hasCount($name)) {
                    if (isset($name[0])) {
                        $output = _t('span', $name[0], array('class' => 'nickname'));
                    }
                    if (isset($name[1])) {
                        $output = _t('span', $name[0], array('class' => 'given-name')) . ' ';
                        $output .= _t('span', $name[1], array('class' => 'family-name'));
                    }
                }
            } else {
                $output = _t('span', $author_name, array('class' => 'nickname'));
            }
            // author post url;
            $url = get_author_posts_url($authordata->ID, $authordata->user_nicename);
            $url = apply_filters(wpiFilter::FILTER_LINKS, $url);
            $attribs = array('href' => $url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . '&apos;s Author page', 'rev' => 'author:' . $authordata->user_nicename);
            $output = _t('a', $output, $attribs);
            // microID sha-1 hash
            $hash = get_microid_hash($authordata->user_email, $author_url);
            // wrap hcard
            $output = _t('cite', $output, array('class' => 'vcard microid-' . $hash));
            break;
        default:
            $output = $name;
            break;
    }
    return apply_filters(wpiFilter::FILTER_AUTHOR_NAME . $type, $output);
}
コード例 #13
0
ファイル: class-option-save.php プロジェクト: vinhnq1211/funy
    public function display()
    {
        if (!empty($this->owner->postID)) {
            return;
        }
        if (empty($this->settings['save'])) {
            $this->settings['save'] = __('Save Changes', 'thim');
        }
        if (empty($this->settings['reset'])) {
            $this->settings['reset'] = __('Reset to Defaults', 'thim');
        }
        if (empty($this->settings['reset_question'])) {
            $this->settings['reset_question'] = __('Are you sure you want to reset ALL options to their default values?', 'thim');
        }
        ?>
		</tbody>
		</table>

		<p class='submit'>
			<button name="action" value="<?php 
        echo esc_html($this->settings['action']);
        ?>
" class="button button-primary">
				<?php 
        echo ent2ncr($this->settings['save']);
        ?>
			</button>

			<?php 
        if ($this->settings['use_reset']) {
            ?>
			<button name="action" class="button button-secondary"
				onclick="javascript: if ( confirm( '<?php 
            echo htmlentities(esc_attr($this->settings['reset_question']));
            ?>
' ) ) { jQuery( '#tf-reset-form' ).submit(); } jQuery(this).blur(); return false;">
				<?php 
            echo ent2ncr($this->settings['reset']);
            ?>
			</button>
			<?php 
        }
        ?>
		</p>

		<table class='form-table'>
			<tbody>
		<?php 
    }
コード例 #14
0
ファイル: TF_SEO.php プロジェクト: part-time-project/italians
 /**
  * Fix double title in rss
  */
 public function wp_title_rss_filter($title)
 {
     if (!tfuse_options('enable_tfuse_seo_tab', true)) {
         return $title;
     }
     $exploded = explode($this->bloginfo_rss_name, ent2ncr($title));
     if (!$exploded[0]) {
         array_shift($exploded);
     }
     if (sizeof($exploded) > 1) {
         $title = implode(bloginfo_rss('name'), $exploded);
     } else {
         $title = implode('', $exploded);
     }
     return $title;
 }
コード例 #15
0
ファイル: export-settings.php プロジェクト: vinhnq1211/funy
function thim_customizer_export_theme_settings()
{
    $blogname = strtolower(str_replace(' ', '-', get_option('blogname')));
    $file_name = $blogname . '-thimtheme-' . date('Ydm') . '.json';
    $options = get_theme_mods();
    unset($options['nav_menu_locations']);
    foreach ($options as $key => $value) {
        $value = maybe_unserialize($value);
        $need_options[$key] = $value;
    }
    $json_file = json_encode($need_options);
    ob_clean();
    header('Content-Type: text/json; charset=' . get_option('blog_charset'));
    header('Content-Disposition: attachment; filename="' . $file_name . '"');
    echo ent2ncr($json_file);
    exit;
}
コード例 #16
0
function csg_sitemap()
{
    // Create empty string
    $sitemap = '';
    // Sanitize and escape input
    $frequency = sanitize_option('frequency', $_POST['frequency']);
    $frequency = esc_html($frequency);
    // And finally, check if its a safe value
    $check_input = $frequency;
    $safe_values = array('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never');
    if (in_array($check_input, $safe_values, true)) {
        // Add basic XML output
        $sitemap .= '<?xml version="1.0" encoding="UTF-8"?>
		<urlset xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        // Add homepage
        $sitemap .= '
			<url>
			<loc>' . get_site_url() . '/</loc>
			<changefreq>' . $frequency . '</changefreq>
			</url>
		';
        // Add pages
        // Arguments for selecting pages
        $args = array('post_type' => 'page', 'posts_per_page' => 9000);
        // The Query
        query_posts($args);
        // The Loop
        while (have_posts()) {
            the_post();
            $sitemap .= '
				<url>
				<loc>' . get_the_permalink() . '</loc>
				<changefreq>' . $frequency . '</changefreq>
				</url>
			';
        }
        $sitemap .= '</urlset>';
        // Reset Query
        wp_reset_query();
    } else {
        wp_die('Invalid data');
        // If the frequency is not accepted, return error
    }
    // Return sitemap-string but first filter any text containing illegal named entities
    return ent2ncr($sitemap);
}
コード例 #17
0
ファイル: parsers.php プロジェクト: vinhnq1211/funy
 function parse($file)
 {
     // Attempt to use proper XML parsers first
     if (extension_loaded('simplexml')) {
         $parser = new WXR_Parser_SimpleXML();
         $result = $parser->parse($file);
         // If SimpleXML succeeds or this is an invalid WXR file then return the results
         if (!is_wp_error($result) || 'SimpleXML_parse_error' != $result->get_error_code()) {
             return $result;
         }
     } else {
         if (extension_loaded('xml')) {
             $parser = new WXR_Parser_XML();
             $result = $parser->parse($file);
             // If XMLParser succeeds or this is an invalid WXR file then return the results
             if (!is_wp_error($result) || 'XML_parse_error' != $result->get_error_code()) {
                 return $result;
             }
         }
     }
     // We have a malformed XML file, so display the error and fallthrough to regex
     if (isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG) {
         echo '<pre>';
         if ('SimpleXML_parse_error' == $result->get_error_code()) {
             foreach ($result->get_error_data() as $error) {
                 echo ent2ncr($error->line . ':' . $error->column . ' ' . esc_html($error->message) . "\n");
             }
         } else {
             if ('XML_parse_error' == $result->get_error_code()) {
                 $error = $result->get_error_data();
                 echo ent2ncr($error[0] . ':' . $error[1] . ' ' . esc_html($error[2]));
             }
         }
         echo '</pre>';
         echo '<p><strong>' . __('There was an error when reading this WXR file', 'wordpress-importer') . '</strong><br />';
         echo __('Details are shown above. The importer will now try again with a different parser...', 'wordpress-importer') . '</p>';
     }
     // use regular expressions if nothing else available or this is bad XML
     $parser = new WXR_Parser_Regex();
     return $parser->parse($file);
 }
コード例 #18
0
        public function render_content()
        {
            ?>
			<label>
				<span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
				<textarea class='large-text <?php 
            echo ent2ncr($this->is_code ? 'code' : '');
            ?>
' rows='7' cols='50' <?php 
            $this->link();
            ?>
><?php 
            echo esc_textarea(stripslashes($this->value()));
            ?>
</textarea>
			</label>
			<?php 
            echo "<p class='description'>{$this->description}</p>";
        }
コード例 #19
0
ファイル: class-meta-box.php プロジェクト: vinhnq1211/funy
    public function display($post)
    {
        $this->postID = $post->ID;
        wp_nonce_field($this->settings['id'], TF . '_' . $this->settings['id'] . '_nonce');
        if (!empty($this->settings['desc'])) {
            ?>
<p class='description'><?php 
            echo ent2ncr($this->settings['desc']);
            ?>
</p><?php 
        }
        ?>
		<table class="form-table tf-form-table">
		<tbody>
		<?php 
        foreach ($this->options as $option) {
            $option->display();
        }
        ?>
		</tbody>
		</table>
		<?php 
    }
コード例 #20
0
ファイル: class-option-code.php プロジェクト: vinhnq1211/funy
    /**
     * Prints javascript code in the header for meta options using wp_print_scripts
     *
     * @return	void
     * @since	1.3
     */
    public function printJSForPagesAndPosts()
    {
        // This is for meta box options only, other types get generated normally
        if (TitanFrameworkOption::TYPE_META != $this->type) {
            return;
        }
        // For CSS langs only
        if ($this->settings['lang'] != 'javascript') {
            return;
        }
        // Don't generate CSS for non-pages and non-posts
        $id = get_the_ID();
        if (empty($id) || 1 == $id) {
            return;
        }
        ?>
		<script>
		<?php 
        echo ent2ncr($this->getFramework()->getOption($this->settings['id'], $id));
        ?>
		</script>
		<?php 
    }
コード例 #21
0
ファイル: class-option-note.php プロジェクト: vinhnq1211/funy
    public function display()
    {
        $this->echoOptionHeader();
        $color = $this->settings['color'] == 'green' ? '' : 'error';
        if ($this->settings['notification']) {
            ?>
<div class='updated below-h2 <?php 
            echo esc_attr($color);
            ?>
'><?php 
        }
        if ($this->settings['paragraph']) {
            echo "<p class='description'>";
        }
        echo ent2ncr($this->settings['desc']);
        if ($this->settings['paragraph']) {
            echo "</p>";
        }
        if ($this->settings['notification']) {
            ?>
</div><?php 
        }
        $this->echoOptionFooter(false);
    }
コード例 #22
0
 function parse_video_opts($data)
 {
     $opts = array();
     $fields = array('thumbnail_url' => 'video:thumbnail_loc', 'title' => 'video:title', 'description' => 'video:description', 'duration' => 'video:duration', 'author_name' => 'video:uploader', 'html' => 'video:player_loc');
     $link_found = 0;
     if (!empty($data)) {
         $data = (array) $data;
         if (!empty($data['html'])) {
             $dom_document = new DOMDocument();
             @$dom_document->loadHTML($data['html']);
             $dom_xpath = new DOMXpath($dom_document);
             $iframes = $dom_xpath->query("//iframe");
             if (!is_null($iframes) && $iframes->length) {
                 foreach ($iframes as $iframe) {
                     if ($iframe->hasAttributes()) {
                         $attributes = $iframe->attributes;
                         if (!is_null($attributes)) {
                             foreach ($attributes as $index => $attr) {
                                 if ($attr->name == 'src') {
                                     $data['html'] = $attr->value;
                                     $link_found = 1;
                                     break 2;
                                 }
                             }
                         }
                     }
                 }
             } else {
                 $embeds = $dom_xpath->query("//embed");
                 if (!is_null($embeds) && $embeds->length) {
                     foreach ($embeds as $embed) {
                         if ($embed->hasAttributes()) {
                             $attributes = $embed->attributes;
                             if (!is_null($attributes)) {
                                 foreach ($attributes as $index => $attr) {
                                     if ($attr->name == 'src') {
                                         $data['html'] = $attr->value;
                                         $link_found = 1;
                                         break 2;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (!$link_found) {
             unset($data["html"]);
         } else {
             $parse_url = parse_url(str_replace(':////', '://', esc_url_raw($data["html"])));
             if (empty($parse_url['scheme'])) {
                 $parse_url['scheme'] = 'http';
                 $data["html"] = str_replace(':////', '://', esc_url_raw($this->unparse_url($parse_url)));
             }
         }
         foreach ($fields as $k => $v) {
             if (!empty($data[$k])) {
                 $opts[$v] = ent2ncr(esc_attr($data[$k]));
             }
         }
         if (!empty($data['html']) && empty($opts['video:description'])) {
             $opts['video:description'] = "Video ";
             if (!empty($opts['video:title'])) {
                 $opts['video:description'] .= $opts['video:title'];
             }
             if (!empty($opts['video:uploader'])) {
                 $opts['video:description'] .= ' by ' . $opts['video:uploader'];
             }
         }
     }
     return $opts;
 }
コード例 #23
0
ファイル: rss.php プロジェクト: adisonc/MaineLearning
		<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;
    ?>
コード例 #24
0
<?php 
if (have_comments()) {
    while (have_comments()) {
        the_comment();
        $comment_post = get_post($comment->comment_post_ID);
        get_post_custom($comment_post->ID);
        ?>
	<entry>
		<title><?php 
        if (!is_singular()) {
            $title = get_the_title($comment_post->ID);
            $title = apply_filters('the_title_rss', $title);
            printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
        } else {
            printf(ent2ncr(__('By: %s')), get_comment_author_rss());
        }
        ?>
</title>
		<link rel="alternate" href="<?php 
        comment_link();
        ?>
" type="<?php 
        bloginfo_rss('html_type');
        ?>
" />

		<author>
			<name><?php 
        comment_author_rss();
        ?>
コード例 #25
0
ファイル: tp-import.php プロジェクト: vinhnq1211/funy
     include_once TP_FRAMEWORK_LIBS_DIR . 'import/tp-import-class.php';
 }
 if (!is_file($import_filepath)) {
     $response = array('step' => 'check_demo_data_files', 'next' => '', 'return' => false, 'message' => 'The XML file containing the demo content is not available or could not be read in <pre>' . get_template_directory() . '</pre><br/> You might want to try to set the file permission to chmod 777.<br/>If this doesn\'t work please use the wordpress importer and import the XML file (should be located in your themes folder: dummy.xml) manually <a href="/wp-admin/import.php">here.</a>', 'logs' => ent2ncr($import_filepath) . ' not found');
     echo json_encode($response);
 } else {
     if (!isset($custom_export)) {
         $wp_import = new ob_wp_import();
         $type = $_REQUEST['type'];
         ob_start();
         switch (trim($type)) {
             case 'woo_setting':
                 if (is_file($import_woo_setting)) {
                     if (!$wp_import->import_woosetting($import_woo_setting)) {
                         ob_end_clean();
                         echo ent2ncr($return->get_error_message());
                         return;
                     }
                 }
                 $log = ob_get_clean();
                 $response = array('step' => 'woo_setting', 'next' => 'core', 'return' => true, 'message' => __('Import WooCommerce settings success', 'thim'), 'logs' => $log);
                 echo json_encode($response);
                 break;
             case 'core':
                 $wp_import->fetch_attachments = true;
                 if ($wp_import->import($import_filepath) == 0) {
                     $log = ob_get_clean();
                     $response = array('step' => 'core', 'next' => 'core', 'return' => true, 'message' => '', 'logs' => $log);
                     echo json_encode($response);
                     return;
                 }
コード例 #26
0
	$comment_post = get_post($comment->comment_post_ID);
	get_post_custom($comment_post->ID);
?>
	<item>
		<title><?php
			if ( !is_singular() ) {
				$title = get_the_title($comment_post->ID);
				$title = apply_filters('the_title_rss', $title);
				printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
			} else {
				printf(ent2ncr(__('By: %s')), get_comment_author_rss());
			}
		?></title>
		<link><?php comment_link() ?></link>
		<dc:creator><?php echo get_comment_author_rss() ?></dc:creator>
		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>
		<guid isPermaLink="false"><?php comment_guid() ?></guid>
<?php if ( post_password_required($comment_post) ) : ?>
		<description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
<?php else : // post pass ?>
		<description><?php comment_text_rss() ?></description>
		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
<?php endif; // post pass
	do_action('commentrss2_item', $comment->comment_ID, $comment_post->ID);
?>
	</item>
<?php endwhile; endif; ?>
</channel>
</rss>
コード例 #27
0
        echo get_comment_author_rss();
        ?>
</dc:creator>
		<pubDate><?php 
        echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false);
        ?>
</pubDate>
		<guid isPermaLink="false"><?php 
        comment_guid();
        ?>
</guid>
<?php 
        if (post_password_required($comment_post)) {
            ?>
		<description><?php 
            echo ent2ncr(__('Protected Comments: Please enter your password to view comments.'));
            ?>
</description>
		<content:encoded><![CDATA[<?php 
            echo get_the_password_form();
            ?>
]]></content:encoded>
<?php 
        } else {
            // post pass
            ?>
		<description><?php 
            comment_text_rss();
            ?>
</description>
		<content:encoded><![CDATA[<?php 
コード例 #28
0
ファイル: sitemaps.php プロジェクト: kanei/vantuch.cz
/**
 * Prints the news XML sitemap conforming to the Sitemaps.org protocol.
 * Outputs an XML list of up to 1000 posts published in the last 2 days.
 *
 * @module sitemaps
 *
 * @link http://sitemaps.org/protocol.php Sitemaps.org protocol.
 */
function jetpack_print_news_sitemap()
{
    $xml = get_transient('jetpack_news_sitemap');
    if ($xml) {
        header('Content-Type: application/xml');
        echo $xml;
        die;
    }
    global $wpdb, $post;
    /**
     * Filter post types to be included in news sitemap.
     *
     * @module sitemaps
     *
     * @since 3.9.0
     *
     * @param array $post_types Array with post types to include in news sitemap.
     */
    $post_types = apply_filters('jetpack_sitemap_news_sitemap_post_types', array('post'));
    if (empty($post_types)) {
        return;
    }
    $post_types_in = array();
    foreach ($post_types as $post_type) {
        $post_types_in[] = $wpdb->prepare('%s', $post_type);
    }
    $post_types_in_string = implode(', ', $post_types_in);
    /**
     * Filter limit of entries to include in news sitemap.
     *
     * @module sitemaps
     *
     * @since 3.9.0
     *
     * @param int $count Number of entries to include in news sitemap.
     */
    $limit = apply_filters('jetpack_sitemap_news_sitemap_count', 1000);
    $cur_datetime = current_time('mysql', true);
    $query = $wpdb->prepare("\n\t\tSELECT p.ID, p.post_title, p.post_type, p.post_date, p.post_name, p.post_date_gmt, GROUP_CONCAT(t.name SEPARATOR ', ') AS keywords\n\t\tFROM\n\t\t\t{$wpdb->posts} AS p LEFT JOIN {$wpdb->term_relationships} AS r ON p.ID = r.object_id\n\t\t\tLEFT JOIN {$wpdb->term_taxonomy} AS tt ON r.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'post_tag'\n\t\t\tLEFT JOIN {$wpdb->terms} AS t ON tt.term_id = t.term_id\n\t\tWHERE\n\t\t\tpost_status='publish' AND post_type IN ( {$post_types_in_string} ) AND post_date_gmt > (%s - INTERVAL 2 DAY)\n\t\tGROUP BY p.ID\n\t\tORDER BY p.post_date_gmt DESC LIMIT %d", $cur_datetime, $limit);
    // URL to XSLT
    $xsl = get_option('permalink_structure') ? home_url('news-sitemap.xsl') : home_url('/?jetpack-news-sitemap-xsl=true');
    // Unless it's zh-cn for Simplified Chinese or zh-tw for Traditional Chinese,
    // trim national variety so an ISO 639 language code as required by Google.
    $language_code = strtolower(get_locale());
    if (in_array($language_code, array('zh_tw', 'zh_cn'))) {
        $language_code = str_replace('_', '-', $language_code);
    } else {
        $language_code = preg_replace('/(_.*)$/i', '', $language_code);
    }
    header('Content-Type: application/xml');
    ob_start();
    echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
    echo '<?xml-stylesheet type="text/xsl" href="' . esc_url($xsl) . '"?>' . "\n";
    echo '<!-- generator="jetpack-' . JETPACK__VERSION . '" -->' . "\n";
    ?>
	<!-- generator="jetpack" -->
	<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
	        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
	        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
	        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
		>
		<?php 
    $posts = $wpdb->get_results($query);
    foreach ($posts as $post) {
        setup_postdata($post);
        /**
         * Filter condition to allow skipping specific posts in news sitemap.
         *
         * @module sitemaps
         *
         * @since 3.9.0
         *
         * @param bool $skip Current boolean. False by default, so no post is skipped.
         * @param WP_POST $post Current post object.
         */
        if (apply_filters('jetpack_sitemap_news_skip_post', false, $post)) {
            continue;
        }
        $GLOBALS['post'] = $post;
        $url = array();
        $url['loc'] = get_permalink($post->ID);
        $news = array();
        $news['news:publication']['news:name'] = get_bloginfo_rss('name');
        $news['news:publication']['news:language'] = $language_code;
        $news['news:publication_date'] = jetpack_w3cdate_from_mysql($post->post_date_gmt);
        $news['news:title'] = get_the_title_rss();
        if ($post->keywords) {
            $news['news:keywords'] = html_entity_decode(ent2ncr($post->keywords), ENT_HTML5);
        }
        $url['news:news'] = $news;
        // Add image to sitemap
        $post_thumbnail = Jetpack_PostImages::get_image($post->ID);
        if (isset($post_thumbnail['src'])) {
            $url['image:image'] = array('image:loc' => esc_url($post_thumbnail['src']));
        }
        /**
         * Filter associative array with data to build <url> node and its descendants for current post in news sitemap.
         *
         * @module sitemaps
         *
         * @since 3.9.0
         *
         * @param array $url Data to build parent and children nodes for current post.
         * @param int $post_id Current post ID.
         */
        $url = apply_filters('jetpack_sitemap_news_sitemap_item', $url, $post);
        if (empty($url)) {
            continue;
        }
        jetpack_print_sitemap_item($url);
    }
    wp_reset_postdata();
    ?>
	</urlset>
	<?php 
    $xml = ob_get_contents();
    ob_end_clean();
    if (!empty($xml)) {
        set_transient('jetpack_news_sitemap', $xml, DAY_IN_SECONDS);
        echo $xml;
    }
    die;
}
コード例 #29
0
/**
 * Universal Feed Loader
 * hooked function
 * supports custom settings
 * NOTE uses just-in-time initialization
 * @see     functions.php, feed-links include module
 * @uses    Universal Feed Writer class
 */
function tLoadFeed()
{
    global $tFeeds, $tCurrentFeed, $wp_query, $post;
    $tCurrentFeed = get_query_var('feed');
    // FB::trace($tCurrentFeed);
    if (empty($tCurrentFeed) || $tCurrentFeed == 'feed') {
        $tCurrentFeed = get_default_feed();
        # rss2
    }
    $args =& $tFeeds[$tCurrentFeed];
    $defaults = array('num_entries' => get_option('posts_per_rss'), 'do_images' => true, 'size_image' => 'large', 'feed_type' => defined('TFEED') ? TFEED : 'atom', 'feed_title' => 'Recent Posts', 'feed_description' => 'An unfiltered list limited to ' . $num_entries . ' posts');
    $args = apply_filters('t_load_feed_args', $args);
    $args = wp_parse_args($args, $defaults);
    # customizing default info
    if (is_category()) {
        $category = t_get_term_name(get_query_var('cat'), 'category');
        $args['feed_title'] = 'Feed for ' . $category;
        $args['feed_description'] = 'A list limited to ' . $args['num_entries'] . ' posts categorized under ' . $category;
    }
    if ($wp_query->is_comment_feed) {
        # comment feed
        if (is_singular()) {
            $args['feed_title'] = 'Recent comments on ' . get_the_title_rss();
        } elseif (is_search()) {
            $args['feed_title'] = 'Comments for search on ' . attribute_escape($wp_query->query_vars['s']);
        } else {
            $args['feed_title'] = 'Recent comments for ' . get_wp_title_rss();
        }
        $args['feed_title'] = ent2ncr($args['feed_title']);
        $args['feed_description'] = 'A list limited to ' . $args['num_entries'] . ' comments';
    }
    $args['query'] = tGetFeedQuery();
    if (is_array($args['query'])) {
        $args['query']['showposts'] =& $args['num_entries'];
    }
    if ($tCurrentFeed == 'rss' || $tCurrentFeed == 'rss2' || $tCurrentFeed == 'atom') {
        $args['feed_type'] = $tCurrentFeed;
    } else {
        $args['feed_title'] = ucwords(str_replace('_', ' ', $tCurrentFeed));
    }
    extract($args);
    # namespacing
    switch ($feed_type) {
        case 'rss2':
            $namespace = '
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 xmlns:atom="http://www.w3.org/2005/Atom"
                 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
                ';
            $feedType = RSS2;
            break;
        case 'rss':
            $namespace = '
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
                 xmlns:admin="http://webns.net/mvcb/"
                 xmlns:content="http://purl.org/rss/1.0/modules/content/"
                ';
            $feedType = RSS1;
            break;
        case 'atom':
        default:
            $namespace = '
                 xmlns:thr="http://purl.org/syndication/thread/1.0"
                 xml:lang="' . get_option('rss_language') . '"
                 xml:base="' . get_bloginfo_rss('url') . '"
                 ';
            $feedType = ATOM;
            break;
    }
    $GLOBALS['t_feed_ns'] = $namespace;
    # for use in FeedWriter
    add_filter('t_feed_ns', create_function('$default', 'return $default . $GLOBALS["t_feed_ns"];'));
    # start
    $feedWriter = new FeedWriter($feedType);
    require TDIR . TMODINC . 'feed-head.php';
    require TDIR . TMODINC . 'feed-body.php';
    # output
    $out = ob_get_contents();
    $out = str_replace(array("\n", "\r", "\t", ' '), '', $input);
    ob_end_clean();
    $feedWriter->generateFeed();
    // lifestream_rss_feed();
    // FB::info($args);
}
コード例 #30
0
ファイル: base.php プロジェクト: vinhnq1211/funy
            if ($show_social) {
                $html .= '<div class="social"><ul>';
                $html .= $face_url;
                $html .= $twitter_url;
                $html .= $rss_url;
                $html .= $skype_url;
                $html .= $dribbble_url;
                $html .= $linkedin_url;
                $html .= '</ul></div>';
            }
            $html .= '</div>';
        }
        $html .= ' 		<div class="info">';
        $html .= '			<div class="name">' . the_title(' ', ' ', false) . '</div>';
        $html .= $regency;
        $html .= $our_team_phone;
        $html .= $our_team_email;
        $html .= '		</div>';
        $html .= '	</div>';
        $html .= '</div>';
        if ($i % $instance['per_row'] == 0) {
            $html .= '<div class="clearfix"></div>';
        }
    }
    echo ent2ncr($html);
    ?>
		</div>
	</div>
<?php 
}
wp_reset_postdata();