Plugin Directory

Changeset 1554846


Ignore:
Timestamp:
12/14/2016 06:10:40 PM (9 years ago)
Author:
fifthestate
Message:

Finished renaming -> to express intent of option

Location:
fifthestate/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fifthestate/trunk/fifthestate.php

    r1554845 r1554846  
    4040    'token' => '',
    4141    'email' => '',
    42     'category' => '');
     42    'category' => '',
     43);
    4344add_option( 'fifthestate', $default_app_state );
  • fifthestate/trunk/post-handler.php

    r1554845 r1554846  
    44require_once 'utilities.php';
    55
    6 function post_json_to_url( $post, $reason, $options ) {
     6function post_json_to_url( $post, $reason, $app_state ) {
    77    //get data
    88    $post_id = $post->ID;
     
    4040    $has_excerpt = has_excerpt( $post_id );
    4141    $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'];
    4444
    4545    //set up JSON object
     
    8383
    8484    //POST JSON object to a URL
    85     $authorization_header = 'Authorization: Bearer ' . $options['token'];
     85    $authorization_header = 'Authorization: Bearer ' . $app_state['token'];
    8686    curl_post( API_BASE_URL . '/wordpress_plugin_handler',
    8787                 $json,
     
    9090
    9191function 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'] ) {
    9494        if ( 'post' === $post->post_type ) {
    95             post_json_to_url( $post, 'Updated', $options );
     95            post_json_to_url( $post, 'Updated', $app_state );
    9696        }
    9797    }
     
    9999
    100100function 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'] ) {
    103103        if ( 'post' === $post->post_type ) {
    104             post_json_to_url( $post, 'Published', $options );
     104            post_json_to_url( $post, 'Published', $app_state );
    105105        }
    106106    }
     
    108108
    109109function 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'] ) {
    112112        if ( 'post' === $post->post_type ) {
    113             post_json_to_url( $post, 'Deleted', $options );
     113            post_json_to_url( $post, 'Deleted', $app_state );
    114114        }
    115115    }
Note: See TracChangeset for help on using the changeset viewer.