Skip to content

Commit

Permalink
Removed ununsed global variables in local scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
coenjacobs committed Jun 8, 2014
1 parent eadf66a commit 3ad8935
Show file tree
Hide file tree
Showing 51 changed files with 35 additions and 89 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WC_Admin_Attributes {
* The added attributes are stored in the database and can be used for layered navigation.
*/
public static function output() {
global $wpdb, $woocommerce;
global $wpdb;

// Action to perform: add, edit, delete or none
$action = '';
Expand Down
1 change: 0 additions & 1 deletion includes/admin/class-wc-admin-duplicate-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ private function get_product_to_duplicate( $id ) {
* @return void
*/
private function duplicate_post_taxonomies( $id, $new_id, $post_type ) {
global $wpdb;
$taxonomies = get_object_taxonomies($post_type); //array("category", "post_tag");
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($id, $taxonomy);
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct() {
* Add menu items
*/
public function admin_menu() {
global $menu, $woocommerce;
global $menu;

if ( current_user_can( 'manage_woocommerce' ) )
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function shop_order_columns( $existing_columns ) {
* @param string $column
*/
public function render_product_columns( $column ) {
global $post, $woocommerce, $the_product;
global $post;

if ( empty( $the_product ) || $the_product->id != $post->ID ) {
$the_product = get_product( $post );
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function get_settings_pages() {
* Save the settings
*/
public static function save() {
global $current_section, $current_tab;
global $current_tab;

if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'woocommerce-settings' ) )
die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
Expand Down
1 change: 0 additions & 1 deletion includes/admin/class-wc-admin-status.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public static function output() {
* Handles output of report
*/
public static function status_report() {
global $wpdb;
include_once( 'views/html-admin-page-status-report.php' );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/importers/class-wc-tax-rate-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function format_data_from_csv( $data, $enc ) {
* @return void
*/
function import( $file ) {
global $woocommerce, $wpdb;
global $wpdb;

$this->imported = $this->skipped = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WC_Meta_Box_Order_Actions {
* Output the metabox
*/
public static function output( $post ) {
global $woocommerce, $theorder, $wpdb;
global $theorder;

if ( ! is_object( $theorder ) )
$theorder = new WC_Order( $post->ID );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WC_Meta_Box_Order_Downloads {
* Output the metabox
*/
public static function output( $post ) {
global $woocommerce, $post, $wpdb;
global $post, $wpdb;
?>
<div class="order_download_permissions wc-metaboxes-wrapper">

Expand Down Expand Up @@ -75,7 +75,7 @@ public static function output( $post ) {
* Save meta box data
*/
public static function save( $post_id, $post ) {
global $wpdb, $woocommerce;
global $wpdb;

if ( isset( $_POST['download_id'] ) ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WC_Meta_Box_Order_Items {
* Output the metabox
*/
public static function output( $post ) {
global $wpdb, $thepostid, $theorder, $woocommerce;
global $thepostid, $theorder;

if ( ! is_object( $theorder ) )
$theorder = new WC_Order( $thepostid );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class WC_Meta_Box_Order_Notes {
* Output the metabox
*/
public static function output( $post ) {
global $woocommerce, $post;
global $post;

$args = array(
'post_id' => $post->ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WC_Meta_Box_Order_Totals {
* Output the metabox
*/
public static function output() {
global $woocommerce, $theorder, $wpdb, $post;
global $theorder, $wpdb, $post;

if ( ! is_object( $theorder ) )
$theorder = new WC_Order( $post->ID );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WC_Meta_Box_Product_Data {
* Output the metabox
*/
public static function output( $post ) {
global $post, $wpdb, $thepostid;
global $post, $thepostid;

wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );

Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-customer-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class WC_Report_Customer_List extends WP_List_Table {
* @access public
*/
function __construct(){
global $status, $page;

parent::__construct( array(
'singular' => __( 'Customer', 'woocommerce' ),
'plural' => __( 'Customers', 'woocommerce' ),
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ public function customers_vs_guests() {
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-sales-by-category.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function get_chart_legend() {
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-sales-by-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ public function get_chart_legend() {
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-sales-by-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public function get_chart_legend() {
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/reports/class-wc-report-stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function output_report() {
* @param mixed $column_name
*/
function column_default( $item, $column_name ) {
global $woocommerce, $wpdb, $product;
global $product;

if ( ! $product || $product->id !== $item->id )
$product = get_product( $item->id );
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/reports/class-wc-report-taxes-by-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class="export_csv"
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand Down
4 changes: 0 additions & 4 deletions includes/admin/reports/class-wc-report-taxes-by-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class="export_csv"
* Output the report
*/
public function output_report() {
global $woocommerce, $wpdb, $wp_locale;

$ranges = array(
'year' => __( 'Year', 'woocommerce' ),
'last_month' => __( 'Last Month', 'woocommerce' ),
Expand All @@ -65,8 +63,6 @@ public function output_report() {
* @return string
*/
public function get_main_chart() {
global $wpdb;

$tax_rows = $this->get_order_report_data( array(
'data' => array(
'_order_tax' => array(
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/settings/class-wc-settings-tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function save() {
* Output tax rate tables
*/
public function output_tax_rates() {
global $woocommerce, $current_section, $wpdb;
global $current_section, $wpdb;

$page = ! empty( $_GET['p'] ) ? absint( $_GET['p'] ) : 1;
$limit = 100;
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/wc-admin-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ function woocommerce_settings_get_option( $option_name, $default = '' ) {
* @return void
*/
function woocommerce_compile_less_styles() {
global $woocommerce;

$colors = array_map( 'esc_attr', (array) get_option( 'woocommerce_frontend_css_colors' ) );
$base_file = WC()->plugin_path() . '/assets/css/woocommerce-base.less';
$less_file = WC()->plugin_path() . '/assets/css/woocommerce.less';
Expand Down
8 changes: 4 additions & 4 deletions includes/admin/wc-meta-box-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @return void
*/
function woocommerce_wp_text_input( $field ) {
global $thepostid, $post, $woocommerce;
global $thepostid, $post;

$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
Expand Down Expand Up @@ -86,7 +86,7 @@ function woocommerce_wp_hidden_input( $field ) {
* @return void
*/
function woocommerce_wp_textarea_input( $field ) {
global $thepostid, $post, $woocommerce;
global $thepostid, $post;

$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
Expand Down Expand Up @@ -140,7 +140,7 @@ function woocommerce_wp_checkbox( $field ) {
* @return void
*/
function woocommerce_wp_select( $field ) {
global $thepostid, $post, $woocommerce;
global $thepostid, $post;

$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
Expand Down Expand Up @@ -177,7 +177,7 @@ function woocommerce_wp_select( $field ) {
* @return void
*/
function woocommerce_wp_radio( $field ) {
global $thepostid, $post, $woocommerce;
global $thepostid, $post;

$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
Expand Down
2 changes: 0 additions & 2 deletions includes/api/class-wc-api-customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ public function get_customer_orders( $id, $fields = null ) {
* @return array
*/
public function get_customer_downloads( $id, $fields = null ) {
global $wpdb;

$id = $this->validate_request( $id, 'customer', 'read' );

if ( is_wp_error( $id ) ) {
Expand Down
12 changes: 0 additions & 12 deletions includes/class-wc-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,6 @@ public static function get_customer_details() {
* Add order item via ajax
*/
public static function add_order_item() {
global $wpdb;

check_ajax_referer( 'order-item', 'security' );

$item_to_add = sanitize_text_field( $_POST['item_to_add'] );
Expand Down Expand Up @@ -1041,8 +1039,6 @@ public static function add_order_fee() {
* Remove an order item
*/
public static function remove_order_item() {
global $wpdb;

check_ajax_referer( 'order-item', 'security' );

$order_item_ids = $_POST['order_item_ids'];
Expand All @@ -1060,8 +1056,6 @@ public static function remove_order_item() {
* Reduce order item stock
*/
public static function reduce_order_item_stock() {
global $wpdb;

check_ajax_referer( 'order-item', 'security' );

$order_id = absint( $_POST['order_id'] );
Expand Down Expand Up @@ -1108,8 +1102,6 @@ public static function reduce_order_item_stock() {
* Increase order item stock
*/
public static function increase_order_item_stock() {
global $wpdb;

check_ajax_referer( 'order-item', 'security' );

$order_id = absint( $_POST['order_id'] );
Expand Down Expand Up @@ -1157,8 +1149,6 @@ public static function increase_order_item_stock() {
* Add some meta to a line item
*/
public static function add_order_item_meta() {
global $wpdb;

check_ajax_referer( 'order-item', 'security' );

$meta_id = wc_add_order_item_meta( absint( $_POST['order_item_id'] ), __( 'Name', 'woocommerce' ), __( 'Value', 'woocommerce' ) );
Expand Down Expand Up @@ -1616,8 +1606,6 @@ public static function json_search_customer_name( $query ) {
* Ajax request handling for categories ordering
*/
public static function term_ordering() {
global $wpdb;

$id = (int) $_POST['id'];
$next_id = isset( $_POST['nextid'] ) && (int) $_POST['nextid'] ? (int) $_POST['nextid'] : null;
$taxonomy = isset( $_POST['thetaxonomy'] ) ? esc_attr( $_POST['thetaxonomy'] ) : null;
Expand Down
2 changes: 0 additions & 2 deletions includes/class-wc-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@ public function create_order() {
* @return void
*/
public function process_checkout() {
global $wpdb, $current_user;

wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-process_checkout' );

if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) )
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function init() {
* @return array
*/
public static function exclude_order_comments( $clauses ) {
global $wpdb, $typenow, $pagenow;
global $wpdb, $typenow;

if ( is_admin() && $typenow == 'shop_order' && current_user_can( 'manage_woocommerce' ) )
return $clauses; // Don't hide when viewing orders in admin
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-download-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static function download_product() {
* Download a file - hook into init function.
*/
public static function download( $file_path, $product_id ) {
global $wpdb, $is_IE;
global $is_IE;

$file_download_method = apply_filters( 'woocommerce_file_download_method', get_option( 'woocommerce_file_download_method' ), $product_id );

Expand Down
2 changes: 0 additions & 2 deletions includes/class-wc-form-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ public static function pay_action() {
* Process the add payment method form.
*/
public static function add_payment_method_action() {
global $wp;

if ( isset( $_POST['woocommerce_add_payment_method'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-add-payment-method' ) ) {

ob_start();
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-frontend-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function get_styles() {
* @return void
*/
public static function load_scripts() {
global $post, $wp;
global $post;

$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
$lightbox_en = get_option( 'woocommerce_enable_lightbox' ) == 'yes' ? true : false;
Expand Down Expand Up @@ -134,7 +134,7 @@ public static function load_scripts() {
* Localize scripts only when enqueued
*/
public static function localize_printed_scripts() {
global $post, $wp;
global $wp;

$assets_path = str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/';

Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function create_options() {
* @return void
*/
private function create_tables() {
global $wpdb, $woocommerce;
global $wpdb;

$wpdb->hide_errors();

Expand Down
2 changes: 0 additions & 2 deletions includes/class-wc-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ public function get_items( $type = '' ) {
* @return string
*/
public function get_item_count( $type = '' ) {
global $wpdb;

if ( empty( $type ) ) {
$type = array( 'line_item' );
}
Expand Down
Loading

0 comments on commit 3ad8935

Please sign in to comment.