function hocwp_option_reading_update($input) { $breadcrumb_label = hocwp_get_value_by_key($input, 'breadcrumb_label'); if (!empty($breadcrumb_label)) { $breadcrumb_label = hocwp_remove_last_char($breadcrumb_label, ':'); $breadcrumb_label .= ':'; $wpseo_internallinks = get_option('wpseo_internallinks'); $wpseo_internallinks['breadcrumbs-prefix'] = $breadcrumb_label; update_option('wpseo_internallinks', $wpseo_internallinks); } $posts_per_page = hocwp_get_value_by_key($input, 'products_per_page'); if (hocwp_is_positive_number($posts_per_page)) { update_option('hocwp_product_posts_per_page', $posts_per_page); } }
function hocwp_delete_transient_with_condition($transient_name, $condition = '', $blog_id = '') { global $wpdb; if (!empty($blog_id)) { $wpdb->set_blog_id($blog_id); } $last_char = hocwp_get_last_char($transient_name); if ('_' == $last_char) { $transient_name = hocwp_remove_last_char($transient_name, $last_char); } $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name like %s" . $condition, '_transient_' . $transient_name . '_%')); $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->options} WHERE option_name like %s" . $condition, '_transient_timeout_' . $transient_name . '_%')); }
function hocwp_remove_first_char_and_last_char($string, $char = '') { if (empty($char)) { $string = hocwp_remove_first_char($string); $string = hocwp_remove_last_char($string); } else { $string = trim($string, $char); } return $string; }