当前位置: 首页>>代码示例>>PHP>>正文


PHP ent2ncr函数代码示例

本文整理汇总了PHP中ent2ncr函数的典型用法代码示例。如果您正苦于以下问题:PHP ent2ncr函数的具体用法?PHP ent2ncr怎么用?PHP ent2ncr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ent2ncr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: podPress_feedSafeContent

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;
}
开发者ID:niko-lgdcom,项目名称:archives,代码行数:29,代码来源:podpress_feed_functions.php

示例2: livePreview

    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 
    }
开发者ID:vinhnq1211,项目名称:funy,代码行数:32,代码来源:thim-class-customizer-section.php

示例3: display

    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;
    }
开发者ID:vinhnq1211,项目名称:funy,代码行数:34,代码来源:class-option-color-opacity.php

示例4: display

    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);
    }
开发者ID:vinhnq1211,项目名称:funy,代码行数:27,代码来源:class-option-checkbox.php

示例5: em_rss

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;
    }
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:58,代码来源:em-rss.php

示例6: jd_draw_template

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));
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:56,代码来源:my-calendar-templates.php

示例7: generate_sitemap

 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");
     }
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:53,代码来源:wds-sitemaps.php

示例8: rsscloud_notify_result

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;
}
开发者ID:voitto,项目名称:dbscript,代码行数:13,代码来源:rsscloud.php

示例9: the_excerpt_rss

 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;
 }
开发者ID:hscale,项目名称:webento,代码行数:13,代码来源:em-event-post.php

示例10: jd_draw_template

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));
}
开发者ID:newmight2015,项目名称:psmpsm,代码行数:51,代码来源:my-calendar-templates.php

示例11: franz_title

/**
 * 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)));
}
开发者ID:ravitechrlabs,项目名称:wordpress,代码行数:18,代码来源:head.php

示例12: wpi_get_author_name

/**
 *  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);
}
开发者ID:Creativebq,项目名称:wp-istalker,代码行数:54,代码来源:author.php

示例13: display

    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 
    }
开发者ID:vinhnq1211,项目名称:funy,代码行数:49,代码来源:class-option-save.php

示例14: wp_title_rss_filter

 /**
  * 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;
 }
开发者ID:part-time-project,项目名称:italians,代码行数:19,代码来源:TF_SEO.php

示例15: thim_customizer_export_theme_settings

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;
}
开发者ID:vinhnq1211,项目名称:funy,代码行数:17,代码来源:export-settings.php


注:本文中的ent2ncr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。