function init() { self::$active_plugins = (array) get_option('active_plugins', array()); if (is_multisite()) { self::$active_plugins = array_merge(self::$active_plugins, get_site_option('active_sitewide_plugins', array())); } }
/** * Add Product Data tab section. * * @return void */ public function woo_tied_products_write_panel() { global $woocommerce, $post; $tied_products = maybe_unserialize(get_post_meta($post->ID, '_tied_products', true)); $dependency_type = get_post_meta($post->ID, '_dependency_type', true); if (!$dependency_type) { $dependency_type = 3; } $product_id_options = array(); if ($tied_products) { foreach ($tied_products as $item_id) { $title = get_the_title($item_id); $sku = get_post_meta($item_id, '_sku', true); if (!$title) { continue; } if ($sku) { $title .= ' (SKU: ' . $sku . ')'; } $product_id_options[$item_id] = $title; } } ?> <div id="tied_products_data" class="panel woocommerce_options_panel wc-metaboxes-wrapper"> <p class="form-field"> <label> <?php _e('Product Dependencies', 'woocommerce-product-dependencies'); ?> </label><?php if (WC_Tied_Products_Dependencies::is_wc_version_gte_2_3()) { ?> <input type="hidden" id="tied_products" name="tied_products" class="wc-product-search" style="width: 75%;" data-placeholder="<?php _e('Search for products…', 'woocommerce-product-dependencies'); ?> " data-action="woocommerce_json_search_products" data-multiple="true" data-selected="<?php echo esc_attr(json_encode($product_id_options)); ?> " value="<?php echo implode(',', array_keys($product_id_options)); ?> " /><?php } else { ?> <select id="tied_products" multiple="multiple" name="tied_products[]" data-placeholder="<?php _e('Search for products…', 'woocommerce-product-dependencies'); ?> " class="ajax_chosen_select_products"><?php if (!empty($product_id_options)) { foreach ($product_id_options as $product_id => $product_name) { echo '<option value="' . $product_id . '" selected="selected">' . $product_name . '</option>'; } } ?> </select><?php } echo '<img class="help_tip" style="width:16px; height:16px;" data-tip="' . __('Restrict access to this product based on the ownership or purchase of the items added here.', 'woocommerce-product-dependencies') . '" src="' . WC()->plugin_url() . '/assets/images/help.png" />'; ?> </p> <p class="form-field"> <label><?php _e('Dependency Type', 'woocommerce-product-dependencies'); ?> </label> <select name="dependency_type" id="dependency_type" style="min-width:150px;"> <option value="1" <?php echo $dependency_type == 1 ? 'selected="selected"' : ''; ?> ><?php _e('Ownership', 'woocommerce-product-dependencies'); ?> </option> <option value="2" <?php echo $dependency_type == 2 ? 'selected="selected"' : ''; ?> ><?php _e('Purchase', 'woocommerce-product-dependencies'); ?> </option> <option value="3" <?php echo $dependency_type == 3 ? 'selected="selected"' : ''; ?> ><?php _e('Either', 'woocommerce-product-dependencies'); ?> </option> </select> </p> </div> <?php }