diff options
author | James Inman <james@jamesinman.co.uk> | 2012-09-18 10:18:37 +0100 |
---|---|---|
committer | James Inman <james@jamesinman.co.uk> | 2012-09-18 10:18:37 +0100 |
commit | f42a8094845b816d1c6f5951599f215e88649127 (patch) | |
tree | 22569ad601d38cbd9be217ebbc5d1e2d35fcd978 | |
parent | 1b6624ee1794efbcaf08006b0a5e359200d72a4a (diff) | |
download | clockwork-php-f42a8094845b816d1c6f5951599f215e88649127.zip clockwork-php-f42a8094845b816d1c6f5951599f215e88649127.tar.gz clockwork-php-f42a8094845b816d1c6f5951599f215e88649127.tar.bz2 |
[RELEASE] 1.3.0 Added is_valid_msisdn() method.1.3.0
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rwxr-xr-x | class-Clockwork.php | 6 | ||||
-rwxr-xr-x | wordpress/class-clockwork-plugin.php | 30 |
4 files changed, 37 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 068dcd6..8bd2d46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,12 @@ ### 1.1 (August 21st, 2012) * Added /get_key functionality to translate a legacy Mediaburst username and password into a new Clockwork API key. [JI] -* Added checkBalance and deprecated checkCredit. [JI] +* Deprecated `checkCredit()` and replaced with `checkBalance()` [JI] ### 1.2 (September 7th, 2012) -* Deprecated checkCredit() and replaced with checkBalance() [JI] * Added various new Wordpress classes, including the Clockwork_Plugin class for writing plugins based on Clockwork. [JI] + +### 1.3 (September 18th, 2012) + +* Added `is_valid_msisdn()` method. [JI]
\ No newline at end of file @@ -4,10 +4,7 @@ This wrapper lets you interact with Clockwork without the hassle of having to cr ## What's Clockwork? -The mediaburst SMS API is being re-branded as Clockwork. At the same time we'll be launching some exciting new features -and these shiny new wrappers. - -The terms Clockwork and "mediaburst SMS API" refer to exactly the same thing. +[Clockwork][2] is Mediaburst's SMS API. ### Prerequisites @@ -192,16 +189,16 @@ In this example, one message will be from Clockwork and the other from 84433: This project is licensed under the ISC open-source license. -A copy of this license can be found in License.txt. +A copy of this license can be found in license.txt. # Contributing -If you have any feedback on this wrapper drop us an email to hello@clockworksms.com. +If you have any feedback on this wrapper drop us an email to [hello@clockworksms.com][1]. The project is hosted on GitHub at [https://github.com/mediaburst/clockwork-php][3]. If you would like to contribute a bug fix or improvement please fork the project and submit a pull request. -[1]: https://nuget.org/packages/Clockwork/ +[1]: mailto:hello@clockworksms.com [2]: http://www.clockworksms.com/ [3]: https://github.com/mediaburst/clockwork-php
\ No newline at end of file diff --git a/class-Clockwork.php b/class-Clockwork.php index f20fcfb..e0a9ea0 100755 --- a/class-Clockwork.php +++ b/class-Clockwork.php @@ -6,7 +6,7 @@ * @copyright Mediaburst Ltd 2012 * @license ISC * @link http://www.clockworksms.com -* @version 1.1 +* @version 1.3.0 */ if ( !class_exists('ClockworkException') ) { @@ -24,7 +24,7 @@ class Clockwork { /* * Version of this class */ - const VERSION = '1.2.0'; + const VERSION = '1.3.0'; /** * All Clockwork API calls start with BASE_URL @@ -633,6 +633,8 @@ class Clockwork { * @param string $val Value to check * @return bool True if valid MSISDN * @author James Inman + * @since 1.3.0 + * @todo Take an optional country code and check that the number starts with it */ public static function is_valid_msisdn($val) { return preg_match( '/^[1-9][0-9]{10,14}$/', $val ); diff --git a/wordpress/class-clockwork-plugin.php b/wordpress/class-clockwork-plugin.php index aa879b8..054e902 100755 --- a/wordpress/class-clockwork-plugin.php +++ b/wordpress/class-clockwork-plugin.php @@ -35,7 +35,7 @@ abstract class Clockwork_Plugin { /** * Version of the Clockwork Wordpress wrapper */ - const VERSION = '1.0.0'; + const VERSION = '1.0.1'; /** * URL to signup for a new Clockwork account */ @@ -57,6 +57,13 @@ abstract class Clockwork_Plugin { public $plugin_callback = null; /** + * @param $plugin_dir Plugin directory name + * + * @author James Inman + */ + public $plugin_dir = null; + + /** * Instance of WordPressClockwork * * @var WordPressClockwork @@ -81,6 +88,9 @@ abstract class Clockwork_Plugin { } } catch( Exception $e ) { } + + // Register the activation hook to install + register_activation_hook( __FILE__, array( $this, 'install' ) ); add_action( 'admin_head', array( $this, 'setup_admin_head' ) ); add_action( 'admin_menu', array( $this, 'setup_admin_navigation' ) ); @@ -133,6 +143,15 @@ abstract class Clockwork_Plugin { } /** + * Called on plugin activation + * + * @return void + * @author James Inman + */ + public function install() { + } + + /** * Tell the user to update their Clockwork options on every admin panel page if they haven't already * * @return void @@ -141,7 +160,7 @@ abstract class Clockwork_Plugin { public function setup_admin_message() { // Don't bother showing the "You need to set your Clockwork options" message if it's that form we're viewing if( !isset( $this->clockwork ) && ( get_current_screen()->base != 'toplevel_page_clockwork_options' ) ) { - $this->show_admin_message('You need to set your <a href="/wp-admin/admin.php?page=clockwork_options">Clockwork options</a> before you can use ' . $this->plugin_name . '.'); + $this->show_admin_message('You need to set your <a href="' . site_url() . '/wp-admin/admin.php?page=clockwork_options">Clockwork options</a> before you can use ' . $this->plugin_name . '.'); } } @@ -215,8 +234,8 @@ abstract class Clockwork_Plugin { */ public function setup_admin_init() { register_setting( 'clockwork_options', 'clockwork_options', array( $this, 'clockwork_options_validate' ) ); - add_settings_section( 'clockwork_options', 'API Key', array( $this, 'settings_api_key_text' ), 'clockwork_options' ); - add_settings_field( 'clockwork_api_key', 'Your API Key', array( $this, 'settings_api_key_input' ), 'clockwork_options', 'clockwork_options' ); + add_settings_section( 'clockwork_api_keys', 'API Key', array( $this, 'settings_api_key_text' ), 'clockwork' ); + add_settings_field( 'clockwork_api_key', 'Your API Key', array( $this, 'settings_api_key_input' ), 'clockwork', 'clockwork_api_keys' ); } /** @@ -319,8 +338,7 @@ abstract class Clockwork_Plugin { * @author James Inman */ protected function render_template( $name, $data = array() ) { - extract( $data ); - include( WP_PLUGIN_DIR . '/' . rtrim( basename( dirname( dirname( __FILE__ ) ) ), '/' ) . '/templates/' . $name . '.php' ); + include( WP_PLUGIN_DIR . '/' . $this->plugin_dir . '/templates/' . $name . '.php'); } } |