Changeset 2172631
- Timestamp:
- 10/14/2019 02:40:18 AM (5 years ago)
- Location:
- usgs-stream-flow-data
- Files:
-
- 31 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
usgs-stream-flow-data/trunk/README.txt
r1955204 r2172631 4 4 Tags: USGS, River Flow, Stream Flow, Fly Fishing, Water Level 5 5 Requires at least: 3.7 6 Tested up to: 4.9.87 Stable tag: 2. 76 Tested up to: 5.3 7 Stable tag: 2.8 8 8 License: GPLv2 or later 9 9 License URI: //www.gnu.org/licenses/gpl-2.0.html … … 66 66 67 67 == Changelog == 68 = 2.8 = 69 Tested plugin up to 5.3. 70 71 = 2.7.1 = 72 Adds additional tests and allows for more trusted call to API Url. 73 68 74 = 2.7 = 69 75 Tested with WordPress 4.9.8 -
usgs-stream-flow-data/trunk/admin/class-kwc-usgs-admin.php
r1876522 r2172631 31 31 32 32 /** 33 * Slug of the plugin screen.34 *35 * @since 1.0.036 *37 * @var string38 */39 protected $plugin_screen_hook_suffix = null;40 41 /**42 33 * Initialize the plugin by loading admin scripts & styles and adding a 43 34 * settings page and menu. … … 46 37 */ 47 38 private function __construct() { 48 /*49 * Call $plugin_slug from public plugin class.50 */51 39 $this->plugin_slug = Kwc_Usgs::get_instance()->get_plugin_slug(); 52 53 // Load admin style sheet and JavaScript.54 40 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); 55 41 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); 56 57 // Add the options page and menu item.58 42 add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) ); 59 43 60 // Add an action link pointing to the options page.61 44 $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_slug . '.php' ); 62 45 add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'add_action_links' ) ); … … 73 56 */ 74 57 public static function get_instance() { 75 // If the single instance hasn't been set, set it now.76 58 if ( null == self::$instance ) { 77 59 self::$instance = new self; 78 60 } 79 80 61 return self::$instance; 81 62 } … … 84 65 * Register and enqueue admin-specific style sheet. 85 66 * 86 * @since 1.0.0 87 * 88 * @return null Return early if no settings page is registered. 67 * @since 1.0.0 68 * @return void 89 69 */ 90 70 public function enqueue_admin_styles() { 91 92 if ( ! isset( $this->plugin_screen_hook_suffix ) ) {93 return;94 }95 96 71 $screen = get_current_screen(); 97 if ( $this->plugin_screen_hook_suffix== $screen->id ) {72 if ( 'settings_page_kwcusgs' == $screen->id ) { 98 73 wp_enqueue_style( $this->plugin_slug . '-admin-styles', plugins_url( 'assets/css/admin.css', __FILE__ ), array(), kwc_usgs::VERSION ); 99 74 } 100 101 75 } 102 76 … … 104 78 * Register and enqueue admin-specific JavaScript. 105 79 * 106 * @since 1.0.0 107 * 108 * @return null Return early if no settings page is registered. 80 * @since 1.0.0 81 * @return void 109 82 */ 110 83 public function enqueue_admin_scripts() { 111 112 if ( ! isset( $this->plugin_screen_hook_suffix ) ) {113 return;114 }115 116 84 $screen = get_current_screen(); 117 if ( $this->plugin_screen_hook_suffix== $screen->id ) {85 if ( 'settings_page_kwcusgs' == $screen->id ) { 118 86 wp_enqueue_script( $this->plugin_slug . '-admin-script', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), Kwc_Usgs::VERSION ); 119 87 } 120 121 88 } 122 89 … … 127 94 */ 128 95 public function add_plugin_admin_menu() { 129 $this->plugin_screen_hook_suffix =add_options_page(96 add_options_page( 130 97 __( 'USGS Stream Flow Data', 'kwc_usgs' ), 131 98 __( 'Stream Flow Data', 'kwc_usgs' ), … … 134 101 array( $this, 'display_plugin_admin_page' ) 135 102 ); 136 137 103 } 138 104 … … 150 116 * 151 117 * @since 1.0.0 152 * @param array $links 118 * @param array $links The links array. 153 119 */ 154 120 public function add_action_links( $links ) { 155 156 121 return array_merge( 157 122 array( … … 160 125 $links 161 126 ); 162 163 127 } 164 128 … … 169 133 */ 170 134 public function kwcusgsajax_javascript() { 171 ?>135 ?> 172 136 <script type="text/javascript" > 173 137 $j=jQuery.noConflict(); … … 187 151 }); 188 152 </script> 189 <?php153 <?php 190 154 } 191 155 /** -
usgs-stream-flow-data/trunk/admin/views/admin.php
r1876522 r2172631 26 26 <h2 class="nav-tab-wrapper"> 27 27 <?php 28 foreach ( $usgs_tabs as $usgs_tab => $ name ) {28 foreach ( $usgs_tabs as $usgs_tab => $usgs_name ) { 29 29 $usgs_class = ( $usgs_tab == $usgs_active_tab ) ? ' nav-tab-active' : ''; 30 echo "<a class='nav-tab$usgs_class' href='?page=kwcusgs&tab=$usgs_tab'>$ name</a>";30 echo "<a class='nav-tab$usgs_class' href='?page=kwcusgs&tab=$usgs_tab'>$usgs_name</a>"; 31 31 } 32 32 ?> … … 116 116 117 117 case 'home-settings': 118 ?>118 ?> 119 119 <h3 class="">Using USGS Steam Flow Data</h3> 120 120 <p class="">This plugin uses short codes to allow you to include the USGS infromation for a location on any post or in a Text Widget.</p> … … 133 133 134 134 default: 135 ?>135 ?> 136 136 <center><a href="https://www.kindredwebconsulting.com/"><img src="<?php echo plugins_url( '../assets/kwc-logo.png', __FILE__ ); ?>" alt="Kindred Web Consulting Logo" border="0" /></a><p>Development by: <a href="https://www.kindredwebconsulting.com">Kindred Web Consulting</a></p></center> 137 137 <div class="sidebar"> … … 170 170 break; 171 171 } 172 ?>172 ?> 173 173 </div> -
usgs-stream-flow-data/trunk/kwcusgs.php
r1955204 r2172631 13 13 * Plugin URI: //wordpress.org/plugins/usgs-stream-flow-data/ 14 14 * Description: USGS Stream Flow Data 15 * Version: 2. 715 * Version: 2.8 16 16 * Author: Chris Kindred 17 17 * Author URI: //www.kindredwebconsulting.com -
usgs-stream-flow-data/trunk/public/class-kwc-usgs.php
r1955204 r2172631 28 28 * @var string 29 29 */ 30 const VERSION = '2.7 ';30 const VERSION = '2.7.1'; 31 31 32 32 /** … … 59 59 */ 60 60 private function __construct() { 61 62 61 add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); 63 62 add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) ); … … 81 80 * Return an instance of this class. 82 81 * 83 * @since 1.0.0 84 * 85 * @return object A single instance of this class. 82 * @since 1.0.0 83 * @return object 86 84 */ 87 85 public static function get_instance() { 88 89 // If the single instance hasn't been set, set it now. 90 if ( null == self::$instance ) { 86 if ( null === self::$instance ) { 91 87 self::$instance = new self; 92 88 } 93 94 89 return self::$instance; 95 90 } … … 123 118 124 119 /** 120 * Fired for each blog when the plugin is activated. 121 * 122 * @since 2.7 123 */ 124 private static function single_activate() { 125 return; 126 } 127 128 /** 129 * Fired for each blog when the plugin is deactivated. 130 * 131 * @since 2.7 132 * @return void 133 */ 134 private static function single_deactivate() { 135 136 } 137 /** 125 138 * Fired when the plugin is deactivated. 126 139 * 127 140 * @since 1.0.0 128 *129 141 * @param boolean $network_wide True if WPMU superadmin uses 130 142 * "Network Deactivate" action, false if … … 133 145 */ 134 146 public static function deactivate( $network_wide ) { 135 136 147 if ( function_exists( 'is_multisite' ) && is_multisite() ) { 137 138 148 if ( $network_wide ) { 139 149 $blog_ids = self::get_blog_ids(); … … 154 164 * Fired when a new site is activated with a WPMU environment. 155 165 * 156 * @since 1.0.0 157 * 166 * @since 1.0.0 158 167 * @param int $blog_id ID of the new blog. 159 168 */ 160 169 public function activate_new_site( $blog_id ) { 161 162 170 if ( 1 !== did_action( 'wpmu_new_blog' ) ) { 163 171 return; 164 172 } 165 166 173 switch_to_blog( $blog_id ); 167 174 self::single_activate(); 168 175 restore_current_blog(); 169 170 176 } 171 177 … … 176 182 * - not deleted 177 183 * 178 * @since 1.0.0 179 * 180 * @return array|false The blog ids, false if no matches. 184 * @since 1.0.0 185 * @return array|false The blog ids, false if no matches. 181 186 */ 182 187 private static function get_blog_ids() { … … 186 191 187 192 /** 188 * Fired for each blog when the plugin is activated.189 *190 * @since 1.0.0191 */192 private static function single_activate() {193 194 }195 196 /**197 * Fired for each blog when the plugin is deactivated.198 *199 * @since 1.0.0200 */201 private static function single_deactivate() {202 203 }204 205 /**206 193 * Load the plugin text domain for translation. 207 194 * … … 209 196 */ 210 197 public function load_plugin_textdomain() { 211 212 198 $domain = $this->plugin_slug; 213 199 $locale = apply_filters( 'kwc_usgs_plugin_locale', get_locale(), $domain ); 214 215 200 load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' ); 216 217 201 } 218 202 … … 220 204 * Register and enqueue public-facing style sheet. 221 205 * 222 * @since 206 * @since 1.0.0 223 207 */ 224 208 public function enqueue_styles() { 225 226 209 wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION ); 227 228 210 } 229 211 … … 231 213 * Register and enqueues public-facing JavaScript files. 232 214 * 233 * @since 215 * @since 1.0.0 234 216 */ 235 217 public function enqueue_scripts() { 236 237 218 wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public.js', __FILE__ ), array( 'jquery' ), self::VERSION ); 238 239 219 } 240 220 … … 365 345 public function get_usgs( $location ) { 366 346 $url = "https://waterservices.usgs.gov/nwis/iv?site=$location¶meterCd=00010,00060,00065&format=waterml"; 367 $response = wp_remote_get( $url ); 347 $args = array( 348 'sslverify' => false, 349 ); 350 $response = wp_remote_get( $url, $args ); 368 351 if ( is_wp_error( $response ) ) { 369 352 return $response;
Note: See TracChangeset
for help on using the changeset viewer.