' . esc_html__('Settings', 'apixu-weather') . ''; } else { $settings_link = '' . esc_html__('API Key Required', 'apixu-weather') . ''; } if ($file == 'apixu-weather/apixu-weather.php') array_unshift($links, $settings_link); return $links; } add_filter('plugin_action_links', 'apixu_weather_plugin_action_links', 10, 2); add_action('admin_init', 'apixu_weather_setting_init'); function apixu_weather_setting_init() { register_setting('awe-basic-settings-group', 'open-weather-key'); register_setting('awe-basic-settings-group', 'aw-error-handling'); add_settings_section('awe-basic-settings', '', 'apixu_weather_api_keys_description', 'apixu-weather'); add_settings_field('open-weather-key', __('ApixuWeather App Key', 'apixu-weather'), 'apixu_weather_openweather_key', 'apixu-weather', 'awe-basic-settings'); add_settings_field('aw-error-handling', __('Error Handling', 'apixu-weather'), 'apixu_weather_error_handling_setting', 'apixu-weather', 'awe-basic-settings'); if (isset($_GET['action']) AND $_GET['action'] == "apixu-weather-clear-transients") { apixu_weather_delete_all_transients(); wp_redirect("options-general.php?page=apixu-weather&apixu-weather-cached-cleared=true"); die; } } // DELETE ALL APIXU WEATHER WIDGET TRANSIENTS function apixu_weather_delete_all_transients_save( $value ) { apixu_weather_delete_all_transients(); return $value; } function apixu_weather_delete_all_transients() { global $wpdb; // DELETE TRANSIENTS $sql = "DELETE FROM $wpdb->options WHERE option_name LIKE '%_transient_awe_%'"; $clean = $wpdb->query($sql); return true; } function apixu_weather_api_keys_description() { } function apixu_weather_openweather_key() { if (defined('APIXU_WEATHER_APPID')) { echo "" . __('Defined in wp-config', 'apixu-weather-pro') . ": " . APIXU_WEATHER_APPID . ""; } else { $setting = esc_attr(apply_filters('apixu_weather_appid', get_option('open-weather-key'))); echo ""; echo "

"; echo __("Apixu requires an APP ID key to access their weather data.", 'apixu-weather'); echo " "; echo __('Get your APPID', 'apixu-weather'); echo ""; echo "

"; } } function apixu_weather_error_handling_setting() { $setting = esc_attr(get_option('aw-error-handling')); if (!$setting) $setting = "source"; echo " " . __('Hidden in Source', 'apixu-weather') . "     "; echo " " . __('Display if Admin', 'apixu-weather') . "     "; echo " " . __('Display for Anyone', 'apixu-weather') . "     "; echo "

"; echo __("What should the plugin do when there is an error?", 'apixu-weather'); echo "

"; } if (!function_exists('mydebug')){ function mydebug( $data ) { echo '
';
		print_r($data);
		echo '
'; } }