Permalink
Browse files

Use PHP 5 class constructors (compatibility with WordPress 4.3).

  • Loading branch information...
benhuson committed Aug 18, 2015
1 parent 0a0dce0 commit 1a0cb52fc83155d4b223981eef11f8fce48437c8
View
@@ -10,7 +10,7 @@ class WPGeo_Admin {
var $map;
var $plugin_message = '';
- function WPGeo_Admin() {
+ function __construct() {
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'admin_head', array( $this, 'admin_head' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
@@ -22,7 +22,14 @@ function WPGeo_Admin() {
add_action( 'after_plugin_row', array( $this, 'after_plugin_row' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Admin() {
+ $this->__construct();
+ }
+
/**
* Admin Init
*/
View
@@ -11,11 +11,18 @@ class WPGeo_Dashboard {
/**
* Constructor
*/
- function WPGeo_Dashboard() {
+ function __construct() {
add_action( 'wp_dashboard_setup', array( $this, 'register_widget' ) );
add_filter( 'wp_dashboard_widgets', array( $this, 'add_widget' ) );
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Dashboard() {
+ $this->__construct();
+ }
+
/**
* Register the dashboard widget
*/
View
@@ -8,9 +8,16 @@ class WPGeo_Editor {
/**
* Constructor
*/
+ function __construct() {
+ }
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
function WPGeo_Editor() {
+ $this->__construct();
}
-
+
/**
* Add Buttons
* This function add buttons to the Rich Editor.
View
@@ -8,11 +8,18 @@ class WPGeo_Settings {
/**
* Constructor
*/
- function WPGeo_Settings() {
+ function __construct() {
$this->register_settings();
$this->filter_plugin_action_links();
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Settings() {
+ $this->__construct();
+ }
+
/**
* Settings API
*/
@@ -8,7 +8,7 @@ class WPGeo_API_GoogleMapsV2 extends WPGeo_API {
/**
* Constructor
*/
- function WPGeo_API_GoogleMapsV2() {
+ function __construct() {
add_action( 'wpgeo_register_scripts', array( $this, 'wpgeo_register_scripts' ) );
add_action( 'wpgeo_enqueue_scripts', array( $this, 'wpgeo_enqueue_scripts' ) );
add_filter( 'wpgeo_api_string', array( $this, 'wpgeo_api_string' ), 10, 3 );
@@ -17,6 +17,13 @@ function WPGeo_API_GoogleMapsV2() {
add_action( 'wpgeo_widget_form_fields', array( $this, 'display_widget_api_key_message' ), 1 );
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_API_GoogleMapsV2() {
+ $this->__construct();
+ }
+
/**
* Register WP Geo Scripts
*
@@ -8,7 +8,7 @@ class WPGeo_API_GoogleMapsV3 extends WPGeo_API {
/**
* Constructor
*/
- function WPGeo_API_GoogleMapsV3() {
+ function __construct() {
add_action( 'wpgeo_register_scripts', array( $this, 'wpgeo_register_scripts' ) );
add_action( 'wpgeo_enqueue_scripts', array( $this, 'wpgeo_enqueue_scripts' ) );
add_filter( 'wpgeo_api_string', array( $this, 'wpgeo_api_string' ), 10, 3 );
@@ -18,6 +18,13 @@ function WPGeo_API_GoogleMapsV3() {
add_filter( 'wpgeo_check_google_api_key', array( $this, 'check_google_api_key' ) );
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_API_GoogleMapsV3() {
+ $this->__construct();
+ }
+
/**
* Register WP Geo Scripts
*
View
@@ -9,7 +9,14 @@ class WPGeo_API {
/**
* Constructor
*/
+ function __construct() {
+ }
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
function WPGeo_API() {
+ $this->__construct();
}
/**
View
@@ -14,7 +14,7 @@ class WPGeo_Coord {
* @param float $latitude Latitude.
* @param float $longitude Longitude.
*/
- function WPGeo_Coord( $latitude, $longitude ) {
+ function __construct( $latitude, $longitude ) {
$this->latitude = $latitude;
$this->longitude = $longitude;
if ( $this->is_valid_coord() ) {
@@ -23,6 +23,13 @@ function WPGeo_Coord( $latitude, $longitude ) {
}
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Coord() {
+ $this->__construct();
+ }
+
/**
* Is Valid Geo Coord
*
View
@@ -8,10 +8,17 @@ class WPGeo_Feeds {
/**
* Constructor
*/
- function WPGeo_Feeds() {
+ function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Feeds() {
+ $this->__construct();
+ }
+
/**
* Initialise WP Geo feeds
*/
View
@@ -31,7 +31,7 @@ class WPGeo_Map {
*
* @param string $id Map ID.
*/
- function WPGeo_Map( $id = 0 ) {
+ function __construct( $id = 0 ) {
$wp_geo_options = get_option( 'wp_geo_options' );
$this->id = $this->validate_map_id( $id );
@@ -42,7 +42,14 @@ function WPGeo_Map( $id = 0 ) {
$this->mapcentre = new WPGeo_Coord( $wp_geo_options['default_map_latitude'], $wp_geo_options['default_map_longitude'] );
$this->mapcontrol = $wp_geo_options['default_map_control'];
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Map() {
+ $this->__construct();
+ }
+
/**
* Validate Map ID
*
View
@@ -12,10 +12,17 @@ class WPGeo_Maps {
/**
* Constructor
*/
- function WPGeo_Maps() {
+ function __construct() {
$this->maps = array();
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Maps() {
+ $this->__construct();
+ }
+
/**
* Add Map
* Adds a WPGeo_Map object to the maps array.
View
@@ -21,7 +21,7 @@ class WPGeo_Marker {
/**
* Constructor
*/
- function WPGeo_Marker( $id, $name, $description, $width, $height, $anchorX, $anchorY, $image, $shadow = null ) {
+ function __construct( $id, $name, $description, $width, $height, $anchorX, $anchorY, $image, $shadow = null ) {
$this->set_id( $id );
$this->set_name( $name );
$this->set_description( $description );
@@ -31,6 +31,13 @@ function WPGeo_Marker( $id, $name, $description, $width, $height, $anchorX, $anc
$this->set_shadow( $shadow );
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Marker() {
+ $this->__construct();
+ }
+
/**
* Set the marker's ID.
*
View
@@ -14,7 +14,7 @@ class WPGeo_Markers {
/**
* Constructor
*/
- function WPGeo_Markers() {
+ function __construct() {
// Marker directories abstraction. props Alain (alm)
$upl = wp_upload_dir();
@@ -56,6 +56,13 @@ function WPGeo_Markers() {
);
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Markers() {
+ $this->__construct();
+ }
+
/**
* Get Image URL
*
View
@@ -17,7 +17,7 @@ class WPGeo_Point {
* @param object $coord WPGeo_Coord object.
* @param array $args Point arguments.
*/
- function WPGeo_Point( $coord, $args = null ) {
+ function __construct( $coord, $args = null ) {
$args = wp_parse_args( $args, array(
'icon' => 'large',
'title' => '',
@@ -30,6 +30,13 @@ function WPGeo_Point( $coord, $args = null ) {
$this->link = $args['link'];
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Point() {
+ $this->__construct();
+ }
+
/**
* Get Coord
*
View
@@ -16,7 +16,7 @@ class WPGeo_Polyline {
*
* @param array $args Args.
*/
- function WPGeo_Polyline( $args = null ) {
+ function __construct( $args = null ) {
$args = wp_parse_args( $args, array(
'coords' => $this->coords,
'geodesic' => $this->geodesic,
@@ -31,6 +31,13 @@ function WPGeo_Polyline( $args = null ) {
$this->opacity = $args['opacity'];
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Polyline() {
+ $this->__construct();
+ }
+
/**
* Add Coord
*
View
@@ -9,12 +9,19 @@ class WPGeo_Query {
/**
* Constructor
*/
- function WPGeo_Query() {
+ function __construct() {
add_filter( 'post_limits', array( $this, 'post_limits' ) );
add_filter( 'posts_join', array( $this, 'posts_join' ) );
add_filter( 'posts_where', array( $this, 'posts_where' ) );
}
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Query() {
+ $this->__construct();
+ }
+
/**
* Get Custom Field Posts Join
* Join custom fields on to results.
View
@@ -24,7 +24,7 @@ class WPGeo {
/**
* Constructor
*/
- function WPGeo() {
+ function __construct() {
// API
$wp_geo_options = get_option( 'wp_geo_options' );
@@ -65,7 +65,14 @@ function WPGeo() {
$this->admin = new WPGeo_Admin();
}
}
-
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo() {
+ $this->__construct();
+ }
+
/**
* Filter 'wp_geo_options' value to ensure all defaults are set.
*
View
@@ -14,8 +14,8 @@ class WPGeo_Category_Map_Widget extends WPGeo_Widget {
/**
* Constuctor
*/
- function WPGeo_Category_Map_Widget() {
- $this->WPGeo_Widget(
+ function __construct() {
+ parent::__construct(
'wpgeo_category_map_widget',
__( 'WP Geo Category Map', 'wp-geo' ),
array(
@@ -24,6 +24,13 @@ function WPGeo_Category_Map_Widget() {
)
);
}
+
+ /**
+ * Deprecated PHP 4 Constructor
+ */
+ function WPGeo_Category_Map_Widget() {
+ $this->__construct();
+ }
/**
* Widget Output
Oops, something went wrong.

0 comments on commit 1a0cb52

Please sign in to comment.