本文整理汇总了PHP中utf8_uri_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_uri_encode函数的具体用法?PHP utf8_uri_encode怎么用?PHP utf8_uri_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_uri_encode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: VietCoding_sanitize_title_with_dashes
function VietCoding_sanitize_title_with_dashes($title)
{
$title = vi2en($title);
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
$title = remove_accents($title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 200);
}
$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
$title = str_replace('.', '-', $title);
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
$title = vi2en($title);
return $title;
}
开发者ID:xuandungpy,项目名称:vuong,代码行数:28,代码来源:WP-Vietnamese-URL.php
示例2: format_uri
/**
* Format URI
*
* Formats a category uri.
*
* @param string $cat_uri The uri name
* @uses check_uri
* @uses remove_accents
* @uses seems_utf8
* @uses utf8_uri_encode
* @uses format_uri
* @return string A cleaned uri
*/
function format_uri($cat_uri, $i = 0, $cat_id = false)
{
$cat_uri = strip_tags($cat_uri);
// Preserve escaped octets.
$cat_uri = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $cat_uri);
// Remove percent signs that are not part of an octet.
$cat_uri = str_replace('%', '', $cat_uri);
// Restore octets.
$cat_uri = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $cat_uri);
$cat_uri = remove_accents($cat_uri);
if (seems_utf8($cat_uri)) {
if (function_exists('mb_strtolower')) {
$cat_uri = mb_strtolower($cat_uri, 'UTF-8');
}
$cat_uri = utf8_uri_encode($cat_uri, 200);
}
$cat_uri = strtolower($cat_uri);
$cat_uri = preg_replace('/&.+?;/', '', $cat_uri);
// kill entities
$cat_uri = preg_replace('/[^%a-z0-9 _-]/', '', $cat_uri);
$cat_uri = preg_replace('/\\s+/', '-', $cat_uri);
$cat_uri = preg_replace('|-+|', '-', $cat_uri);
$cat_uri = trim($cat_uri, '-');
if ($i > 0) {
$cat_uri = $cat_uri . "-" . $i;
}
if (!$this->check_uri($cat_uri, $cat_id)) {
$i++;
$cat_uri = $this->format_uri($cat_uri, $i);
}
return $cat_uri;
}
开发者ID:thanhtq00103,项目名称:QLBH,代码行数:45,代码来源:download_link_model.php
示例3: sanitize_title_with_accented
function sanitize_title_with_accented($title, $raw_title = '', $context = 'display')
{
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 1000);
}
$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
$title = str_replace('.', '-', $title);
if ('save' == $context) {
// Convert nbsp, ndash and mdash to hyphens
$title = str_replace(array('%c2%a0', '%e2%80%93', '%e2%80%94'), '-', $title);
// Strip these characters entirely
$title = str_replace(array('%c2%a1', '%c2%bf', '%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba', '%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d', '%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f', '%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2', '%c2%b4', '%cb%8a', '%cc%81', '%cd%81', '%cc%80', '%cc%84', '%cc%8c'), '', $title);
// Convert times to x
$title = str_replace('%c3%97', 'x', $title);
}
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return urldecode($title);
}
开发者ID:hoamaisoft,项目名称:hoamai-cms-beta-1.0,代码行数:33,代码来源:string.php
示例4: update_bc_video
/**
* Updates Metadata to the Brightcove API
*
* @param array $sanitized_post_data . This should be sanitized POST data
*
* @return bool|WP_Error
*/
public function update_bc_video($sanitized_post_data)
{
global $bc_accounts;
$video_id = BC_Utility::sanitize_id($sanitized_post_data['video_id']);
if (array_key_exists('name', $sanitized_post_data) && '' !== $sanitized_post_data['name']) {
$update_data['name'] = utf8_uri_encode(sanitize_text_field($sanitized_post_data['name']));
}
if (array_key_exists('description', $sanitized_post_data) && !empty($sanitized_post_data['description'])) {
$update_data['description'] = BC_Utility::sanitize_payload_item($sanitized_post_data['description']);
}
if (array_key_exists('long_description', $sanitized_post_data) && !empty($sanitized_post_data['long_description'])) {
$update_data['long_description'] = BC_Utility::sanitize_payload_item($sanitized_post_data['long_description']);
}
if (array_key_exists('tags', $sanitized_post_data) && !empty($sanitized_post_data['tags'])) {
// Convert tags string to an array.
$update_data['tags'] = array_map('trim', explode(',', $sanitized_post_data['tags']));
}
$bc_accounts->set_current_account($sanitized_post_data['account']);
$request = $this->cms_api->video_update($video_id, $update_data);
$bc_accounts->restore_default_account();
/**
* If we had any tags in the update, add them to the tags collection if we don't already track them.
*/
if (array_key_exists('tags', $update_data) && is_array($update_data['tags']) && count($update_data['tags'])) {
$existing_tags = $this->tags->get_tags();
$new_tags = array_diff($update_data['tags'], $existing_tags);
if (count($new_tags)) {
$this->tags->add_tags($new_tags);
}
}
if (is_wp_error($request) || $request === false) {
return false;
}
return true;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:42,代码来源:class-bc-videos.php
示例5: update_bc_playlist
/**
* Updates Metadata to the Brightcove API
*
* @param array $sanitized_post_data This should be sanitized POST data.
*
* @return bool|WP_Error
*/
public function update_bc_playlist($sanitized_post_data)
{
global $bc_accounts;
if (!wp_verify_nonce($_POST['nonce'], '_bc_ajax_search_nonce')) {
return false;
}
$playlist_id = BC_Utility::sanitize_id($sanitized_post_data['playlist_id']);
$update_data = array('type' => 'EXPLICIT');
if (array_key_exists('name', $sanitized_post_data) && '' !== $sanitized_post_data['name']) {
$update_data['name'] = utf8_uri_encode(sanitize_text_field($sanitized_post_data['name']));
}
if (array_key_exists('playlist_videos', $sanitized_post_data) && !empty($sanitized_post_data['playlist_videos'])) {
$update_data['video_ids'] = BC_Utility::sanitize_payload_item($sanitized_post_data['playlist_videos']);
}
$bc_accounts->set_current_account($sanitized_post_data['account']);
$request = $this->cms_api->playlist_update($playlist_id, $update_data);
$bc_accounts->restore_default_account();
if (is_wp_error($request) || false === $request) {
return false;
}
if (is_array($request) && isset($request['id'])) {
return true;
}
return true;
}
开发者ID:10up,项目名称:brightcove-video-connect,代码行数:32,代码来源:class-bc-playlists.php
示例6: update_bc_playlist
/**
* Updates Metadata to the Brightcove API
*
* @param array $sanitized_post_data . This should be sanitized POST data
*
* @return bool|WP_Error
*/
public function update_bc_playlist($sanitized_post_data)
{
global $bc_accounts;
if (!wp_verify_nonce($_POST['nonce'], '_bc_ajax_search_nonce')) {
return false;
}
$playlist_id = BC_Utility::sanitize_id($sanitized_post_data['playlist_id']);
$update_data = array('type' => 'EXPLICIT');
if (array_key_exists('name', $sanitized_post_data) && '' !== $sanitized_post_data['name']) {
$update_data['name'] = utf8_uri_encode(sanitize_text_field($sanitized_post_data['name']));
}
if (array_key_exists('playlist_videos', $sanitized_post_data) && !empty($sanitized_post_data['playlist_videos'])) {
$update_data['video_ids'] = BC_Utility::sanitize_payload_item($sanitized_post_data['playlist_videos']);
}
$bc_accounts->set_current_account($sanitized_post_data['account']);
$request = $this->cms_api->playlist_update($playlist_id, $update_data);
$bc_accounts->restore_default_account();
if (is_wp_error($request) || $request === false) {
return false;
}
if (is_array($request) && isset($request['id'])) {
if (true === $this->add_or_update_wp_playlist($request)) {
return true;
}
$error_message = esc_html__('The Playlist failed to sync with WordPress', 'brightcove');
BC_Logging::log(sprintf('WORDPRESS PLAYLIST SYNC: %s', $error_message));
return new WP_Error('playlist-wp-sync-error', $error_message);
}
return true;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:37,代码来源:class-bc-playlists.php
示例7: st_auto_post_slug
/**
* WordPress の投稿スラッグを自動的に生成する
*/
function st_auto_post_slug($slug, $post_ID, $post_status, $post_type)
{
if (preg_match('/(%[0-9a-f]{2})+/', $slug)) {
$slug = utf8_uri_encode($post_type) . '-' . $post_ID;
}
return $slug;
}
开发者ID:curogihu,项目名称:ModifyWordPress,代码行数:10,代码来源:functions.php
示例8: cf_sanitize_ids
function cf_sanitize_ids($t)
{
$t = strip_tags($t);
$t = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $t);
$t = str_replace('%', '', $t);
$t = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $t);
$t = remove_accents($t);
if (seems_utf8($t)) {
$t = utf8_uri_encode($t, 200);
}
$t = preg_replace('/&.+?;/', '', $t);
// kill entities
$t = preg_replace('/\\s+/', '-', $t);
$t = preg_replace('|-+|', '-', $t);
$t = preg_replace("|'|", '-', $t);
$t = trim($t, '-');
$t = str_replace('[', '', $t);
$t = str_replace(']', '', $t);
return $t;
}
开发者ID:nvvetal,项目名称:water,代码行数:20,代码来源:lib_aux.php
示例9: slugify
/**
* Slugify title, replacing whitespace and a few other characters with dashes.
*
* Limits the output to alphanumeric characters, underscore (_) and dash (-).
* Whitespace becomes a dash.
*
*
* @param string $title The title to be sanitized.
* @param string $raw_title Optional. Not used.
* @param string $context Optional. The operation for which the string is sanitized.
* @return string The sanitized title.
*/
function slugify($title, $raw_title = '', $context = 'display')
{
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 200);
}
$title = strtolower($title);
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
$title = str_replace('.', '-', $title);
if ('save' == $context) {
// nbsp, ndash and mdash
$title = str_replace(array('%c2%a0', '%e2%80%93', '%e2%80%94'), '-', $title);
// iexcl and iquest
$title = str_replace(array('%c2%a1', '%c2%bf'), '', $title);
// angle quotes
$title = str_replace(array('%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba'), '', $title);
// curly quotes
$title = str_replace(array('%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d'), '', $title);
// copy, reg, deg, hellip and trade
$title = str_replace(array('%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2'), '', $title);
}
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return $title;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:49,代码来源:SluggerHelper.php
示例10: ita_sanitize_title
function ita_sanitize_title($title)
{
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
$title = remove_accents($title);
if (seems_utf8($title)) {
$title = utf8_uri_encode($title, 200);
}
$title = preg_replace('/&.+?;/', '', $title);
// kill entities
$title = preg_replace('/[^%a-zA-Z0-9 ()_-]/', '', $title);
$title = preg_replace('/\\s+/', '_', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return $title;
}
开发者ID:Ruxton,项目名称:iTALM,代码行数:21,代码来源:itunes-affiliate.php
示例11: get_avatar_url
function get_avatar_url($user_id)
{
$avatar = get_avatar($user_id);
if (preg_match("/src=['\"](.*?)['\"]/i", $avatar, $matches)) {
return utf8_uri_encode($matches[1]);
}
}
开发者ID:sitepoint,项目名称:wp-discourse,代码行数:7,代码来源:discourse.php
示例12: do_action
<?php
}
/* xmlsf_news_tags_after action hook */
do_action('xmlsf_news_tags_after');
?>
</news:news>
<?php
if (!empty($options['image']) && $xmlsf->get_images('news')) {
foreach ($xmlsf->get_images() as $image) {
if (empty($image['loc'])) {
continue;
}
?>
<image:image>
<image:loc><?php
echo utf8_uri_encode($image['loc']);
?>
</image:loc>
<?php
if (!empty($image['title'])) {
?>
<image:title><![CDATA[<?php
echo str_replace(']]>', ']]>', $image['title']);
?>
]]></image:title>
<?php
}
if (!empty($image['caption'])) {
?>
<image:caption><![CDATA[<?php
echo str_replace(']]>', ']]>', $image['caption']);
开发者ID:ashenkar,项目名称:sanga,代码行数:31,代码来源:feed-sitemap-news.php
示例13: location_query_arg
function location_query_arg($link)
{
if (isset($_GET['location']) && $_GET['location']) {
$link = add_query_arg('location', urlencode(utf8_uri_encode($_GET['location'])), $link);
}
return $link;
}
开发者ID:besimhu,项目名称:legacy,代码行数:7,代码来源:theme-functions.php
示例14: test_output_is_not_longer_than_optional_length_argument
/**
* @dataProvider data
*/
function test_output_is_not_longer_than_optional_length_argument($utf8, $unused_for_this_test)
{
$max_length = 30;
$this->assertTrue(strlen(utf8_uri_encode($utf8, $max_length)) <= $max_length);
}
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:8,代码来源:Utf8UriEncode.php
示例15: _truncate_post_slug
/**
* Truncate a post slug.
*
* @since 3.6.0
* @access private
*
* @see utf8_uri_encode()
*
* @param string $slug The slug to truncate.
* @param int $length Optional. Max length of the slug. Default 200 (characters).
* @return string The truncated slug.
*/
function _truncate_post_slug($slug, $length = 200)
{
if (strlen($slug) > $length) {
$decoded_slug = urldecode($slug);
if ($decoded_slug === $slug) {
$slug = substr($slug, 0, $length);
} else {
$slug = utf8_uri_encode($decoded_slug, $length);
}
}
return rtrim($slug, '-');
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:24,代码来源:post.php
示例16: sanitize_title_with_dashes
/**
* Sanitizes a title, replacing whitespace and a few other characters with dashes.
*
* Limits the output to alphanumeric characters, underscore (_) and dash (-).
* Whitespace becomes a dash.
*
* @since 1.2.0
*
* @param string $title The title to be sanitized.
* @param string $raw_title Optional. Not used.
* @param string $context Optional. The operation for which the string is sanitized.
* @return string The sanitized title.
*/
function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
// Remove percent signs that are not part of an octet.
$title = str_replace('%', '', $title);
// Restore octets.
$title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
if (seems_utf8($title)) {
if (function_exists('mb_strtolower')) {
$title = mb_strtolower($title, 'UTF-8');
}
$title = utf8_uri_encode($title, 200);
}
$title = strtolower($title);
if ( 'save' == $context ) {
// Convert nbsp, ndash and mdash to hyphens
$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
// Convert nbsp, ndash and mdash HTML entities to hyphens
$title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title );
// Strip these characters entirely
$title = str_replace( array(
// iexcl and iquest
'%c2%a1', '%c2%bf',
// angle quotes
'%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
// curly quotes
'%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
'%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
// copy, reg, deg, hellip and trade
'%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
// acute accents
'%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
// grave accent, macron, caron
'%cc%80', '%cc%84', '%cc%8c',
), '', $title );
// Convert times to x
$title = str_replace( '%c3%97', 'x', $title );
}
$title = preg_replace('/&.+?;/', '', $title); // kill entities
$title = str_replace('.', '-', $title);
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
$title = preg_replace('/\s+/', '-', $title);
$title = preg_replace('|-+|', '-', $title);
$title = trim($title, '-');
return $title;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:68,代码来源:formatting.php
示例17: utf8_uri_encode
<?php
include "../../../wp-config.php";
//$callback = (!empty($_SESSION['wp_url_bind'])) ? $_SESSION['wp_url_bind'] : $_SESSION['wp_url_back'];
//if (!$callback) {
if (isset($_GET['redirect_url'])) {
$callback = utf8_uri_encode($_GET['redirect_url']);
} else {
$callback = get_bloginfo('url');
}
//}
if ($_GET['dl_type'] == 'create') {
$callback = admin_url('options-general.php?page=wp-connect#basic');
}
header('Location:' . $callback);
开发者ID:xxf1995,项目名称:alphaV,代码行数:15,代码来源:denglu.php
示例18: init_filters
function init_filters($filters)
{
foreach ($filters as $filter_name) {
$this->filters[$filter_name] = array();
$taxonomy_types = array("tag", "category", "taxonomy");
$this->filters[$filter_name]['type'] = "choice";
if (in_array($this->form_fields[$filter_name]["type"], $taxonomy_types)) {
$this->filters[$filter_name]['source'] = "taxonomy";
if (strpos($filter_name, SF_TAX_PRE) === 0) {
$taxonomy_name = substr($filter_name, strlen(SF_TAX_PRE));
$this->filters[$filter_name]['taxonomy_name'] = $taxonomy_name;
$this->filters[$filter_name]['type'] = "choice";
}
} else {
if ($this->form_fields[$filter_name]["type"] == "post_meta") {
$this->filters[$filter_name]['source'] = "post_meta";
$this->filters[$filter_name]['type'] = $this->form_fields[$filter_name]["meta_type"];
}
}
$this->filters[$filter_name]['cached_result_ids'] = array();
//these are all the result IDs for the whole field/filter (combining all IDs from terms)
$this->filters[$filter_name]['wp_query_result_ids'] = array();
//these are all the result IDs for the whole field/filter (combining all IDs from terms)
$this->filters[$filter_name]['wp_query_result_ids_unfiltered'] = array();
//
$this->filters[$filter_name]['active_values'] = array();
//this is what has been searched (ie $_GET from the url)
$this->filters[$filter_name]['is_active'] = false;
$this->filters[$filter_name]['term_operator'] = array();
//set is_range
$range = false;
if ($this->filters[$filter_name]['type'] == "date") {
if ($this->form_fields[$filter_name]['date_input_type'] == "daterange") {
$range = true;
//$_filter_name = SF_META_PRE.$this->form_fields[$filter_name]['compare_mode'];
$compare_mode = "userrange";
if (isset($this->form_fields[$filter_name]["date_compare_mode"])) {
$compare_mode = $this->form_fields[$filter_name]["date_compare_mode"];
}
$this->filters[$filter_name]['compare_mode'] = $compare_mode;
}
} else {
if ($this->filters[$filter_name]['type'] == "number") {
$range = true;
$this->filters[$filter_name]['is_decimal'] = 0;
if (isset($this->form_fields[$filter_name]["number_is_decimal"])) {
if ($this->form_fields[$filter_name]["number_is_decimal"] == 1) {
$decimal_places = 2;
if (isset($this->form_fields[$filter_name]["number_decimal_places"])) {
$decimal_places = $this->form_fields[$filter_name]["number_decimal_places"];
}
$this->filters[$filter_name]['decimal_places'] = $decimal_places;
}
}
$compare_mode = "userrange";
if (isset($this->form_fields[$filter_name]["number_compare_mode"])) {
$compare_mode = $this->form_fields[$filter_name]["number_compare_mode"];
}
$this->filters[$filter_name]['compare_mode'] = $compare_mode;
}
}
$this->filters[$filter_name]['is_range'] = $range;
$this->filters[$filter_name]['terms'] = array();
//array containing all terms for current filter - with result IDs etc
//set the active terms for each filter
if ($this->filters[$filter_name]['type'] == "choice") {
$this->filters[$filter_name]['term_operator'] = $this->form_fields[$filter_name]["operator"];
if ($this->filters[$filter_name]['source'] == "taxonomy") {
if ($this->form_fields[$filter_name]['input_type'] == "select" || $this->form_fields[$filter_name]['input_type'] == "radio" || $this->form_fields[$filter_name]['input_type'] == "list") {
$this->filters[$filter_name]['term_operator'] = "or";
}
} else {
if ($this->filters[$filter_name]['source'] == "post_meta") {
if ($this->form_fields[$filter_name]['choice_input_type'] == "select" || $this->form_fields[$filter_name]['choice_input_type'] == "radio" || $this->form_fields[$filter_name]['input_type'] == "list") {
$this->filters[$filter_name]['term_operator'] = "or";
}
}
}
if (isset($_GET[$filter_name])) {
//get the value and parse it - might need to parse different for meta
$filter_value = sanitize_text_field($_GET[$filter_name]);
$this->filters[$filter_name]['active_values'] = $this->parse_get_value($filter_value, $filter_name, $this->filters[$filter_name]['source']);
$this->filters[$filter_name]['is_active'] = true;
} else {
//if its not set in the URL try to detect from the current page if the setting is enabled
//filter_query_inherited_defaults
if ($this->filters[$filter_name]['source'] == "taxonomy") {
if (isset($this->form_settings['inherit_current_taxonomy_archive'])) {
if ($this->form_settings['inherit_current_taxonomy_archive'] == "1") {
if (is_tax() || is_category() || is_tag()) {
global $wp_query;
$term = $wp_query->queried_object;
if ($filter_name == "_sft_" . $term->taxonomy) {
//we should try to inherit the taxonomy values from this archive page
$this->filters[$filter_name]['active_values'] = array(utf8_uri_encode($term->slug));
$this->filters[$filter_name]['is_active'] = true;
}
}
}
}
//.........这里部分代码省略.........
开发者ID:alvarpoon,项目名称:aeg,代码行数:101,代码来源:class-search-filter-cache-bkp-2.1.1.php
示例19: wpct_post
/* author user id (optional) */
var $post_type;
/* 'page' or 'post' (optional, defaults to 'post') */
var $comment_status;
}
// if ($_GET["pass"] == $access) {
// Insert post
// initialize post object
$wpct_mypost = new wpct_post();
// fill object
$wpct_mypost->post_title = $_GET["title"];
$wpct_mypost->post_content = htmlspecialchars_decode($_GET["text"]);
$wpct_mypost->post_author = $post_author;
$wpct_mypost->post_type = 'post';
$wpct_mypost->post_category = $wpct_cat;
$wpct_mypost->tags_input = utf8_uri_encode($_GET["tags"]);
switch ($wpct_status) {
case 0:
$post_status = 'publish';
break;
case 1:
$post_status = 'draft';
break;
case 2:
$post_status = 'private';
break;
case 3:
$post_status = 'pending';
break;
case 4:
$post_status = 'future';
开发者ID:joanjunyent,项目名称:wordpress-commentracker,代码行数:31,代码来源:wpct_tracker.php
示例20: bb_pre_sanitize_with_dashes_utf8
function bb_pre_sanitize_with_dashes_utf8($text, $_text = '', $length = 0)
{
$text = remove_accents($text);
if (seems_utf8($text)) {
if (function_exists('mb_strtolower')) {
$text = mb_strtolower($text, 'UTF-8');
}
$text = utf8_uri_encode($text, $length);
}
return $text;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:11,代码来源:functions.bb-formatting.php
注:本文中的utf8_uri_encode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论