Plugin Directory

Changeset 1930402


Ignore:
Timestamp:
08/26/2018 09:03:40 AM (7 years ago)
Author:
sjhoo
Message:

some bugs has been fixed 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tgchannel/trunk/tgchannel.php

    r1930397 r1930402  
    191191    }
    192192    add_action('admin_enqueue_scripts','tgchannel_add_admin_scripts',10,1);
     193   
     194   
     195
     196/////////////////////////////////////////////////////////// after update_option
     197
     198function tgchannel_upgrade_completed( $upgrader_object, $options ) {
     199 // The path to our plugin's main file
     200 $our_plugin = plugin_basename( __FILE__ );
     201 // If an update has taken place and the updated type is plugins and the plugins element exists
     202 if( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) {
     203  // Iterate through the plugins being updated and check if ours is there
     204  foreach( $options['plugins'] as $plugin ) {
     205   if( $plugin == $our_plugin ) {
     206    if (!get_option('TG_Channel_background')){ 
     207    update_option( 'TG_Channel_background',plugins_url('/css/geometry.png', __FILE__));
     208    }
     209    if (!get_option('TG_Channel_background_color')){   
     210    update_option( 'TG_Channel_background_color','#ffffff');
     211    }           
     212    if (!get_option('TG_Channel_Header_color')){   
     213    update_option( 'TG_Channel_Header_color','#4c70db');
     214    }
     215    if (!get_option('TG_Channel_Footer_color')){   
     216    update_option( 'TG_Channel_Footer_color','#ffffff');
     217    }   
     218    if (!get_option('TG_Channel_Header_Font_color')){   
     219    update_option( 'TG_Channel_Header_Font_color','#ffffff');
     220    }
     221    if (!get_option('TG_Channel_Footer_Font_color')){   
     222    update_option( 'TG_Channel_Footer_Font_color','#4c70db');
     223    }
     224    if (!get_option('TG_Channel_Header_Font_size')){   
     225    update_option( 'TG_Channel_Header_Font_size','20px');
     226    }
     227    if (!get_option('TG_Channel_Footer_Font_size')){   
     228    update_option( 'TG_Channel_Footer_Font_size','17px');
     229    }
     230    if (!get_option('TG_Channel_Header_Height')){   
     231    update_option( 'TG_Channel_Header_Height','50px');
     232    }
     233    if (!get_option('TG_Channel_Footer_Height')){   
     234    update_option( 'TG_Channel_Footer_Height','50px');
     235    }
     236    if (!get_option('TG_Channel_Body_height')){
     237    update_option( 'TG_Channel_Body_height','400px');
     238    }
     239    if (!get_option('TG_Channel_Body_width')){ 
     240    update_option( 'TG_Channel_Body_width','308px');
     241    }
     242    if (!get_option('TG_Channel_Body_width')){ 
     243    update_option( 'TG_Channel_body_size','custom');
     244    }
     245   }
     246  }
     247 }
     248}
     249add_action( 'upgrader_process_complete', 'tgchannel_upgrade_completed', 10, 2 );
     250   
Note: See TracChangeset for help on using the changeset viewer.