/** * Install additional default options for parsing after a specific option ID * Extensions would use this * * NOTE: External code should not call this function any earlier than the WordPress 'init' * action hook in order for Jigoshop language translations to function properly * * @param string $insert_after_id The name of the ID to install -after- * @param array $options The array of options to install * @since 1.3 */ public function install_external_options_after_id($insert_after_id, $options) { // only proceed with function if we have options to add if (empty($options)) { return; } if (empty($insert_after_id)) { return; } $our_options = $this->get_default_options(); $first_index = -1; foreach ($our_options as $index => $option) { if (!isset($option['id']) || $option['id'] != $insert_after_id) { continue; } $first_index = $index; break; } /*** get the start of the array ***/ $start = array_slice($our_options, 0, $first_index + 1); /*** get the end of the array ***/ $end = array_slice($our_options, $first_index + 1); /*** add the new elements to the array ***/ foreach ($options as $option) { if (isset($option['id']) && !$this->exists($option['id'])) { $this->add($option['id'], isset($option['std']) ? $option['std'] : ''); } $start[] = $option; } /*** glue them back together ***/ self::$default_options = array_merge($start, $end); }
function altSetOptions() { if (class_exists('Jigoshop_Options')) { $extracted = get_option('extracted'); if (3 == $extracted) { $args = array('posts_per_page' => 1, 'post_type' => 'shop_options'); $opt_post = get_posts($args); if ($opt_post) { foreach ($opt_post as $post) { $opt = new Jigoshop_Options(); $p_opt_to_rewrite = array('jigoshop_shop_page_id', 'jigoshop_shop_redirect_page_id', 'jigoshop_cart_page_id', 'jigoshop_track_order_page_id', 'jigoshop_myaccount_page_id', 'jigoshop_edit_address_page_id', 'jigoshop_change_password_page_id', 'jigoshop_view_order_page_id', 'jigoshop_checkout_page_id', 'jigoshop_pay_page_id', 'jigoshop_thanks_page_id'); foreach ($p_opt_to_rewrite as $page) { $meta_option = get_post_meta($post->ID, $page, true); $opt->set_option($page, $meta_option); } } } } } }