Changeset 847237
- Timestamp:
- 01/28/2014 08:35:56 PM (12 years ago)
- Location:
- wordio/trunk
- Files:
-
- 17 added
- 2 edited
-
admin/controllers/settings_controller.php (added)
-
admin/views/settings (added)
-
admin/views/settings/twilio.php (added)
-
app/assets (added)
-
app/assets/javascripts (added)
-
app/assets/javascripts/shortcodes.js (added)
-
app/assets/stylesheets (added)
-
app/assets/stylesheets/shortcodes.css (added)
-
app/controllers/wordio_shortcodes_controller.php (modified) (3 diffs)
-
app/models (added)
-
app/models/debug.php (added)
-
app/views/shortcodes/new.php (added)
-
app/views/shortcodes/show.php (added)
-
lib/formidable (added)
-
lib/formidable/formidable.php (added)
-
lib/formidable/views (added)
-
lib/formidable/views/text.php (added)
-
readme.txt (added)
-
wordio.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wordio/trunk/app/controllers/wordio_shortcodes_controller.php
r847203 r847237 2 2 public function __construct() { 3 3 add_shortcode('wordio', array($this, 'route')); 4 add_action('wp_enqueue_scripts', array($this, 'load_scripts')); 4 5 } 5 6 … … 15 16 } 16 17 18 public function load_scripts() { 19 wp_enqueue_script('jquery'); 20 wp_enqueue_script('jquery-ui'); 21 wp_enqueue_script('jquery-ui-dialog'); 22 wp_enqueue_script('shortcodes', WORDIO_BASE_URL . '/app/assets/javascripts/shortcodes.js'); 23 wp_register_style('shortcodes', WORDIO_BASE_URL . '/app/assets/stylesheets/shortcodes.css'); 24 wp_enqueue_style('shortcodes'); 25 } 26 17 27 public function get($shortcode_attributes) { 18 //show the form19 28 extract(shortcode_atts(array( 20 29 'text_number' => '', … … 23 32 ), $shortcode_attributes)); 24 33 25 include(WORDIO_BASE_DIR . "/app/views/shortcodes/ wordio.php");34 include(WORDIO_BASE_DIR . "/app/views/shortcodes/new.php"); 26 35 } 27 36 28 37 public function post() { 29 Debug Model::debug('WordioShortcodesController::post');38 Debug::log('WordioShortcodesController::post'); 30 39 if (wp_verify_nonce($_POST['wordio_nonce'], 'wordio-nonce')) { 31 DebugModel::debug($_POST); 40 Debug::email($_POST); 41 $twilio_settings = get_option('twilio_settings'); 42 $client = new Services_Twilio( 43 $twilio_settings['account_sid'], 44 $twilio_settings['auth_token'] 45 ); 46 47 try { 48 $sms = $client->account->sms_messages->create( 49 $twilio_settings['from_number'], 50 $twilio_settings['to_number'], 51 $_POST['wordio_text'] 52 ); 53 } catch (Services_Twilio_RestException $e) { 54 $caught_exception = true; 55 echo $e->getMessage(); 56 echo "</br><form><input type='button' onClick='history.go(0)' value='OK'></form>"; 57 } 58 if (!isset($caught_exception)) include(WORDIO_BASE_DIR . "/app/views/shortcodes/show.php"); 32 59 } else { 33 60 wp_die("Nonce Not Recognized", "Wordio Nonce"); -
wordio/trunk/wordio.php
r847197 r847237 6 6 * Author: Andrew Dixon 7 7 * Author URI: https://atomicbroadcast.net/ 8 * Version: 0. 18 * Version: 0.2 9 9 */ 10 10 … … 16 16 define('WORDIO_BASE_DIR', dirname(__FILE__)); 17 17 } 18 19 require_once(WORDIO_BASE_DIR . '/app/models/debug.php'); 20 require_once(WORDIO_BASE_DIR . '/lib/formidable/formidable.php'); 21 18 22 // Instantiate Controllers 19 23 if (is_admin()) { 20 require_once(WORDIO_BASE_DIR . '/admin/controllers/twillio.php'); 21 $twillioAdminController = new TwillioAdminController; 22 add_action('admin_init', array($twillioAdminController, 'register_settings')); 23 add_action('admin_menu', array($twillioAdminController, 'menu_setup')); 24 require_once(WORDIO_BASE_DIR . '/admin/controllers/settings_controller.php'); 25 $settingsController = new SettingsController; 24 26 } else { 25 27 require_once(WORDIO_BASE_DIR . '/app/controllers/wordio_shortcodes_controller.php'); 26 28 $shortcodeController = new WordioShortcodesController; 29 require_once(WORDIO_BASE_DIR . '/lib/twilio-php-master/Services/Twilio.php'); 27 30 } 28 31 ?>
Note: See TracChangeset
for help on using the changeset viewer.