/** * Pings http://api.genesistheme.com/ asking if a new version of this theme is * available. * * If not, it returns false. * * If so, the external server passes serialized data back to this function, * which gets unserialized and returned for use. * * @since 1.1.0 * * @uses genesis_get_option() * @uses PARENT_THEME_VERSION Genesis version string * * @global string $wp_version WordPress version string * @return mixed Unserialized data, or false on failure */ function genesis_update_check() { global $wp_version; /** If updates are disabled */ if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) { return false; } /** Get time of last update check */ $genesis_update = get_transient('genesis-update'); /** If it has expired, do an update check */ if (!$genesis_update) { $url = 'http://api.genesistheme.com/update-themes/'; $options = apply_filters('genesis_update_remote_post_options', array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};"))); $response = wp_remote_post($url, $options); $genesis_update = wp_remote_retrieve_body($response); /** If an error occurred, return FALSE, store for 1 hour */ if ('error' == $genesis_update || is_wp_error($genesis_update) || !is_serialized($genesis_update)) { set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60); return false; } /** Else, unserialize */ $genesis_update = maybe_unserialize($genesis_update); /** And store in transient for 24 hours */ set_transient('genesis-update', $genesis_update, 60 * 60 * 24); } /** If we're already using the latest version, return false */ if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) { return false; } return $genesis_update; }
public function payment_post_meta($payment_id) { ini_set('xdebug.var_display_max_depth', 5); ini_set('xdebug.var_display_max_children', 256); ini_set('xdebug.var_display_max_data', 1024); ?> <div id="edd-payment-meta" class="postbox"> <h3 class="hndle"><?php _e('Payment Postmeta Items', 'edd-dev-tools'); ?> </h3> <div class="inside"> <div style="overlfow:auto"> <?php $post_meta = get_metadata('post', $payment_id); ?> <pre style="overflow: auto;word-wrap: break-word;"> <?php foreach ($post_meta as $key => $value) { if (is_serialized($value[0])) { echo $key . '=> '; var_dump(unserialize($value[0])); } else { echo $key . ' => ' . $value[0] . "\n"; } } ?> </pre> </div> </div> </div> <?php }
function cjtheme_fetch_shortcode_options() { global $wpdb, $shortcode_tags; $select_shortcodes = null; $shortcode_options = cjtheme_do_shortcode('[' . $_POST['shortcode'] . ' return="options"]'); $shortcode_options = is_serialized($shortcode_options) ? unserialize($shortcode_options) : $shortcode_options; $shortcode_defaults = cjtheme_do_shortcode('[' . $_POST['shortcode'] . ' return="defaults"]'); $shortcode_defaults = is_serialized($shortcode_defaults) ? unserialize($shortcode_defaults) : $shortcode_defaults; $form_fields[] = array('type' => 'heading', 'id' => 'shortcode-settings-heading', 'label' => '', 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => __('Shortcode Settings', 'cjtheme'), 'options' => ''); if (!is_null($shortcode_options['description'])) { $form_fields[] = array('type' => 'info-full', 'id' => 'shortcode_info', 'label' => '', 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => $shortcode_options['description'], 'options' => ''); } if ($shortcode_options['stype'] == 'closed' && isset($shortcode_options['default_content']) && $shortcode_options['default_content'] != '') { $form_fields[] = array('type' => 'textarea', 'id' => 'shortcode_content', 'label' => __('Content', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => $shortcode_options['default_content'], 'options' => ''); } foreach ($shortcode_options as $key => $options) { if (is_array($options)) { $form_fields[] = array('type' => $options[1], 'id' => $key, 'label' => $options[0], 'info' => $options[3], 'suffix' => '', 'prefix' => '', 'default' => isset($shortcode_defaults[$key]) ? $shortcode_defaults[$key] : '', 'options' => is_array($options[2]) ? $options[2] : ''); } } $form_fields[] = array('type' => 'submit', 'id' => 'cj-insert-shortcode', 'label' => __('Insert Shortcode', 'cjtheme'), 'info' => '', 'suffix' => '', 'prefix' => '', 'default' => '', 'options' => ''); echo '<div class="cj-table">'; echo '<form action="" method="post" id="cj-shortcode-settings-form" data-shortcode-stype="' . $shortcode_options['stype'] . '" data-shortcode-name="' . $_POST['shortcode'] . '">'; echo cjtheme_admin_form_raw($form_fields, 'no-search-box', true); echo '</form>'; echo '</div>'; die; }
/** * Recursively search and replace * @param mixed $data - **by reference** - string or array which should have find/replace applied * @param array $search array with text values to find * @param array $replace array with text values to replace $search values with * @param array $regex_search array with regular expressions to look for * @param array $regex_replace array with text value to replace $regex_search values with * @return int number of replacements made */ function ns_recursive_search_replace(&$data, $search, $replace, $regex_search = array(), $regex_replace = array(), $case_sensitive = false) { $is_serialized = is_serialized($data); $string_replacements_made = $regex_replacements_made = 0; // unserialize if need be if ($is_serialized) { $data = unserialize($data); } // run through replacements for strings, arrays - other types are unsupported to vaoid if (is_array($data)) { foreach ($data as $key => $value) { ns_recursive_search_replace($data[$key], $search, $replace, $regex_search, $regex_replace, $case_sensitive); } } elseif (is_string($data)) { // simple string replacment - most of the time this is all that is needed $replace_func = $case_sensitive ? 'str_replace' : 'str_ireplace'; $data = $replace_func($search, $replace, $data, $string_replacements_made); // advanced regex replacement - this will be skipped most of the time if (!empty($regex_search) && !empty($regex_replace)) { $data = preg_replace($regex_search, $regex_replace, $data, -1, $regex_replacements_made); } } // reserialize if need be if ($is_serialized) { $data = serialize($data); } // return count of replacements made return $string_replacements_made + $regex_replacements_made; }
public function display_field($field, $group_index = 1, $field_index = 1) { $output = ''; $is_multiple = $field['options']['multiple'] ? true : false; $check_post_id = null; if (!empty($_REQUEST['post'])) { $check_post_id = $_REQUEST['post']; } $values = array(); if ($check_post_id) { $values = $field['input_value'] ? is_serialized($field['input_value']) ? unserialize($field['input_value']) : (array) $field['input_value'] : array(); } else { $values[] = $field['options']['default_value']; } foreach ($values as &$val) { $val = trim($val); } $options = preg_split("/\\n/", $field['options']['options']); $output = '<div class="mf-dropdown-box">'; $multiple = $is_multiple ? 'multiple="multiple"' : ''; $output .= sprintf('<select class="dropdown_mf" id="%s" name="%s[]" %s >', $field['input_id'], $field['input_name'], $multiple); foreach ($options as $option) { $option = trim($option); $check = in_array($option, $values) ? 'selected="selected"' : ''; $output .= sprintf('<option value="%s" %s >%s</option>', esc_attr($option), $check, esc_attr($option)); } $output .= '</select>'; $output .= '</div>'; return $output; }
protected function _getAll() { $result = array(); $_temp = array(); global $wpdb; $key_prefix = $this->_getOptionName(''); $terms = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE '{$key_prefix}%'"); foreach ($terms as $term) { if (is_serialized($term->option_value)) { $_term = unserialize($term->option_value); $key = str_replace($key_prefix, '', $term->option_name); if (trim($_term['description'])) { $_temp[$_term['description']][] = array('key' => $key, 'term' => $_term); } else { $_temp[] = array('key' => $key, 'term' => $_term); } } } ksort($_temp); foreach ($_temp as $temp) { if (!isset($temp['key'])) { foreach ($temp as $t) { $result[$t['key']] = $t['term']; } } else { $result[$temp['key']] = $temp['term']; } } return $result; }
function pmxi_wp_ajax_auto_detect_sf() { if (!check_ajax_referer('wp_all_import_secure', 'security', false)) { exit(json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin')))); } if (!current_user_can(PMXI_Plugin::$capabilities)) { exit(json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin')))); } $input = new PMXI_Input(); $fieldName = $input->post('name', ''); $post_type = $input->post('post_type', 'post'); global $wpdb; $result = array(); if ($fieldName) { if ($post_type == 'import_users') { $values = $wpdb->get_results("\n\t\t\t\tSELECT DISTINCT usermeta.meta_value\n\t\t\t\tFROM " . $wpdb->usermeta . " as usermeta\n\t\t\t\tWHERE usermeta.meta_key='" . $fieldName . "'\n\t\t\t", ARRAY_A); } else { $values = $wpdb->get_results("\n\t\t\t\tSELECT DISTINCT postmeta.meta_value\n\t\t\t\tFROM " . $wpdb->postmeta . " as postmeta\n\t\t\t\tWHERE postmeta.meta_key='" . $fieldName . "'\n\t\t\t", ARRAY_A); } if (!empty($values)) { foreach ($values as $key => $value) { if (!empty($value['meta_value']) and is_serialized($value['meta_value'])) { $v = unserialize($value['meta_value']); if (!empty($v) and is_array($v)) { foreach ($v as $skey => $svalue) { $result[] = array('key' => $skey, 'val' => maybe_serialize($svalue)); } break; } } } } } exit(json_encode(array('result' => $result))); }
function duplicate_over_multisite($post_id_to_copy, $new_blog_id, $post_type, $post_author, $prefix, $post_status) { $mdp_post = get_post($post_id_to_copy); $title = get_the_title($mdp_post); if ($prefix != '') { $prefix = $prefix . ' '; } $mdp_post = array('post_title' => $prefix . $title, 'post_status' => $post_status, 'post_type' => $post_type, 'post_author' => $post_author, 'post_content' => $mdp_post->post_content); $data = get_post_custom($mdp_post); $meta_values = get_post_meta($post_id_to_copy); switch_to_blog($new_blog_id); $post_id = wp_insert_post($mdp_post); foreach ($data as $key => $values) { foreach ($values as $value) { add_post_meta($post_id, $key, $value); } } foreach ($meta_values as $key => $values) { foreach ($values as $value) { if (is_serialized($value)) { add_post_meta($post_id, $key, unserialize($value)); } else { add_post_meta($post_id, $key, $value); } } } restore_current_blog(); return $post_id; }
public function test($data) { if (function_exists('is_serialized')) { return is_serialized($data); } return preg_match('/(a\\:[0-9]{1,})?(i\\:[0-9]{1,})?(s\\:[0-9]{1,})?/', $data) && !empty($this->decodedData = unserialize($data)); }
function convert_font_to_variable($data, $tag) { //is_serialized $value = ''; if (is_serialized($data)) { $data = unserialize($data); } if (isset($data['font-family'])) { $value = "@{$tag}_font_family: {$data['font-family']};\n"; } if (isset($data['color-opacity'])) { $value .= "@{$tag}_color: {$data['color-opacity']};\n"; } if (isset($data['font-weight'])) { $value .= "@{$tag}_font_weight: {$data['font-weight']};\n"; } if (isset($data['font-style'])) { $value .= "@{$tag}_font_style: {$data['font-style']};\n"; } if (isset($data['text-transform'])) { $value .= "@{$tag}_text_transform: {$data['text-transform']};\n"; } if (isset($data['font-size'])) { $value .= "@{$tag}_font_size: {$data['font-size']};\n"; } if (isset($data['line-height'])) { $value .= "@{$tag}_line_height: {$data['line-height']};\n"; } return $value; }
function ultimatum_update_check() { global $wp_version; $ultimatumversion = get_option('ultimatum_version'); $apikey = get_option('ultimatum_api'); $ultimatum_update = get_transient('ultimatum-update'); if (!$ultimatum_update) { $url = 'http://api.ultimatumtheme.com/'; $options = array('body' => array('task' => 'updatecheck', 'ultimatum_version' => $ultimatumversion, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'api_key' => $apikey, 'user-agent' => "WordPress/{$wp_version};")); $response = wp_remote_post($url, $options); $ultimatum_update = wp_remote_retrieve_body($response); // If an error occurred, return FALSE, store for 1 hour if ($ultimatum_update == 'error' || is_wp_error($ultimatum_update) || !is_serialized($ultimatum_update)) { set_transient('ultimatum-update', array('new_version' => $ultimatumversion), 60 * 60); // store for 1 hour return FALSE; } // Else, unserialize $ultimatum_update = maybe_unserialize($ultimatum_update); //print_r($ultimatum_update);die(); // And store in transient set_transient('ultimatum-update', $ultimatum_update, 60 * 60 * 24); // store for 24 hours } // If we're already using the latest version, return FALSE if (version_compare($ultimatumversion, $ultimatum_update['new_version'], '>=')) { return FALSE; } return $ultimatum_update; }
public function display_field($field, $group_index = 1, $field_index = 1) { $output = ''; $check_post_id = null; if (!empty($_REQUEST['post'])) { $check_post_id = $_REQUEST['post']; } $values = array(); if ($check_post_id) { $values = $field['input_value'] ? is_serialized($field['input_value']) ? unserialize($field['input_value']) : (array) $field['input_value'] : array(); } else { $values = (array) preg_split("/\\n/", $field['options']['default_value']); } $options = preg_split("/\\n/", $field['options']['options']); $output = '<div class="mf-checkbox-list-box" >'; foreach ($values as &$val) { $val = trim($val); } foreach ($options as $option) { $option = trim($option); $check = in_array($option, $values) ? 'checked="checked"' : ''; $output .= sprintf('<label for="%s_%s" class="selectit mf-checkbox-list">', $field['input_id'], $option); $output .= sprintf('<input tabindex="3" class="checkbox_list_mf" id="%s_%s" name="%s[]" value="%s" type="checkbox" %s %s />', $field['input_id'], $option, $field['input_name'], $option, $check, $field['input_validate']); $output .= esc_attr($option); $output .= '</label>'; } $output .= '</div>'; return $output; }
/** * This function calibrefx_update_check is to ... */ function calibrefx_update_check() { global $wp_version; /** Get time of last update check */ $calibrefx_update = get_transient('calibrefx-update'); /** If it has expired, do an update check */ if (!$calibrefx_update) { $url = 'http://api.calibrefx.com/themes-update/'; $options = apply_filters('calibrefx_update_remote_post_options', array('body' => array('theme_name' => 'calibrefx', 'theme_version' => FRAMEWORK_VERSION, 'url' => home_url(), 'wp_version' => $wp_version, 'php_version' => phpversion(), 'user-agent' => "WordPress/{$wp_version};"))); $response = wp_remote_post($url, $options); $calibrefx_update = wp_remote_retrieve_body($response); /** If an error occurred, return FALSE, store for 48 hour */ if ('error' == $calibrefx_update || is_wp_error($calibrefx_update) || !is_serialized($calibrefx_update)) { set_transient('calibrefx-update', array('new_version' => FRAMEWORK_VERSION), 60 * 60 * 48); return false; } /** Else, unserialize */ $calibrefx_update = maybe_unserialize($calibrefx_update); /** And store in transient for 48 hours */ set_transient('calibrefx-update', $calibrefx_update, 60 * 60 * 48); } /** If we're already using the latest version, return false */ if (version_compare(FRAMEWORK_VERSION, $calibrefx_update['new_version'], '>=')) { return false; } return $calibrefx_update; }
/** * Unserialized variable to array. * * @param $education * @return string */ public function getValueAttribute($value) { if (is_serialized($value)) { return unserialize($value); } return $value; }
/** * This function pings an http://api.genesistheme.com/ asking if a new * version of this theme is available. If not, it returns FALSE. * If so, the external server passes serialized data back to this * function, which gets unserialized and returned for use. * * @since 1.1 */ function genesis_update_check() { global $wp_version; // If updates are disabled if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) { return FALSE; } $genesis_update = get_transient('genesis-update'); if (!$genesis_update) { $url = 'http://api.genesistheme.com/update-themes/'; $options = array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};")); $response = wp_remote_post($url, $options); $genesis_update = wp_remote_retrieve_body($response); // If an error occurred, return FALSE, store for 1 hour if ($genesis_update == 'error' || is_wp_error($genesis_update) || !is_serialized($genesis_update)) { set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60); // store for 1 hour return FALSE; } // Else, unserialize $genesis_update = maybe_unserialize($genesis_update); // And store in transient set_transient('genesis-update', $genesis_update, 60 * 60 * 24); // store for 24 hours } // If we're already using the latest version, return FALSE if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) { return FALSE; } return $genesis_update; }
function pmxi_wp_ajax_auto_detect_sf() { $input = new PMXI_Input(); $fieldName = $input->post('name', ''); $post_type = $input->post('post_type', 'post'); global $wpdb; $result = array(); if ($fieldName) { if ($post_type == 'import_users') { $values = $wpdb->get_results("\n\t\t\t\tSELECT DISTINCT usermeta.meta_value\n\t\t\t\tFROM " . $wpdb->usermeta . " as usermeta\n\t\t\t\tWHERE usermeta.meta_key='" . $fieldName . "'\n\t\t\t", ARRAY_A); } else { $values = $wpdb->get_results("\n\t\t\t\tSELECT DISTINCT postmeta.meta_value\n\t\t\t\tFROM " . $wpdb->postmeta . " as postmeta\n\t\t\t\tWHERE postmeta.meta_key='" . $fieldName . "'\n\t\t\t", ARRAY_A); } if (!empty($values)) { foreach ($values as $key => $value) { if (!empty($value['meta_value']) and is_serialized($value['meta_value'])) { $v = unserialize($value['meta_value']); if (!empty($v) and is_array($v)) { foreach ($v as $skey => $svalue) { $result[] = array('key' => $skey, 'val' => maybe_serialize($svalue)); } break; } } } } } exit(json_encode(array('result' => $result))); }
/** * Check to see if a new version of Catayst is available. * * @since 1.0 * @return either response or transient. */ function dynamik_update_check() { global $wp_version; // Debug Auto-Update. //delete_transient( 'dynamik-gen-update' ); $dynamik_transient = get_transient('dynamik-gen-update'); if ($dynamik_transient == false) { $api_url = 'http://api.cobaltapps.com/dynamik-update/'; // Start checking for an update $send_for_check = array('body' => array('action' => 'theme_update', 'request' => array('slug' => 'dynamik-gen', 'version' => CHILD_THEME_VERSION)), 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url()); $raw_response = wp_remote_post($api_url, $send_for_check); if (!is_wp_error($raw_response) && $raw_response['response']['code'] == 200 && is_serialized($raw_response['body'])) { $response = unserialize($raw_response['body']); } else { set_transient('dynamik-gen-update', array('new_version' => CHILD_THEME_VERSION), 60 * 60 * 24); // store for 24 hours } if (!empty($response)) { set_transient('dynamik-gen-update', $response, 60 * 60 * 24); // store for 24 hours return $response; } } else { return $dynamik_transient; } }
public static function get($key, $group = false, $default = null) { $d = static::$driver; $hash = static::hash($key); $r = $d::get($hash, $group, $default); return is_serialized($r) ? unserialize($r) : $r; }
function maybe_unserialize($original) { if (is_serialized($original)) { // don't attempt to unserialize data that wasn't serialized going in return @unserialize($original); } return $original; }
/** * Sanitize sortable controls * * @since 0.8.3 * * @return mixed */ public static function sortable($value) { if (is_serialized($value)) { return $value; } else { return serialize($value); } }
/** * Sanitize sortable controls * * @since 0.8.3 */ function kirki_sanitize_sortable($value) { if (is_serialized($value)) { return $value; } else { return serialize($value); } }
function unserialize($data) { if (is_serialized($data)) { return unserialize($data); } else { return json_decode($data, true); } }
static function get_meta($post_id, $key) { if ($post_id && $key && ($meta = get_post_meta($post_id, $key, true)) && ($options = is_serialized($meta) ? @unserialize($meta) : $meta) && (is_array($options) || is_string($options))) { return $options; } else { return false; } }
public function _construct() { $arrLanguages = $this->user->getAvailableLanguages(); $strDefaultLanguage = $this->config->get('default_lang'); $this->jquery->init_multilang(); if (is_serialized($this->value)) { $this->value = @unserialize($this->value); } elseif (!is_array($this->value) && $this->value != "") { $strValue = $this->value; $this->value = array(); $this->value[$strDefaultLanguage] = $strValue; } $this->out = '<div class="input-multilang textarea"> <div class="multilang-switcher-container hand"><div class="multilang-switcher"><span>' . $arrLanguages[$strDefaultLanguage] . '</span> <i class="fa fa-caret-down fa-lg"></i></div> <div class="multilang-dropdown"><ul> '; foreach ($arrLanguages as $strKey => $strLang) { $this->out .= '<li data-lang="' . $strLang . '" data-key="' . $strKey . '" class="' . ($strKey == $strDefaultLanguage ? 'active' : '') . '">' . $strLang . '</li>'; } $this->out .= '</ul></div><br />'; foreach ($arrLanguages as $strKey => $strLang) { $out = '<textarea name="' . $this->name . '[' . $strKey . ']" rows="' . $this->rows . '" cols="' . $this->cols . '" '; if (empty($this->id)) { $this->id = $this->cleanid($this->name); } $out .= 'id="' . $this->id . '" '; $class = "taml_" . $this->cleanid($this->name) . " " . $strKey; if (!empty($this->class)) { $class .= ' ' . $this->class; } $out .= 'class="' . $class . '" '; if ($this->disabled) { $out .= 'disabled="disabled" '; } if (!empty($this->js)) { $out .= $this->js . ' '; } if ($this->required && $strKey == $strDefaultLanguage) { $out .= 'required="required" '; } if (!empty($this->placeholder)) { $out .= 'placeholder="' . $this->placeholder . '" '; } if ($strKey != $strDefaultLanguage) { $out .= ' style="display:none;"'; } $out .= '>'; if (isset($this->value) && isset($this->value[$strKey])) { $out .= $this->value[$strKey]; } $out .= '</textarea>'; $this->out .= $out; } $this->out .= '</div>'; if ($this->required) { $this->out .= '<span class="fv_msg" data-errormessage="' . registry::fetch('user')->lang('fv_required') . '"></span>'; } }
/** * Decodes a given base 64 encoded string. * * @return string */ public function decode($sCode) { // make sure it's empty $this->params = array(); $this->_currentTagContents = $sCode; $this->tag_close('', 'base64'); $vData = $this->params[0]; return is_serialized($vData) ? unserialize($vData) : $vData; }
public function get_option($key, $lang_id = null) { $result = $this->option->where('key', $key)->where('lang_id', $lang_id)->first(['value']); if (is_null($result)) { return null; } $value = $result->value; return is_serialized($value) ? unserialize($value) : $value; }
/** * Display meta in a formatted list * * @access public * @param bool $flat (default: false) * @param bool $return (default: false) * @param string $hideprefix (default: _) * @return string */ public function display($flat = false, $return = false, $hideprefix = '_') { if (!empty($this->meta)) { $meta_list = array(); foreach ($this->meta as $meta_key => $meta_values) { if (empty($meta_values) || !empty($hideprefix) && substr($meta_key, 0, 1) == $hideprefix) { continue; } foreach ($meta_values as $meta_value) { // Skip serialised meta if (is_serialized($meta_value)) { continue; } $attribute_key = urldecode(str_replace('attribute_', '', $meta_key)); // If this is a term slug, get the term's nice name if (taxonomy_exists($attribute_key)) { $term = get_term_by('slug', $meta_value, $attribute_key); if (!is_wp_error($term) && is_object($term) && $term->name) { $meta_value = $term->name; } // If we have a product, and its not a term, try to find its non-sanitized name } elseif ($this->product) { $product_attributes = $this->product->get_attributes(); if (isset($product_attributes[$attribute_key])) { $meta_key = wc_attribute_label($product_attributes[$attribute_key]['name']); } } if ($flat) { $meta_list[] = wp_kses_post(wc_attribute_label($attribute_key) . ': ' . apply_filters('woocommerce_order_item_display_meta_value', $meta_value)); } else { $meta_list[] = ' <dt class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wc_attribute_label($attribute_key)) . ':</dt> <dd class="variation-' . sanitize_html_class(sanitize_text_field($meta_key)) . '">' . wp_kses_post(wpautop(apply_filters('woocommerce_order_item_display_meta_value', $meta_value))) . '</dd> '; } } } if (!sizeof($meta_list)) { return ''; } $output = $flat ? '' : '<dl class="variation">'; if ($flat) { $output .= implode(", \n", $meta_list); } else { $output .= implode('', $meta_list); } if (!$flat) { $output .= '</dl>'; } if ($return) { return $output; } else { echo $output; } } return ''; }
private static function unserialize_property($property) { if (!isset($property)) { return; } if ($unserialized_string = is_serialized($property)) { return unserialize($property); } return $property; }
public function get($key) { if (!empty($_SESSION[$this->name][$key])) { if (is_serialized($_SESSION[$this->name][$key])) { $res = unserialize($_SESSION[$this->name][$key]); } else { $res = $_SESSION[$this->name][$key]; } return $res; } }
/** * Ping https://api.ultimatumtheme.com/ asking if a new version of this theme is available. * * If not, it returns false. * * If so, the external server passes serialized data back to this function, which gets unserialized and returned for use. * * Applies `ultimatum_update_remote_post_options` filter. * * Ping occurs at a maximum of once every 24 hours. * */ function ultimatum_update_check() { global $wp_version; $ultimatumversion = get_option('ultimatum_version'); if(is_multisite()){ $apikey = get_site_option('ultimatum_api'); } else { $apikey = get_option('ultimatum_api'); } //* If updates are disabled if ( ! get_option( 'ultimatum-auto-update' ) || ! $apikey ) return false; //* Get time of last update check $ultimatum_update = get_transient( 'ultimatum-update' ); //* If it has expired, do an update check if ( ! $ultimatum_update ) { $url = ULTIMATUM_API; $options = array( 'body' => array( 'task'=>'updatecheck', 'ultimatum_version' => $ultimatumversion, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'api_key' => $apikey, 'user-agent' => "WordPress/$wp_version;" ) ); $response = wp_remote_post( $url, $options ); $ultimatum_update = wp_remote_retrieve_body( $response ); //* If an error occurred, return FALSE, store for 1 hour if ( 'error' === $ultimatum_update || is_wp_error( $ultimatum_update ) || ! is_serialized( $ultimatum_update ) ) { set_transient( 'ultimatum-update', array( 'new_version' => ULTIMATUM_VERSION ), 60 * 60 ); return false; } //* Else, unserialize $ultimatum_update = maybe_unserialize( $ultimatum_update ); //* And store in transient for 24 hours set_transient( 'ultimatum-update', $ultimatum_update, 60 * 60 * 24 ); } //* If we're already using the latest version, return false if ( version_compare( ULTIMATUM_VERSION, $ultimatum_update['new_version'], '>=' ) ) return false; return $ultimatum_update; }