Addons page Closes #3331
This commit is contained in:
parent
54fceb7d99
commit
fa7c1d9a6a
File diff suppressed because one or more lines are too long
|
@ -16,6 +16,63 @@
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Addons */
|
||||||
|
.wc_addons_wrap {
|
||||||
|
.products {
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 10px 10px 0;
|
||||||
|
padding: 0;
|
||||||
|
vertical-align: top;
|
||||||
|
width: 300px;
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
display: block;
|
||||||
|
min-height: 162px;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255,255,255,0.2),
|
||||||
|
inset 0 -1px 0 rgba(0,0,0,0.1);
|
||||||
|
box-shadow:
|
||||||
|
inset 0 1px 0 rgba(255,255,255,0.2),
|
||||||
|
inset 0 -1px 0 rgba(0,0,0,0.1);
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 258px;
|
||||||
|
max-height: 30px;
|
||||||
|
padding: 20px;
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-right: 260px solid #fff;
|
||||||
|
}
|
||||||
|
img.extension-thumb+h3 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.price {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 20px !important;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
padding: 20px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
border-top: 1px solid #f1f1f1;
|
||||||
|
}
|
||||||
|
&:hover, &:focus {
|
||||||
|
background-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* =Styles
|
/* =Styles
|
||||||
-------------------------------------------------------------- */
|
-------------------------------------------------------------- */
|
||||||
|
@ -136,38 +193,6 @@
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#woocommerce_extensions {
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
background-image: url(../images/icons/wc_icon.png);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: 4px 4px;
|
|
||||||
padding: 4px 18px 4px 28px;
|
|
||||||
-webkit-border-radius:4px;
|
|
||||||
-moz-border-radius:4px;
|
|
||||||
-o-border-radius:4px;
|
|
||||||
border-radius:4px;
|
|
||||||
width: 220px;
|
|
||||||
float:right;
|
|
||||||
margin: 9px 0 -40px;
|
|
||||||
position: relative;
|
|
||||||
text-shadow:0 1px 0 rgba(255,255,255,0.8);
|
|
||||||
color: #555;
|
|
||||||
a {
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
a.hide {
|
|
||||||
color: #ccc;
|
|
||||||
float: right;
|
|
||||||
text-decoration: none;
|
|
||||||
position: absolute;
|
|
||||||
top:0;
|
|
||||||
right: 0;
|
|
||||||
line-height: 20px;
|
|
||||||
padding: 2px 8px;
|
|
||||||
font-size: 11px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#wc_get_started { position: relative; margin: 1em 0 2em; padding: 15px 15px 15px 90px; border: 1px solid #d9d9d9; background: #f5f5f5 url(../images/gear.png) no-repeat 15px 15px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -moz-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -webkit-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; }
|
#wc_get_started { position: relative; margin: 1em 0 2em; padding: 15px 15px 15px 90px; border: 1px solid #d9d9d9; background: #f5f5f5 url(../images/gear.png) no-repeat 15px 15px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -moz-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; -webkit-box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #fff; }
|
||||||
#wc_get_started span { display: block; text-shadow: 1px 1px 0 #fff; font-size: 14px; line-height: 22px; color: #595959; }
|
#wc_get_started span { display: block; text-shadow: 1px 1px 0 #fff; font-size: 14px; line-height: 22px; color: #595959; }
|
||||||
#wc_get_started span.main { margin-top: 2px; font-weight: bold; font-size: 16px; }
|
#wc_get_started span.main { margin-top: 2px; font-weight: bold; font-size: 16px; }
|
||||||
|
@ -3125,10 +3150,5 @@ table.bar_chart {
|
||||||
background-image: url(../images/icons/woocommerce-icons-x2.png) !important;
|
background-image: url(../images/icons/woocommerce-icons-x2.png) !important;
|
||||||
background-size: 986px 91px !important;
|
background-size: 986px 91px !important;
|
||||||
}
|
}
|
||||||
#woocommerce_extensions {
|
|
||||||
background-image: url(../images/icons/wc_icon@2x.png);
|
|
||||||
background-size: 16px 17px;
|
|
||||||
background-position: 6px 6px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@import 'chosen.less';
|
@import 'chosen.less';
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Addons Page
|
||||||
|
*
|
||||||
|
* @author WooThemes
|
||||||
|
* @category Admin
|
||||||
|
* @package WooCommerce/Admin
|
||||||
|
* @version 2.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WC_Admin_Addons' ) ) :
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Admin_Addons Class
|
||||||
|
*/
|
||||||
|
class WC_Admin_Addons {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles output of the reports page in admin.
|
||||||
|
*/
|
||||||
|
public function output() {
|
||||||
|
|
||||||
|
$view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : '';
|
||||||
|
|
||||||
|
if ( false === ( $addons = get_transient( 'woocommerce_addons_html_' . $view ) ) ) {
|
||||||
|
|
||||||
|
$raw_addons = wp_remote_get( 'http://www.woothemes.com/product-category/woocommerce-extensions/' . $view . '?orderby=popularity' );
|
||||||
|
|
||||||
|
if ( ! is_wp_error( $raw_addons ) ) {
|
||||||
|
|
||||||
|
$raw_addons = wp_remote_retrieve_body( $raw_addons );
|
||||||
|
|
||||||
|
// Get Products
|
||||||
|
$dom = new DOMDocument();
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
|
$dom->loadHTML( $raw_addons );
|
||||||
|
|
||||||
|
$xpath = new DOMXPath( $dom );
|
||||||
|
$tags = $xpath->query('//ul[@class="products"]');
|
||||||
|
foreach ( $tags as $tag ) {
|
||||||
|
$addons = $tag->ownerDocument->saveXML( $tag );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $addons )
|
||||||
|
set_transient( 'woocommerce_addons_html_' . $view, wp_kses_post( $addons ), 60*60*24*7 ); // Cached for a week
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once( 'views/html-admin-page-addons.php' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endif;
|
||||||
|
|
||||||
|
return new WC_Admin_Addons();
|
|
@ -27,6 +27,9 @@ class WC_Admin_Menus {
|
||||||
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
|
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
|
||||||
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
|
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
|
||||||
|
|
||||||
|
if ( apply_filters( 'woocommerce_show_addons_page', true ) )
|
||||||
|
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
|
||||||
|
|
||||||
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
|
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
|
||||||
add_filter( 'menu_order', array( $this, 'menu_order' ) );
|
add_filter( 'menu_order', array( $this, 'menu_order' ) );
|
||||||
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
|
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
|
||||||
|
@ -77,6 +80,13 @@ class WC_Admin_Menus {
|
||||||
add_submenu_page( 'woocommerce', __( 'WooCommerce Status', 'woocommerce' ), __( 'System Status', 'woocommerce' ) , 'manage_woocommerce', 'wc_status', array( $this, 'status_page' ) );
|
add_submenu_page( 'woocommerce', __( 'WooCommerce Status', 'woocommerce' ), __( 'System Status', 'woocommerce' ) , 'manage_woocommerce', 'wc_status', array( $this, 'status_page' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addons menu item
|
||||||
|
*/
|
||||||
|
public function addons_menu() {
|
||||||
|
add_submenu_page( 'woocommerce', __( 'WooCommerce Add-ons/Extensions', 'woocommerce' ), __( 'Add-ons', 'woocommerce' ) , 'manage_woocommerce', 'wc_addons', array( $this, 'addons_page' ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Highlights the correct top level admin menu item for post type add screens.
|
* Highlights the correct top level admin menu item for post type add screens.
|
||||||
*
|
*
|
||||||
|
@ -198,12 +208,20 @@ class WC_Admin_Menus {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init the reports page
|
* Init the status page
|
||||||
*/
|
*/
|
||||||
public function status_page() {
|
public function status_page() {
|
||||||
$page = include( 'class-wc-admin-status.php' );
|
$page = include( 'class-wc-admin-status.php' );
|
||||||
$page->output();
|
$page->output();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the addons page
|
||||||
|
*/
|
||||||
|
public function addons_page() {
|
||||||
|
$page = include( 'class-wc-admin-addons.php' );
|
||||||
|
$page->output();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<div class="wrap woocommerce wc_addons_wrap">
|
||||||
|
<div class="icon32 icon32-posts-product" id="icon-woocommerce"><br /></div>
|
||||||
|
<h2>
|
||||||
|
<?php _e( 'WooCommerce Add-ons/Extensions', 'woocommerce' ); ?>
|
||||||
|
<a href="http://www.woothemes.com/product-category/woocommerce-extensions/" class="add-new-h2"><?php _e( 'Browse all extensions', 'woocommerce' ); ?></a>
|
||||||
|
<a href="http://www.woothemes.com/product-category/themes/woocommerce/" class="add-new-h2"><?php _e( 'Browse themes', 'woocommerce' ); ?></a>
|
||||||
|
</h2>
|
||||||
|
<ul class="subsubsub">
|
||||||
|
<?php
|
||||||
|
$links = array(
|
||||||
|
'' => __( 'Popular', 'woocommerce' ),
|
||||||
|
'payment-gateways' => __( 'Gateways', 'woocommerce' ),
|
||||||
|
'shipping-methods' => __( 'Shipping', 'woocommerce' ),
|
||||||
|
'import-export-extensions' => __( 'Import/export', 'woocommerce' ),
|
||||||
|
'product-extensions' => __( 'Products', 'woocommerce' ),
|
||||||
|
'marketing-extensions' => __( 'Marketing', 'woocommerce' ),
|
||||||
|
'free-extensions' => __( 'Free', 'woocommerce' )
|
||||||
|
);
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach ( $links as $link => $name ) {
|
||||||
|
$i ++;
|
||||||
|
?><li><a class="<?php if ( $view == $link ) echo 'current'; ?>" href="<?php echo admin_url( 'admin.php?page=wc_addons&view=' . esc_attr( $link ) ); ?>"><?php echo $name; ?></a><?php if ( $i != sizeof( $links ) ) echo ' |'; ?></li><?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<br class="clear" />
|
||||||
|
<?php echo $addons; ?>
|
||||||
|
</div>
|
|
@ -24,6 +24,7 @@ function wc_get_screen_ids() {
|
||||||
$wc_screen_id . '_page_wc_status',
|
$wc_screen_id . '_page_wc_status',
|
||||||
$wc_screen_id . '_page_woocommerce_settings',
|
$wc_screen_id . '_page_woocommerce_settings',
|
||||||
$wc_screen_id . '_page_wc_status',
|
$wc_screen_id . '_page_wc_status',
|
||||||
|
$wc_screen_id . '_page_wc_addons',
|
||||||
$wc_screen_id . '_page_woocommerce_customers',
|
$wc_screen_id . '_page_woocommerce_customers',
|
||||||
'toplevel_page_woocommerce',
|
'toplevel_page_woocommerce',
|
||||||
'woocommerce_page_woocommerce_settings',
|
'woocommerce_page_woocommerce_settings',
|
||||||
|
|
Loading…
Reference in New Issue