diff --git a/admin/importers/importers-init.php b/admin/importers/importers-init.php index 88bf64a2e011e..80667998c47b8 100644 --- a/admin/importers/importers-init.php +++ b/admin/importers/importers-init.php @@ -14,7 +14,7 @@ /** * woocommerce_tax_rates_importer function. - * + * * @access public * @return void */ @@ -25,7 +25,7 @@ function woocommerce_tax_rates_importer() { if ( ! class_exists( 'WP_Importer' ) ) { $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; - if ( file_exists( $class_wp_importer ) ) + if ( file_exists( $class_wp_importer ) ) require $class_wp_importer; } diff --git a/admin/importers/tax-rates-importer.php b/admin/importers/tax-rates-importer.php index 8d5acdc3e31a4..9c303627b7a1e 100644 --- a/admin/importers/tax-rates-importer.php +++ b/admin/importers/tax-rates-importer.php @@ -7,12 +7,12 @@ * @package WooCommerce/Admin/Importers * @version 1.7.0 */ - + if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( class_exists( 'WP_Importer' ) ) { class WC_CSV_Tax_Rates_Import extends WP_Importer { - + var $id; var $file_url; var $import_page; @@ -20,17 +20,17 @@ class WC_CSV_Tax_Rates_Import extends WP_Importer { var $posts = array(); var $imported; var $skipped; - + /** * __construct function. - * + * * @access public * @return void */ public function __construct() { $this->import_page = 'woocommerce_tax_rate_csv'; } - + /** * Registered callback function for the WordPress Importer * @@ -38,13 +38,13 @@ public function __construct() { */ function dispatch() { $this->header(); - + if ( ! empty( $_POST['delimiter'] ) ) $this->delimiter = stripslashes( trim( $_POST['delimiter'] ) ); - - if ( ! $this->delimiter ) + + if ( ! $this->delimiter ) $this->delimiter = ','; - + $step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step']; switch ( $step ) { case 0: @@ -58,26 +58,26 @@ function dispatch() { $file = get_attached_file( $this->id ); else $file = ABSPATH . $this->file_url; - + add_filter( 'http_request_timeout', array( &$this, 'bump_request_timeout' ) ); - + if ( function_exists( 'gc_enable' ) ) gc_enable(); - + @set_time_limit(0); @ob_flush(); @flush(); - + $this->import( $file ); } break; } $this->footer(); } - + /** * format_data_from_csv function. - * + * * @access public * @param mixed $data * @param mixed $enc @@ -89,134 +89,134 @@ function format_data_from_csv( $data, $enc ) { /** * import function. - * + * * @access public * @param mixed $file * @return void */ function import( $file ) { global $woocommerce, $wpdb; - + $this->imported = $this->skipped = 0; - + if ( ! is_file($file) ) { echo '

' . __( 'Sorry, there has been an error.', 'woocommerce' ) . '
'; echo __( 'The file does not exist, please try again.', 'woocommerce' ) . '

'; $this->footer(); die(); } - + $new_rates = array(); - + if ( ( $handle = fopen( $file, "r" ) ) !== FALSE ) { - + $header = fgetcsv( $handle, 0, $this->delimiter ); - + if ( sizeof( $header ) == 6 ) { - + $rates = get_option( 'woocommerce_tax_rates' ); - + while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== FALSE ) { - + $rate = array(); - + list( $rate['countries'], $rate['class'], $rate['label'], $rate['rate'], $rate['compound'], $rate['shipping'] ) = $row; - + $parsed_countries = array(); $rate['countries'] = array_map( 'trim', explode( '|', $rate['countries'] ) ); - + foreach( $rate['countries'] as $country ) { if ( strstr( $country, ':' ) ) { list( $country, $state ) = array_map( 'trim', explode( ':', $country ) ); - + if ( ! isset( $parsed_countries[ $country ] ) ) $parsed_countries[ $country ] = array(); - + $parsed_countries[ $country ][] = $state; } else { - + if ( ! isset( $parsed_countries[ $country ] ) ) $parsed_countries[ $country ] = array(); - + $parsed_countries[ $country ][] = '*'; } } - + $rate['countries'] = $parsed_countries; $rate['shipping'] = $rate['shipping'] ? 'yes' : 'no'; $rate['compound'] = $rate['compound'] ? 'yes' : 'no'; - + $new_rates[] = $rate; - + unset( $rate, $row ); - + $this->imported++; } - + $rates = array_merge( $rates, $new_rates ); - + update_option( 'woocommerce_tax_rates', $rates ); - + } elseif ( sizeof( $header ) == 8 ) { - + $rates = get_option( 'woocommerce_local_tax_rates' ); - + while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== FALSE ) { - + $rate = array(); - + list( $rate['country'], $rate['state'], $rate['postcode'], $rate['class'], $rate['label'], $rate['rate'], $rate['compound'], $rate['shipping'] ) = $row; - + if ( ! $rate['country'] || ! $rate['postcode'] || ! $rate['rate'] ) { $this->skipped++; continue; } - + $rate['state'] = $rate['state'] ? $rate['state'] : '*'; $rate['shipping'] = $rate['shipping'] ? 'yes' : 'no'; $rate['compound'] = $rate['compound'] ? 'yes' : 'no'; $rate['postcode'] = array_map( 'trim', explode( '|', $rate['postcode'] ) ); - + $new_rates[] = $rate; - + unset( $rate, $row ); - + $this->imported++; } - + $rates = array_merge( $rates, $new_rates ); - + update_option( 'woocommerce_local_tax_rates', $rates ); - + } else { - + echo '

' . __( 'Sorry, there has been an error.', 'woocommerce' ) . '
'; echo __( 'The CSV is invalid.', 'woocommerce' ) . '

'; $this->footer(); die(); - + } - + fclose( $handle ); } - + // Show Result echo '

'.sprintf( __( 'Import complete - imported %s tax rates and skipped %s.', 'woocommerce' ), $this->imported, $this->skipped ).'

'; - + $this->import_end(); } - + /** * Performs post-import cleanup of files and the cache */ function import_end() { echo '

' . __( 'All done!', 'woocommerce' ) . ' ' . __( 'View Tax Rates', 'woocommerce' ) . '' . '

'; - + do_action( 'import_end' ); } - + /** * Handles the CSV upload and initial parsing of the file to prepare for * displaying author import options @@ -224,40 +224,40 @@ function import_end() { * @return bool False if error uploading or invalid file, true otherwise */ function handle_upload() { - + if ( empty( $_POST['file_url'] ) ) { - + $file = wp_import_handle_upload(); - + if ( isset( $file['error'] ) ) { echo '

' . __( 'Sorry, there has been an error.', 'woocommerce' ) . '
'; echo esc_html( $file['error'] ) . '

'; return false; } - + $this->id = (int) $file['id']; - + } else { - + if ( file_exists( ABSPATH . $_POST['file_url'] ) ) { - + $this->file_url = esc_attr( $_POST['file_url'] ); - + } else { - + echo '

' . __( 'Sorry, there has been an error.', 'woocommerce' ) . '

'; return false; - + } - + } - + return true; } - + /** * header function. - * + * * @access public * @return void */ @@ -268,32 +268,32 @@ function header() { /** * footer function. - * + * * @access public * @return void */ function footer() { echo ''; } - + /** * greet function. - * + * * @access public * @return void */ function greet() { global $woocommerce; - + echo '
'; echo '

' . __( 'Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce' ).'

'; - + echo '

' . sprintf( __( 'Tax rates need to be defined with columns in a specific order (6 columns). Click here to download a sample.', 'woocommerce' ), $woocommerce->plugin_url() . '/admin/importers/samples/sample_tax_rates.csv' ) . '

'; - + echo '

' . sprintf( __( 'Local tax rates also need to be defined with columns in a specific order (8 columns). Click here to download a sample.', 'woocommerce' ), $woocommerce->plugin_url() . '/admin/importers/samples/sample_local_tax_rates.csv' ) . '

'; - + $action = 'admin.php?import=woocommerce_tax_rate_csv&step=1'; - + $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() ); $size = wp_convert_bytes_to_hr( $bytes ); $upload_dir = wp_upload_dir(); @@ -336,10 +336,10 @@ function greet() { '; } - + /** * Added to http_request_timeout filter to force timeout at 60 seconds during import * @return int 60 diff --git a/admin/includes/class-cssmin.php b/admin/includes/class-cssmin.php index bbe83a2a74bc3..bd60e89351b0b 100644 --- a/admin/includes/class-cssmin.php +++ b/admin/includes/class-cssmin.php @@ -1,7 +1,7 @@ * @@ -11,10 +11,10 @@ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * -- - * + * * @package CssMin * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -31,12 +31,12 @@ * @license http://opensource.org/licenses/mit-license.php MIT License * @version 3.0.1 */ - -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly - + +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly + /** * Abstract definition of a CSS token class. - * + * * Every token has to extend this class. * * @package CssMin/Tokens @@ -50,7 +50,7 @@ abstract class aCssToken { /** * Returns the token as string. - * + * * @return string */ abstract public function __toString(); @@ -68,7 +68,7 @@ abstract public function __toString(); */ abstract class aCssRulesetStartToken extends aCssToken { - + } /** @@ -85,7 +85,7 @@ abstract class aCssRulesetEndToken extends aCssToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -96,10 +96,10 @@ public function __toString() /** * Abstract definition of a parser plugin. - * - * Every parser plugin have to extend this class. A parser plugin contains the logic to parse one or aspects of a + * + * Every parser plugin have to extend this class. A parser plugin contains the logic to parse one or aspects of a * stylesheet. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -111,25 +111,25 @@ abstract class aCssParserPlugin { /** * Plugin configuration. - * + * * @var array */ protected $configuration = array(); /** * The CssParser of the plugin. - * + * * @var CssParser */ protected $parser = null; /** * Plugin buffer. - * + * * @var string */ protected $buffer = ""; /** * Constructor. - * + * * @param CssParser $parser The CssParser object of this plugin. * @param array $configuration Plugin configuration [optional] * @return void @@ -141,19 +141,19 @@ public function __construct(CssParser $parser, array $configuration = null) } /** * Returns the array of chars triggering the parser plugin. - * + * * @return array */ abstract public function getTriggerChars(); /** * Returns the array of states triggering the parser plugin or FALSE if every state will trigger the parser plugin. - * + * * @return array */ abstract public function getTriggerStates(); /** * Parser routine of the plugin. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -163,9 +163,9 @@ abstract public function parse($index, $char, $previousChar, $state); } /** - * Abstract definition of a minifier plugin class. - * - * Minifier plugin process the parsed tokens one by one to apply changes to the token. Every minifier plugin has to + * Abstract definition of a minifier plugin class. + * + * Minifier plugin process the parsed tokens one by one to apply changes to the token. Every minifier plugin has to * extend this class. * * @package CssMin/Minifier/Plugins @@ -179,19 +179,19 @@ abstract class aCssMinifierPlugin { /** * Plugin configuration. - * + * * @var array */ protected $configuration = array(); /** * The CssMinifier of the plugin. - * + * * @var CssMinifier */ protected $minifier = null; /** * Constructor. - * + * * @param CssMinifier $minifier The CssMinifier object of this plugin. * @param array $configuration Plugin configuration [optional] * @return void @@ -203,25 +203,25 @@ public function __construct(CssMinifier $minifier, array $configuration = array( } /** * Apply the plugin to the token. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ abstract public function apply(aCssToken &$token); /** * -- - * + * * @return array */ abstract public function getTriggerTokens(); } /** - * Abstract definition of a minifier filter class. - * + * Abstract definition of a minifier filter class. + * * Minifier filters allows a pre-processing of the parsed token to add, edit or delete tokens. Every minifier filter * has to extend this class. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -233,19 +233,19 @@ abstract class aCssMinifierFilter { /** * Filter configuration. - * + * * @var array */ protected $configuration = array(); /** * The CssMinifier of the filter. - * + * * @var CssMinifier */ protected $minifier = null; /** * Constructor. - * + * * @param CssMinifier $minifier The CssMinifier object of this plugin. * @param array $configuration Filter configuration [optional] * @return void @@ -257,7 +257,7 @@ public function __construct(CssMinifier $minifier, array $configuration = array( } /** * Filter the tokens. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -266,9 +266,9 @@ abstract public function apply(array &$tokens); /** * Abstract formatter definition. - * + * * Every formatter have to extend this class. - * + * * @package CssMin/Formatter * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -280,25 +280,25 @@ abstract class aCssFormatter { /** * Indent string. - * + * * @var string */ protected $indent = " "; /** * Declaration padding. - * + * * @var integer */ protected $padding = 0; /** * Tokens. - * + * * @var array */ protected $tokens = array(); /** * Constructor. - * + * * @param array $tokens Array of CssToken * @param string $indent Indent string [optional] * @param integer $padding Declaration value padding [optional] @@ -311,7 +311,7 @@ public function __construct(array $tokens, $indent = null, $padding = null) } /** * Returns the array of aCssToken as formatted string. - * + * * @return string */ abstract public function __toString(); @@ -331,31 +331,31 @@ abstract class aCssDeclarationToken extends aCssToken { /** * Is the declaration flagged as important? - * + * * @var boolean */ public $IsImportant = false; /** * Is the declaration flagged as last one of the ruleset? - * + * * @var boolean */ public $IsLast = false; /** * Property name of the declaration. - * + * * @var string */ public $Property = ""; /** * Value of the declaration. - * + * * @var string */ public $Value = ""; /** - * Set the properties of the @font-face declaration. - * + * Set the properties of the @font-face declaration. + * * @param string $property Property of the declaration * @param string $value Value of the declaration * @param boolean $isImportant Is the !important flag is set? @@ -371,7 +371,7 @@ public function __construct($property, $value, $isImportant = false, $isLast = f } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -392,7 +392,7 @@ public function __toString() */ abstract class aCssAtBlockStartToken extends aCssToken { - + } /** @@ -409,7 +409,7 @@ abstract class aCssAtBlockEndToken extends aCssToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -420,7 +420,7 @@ public function __toString() /** * {@link aCssFromatter Formatter} returning the CSS source in {@link http://goo.gl/etzLs Whitesmiths indent style}. - * + * * @package CssMin/Formatter * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -432,7 +432,7 @@ class CssWhitesmithsFormatter extends aCssFormatter { /** * Implements {@link aCssFormatter::__toString()}. - * + * * @return string */ public function __toString() @@ -528,11 +528,11 @@ public function __toString() } /** - * This {@link aCssMinifierPlugin} will process var-statement and sets the declaration value to the variable value. - * + * This {@link aCssMinifierPlugin} will process var-statement and sets the declaration value to the variable value. + * * This plugin only apply the variable values. The variable values itself will get parsed by the * {@link CssVariablesMinifierFilter}. - * + * * Example: * * @variables @@ -541,7 +541,7 @@ public function __toString() * } * color: var(defaultColor); * - * + * * Will get converted to: * * color:black; @@ -558,19 +558,19 @@ class CssVariablesMinifierPlugin extends aCssMinifierPlugin { /** * Regular expression matching a value. - * + * * @var string */ private $reMatch = "/var\((.+)\)/iSU"; /** * Parsed variables. - * + * * @var array */ private $variables = null; /** * Returns the variables. - * + * * @return array */ public function getVariables() @@ -579,7 +579,7 @@ public function getVariables() } /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -614,7 +614,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -628,7 +628,7 @@ public function getTriggerTokens() } /** * Sets the variables. - * + * * @param array $variables Variables to set * @return void */ @@ -639,10 +639,10 @@ public function setVariables(array $variables) } /** - * This {@link aCssMinifierFilter minifier filter} will parse the variable declarations out of @variables at-rule - * blocks. The variables will get store in the {@link CssVariablesMinifierPlugin} that will apply the variables to + * This {@link aCssMinifierFilter minifier filter} will parse the variable declarations out of @variables at-rule + * blocks. The variables will get store in the {@link CssVariablesMinifierPlugin} that will apply the variables to * declaration. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -654,7 +654,7 @@ class CssVariablesMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -734,9 +734,9 @@ public function apply(array &$tokens) /** * {@link aCssParserPlugin Parser plugin} for preserve parsing url() values. - * + * * This plugin return no {@link aCssToken CssToken} but ensures that url() values will get parsed properly. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -748,7 +748,7 @@ class CssUrlParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -757,7 +757,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -766,7 +766,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -810,9 +810,9 @@ public function parse($index, $char, $previousChar, $state) /** * {@link aCssParserPlugin Parser plugin} for preserve parsing string values. - * + * * This plugin return no {@link aCssToken CssToken} but ensures that string values will get parsed properly. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -824,13 +824,13 @@ class CssStringParserPlugin extends aCssParserPlugin { /** * Current string delimiter char. - * + * * @var string */ private $delimiterChar = null; /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -839,7 +839,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -848,7 +848,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -881,7 +881,7 @@ public function parse($index, $char, $previousChar, $state) // End of string elseif ($char === $this->delimiterChar && $state === "T_STRING") { - // If the Previous char is a escape char count the amount of the previous escape chars. If the amount of + // If the Previous char is a escape char count the amount of the previous escape chars. If the amount of // escape chars is uneven do not end the string if ($previousChar == "\\") { @@ -911,7 +911,7 @@ public function parse($index, $char, $previousChar, $state) /** * This {@link aCssMinifierFilter minifier filter} sorts the ruleset declarations of a ruleset by name. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Rowan Beentje @@ -923,7 +923,7 @@ class CssSortRulesetPropertiesMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value larger than 0 will rebuild the array */ @@ -955,7 +955,7 @@ public function apply(array &$tokens) $declarations = array_slice($tokens, $startIndex + 1, $endIndex - $startIndex - 1); // Check whether a sort is required $sortRequired = $lastPropertyName = false; - foreach ($declarations as $declaration) + foreach ($declarations as $declaration) { if ($lastPropertyName) { @@ -990,7 +990,7 @@ public function apply(array &$tokens) } /** * User defined sort function. - * + * * @return integer */ public static function userDefinedSort1($a, $b) @@ -1001,7 +1001,7 @@ public static function userDefinedSort1($a, $b) /** * This {@link aCssToken CSS token} represents the start of a ruleset. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1013,14 +1013,14 @@ class CssRulesetStartToken extends aCssRulesetStartToken { /** * Array of selectors. - * + * * @var array */ public $Selectors = array(); /** * Set the properties of a ruleset token. - * - * @param array $selectors Selectors of the ruleset + * + * @param array $selectors Selectors of the ruleset * @return void */ public function __construct(array $selectors = array()) @@ -1029,7 +1029,7 @@ public function __construct(array $selectors = array()) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -1040,8 +1040,8 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing ruleset block with including declarations. - * - * Found rulesets will add a {@link CssRulesetStartToken} and {@link CssRulesetEndToken} to the + * + * Found rulesets will add a {@link CssRulesetStartToken} and {@link CssRulesetEndToken} to the * parser; including declarations as {@link CssRulesetDeclarationToken}. * * @package CssMin/Parser/Plugins @@ -1055,7 +1055,7 @@ class CssRulesetParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -1064,7 +1064,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -1073,13 +1073,13 @@ public function getTriggerStates() } /** * Selectors. - * + * * @var array */ private $selectors = array(); /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -1179,7 +1179,7 @@ public function parse($index, $char, $previousChar, $state) */ class CssRulesetEndToken extends aCssRulesetEndToken { - + } /** @@ -1196,13 +1196,13 @@ class CssRulesetDeclarationToken extends aCssDeclarationToken { /** * Media types of the declaration. - * + * * @var array */ public $MediaTypes = array("all"); /** - * Set the properties of a ddocument- or at-rule @media level declaration. - * + * Set the properties of a ddocument- or at-rule @media level declaration. + * * @param string $property Property of the declaration * @param string $value Value of the declaration * @param mixed $mediaTypes Media types of the declaration @@ -1218,10 +1218,10 @@ public function __construct($property, $value, $mediaTypes = null, $isImportant } /** - * This {@link aCssMinifierFilter minifier filter} sets the IsLast property of any last declaration in a ruleset, - * @font-face at-rule or @page at-rule block. If the property IsLast is TRUE the decrations will get stringified + * This {@link aCssMinifierFilter minifier filter} sets the IsLast property of any last declaration in a ruleset, + * @font-face at-rule or @page at-rule block. If the property IsLast is TRUE the decrations will get stringified * without tailing semicolon. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1233,7 +1233,7 @@ class CssRemoveLastDelarationSemiColonMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -1244,7 +1244,7 @@ public function apply(array &$tokens) $current = get_class($tokens[$i]); $next = isset($tokens[$i+1]) ? get_class($tokens[$i+1]) : false; if (($current === "CssRulesetDeclarationToken" && $next === "CssRulesetEndToken") || - ($current === "CssAtFontFaceDeclarationToken" && $next === "CssAtFontFaceEndToken") || + ($current === "CssAtFontFaceDeclarationToken" && $next === "CssAtFontFaceEndToken") || ($current === "CssAtPageDeclarationToken" && $next === "CssAtPageEndToken")) { $tokens[$i]->IsLast = true; @@ -1255,7 +1255,7 @@ public function apply(array &$tokens) } /** - * This {@link aCssMinifierFilter minifier filter} will remove any empty rulesets (including @keyframes at-rule block + * This {@link aCssMinifierFilter minifier filter} will remove any empty rulesets (including @keyframes at-rule block * rulesets). * * @package CssMin/Minifier/Filters @@ -1269,7 +1269,7 @@ class CssRemoveEmptyRulesetsMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -1295,9 +1295,9 @@ public function apply(array &$tokens) } /** - * This {@link aCssMinifierFilter minifier filter} will remove any empty @font-face, @keyframes, @media and @page + * This {@link aCssMinifierFilter minifier filter} will remove any empty @font-face, @keyframes, @media and @page * at-rule blocks. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1309,7 +1309,7 @@ class CssRemoveEmptyAtBlocksMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -1337,7 +1337,7 @@ public function apply(array &$tokens) /** * This {@link aCssMinifierFilter minifier filter} will remove any comments from the array of parsed tokens. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1349,7 +1349,7 @@ class CssRemoveCommentsMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -1370,7 +1370,7 @@ public function apply(array &$tokens) /** * CSS Parser. - * + * * @package CssMin/Parser * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1382,57 +1382,57 @@ class CssParser { /** * Parse buffer. - * + * * @var string */ private $buffer = ""; /** * {@link aCssParserPlugin Plugins}. - * + * * @var array */ private $plugins = array(); /** * Source to parse. - * + * * @var string */ private $source = ""; /** * Current state. - * + * * @var integer */ private $state = "T_DOCUMENT"; /** * Exclusive state. - * + * * @var string */ private $stateExclusive = false; /** * Media types state. - * + * * @var mixed */ private $stateMediaTypes = false; /** * State stack. - * + * * @var array */ private $states = array("T_DOCUMENT"); /** * Parsed tokens. - * + * * @var array */ private $tokens = array(); /** * Constructer. - * + * * Create instances of the used {@link aCssParserPlugin plugins}. - * + * * @param string $source CSS source [optional] * @param array $plugins Plugin configuration [optional] * @return void @@ -1478,7 +1478,7 @@ public function __construct($source = null, array $plugins = null) } /** * Append a token to the array of tokens. - * + * * @param aCssToken $token Token to append * @return void */ @@ -1488,7 +1488,7 @@ public function appendToken(aCssToken $token) } /** * Clears the current buffer. - * + * * @return void */ public function clearBuffer() @@ -1497,7 +1497,7 @@ public function clearBuffer() } /** * Returns and clear the current buffer. - * + * * @param string $trim Chars to use to trim the returned buffer * @param boolean $tolower if TRUE the returned buffer will get converted to lower case * @return string @@ -1510,7 +1510,7 @@ public function getAndClearBuffer($trim = "", $tolower = false) } /** * Returns the current buffer. - * + * * @param string $trim Chars to use to trim the returned buffer * @param boolean $tolower if TRUE the returned buffer will get converted to lower case * @return string @@ -1530,16 +1530,16 @@ public function getBuffer($trim = "", $tolower = false) } /** * Returns the current media types state. - * + * * @return array - */ + */ public function getMediaTypes() { return $this->stateMediaTypes; } /** * Returns the CSS source. - * + * * @return string */ public function getSource() @@ -1548,7 +1548,7 @@ public function getSource() } /** * Returns the current state. - * + * * @return integer The current state */ public function getState() @@ -1557,8 +1557,8 @@ public function getState() } /** * Returns a plugin by class name. - * - * @param string $name Class name of the plugin + * + * @param string $name Class name of the plugin * @return aCssParserPlugin */ public function getPlugin($class) @@ -1576,7 +1576,7 @@ public function getPlugin($class) } /** * Returns the parsed tokens. - * + * * @return array */ public function getTokens() @@ -1585,7 +1585,7 @@ public function getTokens() } /** * Returns if the current state equals the passed state. - * + * * @param integer $state State to compare with the current state * @return boolean TRUE is the state equals to the passed state; FALSE if not */ @@ -1595,7 +1595,7 @@ public function isState($state) } /** * Parse the CSS source and return a array with parsed tokens. - * + * * @param string $source CSS source * @return array Array with tokens */ @@ -1604,7 +1604,7 @@ public function parse($source) // Reset $this->source = ""; $this->tokens = array(); - // Create a global and plugin lookup table for trigger chars; set array of plugins as local variable and create + // Create a global and plugin lookup table for trigger chars; set array of plugins as local variable and create // several helper variables for plugin handling $globalTriggerChars = ""; $plugins = $this->plugins; @@ -1658,7 +1658,7 @@ public function parse($source) // Extended processing only if the current char is a global trigger char if (strpos($globalTriggerChars, $c) !== false) { - // Exclusive state is set; process with the exclusive plugin + // Exclusive state is set; process with the exclusive plugin if ($exclusive) { $tPluginIndex = $pluginIndex[$exclusive]; @@ -1710,7 +1710,7 @@ public function parse($source) } /** * Remove the last state of the state stack and return the removed stack value. - * + * * @return integer Removed state value */ public function popState() @@ -1721,7 +1721,7 @@ public function popState() } /** * Adds a new state onto the state stack. - * + * * @param integer $state State to add onto the state stack. * @return integer The index of the added state in the state stacks */ @@ -1733,37 +1733,37 @@ public function pushState($state) } /** * Sets/restores the buffer. - * + * * @param string $buffer Buffer to set * @return void - */ + */ public function setBuffer($buffer) { $this->buffer = $buffer; } /** * Set the exclusive state. - * + * * @param string $exclusive Exclusive state * @return void - */ + */ public function setExclusive($exclusive) { - $this->stateExclusive = $exclusive; + $this->stateExclusive = $exclusive; } /** * Set the media types state. - * + * * @param array $mediaTypes Media types state * @return void - */ + */ public function setMediaTypes(array $mediaTypes) { - $this->stateMediaTypes = $mediaTypes; + $this->stateMediaTypes = $mediaTypes; } /** * Sets the current state in the state stack; equals to {@link CssParser::popState()} + {@link CssParser::pushState()}. - * + * * @param integer $state State to set * @return integer */ @@ -1776,7 +1776,7 @@ public function setState($state) } /** * Removes the exclusive state. - * + * * @return void */ public function unsetExclusive() @@ -1785,7 +1785,7 @@ public function unsetExclusive() } /** * Removes the media types state. - * + * * @return void */ public function unsetMediaTypes() @@ -1796,7 +1796,7 @@ public function unsetMediaTypes() /** * {@link aCssFromatter Formatter} returning the CSS source in {@link http://goo.gl/j4XdU OTBS indent style} (The One True Brace Style). - * + * * @package CssMin/Formatter * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1808,7 +1808,7 @@ class CssOtbsFormatter extends aCssFormatter { /** * Implements {@link aCssFormatter::__toString()}. - * + * * @return string */ public function __toString() @@ -1911,7 +1911,7 @@ class CssNullToken extends aCssToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -1922,7 +1922,7 @@ public function __toString() /** * CSS Minifier. - * + * * @package CssMin/Minifier * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -1934,27 +1934,27 @@ class CssMinifier { /** * {@link aCssMinifierFilter Filters}. - * + * * @var array */ private $filters = array(); /** * {@link aCssMinifierPlugin Plugins}. - * + * * @var array */ private $plugins = array(); /** * Minified source. - * + * * @var string */ private $minified = ""; /** * Constructer. - * + * * Creates instances of {@link aCssMinifierFilter filters} and {@link aCssMinifierPlugin plugins}. - * + * * @param string $source CSS source [optional] * @param array $filters Filter configuration [optional] * @param array $plugins Plugin configuration [optional] @@ -1965,7 +1965,7 @@ public function __construct($source = null, array $filters = null, array $plugin $filters = array_merge(array ( "ImportImports" => false, - "RemoveComments" => true, + "RemoveComments" => true, "RemoveEmptyRulesets" => true, "RemoveEmptyAtBlocks" => true, "ConvertLevel3Properties" => false, @@ -2026,7 +2026,7 @@ public function __construct($source = null, array $filters = null, array $plugin } /** * Returns the minified Source. - * + * * @return string */ public function getMinified() @@ -2035,7 +2035,7 @@ public function getMinified() } /** * Returns a plugin by class name. - * + * * @param string $name Class name of the plugin * @return aCssMinifierPlugin */ @@ -2054,7 +2054,7 @@ public function getPlugin($class) } /** * Minifies the CSS source. - * + * * @param string $source CSS source * @return string */ @@ -2132,7 +2132,7 @@ public function minify($source) /** * CssMin - A (simple) css minifier with benefits - * + * * -- * Copyright (c) 2011 Joe Scylla * @@ -2142,10 +2142,10 @@ public function minify($source) * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -2154,7 +2154,7 @@ public function minify($source) * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * -- - * + * * @package CssMin * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2166,25 +2166,25 @@ class CssMin { /** * Index of classes - * + * * @var array */ private static $classIndex = array(); /** * Parse/minify errors - * + * * @var array */ private static $errors = array(); /** * Verbose output. - * + * * @var boolean */ private static $isVerbose = false; /** * {@link http://goo.gl/JrW54 Autoload} function of CssMin. - * + * * @param string $class Name of the class * @return void */ @@ -2197,7 +2197,7 @@ public static function autoload($class) } /** * Return errors - * + * * @return array of {CssError}. */ public static function getErrors() @@ -2206,7 +2206,7 @@ public static function getErrors() } /** * Returns if there were errors. - * + * * @return boolean */ public static function hasErrors() @@ -2215,7 +2215,7 @@ public static function hasErrors() } /** * Initialises CssMin. - * + * * @return void */ public static function initialise() @@ -2243,8 +2243,8 @@ public static function initialise() } } krsort(self::$classIndex); - // Only use autoloading if spl_autoload_register() is available and no __autoload() is defined (because - // __autoload() breaks if spl_autoload_register() is used. + // Only use autoloading if spl_autoload_register() is available and no __autoload() is defined (because + // __autoload() breaks if spl_autoload_register() is used. if (function_exists("spl_autoload_register") && !is_callable("__autoload")) { spl_autoload_register(array(__CLASS__, "autoload")); @@ -2263,7 +2263,7 @@ public static function initialise() } /** * Minifies CSS source. - * + * * @param string $source CSS source * @param array $filters Filter configuration [optional] * @param array $plugins Plugin configuration [optional] @@ -2277,7 +2277,7 @@ public static function minify($source, array $filters = null, array $plugins = n } /** * Parse the CSS source. - * + * * @param string $source CSS source * @param array $plugins Plugin configuration [optional] * @return array Array of aCssToken @@ -2290,7 +2290,7 @@ public static function parse($source, array $plugins = null) } /** * -- - * + * * @param boolean $to * @return boolean */ @@ -2301,7 +2301,7 @@ public static function setVerbose($to) } /** * -- - * + * * @param CssError $error * @return void */ @@ -2318,9 +2318,9 @@ public static function triggerError(CssError $error) CssMin::initialise(); /** - * This {@link aCssMinifierFilter minifier filter} import external css files defined with the @import at-rule into the - * current stylesheet. - * + * This {@link aCssMinifierFilter minifier filter} import external css files defined with the @import at-rule into the + * current stylesheet. + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2332,13 +2332,13 @@ class CssImportImportsMinifierFilter extends aCssMinifierFilter { /** * Array with already imported external stylesheets. - * + * * @var array */ private $imported = array(); /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -2447,9 +2447,9 @@ public function apply(array &$tokens) } } /* - * If the media types of the @media at-rule equals the media types defined in the @import + * If the media types of the @media at-rule equals the media types defined in the @import * at-rule remove the CssAtMediaStartToken and CssAtMediaEndToken token - */ + */ for($ii = 0, $ll = count($import); $ii < $ll; $ii++) { if (get_class($import[$ii]) === "CssAtMediaStartToken" && count(array_diff($tokens[$i]->MediaTypes, $import[$ii]->MediaTypes)) === 0) @@ -2522,10 +2522,10 @@ public function apply(array &$tokens) /** * {@link aCssParserPlugin Parser plugin} for preserve parsing expression() declaration values. - * - * This plugin return no {@link aCssToken CssToken} but ensures that expression() declaration values will get parsed + * + * This plugin return no {@link aCssToken CssToken} but ensures that expression() declaration values will get parsed * properly. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2537,19 +2537,19 @@ class CssExpressionParserPlugin extends aCssParserPlugin { /** * Count of left braces. - * + * * @var integer */ private $leftBraces = 0; /** * Count of right braces. - * + * * @var integer */ private $rightBraces = 0; /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -2558,7 +2558,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -2567,7 +2567,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -2608,7 +2608,7 @@ public function parse($index, $char, $previousChar, $state) /** * CSS Error. - * + * * @package CssMin * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2620,31 +2620,31 @@ class CssError { /** * File. - * + * * @var string */ public $File = ""; /** * Line. - * + * * @var integer */ public $Line = 0; /** * Error message. - * + * * @var string */ public $Message = ""; /** * Source. - * + * * @var string */ public $Source = ""; /** * Constructor triggering the error. - * + * * @param string $message Error message * @param string $source Corresponding line [optional] * @return void @@ -2658,9 +2658,9 @@ public function __construct($file, $line, $message, $source = "") } /** * Returns the error as formatted string. - * + * * @return string - */ + */ public function __toString() { return $this->Message . ($this->Source ? ":
" . $this->Source . "": "") . "
in file " . $this->File . " at line " . $this->Line; @@ -2669,12 +2669,12 @@ public function __toString() /** * This {@link aCssMinifierPlugin} will convert a color value in rgb notation to hexadecimal notation. - * + * * Example: * * color: rgb(200,60%,5); * - * + * * Will get converted to: * * color:#c89905; @@ -2691,13 +2691,13 @@ class CssConvertRgbColorsMinifierPlugin extends aCssMinifierPlugin { /** * Regular expression matching the value. - * + * * @var string */ private $reMatch = "/rgb\s*\(\s*([0-9%]+)\s*,\s*([0-9%]+)\s*,\s*([0-9%]+)\s*\)/iS"; /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -2720,7 +2720,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -2736,19 +2736,19 @@ public function getTriggerTokens() /** * This {@link aCssMinifierPlugin} will convert named color values to hexadecimal notation. - * + * * Example: * * color: black; * border: 1px solid indigo; * - * + * * Will get converted to: * * color:#000; * border:1px solid #4b0082; * - * + * * @package CssMin/Minifier/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2758,26 +2758,26 @@ public function getTriggerTokens() */ class CssConvertNamedColorsMinifierPlugin extends aCssMinifierPlugin { - + /** * Regular expression matching the value. - * + * * @var string */ private $reMatch = null; /** * Regular expression replacing the value. - * + * * @var string */ private $reReplace = "\"\${1}\" . \$this->transformation[strtolower(\"\${2}\")] . \"\${3}\""; /** * Transformation table used by the {@link CssConvertNamedColorsMinifierPlugin::$reReplace replace regular expression}. - * + * * @var array */ private $transformation = array - ( + ( "aliceblue" => "#f0f8ff", "antiquewhite" => "#faebd7", "aqua" => "#0ff", @@ -2917,10 +2917,10 @@ class CssConvertNamedColorsMinifierPlugin extends aCssMinifierPlugin ); /** * Overwrites {@link aCssMinifierPlugin::__construct()}. - * + * * The constructor will create the {@link CssConvertNamedColorsMinifierPlugin::$reReplace replace regular expression} * based on the {@link CssConvertNamedColorsMinifierPlugin::$transformation transformation table}. - * + * * @param CssMinifier $minifier The CssMinifier object of this plugin. * @param array $configuration Plugin configuration [optional] * @return void @@ -2932,7 +2932,7 @@ public function __construct(CssMinifier $minifier, array $configuration = array( } /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -2953,7 +2953,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -2970,7 +2970,7 @@ public function getTriggerTokens() /** * This {@link aCssMinifierFilter minifier filter} triggers on CSS Level 3 properties and will add declaration tokens * with browser-specific properties. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -2981,9 +2981,9 @@ public function getTriggerTokens() class CssConvertLevel3PropertiesMinifierFilter extends aCssMinifierFilter { /** - * Css property transformations table. Used to convert CSS3 and proprietary properties to the browser-specific + * Css property transformations table. Used to convert CSS3 and proprietary properties to the browser-specific * counterparts. - * + * * @var array */ private $transformations = array @@ -3193,7 +3193,7 @@ class CssConvertLevel3PropertiesMinifierFilter extends aCssMinifierFilter ); /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value large than 0 will rebuild the array */ @@ -3241,9 +3241,9 @@ public function apply(array &$tokens) return $r; } /** - * Transforms the Internet Explorer specific declaration property "filter" to Internet Explorer 8+ compatible - * declaratiopn property "-ms-filter". - * + * Transforms the Internet Explorer specific declaration property "filter" to Internet Explorer 8+ compatible + * declaratiopn property "-ms-filter". + * * @param aCssToken $token * @return array */ @@ -3257,7 +3257,7 @@ private static function filter($token) } /** * Transforms "opacity: {value}" into browser specific counterparts. - * + * * @param aCssToken $token * @return array */ @@ -3277,7 +3277,7 @@ private static function opacity($token) } /** * Transforms "white-space: pre-wrap" into browser specific counterparts. - * + * * @param aCssToken $token * @return array */ @@ -3309,7 +3309,7 @@ private static function whiteSpace($token) /** * This {@link aCssMinifierFilter minifier filter} will convert @keyframes at-rule block to browser specific counterparts. - * + * * @package CssMin/Minifier/Filters * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3321,7 +3321,7 @@ class CssConvertLevel3AtKeyframesMinifierFilter extends aCssMinifierFilter { /** * Implements {@link aCssMinifierFilter::filter()}. - * + * * @param array $tokens Array of objects of type aCssToken * @return integer Count of added, changed or removed tokens; a return value larger than 0 will rebuild the array */ @@ -3378,17 +3378,17 @@ public function apply(array &$tokens) /** * This {@link aCssMinifierPlugin} will convert a color value in hsl notation to hexadecimal notation. - * + * * Example: * * color: hsl(232,36%,48%); * - * + * * Will get converted to: * * color:#4e5aa7; * - * + * * @package CssMin/Minifier/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3400,13 +3400,13 @@ class CssConvertHslColorsMinifierPlugin extends aCssMinifierPlugin { /** * Regular expression matching the value. - * + * * @var string */ private $reMatch = "/^hsl\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*%\s*,\s*([0-9]+)\s*%\s*\)/iS"; /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -3420,7 +3420,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -3434,9 +3434,9 @@ public function getTriggerTokens() } /** * Convert a HSL value to hexadecimal notation. - * + * * Based on: {@link http://www.easyrgb.com/index.php?X=MATH&H=19#text19}. - * + * * @param integer $hue Hue * @param integer $saturation Saturation * @param integer $lightness Lightnesss @@ -3472,7 +3472,7 @@ private function hsl2hex($hue, $saturation, $lightness) } /** * Apply hue to a rgb color value. - * + * * @param integer $v1 Value 1 * @param integer $v2 Value 2 * @param integer $hue Hue @@ -3506,13 +3506,13 @@ private function hue2rgb($v1, $v2, $hue) /** * This {@link aCssMinifierPlugin} will convert the font-weight values normal and bold to their numeric notation. - * + * * Example: * * font-weight: normal; * font: bold 11px monospace; * - * + * * Will get converted to: * * font-weight:400; @@ -3530,8 +3530,8 @@ class CssConvertFontWeightMinifierPlugin extends aCssMinifierPlugin { /** * Array of included declaration properties this plugin will process; others declaration properties will get - * ignored. - * + * ignored. + * * @var array */ private $include = array @@ -3541,19 +3541,19 @@ class CssConvertFontWeightMinifierPlugin extends aCssMinifierPlugin ); /** * Regular expression matching the value. - * + * * @var string */ private $reMatch = null; /** * Regular expression replace the value. - * + * * @var string */ private $reReplace = "\"\${1}\" . \$this->transformation[\"\${2}\"] . \"\${3}\""; /** * Transformation table used by the {@link CssConvertFontWeightMinifierPlugin::$reReplace replace regular expression}. - * + * * @var array */ private $transformation = array @@ -3563,10 +3563,10 @@ class CssConvertFontWeightMinifierPlugin extends aCssMinifierPlugin ); /** * Overwrites {@link aCssMinifierPlugin::__construct()}. - * + * * The constructor will create the {@link CssConvertFontWeightMinifierPlugin::$reReplace replace regular expression} * based on the {@link CssConvertFontWeightMinifierPlugin::$transformation transformation table}. - * + * * @param CssMinifier $minifier The CssMinifier object of this plugin. * @return void */ @@ -3577,7 +3577,7 @@ public function __construct(CssMinifier $minifier) } /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -3591,7 +3591,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -3607,21 +3607,21 @@ public function getTriggerTokens() /** * This {@link aCssMinifierPlugin} will compress several unit values to their short notations. Examples: - * + * * * padding: 0.5em; * border: 0px; * margin: 0 0 0 0; * - * + * * Will get compressed to: - * + * * * padding:.5px; * border:0; * margin:0; * - * + * * -- * * @package CssMin/Minifier/Plugins @@ -3635,7 +3635,7 @@ class CssCompressUnitValuesMinifierPlugin extends aCssMinifierPlugin { /** * Regular expression used for matching and replacing unit values. - * + * * @var array */ private $re = array @@ -3646,13 +3646,13 @@ class CssCompressUnitValuesMinifierPlugin extends aCssMinifierPlugin ); /** * Regular expression matching the value. - * + * * @var string */ private $reMatch = "/(^| |-)0\.([0-9]+?)(0+)?(%|em|ex|px|in|cm|mm|pt|pc)|(^| )-?(\.?)0(%|em|ex|px|in|cm|mm|pt|pc)|(^0\s0\s0\s0$)|(^0\s0\s0$)|(^0\s0$)/iS"; /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -3669,7 +3669,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -3685,10 +3685,10 @@ public function getTriggerTokens() /** * This {@link aCssMinifierPlugin} compress the content of expresssion() declaration values. - * - * For compression of expressions {@link https://github.com/rgrove/jsmin-php/ JSMin} will get used. JSMin have to be - * already included or loadable via {@link http://goo.gl/JrW54 PHP autoloading}. - * + * + * For compression of expressions {@link https://github.com/rgrove/jsmin-php/ JSMin} will get used. JSMin have to be + * already included or loadable via {@link http://goo.gl/JrW54 PHP autoloading}. + * * @package CssMin/Minifier/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3700,7 +3700,7 @@ class CssCompressExpressionValuesMinifierPlugin extends aCssMinifierPlugin { /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -3717,7 +3717,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -3732,19 +3732,19 @@ public function getTriggerTokens() } /** - * This {@link aCssMinifierPlugin} will convert hexadecimal color value with 6 chars to their 3 char hexadecimal - * notation (if possible). - * + * This {@link aCssMinifierPlugin} will convert hexadecimal color value with 6 chars to their 3 char hexadecimal + * notation (if possible). + * * Example: * * color: #aabbcc; * - * + * * Will get converted to: * * color:#abc; * - * + * * @package CssMin/Minifier/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3756,13 +3756,13 @@ class CssCompressColorValuesMinifierPlugin extends aCssMinifierPlugin { /** * Regular expression matching 6 char hexadecimal color values. - * + * * @var string */ private $reMatch = "/\#([0-9a-f]{6})/iS"; /** * Implements {@link aCssMinifierPlugin::minify()}. - * + * * @param aCssToken $token Token to process * @return boolean Return TRUE to break the processing of this token; FALSE to continue */ @@ -3780,7 +3780,7 @@ public function apply(aCssToken &$token) } /** * Implements {@link aMinifierPlugin::getTriggerTokens()} - * + * * @return array */ public function getTriggerTokens() @@ -3796,7 +3796,7 @@ public function getTriggerTokens() /** * This {@link aCssToken CSS token} represents a CSS comment. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3808,14 +3808,14 @@ class CssCommentToken extends aCssToken { /** * Comment as Text. - * + * * @var string */ public $Comment = ""; /** * Set the properties of a comment token. - * - * @param string $comment Comment including comment delimiters + * + * @param string $comment Comment including comment delimiters * @return void */ public function __construct($comment) @@ -3824,7 +3824,7 @@ public function __construct($comment) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -3835,9 +3835,9 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing comments. - * + * * Adds a {@link CssCommentToken} to the parser if a comment was found. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3849,7 +3849,7 @@ class CssCommentParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -3858,7 +3858,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -3867,13 +3867,13 @@ public function getTriggerStates() } /** * Stored buffer for restore. - * + * * @var string */ private $restoreBuffer = ""; /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -3916,13 +3916,13 @@ class CssAtVariablesStartToken extends aCssAtBlockStartToken { /** * Media types of the @variables at-rule block. - * + * * @var array */ public $MediaTypes = array(); /** * Set the properties of a @variables at-rule token. - * + * * @param array $mediaTypes Media types * @return void */ @@ -3932,7 +3932,7 @@ public function __construct($mediaTypes = null) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -3943,10 +3943,10 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @variables at-rule block with including declarations. - * - * Found @variables at-rule blocks will add a {@link CssAtVariablesStartToken} and {@link CssAtVariablesEndToken} to the + * + * Found @variables at-rule blocks will add a {@link CssAtVariablesStartToken} and {@link CssAtVariablesEndToken} to the * parser; including declarations as {@link CssAtVariablesDeclarationToken}. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -3958,7 +3958,7 @@ class CssAtVariablesParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -3967,7 +3967,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -3976,7 +3976,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4060,7 +4060,7 @@ class CssAtVariablesEndToken extends aCssAtBlockEndToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4071,7 +4071,7 @@ public function __toString() /** * This {@link aCssToken CSS token} represents a declaration of a @variables at-rule block. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4083,7 +4083,7 @@ class CssAtVariablesDeclarationToken extends aCssDeclarationToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4106,13 +4106,13 @@ class CssAtPageStartToken extends aCssAtBlockStartToken { /** * Selector. - * + * * @var string */ public $Selector = ""; /** * Sets the properties of the @page at-rule. - * + * * @param string $selector Selector * @return void */ @@ -4122,7 +4122,7 @@ public function __construct($selector = "") } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4133,10 +4133,10 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @page at-rule block with including declarations. - * - * Found @page at-rule blocks will add a {@link CssAtPageStartToken} and {@link CssAtPageEndToken} to the + * + * Found @page at-rule blocks will add a {@link CssAtPageStartToken} and {@link CssAtPageEndToken} to the * parser; including declarations as {@link CssAtPageDeclarationToken}. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4148,7 +4148,7 @@ class CssAtPageParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -4157,7 +4157,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -4166,7 +4166,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4255,12 +4255,12 @@ public function parse($index, $char, $previousChar, $state) */ class CssAtPageEndToken extends aCssAtBlockEndToken { - + } /** * This {@link aCssToken CSS token} represents a declaration of a @page at-rule block. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4270,7 +4270,7 @@ class CssAtPageEndToken extends aCssAtBlockEndToken */ class CssAtPageDeclarationToken extends aCssDeclarationToken { - + } /** @@ -4287,7 +4287,7 @@ class CssAtMediaStartToken extends aCssAtBlockStartToken { /** * Sets the properties of the @media at-rule. - * + * * @param array $mediaTypes Media types * @return void */ @@ -4297,7 +4297,7 @@ public function __construct(array $mediaTypes = array()) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4308,8 +4308,8 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @media at-rule block. - * - * Found @media at-rule blocks will add a {@link CssAtMediaStartToken} and {@link CssAtMediaEndToken} to the parser. + * + * Found @media at-rule blocks will add a {@link CssAtMediaStartToken} and {@link CssAtMediaEndToken} to the parser. * This plugin will also set the the current media types using {@link CssParser::setMediaTypes()} and * {@link CssParser::unsetMediaTypes()}. * @@ -4324,7 +4324,7 @@ class CssAtMediaParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -4333,7 +4333,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -4342,7 +4342,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4390,7 +4390,7 @@ public function parse($index, $char, $previousChar, $state) */ class CssAtMediaEndToken extends aCssAtBlockEndToken { - + } /** @@ -4407,19 +4407,19 @@ class CssAtKeyframesStartToken extends aCssAtBlockStartToken { /** * Name of the at-rule. - * + * * @var string */ public $AtRuleName = "keyframes"; /** * Name - * + * * @var string */ public $Name = ""; /** * Sets the properties of the @page at-rule. - * + * * @param string $selector Selector * @return void */ @@ -4433,7 +4433,7 @@ public function __construct($name, $atRuleName = null) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4444,7 +4444,7 @@ public function __toString() /** * This {@link aCssToken CSS token} represents the start of a ruleset of a @keyframes at-rule block. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4456,14 +4456,14 @@ class CssAtKeyframesRulesetStartToken extends aCssRulesetStartToken { /** * Array of selectors. - * + * * @var array */ public $Selectors = array(); /** * Set the properties of a ruleset token. - * - * @param array $selectors Selectors of the ruleset + * + * @param array $selectors Selectors of the ruleset * @return void */ public function __construct(array $selectors = array()) @@ -4472,7 +4472,7 @@ public function __construct(array $selectors = array()) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4483,7 +4483,7 @@ public function __toString() /** * This {@link aCssToken CSS token} represents the end of a ruleset of a @keyframes at-rule block. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4493,7 +4493,7 @@ public function __toString() */ class CssAtKeyframesRulesetEndToken extends aCssRulesetEndToken { - + } /** @@ -4508,12 +4508,12 @@ class CssAtKeyframesRulesetEndToken extends aCssRulesetEndToken */ class CssAtKeyframesRulesetDeclarationToken extends aCssDeclarationToken { - + } /** * {@link aCssParserPlugin Parser plugin} for parsing @keyframes at-rule blocks, rulesets and declarations. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4529,13 +4529,13 @@ class CssAtKeyframesParserPlugin extends aCssParserPlugin private $atRuleName = ""; /** * Selectors. - * + * * @var array */ private $selectors = array(); /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -4544,7 +4544,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -4553,7 +4553,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4562,7 +4562,7 @@ public function getTriggerStates() public function parse($index, $char, $previousChar, $state) { // Start of @keyframes at-rule block - if ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 10)) === "@keyframes") + if ($char === "@" && $state === "T_DOCUMENT" && strtolower(substr($this->parser->getSource(), $index, 10)) === "@keyframes") { $this->atRuleName = "keyframes"; $this->parser->pushState("T_AT_KEYFRAMES::NAME"); @@ -4652,7 +4652,7 @@ public function parse($index, $char, $previousChar, $state) elseif ($char === "}" && $state === "T_AT_KEYFRAMES_RULESET") { $this->parser->clearBuffer(); - + $this->parser->popState(); $this->parser->appendToken(new CssAtKeyframesRulesetEndToken()); } @@ -4683,12 +4683,12 @@ public function parse($index, $char, $previousChar, $state) */ class CssAtKeyframesEndToken extends aCssAtBlockEndToken { - + } /** * This {@link aCssToken CSS token} represents a @import at-rule. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4700,19 +4700,19 @@ class CssAtImportToken extends aCssToken { /** * Import path of the @import at-rule. - * + * * @var string */ public $Import = ""; /** * Media types of the @import at-rule. - * + * * @var array */ public $MediaTypes = array(); /** * Set the properties of a @import at-rule token. - * + * * @param string $import Import path * @param array $mediaTypes Media types * @return void @@ -4724,7 +4724,7 @@ public function __construct($import, $mediaTypes) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4735,9 +4735,9 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @import at-rule. - * + * * If a @import at-rule was found this plugin will add a {@link CssAtImportToken} to the parser. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4749,7 +4749,7 @@ class CssAtImportParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -4758,7 +4758,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -4767,7 +4767,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4831,7 +4831,7 @@ class CssAtFontFaceStartToken extends aCssAtBlockStartToken { /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -4842,10 +4842,10 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @font-face at-rule block with including declarations. - * - * Found @font-face at-rule blocks will add a {@link CssAtFontFaceStartToken} and {@link CssAtFontFaceEndToken} to the + * + * Found @font-face at-rule blocks will add a {@link CssAtFontFaceStartToken} and {@link CssAtFontFaceEndToken} to the * parser; including declarations as {@link CssAtFontFaceDeclarationToken}. - * + * * @package CssMin/Parser/Plugins * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4857,7 +4857,7 @@ class CssAtFontFaceParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -4866,7 +4866,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -4875,7 +4875,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char @@ -4963,7 +4963,7 @@ public function parse($index, $char, $previousChar, $state) */ class CssAtFontFaceEndToken extends aCssAtBlockEndToken { - + } /** @@ -4978,12 +4978,12 @@ class CssAtFontFaceEndToken extends aCssAtBlockEndToken */ class CssAtFontFaceDeclarationToken extends aCssDeclarationToken { - + } /** * This {@link aCssToken CSS token} represents a @charset at-rule. - * + * * @package CssMin/Tokens * @link http://code.google.com/p/cssmin/ * @author Joe Scylla @@ -4995,13 +4995,13 @@ class CssAtCharsetToken extends aCssToken { /** * Charset of the @charset at-rule. - * + * * @var string */ public $Charset = ""; /** - * Set the properties of @charset at-rule token. - * + * Set the properties of @charset at-rule token. + * * @param string $charset Charset of the @charset at-rule token * @return void */ @@ -5011,7 +5011,7 @@ public function __construct($charset) } /** * Implements {@link aCssToken::__toString()}. - * + * * @return string */ public function __toString() @@ -5022,7 +5022,7 @@ public function __toString() /** * {@link aCssParserPlugin Parser plugin} for parsing @charset at-rule. - * + * * If a @charset at-rule was found this plugin will add a {@link CssAtCharsetToken} to the parser. * * @package CssMin/Parser/Plugins @@ -5036,7 +5036,7 @@ class CssAtCharsetParserPlugin extends aCssParserPlugin { /** * Implements {@link aCssParserPlugin::getTriggerChars()}. - * + * * @return array */ public function getTriggerChars() @@ -5045,7 +5045,7 @@ public function getTriggerChars() } /** * Implements {@link aCssParserPlugin::getTriggerStates()}. - * + * * @return array */ public function getTriggerStates() @@ -5054,7 +5054,7 @@ public function getTriggerStates() } /** * Implements {@link aCssParserPlugin::parse()}. - * + * * @param integer $index Current index * @param string $char Current char * @param string $previousChar Previous char diff --git a/admin/includes/class-wc-csv-exporter.php b/admin/includes/class-wc-csv-exporter.php index d97f050777861..8a974c0b1a1f4 100644 --- a/admin/includes/class-wc-csv-exporter.php +++ b/admin/includes/class-wc-csv-exporter.php @@ -10,23 +10,23 @@ * @package WooCommerce/Classes * @author WooThemes */ - + if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class WC_CSV_Exporter { - + /** * @var mixed * @access private */ private $_csv = ''; - + /** * @var string * @access private */ private $_filename = ''; - + /** * @var string * @access private @@ -35,80 +35,80 @@ class WC_CSV_Exporter { /** * __construct function. - * + * * @access public * @param bool $output (default: true) - * @param mixed $filename + * @param mixed $filename * @return void */ function __construct( $columns = array(), $output = true, $filename = '' ) { $this->_csv = ''; $this->_filename = $filename ? $filename : 'export.csv'; - + if ( $this->_output = $output ) $this->start(); - + if ( $columns ) $this->set_columns( $columns ); } - + function set_filename( $filename ) { $this->_filename = $filename ? $filename : 'export.csv'; } - + /** * set_columns function. - * + * * @access public * @return void */ function set_columns( $columns = array() ) { - $this->add_row( $columns ); + $this->add_row( $columns ); unset( $columns ); } - + /** * add_row function. - * + * * @access public * @return void */ function add_row( $row ) { - + $row = implode( ',', array_map( array( &$this, 'wrap_column' ), $row ) ) . "\n"; - - if ( $this->_output ) + + if ( $this->_output ) fwrite( $this->_csv, $row ); else $this->_csv += $row; - + unset( $row ); } - + /** * start function. - * + * * @access public * @return void */ function start() { if ( headers_sent() ) wp_die( 'Headers already sent' ); - + @set_time_limit(0); @ob_clean(); - + header( "Content-Type: text/csv; charset=UTF-8" ); header( "Content-Disposition: attachment; filename={$this->_filename}" ); header( "Pragma: no-cache" ); header( "Expires: 0" ); - + $this->_csv = fopen( 'php://output', 'w') ; } - + /** * end function. - * + * * @access public * @return void */ @@ -116,10 +116,10 @@ function end() { fclose( $this->_csv ); exit; } - + /** * wrap_column function. - * + * * @access public * @param mixed $data * @return void @@ -127,5 +127,5 @@ function end() { function wrap_column( $data ) { return '"' . str_replace( '"', '""', $data ) . '"'; } - + } \ No newline at end of file diff --git a/admin/includes/notice-install.php b/admin/includes/notice-install.php index ec5a25afb7989..41989954d386c 100644 --- a/admin/includes/notice-install.php +++ b/admin/includes/notice-install.php @@ -1,5 +1,5 @@ -
diff --git a/admin/includes/notice-installed.php b/admin/includes/notice-installed.php index 70e184451f292..c3d4117342bfc 100644 --- a/admin/includes/notice-installed.php +++ b/admin/includes/notice-installed.php @@ -1,5 +1,5 @@ -
diff --git a/admin/includes/notice-update.php b/admin/includes/notice-update.php index 4f2f849b354c3..04f50d532029a 100644 --- a/admin/includes/notice-update.php +++ b/admin/includes/notice-update.php @@ -1,5 +1,5 @@ -
diff --git a/admin/includes/notice-updated.php b/admin/includes/notice-updated.php index 79ebfd0bdf370..00ce0ed5fb7d3 100644 --- a/admin/includes/notice-updated.php +++ b/admin/includes/notice-updated.php @@ -1,5 +1,5 @@ -
diff --git a/admin/includes/updates/woocommerce-update-1.7.php b/admin/includes/updates/woocommerce-update-1.7.php index 811a20b001256..a45144ceab063 100644 --- a/admin/includes/updates/woocommerce-update-1.7.php +++ b/admin/includes/updates/woocommerce-update-1.7.php @@ -16,21 +16,21 @@ $existing_file_paths = $wpdb->get_results( "SELECT * FROM ". $wpdb->postmeta . " WHERE meta_key = '_file_path'" ); if ( $existing_file_paths ) { - + foreach( $existing_file_paths as $existing_file_path ) { - + $existing_file_path->meta_value = trim( $existing_file_path->meta_value ); - - if ( $existing_file_path->meta_value ) + + if ( $existing_file_path->meta_value ) $file_paths = maybe_serialize( array( md5( $existing_file_path->meta_value ) => $existing_file_path->meta_value ) ); - else + else $file_paths = ''; - + $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_file_paths', meta_value = %s WHERE meta_id = %d", $file_paths, $existing_file_path->meta_id ) ); - + $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->prefix . "woocommerce_downloadable_product_permissions SET download_id = %s WHERE product_id = %d", md5( $existing_file_path->meta_value ), $existing_file_path->post_id ) ); } - + } // Update table primary keys @@ -45,11 +45,11 @@ if ( empty( $permalinks ) && $shop_page_id > 0 ) { $base_slug = $shop_page_id > 0 && get_page( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop'; - + $category_base = get_option('woocommerce_prepend_shop_page_to_urls') == "yes" ? trailingslashit( $base_slug ) : ''; $category_slug = get_option('woocommerce_product_category_slug') ? get_option('woocommerce_product_category_slug') : _x( 'product-category', 'slug', 'woocommerce' ); $tag_slug = get_option('woocommerce_product_tag_slug') ? get_option('woocommerce_product_tag_slug') : _x( 'product-tag', 'slug', 'woocommerce' ); - + if ( 'yes' == get_option('woocommerce_prepend_shop_page_to_products') ) { $product_base = trailingslashit( $base_slug ); } else { @@ -59,8 +59,8 @@ $product_base = trailingslashit( _x('product', 'slug', 'woocommerce') ); } } - - if ( get_option('woocommerce_prepend_category_to_products') == 'yes' ) + + if ( get_option('woocommerce_prepend_category_to_products') == 'yes' ) $product_base .= trailingslashit('%product_cat%'); $permalinks = array( @@ -69,8 +69,8 @@ 'attribute_base' => untrailingslashit( $category_base ), 'tag_base' => untrailingslashit( $category_base . $tag_slug ) ); - - update_option( 'woocommerce_permalinks', $permalinks ); + + update_option( 'woocommerce_permalinks', $permalinks ); } // Update subcat display settings @@ -98,28 +98,28 @@ " ); foreach ( $order_item_rows as $order_item_row ) { - + $order_items = (array) maybe_unserialize( $order_item_row->meta_value ); - + foreach ( $order_items as $order_item ) { - + if ( ! isset( $order_item['line_total'] ) && isset( $order_item['taxrate'] ) && isset( $order_item['cost'] ) ) { $order_item['line_tax'] = number_format( ( $order_item['cost'] * $order_item['qty'] ) * ( $order_item['taxrate'] / 100 ), 2, '.', '' ); $order_item['line_total'] = $order_item['cost'] * $order_item['qty']; $order_item['line_subtotal_tax'] = $order_item['line_tax']; $order_item['line_subtotal'] = $order_item['line_total']; } - + $order_item['line_tax'] = isset( $order_item['line_tax'] ) ? $order_item['line_tax'] : 0; $order_item['line_total'] = isset( $order_item['line_total'] ) ? $order_item['line_total'] : 0; $order_item['line_subtotal_tax'] = isset( $order_item['line_subtotal_tax'] ) ? $order_item['line_subtotal_tax'] : 0; $order_item['line_subtotal'] = isset( $order_item['line_subtotal'] ) ? $order_item['line_subtotal'] : 0; - + $item_id = woocommerce_add_order_item( $order_item_row->post_id, array( 'order_item_name' => $order_item['name'], 'order_item_type' => 'line_item' ) ); - + // Add line item meta if ( $item_id ) { woocommerce_add_order_item_meta( $item_id, '_qty', absint( $order_item['qty'] ) ); @@ -130,9 +130,9 @@ woocommerce_add_order_item_meta( $item_id, '_line_subtotal_tax', woocommerce_format_decimal( $order_item['line_subtotal_tax'] ) ); woocommerce_add_order_item_meta( $item_id, '_line_total', woocommerce_format_decimal( $order_item['line_total'] ) ); woocommerce_add_order_item_meta( $item_id, '_line_tax', woocommerce_format_decimal( $order_item['line_tax'] ) ); - + $meta_rows = array(); - + // Insert meta if ( ! empty( $order_item['item_meta'] ) ) { foreach ( $order_item['item_meta'] as $key => $meta ) { @@ -144,7 +144,7 @@ } } } - + // Insert meta rows at once if ( sizeof( $meta_rows ) > 0 ) { $wpdb->query( $wpdb->prepare( " @@ -152,7 +152,7 @@ VALUES " . implode( ',', $meta_rows ) . "; ", $order_item_row->post_id ) ); } - + // Delete from DB (rename) $wpdb->query( $wpdb->prepare( " UPDATE {$wpdb->postmeta} @@ -161,7 +161,7 @@ AND post_id = %d ", $order_item_row->post_id ) ); } - + unset( $meta_rows, $item_id, $order_item ); } } @@ -174,27 +174,27 @@ " ); foreach ( $order_tax_rows as $order_tax_row ) { - + $order_taxes = (array) maybe_unserialize( $order_tax_row->meta_value ); - + if ( $order_taxes ) { foreach( $order_taxes as $order_tax ) { - + if ( ! isset( $order_tax['label'] ) || ! isset( $order_tax['cart_tax'] ) || ! isset( $order_tax['shipping_tax'] ) ) continue; - + $item_id = woocommerce_add_order_item( $order_tax_row->post_id, array( 'order_item_name' => $order_tax['label'], 'order_item_type' => 'tax' ) ); - + // Add line item meta if ( $item_id ) { woocommerce_add_order_item_meta( $item_id, 'compound', absint( isset( $order_tax['compound'] ) ? $order_tax['compound'] : 0 ) ); woocommerce_add_order_item_meta( $item_id, 'tax_amount', woocommerce_clean( $order_tax['cart_tax'] ) ); woocommerce_add_order_item_meta( $item_id, 'shipping_tax_amount', woocommerce_clean( $order_tax['shipping_tax'] ) ); } - + // Delete from DB (rename) $wpdb->query( $wpdb->prepare( " UPDATE {$wpdb->postmeta} @@ -202,7 +202,7 @@ WHERE meta_key = '_order_taxes' AND post_id = %d ", $order_tax_row->post_id ) ); - + unset( $tax_amount ); } } diff --git a/admin/post-types/product.php b/admin/post-types/product.php index 4c3139912dc02..b1de7ee125da9 100644 --- a/admin/post-types/product.php +++ b/admin/post-types/product.php @@ -78,7 +78,7 @@ function woocommerce_edit_product_columns( $columns ) { if ( empty( $columns ) && ! is_array( $columns ) ) $columns = array(); - + unset( $columns['title'], $columns['comments'], $columns['date'] ); $columns["cb"] = ""; @@ -1010,34 +1010,34 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { update_post_meta( $post_id, '_weight', esc_html( stripslashes( $_REQUEST['_weight'] ) ) ); if ( ! empty( $_REQUEST['change_dimensions'] ) ) { - if ( isset( $_REQUEST['_length'] ) ) + if ( isset( $_REQUEST['_length'] ) ) update_post_meta( $post_id, '_length', esc_html( stripslashes( $_REQUEST['_length'] ) ) ); - if ( isset( $_REQUEST['_width'] ) ) + if ( isset( $_REQUEST['_width'] ) ) update_post_meta( $post_id, '_width', esc_html( stripslashes( $_REQUEST['_width'] ) ) ); - if ( isset( $_REQUEST['_height'] ) ) + if ( isset( $_REQUEST['_height'] ) ) update_post_meta( $post_id, '_height', esc_html( stripslashes( $_REQUEST['_height'] ) ) ); } - if ( ! empty( $_REQUEST['_stock_status'] ) ) + if ( ! empty( $_REQUEST['_stock_status'] ) ) update_post_meta( $post_id, '_stock_status', stripslashes( $_REQUEST['_stock_status'] ) ); - if ( ! empty( $_REQUEST['_visibility'] ) ) + if ( ! empty( $_REQUEST['_visibility'] ) ) update_post_meta( $post_id, '_visibility', stripslashes( $_REQUEST['_visibility'] ) ); - if ( ! empty( $_REQUEST['_featured'] ) ) + if ( ! empty( $_REQUEST['_featured'] ) ) update_post_meta( $post_id, '_featured', stripslashes( $_REQUEST['_featured'] ) ); // Handle price - remove dates and set to lowest if ( $product->is_type( 'simple' ) || $product->is_type( 'external' ) ) { $price_changed = false; - + if ( ! empty( $_REQUEST['change_regular_price'] ) ) { - + $old_price = $product->regular_price; $change_regular_price = absint( $_REQUEST['change_regular_price'] ); $regular_price = esc_attr( stripslashes( $_REQUEST['_regular_price'] ) ); - + switch ( $change_regular_price ) { case 1 : $new_price = $regular_price; @@ -1050,7 +1050,7 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { $new_price = $old_price + $regular_price; } break; - case 3 : + case 3 : if ( strstr( $regular_price, '%' ) ) { $percent = str_replace( '%', '', $regular_price ) / 100; $new_price = $old_price - ( $old_price * $percent ); @@ -1059,20 +1059,20 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { } break; } - + if ( isset( $new_price ) && $new_price != $product->regular_price ) { $price_changed = true; update_post_meta( $post_id, '_regular_price', $new_price ); $product->regular_price = $new_price; } } - + if ( ! empty( $_REQUEST['change_sale_price'] ) ) { - + $old_price = $product->sale_price; $change_sale_price = absint( $_REQUEST['change_sale_price'] ); $sale_price = esc_attr( stripslashes( $_REQUEST['_sale_price'] ) ); - + switch ( $change_sale_price ) { case 1 : $new_price = $sale_price; @@ -1085,7 +1085,7 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { $new_price = $old_price + $sale_price; } break; - case 3 : + case 3 : if ( strstr( $sale_price, '%' ) ) { $percent = str_replace( '%', '', $sale_price ) / 100; $new_price = $old_price - ( $old_price * $percent ); @@ -1093,7 +1093,7 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { $new_price = $old_price - $sale_price; } break; - case 4 : + case 4 : if ( strstr( $sale_price, '%' ) ) { $percent = str_replace( '%', '', $sale_price ) / 100; $new_price = $product->regular_price - ( $product->regular_price * $percent ); @@ -1102,18 +1102,18 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { } break; } - + if ( isset( $new_price ) && $new_price != $product->sale_price ) { $price_changed = true; update_post_meta( $post_id, '_sale_price', $new_price ); $product->sale_price = $new_price; } } - + if ( $price_changed ) { update_post_meta( $post_id, '_sale_price_dates_from', '' ); update_post_meta( $post_id, '_sale_price_dates_to', '' ); - + if ( $product->regular_price < $product->sale_price ) { $product->sale_price = ''; update_post_meta( $post_id, '_sale_price', '' ); @@ -1129,22 +1129,22 @@ function woocommerce_admin_product_bulk_edit_save( $post_id, $post ) { // Handle stock if ( ! $product->is_type( 'grouped' ) ) { - + if ( ! empty( $_REQUEST['change_stock'] ) ) { update_post_meta( $post_id, '_stock', (int) $_REQUEST['_stock'] ); - update_post_meta( $post_id, '_manage_stock', 'yes' ); + update_post_meta( $post_id, '_manage_stock', 'yes' ); } - + if ( ! empty( $_REQUEST['_manage_stock'] ) ) { if ( $_REQUEST['_manage_stock'] == 'yes' ) { - update_post_meta( $post_id, '_manage_stock', 'yes' ); + update_post_meta( $post_id, '_manage_stock', 'yes' ); } else { update_post_meta( $post_id, '_manage_stock', 'no' ); update_post_meta( $post_id, '_stock', '0' ); } } - + } // Clear transient @@ -1181,18 +1181,18 @@ function woocommerce_default_sorting_link( $views ) { /** * woocommerce_disable_checked_ontop function. - * + * * @access public * @param mixed $args * @param mixed $post_id * @return void */ function woocommerce_disable_checked_ontop( $args ) { - + if ( $args['taxonomy'] == 'product_cat' ) { $args['checked_ontop'] = false; } - + return $args; } diff --git a/admin/post-types/shop_coupon.php b/admin/post-types/shop_coupon.php index 534c6f4b507b5..704fb9ad46dc5 100644 --- a/admin/post-types/shop_coupon.php +++ b/admin/post-types/shop_coupon.php @@ -56,34 +56,34 @@ function woocommerce_custom_coupon_columns( $column ) { case "products" : $product_ids = get_post_meta( $post->ID, 'product_ids', true ); $product_ids = $product_ids ? array_map( 'absint', explode( ',', $product_ids ) ) : array(); - if ( sizeof( $product_ids ) > 0 ) - echo esc_html( implode( ', ', $product_ids ) ); - else + if ( sizeof( $product_ids ) > 0 ) + echo esc_html( implode( ', ', $product_ids ) ); + else echo '–'; break; case "usage_limit" : $usage_limit = get_post_meta( $post->ID, 'usage_limit', true ); - - if ( $usage_limit ) - echo esc_html( $usage_limit ); - else + + if ( $usage_limit ) + echo esc_html( $usage_limit ); + else echo '–'; break; case "usage" : $usage_count = absint( get_post_meta( $post->ID, 'usage_count', true ) ); $usage_limit = esc_html( get_post_meta($post->ID, 'usage_limit', true) ); - - if ( $usage_limit ) + + if ( $usage_limit ) printf( __( '%s / %s', 'woocommerce' ), $usage_count, $usage_limit ); else printf( __( '%s / ∞', 'woocommerce' ), $usage_count ); break; case "expiry_date" : $expiry_date = get_post_meta($post->ID, 'expiry_date', true); - - if ( $expiry_date ) - echo esc_html( date_i18n( 'F j, Y', strtotime( $expiry_date ) ) ); - else + + if ( $expiry_date ) + echo esc_html( date_i18n( 'F j, Y', strtotime( $expiry_date ) ) ); + else echo '–'; break; case "description" : diff --git a/admin/post-types/shop_order.php b/admin/post-types/shop_order.php index 0aa1f7e8f92da..6b6f1cd516875 100644 --- a/admin/post-types/shop_order.php +++ b/admin/post-types/shop_order.php @@ -76,16 +76,16 @@ function woocommerce_custom_order_columns( $column ) { break; case "order_title" : - if ( $order->user_id ) + if ( $order->user_id ) $user_info = get_userdata( $order->user_id ); if ( ! empty( $user_info ) ) { $user = ''; - if ( $user_info->first_name || $user_info->last_name ) + if ( $user_info->first_name || $user_info->last_name ) $user .= esc_html( $user_info->first_name . ' ' . $user_info->last_name ); - else + else $user .= esc_html( $user_info->display_name ); $user .= ''; @@ -98,7 +98,7 @@ function woocommerce_custom_order_columns( $column ) { if ( $order->billing_email ) echo '' . __( 'Email:', 'woocommerce' ) . ' ' . '' . esc_html( $order->billing_email ) . ''; - + if ( $order->billing_phone ) echo '' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $order->billing_phone ) . ''; @@ -394,7 +394,7 @@ function woocommerce_custom_shop_order_sort( $columns ) { */ function woocommerce_custom_shop_order_orderby( $vars ) { global $typenow, $wp_query; - if ( $typenow != 'shop_order' ) + if ( $typenow != 'shop_order' ) return $vars; // Sorting @@ -443,9 +443,9 @@ function woocommerce_shop_order_search_custom_fields( $wp ) { ) ) ); // Query matching custom fields - this seems faster than meta_query - $post_ids = $wpdb->get_col( - $wpdb->prepare( - "SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN ('" . implode( "','", $search_fields ) . "') AND meta_value LIKE '%%%s%%'", esc_attr( $_GET['s'] ) + $post_ids = $wpdb->get_col( + $wpdb->prepare( + "SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN ('" . implode( "','", $search_fields ) . "') AND meta_value LIKE '%%%s%%'", esc_attr( $_GET['s'] ) ) ); @@ -473,7 +473,7 @@ function woocommerce_shop_order_search_custom_fields( $wp ) { // Add ID $search_order_id = str_replace( 'Order #', '', $_GET['s'] ); - if ( is_numeric( $search_order_id ) ) + if ( is_numeric( $search_order_id ) ) $post_ids[] = $search_order_id; // Add blank ID so not all results are returned if the search finds nothing diff --git a/admin/post-types/writepanels/order-download-permission-html.php b/admin/post-types/writepanels/order-download-permission-html.php index 867aa9bec151b..59971b865b6fd 100644 --- a/admin/post-types/writepanels/order-download-permission-html.php +++ b/admin/post-types/writepanels/order-download-permission-html.php @@ -1,4 +1,4 @@ -
diff --git a/admin/post-types/writepanels/order-fee-html.php b/admin/post-types/writepanels/order-fee-html.php index 4021eb285c807..cc5954b485d41 100644 --- a/admin/post-types/writepanels/order-fee-html.php +++ b/admin/post-types/writepanels/order-fee-html.php @@ -1,16 +1,16 @@ - - + - + - + get_image(); ?> get_sku() ) echo esc_html( $_product->get_sku() ) . ' – '; ?> - + - + variation_data ) ) + if ( isset( $_product->variation_data ) ) echo '
' . woocommerce_get_formatted_variation( $_product->variation_data, true ); ?> @@ -37,9 +37,9 @@ has_meta( $item_id )) { foreach ( $metadata as $meta ) { - + // Skip hidden core fields - if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array( + if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array( '_qty', '_tax_class', '_product_id', @@ -49,7 +49,7 @@ '_line_total', '_line_tax' ) ) ) ) continue; - + // Handle serialised fields if ( is_serialized( $meta['meta_value'] ) ) { if ( is_serialized_string( $meta['meta_value'] ) ) { @@ -62,8 +62,8 @@ $meta['meta_key'] = esc_attr( $meta['meta_key'] ); $meta['meta_value'] = esc_textarea( $meta['meta_value'] ); // using a + diff --git a/admin/post-types/writepanels/writepanel-coupon_data.php b/admin/post-types/writepanels/writepanel-coupon_data.php index 107cd2e1e11e9..a6e781a5d8189 100644 --- a/admin/post-types/writepanels/writepanel-coupon_data.php +++ b/admin/post-types/writepanels/writepanel-coupon_data.php @@ -35,9 +35,9 @@ function woocommerce_coupon_data_meta_box( $post ) { // Description woocommerce_wp_text_input( array( 'id' => 'coupon_description', 'label' => __( 'Coupon description', 'woocommerce' ), 'description' => __( 'Optionally enter a description for this coupon for your reference.', 'woocommerce' ), 'value' => $post->post_excerpt, 'name' => 'excerpt' ) ); - + echo '
'; - + // Type woocommerce_wp_select( array( 'id' => 'discount_type', 'label' => __( 'Discount type', 'woocommerce' ), 'options' => $woocommerce->get_coupon_discount_types() ) ); @@ -46,7 +46,7 @@ function woocommerce_coupon_data_meta_box( $post ) { 'step' => 'any', 'min' => '0' ) ) ); - + // Free Shipping woocommerce_wp_checkbox( array( 'id' => 'free_shipping', 'label' => __( 'Enable free shipping', 'woocommerce' ), 'description' => sprintf(__( 'Check this box if the coupon grants free shipping. The free shipping method must be enabled with the "must use coupon" setting checked.', 'woocommerce' ), admin_url('admin.php?page=woocommerce_settings&tab=shipping§ion=WC_Free_Shipping')) ) ); @@ -55,7 +55,7 @@ function woocommerce_coupon_data_meta_box( $post ) { // Apply before tax woocommerce_wp_checkbox( array( 'id' => 'apply_before_tax', 'label' => __( 'Apply before tax', 'woocommerce' ), 'description' => __( 'Check this box if the coupon should be applied before calculating cart tax.', 'woocommerce' ) ) ); - + echo '
'; // minimum spend @@ -78,10 +78,10 @@ function woocommerce_coupon_data_meta_box( $post ) { $title = get_the_title( $product_id ); $sku = get_post_meta( $product_id, '_sku', true ); - if ( ! $title ) + if ( ! $title ) continue; - if ( ! empty( $sku ) ) + if ( ! empty( $sku ) ) $sku = ' (SKU: ' . $sku . ')'; echo ''; @@ -103,10 +103,10 @@ function woocommerce_coupon_data_meta_box( $post ) { $title = get_the_title( $product_id ); $sku = get_post_meta( $product_id, '_sku', true ); - if ( ! $title ) + if ( ! $title ) continue; - if ( ! empty( $sku ) ) + if ( ! empty( $sku ) ) $sku = ' (SKU: ' . $sku . ')'; echo ''; @@ -183,11 +183,11 @@ function woocommerce_coupon_data_meta_box( $post ) { */ function woocommerce_process_shop_coupon_meta( $post_id, $post ) { global $wpdb, $woocommerce_errors; - + // Ensure coupon code is correctly formatted $post->post_title = apply_filters( 'woocommerce_coupon_code', $post->post_title ); $wpdb->update( $wpdb->posts, array( 'post_title' => $post->post_title ), array( 'ID' => $post_id ) ); - + // Check for dupe coupons $coupon_found = $wpdb->get_var( $wpdb->prepare( " SELECT $wpdb->posts.ID @@ -197,7 +197,7 @@ function woocommerce_process_shop_coupon_meta( $post_id, $post ) { AND $wpdb->posts.post_title = '%s' AND $wpdb->posts.ID != %s ", $post->post_title, $post_id ) ); - + if ( $coupon_found ) $woocommerce_errors[] = __( 'Coupon code already exists - customers will use the latest coupon with this code.', 'woocommerce' ); diff --git a/admin/post-types/writepanels/writepanel-order_data.php b/admin/post-types/writepanels/writepanel-order_data.php index 7bb156c1f666b..b2d6261232359 100644 --- a/admin/post-types/writepanels/writepanel-order_data.php +++ b/admin/post-types/writepanels/writepanel-order_data.php @@ -23,7 +23,7 @@ function woocommerce_order_data_meta_box($post) { global $post, $wpdb, $thepostid, $theorder, $order_status, $woocommerce; $thepostid = absint( $post->ID ); - + if ( ! is_object( $theorder ) ) $theorder = new WC_Order( $thepostid ); @@ -176,16 +176,16 @@ function woocommerce_order_data_meta_box($post) { // Display values echo '
'; - if ( $order->get_formatted_billing_address() ) - echo '

' . __( 'Address', 'woocommerce' ) . ':
' . $order->get_formatted_billing_address() . '

'; - else + if ( $order->get_formatted_billing_address() ) + echo '

' . __( 'Address', 'woocommerce' ) . ':
' . $order->get_formatted_billing_address() . '

'; + else echo '

' . __( 'Address', 'woocommerce' ) . ': ' . __( 'No billing address set.', 'woocommerce' ) . '

'; - foreach ( $billing_data as $key => $field ) { - if ( empty( $field['show'] ) ) + foreach ( $billing_data as $key => $field ) { + if ( empty( $field['show'] ) ) continue; $field_name = 'billing_' . $key; - if ( $order->$field_name ) + if ( $order->$field_name ) echo '

' . esc_html( $field['label'] ) . ': ' . esc_html( $order->$field_name ) . '

'; } @@ -195,7 +195,7 @@ function woocommerce_order_data_meta_box($post) { echo '

'; foreach ( $billing_data as $key => $field ) { - if ( ! isset( $field['type'] ) ) + if ( ! isset( $field['type'] ) ) $field['type'] = 'text'; switch ( $field['type'] ) { case "select" : @@ -260,16 +260,16 @@ function woocommerce_order_data_meta_box($post) { // Display values echo '
'; - if ( $order->get_formatted_shipping_address() ) - echo '

' . __( 'Address', 'woocommerce' ) . ':
' . $order->get_formatted_shipping_address() . '

'; - else + if ( $order->get_formatted_shipping_address() ) + echo '

' . __( 'Address', 'woocommerce' ) . ':
' . $order->get_formatted_shipping_address() . '

'; + else echo '

' . __( 'Address', 'woocommerce' ) . ': ' . __( 'No shipping address set.', 'woocommerce' ) . '

'; - if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) { - if ( empty( $field['show'] ) ) + if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) { + if ( empty( $field['show'] ) ) continue; $field_name = 'shipping_' . $key; - if ( $order->$field_name ) + if ( $order->$field_name ) echo '

' . esc_html( $field['label'] ) . ': ' . esc_html( $order->$field_name ) . '

'; } @@ -279,7 +279,7 @@ function woocommerce_order_data_meta_box($post) { echo '

'; if ( $shipping_data ) foreach ( $shipping_data as $key => $field ) { - if ( ! isset( $field['type'] ) ) + if ( ! isset( $field['type'] ) ) $field['type'] = 'text'; switch ( $field['type'] ) { case "select" : @@ -315,7 +315,7 @@ function woocommerce_order_items_meta_box( $post ) { $theorder = new WC_Order( $thepostid ); $order = $theorder; - + $data = get_post_custom( $post->ID ); ?>
@@ -324,7 +324,7 @@ function woocommerce_order_items_meta_box( $post ) {
- + @@ -339,29 +339,29 @@ function woocommerce_order_items_meta_box( $post ) { get_items( array( 'line_item', 'fee' ) ); - + foreach ( $order_items as $item_id => $item ) { - + switch ( $item['type'] ) { case 'line_item' : $_product = $order->get_product_from_item( $item ); $item_meta = $order->get_item_meta( $item_id ); - + include( 'order-item-html.php' ); break; - case 'fee' : + case 'fee' : include( 'order-fee-html.php' ); break; } - + } ?>
 [?]
- +

- +

@@ -456,9 +456,9 @@ function woocommerce_order_actions_meta_box($post) { else $delete_text = __( 'Move to Trash', 'woocommerce' ); ?>
- + @@ -475,10 +475,10 @@ function woocommerce_order_actions_meta_box($post) { */ function woocommerce_order_totals_meta_box( $post ) { global $woocommerce, $theorder; - + if ( ! is_object( $theorder ) ) $theorder = new WC_Order( $post->ID ); - + $order = $theorder; $data = get_post_custom( $post->ID ); @@ -490,7 +490,7 @@ function woocommerce_order_totals_meta_box( $post ) {
  • @@ -498,7 +498,7 @@ function woocommerce_order_totals_meta_box( $post ) {
  • @@ -509,19 +509,19 @@ function woocommerce_order_totals_meta_box( $post ) {

      - +
    • -
    • - +
    • -
    • @@ -574,7 +574,7 @@ function woocommerce_order_totals_meta_box( $post ) {
    • @@ -582,7 +582,7 @@ function woocommerce_order_totals_meta_box( $post ) {
    • @@ -597,7 +597,7 @@ function woocommerce_order_totals_meta_box( $post ) {
    • @@ -733,95 +733,95 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) { // Tax rows if ( isset( $_POST['order_taxes_id'] ) ) { - + $get_values = array( 'order_taxes_id', 'order_taxes_label', 'order_taxes_compound', 'order_taxes_amount', 'order_taxes_shipping_amount' ); foreach( $get_values as $value ) $$value = isset( $_POST[ $value ] ) ? $_POST[ $value ] : array(); foreach( $order_taxes_id as $item_id ) { - + $item_id = absint( $item_id ); - if ( ! $order_taxes_label[ $item_id ] ) + if ( ! $order_taxes_label[ $item_id ] ) $order_taxes_label[ $item_id ] = $woocommerce->countries->tax_or_vat(); if ( isset( $order_taxes_label[ $item_id ] ) ) - $wpdb->update( - $wpdb->prefix . "woocommerce_order_items", - array( 'order_item_name' => woocommerce_clean( $order_taxes_label[ $item_id ] ) ), - array( 'order_item_id' => $item_id ), - array( '%s' ), - array( '%d' ) + $wpdb->update( + $wpdb->prefix . "woocommerce_order_items", + array( 'order_item_name' => woocommerce_clean( $order_taxes_label[ $item_id ] ) ), + array( 'order_item_id' => $item_id ), + array( '%s' ), + array( '%d' ) ); - + if ( isset( $order_taxes_compound[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, 'compound', isset( $order_taxes_compound[ $item_id ] ) ? 1 : 0 ); - + if ( isset( $order_taxes_amount[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, 'tax_amount', woocommerce_clean( $order_taxes_amount[ $item_id ] ) ); - + if ( isset( $order_taxes_shipping_amount[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, 'shipping_tax_amount', woocommerce_clean( $order_taxes_shipping_amount[ $item_id ] ) ); } } - + // Order items + fees if ( isset( $_POST['order_item_id'] ) ) { - + $get_values = array( 'order_item_id', 'order_item_name', 'order_item_qty', 'line_subtotal', 'line_subtotal_tax', 'line_total', 'line_tax', 'order_item_tax_class' ); - + foreach( $get_values as $value ) $$value = isset( $_POST[ $value ] ) ? $_POST[ $value ] : array(); foreach ( $order_item_id as $item_id ) { - + $item_id = absint( $item_id ); - + if ( isset( $order_item_name[ $item_id ] ) ) - $wpdb->update( - $wpdb->prefix . "woocommerce_order_items", - array( 'order_item_name' => woocommerce_clean( $order_item_name[ $item_id ] ) ), - array( 'order_item_id' => $item_id ), - array( '%s' ), - array( '%d' ) + $wpdb->update( + $wpdb->prefix . "woocommerce_order_items", + array( 'order_item_name' => woocommerce_clean( $order_item_name[ $item_id ] ) ), + array( 'order_item_id' => $item_id ), + array( '%s' ), + array( '%d' ) ); - + if ( isset( $order_item_qty[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_qty', apply_filters( 'woocommerce_stock_amount', $order_item_qty[ $item_id ] ) ); - + if ( isset( $item_tax_class[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_tax_class', woocommerce_clean( $item_tax_class[ $item_id ] ) ); - + if ( isset( $line_subtotal[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_line_subtotal', woocommerce_clean( $line_subtotal[ $item_id ] ) ); - + if ( isset( $line_subtotal_tax[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_line_subtotal_tax', woocommerce_clean( $line_subtotal_tax[ $item_id ] ) ); - + if ( isset( $line_total[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_line_total', woocommerce_clean( $line_total[ $item_id ] ) ); - + if ( isset( $line_tax[ $item_id ] ) ) woocommerce_update_order_item_meta( $item_id, '_line_tax', woocommerce_clean( $line_tax[ $item_id ] ) ); } } - + // Save meta $meta_keys = isset( $_POST['meta_key'] ) ? $_POST['meta_key'] : ''; $meta_values = isset( $_POST['meta_value'] ) ? $_POST['meta_value'] : ''; - + foreach ( $meta_keys as $id => $value ) { - $wpdb->update( - $wpdb->prefix . "woocommerce_order_itemmeta", - array( + $wpdb->update( + $wpdb->prefix . "woocommerce_order_itemmeta", + array( 'meta_key' => $value, 'meta_value' => empty( $meta_values[ $id ] ) ? '' : $meta_values[ $id ] - ), - array( 'meta_id' => $id ), - array( '%s', '%s' ), - array( '%d' ) + ), + array( 'meta_id' => $id ), + array( '%s', '%s' ), + array( '%d' ) ); } @@ -830,7 +830,7 @@ function woocommerce_process_shop_order_meta( $post_id, $post ) { // Order status $order->update_status( $_POST['order_status'] ); - + // Handle button actions if ( ! empty( $_POST['order_email'] ) ) { diff --git a/admin/post-types/writepanels/writepanel-order_downloads.php b/admin/post-types/writepanels/writepanel-order_downloads.php index a3967c3b910ec..e15ab0f7dfaaa 100644 --- a/admin/post-types/writepanels/writepanel-order_downloads.php +++ b/admin/post-types/writepanels/writepanel-order_downloads.php @@ -41,12 +41,12 @@ function woocommerce_order_downloads_meta_box() { } // don't show permissions to files that have since been removed - if ( ! $product->exists() || ! $product->has_file( $download->download_id ) ) + if ( ! $product->exists() || ! $product->has_file( $download->download_id ) ) continue; - + $loop++; $file_count++; - + include( 'order-download-permission-html.php' ); } ?> @@ -77,7 +77,7 @@ function woocommerce_order_downloads_meta_box() { $sku = get_post_meta( $product->ID, '_sku', true ); - if ( $sku ) + if ( $sku ) $sku = ' SKU: ' . $sku; echo ''; @@ -123,9 +123,9 @@ function woocommerce_order_downloads_meta_box() { jQuery('.order_download_permissions .wc-metaboxes').append( response ); } else { - + alert(''); - + } jQuery( ".date-picker" ).datepicker({ @@ -215,7 +215,7 @@ function woocommerce_order_downloads_save( $post_id, $post ) { $customer_email = get_post_meta( $post->ID, '_billing_email', true ); $customer_user = get_post_meta( $post->ID, '_customer_user', true ); $product_ids_count = sizeof( $product_ids ); - + for ( $i = 0; $i < $product_ids_count; $i ++ ) { $data = array( @@ -239,8 +239,8 @@ function woocommerce_order_downloads_save( $post_id, $post ) { 'order_id' => $post_id, 'product_id' => absint( $product_ids[$i] ), 'download_id' => woocommerce_clean( $download_ids[$i] ) - ), - $format, array( '%d', '%d', '%s' ) + ), + $format, array( '%d', '%d', '%s' ) ); } diff --git a/admin/post-types/writepanels/writepanel-order_notes.php b/admin/post-types/writepanels/writepanel-order_notes.php index fc084b0cb4fab..fcee1b5227723 100644 --- a/admin/post-types/writepanels/writepanel-order_notes.php +++ b/admin/post-types/writepanels/writepanel-order_notes.php @@ -34,7 +34,7 @@ function woocommerce_order_notes_meta_box() { if ( $notes ) { foreach( $notes as $note ) { $note_classes = get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ? array( 'customer-note', 'note' ) : array( 'note' ); - + ?>
    • diff --git a/admin/post-types/writepanels/writepanel-product-type-variable.php b/admin/post-types/writepanels/writepanel-product-type-variable.php index b867bf13ba4b4..5474257d3266b 100644 --- a/admin/post-types/writepanels/writepanel-product-type-variable.php +++ b/admin/post-types/writepanels/writepanel-product-type-variable.php @@ -52,7 +52,7 @@ function variable_product_type_options() { $tax_class_options = array(); $tax_class_options['parent'] = __( 'Same as parent', 'woocommerce' ); $tax_class_options[''] = __( 'Standard', 'woocommerce' ); - if ( $tax_classes ) + if ( $tax_classes ) foreach ( $tax_classes as $class ) $tax_class_options[ sanitize_title( $class ) ] = esc_attr( $class ); ?> @@ -103,19 +103,19 @@ function variable_product_type_options() { 'height' => get_post_meta( $post->ID, '_height', true ), 'tax_class' => get_post_meta( $post->ID, '_tax_class', true ) ); - + if ( ! $parent_data['weight'] ) $parent_data['weight'] = '0.00'; - + if ( ! $parent_data['length'] ) $parent_data['length'] = '0'; - + if ( ! $parent_data['width'] ) $parent_data['width'] = '0'; - + if ( ! $parent_data['height'] ) $parent_data['height'] = '0'; - + // Get variations $args = array( 'post_type' => 'product_variation', @@ -128,19 +128,19 @@ function variable_product_type_options() { $variations = get_posts( $args ); $loop = 0; if ( $variations ) foreach ( $variations as $variation ) { - + $variation_id = absint( $variation->ID ); $variation_post_status = esc_attr( $variation->post_status ); $variation_data = get_post_custom( $variation_id ); $variation_data['variation_post_id'] = $variation_id; - + // Grab shipping classes $shipping_classes = get_the_terms( $variation_id, 'product_shipping_class' ); $shipping_class = ( $shipping_classes && ! is_wp_error( $shipping_classes ) ) ? current( $shipping_classes )->term_id : ''; - - $variation_fields = array( + + $variation_fields = array( '_sku', - '_stock', + '_stock', '_price', '_regular_price', '_sale_price', @@ -158,28 +158,28 @@ function variable_product_type_options() { '_sale_price_dates_from', '_sale_price_dates_to' ); - + foreach ( $variation_fields as $field ) $$field = isset( $variation_data[ $field ][0] ) ? $variation_data[ $field ][0] : ''; - + // Price backwards compat if ( $_regular_price == '' && $_price ) $_regular_price = $_price; - + // Get image $image = ''; $image_id = absint( $_thumbnail_id ); if ( $image_id ) $image = wp_get_attachment_url( $image_id ); - + // Format file paths $_file_paths = maybe_unserialize( $_file_paths ); - if ( is_array( $_file_paths ) ) + if ( is_array( $_file_paths ) ) $_file_paths = implode( "\n", $_file_paths ); - + include( 'variation-admin-html.php' ); - - $loop++; + + $loop++; } ?>
      @@ -196,7 +196,7 @@ function variable_product_type_options() { foreach ( $attributes as $attribute ) { // Only deal with attributes that are variations - if ( ! $attribute['is_variation'] ) + if ( ! $attribute['is_variation'] ) continue; // Get current value for variation (if set) @@ -235,9 +235,9 @@ function variable_product_type_options() { jQuery('#variable_product_options').on('click', 'button.add_variation', function(){ jQuery('.woocommerce_variations').block({ message: null, overlayCSS: { background: '#fff url(plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } }); - + var loop = jQuery('.woocommerce_variation').size(); - + var data = { action: 'woocommerce_add_variation', post_id: ID; ?>, @@ -248,7 +248,7 @@ function variable_product_type_options() { jQuery.post('', data, function(response) { jQuery('.woocommerce_variations').append( response ); - + jQuery(".tips").tipTip({ 'attribute' : 'data-tip', 'fadeIn' : 50, @@ -379,7 +379,7 @@ function variable_product_type_options() { jQuery('a.bulk_edit').click(function() { var field_to_edit = jQuery('select#field_to_edit').val(); var input_tag = jQuery('select#field_to_edit :selected').attr('rel') ? jQuery('select#field_to_edit :selected').attr('rel') : 'input'; - + var value = prompt(""); jQuery(input_tag + '[name^="' + field_to_edit + '"]').val( value ); return false; @@ -572,7 +572,7 @@ function process_product_meta_variable( $post_id ) { for ( $i = 0; $i <= $max_loop; $i ++ ) { - if ( ! isset( $variable_post_id[ $i ] ) ) + if ( ! isset( $variable_post_id[ $i ] ) ) continue; $variation_id = absint( $variable_post_id[ $i ] ); @@ -599,15 +599,15 @@ function process_product_meta_variable( $post_id ) { 'post_type' => 'product_variation', 'menu_order' => $variable_menu_order[ $i ] ); - + $variation_id = wp_insert_post( $variation ); - + do_action( 'woocommerce_create_product_variation', $variation_id ); } else { $wpdb->update( $wpdb->posts, array( 'post_status' => $post_status, 'post_title' => $variation_post_title, 'menu_order' => $variable_menu_order[ $i ] ), array( 'ID' => $variation_id ) ); - + do_action( 'woocommerce_update_product_variation', $variation_id ); } @@ -625,22 +625,22 @@ function process_product_meta_variable( $post_id ) { update_post_meta( $variation_id, '_virtual', woocommerce_clean( $is_virtual ) ); update_post_meta( $variation_id, '_downloadable', woocommerce_clean( $is_downloadable ) ); - + // Price handling $regular_price = woocommerce_clean( $variable_regular_price[ $i ] ); $sale_price = woocommerce_clean( $variable_sale_price[ $i ] ); $date_from = woocommerce_clean( $variable_sale_price_dates_from[ $i ] ); $date_to = woocommerce_clean( $variable_sale_price_dates_to[ $i ] ); - + update_post_meta( $variation_id, '_regular_price', $regular_price ); update_post_meta( $variation_id, '_sale_price', $sale_price ); - + // Save Dates if ( $date_from ) update_post_meta( $variation_id, '_sale_price_dates_from', strtotime( $date_from ) ); else update_post_meta( $variation_id, '_sale_price_dates_from', '' ); - + if ( $date_to ) update_post_meta( $variation_id, '_sale_price_dates_to', strtotime( $date_to ) ); else @@ -657,13 +657,13 @@ function process_product_meta_variable( $post_id ) { if ( $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) update_post_meta( $variation_id, '_price', $sale_price ); - + if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { update_post_meta( $variation_id, '_price', $regular_price ); update_post_meta( $variation_id, '_sale_price_dates_from', '' ); update_post_meta( $variation_id, '_sale_price_dates_to', '' ); } - + if ( $variable_tax_class[ $i ] !== 'parent' ) update_post_meta( $variation_id, '_tax_class', woocommerce_clean( $variable_tax_class[ $i ] ) ); else @@ -672,13 +672,13 @@ function process_product_meta_variable( $post_id ) { if ( $is_downloadable == 'yes' ) { update_post_meta( $variation_id, '_download_limit', woocommerce_clean( $variable_download_limit[ $i ] ) ); update_post_meta( $variation_id, '_download_expiry', woocommerce_clean( $variable_download_expiry[ $i ] ) ); - + $_file_paths = array(); $file_paths = str_replace( "\r\n", "\n", $variable_file_paths[ $i ] ); $file_paths = trim( preg_replace( "/\n+/", "\n", $file_paths ) ); if ( $file_paths ) { $file_paths = explode( "\n", $file_paths ); - + foreach ( $file_paths as $file_path ) { $file_path = woocommerce_clean( $file_path ); $_file_paths[ md5( $file_path ) ] = $file_path; @@ -700,7 +700,7 @@ function process_product_meta_variable( $post_id ) { wp_set_object_terms( $variation_id, $variable_shipping_class[ $i ], 'product_shipping_class'); // Remove old taxonomies attributes so data is kept up to date - if ( $variation_id ) + if ( $variation_id ) $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key LIKE %s AND post_id = %d;", 'attribute_%', $variation_id ) ); // Update taxonomies @@ -714,7 +714,7 @@ function process_product_meta_variable( $post_id ) { } } - + do_action( 'woocommerce_save_product_variation', $variation_id ); } @@ -740,20 +740,20 @@ function process_product_meta_variable( $post_id ) { $child_price = get_post_meta( $child, '_price', true ); $child_regular_price = get_post_meta( $child, '_regular_price', true ); $child_sale_price = get_post_meta( $child, '_sale_price', true ); - + // Regular prices - if ( ! is_numeric( $lowest_regular_price ) || $child_regular_price < $lowest_regular_price ) + if ( ! is_numeric( $lowest_regular_price ) || $child_regular_price < $lowest_regular_price ) $lowest_regular_price = $child_regular_price; - - if ( ! is_numeric( $highest_regular_price ) || $child_regular_price > $highest_regular_price ) + + if ( ! is_numeric( $highest_regular_price ) || $child_regular_price > $highest_regular_price ) $highest_regular_price = $child_regular_price; - + // Sale prices if ( $child_price == $child_sale_price ) { - if ( $child_sale_price !== '' && ( ! is_numeric( $lowest_sale_price ) || $child_sale_price < $lowest_sale_price ) ) + if ( $child_sale_price !== '' && ( ! is_numeric( $lowest_sale_price ) || $child_sale_price < $lowest_sale_price ) ) $lowest_sale_price = $child_sale_price; - - if ( $child_sale_price !== '' && ( ! is_numeric( $highest_sale_price ) || $child_sale_price > $highest_sale_price ) ) + + if ( $child_sale_price !== '' && ( ! is_numeric( $highest_sale_price ) || $child_sale_price > $highest_sale_price ) ) $highest_sale_price = $child_sale_price; } } diff --git a/admin/post-types/writepanels/writepanel-product_data.php b/admin/post-types/writepanels/writepanel-product_data.php index d7046e7e2ed0d..b679a67e075f6 100644 --- a/admin/post-types/writepanels/writepanel-product_data.php +++ b/admin/post-types/writepanels/writepanel-product_data.php @@ -9,7 +9,7 @@ * @package WooCommerce/Admin/WritePanels * @version 1.7.0 */ - + if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** Variable products */ @@ -69,9 +69,9 @@ function woocommerce_product_data_box() {
      - +
      - +
      '; - + echo '
      '; - + // Tax woocommerce_wp_select( array( 'id' => '_tax_status', 'label' => __( 'Tax Status', 'woocommerce' ), 'options' => array( 'taxable' => __( 'Taxable', 'woocommerce' ), 'shipping' => __( 'Shipping only', 'woocommerce' ), 'none' => __( 'None', 'woocommerce' ) ) ) ); - + $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) ); $classes_options = array(); $classes_options[''] = __( 'Standard', 'woocommerce' ); - if ( $tax_classes ) + if ( $tax_classes ) foreach ( $tax_classes as $class ) $classes_options[ sanitize_title( $class ) ] = esc_html( $class ); - + woocommerce_wp_select( array( 'id' => '_tax_class', 'label' => __( 'Tax Class', 'woocommerce' ), 'options' => $classes_options ) ); - + do_action( 'woocommerce_product_options_tax' ); - + echo '
      '; do_action( 'woocommerce_product_options_general_product_data' ); @@ -199,7 +199,7 @@ function woocommerce_product_data_box() {
      '; if (get_option('woocommerce_manage_stock')=='yes') { @@ -242,9 +242,9 @@ function woocommerce_product_data_box() { echo '
      '; } - + echo '
    '; - + echo '
    '; // Individual product @@ -259,11 +259,11 @@ function woocommerce_product_data_box() {
    - + '; - + // Weight if( get_option('woocommerce_enable_weight', true) !== 'no' ) : woocommerce_wp_text_input( array( 'id' => '_weight', 'label' => __( 'Weight', 'woocommerce' ) . ' ('.get_option('woocommerce_weight_unit').')', 'placeholder' => '0.00', 'description' => __( 'Weight in decimal form', 'woocommerce' ), 'type' => 'number', 'custom_attributes' => array( @@ -294,7 +294,7 @@ function woocommerce_product_data_box() { do_action( 'woocommerce_product_options_dimensions' ); echo '
    '; - + echo '
    '; // Shipping Class @@ -313,7 +313,7 @@ function woocommerce_product_data_box() { ?>

    '; ?> @@ -344,7 +344,7 @@ function woocommerce_product_data_box() { if ( ! taxonomy_exists( $attribute_taxonomy_name ) ) continue; // Get product data values for current taxonomy - this contains ordering and visibility data - if ( isset( $attributes[ $attribute_taxonomy_name ] ) ) + if ( isset( $attributes[ $attribute_taxonomy_name ] ) ) $attribute = $attributes[ $attribute_taxonomy_name ]; $position = empty( $attribute['position'] ) ? 0 : absint( $attribute['position'] ); @@ -487,14 +487,14 @@ function woocommerce_product_data_box() { } ?> - +

    - +
    - +

    ' src="plugin_url(); ?>/assets/images/help.png" />

    - +
    '; // List Grouped products @@ -563,7 +563,7 @@ function woocommerce_product_data_box() { if ( $grouped_products ) { foreach ( $grouped_products as $product ) { - if ( $product->ID == $post->ID ) + if ( $product->ID == $post->ID ) continue; $post_parents[ $product->ID ] = $product->post_title; @@ -572,14 +572,14 @@ function woocommerce_product_data_box() { } woocommerce_wp_select( array( 'id' => 'parent_id', 'label' => __( 'Grouping', 'woocommerce' ), 'value' => absint( $post->post_parent ), 'options' => $post_parents, 'desc_tip' => true, 'description' => __( 'Set this option to make this product part of a grouped product.', 'woocommerce' ) ) ); - + woocommerce_wp_hidden_input( array( 'id' => 'previous_parent_id', 'value' => absint( $post->post_parent ) ) ); do_action( 'woocommerce_product_options_grouping' ); echo '
    '; ?> - +
    @@ -616,7 +616,7 @@ function woocommerce_product_data_box() {
    - +
    @@ -650,7 +650,7 @@ function woocommerce_process_product_meta( $post_id, $post ) { // Set transient for product type set_transient( 'wc_product_type_' . $post_id, $product_type ); - + // Update post meta update_post_meta( $post_id, '_regular_price', stripslashes( $_POST['_regular_price'] ) ); update_post_meta( $post_id, '_sale_price', stripslashes( $_POST['_sale_price'] ) ); @@ -658,7 +658,7 @@ function woocommerce_process_product_meta( $post_id, $post ) { update_post_meta( $post_id, '_tax_class', stripslashes( $_POST['_tax_class'] ) ); update_post_meta( $post_id, '_visibility', stripslashes( $_POST['_visibility'] ) ); update_post_meta( $post_id, '_purchase_note', stripslashes( $_POST['_purchase_note'] ) ); - update_post_meta( $post_id, '_featured', isset( $_POST['_featured'] ) ? 'yes' : 'no' ); + update_post_meta( $post_id, '_featured', isset( $_POST['_featured'] ) ? 'yes' : 'no' ); // Dimensions if ( $is_virtual == 'no' ) { @@ -709,20 +709,20 @@ function woocommerce_process_product_meta( $post_id, $post ) { if ( isset( $_POST['attribute_names'] ) ) { $attribute_names = $_POST['attribute_names']; $attribute_values = $_POST['attribute_values']; - - if ( isset( $_POST['attribute_visibility'] ) ) + + if ( isset( $_POST['attribute_visibility'] ) ) $attribute_visibility = $_POST['attribute_visibility']; - - if ( isset( $_POST['attribute_variation'] ) ) + + if ( isset( $_POST['attribute_variation'] ) ) $attribute_variation = $_POST['attribute_variation']; - + $attribute_is_taxonomy = $_POST['attribute_is_taxonomy']; $attribute_position = $_POST['attribute_position']; $attribute_names_count = sizeof( $attribute_names ); for ( $i=0; $i < $attribute_names_count; $i++ ) { - if ( ! $attribute_names[ $i ] ) + if ( ! $attribute_names[ $i ] ) continue; $is_visible = isset( $attribute_visibility[ $i ] ) ? 1 : 0; @@ -800,17 +800,17 @@ function attributes_cmp( $a, $b ) { update_post_meta( $post_id, '_product_attributes', $attributes ); // Sales and prices - if ( in_array( $product_type, array( 'variable', 'grouped' ) ) ) { - + if ( in_array( $product_type, array( 'variable', 'grouped' ) ) ) { + // Variable and grouped products have no prices update_post_meta( $post_id, '_regular_price', '' ); update_post_meta( $post_id, '_sale_price', '' ); update_post_meta( $post_id, '_sale_price_dates_from', '' ); update_post_meta( $post_id, '_sale_price_dates_to', '' ); update_post_meta( $post_id, '_price', '' ); - + } else { - + $date_from = isset( $_POST['_sale_price_dates_from'] ) ? $_POST['_sale_price_dates_from'] : ''; $date_to = isset( $_POST['_sale_price_dates_to'] ) ? $_POST['_sale_price_dates_to'] : ''; @@ -846,21 +846,21 @@ function attributes_cmp( $a, $b ) { // Update parent if grouped so price sorting works and stays in sync with the cheapest child if ( $post->post_parent > 0 || $product_type == 'grouped' || $_POST['previous_parent_id'] > 0 ) { - + $clear_parent_ids = array(); - + if ( $post->post_parent > 0 ) $clear_parent_ids[] = $post->post_parent; - + if ( $product_type == 'grouped' ) $clear_parent_ids[] = $post_id; - + if ( $_POST['previous_parent_id'] > 0 ) $clear_parent_ids[] = absint( $_POST['previous_parent_id'] ); if ( $clear_parent_ids ) { foreach( $clear_parent_ids as $clear_id ) { - + $children_by_price = get_posts( array( 'post_parent' => $clear_id, 'orderby' => 'meta_value_num', @@ -876,7 +876,7 @@ function attributes_cmp( $a, $b ) { update_post_meta( $clear_id, '_price', $child_price ); } } - + // Clear cache/transients $woocommerce->clear_product_transients( $clear_id ); } @@ -889,7 +889,7 @@ function attributes_cmp( $a, $b ) { } else { update_post_meta( $post_id, '_sold_individually', '' ); } - + // Stock Data if ( get_option('woocommerce_manage_stock') == 'yes' ) { @@ -940,7 +940,7 @@ function attributes_cmp( $a, $b ) { $upsells = array(); $ids = $_POST['upsell_ids']; foreach ( $ids as $id ) - if ( $id && $id > 0 ) + if ( $id && $id > 0 ) $upsells[] = $id; update_post_meta( $post_id, '_upsell_ids', $upsells ); @@ -953,9 +953,9 @@ function attributes_cmp( $a, $b ) { $crosssells = array(); $ids = $_POST['crosssell_ids']; foreach ( $ids as $id ) - if ( $id && $id > 0 ) + if ( $id && $id > 0 ) $crosssells[] = $id; - + update_post_meta( $post_id, '_crosssell_ids', $crosssells ); } else { delete_post_meta( $post_id, '_crosssell_ids' ); @@ -965,11 +965,11 @@ function attributes_cmp( $a, $b ) { if ( $is_downloadable == 'yes' ) { $_download_limit = absint( $_POST['_download_limit'] ); - if ( ! $_download_limit ) + if ( ! $_download_limit ) $_download_limit = ''; // 0 or blank = unlimited $_download_expiry = absint( $_POST['_download_expiry'] ); - if ( ! $_download_expiry ) + if ( ! $_download_expiry ) $_download_expiry = ''; // 0 or blank = unlimited // file paths will be stored in an array keyed off md5(file path) @@ -991,17 +991,17 @@ function attributes_cmp( $a, $b ) { update_post_meta( $post_id, '_file_paths', $_file_paths ); } - if ( isset( $_POST['_download_limit'] ) ) + if ( isset( $_POST['_download_limit'] ) ) update_post_meta( $post_id, '_download_limit', esc_attr( $_download_limit ) ); - if ( isset( $_POST['_download_expiry'] ) ) + if ( isset( $_POST['_download_expiry'] ) ) update_post_meta( $post_id, '_download_expiry', esc_attr( $_download_expiry ) ); } // Product url if ( $product_type == 'external' ) { - if ( isset( $_POST['_product_url'] ) && $_POST['_product_url'] ) + if ( isset( $_POST['_product_url'] ) && $_POST['_product_url'] ) update_post_meta( $post_id, '_product_url', esc_attr( $_POST['_product_url'] ) ); - if ( isset( $_POST['_button_text'] ) && $_POST['_button_text'] ) + if ( isset( $_POST['_button_text'] ) && $_POST['_button_text'] ) update_post_meta( $post_id, '_button_text', esc_attr( $_POST['_button_text'] ) ); } @@ -1024,12 +1024,12 @@ function attributes_cmp( $a, $b ) { * @return void */ function woocommerce_change_insert_into_post( $translation, $original ) { - if ( ! isset( $_REQUEST['from'] ) ) + if ( ! isset( $_REQUEST['from'] ) ) return $translation; $original = strtolower( $original ); - if ( $_REQUEST['from'] == 'wc01' && ( $original == 'insert into post' || $original == 'use this image' ) ) + if ( $_REQUEST['from'] == 'wc01' && ( $original == 'insert into post' || $original == 'use this image' ) ) return __( 'Use this file', 'woocommerce' ); return $translation; diff --git a/admin/post-types/writepanels/writepanel-product_images.php b/admin/post-types/writepanels/writepanel-product_images.php index 6bf4c290a70e1..f8b97616996a1 100644 --- a/admin/post-types/writepanels/writepanel-product_images.php +++ b/admin/post-types/writepanels/writepanel-product_images.php @@ -23,30 +23,30 @@ function woocommerce_product_images_box() { ?>
      - ID ); - + if ( $thumbnail_id ) echo '
    • ' . wp_get_attachment_image( $thumbnail_id, 'full' ) . ' - +
    • '; - - $attachments =& get_children( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image' ); - + + $attachments =& get_children( 'post_parent=' . $post->ID . '&numberposts=-1&post_type=attachment&orderby=menu_order&order=ASC&post_mime_type=image' ); + foreach ( $attachments as $attachment_id => $attachment ) { if ( $thumbnail_id == $attachment_id ) continue; - + $exclude_class = get_post_meta( $attachment_id, '_woocommerce_exclude_image', true ) == 1 ? 'excluded' : ''; echo '
    • ' . wp_get_attachment_image( $attachment_id, 'full' ) . ' - +
    - +

    -
    +
    'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', - 'file_data_name' => 'async-upload', + 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), @@ -89,11 +89,11 @@ function woocommerce_product_images_box() { ); // Apply filters to initiate plupload: - $plupload_init = apply_filters( 'plupload_init', $plupload_init ); + $plupload_init = apply_filters( 'plupload_init', $plupload_init ); ?> order_id ); - if ( $order->id ) { + if ( $order->id ) { foreach ( $new_download_ids as $new_download_id ) { // grant permission if it doesn't already exist - if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT true FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $new_download_id ) ) ) { + if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT true FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $new_download_id ) ) ) { woocommerce_downloadable_file_permission( $new_download_id, $product_id, $order ); } } @@ -313,21 +313,21 @@ function woocommerce_meta_boxes_show_errors() { */ function woocommerce_wp_text_input( $field ) { global $thepostid, $post, $woocommerce; - + $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; - + // Custom attribute handling $custom_attributes = array(); - + if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) foreach ( $field['custom_attributes'] as $attribute => $value ) $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; - + echo '

    '; if ( ! empty( $field['description'] ) ) { @@ -352,11 +352,11 @@ function woocommerce_wp_text_input( $field ) { */ function woocommerce_wp_hidden_input( $field ) { global $thepostid, $post; - + $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; - + echo ' '; } diff --git a/admin/settings/settings-init.php b/admin/settings/settings-init.php index b8f5629e700ef..3d89c71b3dbcb 100644 --- a/admin/settings/settings-init.php +++ b/admin/settings/settings-init.php @@ -341,11 +341,11 @@ $woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', array( - array( - 'title' => __( 'Page Setup', 'woocommerce' ), - 'type' => 'title', - 'desc' => sprintf( __( 'Set up core WooCommerce pages here, for example the base page. The base page can also be used in your %sproduct permalinks%s.', 'woocommerce' ), '', '' ), - 'id' => 'page_options' + array( + 'title' => __( 'Page Setup', 'woocommerce' ), + 'type' => 'title', + 'desc' => sprintf( __( 'Set up core WooCommerce pages here, for example the base page. The base page can also be used in your %sproduct permalinks%s.', 'woocommerce' ), '', '' ), + 'id' => 'page_options' ), array( @@ -515,7 +515,7 @@ )), 'desc_tip' => true, ), - + array( 'title' => __( 'Shop Page Display', 'woocommerce' ), 'desc' => __( 'This controls what is shown on the product archive.', 'woocommerce' ), @@ -530,7 +530,7 @@ ), 'desc_tip' => true, ), - + array( 'title' => __( 'Default Category Display', 'woocommerce' ), 'desc' => __( 'This controls what is shown on category archives.', 'woocommerce' ), @@ -948,7 +948,7 @@ $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) ); $classes_options = array(); -if ( $tax_classes ) +if ( $tax_classes ) foreach ( $tax_classes as $class ) $classes_options[ sanitize_title( $class ) ] = esc_html( $class ); @@ -963,7 +963,7 @@ 'default' => 'no', 'type' => 'checkbox' ), - + array( 'title' => __( 'Calculation Settings', 'woocommerce' ), 'desc' => __( 'Calculate tax based on the customer shipping address', 'woocommerce' ), @@ -972,7 +972,7 @@ 'type' => 'checkbox', 'checkboxgroup' => 'start' ), - + array( 'desc' => __( 'Round tax at subtotal level, instead of rounding per line', 'woocommerce' ), 'id' => 'woocommerce_tax_round_at_subtotal', @@ -980,7 +980,7 @@ 'type' => 'checkbox', 'checkboxgroup' => '' ), - + array( 'desc' => sprintf( __( 'Display the tax total when tax is %s', 'woocommerce' ), woocommerce_price( 0 ) ), 'id' => 'woocommerce_display_cart_taxes_if_zero', @@ -1027,7 +1027,7 @@ 'options' => array( '' => 'Shipping tax class based on cart items', 'standard' => __( 'Standard', 'woocommerce' ) ) + $classes_options, 'desc_tip' => true, ), - + array( 'title' => __( 'Additional Tax classes', 'woocommerce' ), 'desc' => __( 'List additonal tax classes below (1 per line). This is in addition to the default Standard Rate.', 'woocommerce' ), diff --git a/admin/settings/settings-save.php b/admin/settings/settings-save.php index f0044a4cd8c26..852931e0dbb03 100644 --- a/admin/settings/settings-save.php +++ b/admin/settings/settings-save.php @@ -21,46 +21,46 @@ */ function woocommerce_update_options( $options ) { - if ( empty( $_POST ) ) + if ( empty( $_POST ) ) return false; - + // Options to update will be stored here $update_options = array(); - + // Loop options and get values to save foreach ( $options as $value ) { - + if ( ! isset( $value['id'] ) ) continue; - + $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; - + // Get the option name $option_value = null; - + switch ( $type ) { - + // Standard types case "checkbox" : - + if ( isset( $_POST[$value['id']] ) ) { $option_value = 'yes'; } else { $option_value = 'no'; } - + break; - + case "textarea" : - + if ( isset( $_POST[$value['id']] ) ) { $option_value = wp_kses_post( $_POST[ $value['id'] ] ); } else { $option_value = ''; } - + break; - + case "text" : case 'email': case 'number': @@ -69,7 +69,7 @@ function woocommerce_update_options( $options ) { case "single_select_page" : case "single_select_country" : case 'radio' : - + if ( $value['id'] == 'woocommerce_price_thousand_sep' || $value['id'] == 'woocommerce_price_decimal_sep' ) { // price separators get a special treatment as they should allow a spaces (don't trim) @@ -78,19 +78,19 @@ function woocommerce_update_options( $options ) { } else { $option_value = ''; } - + } else { - + if ( isset( $_POST[$value['id']] ) ) { $option_value = woocommerce_clean( $_POST[ $value['id'] ] ); } else { $option_value = ''; - } - + } + } - + break; - + // Special types case "tax_rates" : @@ -104,36 +104,36 @@ function woocommerce_update_options( $options ) { $tax_compound = isset( $_POST['tax_compound'] ) ? $_POST['tax_compound'] : array(); $tax_label = isset( $_POST['tax_label'] ) ? $_POST['tax_label'] : array(); $tax_classes_count = sizeof( $tax_classes ); - + for ( $i = 0; $i < $tax_classes_count; $i ++ ) { - + if ( isset( $tax_classes[ $i ] ) && isset( $tax_countries[ $i ] ) && isset( $tax_rate[ $i ] ) && is_numeric( $tax_rate[ $i ] ) ) { - + $rate = woocommerce_clean( $tax_rate[ $i ] ); $rate = number_format( $rate, 4, '.', '' ); - + $class = woocommerce_clean( $tax_classes[ $i ] ); - + $shipping = empty( $tax_shipping[ $i ] ) ? 'no' : 'yes'; $compound = empty( $tax_compound[ $i ] ) ? 'no' : 'yes'; - + // Handle countries $counties_array = array(); $countries = $tax_countries[ $i ]; if ( $countries ) foreach ( $countries as $country ) { - + $country = woocommerce_clean( $country ); $state = '*'; - + if ( strstr( $country, ':' ) ) { $cr = explode( ':', $country ); $country = current( $cr ); $state = end( $cr ); } - + $counties_array[ woocommerce_clean( $country ) ][] = woocommerce_clean( $state ); } - + $tax_rates[] = array( 'countries' => $counties_array, 'rate' => $rate, @@ -144,9 +144,9 @@ function woocommerce_update_options( $options ) { ); } } - + $update_options[ 'woocommerce_tax_rates' ] = $tax_rates; - + // Local tax rates saving $local_tax_rates = array(); $tax_classes = isset( $_POST['local_tax_class'] ) ? $_POST['local_tax_class'] : array(); @@ -160,36 +160,36 @@ function woocommerce_update_options( $options ) { $tax_label = isset( $_POST['local_tax_label'] ) ? $_POST['local_tax_label'] : array(); $tax_classes_count = sizeof( $tax_classes ); for ( $i = 0; $i < $tax_classes_count; $i ++ ) { - + if ( isset( $tax_classes[ $i ] ) && isset( $tax_countries[ $i ] ) && isset( $tax_rate[ $i ] ) && is_numeric( $tax_rate[ $i ] ) ) { - + $rate = woocommerce_clean( $tax_rate[ $i ] ); $rate = number_format( $rate, 4, '.', '' ); - + $class = woocommerce_clean( $tax_classes[ $i ] ); - + if ( ! empty( $tax_shipping[ $i ] ) ) $shipping = 'yes'; else $shipping = 'no'; if ( ! empty( $tax_compound[ $i ] ) ) $compound = 'yes'; else $compound = 'no'; - + // Handle country $country = woocommerce_clean( $tax_countries[ $i ] ); $state = '*'; - + if ( strstr( $country, ':' ) ) { $cr = explode( ':', $country ); $country = current( $cr ); $state = end( $cr ); } - + // Handle postcodes/cities $location_type = $tax_location_type[ $i ] == 'city' ? 'city' : 'postcode'; $locations = explode( "\n", $tax_location[ $i ] ); $locations = array_filter( array_map( 'woocommerce_clean', $locations ) ); - + if ( $location_type == 'city' ) { $locations = array_map( 'sanitize_title', $locations ); } - + $local_tax_rates[] = array( 'country' => $country, 'state' => $state, @@ -203,86 +203,86 @@ function woocommerce_update_options( $options ) { ); } } - + $update_options[ 'woocommerce_local_tax_rates' ] = $local_tax_rates; - + break; - + case "multi_select_countries" : - + // Get countries array - if ( isset( $_POST[ $value['id'] ] ) ) - $selected_countries = array_map( 'woocommerce_clean', (array) $_POST[ $value['id'] ] ); - else + if ( isset( $_POST[ $value['id'] ] ) ) + $selected_countries = array_map( 'woocommerce_clean', (array) $_POST[ $value['id'] ] ); + else $selected_countries = array(); - + $option_value = $selected_countries; - + break; - + case "image_width" : if ( isset( $_POST[$value['id'] ]['width'] ) ) { - + $update_options[ $value['id'] ]['width'] = woocommerce_clean( $_POST[$value['id'] ]['width'] ); $update_options[ $value['id'] ]['height'] = woocommerce_clean( $_POST[$value['id'] ]['height'] ); - + if ( isset( $_POST[ $value['id'] ]['crop'] ) ) $update_options[ $value['id'] ]['crop'] = 1; else $update_options[ $value['id'] ]['crop'] = 0; - + } else { $update_options[ $value['id'] ]['width'] = $value['default']['width']; $update_options[ $value['id'] ]['height'] = $value['default']['height']; $update_options[ $value['id'] ]['crop'] = $value['default']['crop']; } - + break; - + // Custom handling default : - + do_action( 'woocommerce_update_option_' . $type, $value ); - + break; } - + if ( ! is_null( $option_value ) ) { // Check if option is an array if ( strstr( $value['id'], '[' ) ) { - + parse_str( $value['id'], $option_array ); - + // Option name is first key $option_name = current( array_keys( $option_array ) ); - + // Get old option value if ( ! isset( $update_options[ $option_name ] ) ) $update_options[ $option_name ] = get_option( $option_name, array() ); - + if ( ! is_array( $update_options[ $option_name ] ) ) $update_options[ $option_name ] = array(); - + // Set keys and value $key = key( $option_array[ $option_name ] ); - + $update_options[ $option_name ][ $key ] = $option_value; - + // Single value } else { $update_options[ $value['id'] ] = $option_value; } } - + // Custom handling do_action( 'woocommerce_update_option', $value ); } - + // Now save the options foreach( $update_options as $name => $value ) update_option( $name, $value, true ); - + return true; } \ No newline at end of file diff --git a/admin/settings/settings-tax-rates.php b/admin/settings/settings-tax-rates.php index b87848fd639a3..9143e6bfaec32 100644 --- a/admin/settings/settings-tax-rates.php +++ b/admin/settings/settings-tax-rates.php @@ -18,7 +18,7 @@ */ function woocommerce_tax_rates_setting() { global $woocommerce; - + woocommerce_export_tax_rates(); $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) ); @@ -28,12 +28,12 @@ function woocommerce_tax_rates_setting() { ?> - + - +

    - + @@ -53,8 +53,8 @@ function woocommerce_tax_rates_setting() { @@ -102,7 +102,7 @@ function woocommerce_tax_rates_setting() {
    - - + +
    - +

    +

    @@ -113,9 +113,9 @@ function woocommerce_tax_rates_setting() { - +

    - + @@ -139,10 +139,10 @@ function woocommerce_tax_rates_setting() { - @@ -374,7 +374,7 @@ function woocommerce_tax_rates_setting() { } return false; }); - + // Show local rates jQuery( 'a.toggle_local_tax_rates' ).click(function(){ jQuery(this).closest('p').hide(); @@ -414,7 +414,7 @@ function woocommerce_tax_row_label( $selected ) { $states_count+=sizeof($value); endif; - if ( ! in_array( $country, $counties_array ) ) + if ( ! in_array( $country, $counties_array ) ) $counties_array[] = esc_html( $woocommerce->countries->countries[ $country ] ); endforeach; @@ -446,33 +446,33 @@ function woocommerce_tax_row_label( $selected ) { /** * woocommerce_export_tax_rates function. - * + * * @access public * @return void */ function woocommerce_export_tax_rates() { - + if ( empty( $_GET['wc_export_tax_rates'] ) ) return; - + global $woocommerce; - + if ( ! class_exists('WC_CSV_Exporter') ) include( $woocommerce->plugin_path() . '/admin/includes/class-wc-csv-exporter.php' ); $export = absint( $_GET['wc_export_tax_rates'] ); - + if ( $export == 1 ) { - + $tax_rates = get_option('woocommerce_tax_rates'); - + $csv = new WC_CSV_Exporter( array( 'countries', 'class', 'label', 'rate', 'compound', 'shipping' ), true, 'tax_rates.csv' ); - + if ( $tax_rates ) foreach( $tax_rates as $rate ) { - + $countries = array(); - + foreach ( $rate['countries'] as $country => $states ) { foreach( $states as $state ) { if ( $state == '*' ) { @@ -482,8 +482,8 @@ function woocommerce_export_tax_rates() { } } } - - $csv->add_row( array( + + $csv->add_row( array( implode( ' | ', $countries ), $rate['class'], $rate['label'], @@ -492,18 +492,18 @@ function woocommerce_export_tax_rates() { $rate['shipping'] == 'yes' ? 1 : 0 ) ); } - + $csv->end(); - + } else { $tax_rates = get_option('woocommerce_local_tax_rates'); - + $csv = new WC_CSV_Exporter( array( 'country', 'state', 'postcode', 'class', 'label', 'rate', 'compound', 'shipping' ), true, 'local_tax_rates.csv' ); - + if ( $tax_rates ) foreach( $tax_rates as $rate ) { - $csv->add_row( array( + $csv->add_row( array( $rate['country'], $rate['state'], implode( ' | ', $rate['postcode'] ), @@ -514,8 +514,8 @@ function woocommerce_export_tax_rates() { $rate['shipping'] == 'yes' ? 1 : 0 ) ); } - + $csv->end(); - + } } \ No newline at end of file diff --git a/admin/woocommerce-admin-attributes.php b/admin/woocommerce-admin-attributes.php index abb906133b066..7dcf07cb374df 100644 --- a/admin/woocommerce-admin-attributes.php +++ b/admin/woocommerce-admin-attributes.php @@ -298,7 +298,7 @@ function woocommerce_add_attribute() { - - = date ( 'm' ) && $current_year == date( 'Y' ) ) + for ( $count = 0; $count < 12; $count++ ) : + if ( $count >= date ( 'm' ) && $current_year == date( 'Y' ) ) continue; $month = date( 'Ym', strtotime( date( 'Ym', strtotime( '+ '. $count . ' MONTH', $start_date ) ) . '01' ) ); - + // set elements before += them below $monthly_totals[$month] = 0; - + $column_count++; ?> @@ -2334,61 +2334,61 @@ function woocommerce_coupon_sales() { - + $sales ) { - + echo ''; - + for ( $count = 0; $count < 12; $count ++ ) { - - if ( $count >= date ( 'm' ) && $current_year == date( 'Y' ) ) + + if ( $count >= date ( 'm' ) && $current_year == date( 'Y' ) ) continue; - + $month = date( 'Ym', strtotime( date( 'Ym', strtotime( '+ '. $count . ' MONTH', $start_date ) ) . '01' ) ); - + $amount = isset( $sales[$month] ) ? $sales[$month] : 0; echo ''; - + $monthly_totals[$month] += $amount; - + $chart_data[$coupon_code][] = array( strtotime( date( 'Ymd', strtotime( $month . '01' ) ) ) . '000', $amount ); - + } - + echo ''; - + // total sales across all months $coupon_totals[$coupon_code] = array_sum( $sales ); - + echo ''; - + } - + $top_coupon_name = current( array_keys( $coupon_totals, max( $coupon_totals ) ) ); $top_coupon_sales = $coupon_totals[$top_coupon_name]; - + $worst_coupon_name = current( array_keys( $coupon_totals, min( $coupon_totals ) ) ); $worst_coupon_sales = $coupon_totals[$worst_coupon_name]; - + $median_coupon_sales = array_values( $coupon_totals ); sort($median_coupon_sales); - + echo ''; - + foreach( $monthly_totals as $month => $totals ) echo ''; - + echo ''; - + ?>
    attribute_name ); ?> attribute_type ) ); ?>attribute_orderby ) { case 'name' : _e( 'Name', 'woocommerce' ); @@ -306,7 +306,7 @@ function woocommerce_add_attribute() { case 'id' : _e( 'Term ID', 'woocommerce' ); break; - default: + default: _e( 'Custom ordering', 'woocommerce' ); break; } @@ -364,7 +364,7 @@ function woocommerce_add_attribute() {

    Text allows manual entry via the product page, whereas select attribute terms can be defined from this section. If you plan on using an attribute for variations use select.', 'woocommerce' ); ?>

    - +
    %s', $i, selected( $current_year, $i, false ), $i ); ?>

    @@ -833,10 +833,10 @@ function woocommerce_monthly_sales() { $count ) $order_counts_array[] = array( esc_js( $key ), esc_js( $count ) ); - + foreach ( $order_amounts as $key => $amount ) $order_amounts_array[] = array( esc_js( $key ), esc_js( $amount ) ); @@ -901,7 +901,7 @@ function woocommerce_top_sellers() { $start_date = isset( $_POST['start_date'] ) ? $_POST['start_date'] : ''; $end_date = isset( $_POST['end_date'] ) ? $_POST['end_date'] : ''; - if ( ! $start_date ) + if ( ! $start_date ) $start_date = date( 'Ymd', strtotime( date( 'Ym', current_time( 'timestamp' ) ) . '01' ) ); if ( ! $end_date ) $end_date = date( 'Ymd', current_time( 'timestamp' ) ); @@ -912,10 +912,10 @@ function woocommerce_top_sellers() { // Get order ids and dates in range $order_items = $wpdb->get_results( " SELECT order_item_meta_2.meta_value as product_id, SUM( order_item_meta.meta_value ) as item_quantity FROM {$wpdb->prefix}woocommerce_order_items as order_items - + LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id - LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID + LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS term USING( term_id ) @@ -931,7 +931,7 @@ function woocommerce_top_sellers() { AND order_item_meta_2.meta_key = '_product_id' GROUP BY order_item_meta_2.meta_value " ); - + $found_products = array(); if ( $order_items ) { @@ -961,7 +961,7 @@ function woocommerce_top_sellers() { foreach ( $found_products as $product_id => $sales ) { $width = $sales > 0 ? ( $sales / $max_sales ) * 100 : 0; $product_title = get_the_title( $product_id ); - + if ( $product_title ) { $product_name = ''. __( $product_title ) .''; $orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=completed,processing,on-hold' ); @@ -997,21 +997,21 @@ function woocommerce_top_earners() { $start_date = isset( $_POST['start_date'] ) ? $_POST['start_date'] : ''; $end_date = isset( $_POST['end_date'] ) ? $_POST['end_date'] : ''; - if ( ! $start_date ) + if ( ! $start_date ) $start_date = date( 'Ymd', strtotime( date('Ym', current_time( 'timestamp' ) ) . '01' ) ); - if ( ! $end_date ) + if ( ! $end_date ) $end_date = date( 'Ymd', current_time( 'timestamp' ) ); $start_date = strtotime( $start_date ); $end_date = strtotime( $end_date ); - + // Get order ids and dates in range $order_items = $wpdb->get_results( " SELECT order_item_meta_2.meta_value as product_id, SUM( order_item_meta.meta_value ) as line_total FROM {$wpdb->prefix}woocommerce_order_items as order_items - + LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id - LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID + LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS term USING( term_id ) @@ -1035,7 +1035,7 @@ function woocommerce_top_earners() { $found_products[ $order_item->product_id ] = $order_item->line_total; } } - + asort( $found_products ); $found_products = array_reverse( $found_products, true ); $found_products = array_slice( $found_products, 0, 25, true ); @@ -1058,7 +1058,7 @@ function woocommerce_top_earners() { $width = $sales > 0 ? ( round( $sales ) / round( $max_sales ) ) * 100 : 0; $product_title = get_the_title( $product_id ); - + if ( $product_title ) { $product_name = ''. __( $product_title ) .''; $orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( $product_title ) . '&shop_order_status=completed,processing,on-hold' ); @@ -1113,22 +1113,22 @@ function woocommerce_product_sales() { // Get order items $order_items = $wpdb->get_results( " - SELECT order_item_meta_2.meta_value as product_id, posts.post_date, SUM( order_item_meta.meta_value ) as item_quantity, SUM( order_item_meta_3.meta_value ) as line_total + SELECT order_item_meta_2.meta_value as product_id, posts.post_date, SUM( order_item_meta.meta_value ) as item_quantity, SUM( order_item_meta_3.meta_value ) as line_total FROM {$wpdb->prefix}woocommerce_order_items as order_items - + LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_3 ON order_items.order_item_id = order_item_meta_3.order_item_id - LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID + LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS term USING( term_id ) - + WHERE posts.post_type = 'shop_order' AND order_item_meta_2.meta_value IN ('" . implode( "','", array_merge( $chosen_product_ids, $children_ids ) ) . "') AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' - AND term.slug IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "') + AND term.slug IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "') AND order_items.order_item_type = 'line_item' AND order_item_meta.meta_key = '_qty' AND order_item_meta_2.meta_key = '_product_id' @@ -1138,27 +1138,27 @@ function woocommerce_product_sales() { " ); $found_products = array(); - + if ( $order_items ) { foreach ( $order_items as $order_item ) { - + if ( $order_item->line_total == 0 && $order_item->item_quantity == 0 ) continue; - + // Get date $date = date( 'Ym', strtotime( $order_item->post_date ) ); - + // Set values $product_sales[ $date ] = isset( $product_sales[ $date ] ) ? $product_sales[ $date ] + $order_item->item_quantity : $order_item->item_quantity; $product_totals[ $date ] = isset( $product_totals[ $date ] ) ? $product_totals[ $date ] + $order_item->line_total : $order_item->line_total; - - if ( $product_sales[ $date ] > $max_sales ) + + if ( $product_sales[ $date ] > $max_sales ) $max_sales = $product_sales[ $date ]; - - if ( $product_totals[ $date ] > $max_totals ) + + if ( $product_totals[ $date ] > $max_totals ) $max_totals = $product_totals[ $date ]; } - } + } ?>

    @@ -1174,9 +1174,9 @@ function woocommerce_product_sales() { foreach ( $product_sales as $date => $sales ) { $width = ($sales>0) ? (round($sales) / round($max_sales)) * 100 : 0; $width2 = ($product_totals[$date]>0) ? (round($product_totals[$date]) / round($max_totals)) * 100 : 0; - + $orders_link = admin_url( 'edit.php?s&post_status=all&post_type=shop_order&action=-1&s=' . urlencode( implode( ' ', $chosen_product_titles ) ) . '&m=' . date( 'Ym', strtotime( $date . '01' ) ) . '&shop_order_status=completed,processing,on-hold' ); - + echo ''; - - + + foreach ( $tax_row_labels as $label ) { - + $row_total = 0; - + foreach ( $tax['tax_rows'] as $tax_row ) { if ( $tax_row->name == $label ) { $row_total = $tax_row->total_tax_amount; } } - - echo ''; + + echo ''; } echo ''; @@ -1899,7 +1899,7 @@ function woocommerce_monthly_taxes() { /** * woocommerce_category_sales function. - * + * * @access public * @return void */ @@ -1911,7 +1911,7 @@ function woocommerce_category_sales() { $current_year = isset( $_POST['show_year'] ) ? $_POST['show_year'] : date( 'Y', current_time( 'timestamp' ) ); $start_date = strtotime( $current_year . '0101' ); - + $categories = get_terms( 'product_cat', array( 'parent' => 0 ) ); ?> @@ -1919,11 +1919,11 @@ function woocommerce_category_sales() { - + - = date ( 'm' ) && $current_year == date( 'Y' ) ) + for ( $count = 0; $count < 12; $count++ ) : + if ( $count >= date ( 'm' ) && $current_year == date( 'Y' ) ) continue; $column_count++; ?> @@ -2009,34 +2009,34 @@ function woocommerce_category_sales() { // While outputting, lets store them for the chart $chart_data = $month_totals = $category_totals = array(); $top_cat = $bottom_cat = $top_cat_name = $bottom_cat_name = ''; - + for ( $count = 0; $count < 12; $count++ ) if ( $count >= date( 'm' ) && $current_year == date( 'Y' ) ) break; else $month_totals[ $count ] = 0; - + foreach ( $categories as $category ) { - + $cat_total = 0; $category_chart_data = $term_ids = array(); - + $term_ids = get_term_children( $category->term_id, 'product_cat' ); $term_ids[] = $category->term_id; $product_ids = get_objects_in_term( $term_ids, 'product_cat' ); - + if ( $category->parent > 0 ) $prepend = '— '; else $prepend = ''; - + $category_sales_html = ''; - + for ( $count = 0; $count < 12; $count++ ) { - - if ( $count >= date( 'm' ) && $current_year == date( 'Y' ) ) + + if ( $count >= date( 'm' ) && $current_year == date( 'Y' ) ) continue; - + if ( ! empty( $item_sales[ $count ] ) ) { $matches = array_intersect_key( $item_sales[ $count ], array_flip( $product_ids ) ); $total = array_sum( $matches ); @@ -2044,41 +2044,41 @@ function woocommerce_category_sales() { } else { $total = 0; } - + $month_totals[ $count ] += $total; - + $category_sales_html .= ''; - + $category_chart_data[] = array( strtotime( date( 'Ymd', strtotime( '2012-' . ( $count + 1 ) . '-01' ) ) ) . '000', $total ); } - + if ( $cat_total == 0 ) continue; - + $category_totals[] = $cat_total; - + $category_sales_html .= ''; - + $category_sales_html .= ''; - + echo $category_sales_html; - + $chart_data[ $category->name ] = $category_chart_data; - + if ( $cat_total > $top_cat ) { $top_cat = $cat_total; $top_cat_name = $category->name; } - + if ( $cat_total < $bottom_cat || $bottom_cat === '' ) { $bottom_cat = $cat_total; $bottom_cat_name = $category->name; } - + } - + sort( $category_totals ); - + echo ''; for ( $count = 0; $count < 12; $count++ ) if ( $count >= date( 'm' ) && $current_year == date( 'Y' ) ) @@ -2086,11 +2086,11 @@ function woocommerce_category_sales() { else echo ''; echo ''; - + ?>
    ' . date_i18n( 'F', strtotime( $date . '01' ) ) . ' ' . esc_html( $sales ) . '' . woocommerce_price( $product_totals[ $date ] ) . ' @@ -1198,7 +1198,7 @@ function woocommerce_product_sales() {

    @@ -1700,22 +1700,22 @@ function woocommerce_monthly_taxes() { " ); $tax_rows = $wpdb->get_results( " - SELECT + SELECT order_items.order_item_name as name, - SUM( order_item_meta.meta_value ) as tax_amount, + SUM( order_item_meta.meta_value ) as tax_amount, SUM( order_item_meta_2.meta_value ) as shipping_tax_amount, SUM( order_item_meta.meta_value + order_item_meta_2.meta_value ) as total_tax_amount - + FROM {$wpdb->prefix}woocommerce_order_items as order_items - + LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta_2 ON order_items.order_item_id = order_item_meta_2.order_item_id - - LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID + + LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS term USING( term_id ) - + WHERE order_items.order_item_type = 'tax' AND posts.post_type = 'shop_order' AND posts.post_status = 'publish' @@ -1724,10 +1724,10 @@ function woocommerce_monthly_taxes() { AND '{$month}' = date_format( posts.post_date,'%%Y%%m' ) AND order_item_meta.meta_key = 'tax_amount' AND order_item_meta_2.meta_key = 'shipping_tax_amount' - + GROUP BY order_items.order_item_name " ); - + if ( $tax_rows ) { foreach ( $tax_rows as $tax_row ) { $tax_row_labels[] = $tax_row->name; @@ -1864,19 +1864,19 @@ function woocommerce_monthly_taxes() {
    ' . woocommerce_price( $tax['total_tax'] ) . ' ' . woocommerce_price( $tax['gross'] - $tax['shipping'] - $tax['total_tax'] ) . '' . woocommerce_price( $row_total ) . '' . woocommerce_price( $row_total ) . '
    ' . $prepend . $category->name . '' . woocommerce_price( $total ) . '' . woocommerce_price( $cat_total ) . '
    ' . __( 'Total', 'woocommerce' ) . '' . woocommerce_price( $month_totals[ $count ] ) . '' . woocommerce_price( array_sum( $month_totals ) ) . '
    - +
    @@ -2128,10 +2128,10 @@ function woocommerce_category_sales() { if ( sizeof( $category_totals ) == 0 ) echo __( 'N/A', 'woocommerce' ); elseif ( sizeof( $category_totals ) % 2 ) - echo woocommerce_price( - ( - $category_totals[ floor( sizeof( $category_totals ) / 2 ) ] + $category_totals[ ceil( sizeof( $category_totals ) / 2 ) ] - ) / 2 + echo woocommerce_price( + ( + $category_totals[ floor( sizeof( $category_totals ) / 2 ) ] + $category_totals[ ceil( sizeof( $category_totals ) / 2 ) ] + ) / 2 ); else echo woocommerce_price( $category_totals[ sizeof( $category_totals ) / 2 ] ); @@ -2151,7 +2151,7 @@ function woocommerce_category_sales() {
    @@ -2215,7 +2215,7 @@ function woocommerce_category_sales() { /** * woocommerce_coupon_sales function. - * + * * @access public * @return void */ @@ -2227,42 +2227,42 @@ function woocommerce_coupon_sales() { $current_year = isset( $_POST['show_year'] ) ? $_POST['show_year'] : date( 'Y', current_time( 'timestamp' ) ); $start_date = strtotime( $current_year . '0101' ); - + $order_statuses = implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ); - - + + $coupons = $wpdb->get_col( " SELECT DISTINCT meta.meta_value FROM {$wpdb->postmeta} AS meta LEFT JOIN {$wpdb->posts} AS posts ON posts.ID = meta.post_id LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) LEFT JOIN {$wpdb->terms} AS term USING( term_id ) - + WHERE meta.meta_key = 'coupons' AND posts.post_type = 'shop_order' AND posts.post_status = 'publish' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ('{$order_statuses}') " ); - - - + + + ?> - +

    - +

    - + 0 ) : - + $coupons = $_POST['show_coupons']; - + $coupon_sales = $monthly_totals = array(); foreach( $coupons as $coupon ) : - + $monthly_sales = $wpdb->get_results( $wpdb->prepare( " SELECT SUM(postmeta.meta_value) AS order_total, date_format(posts.post_date, '%%Y%%m') as month FROM {$wpdb->posts} AS posts - + INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID=postmeta.post_ID INNER JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID INNER JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) INNER JOIN {$wpdb->terms} AS term USING( term_id ) - + WHERE postmeta.meta_key = '_order_total' AND tax.taxonomy = 'shop_order_status' AND term.slug IN ('{$order_statuses}') @@ -2298,18 +2298,18 @@ function woocommerce_coupon_sales() { AND '{$current_year}' = date_format(posts.post_date,'%%Y') AND posts.ID IN ( SELECT post_id FROM {$wpdb->postmeta} AS meta - + WHERE meta.meta_key = 'coupons' AND meta.meta_value = '%s' ) GROUP BY month", $coupon ), OBJECT ); - + foreach( $monthly_sales as $sales ) { $month = $sales->month; $coupon_sales[$coupon][$month] = $sales->order_total; } - - + + endforeach; ?>
    @@ -2317,16 +2317,16 @@ function woocommerce_coupon_sales() {
    ' . esc_html( $coupon_code ) . '' . woocommerce_price( $amount ) . '' . woocommerce_price( array_sum( $sales ) ) . '
    ' . __( 'Total', 'woocommerce' ) . '' . woocommerce_price( $totals ) . '' . woocommerce_price( array_sum( $monthly_totals ) ) . '
    - +
    @@ -2423,13 +2423,13 @@ function woocommerce_coupon_sales() { if ( count( $median_coupon_sales ) == 2 ) echo __( 'N/A', 'woocommerce' ); elseif ( count( $median_coupon_sales ) % 2 ) - echo woocommerce_price( - ( - $median_coupon_sales[ floor( count( $median_coupon_sales ) / 2 ) ] + $median_coupon_sales[ ceil( count( $median_coupon_sales ) / 2 ) ] - ) / 2 + echo woocommerce_price( + ( + $median_coupon_sales[ floor( count( $median_coupon_sales ) / 2 ) ] + $median_coupon_sales[ ceil( count( $median_coupon_sales ) / 2 ) ] + ) / 2 ); else - + echo woocommerce_price( $median_coupon_sales[ count( $median_coupon_sales ) / 2 ] ); ?>

    @@ -2447,7 +2447,7 @@ function woocommerce_coupon_sales() {
    \ No newline at end of file diff --git a/classes/integrations/shareyourcart/sdk/views/admin-page.php b/classes/integrations/shareyourcart/sdk/views/admin-page.php index 1d7a269e858ad..57f001b4fd629 100755 --- a/classes/integrations/shareyourcart/sdk/views/admin-page.php +++ b/classes/integrations/shareyourcart/sdk/views/admin-page.php @@ -1,4 +1,4 @@ -"; //it can happen that the headers have allready been sent, so use the html version as well @@ -20,15 +20,15 @@
    - + getUpdateNotification(); ?> - +

    - + adminFix)) echo "




    "; else echo "
    "; @@ -38,29 +38,29 @@

    -
    "; - + $message .= $status_message; } - - echo $message; + + echo $message; ?>

    - +

    'ShareYourCart™')); ?>

    - +
    -
    -
    -
    +
    + +
    isActive()) : ?> @@ -74,7 +74,7 @@ -
    +
    @@ -90,34 +90,34 @@
    -
    -
    -
    +
    + +
    - + isActive()): //show the configure part only if it is active ?>


    - +
    -
    - +

    + - - + +

    , or if you have a private question, you can {link-2} contact us directly", array('{link-1}' => '', '{link-2}' => '')); ?>


    - +
    \ No newline at end of file diff --git a/classes/integrations/shareyourcart/sdk/views/button-img.php b/classes/integrations/shareyourcart/sdk/views/button-img.php index e94b5f7f31e81..21f52ff45575b 100755 --- a/classes/integrations/shareyourcart/sdk/views/button-img.php +++ b/classes/integrations/shareyourcart/sdk/views/button-img.php @@ -1,6 +1,6 @@ -px; text-indent: -9999px; } - + diff --git a/classes/integrations/shareyourcart/sdk/views/button-settings-page.php b/classes/integrations/shareyourcart/sdk/views/button-settings-page.php index 3be9c2115d00c..606745e29adaa 100755 --- a/classes/integrations/shareyourcart/sdk/views/button-settings-page.php +++ b/classes/integrations/shareyourcart/sdk/views/button-settings-page.php @@ -5,15 +5,15 @@ -
    -
    +
    +
    - +
    - + name="button_type" onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/default-click']);" /> - +

    @@ -43,7 +43,7 @@ - + @@ -54,14 +54,14 @@ + - + + -->
    @@ -82,7 +82,7 @@ - + @@ -96,27 +96,27 @@ - +
    onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/custom-button-click']);"/> - + - + - +
    - +
    - +
    - +
    - +

    @@ -125,7 +125,7 @@ @@ -141,13 +141,13 @@
    type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-product-click']);">
    - type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-checkout-click']);"> + type='checkbox' onclick=" if(_gaq) _gaq.push(['_trackPageview', '/admin/button-settings-view/toggle-show-on-checkout-click']);">
    - - -
    - - + + +
    + +
    -
    +
    diff --git a/classes/integrations/shareyourcart/sdk/views/documentation.php b/classes/integrations/shareyourcart/sdk/views/documentation.php index 9d350289ad23b..b700e05405958 100755 --- a/classes/integrations/shareyourcart/sdk/views/documentation.php +++ b/classes/integrations/shareyourcart/sdk/views/documentation.php @@ -5,28 +5,28 @@
    - + getUpdateNotification(); ?> - +

    -
    +

    - +

    post or page you can use the following shortcode:', array( '{brand}' => 'ShareYourCart™')); ?>

    [shareyourcart]
    - +

    theme or page template you have to use the following function call:', array('{brand}' => 'ShareYourCart™')); ?>

    echo do_shortcode('[shareyourcart]');

      - +
    1. 
             
           ...
      @@ -55,23 +55,23 @@
                           
                       
    - - + +

    'ShareYourCart™')); ?>

    Get a
    discount '; ?>
    - +

    append {product-property} to the {callback-url} value, where {product-property} is the product\'s id', array('{brand}' => 'ShareYourCart™', '{product-property}' => '&p=<product_id>', '{callback-url}' => 'data-syc-callback_url')); ?>

    diff --git a/classes/integrations/shareyourcart/sdk/views/page-header.php b/classes/integrations/shareyourcart/sdk/views/page-header.php index 5df753816f484..4ca36ae2acf17 100755 --- a/classes/integrations/shareyourcart/sdk/views/page-header.php +++ b/classes/integrations/shareyourcart/sdk/views/page-header.php @@ -4,14 +4,14 @@ -getFileName())."/css/style.css"; - + //check if there is a file in the specified location if(file_exists($_file_)):?> - + diff --git a/classes/integrations/shareyourcart/views/admin-header.php b/classes/integrations/shareyourcart/views/admin-header.php index b4ecb3d2757ae..98a9ce32509ff 100644 --- a/classes/integrations/shareyourcart/views/admin-header.php +++ b/classes/integrations/shareyourcart/views/admin-header.php @@ -4,10 +4,10 @@ window.onload = function() { document.getElementById('syc-form').addEventListener('submit', changetext, false); -}; +}; var changetext = function(){ var textarea = document.getElementById('syc_button_textarea').value; - document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea); + document.getElementById('syc_button_textarea').value = encodeURIComponent(textarea); } \ No newline at end of file diff --git a/classes/integrations/shareyourcart/views/admin-page.php b/classes/integrations/shareyourcart/views/admin-page.php index 280f2b40505d3..858e3c51d7770 100644 --- a/classes/integrations/shareyourcart/views/admin-page.php +++ b/classes/integrations/shareyourcart/views/admin-page.php @@ -7,13 +7,13 @@ //since this is a post, and is related to recovering or creating a new account, perform some special operations if ($refresh || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $_REQUEST['syc-account'] ))){ - $redirect = remove_query_arg( 'saved' ); - $redirect = remove_query_arg( 'wc_error', $redirect ); - $redirect = remove_query_arg( 'wc_message', $redirect ); - + $redirect = remove_query_arg( 'saved' ); + $redirect = remove_query_arg( 'wc_error', $redirect ); + $redirect = remove_query_arg( 'wc_message', $redirect ); + //remove the syc-account argument only if the SDK commanded as such if($refresh) $redirect = remove_query_arg( 'syc-account', $redirect ); - + if ( !empty($error_message) ) $redirect = add_query_arg( 'wc_error', urlencode( esc_attr( $error_message ) ), $redirect ); wp_safe_redirect( $redirect ); @@ -26,62 +26,62 @@ getUpdateNotification(); ?> - + getClientId() && ! $this->getAppKey() ) : //show the get started message ?> - +
    method_description; ?>

    - + - +

    method_description );?> - + - +

    -
    "; - + $message .= $status_message; } - - echo $message; + + echo $message; ?>

    - - + +

    Account Options

    -
    +
    @@ -96,19 +96,19 @@ - +
    - isActive() ) echo SyC::t('sdk','Enabled'); else echo SyC::t('sdk','Disabled'); ?> + isActive() ) echo SyC::t('sdk','Enabled'); else echo SyC::t('sdk','Disabled'); ?> isActive()) : ?> - +
    - + - -

    - + +

    +
    - +
    -
    +
    - +
    \ No newline at end of file diff --git a/classes/integrations/shareyourcart/views/button-settings-page.php b/classes/integrations/shareyourcart/views/button-settings-page.php index 78a9e91c87922..67e75d7b8c512 100644 --- a/classes/integrations/shareyourcart/views/button-settings-page.php +++ b/classes/integrations/shareyourcart/views/button-settings-page.php @@ -11,7 +11,7 @@

    @@ -37,7 +37,7 @@ - +

    @@ -62,13 +62,13 @@
    - + - +

    - + - - + +

    @@ -96,7 +96,7 @@ @@ -114,10 +114,10 @@
    type='checkbox'>
    - type='checkbox'> + type='checkbox'>
    -
    - + +
    -
    +
    \ No newline at end of file diff --git a/classes/shipping/class-wc-flat-rate.php b/classes/shipping/class-wc-flat-rate.php index f64e17b9ec7d9..20bde8e825f60 100644 --- a/classes/shipping/class-wc-flat-rate.php +++ b/classes/shipping/class-wc-flat-rate.php @@ -191,18 +191,18 @@ function calculate_shipping( $package = array() ) { $cost_per_order = ( isset( $this->cost_per_order ) && ! empty( $this->cost_per_order ) ) ? $this->cost_per_order : 0; if ( $this->type == 'order' ) { - + $shipping_total = $this->order_shipping( $package ); - + if ( ! is_null( $shipping_total ) || $cost_per_order > 0 ) $rate = array( 'id' => $this->id, 'label' => $this->title, 'cost' => $shipping_total + $cost_per_order, ); - + } elseif ( $this->type == 'class' ) { - + $shipping_total = $this->class_shipping( $package ); if ( ! is_null( $shipping_total ) || $cost_per_order > 0 ) @@ -211,28 +211,28 @@ function calculate_shipping( $package = array() ) { 'label' => $this->title, 'cost' => $shipping_total + $cost_per_order, ); - + } elseif ( $this->type == 'item' ) { - + $costs = $this->item_shipping( $package ); - + if ( ! is_null( $costs ) || $cost_per_order > 0 ) { - + if ( ! is_array( $costs ) ) $costs = array(); - + $costs['order'] = $cost_per_order; - + $rate = array( 'id' => $this->id, 'label' => $this->title, 'cost' => $costs, 'calc_tax' => 'per_item', ); - + } } - + if ( ! isset( $rate ) ) return; @@ -332,7 +332,7 @@ function order_shipping( $package ) { } elseif ( is_null( $cost ) ) { // No match return null; - } + } // Shipping for whole order return $cost + $this->get_fee( $fee, $package['contents_cost'] ); @@ -367,9 +367,9 @@ function class_shipping( $package ) { } $found_shipping_classes = array_unique( $found_shipping_classes ); - + $matched = false; - + // For each found class, add up the costs and fees foreach ( $found_shipping_classes as $shipping_class => $class_price ) { if ( isset( $this->flat_rates[ $shipping_class ] ) ) { @@ -403,7 +403,7 @@ function class_shipping( $package ) { function item_shipping( $package ) { // Per item shipping so we pass an array of costs (per item) instead of a single value $costs = array(); - + $matched = false; // Shipping per item @@ -412,9 +412,9 @@ function item_shipping( $package ) { if ( $values['quantity'] > 0 && $_product->needs_shipping() ) { $shipping_class = $_product->get_shipping_class(); - + $fee = $cost = 0; - + if ( isset( $this->flat_rates[ $shipping_class ] ) ) { $cost = $this->flat_rates[ $shipping_class ]['cost']; $fee = $this->get_fee( $this->flat_rates[ $shipping_class ]['fee'], $_product->get_price() ); @@ -428,7 +428,7 @@ function item_shipping( $package ) { $costs[ $item_id ] = ( ( $cost + $fee ) * $values['quantity'] ); } } - + if ( $matched ) return $costs; else diff --git a/classes/shipping/class-wc-local-delivery.php b/classes/shipping/class-wc-local-delivery.php index 6dfb4a3b39685..b86732453d282 100644 --- a/classes/shipping/class-wc-local-delivery.php +++ b/classes/shipping/class-wc-local-delivery.php @@ -191,29 +191,29 @@ function is_available( $package ) { $codes[] = $this->clean( $code ); } } - + if ( is_array( $codes ) ) { - + $found_match = false; - + if ( in_array( $this->clean( $package['destination']['postcode'] ), $codes ) ) $found_match = true; - + // Wildcard search if ( ! $found_match ) { - + $customer_postcode = $this->clean( $package['destination']['postcode'] ); $customer_postcode_length = strlen( $customer_postcode ); - + for ( $i = 0; $i <= $customer_postcode_length; $i++ ) { - - if ( in_array( $customer_postcode, $codes ) ) + + if ( in_array( $customer_postcode, $codes ) ) $found_match = true; - + $customer_postcode = substr( $customer_postcode, 0, -2 ) . '*'; } } - + if ( ! $found_match ) return false; } diff --git a/classes/shipping/class-wc-local-pickup.php b/classes/shipping/class-wc-local-pickup.php index bff983fd5881a..ebea0174c37ee 100644 --- a/classes/shipping/class-wc-local-pickup.php +++ b/classes/shipping/class-wc-local-pickup.php @@ -144,13 +144,13 @@ function admin_options() { */ function is_available( $package ) { global $woocommerce; - + $is_available = true; - + if ( $this->enabled == "no" ) { - + $is_available = false; - + } else { // If post codes are listed, let's use them. @@ -160,35 +160,35 @@ function is_available( $package ) { $codes[] = $this->clean( $code ); } } - + if ( is_array( $codes ) ) { - + $found_match = false; - + if ( in_array( $this->clean( $package['destination']['postcode'] ), $codes ) ) $found_match = true; - + // Wildcard search if ( ! $found_match ) { - + $customer_postcode = $this->clean( $package['destination']['postcode'] ); $customer_postcode_length = strlen( $customer_postcode ); - + for ( $i = 0; $i <= $customer_postcode_length; $i++ ) { - - if ( in_array( $customer_postcode, $codes ) ) + + if ( in_array( $customer_postcode, $codes ) ) $found_match = true; - + $customer_postcode = substr( $customer_postcode, 0, -2 ) . '*'; } } - + if ( ! $found_match ) { - + $is_available = false; - + } else { - + $ship_to_countries = ''; if ( $this->availability == 'specific' ) { @@ -196,56 +196,56 @@ function is_available( $package ) { } elseif ( get_option( 'woocommerce_allowed_countries' ) == 'specific' ) { $ship_to_countries = get_option( 'woocommerce_specific_allowed_countries' ); } - + if ( is_array( $ship_to_countries ) && ! in_array( $package['destination']['country'], $ship_to_countries ) ) { $is_available = false; } - + } } - + } return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available, $package ); } - - + + /** * taxable_address function. - * + * * @access public * @param mixed $address * @return void */ function taxable_address( $address ) { global $woocommerce; - + if ( ! empty( $woocommerce->session->chosen_shipping_method ) && $woocommerce->session->chosen_shipping_method == 'local_pickup' ) { if ( ! empty( $this->settings['apply_base_tax'] ) && $this->settings['apply_base_tax'] == 'yes' ) { - + $country = $woocommerce->countries->get_base_country(); $state = $woocommerce->countries->get_base_state(); - - $address = array( $country, $state, '', '' ); + + $address = array( $country, $state, '', '' ); } } return $address; } - + /** * Refresh totals when chosen so we can refresh the tax if we are using local pickup. - * + * * @access public * @return void */ function method_chosen( $method ) { global $woocommerce; - + if ( $method == 'local_pickup' && ! empty( $this->settings['apply_base_tax'] ) && $this->settings['apply_base_tax'] == 'yes' ) { $woocommerce->cart->calculate_totals(); } } - + /** * clean function. * @@ -256,7 +256,7 @@ function method_chosen( $method ) { function clean( $code ) { return str_replace( '-', '', sanitize_title( $code ) ) . ( strstr( $code, '*' ) ? '*' : '' ); } - + } /** diff --git a/classes/shipping/class-wc-shipping.php b/classes/shipping/class-wc-shipping.php index 076c04fff29d7..459b0c026adff 100644 --- a/classes/shipping/class-wc-shipping.php +++ b/classes/shipping/class-wc-shipping.php @@ -181,8 +181,8 @@ function get_shipping_classes() { */ function calculate_shipping( $packages = array() ) { global $woocommerce; - - if ( ! $this->enabled || empty( $packages ) ) + + if ( ! $this->enabled || empty( $packages ) ) return; $this->shipping_total = 0; @@ -235,10 +235,10 @@ function calculate_shipping( $packages = array() ) { } $chosen_method = $_cheapest_method; } - + // Store chosen method $woocommerce->session->chosen_shipping_method = $chosen_method; - + // Do action for this chosen method do_action( 'woocommerce_shipping_method_chosen', $chosen_method ); } @@ -272,7 +272,7 @@ function calculate_shipping_for_package( $package = array() ) { $package['rates'] = array(); foreach ( $this->load_shipping_methods( $package ) as $shipping_method ) { - + if ( $shipping_method->is_available( $package ) ) { // Reset Rates @@ -280,7 +280,7 @@ function calculate_shipping_for_package( $package = array() ) { // Calculate Shipping for package $shipping_method->calculate_shipping( $package ); - + // Place rates in package array if ( ! empty( $shipping_method->rates ) && is_array( $shipping_method->rates ) ) foreach ( $shipping_method->rates as $rate ) @@ -288,7 +288,7 @@ function calculate_shipping_for_package( $package = array() ) { } } - + // Filter the calculated rates $package['rates'] = apply_filters( 'woocommerce_package_rates', $package['rates'], $package ); diff --git a/readme.txt b/readme.txt index 50d18b9fdfedf..90ea0e8aa073e 100644 --- a/readme.txt +++ b/readme.txt @@ -150,7 +150,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc == Changelog == -= 1.7.0 = += 1.7.0 = * Feature - Securi audited and secured. * Feature - Added sales by category report. * Feature - Added sales by coupon report (kudos Max Rice). @@ -179,7 +179,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Feature - Added the option to sell products individually (only allow 1 in the cart). * Feature - New shop page/category archive display settings, and the ability to change display per-category. * Feature - Allow shipping tax classes to be defined independent of items. https://github.com/woothemes/woocommerce/issues/1625 -* Feature - Redone order item storage making them easier (and faster) to access for reporting, and querying purchases. Huge performance gains for reports. Order items are no longer serialised - they are stored in there own table with meta. Existing data can be be updated on upgrade. +* Feature - Redone order item storage making them easier (and faster) to access for reporting, and querying purchases. Huge performance gains for reports. Order items are no longer serialised - they are stored in there own table with meta. Existing data can be be updated on upgrade. * Feature - Update weights/dimensions for variations if they differ. * Feature - is_order_received_page() courtesy of Lee Willis. * Feature - Inline saving of attributes to make creating variable products easier. @@ -1141,9 +1141,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc == Upgrade Notice == = 1.7.0 = -There are many improvements in this major release - see the changelog for full details. +There are many improvements in this major release - see the changelog for full details. -The biggest change is that we're redone order item storage making them easier (and faster) to access for reporting and querying purchases; there are huge performance gains for reports. +The biggest change is that we're redone order item storage making them easier (and faster) to access for reporting and querying purchases; there are huge performance gains for reports. Order items are no longer serialised data and store in meta - they are stored in there own table with their own meta. Existing data can be be updated upon upgrade (you will be prompted). You should backup before upgrading. diff --git a/shortcodes/shortcode-cart.php b/shortcodes/shortcode-cart.php index 8250a99e023c6..ff606d271c22b 100644 --- a/shortcodes/shortcode-cart.php +++ b/shortcodes/shortcode-cart.php @@ -83,7 +83,7 @@ function woocommerce_cart( $atts ) { $woocommerce->add_message( __( 'Shipping costs updated.', 'woocommerce' ) ); } - + do_action( 'woocommerce_calculated_shipping' ); } diff --git a/shortcodes/shortcode-init.php b/shortcodes/shortcode-init.php index b198650117f11..f7696790a5ba1 100644 --- a/shortcodes/shortcode-init.php +++ b/shortcodes/shortcode-init.php @@ -55,7 +55,7 @@ function woocommerce_product_category( $atts ){ ), $atts ) ); if ( ! $category ) return; - + $ordering_args = $woocommerce->query->get_catalog_ordering_args( $orderby, $order ); $args = array( @@ -81,7 +81,7 @@ function woocommerce_product_category( $atts ){ ) ) ); - + if ( isset( $ordering_args['meta_key'] ) ) { $args['meta_key'] = $ordering_args['meta_key']; } @@ -528,7 +528,7 @@ function woocommerce_sale_products( $atts ){ set_transient( 'wc_products_onsale', $product_ids_on_sale ); } - + $product_ids_on_sale[] = 0; $meta_query = array(); @@ -551,7 +551,7 @@ function woocommerce_sale_products( $atts ){ ob_start(); $products = new WP_Query( $args ); - + $woocommerce_loop['columns'] = $columns; if ( $products->have_posts() ) : ?> @@ -605,9 +605,9 @@ function woocommerce_best_selling_products( $atts ){ ); ob_start(); - + $products = new WP_Query( $args ); - + $woocommerce_loop['columns'] = $columns; if ( $products->have_posts() ) : ?> @@ -663,13 +663,13 @@ function woocommerce_top_rated_products( $atts ){ ); ob_start(); - + add_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' ); $products = new WP_Query( $args ); - + remove_filter( 'posts_clauses', 'woocommerce_order_by_rating_post_clauses' ); - + $woocommerce_loop['columns'] = $columns; if ( $products->have_posts() ) : ?> @@ -824,7 +824,7 @@ function woocommerce_messages_shortcode() { /** * woocommerce_order_by_rating_post_clauses function. - * + * * @access public * @param mixed $args * @return void diff --git a/templates/archive-product.php b/templates/archive-product.php index 75db8b74c81f2..0143186f456d5 100644 --- a/templates/archive-product.php +++ b/templates/archive-product.php @@ -35,7 +35,7 @@ - diff --git a/templates/cart/cart.php b/templates/cart/cart.php index eba2b890a46e2..42521cbb3e318 100755 --- a/templates/cart/cart.php +++ b/templates/cart/cart.php @@ -48,7 +48,7 @@ get_image(), $values, $cart_item_key ); - + if ( ! $_product->is_visible() || ( ! empty( $_product->variation_id ) && ! $_product->parent_is_visible() ) ) echo $thumbnail; else @@ -88,7 +88,7 @@ if ( $_product->is_sold_individually() ) { $product_quantity = sprintf( '1 ', $cart_item_key ); } else { - + $step = apply_filters( 'woocommerce_quantity_input_step', '1', $_product ); $min = apply_filters( 'woocommerce_quantity_input_min', '', $_product ); $max = apply_filters( 'woocommerce_quantity_input_max', $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(), $_product ); diff --git a/templates/cart/shipping-methods.php b/templates/cart/shipping-methods.php index 9a3e24f54c08b..3524d6c61ce07 100644 --- a/templates/cart/shipping-methods.php +++ b/templates/cart/shipping-methods.php @@ -1,4 +1,4 @@ -id ) . '" ' . selected( $method->id, $woocommerce->session->chosen_shipping_method, false ) . '>' . wp_kses_post( $method->full_label ) . ''; echo ''; - + // Show radio buttons for methods } else { diff --git a/templates/cart/totals.php b/templates/cart/totals.php index 7e1f2f3424593..464f4c44c4b58 100644 --- a/templates/cart/totals.php +++ b/templates/cart/totals.php @@ -37,81 +37,81 @@ - + cart->needs_shipping() && $woocommerce->cart->show_shipping() && ( $available_methods || get_option( 'woocommerce_enable_shipping_calc' ) == 'yes' ) ) : ?> - + $available_methods ) ); ?> - + - + cart->get_fees() as $fee ) : ?> - + name ?> - cart->display_totals_ex_tax || ! $woocommerce->cart->prices_include_tax ) echo woocommerce_price( $fee->amount ); else echo woocommerce_price( $fee->amount + $fee->tax ); ?> - + cart->display_totals_ex_tax || ! $woocommerce->cart->prices_include_tax ) { if ( $woocommerce->cart->get_cart_tax() ) { - + $taxes = $woocommerce->cart->get_formatted_taxes(); - + if ( sizeof( $taxes ) > 0 ) { - + $has_compound_tax = false; - + foreach ( $taxes as $key => $tax ) { if ( $woocommerce->cart->tax->is_compound( $key ) ) { - $has_compound_tax = true; + $has_compound_tax = true; continue; } - + echo ' ' . $woocommerce->cart->tax->get_rate_label( $key ) . ' ' . $tax . ' '; } - + if ( $has_compound_tax ) { - + echo ' ' . __( 'Subtotal', 'woocommerce' ) . ' ' . $woocommerce->cart->get_cart_subtotal( true ) . ' '; } - + foreach ( $taxes as $key => $tax ) { - if ( ! $woocommerce->cart->tax->is_compound( $key ) ) + if ( ! $woocommerce->cart->tax->is_compound( $key ) ) continue; - + echo ' ' . $woocommerce->cart->tax->get_rate_label( $key ) . ' ' . $tax . ' '; } - - } else { - + + } else { + echo ' ' . __( 'Tax', 'woocommerce' ) . ' ' . $woocommerce->cart->get_cart_tax() . ' '; } - + } elseif ( get_option( 'woocommerce_display_cart_taxes_if_zero' ) == 'yes' ) { - + echo ' ' . __( 'Tax', 'woocommerce' ) . ' ' . _x( 'N/A', 'Relating to tax', 'woocommerce' ) . ' @@ -121,7 +121,7 @@ ?> cart->get_discounts_after_tax() ) : ?> - + -cart->get_discounts_after_tax(); ?> @@ -136,17 +136,17 @@ cart->display_totals_ex_tax && $woocommerce->cart->prices_include_tax ) { - + if ( $woocommerce->cart->get_cart_tax() ) { $tax_string_array = array(); $taxes = $woocommerce->cart->get_formatted_taxes(); - + if ( sizeof( $taxes ) > 0 ) foreach ( $taxes as $key => $tax ) $tax_string_array[] = sprintf( '%s %s', $tax, $woocommerce->cart->tax->get_rate_label( $key ) ); else $tax_string_array[] = sprintf( '%s tax', $tax ); - + if ( ! empty( $tax_string_array ) ) { echo '' . sprintf( __( '(Includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . ''; } @@ -162,7 +162,7 @@ cart->get_cart_tax() ) : ?> - +

    customer->is_customer_outside_base() && ! $woocommerce->customer->has_calculated_shipping() ) ? sprintf( ' ' . __( ' (taxes estimated for %s)', 'woocommerce' ), $woocommerce->countries->estimated_for_prefix() . __( $woocommerce->countries->countries[ $woocommerce->countries->get_base_country() ], 'woocommerce' ) ) : ''; @@ -170,7 +170,7 @@ printf( __( 'Note: Shipping and taxes are estimated%s and will be updated during checkout based on your billing and shipping information.', 'woocommerce' ), $estimated_text ); ?>

    - + cart->needs_shipping() ) : ?> diff --git a/templates/checkout/review-order.php b/templates/checkout/review-order.php index 5cfd020a665b7..c15a2f3bed40c 100644 --- a/templates/checkout/review-order.php +++ b/templates/checkout/review-order.php @@ -42,28 +42,28 @@ cart->needs_shipping() && $woocommerce->cart->show_shipping() ) : ?> - + $available_methods ) ); ?> - + - + cart->get_fees() as $fee ) : ?> - + name ?> - cart->display_totals_ex_tax || ! $woocommerce->cart->prices_include_tax ) echo woocommerce_price( $fee->amount ); else echo woocommerce_price( $fee->amount + $fee->tax ); ?> - + $tax ) { if ( $woocommerce->cart->tax->is_compound( $key ) ) { - $has_compound_tax = true; + $has_compound_tax = true; continue; } ?> @@ -100,7 +100,7 @@ } foreach ( $taxes as $key => $tax ) { - if ( ! $woocommerce->cart->tax->is_compound( $key ) ) + if ( ! $woocommerce->cart->tax->is_compound( $key ) ) continue; ?> @@ -110,7 +110,7 @@ @@ -118,7 +118,7 @@ @@ -148,11 +148,11 @@ cart->display_totals_ex_tax && $woocommerce->cart->prices_include_tax ) { - + if ( $woocommerce->cart->get_cart_tax() ) { $tax_string_array = array(); $taxes = $woocommerce->cart->get_formatted_taxes(); - + if ( sizeof( $taxes ) > 0 ) { foreach ( $taxes as $key => $tax ) { $tax_string_array[] = sprintf( '%s %s', $tax, $woocommerce->cart->tax->get_rate_label( $key ) ); @@ -160,14 +160,14 @@ } else { $tax_string_array[] = sprintf( '%s tax', $tax ); } - + if ( ! empty( $tax_string_array ) ) { - ?> @@ -206,7 +206,7 @@ // Chosen Method if (sizeof($available_gateways)) : $default_gateway = get_option('woocommerce_default_gateway'); - + if ( isset( $woocommerce->session->chosen_payment_method ) && isset( $available_gateways[ $woocommerce->session->chosen_payment_method ] ) ) { $available_gateways[ $woocommerce->session->chosen_payment_method ]->set_current(); } elseif ( isset( $available_gateways[ $default_gateway ] ) ) { @@ -214,7 +214,7 @@ } else { current( $available_gateways )->set_current(); } - + endif; foreach ($available_gateways as $gateway ) : ?> diff --git a/templates/emails/email-footer.php b/templates/emails/email-footer.php index 8e606f147cb48..91d35933e6b7f 100644 --- a/templates/emails/email-footer.php +++ b/templates/emails/email-footer.php @@ -21,11 +21,11 @@ "; $credit = " - border:0; - color: $base_lighter_40; - font-family: Arial; - font-size:12px; - line-height:125%; + border:0; + color: $base_lighter_40; + font-family: Arial; + font-size:12px; + line-height:125%; text-align:center; "; ?> diff --git a/templates/emails/email-header.php b/templates/emails/email-header.php index 8e6aa0c90340c..ad2cf7d640ff9 100644 --- a/templates/emails/email-header.php +++ b/templates/emails/email-header.php @@ -8,7 +8,7 @@ */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly - + // Load colours $bg = get_option( 'woocommerce_email_background_color' ); $body = get_option( 'woocommerce_email_body_background_color' ); @@ -22,8 +22,8 @@ // For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something. $wrapper = " - background-color: " . esc_attr( $bg ) . "; - width:100%; + background-color: " . esc_attr( $bg ) . "; + width:100%; -webkit-text-size-adjust:none !important; margin:0; padding: 70px 0 70px 0; @@ -31,12 +31,12 @@ $template_container = " -webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.025) !important; box-shadow:0 0 0 3px rgba(0,0,0,0.025) !important; - -webkit-border-radius:6px !important; - border-radius:6px !important; + -webkit-border-radius:6px !important; + border-radius:6px !important; background-color: " . esc_attr( $body ) . "; border: 1px solid $bg_darker_10; - -webkit-border-radius:6px !important; - border-radius:6px !important; + -webkit-border-radius:6px !important; + border-radius:6px !important; "; $template_header = " background-color: " . esc_attr( $base ) ."; @@ -46,9 +46,9 @@ border-top-left-radius:6px !important; border-top-right-radius:6px !important; border-bottom: 0; - font-family:Arial; - font-weight:bold; - line-height:100%; + font-family:Arial; + font-weight:bold; + line-height:100%; vertical-align:middle; "; $body_content = " @@ -64,15 +64,15 @@ text-align:left; "; $header_content_h1 = " - color: " . esc_attr( $base_text ) . "; - margin:0; + color: " . esc_attr( $base_text ) . "; + margin:0; padding: 28px 24px; text-shadow: 0 1px 0 $base_lighter_20; - display:block; - font-family:Arial; - font-size:30px; - font-weight:bold; - text-align:left; + display:block; + font-family:Arial; + font-size:30px; + font-weight:bold; + text-align:left; line-height: 150%; "; ?> diff --git a/templates/emails/email-order-items.php b/templates/emails/email-order-items.php index e18a2b04b6665..0acc4222ac4c6 100644 --- a/templates/emails/email-order-items.php +++ b/templates/emails/email-order-items.php @@ -38,7 +38,7 @@ echo '
    '; if ( count( $download_file_urls ) > 1 ) { echo sprintf( __('Download %d:', 'woocommerce' ), $i + 1 ); - } elseif ( $i == 0 ) + } elseif ( $i == 0 ) echo __( 'Download:', 'woocommerce' ); echo ' ' . $download_file_url . ''; endforeach; diff --git a/templates/emails/plain/admin-new-order.php b/templates/emails/plain/admin-new-order.php index e29f1fccd8d13..5b725285cdc2c 100644 --- a/templates/emails/plain/admin-new-order.php +++ b/templates/emails/plain/admin-new-order.php @@ -10,7 +10,7 @@ echo $email_heading . "\n\n"; -echo sprintf( __( 'You have received an order from %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ) . "\n\n"; +echo sprintf( __( 'You have received an order from %s. Their order is as follows:', 'woocommerce' ), $order->billing_first_name . ' ' . $order->billing_last_name ) . "\n\n"; echo "****************************************************\n\n"; @@ -21,7 +21,7 @@ do_action( 'woocommerce_email_order_meta', $order, true, true ); -echo "\n" . $order->email_order_items_table( false, true, '', '', '', true ); +echo "\n" . $order->email_order_items_table( false, true, '', '', '', true ); echo "----------\n\n"; @@ -38,10 +38,10 @@ _e( 'Customer details', 'woocommerce' ); if ( $order->billing_email ) - echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; + echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; if ( $order->billing_phone ) - echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; + echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; woocommerce_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) ); diff --git a/templates/emails/plain/customer-completed-order.php b/templates/emails/plain/customer-completed-order.php index 6f97684328199..3277799564bf3 100644 --- a/templates/emails/plain/customer-completed-order.php +++ b/templates/emails/plain/customer-completed-order.php @@ -10,7 +10,7 @@ echo $email_heading . "\n\n"; -echo sprintf( __( "Hi there. Your recent order on %s has been completed. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ) . "\n\n"; +echo sprintf( __( "Hi there. Your recent order on %s has been completed. Your order details are shown below for your reference:", 'woocommerce' ), get_option( 'blogname' ) ) . "\n\n"; echo "****************************************************\n\n"; @@ -38,10 +38,10 @@ echo __( 'Your details', 'woocommerce' ) . "\n\n"; if ( $order->billing_email ) - echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; + echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; if ( $order->billing_phone ) - echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; + echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; woocommerce_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) ); diff --git a/templates/emails/plain/customer-invoice.php b/templates/emails/plain/customer-invoice.php index 0a554edc06b28..c006159cd247d 100644 --- a/templates/emails/plain/customer-invoice.php +++ b/templates/emails/plain/customer-invoice.php @@ -11,7 +11,7 @@ echo $email_heading . "\n\n"; if ( $order->status == 'pending' ) - echo sprintf( __( 'An order has been created for you on %s. To pay for this order please use the following link: %s', 'woocommerce' ), get_bloginfo( 'name' ), $order->get_checkout_payment_url() ) . "\n\n"; + echo sprintf( __( 'An order has been created for you on %s. To pay for this order please use the following link: %s', 'woocommerce' ), get_bloginfo( 'name' ), $order->get_checkout_payment_url() ) . "\n\n"; echo "****************************************************\n\n"; diff --git a/templates/emails/plain/customer-new-account.php b/templates/emails/plain/customer-new-account.php index 62064c8375e56..95c0610a153d9 100644 --- a/templates/emails/plain/customer-new-account.php +++ b/templates/emails/plain/customer-new-account.php @@ -10,9 +10,9 @@ echo $email_heading . "\n\n"; -echo sprintf( __( "Thanks for creating an account on %s. Your username is %s.", 'woocommerce' ), $blogname, $user_login ) . "\n\n"; +echo sprintf( __( "Thanks for creating an account on %s. Your username is %s.", 'woocommerce' ), $blogname, $user_login ) . "\n\n"; -echo sprintf(__( 'You can access your account area here: %s.', 'woocommerce' ), get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) . "\n\n"; +echo sprintf(__( 'You can access your account area here: %s.', 'woocommerce' ), get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) . "\n\n"; echo "\n****************************************************\n\n"; diff --git a/templates/emails/plain/customer-note.php b/templates/emails/plain/customer-note.php index a0233106ed610..c6b91cfbabc84 100644 --- a/templates/emails/plain/customer-note.php +++ b/templates/emails/plain/customer-note.php @@ -46,10 +46,10 @@ echo __( 'Your details', 'woocommerce' ) . "\n\n"; if ( $order->billing_email ) - echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; + echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; if ( $order->billing_phone ) - echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; + echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; woocommerce_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) ); diff --git a/templates/emails/plain/customer-processing-order.php b/templates/emails/plain/customer-processing-order.php index e95a6b2d1cc15..e122d1697072d 100644 --- a/templates/emails/plain/customer-processing-order.php +++ b/templates/emails/plain/customer-processing-order.php @@ -10,7 +10,7 @@ echo $email_heading . "\n\n"; -echo __( "Your order has been received and is now being processed. Your order details are shown below for your reference:", 'woocommerce' ) . "\n\n"; +echo __( "Your order has been received and is now being processed. Your order details are shown below for your reference:", 'woocommerce' ) . "\n\n"; echo "****************************************************\n\n"; @@ -21,7 +21,7 @@ do_action( 'woocommerce_email_order_meta', $order, false, true ); -echo "\n" . $order->email_order_items_table( $order->is_download_permitted(), true, ($order->status=='processing') ? true : false, '', '', true ); +echo "\n" . $order->email_order_items_table( $order->is_download_permitted(), true, ($order->status=='processing') ? true : false, '', '', true ); echo "----------\n\n"; @@ -38,10 +38,10 @@ echo __( 'Your details', 'woocommerce' ) . "\n\n"; if ( $order->billing_email ) - echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; + echo __( 'Email:', 'woocommerce' ); echo $order->billing_email. "\n"; if ( $order->billing_phone ) - echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; + echo __( 'Tel:', 'woocommerce' ); ?> billing_phone. "\n"; woocommerce_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) ); diff --git a/templates/emails/plain/email-order-items.php b/templates/emails/plain/email-order-items.php index b335256e0e443..5b1c2c2bd7331 100644 --- a/templates/emails/plain/email-order-items.php +++ b/templates/emails/plain/email-order-items.php @@ -16,20 +16,20 @@ // Get/prep product data $_product = $order->get_product_from_item( $item ); $item_meta = new WC_Order_Item_Meta( $item['item_meta'] ); - + // Title, sku, qty, price echo apply_filters( 'woocommerce_order_product_title', $item['name'], $_product ); echo $show_sku && $_product->get_sku() ? ' (#' . $_product->get_sku() . ')' : ''; - + // Variation echo $item_meta->meta ? "\n" . nl2br( $item_meta->display( true, true ) ) : ''; - + // Quantity echo "\n" . sprintf( __( 'Quantity: %s', 'woocommerce' ), $item['qty'] ); - + // Cost echo "\n" . sprintf( __( 'Cost: %s', 'woocommerce' ), $order->get_formatted_line_subtotal( $item ) ); - + // Download URLs if ( $show_download_links && $_product->exists() && $_product->is_downloadable() ) echo "\n" . implode( ', ', $order->get_downloadable_file_urls( $item['product_id'], $item['variation_id'], $item ) ); @@ -37,7 +37,7 @@ // Note if ( $show_purchase_note && $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) echo "\n" . nl2br( $purchase_note ); - + echo "\n\n"; endforeach; \ No newline at end of file diff --git a/templates/loop/pagination.php b/templates/loop/pagination.php index 06e5d9e0bfd46..b5c0a7584f6a4 100644 --- a/templates/loop/pagination.php +++ b/templates/loop/pagination.php @@ -12,7 +12,7 @@ global $wp_query; if ( $wp_query->max_num_pages <= 1 ) - return; + return; ?>