Skip to content

Commit

Permalink
Re-name PHP4 constructors to PHP5-style. Add some visibility keywords.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeales committed Jan 18, 2016
1 parent a85a3b9 commit da80328
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion wpsc-admin/includes/product-functions.php
Expand Up @@ -1073,7 +1073,7 @@ class wpsc_variation_combinator {
var $reprocessed_array = array();
var $combinations= array();

function wpsc_variation_combinator($variation_sets) {
public function __construct($variation_sets) {
if( $variation_sets ) {
foreach($variation_sets as $variation_set_id => $variation_set) {
$this->variation_sets[] = absint($variation_set_id);
Expand Down
10 changes: 5 additions & 5 deletions wpsc-components/merchant-core-v2/classes/wpsc-gateways.php
Expand Up @@ -11,7 +11,7 @@ class wpsc_gateways {
var $current_gateway = -1;
var $in_the_loop = false;

function wpsc_gateways() {
public function __construct() {
global $nzshpcrt_gateways;

$gateway_options = get_option( 'custom_gateway_options' );
Expand All @@ -32,20 +32,20 @@ function wpsc_gateways() {
/**
* checkout loop methods
*/
function next_gateway() {
public function next_gateway() {
$this->current_gateway++;
$this->gateway = $this->wpsc_gateways[$this->current_gateway];
return $this->gateway;
}

function the_gateway() {
public function the_gateway() {
$this->in_the_loop = true;
$this->gateway = $this->next_gateway();
if ( $this->current_gateway == 0 ) // loop has just started
do_action( 'wpsc_checkout_loop_start' );
}

function have_gateways() {
public function have_gateways() {
if ( $this->current_gateway + 1 < $this->gateway_count ) {
return true;
} else if ( $this->current_gateway + 1 == $this->gateway_count && $this->gateway_count > 0 ) {
Expand All @@ -58,7 +58,7 @@ function have_gateways() {
return false;
}

function rewind_gateways() {
public function rewind_gateways() {
$this->current_gateway = -1;
if ( $this->gateway_count > 0 ) {
$this->gateway = $this->wpsc_gateways[0];
Expand Down
10 changes: 5 additions & 5 deletions wpsc-components/theme-engine-v1/classes/breadcrumbs.php
Expand Up @@ -201,7 +201,7 @@ class wpsc_breadcrumbs {
* @access public
* @return void
*/
function wpsc_breadcrumbs() {
public function __construct() {
global $wp_query, $wpsc_query;
$this->breadcrumbs = array();
$query_data = Array();
Expand Down Expand Up @@ -260,7 +260,7 @@ function wpsc_breadcrumbs() {
* @access public
* @return void
*/
function next_breadcrumbs() {
public function next_breadcrumbs() {
$this->current_breadcrumb++;
$this->breadcrumb = $this->breadcrumbs[$this->current_breadcrumb];
return $this->breadcrumb;
Expand All @@ -273,7 +273,7 @@ function next_breadcrumbs() {
* @access public
* @return void
*/
function the_breadcrumb() {
public function the_breadcrumb() {
$this->breadcrumb = $this->next_breadcrumbs();
}

Expand All @@ -283,7 +283,7 @@ function the_breadcrumb() {
* @access public
* @return void
*/
function have_breadcrumbs() {
public function have_breadcrumbs() {
if ($this->current_breadcrumb + 1 < $this->breadcrumb_count) {
return true;
} else if ($this->current_breadcrumb + 1 == $this->breadcrumb_count && $this->breadcrumb_count > 0) {
Expand All @@ -298,7 +298,7 @@ function have_breadcrumbs() {
* @access public
* @return void
*/
function rewind_breadcrumbs() {
public function rewind_breadcrumbs() {
$this->current_breadcrumb = -1;
if ($this->breadcrumb_count > 0) {
$this->breadcrumb = $this->breadcrumbs[0];
Expand Down
Expand Up @@ -14,7 +14,7 @@ class wpsc_products_by_category {
* @param mixed $query
* @return void
*/
function wpsc_products_by_category( $query ) {
function __construct( $query ) {

_wpsc_doing_it_wrong( 'wpsc_products_by_category', __( 'This class is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce' ), '4.0' );

Expand Down
Expand Up @@ -12,7 +12,7 @@ class WP_Widget_Shopping_Cart extends WP_Widget {
/**
* Widget Constuctor
*/
function WP_Widget_Shopping_Cart() {
public function __construct() {

$widget_ops = array(
'classname' => 'widget_wpsc_shopping_cart',
Expand All @@ -30,7 +30,7 @@ function WP_Widget_Shopping_Cart() {
* @param $instance (array) Widget values.
*
*/
function widget( $args, $instance ) {
public function widget( $args, $instance ) {

extract( $args );

Expand Down Expand Up @@ -101,7 +101,7 @@ function widget( $args, $instance ) {
*
* @return (array) New values.
*/
function update( $new_instance, $old_instance ) {
public function update( $new_instance, $old_instance ) {

$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
Expand All @@ -114,7 +114,7 @@ function update( $new_instance, $old_instance ) {
*
* @param $instance (array) Widget values.
*/
function form( $instance ) {
public function form( $instance ) {
global $wpdb;

// Defaults
Expand Down
8 changes: 4 additions & 4 deletions wpsc-components/theme-engine-v1/widgets/specials_widget.php
Expand Up @@ -12,7 +12,7 @@ class WP_Widget_Product_Specials extends WP_Widget {
/**
* Widget Constuctor
*/
function WP_Widget_Product_Specials() {
public function __construct() {

$widget_ops = array(
'classname' => 'widget_wpsc_product_specials',
Expand All @@ -31,7 +31,7 @@ function WP_Widget_Product_Specials() {
*
* @todo Add individual capability checks for each menu item rather than just manage_options.
*/
function widget( $args, $instance ) {
public function widget( $args, $instance ) {

global $wpdb, $table_prefix;

Expand All @@ -55,7 +55,7 @@ function widget( $args, $instance ) {
*
* @return (array) New values.
*/
function update( $new_instance, $old_instance ) {
public function update( $new_instance, $old_instance ) {

$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
Expand All @@ -74,7 +74,7 @@ function update( $new_instance, $old_instance ) {
*
* @param $instance (array) Widget values.
*/
function form( $instance ) {
public function form( $instance ) {

global $wpdb;

Expand Down
2 changes: 1 addition & 1 deletion wpsc-core/wpsc-deprecated.php
Expand Up @@ -483,7 +483,7 @@ function wpsc_total_product_count() {
*
*/
class WPSC_Query extends WP_Query {
function WPSC_Query( $query = '' ) {
public function __construct( $query = '' ) {
_wpsc_deprecated_function( __FUNCTION__, '3.8', 'WP_Query()' );
$query = wp_parse_args( $query );
$query['post_type'] = 'wpsc-product';
Expand Down
2 changes: 1 addition & 1 deletion wpsc-includes/cart.class.php
Expand Up @@ -90,7 +90,7 @@ class wpsc_cart {
public $_signature = '';


function wpsc_cart() {
public function __construct() {
$coupon = 'percentage';
$this->update_location();
$this->wpsc_refresh_cart_items();
Expand Down
2 changes: 1 addition & 1 deletion wpsc-includes/checkout.class.php
Expand Up @@ -162,7 +162,7 @@ class wpsc_checkout {
* wpsc_checkout method, gets the tax rate as a percentage, based on the selected country and region
* @access public
*/
function wpsc_checkout( $checkout_set = 0 ) {
public function __construct( $checkout_set = 0 ) {
global $wpdb;
$this->checkout_items = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `" . WPSC_TABLE_CHECKOUT_FORMS . "` WHERE `active` = '1' AND `checkout_set`= %s ORDER BY `checkout_order`;", $checkout_set ) );

Expand Down
2 changes: 1 addition & 1 deletion wpsc-includes/coupons.class.php
Expand Up @@ -69,7 +69,7 @@ class wpsc_coupons {
* @param string code (optional) the coupon code you would like to use.
* @return bool True if coupon code exists, False otherwise.
*/
function wpsc_coupons( $code = '' ) {
public function __construct( $code = '' ) {
global $wpdb;

if ( empty( $code ) ) {
Expand Down
4 changes: 2 additions & 2 deletions wpsc-includes/purchaselogs.class.php
Expand Up @@ -695,7 +695,7 @@ class wpsc_purchaselogs {
var $end_timestamp;

/* Constructor function */
function wpsc_purchaselogs() {
public function __construct() {
$this->getall_formdata();
if ( !isset( $_GET['view_purchlogs_by'] ) && !isset( $_GET['purchlogs_searchbox'] ) ) {
$dates = $this->getdates();
Expand Down Expand Up @@ -1010,7 +1010,7 @@ class wpsc_purchaselogs_items {
var $additional_fields = array();


function wpsc_purchaselogs_items( $id ) {
public function __construct( $id ) {
$this->purchlogid = $id;
$this->get_purchlog_details();
}
Expand Down
10 changes: 5 additions & 5 deletions wpsc-includes/shipping.helper.php
Expand Up @@ -374,10 +374,10 @@ class ASHPackage {
* The constructor for the ASHPackage class
* Accepts an arguments array to fill out the class on initialization
*
* @since 0.0.1
* @since 3.11.3
* @param array $args
*/
function ASHPackage(array $args = array()){
public function __construct(array $args = array()){
foreach($args as $key=>$value){
$this->$key=$value;
}
Expand Down Expand Up @@ -483,9 +483,9 @@ class ASHShipment{
/**
* Constructor for the ASHShipment class
*
* @since 0.0.1
* @since 3.11.3
*/
function ASHShipment(){
public function __construct(){
}

/**
Expand Down Expand Up @@ -564,7 +564,7 @@ class ASH{
* General constructor for ASH class
*
*/
function ASH(){
public function _construct(){

This comment has been minimized.

Copy link
@meloniq

meloniq Feb 3, 2016

Contributor

Missing one underscore character in constructor name _construct() instead of __construct()

This comment has been minimized.

Copy link
@mihaijoldis

mihaijoldis Feb 3, 2016

Contributor

Thanks. Fixed

}

/**
Expand Down
2 changes: 1 addition & 1 deletion wpsc-includes/theming.class.php
Expand Up @@ -37,7 +37,7 @@ class wpsc_theming {
*
* @return
*/
function wpsc_theming() {
public function __construct() {
check_admin_referer( 'wpsc_copy_themes' );

$this->active_wp_style = trailingslashit( get_stylesheet_directory() );
Expand Down
2 changes: 1 addition & 1 deletion wpsc-shipping/flatrate.php
Expand Up @@ -14,7 +14,7 @@ class flatrate {
*
* @return boolean Always returns true.
*/
function flatrate() {
public function __construct() {
$this->internal_name = "flatrate";
$this->name= __( "Flat Rate", 'wp-e-commerce' );
$this->is_external = false;
Expand Down
2 changes: 1 addition & 1 deletion wpsc-shipping/tablerate.php
Expand Up @@ -15,7 +15,7 @@ class tablerate {
*
* @return boolean Always returns true.
*/
function tablerate() {
public function __construct() {
$this->internal_name = "tablerate";
$this->name = __( "Table Rate", 'wp-e-commerce' );
$this->is_external=false;
Expand Down
2 changes: 1 addition & 1 deletion wpsc-shipping/ups_20.php
Expand Up @@ -18,7 +18,7 @@ class ash_ups {
public $drop_types = array();
public $cust_types = array();

function ash_ups () {
public function __construct() {
$this->internal_name = 'ups';
$this->name = _x( 'UPS', 'Shipping Module', 'wp-e-commerce' );
$this->is_external = true;
Expand Down
2 changes: 1 addition & 1 deletion wpsc-shipping/usps_20.php
Expand Up @@ -70,7 +70,7 @@ class ash_usps {
* Automatically loads services that are available into the class instance
* @since 1.0
*/
function ash_usps() {
public function __construct() {
$this->_load_services();
return TRUE;
}
Expand Down

0 comments on commit da80328

Please sign in to comment.