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


PHP esc_html函数代码示例

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


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

示例1: cimy_um_download_database

function cimy_um_download_database()
{
    global $cum_upload_path;
    if (!empty($_POST["cimy_um_filename"])) {
        if (strpos($_SERVER['HTTP_REFERER'], admin_url('users.php?page=cimy_user_manager')) !== false) {
            // not whom we are expecting? exit!
            if (!check_admin_referer('cimy_um_download', 'cimy_um_downloadnonce')) {
                return;
            }
            $cimy_um_filename = $_POST["cimy_um_filename"];
            // sanitize the file name
            $cimy_um_filename = sanitize_file_name($cimy_um_filename);
            $cimy_um_fullpath_file = $cum_upload_path . $cimy_um_filename;
            // does not exist? exit!
            if (!is_file($cimy_um_fullpath_file)) {
                return;
            }
            header("Pragma: ");
            // Leave blank for issues with IE
            header("Expires: 0");
            header('Vary: User-Agent');
            header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
            header("Content-Type: text/csv");
            header("Content-Type: application/force-download");
            header("Content-Type: application/download");
            header("Content-Disposition: attachment; filename=\"" . esc_html($cimy_um_filename) . "\";");
            // cannot use esc_url any more because prepends 'http' (doh)
            header("Content-Transfer-Encoding: binary");
            header("Content-Length: " . filesize($cimy_um_fullpath_file));
            readfile($cimy_um_fullpath_file);
            exit;
        }
    }
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:34,代码来源:cimy_user_manager.php

示例2: square_posted_on

 /**
  * Prints HTML with meta information for the current post-date/time and author.
  */
 function square_posted_on()
 {
     $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
     if (get_the_time('U') !== get_the_modified_time('U')) {
         $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
     }
     $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date()));
     $posted_on = sprintf(esc_html_x('%s', 'post date', 'square'), '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">' . $time_string . '</a>');
     $byline = sprintf(esc_html_x('by %s', 'post author', 'square'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
     $comment_count = get_comments_number();
     // get_comments_number returns only a numeric value
     if (comments_open()) {
         if ($comment_count == 0) {
             $comments = __('No Comments', 'square');
         } elseif ($comment_count > 1) {
             $comments = $comment_count . __(' Comments', 'square');
         } else {
             $comments = __('1 Comment', 'square');
         }
         $comment_link = '<a href="' . get_comments_link() . '">' . $comments . '</a>';
     } else {
         $comment_link = __(' Comment Closed', 'square');
     }
     echo '<span class="posted-on"><i class="fa fa-clock-o"></i>' . $posted_on . '</span><span class="byline"> ' . $byline . '</span><span class="comment-count"><i class="fa fa-comments-o"></i>' . $comment_link . "</span>";
     // WPCS: XSS OK.
 }
开发者ID:jgcopple,项目名称:drgaryschwantz,代码行数:29,代码来源:template-tags.php

示例3: render_content

        public function render_content()
        {
            $args = array('orderby' => $this->orderby, 'order' => $this->order, 'taxonomy' => $this->taxonomy, 'hide_empty' => $this->hide_empty ? '1' : '0');
            $categories = get_categories($args);
            ?>
			<label>
				<span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
				<select <?php 
            $this->link();
            ?>
>
					<?php 
            // The default value (nothing is selected)
            printf("<option value='%s' %s>%s</option>", '0', selected($this->value(), '0', false), '— ' . __('Select', PARADOX_TF_I18NDOMAIN) . ' —');
            // Print all the other pages
            foreach ($categories as $category) {
                printf("<option value='%s' %s>%s</option>", esc_attr($category->term_id), selected($this->value(), $category->term_id, false), $category->name . ($this->show_count ? ' (' . $category->count . ')' : ''));
            }
            ?>
				</select>
			</label>
			<?php 
            echo "<p class='description'>{$this->description}</p>";
        }
开发者ID:AndyMarkle,项目名称:rocket,代码行数:27,代码来源:class-option-select-categories.php

示例4: get_terms_for_site

 /**
  * Return the terms for the given type.
  *
  * @param int $site_id Blog ID.
  *
  * @return array
  */
 public function get_terms_for_site($site_id)
 {
     $out = [];
     switch_to_blog($site_id);
     $taxonomy_object = get_taxonomy($this->taxonomy_name);
     if (!current_user_can($taxonomy_object->cap->edit_terms)) {
         $terms = [];
     } else {
         $terms = get_terms($this->taxonomy_name, ['hide_empty' => FALSE]);
     }
     foreach ($terms as $term) {
         if (is_taxonomy_hierarchical($this->taxonomy_name)) {
             $ancestors = get_ancestors($term->term_id, $this->taxonomy_name);
             if (!empty($ancestors)) {
                 foreach ($ancestors as $ancestor) {
                     $parent_term = get_term($ancestor, $this->taxonomy_name);
                     $term->name = $parent_term->name . '/' . $term->name;
                 }
             }
         }
         $out[$term->term_taxonomy_id] = esc_html($term->name);
     }
     restore_current_blog();
     uasort($out, 'strcasecmp');
     return $out;
 }
开发者ID:inpsyde,项目名称:multilingual-press,代码行数:33,代码来源:Mlp_Term_Translation_Presenter.php

示例5: render_content

    /**
     * Render the content on the theme customizer page
     */
    public function render_content()
    {
        if (!empty($this->menus)) {
            ?>
                <label>
                    <span class="customize-menu-dropdown"><?php 
            echo esc_html($this->label);
            ?>
</span>
                    <select name="<?php 
            echo $this->id;
            ?>
" id="<?php 
            echo $this->id;
            ?>
">
                    <?php 
            foreach ($this->menus as $menu) {
                printf('<option value="%s" %s>%s</option>', $menu->term_id, selected($this->value(), $menu->term_id, false), $menu->name);
            }
            ?>
                    </select>
                </label>
            <?php 
        }
    }
开发者ID:lucatume,项目名称:wp-customizer,代码行数:29,代码来源:paulund_MenuDropdownCustomControl.php

示例6: get_value

 /**
  * @see CPAC_Column::get_value()
  * @since 2.0
  */
 function get_value($post_id)
 {
     if (!($format = $this->get_raw_value($post_id))) {
         return false;
     }
     return esc_html(get_post_format_string($format));
 }
开发者ID:OneTimeUser,项目名称:retailwire,代码行数:11,代码来源:formats.php

示例7: display_region_drop_down

    public function display_region_drop_down()
    {
        $base_region = get_option('base_region');
        if (!empty($this->regions)) {
            ?>
				<select name='wpmlm_options[base_region]'>
					<?php 
            foreach ($this->regions as $region) {
                ?>
						<option value='<?php 
                echo esc_attr($region->id);
                ?>
' <?php 
                selected($region->id, $base_region);
                ?>
><?php 
                echo esc_html($region->name);
                ?>
</option>
					<?php 
            }
            ?>
				</select>
			<?php 
        }
    }
开发者ID:juano2h,项目名称:binary-mlm-ecommerce,代码行数:26,代码来源:general.php

示例8: showgallery

function showgallery()
{
    global $wpdb;
    $limit = 0;
    if (isset($_POST['search_events_by_title'])) {
        $search_tag = esc_html(stripslashes($_POST['search_events_by_title']));
        $search_tag = sanitize_text_field($search_tag);
    } else {
        $search_tag = '';
    }
    $cat_row_query = "SELECT id,name FROM " . $wpdb->prefix . "huge_itgallery_gallerys WHERE sl_width=0";
    $cat_row = $wpdb->get_results($cat_row_query);
    $query = $wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->prefix . "huge_itgallery_gallerys WHERE name LIKE %s", "%{$search_tag}}%");
    $total = $wpdb->get_var($query);
    $query = $wpdb->prepare("SELECT  a.* ,  COUNT(b.id) AS count, g.par_name AS par_name FROM " . $wpdb->prefix . "huge_itgallery_gallerys  AS a LEFT JOIN " . $wpdb->prefix . "huge_itgallery_gallerys AS b ON a.id = b.sl_width \nLEFT JOIN (SELECT  " . $wpdb->prefix . "huge_itgallery_gallerys.ordering as ordering," . $wpdb->prefix . "huge_itgallery_gallerys.id AS id, COUNT( " . $wpdb->prefix . "huge_itgallery_images.gallery_id ) AS prod_count\nFROM " . $wpdb->prefix . "huge_itgallery_images, " . $wpdb->prefix . "huge_itgallery_gallerys\nWHERE " . $wpdb->prefix . "huge_itgallery_images.gallery_id = " . $wpdb->prefix . "huge_itgallery_gallerys.id\nGROUP BY " . $wpdb->prefix . "huge_itgallery_images.gallery_id) AS c ON c.id = a.id LEFT JOIN\n(SELECT " . $wpdb->prefix . "huge_itgallery_gallerys.name AS par_name," . $wpdb->prefix . "huge_itgallery_gallerys.id FROM " . $wpdb->prefix . "huge_itgallery_gallerys) AS g\n ON a.sl_width=g.id WHERE a.name LIKE %s  group by a.id  ", "%" . $search_tag . "%");
    $rows = $wpdb->get_results($query);
    $rows = open_cat_in_tree($rows);
    $query = "SELECT  " . $wpdb->prefix . "huge_itgallery_gallerys.ordering," . $wpdb->prefix . "huge_itgallery_gallerys.id, COUNT( " . $wpdb->prefix . "huge_itgallery_images.gallery_id ) AS prod_count\nFROM " . $wpdb->prefix . "huge_itgallery_images, " . $wpdb->prefix . "huge_itgallery_gallerys\nWHERE " . $wpdb->prefix . "huge_itgallery_images.gallery_id = " . $wpdb->prefix . "huge_itgallery_gallerys.id\nGROUP BY " . $wpdb->prefix . "huge_itgallery_images.gallery_id ";
    $prod_rows = $wpdb->get_results($query);
    foreach ($rows as $row) {
        foreach ($prod_rows as $row_1) {
            if ($row->id == $row_1->id) {
                $row->ordering = $row_1->ordering;
                $row->prod_count = $row_1->prod_count;
            }
        }
    }
    $pageNav = '';
    $sort = '';
    $cat_row = open_cat_in_tree($cat_row);
    html_showgallerys($rows, $pageNav, $sort, $cat_row);
}
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:32,代码来源:gallery_func.php

示例9: render_content

        public function render_content()
        {
            ?>
				<label>
					<span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
					<?php 
            if (!empty($this->description)) {
                ?>
						<span class="description customize-control-description"><?php 
                echo $this->description;
                ?>
</span>
					<?php 
            }
            ?>
				</label>
					
			<?php 
            echo '<div class="zerowp-customizer-fonts-block">';
            echo '<div class="zerowp-customizer-show-selected-font"><div class="zerowp-customizer-font-item"></div></div>
				<div class="zerowp-customizer-fonts">
					<input type="text" class="zerowp-customizer-fonts-search-field" placeholder="' . __('Search font', 'zerowp_customizer_local') . '" />
					<input type="hidden" class="zerowp-customizer-fonts-value" ' . $this->get_link() . ' ' . $this->value() . ' />' . $this->fontsList() . '</div>
			</div>';
        }
开发者ID:ZeroWP,项目名称:Customizer,代码行数:28,代码来源:control.class.php

示例10: genesis_search_form

/**
 * Replace the default search form with a Genesis-specific form.
 *
 * The exact output depends on whether the child theme supports HTML5 or not.
 *
 * Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
 * `genesis_search_form` filters.
 *
 * @since 0.2.0
 *
 * @uses genesis_html5() Check for HTML5 support.
 *
 * @return string HTML markup.
 */
function genesis_search_form()
{
    $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis') . ' &#x02026;');
    $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis'));
    $onfocus = "if ('" . esc_js($search_text) . "' === this.value) {this.value = '';}";
    $onblur = "if ('' === this.value) {this.value = '" . esc_js($search_text) . "';}";
    //* Empty label, by default. Filterable.
    $label = apply_filters('genesis_search_form_label', '');
    $value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value';
    if (genesis_html5()) {
        $form = sprintf('<form %s>', genesis_attr('search-form'));
        if (genesis_a11y('search-form')) {
            if ('' == $label) {
                $label = apply_filters('genesis_search_text', __('Search this website', 'genesis'));
            }
            $form_id = uniqid('searchform-');
            $form .= sprintf('<meta itemprop="target" content="%s"/><label class="search-form-label screen-reader-text" for="%s">%s</label><input itemprop="query-input" type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>', home_url('/?s={s}'), esc_attr($form_id), esc_html($label), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        } else {
            $form .= sprintf('%s<meta itemprop="target" content="%s"/><input itemprop="query-input" type="search" name="s" %s="%s" /><input type="submit" value="%s"  /></form>', esc_html($label), home_url('/?s={s}'), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
        }
    } else {
        $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', home_url('/'), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text));
    }
    return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label);
}
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:39,代码来源:search.php

示例11: execute

 public function execute()
 {
     $type = isset($_GET['type']) ? esc_html($_GET['type']) : 'display';
     $edit_type = isset($_GET['edit_type']) ? esc_html($_GET['edit_type']) : '';
     $image_id = isset($_GET['image_id']) ? esc_html($_GET['image_id']) : 0;
     $this->display($type);
 }
开发者ID:a-i-ko93,项目名称:ipl-foodblog,代码行数:7,代码来源:BWGControllerEditThumb.php

示例12: create_fields

        public static function create_fields($ops = array(), $options = array())
        {
            foreach ($ops as $k => $v) {
                if (!isset($v['type'])) {
                    continue;
                }
                switch ($v['type']) {
                    case 'select':
                        break;
                    default:
                        $output = '<input type="text" name="' . esc_attr($k) . '" id="' . esc_attr($k) . '" />';
                }
                ?>
				<tr valign="top">
					<th scope="row"><label for="<?php 
                echo esc_attr($k);
                ?>
"><?php 
                echo esc_html($v['label']);
                ?>
</label></th>
					<td class="forminp forminp-text">
						<?php 
                echo $output;
                ?>
					</td>
				</tr>
				<?php 
            }
        }
开发者ID:kinhdon2011,项目名称:nexthemes-plugins,代码行数:30,代码来源:class-nth-admin-templ.php

示例13: render_content

        public function render_content()
        {
            ?>
			<label>
				<span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
				<select <?php 
            $this->link();
            ?>
>
					<?php 
            foreach ($this->choices as $value => $label) {
                ?>
<optgroup label="<?php 
                echo $value;
                ?>
"><?php 
                foreach ($label as $subValue => $subLabel) {
                    printf("<option value=\"%s\" %s>%s</option>", esc_attr($subValue), selected($this->value(), $subValue, false), $subLabel);
                }
                ?>
</optgroup><?php 
            }
            ?>
				</select>
			</label>
			<?php 
            echo "<p class='description'>{$this->description}</p>";
        }
开发者ID:banna360,项目名称:genietheme-responsive,代码行数:31,代码来源:class-option-select.php

示例14: display_seller_review

 /**
  * Displaying Prodcuts
  *
  * Does prepare the data for displaying the products in the table.
  */
 function display_seller_review()
 {
     $data = array();
     $prefix = FARMTOYOU_META_PREFIX;
     //if search is call then pass searching value to function for displaying searching values
     $args = array('post_type' => FARMTOYOU_SELLER_REVIEW_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => '-1');
     //get seller_review data from database
     $all_seller_review = get_posts($args);
     foreach ($all_seller_review as $key => $value) {
         $seller_id = get_post_meta($value->ID, $prefix . 'seller_id', true);
         $store_info = dokan_get_store_info($seller_id);
         $store_name = isset($store_info['store_name']) ? esc_html($store_info['store_name']) : __('N/A', 'dokan');
         $curr_user_id = get_post_meta($value->ID, $prefix . 'current_user_id', true);
         $user_info = get_userdata($curr_user_id);
         $first_name = $user_info->first_name;
         $last_name = $user_info->last_name;
         $user_email = $user_info->user_email;
         $data[$key]['ID'] = isset($value->ID) ? $value->ID : '';
         $data[$key]['seller_store'] = $store_name;
         $data[$key]['curr_user_name'] = $first_name . " " . $last_name;
         $data[$key]['curr_user_email'] = $user_email;
         $data[$key]['user_rating'] = get_post_meta($value->ID, $prefix . 'seller_rating', true);
         $data[$key]['user_comment'] = get_post_meta($value->ID, $prefix . 'user_comment', true);
         $data[$key]['post_status'] = isset($value->post_status) ? $value->post_status : '';
         $data[$key]['post_date'] = isset($value->post_date) ? $value->post_date : '';
     }
     return $data;
 }
开发者ID:abcode619,项目名称:wpstuff,代码行数:33,代码来源:custom-seller-review.php

示例15: validateXml

 /**
  * Validate XML to be valid for import
  * @param string $xml
  * @param WP_Error[optional] $errors
  * @return bool Validation status
  */
 public static function validateXml(&$xml, $errors = NULL)
 {
     if (FALSE === $xml or '' == $xml) {
         $errors and $errors->add('form-validation', __('WP All Import can\'t read your file.<br/><br/>Probably, you are trying to import an invalid XML feed. Try opening the XML feed in a web browser (Google Chrome is recommended for opening XML files) to see if there is an error message.<br/>Alternatively, run the feed through a validator: http://validator.w3.org/<br/>99% of the time, the reason for this error is because your XML feed isn\'t valid.<br/>If you are 100% sure you are importing a valid XML feed, please contact WP All Import support.', 'wp_all_import_plugin'));
     } else {
         PMXI_Import_Record::preprocessXml($xml);
         if (function_exists('simplexml_load_string')) {
             libxml_use_internal_errors(true);
             libxml_clear_errors();
             $_x = @simplexml_load_string($xml);
             $xml_errors = libxml_get_errors();
             libxml_clear_errors();
             if ($xml_errors) {
                 $error_msg = '<strong>' . __('Invalid XML', 'wp_all_import_plugin') . '</strong><ul>';
                 foreach ($xml_errors as $error) {
                     $error_msg .= '<li>';
                     $error_msg .= __('Line', 'wp_all_import_plugin') . ' ' . $error->line . ', ';
                     $error_msg .= __('Column', 'wp_all_import_plugin') . ' ' . $error->column . ', ';
                     $error_msg .= __('Code', 'wp_all_import_plugin') . ' ' . $error->code . ': ';
                     $error_msg .= '<em>' . trim(esc_html($error->message)) . '</em>';
                     $error_msg .= '</li>';
                 }
                 $error_msg .= '</ul>';
                 $errors and $errors->add('form-validation', $error_msg);
             } else {
                 return true;
             }
         } else {
             $errors and $errors->add('form-validation', __('Required PHP components are missing.', 'wp_all_import_plugin'));
             $errors and $errors->add('form-validation', __('WP All Import requires the SimpleXML PHP module to be installed. This is a standard feature of PHP, and is necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the SimpleXML PHP module.', 'wp_all_import_plugin'));
         }
     }
     return false;
 }
开发者ID:k-hasan-19,项目名称:wp-all-import,代码行数:40,代码来源:record.php


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