@@ -239,7 +237,7 @@ function wpsc_price_control_forms() { 0 ) { + if ( count( (array) $product_meta['table_rate_price']['quantity'] ) > 0 ) { foreach ( (array) $product_meta['table_rate_price']['quantity'] as $key => $quantity ) { if ( $quantity != '' ) { $table_price = number_format( $product_meta['table_rate_price']['table_price'][ $key ], 2, '.', '' ); @@ -299,7 +297,7 @@ function wpsc_stock_control_forms() { if ( ! isset( $product_meta['unpublish_when_none_left'] ) ) { $product_meta['unpublish_when_none_left'] = ''; } - + if ( ! isset( $product_meta['stock_limit_notify'] ) ) { $product_meta['stock_limit_notify'] = ''; } @@ -348,7 +346,7 @@ class='stock_limit_quantity' /> ID ); - $reserved_quantity = $product_data['meta']['_wpsc_stock'] - $remaining_quantity; + $reserved_quantity = intval( $product_data['meta']['_wpsc_stock'] ) - $remaining_quantity; if ( $reserved_quantity ) { echo '
';
printf( _n('%s of them is reserved for pending or recently completed orders.',
diff --git a/wpsc-admin/includes/product-functions.php b/wpsc-admin/includes/product-functions.php
index 391d6b88cb..8abf1f7812 100644
--- a/wpsc-admin/includes/product-functions.php
+++ b/wpsc-admin/includes/product-functions.php
@@ -19,7 +19,7 @@ function wpsc_get_max_upload_size(){
*/
function wpsc_admin_submit_product( $post_ID, $post ) {
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_type != 'wpsc-product' ) {
+ if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_type !== 'wpsc-product' ) {
return;
}
@@ -53,7 +53,7 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
} else {
$post_data['meta']['_wpsc_stock'] = isset( $post_data['meta']['_wpsc_stock'] ) ? (int) $post_data['meta']['_wpsc_stock'] : 0;
}
-
+
// Update low stock notifications
if ( isset( $post_data['meta']['_wpsc_stock'] ) && isset( $post_data['meta']['_wpsc_product_metadata'] ) && ( $post_data['meta']['_wpsc_stock'] > $post_data['meta']['_wpsc_product_metadata']['stock_limit_notify'] ) ) {
// Check if notification has been sent
@@ -62,7 +62,7 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
delete_product_meta( $product_id, 'stock_limit_notify_sent' );
}
}
-
+
unset($post_data['meta']['_wpsc_limited_stock']);
if(!isset($post_data['quantity_limited'])) $post_data['quantity_limited'] = '';
if(!isset($post_data['special'])) $post_data['special'] = '';
@@ -203,8 +203,6 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
$post_data['files'] = $_FILES;
- if(isset($post_data['post_title']) && $post_data['post_title'] != '') {
-
$product_columns = array(
'name' => '',
'description' => '',
@@ -272,8 +270,9 @@ function wpsc_admin_submit_product( $post_ID, $post ) {
if(isset($post_data['files']['preview_file']['tmp_name']) && ($post_data['files']['preview_file']['tmp_name'] != '')) {
wpsc_item_add_preview_file($product_id, $post_data['files']['preview_file']);
}
+
do_action('wpsc_edit_product', $product_id);
- }
+
return $product_id;
}
diff --git a/wpsc-admin/js/admin-legacy.js b/wpsc-admin/js/admin-legacy.js
index aa4e1c2267..855f6cd5ea 100755
--- a/wpsc-admin/js/admin-legacy.js
+++ b/wpsc-admin/js/admin-legacy.js
@@ -245,9 +245,7 @@ var getresults=function(results) {
boxes = ["price_and_stock", "shipping", "variation", "advanced", "product_image", "product_download"];
for (i=0;i \n\r";
break;
diff --git a/wpsc-core/wpsc-functions.php b/wpsc-core/wpsc-functions.php
index 760130e2b3..bf991ab9da 100644
--- a/wpsc-core/wpsc-functions.php
+++ b/wpsc-core/wpsc-functions.php
@@ -476,16 +476,17 @@ function wpsc_register_post_types() {
'not_found_in_trash' => __( 'No products found in Trash', 'wp-e-commerce' ),
'menu_name' => __( 'Products' , 'wp-e-commerce' ),
'parent_item_colon' => '',
- );
+ );
$args = array(
'capability_type' => 'post',
- 'supports' => array( 'title', 'editor', 'thumbnail' ),
+ 'supports' => [ 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields' ],
'hierarchical' => true,
'exclude_from_search' => false,
'public' => true,
'show_ui' => true,
+ 'show_in_rest' => true,
'show_in_nav_menus' => true,
- 'menu_icon' => version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ? WPSC_CORE_IMAGES_URL . '/credit_cards.png' : 'dashicons-cart',
+ 'menu_icon' => 'dashicons-cart',
'labels' => $labels,
'query_var' => true,
'register_meta_box_cb' => 'wpsc_meta_boxes',
@@ -494,9 +495,30 @@ function wpsc_register_post_types() {
'with_front' => false
)
);
+
$args = apply_filters( 'wpsc_register_post_types_products_args', $args );
register_post_type( 'wpsc-product', $args );
+ $wpsc_meta_keys = [
+ '_wpsc_stock',
+ '_wpsc_price',
+ '_wpsc_special_price',
+ '_wpsc_sku',
+ ];
+
+ foreach ( $wpsc_meta_keys as $key ) {
+ $post_type_object = get_post_type_object( 'wpsc-product' );
+
+ register_post_meta( 'wpsc-product', $key, [
+ 'show_in_rest' => true,
+ 'single' => true,
+ 'type' => 'string',
+ 'auth_callback' => function() use ( $post_type_object ) {
+ return current_user_can( $post_type_object->cap->edit_posts );
+ }
+ ] );
+ }
+
// Purchasable product files
$args = array(
'capability_type' => 'post',
@@ -530,7 +552,6 @@ function wpsc_register_post_types() {
'hierarchical' => false,
'labels' => $labels,
'show_in_rest' => true,
- 'rest_controller_class' => 'WPSC_REST_Tags_Controller',
'rewrite' => array(
'slug' => '/' . sanitize_title_with_dashes( _x( 'tagged', 'slug, part of url', 'wp-e-commerce' ) ),
'with_front' => false )
@@ -556,7 +577,6 @@ function wpsc_register_post_types() {
'labels' => $labels,
'hierarchical' => true,
'show_in_rest' => true,
- 'rest_controller_class' => 'WPSC_REST_Categories_Controller',
'rewrite' => array(
'slug' => str_replace( basename( home_url() ), '', $wpsc_page_titles['products'] ),
'with_front' => false,
@@ -581,7 +601,6 @@ function wpsc_register_post_types() {
$args = array(
'hierarchical' => true,
'show_in_rest' => true,
- 'rest_controller_class' => 'WPSC_REST_Variations_Controller',
'query_var' => 'variations',
'rewrite' => false,
'public' => true,
@@ -705,7 +724,6 @@ function wpsc_get_page_post_names() {
return $wpsc_page;
}
-
/**
* wpsc_cron()
*
@@ -874,9 +892,9 @@ function wpsc_core_get_db_version() {
}
/**
- * get the current WPeC database version
+ * Check if shipping is enabled
*
- * @return int current database version
+ * @return boolean Whether or not shipping is enabled
*/
function wpsc_core_shipping_enabled() {
$shipping_disabled = get_option( 'do_not_use_shipping', -1 );
@@ -1222,4 +1240,4 @@ function wpsc_is_theme_engine( $version = '1.0' ) {
$te = get_option( 'wpsc_get_active_theme_engine', $version );
return $version == $te;
-}
+}
\ No newline at end of file
diff --git a/wpsc-core/wpsc-includes.php b/wpsc-core/wpsc-includes.php
index 9c859c27ad..96c96ab691 100644
--- a/wpsc-core/wpsc-includes.php
+++ b/wpsc-core/wpsc-includes.php
@@ -50,10 +50,7 @@
require_once( WPSC_FILE_PATH . '/wpsc-includes/checkout-form.class.php' );
require_once( WPSC_FILE_PATH . '/wpsc-includes/checkout-form-data.class.php' );
require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-theme-engine-bootstrap.php' );
-
-if ( defined( 'REST_API_VERSION' ) ) {
- require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-rest-api.class.php' );
-}
+require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-rest-api.class.php' );
do_action( 'wpsc_loaded_module_'. basename( __FILE__ ) );
@@ -79,13 +76,13 @@
// Gregs ASH Shipping
require_once( WPSC_FILE_PATH . '/wpsc-includes/shipping.helper.php' );
-// Admin
-if ( is_admin() ) {
+// Admin (Ensure this is loaded in)
+add_action( 'admin_init', function() {
include_once( WPSC_FILE_PATH . '/wpsc-admin/admin.php' );
-}
+} );
// WP-CLI support
-if ( defined( 'WP_CLI' ) && WP_CLI && version_compare( phpversion(), '5.3', '>=' ) ) {
+if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-wp-cli.php' );
}
diff --git a/wpsc-includes/cart-item.class.php b/wpsc-includes/cart-item.class.php
index ba9baa8a56..55dc7c5a6b 100644
--- a/wpsc-includes/cart-item.class.php
+++ b/wpsc-includes/cart-item.class.php
@@ -235,7 +235,7 @@ function refresh_item() {
if ( isset( $special_price ) && $special_price > 0 && $special_price < $price )
$price = $special_price;
$priceandstock_id = 0;
- $this->weight = isset( $product_meta[0]['weight'] ) ? $product_meta[0]["weight"] : 0;
+ $this->weight = isset( $product_meta[0]['weight'] ) ? floatval( $product_meta[0]["weight"] ) : 0;
// if we are using table rate price
if ( isset( $product_meta[0]['table_rate_price'] ) ) {
$levels = $product_meta[0]['table_rate_price'];
@@ -376,7 +376,7 @@ public function get_title( $mode = 'display' ) {
function calculate_shipping($method = null) {
global $wpdb, $wpsc_cart, $wpsc_shipping_modules;
- $shipping = '';
+ $shipping = 0;
if($method === null)
$method = $this->cart->selected_shipping_method;
diff --git a/wpsc-includes/cart.class.php b/wpsc-includes/cart.class.php
index bd6289c106..1adea1f1e9 100755
--- a/wpsc-includes/cart.class.php
+++ b/wpsc-includes/cart.class.php
@@ -431,7 +431,7 @@ function get_shipping_method() {
function get_shipping_option() {
global $wpsc_shipping_modules;
- if ( ( count( $this->shipping_quotes ) < 1 ) &&
+ if ( ( count( (array) $this->shipping_quotes ) < 1 ) &&
isset( $wpsc_shipping_modules[$this->selected_shipping_method] ) &&
is_callable( array( $wpsc_shipping_modules[$this->selected_shipping_method], 'getQuote' ) ) ) {
$this->shipping_quotes = $wpsc_shipping_modules[$this->selected_shipping_method]->getQuote();
@@ -441,7 +441,7 @@ function get_shipping_option() {
$this->selected_shipping_option = null;
}
- if ( count( $this->shipping_quotes ) < 1 ) {
+ if ( count( (array) $this->shipping_quotes ) < 1 ) {
$this->selected_shipping_option = null;
}
@@ -980,7 +980,7 @@ function calculate_total_tax() {
* @return float returns the price as a floating point value
*/
function calculate_total_weight( $for_shipping = false ) {
- $total = '';
+ $total = 0;
if ( $for_shipping == true ) {
foreach ( $this->cart_items as $key => $cart_item ) {
if ( $cart_item->uses_shipping == 1 ) {
diff --git a/wpsc-includes/checkout.class.php b/wpsc-includes/checkout.class.php
index 1e20d004d3..b248557eff 100644
--- a/wpsc-includes/checkout.class.php
+++ b/wpsc-includes/checkout.class.php
@@ -381,7 +381,7 @@ function form_field() {
function validate_forms() {
global $wpsc_cart, $wpdb, $current_user, $user_ID, $wpsc_gateway_error_messages, $wpsc_checkout_error_messages, $wpsc_customer_checkout_details, $wpsc_registration_error_messages;
$any_bad_inputs = false;
- $bad_input_message = '';
+ $bad_input_messages = [];
$wpsc_gateway_error_messages = array();
$wpsc_checkout_error_messages = array();
$wpsc_registration_error_messages = array();
@@ -548,7 +548,7 @@ function validate_forms() {
// Check if the shoppers location has changed
_wpsc_has_visitor_location_changed();
- $states = array( 'is_valid' => ! $any_bad_inputs, 'error_messages' => $bad_input_message );
+ $states = array( 'is_valid' => ! $any_bad_inputs, 'error_messages' => $bad_input_messages );
$states = apply_filters( 'wpsc_checkout_form_validation', $states );
return $states;
}
diff --git a/wpsc-includes/form-display.functions.php b/wpsc-includes/form-display.functions.php
index cfc2988292..ec5c537d1b 100755
--- a/wpsc-includes/form-display.functions.php
+++ b/wpsc-includes/form-display.functions.php
@@ -12,7 +12,7 @@ function wpsc_uploaded_files() {
$num = 0;
$dirlist = array( );
- if ( count( $wpsc_uploaded_file_cache ) > 0 ) {
+ if ( $wpsc_uploaded_file_cache && count( $wpsc_uploaded_file_cache ) > 0 ) {
$dirlist = $wpsc_uploaded_file_cache;
} elseif ( $dir ) {
while ( ($file = @readdir( $dir )) !== false ) {
diff --git a/wpsc-includes/processing.functions.php b/wpsc-includes/processing.functions.php
index 16fd4ac544..b3b96f8e39 100755
--- a/wpsc-includes/processing.functions.php
+++ b/wpsc-includes/processing.functions.php
@@ -126,7 +126,7 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
case 4:
case 5:
foreach ( (array) $all_claimed_stock as $claimed_stock ) {
-
+
$product = get_post( $claimed_stock->product_id );
$current_stock = get_post_meta( $product->ID, '_wpsc_stock', true );
$remaining_stock = $current_stock - $claimed_stock->stock_claimed;
@@ -134,7 +134,7 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
update_product_meta( $product->ID, 'stock', $remaining_stock );
$product_meta = get_product_meta( $product->ID, 'product_metadata', true );
-
+
$parent_id = wpsc_product_is_variation( $product->ID );
if( $parent_id ) {
@@ -144,19 +144,19 @@ function wpsc_decrement_claimed_stock( $purchase_log_id ) {
} else {
$notify_limit = $product_meta['stock_limit_notify'];
}
-
+
if ( $notify_limit != 0 && $remaining_stock <= apply_filters( 'wpec_stock_limit_notify', $notify_limit ) ) {
// Check if notification has been sent
$notify_sent = get_product_meta( $product->ID, 'stock_limit_notify_sent', true );
-
+
if( empty( $notify_sent ) ) {
$email_message = sprintf( __( 'The product "%s" has reached stock level "%s".', 'wp-e-commerce' ), $product->post_title, $remaining_stock );
-
+
wp_mail( get_option('purch_log_email'), sprintf(__('%s is low on stock', 'wp-e-commerce'), $product->post_title), $email_message );
- update_product_meta( $product->ID, 'stock_limit_notify_sent', true );
+ update_product_meta( $product->ID, 'stock_limit_notify_sent', true );
}
}
-
+
if ( $remaining_stock < 1 ) {
$email_message = sprintf( __( 'The product "%s" is out of stock.', 'wp-e-commerce' ), $product->post_title );
@@ -244,6 +244,7 @@ function wpsc_convert_weight( $in_weight, $in_unit, $out_unit = 'pound', $raw =
// other unit names are used when doing imports from CSV
// convert $in_weight to grams, then convert that to whatever else.
+ $in_weight = floatval( $in_weight );
switch( strtolower( $in_unit ) ) {
case "kilogram":
@@ -411,11 +412,11 @@ function wpsc_check_weight($state, $product) {
$shipping_modules = array();
$product_meta = get_product_meta( $product->ID, 'product_metadata',true );
if(! $product->post_parent && wpsc_product_has_children($product->ID)) return $state;
-
+
if ( get_option( 'do_not_use_shipping' ) ) {
return $state;
}
-
+
// only do anything if UPS is on and shipping is used
if( array_search( 'ups', $custom_shipping ) !== false )
$shipping_modules[] = 'UPS';
diff --git a/wpsc-includes/product-template.php b/wpsc-includes/product-template.php
index 78dadda0f4..820a46b407 100644
--- a/wpsc-includes/product-template.php
+++ b/wpsc-includes/product-template.php
@@ -170,9 +170,10 @@ function wpsc_calculate_price( $product_id, $variations = false, $special = true
} else {
$price = get_post_meta( $product_id, '_wpsc_price', true );
}
+
$price = apply_filters( 'wpsc_price', $price, $product_id );
- return $price;
+ return floatval( $price );
}
/**
diff --git a/wpsc-includes/product.class.php b/wpsc-includes/product.class.php
index fc7574e8ec..247d54127b 100644
--- a/wpsc-includes/product.class.php
+++ b/wpsc-includes/product.class.php
@@ -665,7 +665,7 @@ private function process_stats() {
* @param array|string $args Arguments. See {@link WPSC_Purchase_Log::fetch_stats()}
* @return array 'sales' and 'earnings' stats
*/
- public function get_stats( $args = '' ) {
+ public function get_stats( $args = [] ) {
return WPSC_Purchase_Log::get_stats_for_product( $this->post->ID, $args );
}
}
diff --git a/wpsc-includes/purchase-log.class.php b/wpsc-includes/purchase-log.class.php
index e3809eccd5..ce58887186 100644
--- a/wpsc-includes/purchase-log.class.php
+++ b/wpsc-includes/purchase-log.class.php
@@ -341,7 +341,7 @@ private static function convert_date_args( $args ) {
* @param int $id ID of the product
* @return array Array containing 'sales' and 'earnings' stats
*/
- public static function get_stats_for_product( $id, $args = '' ) {
+ public static function get_stats_for_product( $id, $args = [] ) {
$product = WPSC_Product::get_instance( $id );
diff --git a/wpsc-includes/rest-api/wpsc-rest-categories-controller.php b/wpsc-includes/rest-api/wpsc-rest-categories-controller.php
deleted file mode 100644
index d332a51768..0000000000
--- a/wpsc-includes/rest-api/wpsc-rest-categories-controller.php
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace = 'wpsc/v1';
- }
-}
diff --git a/wpsc-includes/rest-api/wpsc-rest-products-controller.php b/wpsc-includes/rest-api/wpsc-rest-products-controller.php
deleted file mode 100644
index a757441e79..0000000000
--- a/wpsc-includes/rest-api/wpsc-rest-products-controller.php
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace = 'wpsc/v1';
- }
-}
diff --git a/wpsc-includes/rest-api/wpsc-rest-tags-controller.php b/wpsc-includes/rest-api/wpsc-rest-tags-controller.php
deleted file mode 100644
index bb41ec1fd5..0000000000
--- a/wpsc-includes/rest-api/wpsc-rest-tags-controller.php
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace = 'wpsc/v1';
- }
-}
diff --git a/wpsc-includes/wpsc-meta-visitor.php b/wpsc-includes/wpsc-meta-visitor.php
index 94f09169e0..a2c642fe51 100644
--- a/wpsc-includes/wpsc-meta-visitor.php
+++ b/wpsc-includes/wpsc-meta-visitor.php
@@ -570,8 +570,7 @@ function wpsc_get_visitor_cart( $visitor_id ) {
case 'current_cart_item': // don't load array cursor
case 'current_shipping_method': // don't load array cursor
case 'current_shipping_quote': // don't load array cursor
- continue;
-
+ break;
case 'shipping_methods':
case 'shipping_quotes':
case 'cart_items':
@@ -588,7 +587,6 @@ function wpsc_get_visitor_cart( $visitor_id ) {
break;
-
case 'cart_item':
/////////////////////////////////////////////////////////////////////////////
// The type of the decoded value must be an wpsc_cart_item, we are going to
@@ -654,7 +652,7 @@ function wpsc_update_visitor_cart( $visitor_id, $wpsc_cart ) {
case 'current_cart_item': // don't save array cursor
case 'current_shipping_method': // don't save array cursor
case 'current_shipping_quote': // don't save array cursor
- continue;
+ break;
case 'shipping_methods':
case 'shipping_quotes':
@@ -1342,4 +1340,4 @@ function wpsc_delete_visitor_ajax() {
add_action( 'wp_ajax_wpsc_delete_visitor', 'wpsc_delete_visitor_ajax' );
-add_action( 'wp_ajax_nopriv_wpsc_delete_visitor', 'wpsc_delete_visitor_ajax' );
+add_action( 'wp_ajax_nopriv_wpsc_delete_visitor', 'wpsc_delete_visitor_ajax' );
\ No newline at end of file
diff --git a/wpsc-includes/wpsc-rest-api.class.php b/wpsc-includes/wpsc-rest-api.class.php
index e64d110982..3697ca3ba2 100644
--- a/wpsc-includes/wpsc-rest-api.class.php
+++ b/wpsc-includes/wpsc-rest-api.class.php
@@ -17,19 +17,9 @@ class WPSC_REST_API {
);
public static function hooks() {
- add_filter( 'wpsc_register_post_types_products_args', array( __CLASS__, 'register_post_type_rest_args' ) );
add_action( 'rest_api_init', array( __CLASS__, 'register_routes' ), 999 );
}
- public static function register_post_type_rest_args( $args ) {
-
- $args['show_in_rest'] = true;
- $args['rest_base'] = 'products';
- $args['rest_controller_class'] = 'WPSC_REST_Products_Controller';
-
- return $args;
- }
-
public static function register_routes() {
$dir = WPSC_FILE_PATH . '/wpsc-includes/rest-api/';
diff --git a/wpsc-includes/wpsc-theme-engine-bootstrap.php b/wpsc-includes/wpsc-theme-engine-bootstrap.php
index 48f65a53c7..1da69c9394 100644
--- a/wpsc-includes/wpsc-theme-engine-bootstrap.php
+++ b/wpsc-includes/wpsc-theme-engine-bootstrap.php
@@ -197,12 +197,6 @@ function _wpsc_maybe_activate_theme_engine_v2() {
$activate = false;
}
- // Our checkout process uses a custom REST API endpoint by default, requiring the REST API.
- // An alternative approach here would be to filter the fancy notifications to be turned off.
- if ( version_compare( $GLOBALS['wp_version'], '4.7.0', '<' ) ) {
- $activate = false;
- }
-
$activate = apply_filters( '_wpsc_maybe_activate_theme_engine_v2', $activate );
$new_theme_engine = $activate ? '2.0' : '1.0';
$old_theme_engine = get_option( 'wpsc_get_active_theme_engine' );
diff --git a/wpsc-taxes/models/taxes.class.php b/wpsc-taxes/models/taxes.class.php
index 6372dcdc7f..f6eb27e671 100644
--- a/wpsc-taxes/models/taxes.class.php
+++ b/wpsc-taxes/models/taxes.class.php
@@ -46,11 +46,11 @@ function wpec_taxes_get_billing_shipping_preference() {
}
function wpec_taxes_get_rates() {
- return $this->taxes_options['wpec_taxes_rates'];
+ return (array) $this->taxes_options['wpec_taxes_rates'];
}
function wpec_taxes_get_bands() {
- return $this->taxes_options['wpec_taxes_bands'];
+ return (array) $this->taxes_options['wpec_taxes_bands'];
}
function wpec_taxes_get_options() {
diff --git a/wpsc-widgets/admin_menu_widget.php b/wpsc-widgets/admin_menu_widget.php
index 3e762143a3..c70270f388 100755
--- a/wpsc-widgets/admin_menu_widget.php
+++ b/wpsc-widgets/admin_menu_widget.php
@@ -84,7 +84,9 @@ function form( $instance ) {
}
-add_action( 'widgets_init', create_function( '', 'return register_widget("WP_Widget_Admin_Menu");' ) );
+add_action( 'widgets_init', function() {
+ return register_widget( 'WP_Widget_Admin_Menu' );
+} );
/**
* Admin Menu Widget content function
" . esc_html( $form_field['name'] ) . ":