static function js_vars() { $step_statuses = get_option(self::STEP_STATUS_KEY, array()); $started = get_option(self::STARTED_KEY, false); $jetpack_config = array(); if (class_exists('Jetpack')) { $jetpack_config = array('plugin_active' => true, 'configured' => Jetpack::is_active(), 'logo_url' => plugins_url('jetpack/images/jetpack-logo.png'), 'jumpstart_modules' => array_values(self::jumpstart_modules()), 'additional_modules' => array(), 'active_modules' => array_values(Jetpack::init()->get_active_modules())); } else { $jetpack_config = array('plugin_active' => false, 'configured' => false, 'logo_url' => '', 'jumpstart_modules' => array(), 'additional_modules' => array(), 'active_modules' => array()); } // set the jetpack step status to "completed" if jetpack is active if ($jetpack_config['configured']) { $step_statuses['jetpack'] = array('completed' => true); } if (get_option('show_on_front') == 'page') { if (get_option('page_for_posts') == 0 || get_option('page_for_posts') == null) { $layout = 'website'; } else { $layout = 'site-blog'; } } else { $layout = 'blog'; } $themes = array_slice(array_map(array(__CLASS__, 'normalize_installed_theme'), wp_prepare_themes_for_js()), 0, self::MAX_THEMES); return array('base_url' => JETPACK_START_BASE_URL, 'nonce' => wp_create_nonce(Jetpack_Start_EndPoints::AJAX_NONCE), 'debug' => WP_DEBUG ? true : false, 'bloginfo' => array('name' => wp_kses_decode_entities(stripslashes(get_bloginfo('name'))), 'description' => wp_kses_decode_entities(stripslashes(get_bloginfo('description')))), 'site_actions' => array('set_title' => 'jps_set_title', 'set_layout' => 'jps_set_layout', 'set_theme' => 'jps_set_theme', 'install_theme' => 'jps_install_theme', 'get_popular_themes' => 'jps_get_popular_themes', 'configure_jetpack' => 'jps_configure_jetpack', 'activate_jetpack_modules' => 'jps_activate_jetpack_modules', 'deactivate_jetpack_modules' => 'jps_deactivate_jetpack_modules', 'list_jetpack_modules' => 'jps_list_jetpack_modules', 'reset_data' => 'jps_reset_data'), 'step_actions' => array('start' => 'jps_started', 'view' => 'jps_step_view', 'skip' => 'jps_step_skip', 'complete' => 'jps_step_complete'), 'jetpack' => $jetpack_config, 'themes' => $themes, 'started' => $started, 'step_status' => $step_statuses, 'steps' => array('layout' => array('current' => $layout), 'advanced_settings' => array('jetpack_modules_url' => admin_url('admin.php?page=jetpack_modules'), 'widgets_url' => admin_url('widgets.php'), 'themes_url' => admin_url('themes.php'), 'plugins_url' => admin_url('plugins.php'), 'customize_url' => wp_customize_url(), 'new_blog_post_url' => admin_url('post-new.php'), 'manage_posts_url' => admin_url('edit.php'), 'new_page_url' => admin_url('post-new.php?post_type=page'), 'manage_pages_url' => admin_url('edit.php?post_type=page')))); }
/** * Generated by the WordPress Meta Box generator * at http://jeremyhixon.com/wp-tools/meta-box/ */ function link_to_code_get_meta($value) { global $post; $field = get_post_meta($post->ID, $value, true); if (!empty($field)) { return is_array($field) ? stripslashes_deep($field) : stripslashes(wp_kses_decode_entities($field)); } else { return false; } }
function genesis_get_custom_field($field) { global $post; $custom_field = get_post_meta($post->ID, $field, true); if ($custom_field) { // sanitize and return the value of the custom field return wp_kses_stripslashes(wp_kses_decode_entities($custom_field)); } else { // return FALSE if custom field is empty return FALSE; } }
/** * undocumented */ function etheme_get_custom_field($field) { global $post; if (null === $post) { return FALSE; } $custom_field = get_post_meta($post->ID, $field, true); if ($custom_field) { return stripslashes(wp_kses_decode_entities($custom_field)); } else { return FALSE; } }
/** * Pull an Simple Hooks option from the database, return value * * @since 0.1 */ function simplehooks_get_option($hook = null, $field = null, $all = false) { static $options = array(); $options = $options ? $options : get_option(SIMPLEHOOKS_SETTINGS_FIELD); if ($all) { return $options; } if (!array_key_exists($hook, (array) $options)) { return ''; } $option = isset($options[$hook][$field]) ? $options[$hook][$field] : ''; return wp_kses_stripslashes(wp_kses_decode_entities($option)); }
public static function get($value, $id = null) { if (empty($id)) { global $post; $id = $post->ID; } $custom_field = get_post_meta($id, $value, true); if (!empty($custom_field)) { return is_array($custom_field) ? stripslashes_deep($custom_field) : stripslashes(wp_kses_decode_entities($custom_field)); } else { return false; } }
/** * Thanks to http://jeremyhixon.com/tool/wordpress-meta-box-generator/ */ function aaron_get_meta($value) { if (is_home()) { $postid = get_option('page_for_posts'); } else { $postid = get_the_ID(); } $field = get_post_meta($postid, $value, true); if (!empty($field)) { return is_array($field) ? stripslashes_deep($field) : stripslashes(wp_kses_decode_entities($field)); } else { return false; } }
/** * Returns custom field post meta data. * * Return only the first value of custom field. * Returns false if field is blank or not set. * * @since 0.1.0 * * @global integer $id Post ID. * @global stdClass $post Post object. * @param string $field Custom field key. * @return string|boolean Return value or false on failure. */ function accesspress_get_custom_field($field, $default = '') { global $id, $post; if (null === $id && null === $post) { return $default; } $post_id = null === $id ? $post->ID : $id; $custom_field = get_post_meta($post_id, $field, true); if ($custom_field) { /** Sanitize and return the value of the custom field */ return stripslashes(wp_kses_decode_entities($custom_field)); } /** Return $default if custom field is empty */ return $default; }
function etheme_get_custom_field($field, $postid = false) { global $post; if (null === $post && !$postid) { return FALSE; } if (!$postid) { $postid = $post->ID; } $page_for_posts = get_option('page_for_posts'); $custom_field = get_post_meta($postid, $field, true); if ($custom_field) { return stripslashes(wp_kses_decode_entities($custom_field)); } else { return FALSE; } }
/** * Get custom post meta option value * @param string $field post meta key * @return mixed post meta value */ function calibrefx_get_custom_field($field) { global $post; if (null === $post) { return false; } $custom_field = get_post_meta($post->ID, $field, true); if ($custom_field) { if (!is_array($custom_field)) { /** sanitize and return the value of the custom field */ return stripslashes(wp_kses_decode_entities($custom_field)); } return $custom_field; } else { /** return false if custom field is empty */ return false; } }
/** * Returns custom field post meta data. * * Return only the first value of custom field. * Returns false if field is blank or not set. * * @since 0.1.0 * * @global integer $id Post ID. * @global stdClass $post Post object. * @param string $field Custom field key. * @param string $default Default text to show if custom field is empty. * @param integer $post_id The ID of the post to pull custom field data from. * @return string|boolean Return value or false on failure. */ function accesspress_get_custom_field($field, $default = '', $post_id = null) { global $post; $post_id = $post_id ? (int) $post_id : $post->ID; if (!$post_id) { return false; } /** Short-circuit this function */ $pre = apply_filters('accesspress_pre_get_custom_field_' . $field, null, $post_id); if (null !== $pre) { return $pre; } /** Default value */ $return = $default; /** If custom field has value, assign it to $return */ if ($custom_field = get_post_meta($post_id, $field, true)) { $return = stripslashes(wp_kses_decode_entities($custom_field)); } /** Return $default if custom field is empty */ return apply_filters('accesspress_get_custom_field', $return, $field, $default, $post_id); }
static function js_vars() { $step_statuses = get_option(self::STEP_STATUS_KEY, array()); $started = get_option(self::STARTED_KEY, false); $contact_page_id = get_option(self::CONTACTPAGE_ID_KEY, false); if ($contact_page_id) { $contact_page_info = self::contact_page_to_json($contact_page_id); } else { $contact_page_info = null; } $jetpack_config = array(); if (class_exists('Jetpack')) { $jetpack_config = array('plugin_active' => true, 'configured' => Jetpack::is_active(), 'logo_url' => plugins_url('jetpack/images/jetpack-logo.png'), 'jumpstart_modules' => array_values(self::jumpstart_modules()), 'additional_modules' => array(), 'active_modules' => array_values(Jetpack::init()->get_active_modules())); } else { $jetpack_config = array('plugin_active' => false, 'configured' => false, 'logo_url' => '', 'jumpstart_modules' => array(), 'additional_modules' => array(), 'active_modules' => array()); } // set the jetpack step status to "completed" if jetpack is active if ($jetpack_config['configured']) { $step_statuses['jetpack'] = array('completed' => true); } return array('base_url' => JETPACK_ONBOARDING_BASE_URL, 'site_url' => site_url(), 'nonce' => wp_create_nonce(Jetpack_Onboarding_EndPoints::AJAX_NONCE), 'debug' => WP_DEBUG ? true : false, 'bloginfo' => array('name' => wp_kses_decode_entities(stripslashes(get_bloginfo('name'))), 'description' => wp_kses_decode_entities(stripslashes(get_bloginfo('description')))), 'site_actions' => array('set_title' => 'jpo_set_title', 'set_layout' => 'jpo_set_layout', 'set_theme' => 'jpo_set_theme', 'install_theme' => 'jpo_install_theme', 'get_popular_themes' => 'jpo_get_popular_themes', 'configure_jetpack' => 'jpo_configure_jetpack', 'activate_jetpack_modules' => 'jpo_activate_jetpack_modules', 'deactivate_jetpack_modules' => 'jpo_deactivate_jetpack_modules', 'list_jetpack_modules' => 'jpo_list_jetpack_modules', 'reset_data' => 'jpo_reset_data', 'build_contact_page' => 'jpo_build_contact_page'), 'step_actions' => array('start' => 'jpo_started', 'disable' => 'jpo_disabled', 'view' => 'jpo_step_view', 'skip' => 'jpo_step_skip', 'complete' => 'jpo_step_complete'), 'jetpack' => $jetpack_config, 'started' => $started, 'step_status' => $step_statuses, 'steps' => array('layout' => self::get_layout(), 'contact_page' => $contact_page_info, 'advanced_settings' => array('jetpack_modules_url' => admin_url('admin.php?page=jetpack_modules'), 'jetpack_dash' => admin_url('admin.php?page=jetpack'), 'widgets_url' => admin_url('widgets.php'), 'themes_url' => admin_url('themes.php'), 'plugins_url' => admin_url('plugins.php'), 'customize_url' => wp_customize_url(), 'new_blog_post_url' => admin_url('post-new.php'), 'manage_posts_url' => admin_url('edit.php'), 'new_page_url' => admin_url('post-new.php?post_type=page'), 'manage_pages_url' => admin_url('edit.php?post_type=page')))); }
/** * Retrieve the caption data. * * @param int $id The ID of the post or page for which we need the featured image caption. * * @return bool|array $caption If successful, the array of caption data. If unsuccessful, return false. */ public function caption_data($id) { // Get the caption data from the post meta $caption = get_post_meta($id, '_' . CCFIC_KEY, true); // If caption data is not present, return null if (empty($caption)) { return; } // Legacy support: if caption is a string, convert it to an array if (is_string($caption)) { $string = $caption; $caption = array('caption_text' => $string); } // Unescape HTML characters if (!empty($caption['caption_text'])) { wp_kses_decode_entities($caption['caption_text']); } if (!empty($caption['source_text'])) { wp_kses_decode_entities($caption['source_text']); } return $caption; }
/** * Retrieve and return an option from the database. * * @since 2.1.0 */ function premise_get_option($key, $setting = null) { /** * Get setting. The default is set here, once, so it doesn't have to be * repeated in the function arguments for accesspress_option() too. */ $setting = $setting ? $setting : PREMISE_SETTINGS_FIELD; /** setup caches */ static $settings_cache = array(); static $options_cache = array(); /** Short circuit */ $pre = apply_filters('premise_pre_get_option_' . $key, false, $setting); if (false !== $pre) { return $pre; } /** Check options cache */ if (isset($options_cache[$setting][$key])) { // option has been cached return $options_cache[$setting][$key]; } /** check settings cache */ if (isset($settings_cache[$setting])) { // setting has been cached $options = apply_filters('premise_options', $settings_cache[$setting], $setting); } else { // set value and cache setting $options = $settings_cache[$setting] = apply_filters('premise_options', get_option($setting), $setting); } // check for non-existent option if (!is_array($options) || !array_key_exists($key, (array) $options)) { // cache non-existent option $options_cache[$setting][$key] = ''; return ''; } // option has been cached, cache option $options_cache[$setting][$key] = is_array($options[$key]) ? stripslashes_deep($options[$key]) : stripslashes(wp_kses_decode_entities($options[$key])); return $options_cache[$setting][$key]; }
/** * Get the latest genesis_extender_custom_css array from the database * and then cache it, if not otherwise specified, so specific * Custom Options values (or the entire array) can be efficiently accessed. * * @since 1.0 * @return either the entire genesis_extender_custom_css array or a specific key/value. */ function genesis_extender_get_custom_css($key, $args = false) { static $options_cache = array(); static $options_set = false; if ($args) { if (empty($options_cache) || !$args['cached']) { $options_cache = get_option('genesis_extender_custom_css'); } if ($args['array']) { return $options_cache; } else { return; } } if (isset($options_cache[$key])) { return is_array($options_cache[$key]) ? stripslashes_deep($options_cache[$key]) : stripslashes(wp_kses_decode_entities($options_cache[$key])); } elseif ($options_set) { $options_cache[$key] = ''; return $options_cache[$key]; } else { $options_cache = get_option('genesis_extender_custom_css'); $options_set = true; } if (!isset($options_cache[$key])) { $options_cache[$key] = ''; } else { $options_cache[$key] = is_array($options_cache[$key]) ? stripslashes_deep($options_cache[$key]) : stripslashes(wp_kses_decode_entities($options_cache[$key])); } return $options_cache[$key]; }
/** * For backward compatibility only. * * Filter each term, pulling term meta automatically so it can be accessed directly by the term object. * * Applies `genesis_term_meta_defaults`, `genesis_term_meta_{field}` and `genesis_term_meta` filters. * * @since 1.2.0 * * @param object $term Database row object. * @param string $taxonomy Taxonomy name that $term is part of. * * @return object $term Database row object. */ function genesis_get_term_filter($term, $taxonomy) { //* Do nothing, if $term is not object if (!is_object($term)) { return $term; } //* Do nothing, if called in the context of creating a term via an ajax call if (did_action('wp_ajax_add-tag')) { return $term; } //* Pull all meta for this term ID $term_meta = get_term_meta($term->term_id); //* Convert array values to string foreach ((array) $term_meta as $key => $value) { $term_meta[$key] = $value[0]; } $term->meta = wp_parse_args($term_meta, genesis_term_meta_defaults()); //* Sanitize term meta foreach ($term->meta as $field => $value) { if (is_array($value)) { $value = stripslashes_deep(array_filter($value, 'wp_kses_decode_entities')); } else { $value = stripslashes(wp_kses_decode_entities($value)); } /** * Term meta value filter. * * Allow term meta value to be filtered before being injected into the $term->meta array. * * @since * * @param string|array $value The term meta value. * @param string $term The term that is being filtered. * @param string $taxonomy The taxonomy to which the term belongs. */ $term->meta[$field] = apply_filters("genesis_term_meta_{$field}", $value, $term, $taxonomy); } $term->meta = apply_filters('genesis_term_meta', $term->meta, $term, $taxonomy); return $term; }
function wp_kses_bad_protocol_once2($string, $allowed_protocols) ############################################################################### # This function processes URL protocols, checks to see if they're in the white- # list or not, and returns different data depending on the answer. ############################################################################### { $string2 = wp_kses_decode_entities($string); $string2 = preg_replace('/\s/', '', $string2); $string2 = wp_kses_no_null($string2); $string2 = preg_replace('/\xad+/', '', $string2); # deals with Opera "feature" $string2 = strtolower($string2); $allowed = false; foreach ($allowed_protocols as $one_protocol) if (strtolower($one_protocol) == $string2) { $allowed = true; break; } if ($allowed) return "$string2:"; else return ''; } # function wp_kses_bad_protocol_once2
/** * Replace the strings in the theme's settings with the translated strings */ function franz_translate_settings() { if (!function_exists('icl_t')) { return; } if (is_admin()) { return; } global $franz_settings; $franz_settings['copy_text'] = franz_icl_t('Copyright text', $franz_settings['copy_text']); $franz_settings['navmenu_home_desc'] = franz_icl_t('Home nav menu description', $franz_settings['navmenu_home_desc']); foreach ($franz_settings['social_profiles'] as $key => $social_profile) { $franz_settings['social_profiles'][$key]['title'] = franz_icl_t('Social icon - ' . $social_profile['name'], wp_kses_decode_entities($social_profile['title'])); } }
/** * Merge term meta data into options table. * * Genesis is forced to create its own term-meta data structure in the options table, since it is not support in core WP. * * Applies `genesis_term_meta_defaults`, `genesis_term_meta_{field}` and `genesis_term_meta` filters. * * @since 1.2.0 * * @param object $term Database row object. * @param string $taxonomy Taxonomy name that $term is part of. * * @return object $term Database row object. */ function genesis_get_term_filter($term, $taxonomy) { //* Do nothing, if $term is not object if (!is_object($term)) { return $term; } $db = get_option('genesis-term-meta'); $term_meta = isset($db[$term->term_id]) ? $db[$term->term_id] : array(); $term->meta = wp_parse_args($term_meta, apply_filters('genesis_term_meta_defaults', array('headline' => '', 'intro_text' => '', 'display_title' => 0, 'display_description' => 0, 'doctitle' => '', 'description' => '', 'keywords' => '', 'layout' => '', 'noindex' => 0, 'nofollow' => 0, 'noarchive' => 0))); //* Sanitize term meta foreach ($term->meta as $field => $value) { $term->meta[$field] = apply_filters('genesis_term_meta_' . $field, stripslashes(wp_kses_decode_entities($value)), $term, $taxonomy); } $term->meta = apply_filters('genesis_term_meta', $term->meta, $term, $taxonomy); return $term; }
/** * Output the meta keywords based on contextual criteria. * * Outputs nothing if keywords aren't present. * * @since 1.2.0 * * @uses genesis_get_seo_option() Get SEO setting value. * @uses genesis_get_custom_field() Get custom field value. * * @global WP_Query $wp_query Query object. */ function genesis_seo_meta_keywords() { global $wp_query; $keywords = ''; $post_id = null; //* If we're on the root page if (genesis_is_root_page()) { $keywords = genesis_get_seo_option('home_keywords'); } //* When the page is set as the Posts Page in WordPress core, use the $post_id of the page when loading SEO values if (is_home() && get_option('page_for_posts') && get_queried_object_id()) { $post_id = get_option('page_for_posts'); } //* If we're on a single post, page or attachment if (is_singular() || null !== $post_id) { //* Keywords are set via custom field if (genesis_get_custom_field('_genesis_keywords', $post_id)) { $keywords = genesis_get_custom_field('_genesis_keywords', $post_id); } elseif (genesis_get_custom_field('_aioseop_keywords', $post_id)) { $keywords = genesis_get_custom_field('_aioseop_keywords', $post_id); } elseif (genesis_get_custom_field('thesis_keywords', $post_id)) { $keywords = genesis_get_custom_field('thesis_keywords', $post_id); } elseif (genesis_get_custom_field('keywords', $post_id)) { $keywords = genesis_get_custom_field('keywords', $post_id); } } if (is_category()) { $term = $wp_query->get_queried_object(); $keywords = !empty($term->meta['keywords']) ? $term->meta['keywords'] : ''; } if (is_tag()) { $term = $wp_query->get_queried_object(); $keywords = !empty($term->meta['keywords']) ? $term->meta['keywords'] : ''; } if (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $keywords = !empty($term->meta['keywords']) ? wp_kses_stripslashes(wp_kses_decode_entities($term->meta['keywords'])) : ''; } if (is_author()) { $user_keywords = get_the_author_meta('meta_keywords', (int) get_query_var('author')); $keywords = $user_keywords ? $user_keywords : ''; } if (is_post_type_archive() && genesis_has_post_type_archive_support()) { $keywords = genesis_get_cpt_option('keywords') ? genesis_get_cpt_option('keywords') : ''; } //* Add the keywords if they exist if ($keywords) { echo '<meta name="keywords" content="' . esc_attr($keywords) . '" />' . "\n"; } }
/** * Get all blogs that the user is a member of and returns * a json array of blogs and roles * * @access public * @return string */ public function ajax_get_user_blogs() { if (!defined('DOING_AJAX') || !DOING_AJAX) { return; } // Verify nonce $this->verify_ajax_nonce(); // Verify permissions $this->verify_ajax_super_admin(); if (empty($_POST['user_id']) || !($user_id = absint($_POST['user_id']))) { wp_send_json_error(array(array('type' => 'error', 'message' => esc_html__('Invalid User ID', 'multisite-user-role-manager')))); } $output = array(); /** * Filter the list of blogs returned for a particular user * @param array All the blogs the user is a member of * @param int $user_id The user ID currently being edited */ $user_blogs = apply_filters('wpmuurm_user_blogs', get_blogs_of_user($user_id), $user_id); // Cycle through each blog and get the user's // roles at each one foreach ($user_blogs as $user_blog) { switch_to_blog($user_blog->userblog_id); $user_at_different_blog = new WP_User($user_id, $user_blog->userblog_id); // Decode the blog name $user_blog->blogname = wp_kses_decode_entities($user_blog->blogname); // Format the blog roles so they can be used by the JS $formatted_blog_roles = array(); foreach ($blog_roles = get_editable_roles() as $role_slug => $role_details) { $formatted_blog_roles[] = array('text' => $role_details['name'], 'value' => $role_slug); } $output[] = array('blog' => $user_blog, 'blog_roles' => $formatted_blog_roles, 'user_roles' => $user_at_different_blog->roles); restore_current_blog(); } wp_send_json_success(apply_filters('wpmuurm_ajax_get_user_blogs_output', $output, $user_id)); }
/** * Get post meta * * @since 7.9.4.1 */ function bizzthemes_get_custom_field($field) { if (null === get_the_ID()) { return ''; } $custom_field = get_post_meta(get_the_ID(), $field, true); if (!$custom_field) { return ''; } //* Return custom field, slashes stripped, sanitized if string return is_array($custom_field) ? stripslashes_deep($custom_field) : stripslashes(wp_kses_decode_entities($custom_field)); }
/** * Callback for wp_kses_bad_protocol_once() regular expression. * * This function processes URL protocols, checks to see if they're in the * white-list or not, and returns different data depending on the answer. * * @access private * @since 1.0.0 * * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols * @return string Sanitized content */ function wp_kses_bad_protocol_once2($matches) { global $_kses_allowed_protocols; if (is_array($matches)) { if (!isset($matches[1]) || empty($matches[1])) { return ''; } $string = $matches[1]; } else { $string = $matches; } $string2 = wp_kses_decode_entities($string); $string2 = preg_replace('/\\s/', '', $string2); $string2 = wp_kses_no_null($string2); $string2 = strtolower($string2); $allowed = false; foreach ((array) $_kses_allowed_protocols as $one_protocol) { if (strtolower($one_protocol) == $string2) { $allowed = true; break; } } if ($allowed) { return "{$string2}:"; } else { return ''; } }
function cc_shortcode_tabby($atts, $content = null) { // initialise $firsttab flag so we can tell whether we are building the first tab global $reset_firsttab_flag; static $firsttab = TRUE; if ($GLOBALS["reset_firsttab_flag"] === TRUE) { $firsttab = TRUE; $GLOBALS["reset_firsttab_flag"] = FALSE; } // extract title & whether open extract(shortcode_atts(array("title" => '', "open" => '', "icon" => ''), $atts, 'tabbytab')); $tabtarget = sanitize_title_with_dashes(remove_accents(wp_kses_decode_entities($title))); //initialise urltarget $urltarget = ''; //grab the value of the 'target' url parameter if there is one if (isset($_REQUEST['target'])) { $urltarget = sanitize_title_with_dashes($_REQUEST['target']); } // Set Tab Panel Class - add active class if the open attribute is set or the target url parameter matches the dashed version of the tab title $tabcontentclass = "tabcontent"; if (isset($class)) { $tabcontentclass .= " " . $class . "-content"; } if ($open || isset($urltarget) && $urltarget == $tabtarget) { $tabcontentclass .= " responsive-tabs__panel--active"; } $addtabicon = ''; if ($icon) { $addtabicon = '<span class="fa fa-' . $icon . '"></span>'; } // test whether this is the first tab in the group if ($firsttab) { // Set flag so we know subsequent tabs are not the first in the tab group $firsttab = FALSE; // Build output if we are making the first tab return '<div class="responsive-tabs">' . "\n" . '<h2 class="tabtitle">' . $addtabicon . $title . '</h2>' . "\n" . '<div class="' . $tabcontentclass . '">' . "\n"; } else { // Build output if we are making a non-first tab return "\n" . '</div><h2 class="tabtitle">' . $addtabicon . $title . '</h2>' . "\n" . '<div class="' . $tabcontentclass . '">' . "\n"; } }
/** * Edit the e-mail message */ function alo_em_handle_email($args) { // $args['to'], $args['subject'], $args['message'], $args['headers'], $args['attachments'] // Check based on $args['subject']; more attrs in $args['message'] global $_config; /* * 1) Activation e-mail */ if (strpos("#_EASYMAIL_ACTIVATION_#", $args['subject']) !== false) { // Get the parameters stored as a query in $args['message'] $defaults = array('lang' => '', 'email' => '', 'name' => '', 'unikey' => ''); /* // replaced 'wp_parse_args' because use urlencode and stripslashes, so affect emails with '+' chars $customs = wp_parse_args( $args['message'], $defaults ); extract( $customs, EXTR_SKIP ); */ $pars = array(); $raw = explode('&', $args['message']); foreach ($raw as $section) { if (strpos($section, '=') !== false) { list($key, $value) = explode('=', $section); $pars[$key] = $value; } } $customs = array_merge($defaults, $pars); extract($customs, EXTR_SKIP); //$subscriber = alo_em_get_subscriber( $email ); // Subject if ($subject_text = alo_em_translate_option($lang, 'alo_em_txtpre_activationmail_subj', true)) { $subject = $subject_text; } else { $subject = alo_em___(__("Confirm your subscription to %BLOGNAME% Newsletter", "alo-easymail")); } $blogname = html_entity_decode(wp_kses_decode_entities(get_option('blogname'))); $subject = str_replace("%BLOGNAME%", $blogname, $subject); $args['subject'] = $subject; // Content if ($content_txt = alo_em_translate_option($lang, 'alo_em_txtpre_activationmail_mail', true)) { $content = $content_txt; } else { $content = __("Hi %NAME%\nto complete your subscription to %BLOGNAME% newsletter you need to click on the following link (or paste it in the address bar of your browser):\n", "alo-easymail"); $content .= "%ACTIVATIONLINK%\n\n"; $content .= __("If you did not ask for this subscription ignore this message.", "alo-easymail") . "\n"; $content .= __("Thank you", "alo-easymail") . "\n" . $blogname . "\n"; } /* $div_email = explode("@", $email); $arr_params = array ('ac' => 'activate', 'em1' => $div_email[0], 'em2' => $div_email[1], 'uk' => $unikey ); $sub_link = add_query_arg( $arr_params, get_page_link (get_option('alo_em_subsc_page')) ); $sub_link = alo_em_translate_url ( $sub_link, $lang ); */ //$div_email = explode("@", $email); $sub_vars = $email . "|" . $unikey . "|" . $lang; //$sub_vars = $subscriber->ID . "|" . $subscriber->unikey; $sub_vars = urlencode(base64_encode($sub_vars)); $sub_link = add_query_arg('emact', $sub_vars, alo_em_translate_home_url($lang)); //$sub_link = alo_em_translate_url ( $sub_link, $lang /*$subscriber->lang */ ); $content = str_replace("%BLOGNAME%", $blogname, $content); $content = str_replace("%NAME%", $name, $content); $content = str_replace("%ACTIVATIONLINK%", $sub_link, $content); $args['message'] = $content; } return $args; }
/** * Return custom field post meta data. * * Return only the first value of custom field. Return empty string if field is blank or not set. * * @since 0.1.3 * * @param string $field Custom field key. * @param int $post_id Optional. Post ID to use for Post Meta lookup, defaults to get_the_ID() * * @return string|boolean Return value or empty string on failure. */ function genesis_get_custom_field($field, $post_id = null) { //* Use get_the_ID() if no $post_id is specified $post_id = empty($post_id) ? get_the_ID() : $post_id; if (!$post_id) { return ''; } $custom_field = get_post_meta($post_id, $field, true); if (!$custom_field) { return ''; } //* Return custom field, slashes stripped, sanitized if string return is_array($custom_field) ? stripslashes_deep($custom_field) : stripslashes(wp_kses_decode_entities($custom_field)); }
/** * This function generates the meta keywords based on contextual criteria. * * Outputs nothing if keywords aren't present. * * @since 1.2.0 * * @uses genesis_get_seo_option() Get SEO setting value * @uses genesis_get_custom_field() Get custom field value * * @global WP_Query $wp_query Query object * @global stdClass $post Post object */ function genesis_seo_meta_keywords() { global $wp_query, $post; $keywords = ''; /** If we're on the home page */ if (is_front_page()) { $keywords = genesis_get_seo_option('home_keywords'); } /** If we're on a single post / page / attachment */ if (is_singular()) { /** Keywords are set via custom field */ if (genesis_get_custom_field('_genesis_keywords')) { $keywords = genesis_get_custom_field('_genesis_keywords'); } elseif (genesis_get_custom_field('_aioseop_keywords')) { $keywords = genesis_get_custom_field('_aioseop_keywords'); } elseif (genesis_get_custom_field('thesis_keywords')) { $keywords = genesis_get_custom_field('thesis_keywords'); } elseif (genesis_get_custom_field('keywords')) { $keywords = genesis_get_custom_field('keywords'); } } if (is_category()) { $term = $wp_query->get_queried_object(); $keywords = !empty($term->meta['keywords']) ? $term->meta['keywords'] : ''; } if (is_tag()) { $term = $wp_query->get_queried_object(); $keywords = !empty($term->meta['keywords']) ? $term->meta['keywords'] : ''; } if (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $keywords = !empty($term->meta['keywords']) ? wp_kses_stripslashes(wp_kses_decode_entities($term->meta['keywords'])) : ''; } if (is_author()) { $user_keywords = get_the_author_meta('meta_keywords', (int) get_query_var('author')); $keywords = $user_keywords ? $user_keywords : ''; } /** Add the keywords if they exist */ if ($keywords) { echo '<meta name="keywords" content="' . esc_attr($keywords) . '" />' . "\n"; } }
/** * Callback for wp_kses_bad_protocol_once() regular expression. * * This function processes URL protocols, checks to see if they're in the * whitelist or not, and returns different data depending on the answer. * * @access private * @since 1.0.0 * * @param string $string URI scheme to check against the whitelist * @param string $allowed_protocols Allowed protocols * @return string Sanitized content */ function wp_kses_bad_protocol_once2($string, $allowed_protocols) { $string2 = wp_kses_decode_entities($string); $string2 = preg_replace('/\\s/', '', $string2); $string2 = wp_kses_no_null($string2); $string2 = strtolower($string2); $allowed = false; foreach ((array) $allowed_protocols as $one_protocol) { if (strtolower($one_protocol) == $string2) { $allowed = true; break; } } if ($allowed) { return "{$string2}:"; } else { return ''; } }
/** * Merge term meta data into options table. * * Genesis is forced to create its own term-meta data structure in the options table, since it is not support in core WP. * * Applies `genesis_term_meta_defaults`, `genesis_term_meta_{field}` and `genesis_term_meta` filters. * * @since 1.2.0 * * @param object $term Database row object. * @param string $taxonomy Taxonomy name that $term is part of. * * @return object $term Database row object. */ function genesis_get_term_filter($term, $taxonomy) { //* Do nothing, if $term is not object if (!is_object($term)) { return $term; } //* Do nothing, if called in the context of creating a term via an ajax call if (did_action('wp_ajax_add-tag')) { return $term; } $db = get_option('genesis-term-meta'); $term_meta = isset($db[$term->term_id]) ? $db[$term->term_id] : array(); $term->meta = wp_parse_args($term_meta, apply_filters('genesis_term_meta_defaults', array('headline' => '', 'intro_text' => '', 'display_title' => 0, 'display_description' => 0, 'doctitle' => '', 'description' => '', 'keywords' => '', 'layout' => '', 'noindex' => 0, 'nofollow' => 0, 'noarchive' => 0))); //* Sanitize term meta foreach ($term->meta as $field => $value) { if (is_array($value)) { $value = stripslashes_deep(array_filter($value, 'wp_kses_decode_entities')); } else { $value = stripslashes(wp_kses_decode_entities($value)); } /** * Term meta value filter. * * Allow term meta value to be filtered before being injected into the $term->meta array. * * @since * * @param string|array $value The term meta value. * @param string $term The term that is being filtered. * @param string $taxonomy The taxonomy to which the term belongs. */ $term->meta[$field] = apply_filters("genesis_term_meta_{$field}", $value, $term, $taxonomy); } $term->meta = apply_filters('genesis_term_meta', $term->meta, $term, $taxonomy); return $term; }