Changeset 944671
- Timestamp:
- 07/08/2014 03:59:59 AM (12 years ago)
- Location:
- sendwithus/trunk
- Files:
-
- 3 edited
-
inc/helper_functions.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
sendwithus.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sendwithus/trunk/inc/helper_functions.php
r934659 r944671 19 19 function set_globals(){ 20 20 $GLOBALS['templates'] = get_templates(); 21 $GLOBALS['api_key'] = get_api_key();22 21 } 23 22 24 23 // Function for creating a default template if there isn't one already (Single Site Instance) 25 24 function create_default_template(){ 26 $active_templates = get_templates();25 $active_templates = $GLOBALS['templates']; 27 26 28 27 $api_key = get_option('api_key'); … … 60 59 // Function for creating a default template if there isn't one already (Multi Site Instance) 61 60 function ms_create_default_template(){ 62 $active_templates = get_templates();61 $active_templates = $GLOBALS['templates']; 63 62 64 63 $api_key = get_site_option('api_key'); -
sendwithus/trunk/readme.txt
r932728 r944671 52 52 == Changelog == 53 53 54 =1.02= 55 * Now with less spamming of sendwithus’ servers! 56 54 57 = 1.01 = 55 58 * Some bugfixes -
sendwithus/trunk/sendwithus.php
r934659 r944671 2 2 /** 3 3 * @package sendwithus 4 * @version 1.0 14 * @version 1.02 5 5 */ 6 6 /* … … 19 19 require( 'inc/multisite_overrides.php' ); 20 20 21 // API key is needed throughout. 22 $GLOBALS['api_key'] = get_api_key(); 23 21 24 // Add stylesheet 22 25 add_action( 'admin_enqueue_scripts', 'register_style_sheet' ); … … 26 29 } 27 30 28 set_globals();29 30 if(is_network_admin()){31 $GLOBALS['api_key'] = get_site_option('api_key');32 }33 34 if ( $GLOBALS['api_key'] == '' || $GLOBALS['templates']->status == 'error' ) {35 $GLOBALS['valid_key'] = false;36 } else {37 // Establish whether an API key has been entered and that it is valid.38 $GLOBALS['valid_key'] = true;39 if(is_network_admin()){40 add_action( 'init', 'ms_create_default_template');41 // Some sites don't work with muplugins_loaded for some reason.42 // This will make default be created.43 if ( did_action('create_default_template') == 0 ) {44 add_action( 'plugins_loaded', 'ms_create_default_template');45 }46 }47 else{48 add_action( 'init', 'create_default_template');49 // Some sites don't work with muplugins_loaded for some reason.50 // This will make default be created.51 if ( did_action('create_default_template') == 0 ) {52 add_action( 'plugins_loaded', 'create_default_template');53 }54 }55 add_action( 'plugins_loaded', 'set_globals');56 }57 58 31 // Used for displaying the main menu page. 59 32 // Activated when user clicks on link in sidebar. 60 33 function sendwithus_conf_main() { 34 set_globals(); 35 36 if(is_network_admin()){ 37 $GLOBALS['api_key'] = get_site_option('api_key'); 38 } 39 40 if ( $GLOBALS['api_key'] == '' || $GLOBALS['templates']->status == 'error' ) { 41 $GLOBALS['valid_key'] = false; 42 } else { 43 // Establish whether an API key has been entered and that it is valid. 44 $GLOBALS['valid_key'] = true; 45 if(is_network_admin()){ 46 add_action( 'init', 'ms_create_default_template'); 47 // Some sites don't work with muplugins_loaded for some reason. 48 // This will make default be created. 49 if ( did_action('create_default_template') == 0 ) { 50 add_action( 'plugins_loaded', 'ms_create_default_template'); 51 } 52 } 53 else{ 54 add_action( 'init', 'create_default_template'); 55 // Some sites don't work with muplugins_loaded for some reason. 56 // This will make default be created. 57 if ( did_action('create_default_template') == 0 ) { 58 add_action( 'plugins_loaded', 'create_default_template'); 59 } 60 } 61 add_action( 'plugins_loaded', 'set_globals'); 62 } 63 61 64 // Make sure that the user has appropriate permissions to be here. 62 65 if ( ! current_user_can( 'manage_options' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.