Changeset 1554846
- Timestamp:
- 12/14/2016 06:10:40 PM (9 years ago)
- Location:
- fifthestate/trunk
- Files:
-
- 2 edited
-
fifthestate.php (modified) (1 diff)
-
post-handler.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fifthestate/trunk/fifthestate.php
r1554845 r1554846 40 40 'token' => '', 41 41 'email' => '', 42 'category' => ''); 42 'category' => '', 43 ); 43 44 add_option( 'fifthestate', $default_app_state ); -
fifthestate/trunk/post-handler.php
r1554845 r1554846 4 4 require_once 'utilities.php'; 5 5 6 function post_json_to_url( $post, $reason, $ options) {6 function post_json_to_url( $post, $reason, $app_state ) { 7 7 //get data 8 8 $post_id = $post->ID; … … 40 40 $has_excerpt = has_excerpt( $post_id ); 41 41 $has_post_format = has_post_format( $post_id ); 42 $email = $ options['email'];43 $category = $ options['category'];42 $email = $app_state['email']; 43 $category = $app_state['category']; 44 44 45 45 //set up JSON object … … 83 83 84 84 //POST JSON object to a URL 85 $authorization_header = 'Authorization: Bearer ' . $ options['token'];85 $authorization_header = 'Authorization: Bearer ' . $app_state['token']; 86 86 curl_post( API_BASE_URL . '/wordpress_plugin_handler', 87 87 $json, … … 90 90 91 91 function post_updated_notification( $post ) { 92 $ options= get_option( 'fifthestate' );93 if ( $ options['logged_in'] ) {92 $app_state = get_option( 'fifthestate' ); 93 if ( $app_state['logged_in'] ) { 94 94 if ( 'post' === $post->post_type ) { 95 post_json_to_url( $post, 'Updated', $ options);95 post_json_to_url( $post, 'Updated', $app_state ); 96 96 } 97 97 } … … 99 99 100 100 function post_published_notification( $post ) { 101 $ options= get_option( 'fifthestate' );102 if ( $ options['logged_in'] ) {101 $app_state = get_option( 'fifthestate' ); 102 if ( $app_state['logged_in'] ) { 103 103 if ( 'post' === $post->post_type ) { 104 post_json_to_url( $post, 'Published', $ options);104 post_json_to_url( $post, 'Published', $app_state ); 105 105 } 106 106 } … … 108 108 109 109 function post_deleted_notification( $post ){ 110 $ options= get_option( 'fifthestate' );111 if ( $ options['logged_in'] ) {110 $app_state = get_option( 'fifthestate' ); 111 if ( $app_state['logged_in'] ) { 112 112 if ( 'post' === $post->post_type ) { 113 post_json_to_url( $post, 'Deleted', $ options);113 post_json_to_url( $post, 'Deleted', $app_state ); 114 114 } 115 115 }
Note: See TracChangeset
for help on using the changeset viewer.