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; }
/** * 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; }
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); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
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; }
function get_avatar_url($user_id) { $avatar = get_avatar($user_id); if (preg_match("/src=['\"](.*?)['\"]/i", $avatar, $matches)) { return utf8_uri_encode($matches[1]); } }
<?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']);
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; }
/** * @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); }
/** * 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, '-'); }
/** * 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; }
<?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);
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; } } } } } } } else { if ($this->filters[$filter_name]['is_range'] == true) { $this->filters[$filter_name]['term_operator'] = "and"; //when using a number operator always use AND because its a combination of the two result sets 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]); if ($this->filters[$filter_name]['type'] == "date") { //then we need to convert the _GET to the correct date format $this->filters[$filter_name]['active_values'] = $this->parse_get_value($filter_value, $filter_name, $this->filters[$filter_name]['source'], "date"); } else { $this->filters[$filter_name]['active_values'] = $this->parse_get_value($filter_value, $filter_name, $this->filters[$filter_name]['source'], "simple"); } $this->filters[$filter_name]['is_active'] = true; } } else { 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]); if ($this->filters[$filter_name]['type'] == "date") { $this->filters[$filter_name]['term_operator'] = "or"; $this->filters[$filter_name]['is_active'] = true; $this->filters[$filter_name]['active_values'] = $this->parse_get_value($filter_value, $filter_name, $this->filters[$filter_name]['source'], "date"); } } } } /* TODO - this could be used to find min / max - but all searches are performed on active_terms */ if ($this->filters[$filter_name]['type'] == "choice") { if ($this->filters[$filter_name]['source'] == "taxonomy") { $filter_terms = $this->get_filter_terms_all($filter_name, $this->filters[$filter_name]['source']); } else { //them meta $filter_terms = $this->get_filter_terms_all($filter_name, $this->filters[$filter_name]['source']); //$filter_terms = $this->get_filter_terms_meta($filter_name, $this->form_fields[$filter_name]); } } else { if ($this->filters[$filter_name]['is_range'] == true) { $filter_terms = array(); $filter_terms[0] = new stdClass(); $filter_terms[0]->field_value = "value"; //$filter_terms[1] = new stdClass(); //$filter_terms[1]->field_value = "max"; } else { $filter_terms = array(); if ($this->filters[$filter_name]['type'] == "date") { $filter_terms[0] = new stdClass(); $filter_terms[0]->field_value = "value"; } } } if (count($filter_terms) > 0) { foreach ($filter_terms as $filter_term) { if ($this->filters[$filter_name]['source'] == "taxonomy") { //then we will have IDs - so we need to convert back to slug $term = get_term($filter_term->field_value, $this->filters[$filter_name]['taxonomy_name']); $term_name = $term->slug; $this->filters[$filter_name]['terms'][$term_name] = array(); $this->filters[$filter_name]['terms'][$term_name]['term_id'] = $term->term_id; } else { $term_name = $filter_term->field_value; $this->filters[$filter_name]['terms'][$term_name] = array(); } //all the IDs used for setting up queries & counts $this->filters[$filter_name]['terms'][$term_name]['cache_result_ids'] = array(); $this->filters[$filter_name]['terms'][$term_name]['wp_query_results_ids'] = array(); $this->filters[$filter_name]['terms'][$term_name]['count'] = 0; } } } }
/* 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';
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; }
public static function sanitize_payload_item($item) { if (is_array($item)) { return BC_Utility::sanitize_payload_args_recursive($item); } return utf8_uri_encode(sanitize_text_field($item)); }
/** * Create a capability name for a write panel given its name. This function is * copied from WP's sanitize_title_with_dashes($title) (formatting.php) * * @param string $customWritePanelName panel name * @return string capability name */ public static function GetCapabilityName($customWritePanelName) { // copied from WP's sanitize_title_with_dashes($title) (formatting.php) $capabilityName = strip_tags($customWritePanelName); // Preserve escaped octets. $capabilityName = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $capabilityName); // Remove percent signs that are not part of an octet. $capabilityName = str_replace('%', '', $capabilityName); // Restore octets. $capabilityName = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $capabilityName); $capabilityName = remove_accents($capabilityName); if (seems_utf8($capabilityName)) { if (function_exists('mb_strtolower')) { $capabilityName = mb_strtolower($capabilityName, 'UTF-8'); } $capabilityName = utf8_uri_encode($capabilityName, 200); } $capabilityName = strtolower($capabilityName); $capabilityName = preg_replace('/&.+?;/', '', $capabilityName); // kill entities $capabilityName = preg_replace('/[^%a-z0-9 _-]/', '', $capabilityName); $capabilityName = preg_replace('/\\s+/', '_', $capabilityName); $capabilityName = preg_replace('|-+|', '_', $capabilityName); $capabilityName = trim($capabilityName, '_'); return $capabilityName; }
function gw_sanitize_title_with_dashes($title, $raw_title = '', $context = 'display') { // Special case during the install process. if ('Uncategorized' == $raw_title) { return 'uncategorized'; } $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); // CHANGE: Don't lowercase if (seems_utf8($title)) { $title = utf8_uri_encode($title, 200); } // CHANGE: Don't lowercase and don't remove dots $title = preg_replace('/&.+?;/', '', $title); // kill entities 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'), '', $title); } // CHANGE: Allow dots and case-insensitive $title = preg_replace('/[^%a-z0-9 _.-]/i', '', $title); $title = preg_replace('/\\s+/', '-', $title); $title = preg_replace('|-+|', '-', $title); $title = trim($title, '-'); return $title; }
/** * Check the given URL for a valid structure. * * @param string URL to be validated * @return bool Validation result * @since 1.0 */ function momtaz_is_vaild_url($url) { return (bool) filter_var(utf8_uri_encode($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED + FILTER_FLAG_HOST_REQUIRED); }
private function get_strings() { $strings = array('wp-job-manager' => array('Job' => $this->label('singular'), 'Jobs' => $this->label('plural'), 'job' => utf8_uri_encode(sprintf(_x('%s', 'the singular "listing" label used in permalinks". only transalte this if you are using Polylang and need to force the slugs to remain in a single language.'), $this->label('singular', true))), 'jobs' => utf8_uri_encode(sprintf(_x('%s', 'the plural "listing" label used in permalinks". only transalte this if you are using Polylang and need to force the slugs to remain in a single language.'), $this->label('plural', true))), 'Job Listings' => $this->label('plural'), 'Job category' => array(__('%s Category', 'listify'), array($this->label('singular'))), 'Job categories' => array(__('%s Categories', 'listify'), array($this->label('singular'))), 'Job Categories' => array(__('%s Categories', 'listify'), array($this->label('singular'))), 'job-category' => array(__('%s-category', 'listify'), array($this->label('singular', true))), 'Job type' => array(__('%s Type', 'listify'), array($this->label('singular'))), 'Job types' => array(__('%s Types', 'listify'), array($this->label('singular'))), 'Job Types' => array(__('%s Types', 'listify'), array($this->label('singular'))), 'job-type' => array(__('%s-type', 'listify'), array($this->label('singular', true))), 'Jobs will be shown if within ANY selected category' => array(__('%s will be shown if within ANY selected category', 'listify'), array($this->label('plural'))), 'Jobs will be shown if within ALL selected categories' => array(__('%s will be shown if within ALL selected categories', 'listify'), array($this->label('plural'))), 'Application email' => __('Contact Email', 'listify'), 'Application URL' => __('Contact URL', 'listify'), 'Application email/URL' => __('Contact email/URL', 'listify'), 'Position filled?' => __('Listing filled?', 'listify'), 'A video about your company' => __('A video about your listing', 'listify'), 'Job Submission' => array(__('%s Submission', 'listify'), array($this->label('singular'))), 'Submit Job Form Page' => array(__('Submit %s Form Page', 'listify'), array($this->label('singular'))), 'Job Dashboard Page' => array(__('%s Dashboard Page', 'listify'), array($this->label('singular'))), 'Job Listings Page' => array(__('%s Page', 'listify'), array($this->label('plural'))), 'Add a job via the back-end' => array(__('Add a %s via the back-end', 'listify'), array($this->label('singular', true))), 'Add a job via the front-end' => array(__('Add a %s via the front-end', 'listify'), array($this->label('singular', true))), 'Find out more about the front-end job submission form' => array(__('Find out more about the front-end %s submission form', 'listify'), array($this->label('singular', true))), 'View submitted job listings' => array(__('View submitted %s listings', 'listify'), array($this->label('singular'))), 'Add the [jobs] shortcode to a page to list jobs' => array(__('Add the [jobs] shortcode to a page to list %s', 'listify'), array($this->label('plural', true))), 'View the job dashboard' => array(__('View the %s dashboard', 'listify'), array($this->label('singular', true))), 'Find out more about the front-end job dashboard' => array(__('Find out more about the front-end %s dashboard', 'listify'), array($this->label('singular', true))), 'Company name' => __('Company name', 'listify'), 'Company website' => __('Company website', 'listify'), 'Company tagline' => __('Company tagline', 'listify'), 'Brief description about the company' => __('Brief description about the company', 'listify'), 'Company Twitter' => __('Company Twitter', 'listify'), 'Company logo' => __('Company logo', 'listify'), 'URL to the company logo' => __('URL to the company logo', 'listify'), 'Company video' => __('Company video', 'listify'), 'WP Job Manager Add-ons' => __('WP Job Manager Add-ons', 'listify'), 'Settings' => __('Settings', 'listify'), 'Add-ons' => __('Add-ons', 'listify'), 'Approve %s' => __('Approve %s', 'listify'), 'Expire %s' => __('Expire %s', 'listify'), '%s approved' => __('%s approved', 'listify'), '%s expired' => __('%s expired', 'listify'), 'Select category' => __('Select category', 'listify'), 'Position' => __('Title', 'listify'), '%s updated. View' => __('%s updated. View', 'listify'), 'Custom field updated.' => __('Custom field updated.', 'listify'), 'Custom field deleted.' => __('Custom field deleted.', 'listify'), '%s updated.' => __('%s updated.', 'listify'), '%s restored to revision from %s' => __('%s restored to revision from %s', 'listify'), '%s published. View' => __('%s published. View', 'listify'), '%s saved.' => __('%s saved.', 'listify'), '%s submitted. Preview' => __('%s submitted. Preview', 'listify'), 'M j, Y @ G:i' => __('M j, Y @ G:i', 'listify'), '%s draft updated. Preview' => __('%s draft updated. Preview', 'listify'), 'Type' => __('Type', 'listify'), 'Posted' => __('Posted', 'listify'), 'Expires' => __('Expires', 'listify'), 'Categories' => __('Categories', 'listify'), 'Featured?' => __('Featured?', 'listify'), 'Filled?' => __('Filled?', 'listify'), 'Status' => __('Status', 'listify'), 'Actions' => __('Actions', 'listify'), 'ID: %d' => __('ID: %d', 'listify'), 'M j, Y' => __('M j, Y', 'listify'), 'by a guest' => __('by a guest', 'listify'), 'by %s' => __('by %s', 'listify'), 'Approve' => __('Approve', 'listify'), 'View' => __('View', 'listify'), 'Edit' => __('Edit', 'listify'), 'Delete' => __('Delete', 'listify'), 'Listings Per Page' => __('Listings Per Page', 'listify'), 'How many listings should be shown per page by default?' => __('How many listings should be shown per page by default?', 'listify'), 'Filled Positions' => __('Filled Positions', 'listify'), 'Hide filled positions' => __('Hide filled positions', 'listify'), 'If enabled, filled positions will be hidden.' => __('If enabled, filled positions will be hidden.', 'listify'), 'Enable categories for listings' => __('Enable categories for listings', 'listify'), 'Multi-select Categories' => __('Multi-select Categories', 'listify'), 'Enable category multiselect by default' => __('Enable category multiselect by default', 'listify'), 'Category Filter Type' => __('Category Filter Type', 'listify'), 'Account Required' => __('Account Required', 'listify'), 'Submitting listings requires an account' => __('Submitting listings requires an account', 'listify'), 'Account Creation' => __('Account Creation', 'listify'), 'Allow account creation' => __('Allow account creation', 'listify'), 'Account Role' => __('Account Role', 'listify'), 'Approval Required' => __('Approval Required', 'listify'), 'New submissions require admin approval' => __('New submissions require admin approval', 'listify'), 'If enabled, new submissions will be inactive, pending admin approval.' => __('If enabled, new submissions will be inactive, pending admin approval.', 'listify'), 'Allow Pending Edits' => __('Allow Pending Edits', 'listify'), 'Submissions awaiting approval can be edited' => __('Submissions awaiting approval can be edited', 'listify'), 'Listing Duration' => __('Listing Duration', 'listify'), 'Application Method' => __('Contact Method', 'listify'), 'Choose the contact method for listings.' => __('Choose the contact method for listings.', 'listify'), 'Email address or website URL' => __('Email address or website URL', 'listify'), 'Email addresses only' => __('Email addresses only', 'listify'), 'Website URLs only' => __('Website URLs only', 'listify'), 'Pages' => __('Pages', 'listify'), 'Settings successfully saved' => __('Settings successfully saved', 'listify'), '--no page--' => __('--no page--', 'listify'), 'Select a page…' => __('Select a page…', 'listify'), 'Save Changes' => __('Save Changes', 'listify'), 'Setup' => __('Setup', 'listify'), 'Skip this step' => __('Skip this step', 'listify'), 'All Done!' => __('All Done!', 'listify'), 'Location' => __('Location', 'listify'), 'e.g. "London"' => __('e.g. "London"', 'listify'), 'Leave this blank if the location is not important' => __('Leave this blank if the location is not important', 'listify'), 'URL or email which applicants use to apply' => __('URL or email which applicants use to apply', 'listify'), 'URL to the company video' => __('URL to the company video', 'listify'), 'Position filled?' => __('Position filled?', 'listify'), 'Feature this listing?' => __('Feature this listing?', 'listify'), 'yyyy-mm-dd' => __('yyyy-mm-dd', 'listify'), 'Posted by' => __('Posted by', 'listify'), '%s Data' => __('%s Data', 'listify'), 'Use file' => __('Use file', 'listify'), 'Upload' => __('Upload', 'listify'), 'Add file' => __('Add file', 'listify'), 'Guest user' => __('Guest user', 'listify'), 'Showing %s' => __('Showing %s', 'listify'), 'Showing all %s' => __('Showing all %s', 'listify'), 'located in “%s”' => __('located in “%s”', 'listify'), 'No results found' => __('No results found', 'listify'), 'Query limit reached' => __('Query limit reached', 'listify'), 'Geocoding error' => __('Geocoding error', 'listify'), 'Employer' => __('Employer', 'listify'), 'Search %s' => __('Search %s', 'listify'), 'All %s' => __('All %s', 'listify'), 'Parent %s' => __('Parent %s', 'listify'), 'Parent %s:' => __('Parent %s:', 'listify'), 'Edit %s' => __('Edit %s', 'listify'), 'Update %s' => __('Update %s', 'listify'), 'Add New %s' => __('Add New %s', 'listify'), 'New %s Name' => __('New %s Name', 'listify'), 'Add New' => __('Add New', 'listify'), 'Add %s' => __('Add %s', 'listify'), 'New %s' => __('New %s', 'listify'), 'View %s' => __('View %s', 'listify'), 'No %s found' => __('No %s found', 'listify'), 'No %s found in trash' => __('No %s found in trash', 'listify'), 'This is where you can create and manage %s.' => __('This is where you can create and manage %s.', 'listify'), 'Expired' => array(__('Expired', 'listify'), __('Expired (%s)', 'listify')), 'Invalid ID' => __('Invalid ID', 'listify'), 'This position has already been filled' => __('This position has already been filled', 'listify'), '%s has been filled' => __('%s has been filled', 'listify'), 'This position is not filled' => __('This position is not filled', 'listify'), '%s has been marked as not filled' => __('%s has been marked as not filled', 'listify'), '%s has been deleted' => __('%s has been deleted', 'listify'), 'Job Title' => __('Title', 'listify'), 'Date Posted' => __('Date Posted', 'listify'), 'Date Expires' => __('Date Expires', 'listify'), 'Load more listings' => sprintf(__('Load More %s', 'listify'), $this->label('plural')), 'Recent %s' => __('Recent %s', 'listify'), 'Keyword' => __('Keyword', 'listify'), 'Number of listings to show' => __('Number of listings to show', 'listify'), 'Invalid listing' => __('Invalid listing', 'listify'), 'Save changes' => __('Save changes', 'listify'), 'Your changes have been saved.' => __('Your changes have been saved.', 'listify'), 'View →' => __('View →', 'listify'), 'Submit Details' => __('Submit Details', 'listify'), 'Preview' => __('Preview', 'listify'), 'Done' => __('Done', 'listify'), '*****@*****.**' => __('*****@*****.**', 'listify'), 'Application URL' => __('Application URL', 'listify'), 'http://' => __('http://', 'listify'), 'Enter an email address or website URL' => __('Enter an email address or website URL', 'listify'), 'Description' => __('Description', 'listify'), 'Enter the name of the company' => __('Enter the name of the company', 'listify'), 'Website' => __('Website', 'listify'), 'Tagline' => __('Tagline', 'listify'), 'Briefly describe your company' => __('Briefly describe your company', 'listify'), 'Video' => __('Video', 'listify'), 'A link to a video about your company' => __('A link to a video about your company', 'listify'), 'Twitter username' => __('Twitter username', 'listify'), '@yourcompany' => __('@yourcompany', 'listify'), 'Logo' => __('Logo', 'listify'), '%s is a required field' => __('%s is a required field', 'listify'), '%s is invalid' => __('%s is invalid', 'listify'), 'Please enter a valid application email address' => __('Please enter a valid contact email address', 'listify'), 'Please enter a valid application URL' => __('Please enter a valid application URL', 'listify'), 'Please enter a valid application email address or URL' => __('Please enter a valid contact email address or URL', 'listify'), 'You must be signed in to post a new listing.' => __('You must be signed in to post a new listing.', 'listify'), 'Submit Listing' => __('Submit Listing', 'listify'), 'Edit listing' => __('Edit listing', 'listify'), '\\%s\\ (filetype %s) needs to be one of the following file types: %s' => __('\\%s\\ (filetype %s) needs to be one of the following file types: %s', 'listify'), 'Your account' => __('Your account', 'listify'), 'You are currently signed in as <strong>%s</strong>.' => __('You are currently signed in as %s.', 'listify'), 'Sign out' => __('Sign out', 'listify'), 'Have an account?' => __('Have an account?', 'listify'), 'Sign in' => __('Sign in', 'listify'), 'optionally' => __('optionally', 'listify'), 'You must sign in to create a new listing.' => __('You must sign in to create a new listing.', 'listify'), 'Your email' => __('Your email', 'listify'), '(optional)' => __('(optional)', 'listify'), '%s ago' => __('%s ago', 'listify'), 'No more results found.' => __('No more results found.', 'listify'), 'Posted %s ago' => __('Posted %s ago', 'listify'), 'This position has been filled' => __('This position has been filled', 'listify'), 'This listing has expired' => __('This listing has expired', 'listify'), 'remove' => __('remove', 'listify'), 'or' => __('or', 'listify'), 'Maximum file size: %s.' => __('Maximum file size: %s.', 'listify'), 'Apply using webmail:' => __('Apply using webmail:', 'listify'), 'To apply for this job please visit the following URL: <a href=\\"%1$s\\" target=\\"_blank\\">%1$s →</a>' => __('To contact this listing owner please visit the following URL: <a href=\\"%1$s\\" target=\\"_blank\\">%1$s %rarr;</a>'), 'Apply for job' => array(__('Contact %s', 'listify'), array($this->label('singular'))), 'You need to be signed in to manage your listings.' => __('You need to be signed in to manage your listings.', 'listify'), 'You do not have any active listings.' => __('You do not have any active listings.', 'listify'), 'Mark not filled' => __('Mark not filled', 'listify'), 'Mark filled' => __('Mark filled', 'listify'), 'Relist' => __('Relist', 'listify'), 'Keywords' => __('Keywords', 'listify'), 'Category' => __('Category', 'listify'), 'Any category' => __('Any category', 'listify'), 'Company Details' => __('Company Details', 'listify'), '%s submitted successfully. Your listing will be visible once approved.' => __('%s submitted successfully. Your listing will be visible once approved.', 'listify'), 'Draft' => __('Draft', 'listify'), 'Preview' => __('Preview', 'listify'), 'Pending approval' => __('Pending approval', 'listify'), 'Pending payment' => __('Pending payment', 'listify'), 'Active' => __('Active', 'listify'), 'Reset' => __('Reset', 'listify'), 'RSS' => __('RSS', 'listify'), 'Your email address isn’t correct.' => __('Your email address isn’t correct.', 'listify'), 'This email is already registered, please choose another one.' => __('This email is already registered, please choose another one.', 'listify'), 'Choose a category…' => __('Choose a category…', 'listify'), 'Inactive' => __('Inactive', 'listify'), 'Application via \\%s\\ listing on %s' => __('Application via \\%s\\ listing on %s', 'listify'), 'Anywhere' => __('Anywhere', 'listify'), 'Are you sure you want to delete this listing?' => __('Are you sure you want to delete this listing?', 'listify'), 'Your listings are shown in the table below. Expired listings will be automatically removed after 30 days.' => __('Your listings are shown in the table below. Expired listings will be automatically removed after 30 days.', 'listify'), 'If you don’t have an account you can %screate one below by entering your email address/username. Your account details will be confirmed via email.' => __('If you don’t have an account you can %screate one below by entering your email address/username. Your account details will be confirmed via email.', 'listify'), 'To apply for this job please visit the following URL: <a href="%1$s" target="_blank">%1$s →</a>' => __('To contact this listing owner please visit the following URL: <a href="%1$s" target="_blank">%1$s →</a>', 'listify'), 'To apply for this job <strong>email your details to</strong> <a class="job_application_email" href="mailto:%1$s%2$s">%1$s</a>' => __('To contact this listing <strong>email your details to</strong> <a class="job_application_email" href="mailto:%1$s%2$s">%1$s</a>', 'listify')), 'wp-job-manager-tags' => array('Job Tags' => array(__('%s Tags', 'listify'), array($this->label('singular'))), 'Job tags' => array(__('%s Tags', 'listify'), array($this->label('singular'))), 'job-tag' => array(__('%s-tag', 'listify'), array($this->label('singular', true))), 'Comma separate tags, such as required skills or technologies, for this job.' => '', 'Choose some tags, such as required skills or technologies, for this job.' => __('Choose some tags, such as required skills available features, for this listing.', 'listify'), 'Filter by tag:' => __('Filter by tag:', 'listify'), 'tagged' => __('tagged', 'listify'), 'Jobs will be shown if within ALL chosen tags' => __('Listings will be shown if within ALL chosen tags', 'listify'), 'Jobs will be shown if within ANY chosen tag' => __('Listings will be shown if within ANY chosen tags', 'listify'), 'Maximum Job Tags' => array(__('Maximum %s Tags', 'listify'), array($this->label('singular')))), 'wp-job-manager-locations' => array('Job Regions' => array(__('%s Regions', 'listify'), array($this->label('singular'))), 'Job Region' => array(__('%s Region', 'listify'), array($this->label('singular'))), 'job-region' => array(__('%s-region', 'listify'), array($this->label('singular', true))), 'Display a list of job regions.' => array(__('Display a list of %s regions.', 'listify'), array($this->label('singular', true)))), 'wp-job-manager-wc-paid-listings' => array('Choose a package before entering job details' => sprintf(__('Choose a package before entering %s details', 'listify'), $this->label('singular')), 'Choose a package after entering job details' => sprintf(__('Choose a package after entering %s details', 'listify'), $this->label('singular')), 'Choose a package' => __('Choose a package', 'listify'), 'Purchase Package:' => __('Purchase Package:', 'listify'), 'Listing Details →' => __('Listing Details →', 'listify'), '%s job posted out of %d' => array(__('%s listing posted out of %d', 'listify'), __('%s listings posted out of %d', 'listify')), '%s job posted' => array(__('%s listing posted', 'listify'), __('%s listings posted', 'listify')), '%s for %s job' => array(__('%s for %s listing', 'listify'), __('%s for %s listings', 'listify')), 'Job Package' => array(__('%s Package', 'listify'), array($this->label('singular'))), 'Job Package Subscription' => array(__('%s Package Subscription', 'listify'), array($this->label('singular'))), 'Job Listing' => array(__('%s Listing', 'listify'), array($this->label('singular'))), 'Job listing limit' => array(__('%s limit', 'listify'), array($this->label('singular'))), 'Job listing duration' => array(__('%s duration', 'listify'), array($this->label('singular'))), 'The number of days that the job listing will be active.' => array(__('The number of days that the %s will be active', 'listify'), array($this->label('singular', true))), 'Feature job listings?' => array(__('Feature %s?', 'listify'), array($this->label('singular', true))), 'Feature this job listing - it will be styled differently and sticky.' => array(__('Feature this %s -- it will be styled differently and sticky.', 'listify'), array($this->label('singular', true))), 'My Job Packages' => array(__('My %s Packages', 'listify'), array($this->label('singular'))), 'Jobs Remaining' => array(__('%s Remaining', 'listify'), array($this->label('plural')))), 'wp-job-manager-simple-paid-listings' => array('Job #%d Payment Update' => __('#%d Payment Update', 'listify')), 'wp-job-manager-alerts' => array('Jobs matching your "%s" alert:' => __('Results for your "%s" alert:', 'listify'), 'Job Alert Results Matching "%s' => __('Results Matching "%s', 'listify'), 'No jobs were found matching your search. Login to your account to change your alert criteria' => __('No results were found matching your search. Login to your account to change your alert criteria', 'listify'), 'This job alert will automatically stop sending after %s.' => __('This alert will automatically stop sending after %s.', 'listify'), 'No jobs found' => array(__('No %s found', 'listify'), array($this->label('plural', true))), 'Optionally add a keyword to match jobs against' => array(__('Optionally add a keyword to match %s against', 'listify'), array($this->label('plural', true))), 'Job Type' => array(__('%s Type', 'listify'), array($this->label('singular'))), 'Job Region' => array(__('%s Region', 'listify'), array($this->label('singular'))), 'Any job type' => array(__('Any %s type', 'listify'), array($this->label('singular', true))), 'Job Type:' => array(__('%s Type:', 'listify'), array($this->label('singular'))), 'Your job alerts are shown in the table below. Your alerts will be sent to %s.' => __('Your alerts are shown in the table below. The alerts will be sent to %s.', 'listify'), 'Alert me to jobs like this' => sprintf(__('Alert me of %s like this', 'listify'), $this->label('plural', true)))); $this->strings = apply_filters('listify_strings', $strings); return $this->strings; }
public static function replace_shortcodes($content, $entry, $shortcodes, $display = false, $show = 'one', $odd = '', $args = array()) { global $frm_field, $frm_entry_meta, $post, $frmpro_settings; if ($display) { $param_value = $display->frm_type == 'id' ? $entry->id : $entry->item_key; if ($entry->post_id) { $detail_link = get_permalink($entry->post_id); } else { $param = isset($display->frm_param) && !empty($display->frm_param) ? $display->frm_param : 'entry'; if ($post) { $detail_link = add_query_arg($param, $param_value, get_permalink($post->ID)); } else { $detail_link = add_query_arg($param, $param_value); } //if( FrmProAppHelper::rewriting_on() && $frmpro_settings->permalinks ) // $detail_link = get_permalink($post->ID) .$param_value .'/'; } } foreach ($shortcodes[0] as $short_key => $tag) { $conditional = preg_match('/^\\[if/s', $shortcodes[0][$short_key]) ? true : false; $atts = shortcode_parse_atts($shortcodes[3][$short_key]); if (!empty($shortcodes[3][$short_key])) { $tag = str_replace($conditional ? '[if ' : '[', '', $shortcodes[0][$short_key]); $tag = str_replace(']', '', $tag); $tags = explode(' ', $tag); if (is_array($tags)) { $tag = $tags[0]; } } else { $tag = $shortcodes[2][$short_key]; } switch ($tag) { case 'entry_count': $content = str_replace($shortcodes[0][$short_key], isset($args['record_count']) ? $args['record_count'] : '', $content); break; case 'detaillink': if ($display and $detail_link) { $content = str_replace($shortcodes[0][$short_key], $detail_link, $content); } break; case 'id': $content = str_replace($shortcodes[0][$short_key], $entry->id, $content); break; case 'post-id': case 'post_id': $content = str_replace($shortcodes[0][$short_key], $entry->post_id, $content); break; case 'key': $content = str_replace($shortcodes[0][$short_key], $entry->item_key, $content); break; case 'ip': $content = str_replace($shortcodes[0][$short_key], $entry->ip, $content); break; case 'user_agent': case 'user-agent': $entry->description = maybe_unserialize($entry->description); $content = str_replace($shortcodes[0][$short_key], $entry->description['browser'], $content); break; case 'created_at': case 'created-at': case 'updated_at': case 'updated-at': if (!isset($atts['format'])) { $atts['format'] = get_option('date_format'); $time_format = false; } else { $time_format = ' '; } $this_tag = str_replace('-', '_', $tag); if ($conditional) { $atts['short_key'] = $shortcodes[0][$short_key]; $content = self::check_conditional_shortcode($content, $entry->{$this_tag}, $atts, $tag); } else { if (isset($atts['time_ago'])) { $date = FrmProAppHelper::human_time_diff(strtotime($entry->{$this_tag})); } else { $date = FrmProAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); } $content = str_replace($shortcodes[0][$short_key], $date, $content); } unset($this_tag); break; case 'created_by': case 'created-by': case 'updated_by': case 'updated-by': $this_tag = str_replace('-', '_', $tag); $replace_with = self::get_display_value($entry->{$this_tag}, (object) array('type' => 'user_id'), $atts); if ($conditional) { $atts['short_key'] = $shortcodes[0][$short_key]; $content = self::check_conditional_shortcode($content, $entry->{$this_tag}, $atts, $tag); } else { $content = str_replace($shortcodes[0][$short_key], $replace_with, $content); } unset($this_tag); unset($replace_with); break; case 'evenodd': $content = str_replace($shortcodes[0][$short_key], $odd, $content); break; case 'siteurl': $content = str_replace($shortcodes[0][$short_key], FrmAppHelper::site_url(), $content); break; case 'frmurl': $content = str_replace($shortcodes[0][$short_key], FrmAppHelper::plugin_url(), $content); break; case 'sitename': $content = str_replace($shortcodes[0][$short_key], get_option('blogname'), $content); break; case 'get': if (isset($atts['param'])) { $param = $atts['param']; $replace_with = FrmAppHelper::get_param($param); if (is_array($replace_with)) { $replace_with = implode(', ', $replace_with); } $content = str_replace($shortcodes[0][$short_key], $replace_with, $content); unset($param); unset($replace_with); } break; default: if ($tag == 'deletelink') { $page_id = isset($atts['page_id']) ? $atts['page_id'] : ($post ? $post->ID : 0); if (!isset($atts['label'])) { $atts['label'] = false; } $delete_atts = $atts; $delete_atts['id'] = $entry->id; $delete_atts['page_id'] = $page_id; $replace_with = FrmProEntriesController::entry_delete_link($delete_atts); unset($delete_atts); $field = false; } else { if ($tag == 'editlink') { $replace_with = ''; $link_text = isset($atts['label']) ? $atts['label'] : false; if (!$link_text) { $link_text = isset($atts['link_text']) ? $atts['link_text'] : __('Edit'); } $class = isset($atts['class']) ? $atts['class'] : ''; $page_id = isset($atts['page_id']) ? $atts['page_id'] : ($post ? $post->ID : 0); if (isset($atts['location']) && $atts['location'] == 'front' || isset($atts['prefix']) && !empty($atts['prefix']) || isset($atts['page_id']) && !empty($atts['page_id'])) { $edit_atts = $atts; $edit_atts['id'] = $entry->id; $delete_atts['page_id'] = $page_id; $replace_with = FrmProEntriesController::entry_edit_link($edit_atts); } else { if ($entry->post_id) { $replace_with = get_edit_post_link($entry->post_id); } else { if (current_user_can('frm_edit_entries')) { $replace_with = esc_url(admin_url('admin.php?page=formidable-entries&frm_action=edit&id=' . $entry->id)); } } if (!empty($replace_with)) { $replace_with = '<a href="' . $replace_with . '" class="frm_edit_link ' . $class . '">' . $link_text . '</a>'; } } unset($class); } else { $field = $frm_field->getOne($tag); } } $sep = isset($atts['sep']) ? $atts['sep'] : ', '; if (!isset($field)) { $field = false; } if ($field) { $replace_with = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, $atts); $atts['entry_id'] = $entry->id; $atts['entry_key'] = $entry->item_key; $atts['post_id'] = $entry->post_id; $replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field); } if ($field and $field->type == 'file') { //size options are thumbnail, medium, large, or full, label $size = isset($atts['size']) ? $atts['size'] : (isset($atts['show']) ? $atts['show'] : 'thumbnail'); $inc_html = (isset($atts['html']) and $atts['html']) ? true : false; $inc_links = (isset($atts['links']) and $atts['links']) ? true : false; $sep = isset($atts['sep']) ? $atts['sep'] : ' '; $show_filename = (isset($atts['show_filename']) and $atts['show_filename']) ? true : false; if ($size != 'id' && !empty($replace_with)) { $replace_with = FrmProFieldsHelper::get_media_from_id($replace_with, $size, array('html' => $inc_html, 'links' => $inc_links, 'show_filename' => $show_filename)); } else { if (is_array($replace_with)) { $replace_with = array_filter($replace_with); } } unset($size); } if (isset($replace_with) and is_array($replace_with)) { $replace_with = implode($sep, $replace_with); } if ($conditional) { if (!isset($replace_with)) { $replace_with = ''; } $replace_with = apply_filters('frm_conditional_value', $replace_with, $atts, $field, $tag); $start_pos = strpos($content, $shortcodes[0][$short_key]); if ($start_pos !== false) { $start_pos_len = strlen($shortcodes[0][$short_key]); $end_pos = strpos($content, '[/if ' . $tag . ']', $start_pos); $end_pos_len = strlen('[/if ' . $tag . ']'); if ($end_pos !== false) { if (empty($replace_with)) { $total_len = $end_pos + $end_pos_len - $start_pos; $content = substr_replace($content, '', $start_pos, $total_len); } else { $content = substr_replace($content, '', $end_pos, $end_pos_len); $content = substr_replace($content, '', $start_pos, $start_pos_len); } } } } else { if ($field) { if (isset($atts['show']) and $atts['show'] == 'field_label') { $replace_with = $field->name; } else { if (isset($atts['show']) and $atts['show'] == 'description') { $replace_with = $field->description; } else { if (empty($replace_with) and $replace_with != '0') { $replace_with = ''; if ($field->type == 'number') { $replace_with = '0'; } } else { $replace_with = FrmProFieldsHelper::get_display_value($replace_with, $field, $atts); } } } } if (isset($atts['sanitize'])) { $replace_with = sanitize_title_with_dashes($replace_with); } if (isset($atts['sanitize_url'])) { if (seems_utf8($replace_with)) { $replace_with = utf8_uri_encode($replace_with, 200); } $replace_with = urlencode(htmlentities($replace_with)); } if (isset($atts['truncate'])) { if (isset($atts['more_text'])) { $more_link_text = $atts['more_text']; } else { $more_link_text = isset($atts['more_link_text']) ? $atts['more_link_text'] : '. . .'; } if ($display and $display->frm_show_count == 'dynamic') { $more_link_text = ' <a href="' . $detail_link . '">' . $more_link_text . '</a>'; $replace_with = FrmAppHelper::truncate($replace_with, (int) $atts['truncate'], 3, $more_link_text); } else { $replace_with = wp_specialchars_decode(strip_tags($replace_with), ENT_QUOTES); $part_one = substr($replace_with, 0, (int) $atts['truncate']); $part_two = substr($replace_with, (int) $atts['truncate']); if (!empty($part_two)) { $replace_with = $part_one . '<a href="#" onclick="jQuery(this).next().css(\'display\', \'inline\');jQuery(this).css(\'display\', \'none\');return false;" class="frm_text_exposed_show"> ' . $more_link_text . '</a><span style="display:none;">' . $part_two . '</span>'; } } } if (isset($atts['clickable'])) { $replace_with = make_clickable($replace_with); } if (!isset($replace_with)) { $replace_with = ''; } $content = str_replace($shortcodes[0][$short_key], $replace_with, $content); } unset($replace_with); if (isset($field)) { unset($field); } } unset($atts); unset($conditional); } return $content; }
<?php if (isset($_GET['resume_search']) && $_GET['resume_search']) { get_template_part('search-resume'); exit; } ?> <?php if (isset($_GET['location'])) { $_GET['location'] = urldecode(utf8_uri_encode($_GET['location'])); } ?> <?php get_header('search'); ?> <?php do_action('jobs_will_display'); ?> <div class="section"> <?php // Global so we can pass it on to the filter-process.php file global $find_posts_in, $search_result_ids, $wp_query, $query_string; query_posts($query_string . '&posts_per_page=-1'); $term_heading = ''; $location_heading = ''; $search = get_search_query();
function auto_post_slug($slug, $post_ID, $post_status, $post_type) { if (preg_match('/(%[0-9a-f]{2})+/', $slug) && ($post_type == 'post' || $post_type == 'page')) { //投稿もしくは固定ページのときのみ実行する $slug = utf8_uri_encode($post_type) . '-' . $post_ID; } return $slug; }
/** * Update a video in the Brightcove Video Cloud * * Updates a video with the provided id and optional other data in the video cloud. * * @since 1.0.0 * * @param string $video_id the id of the video to update * @param array $args optional array of other arguments used in video creation * * @return array|bool array of data about the updated video or false on failure. */ public function video_update($video_id, $args = array()) { $data = array(); $video_id = utf8_uri_encode(sanitize_text_field($video_id)); $data = BC_Utility::sanitize_payload_args_recursive($args); return $this->send_request(esc_url_raw(self::CMS_BASE_URL . $this->get_account_id() . '/videos/' . $video_id), 'PATCH', $data); }
public static function atts_sanitize_url($replace_with) { if (seems_utf8($replace_with)) { $replace_with = utf8_uri_encode($replace_with, 200); } return urlencode($replace_with); }