Changeset 3114628
- Timestamp:
- 07/09/2024 02:09:54 AM (20 months ago)
- Location:
- fitvids-for-wordpress
- Files:
-
- 4 edited
- 4 copied
-
tags/4.0.0 (copied) (copied from fitvids-for-wordpress/trunk)
-
tags/4.0.0/admin.php (modified) (2 diffs)
-
tags/4.0.0/fitvids-for-wordpress.php (copied) (copied from fitvids-for-wordpress/trunk/fitvids-for-wordpress.php) (9 diffs)
-
tags/4.0.0/jquery.fitvids.js (copied) (copied from fitvids-for-wordpress/trunk/jquery.fitvids.js)
-
tags/4.0.0/readme.txt (copied) (copied from fitvids-for-wordpress/trunk/readme.txt) (2 diffs)
-
trunk/admin.php (modified) (2 diffs)
-
trunk/fitvids-for-wordpress.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fitvids-for-wordpress/tags/4.0.0/admin.php
r2089277 r3114628 24 24 <input id="fitvids_wp_selector" 25 25 placeholder="body" 26 value="<?php echo esc_attr( get_option('fitvids_wp_selector', 'body') ); ?>"26 value="<?php echo esc_attr(get_option('fitvids_wp_selector', 'body') ); ?>" 27 27 name="fitvids_wp_selector" 28 28 type="text" … … 71 71 name="fitvids_wp_jq" 72 72 type="checkbox" 73 <?php $this->print_cdn_field_checked(); ?>73 <?php $this->print_cdn_field_checked(); ?> 74 74 > 75 My theme is missing jQuery. Add jQuery 3. 4.1 from Google CDN.75 My theme is missing jQuery. Add jQuery 3.7.1 from Google CDN. 76 76 </label> 77 77 </td> -
fitvids-for-wordpress/tags/4.0.0/fitvids-for-wordpress.php
r2805249 r3114628 5 5 Description: This plugin makes videos responsive using the FitVids jQuery plugin on WordPress. 6 6 Version: 3.0.13 7 Requires at least: 6.5 8 Requires PHP: 8.2 7 9 Tags: videos, fitvids, responsive 8 10 Author: Kevin Dees … … 19 21 public $path = null; 20 22 public $message = ''; 21 public $request = array();23 public $request = []; 22 24 public $activating = false; 23 public $jquery_version = '3. 4.1';25 public $jquery_version = '3.7.1'; 24 26 public $transient = 'fitvids-admin-notice'; 25 27 public $id = 'fitvids-wp'; … … 29 31 $this->path = plugin_dir_path(__FILE__); 30 32 $this->setup_request(); 31 register_activation_hook( __FILE__, array($this, 'activation'));32 add_action('admin_notices', array($this, 'activation_notice'));33 add_action('admin_menu', array($this, 'menu'));34 add_action('wp_enqueue_scripts', array($this, 'scripts'));33 register_activation_hook( __FILE__, [$this, 'activation'] ); 34 add_action('admin_notices', [$this, 'activation_notice'] ); 35 add_action('admin_menu', [$this, 'menu'] ); 36 add_action('wp_enqueue_scripts', [$this, 'scripts'] ); 35 37 } 36 38 37 public function activation() 39 public function activation(): void 38 40 { 39 41 $this->activating = true; … … 41 43 } 42 44 43 public function activation_notice() 45 public function activation_notice(): void 44 46 { 45 47 if( get_transient( $this->transient ) && ! $this->activating ) { … … 53 55 } 54 56 55 function menu() 56 {57 $page = add_submenu_page('themes.php', 'FitVids for WordPress', 'FitVids', 'switch_themes', $this->id, array($this, 'settings_page'));58 add_action('load-' . $page, array($this, 'help_tab'));57 function menu(): void 58 { 59 $page = add_submenu_page('themes.php', 'FitVids for WordPress', 'FitVids', 'switch_themes', $this->id, [$this, 'settings_page']); 60 add_action('load-' . $page, [$this, 'help_tab'] ); 59 61 } 60 62 61 public function settings_page() 62 {63 public function settings_page(): void 64 { 63 65 $post = $this->request['post']; 64 66 … … 78 80 } 79 81 80 public function help_tab() 82 public function help_tab(): void 81 83 { 82 84 $screen = get_current_screen(); 83 $screen->add_help_tab( array( 84 'id' => $this->id, 85 'title' => 'Using FitVids', 86 'content' => '', 87 'callback' => array( $this, 'help_content') 88 ) ); 85 $screen->add_help_tab( ['id' => $this->id, 'title' => 'Using FitVids', 'content' => '', 'callback' => [$this, 'help_content']] ); 89 86 } 90 87 91 public function help_content() { 88 public function help_content(): void 89 { 92 90 require( $this->path . '/help.php' ); 93 91 } 94 92 95 public function scripts() 93 public function scripts(): void 96 94 { 97 95 if ( get_option('fitvids_wp_jq') == 'true') { 98 96 $v = $this->jquery_version; 99 97 wp_deregister_script('jquery'); 100 wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/'.$v.'/jquery.min.js', array(), $v );98 wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/'.$v.'/jquery.min.js', [], $v ); 101 99 wp_enqueue_script('jquery'); 102 100 } 103 101 104 wp_register_script('fitvids', plugins_url('/jquery.fitvids.js', __FILE__), array('jquery'), '1.1', true);102 wp_register_script('fitvids', plugins_url('/jquery.fitvids.js', __FILE__), ['jquery'], '1.1', true); 105 103 wp_enqueue_script('fitvids'); 106 add_action('wp_print_footer_scripts', array($this, 'generate_inline_js'));104 add_action('wp_print_footer_scripts', [$this, 'generate_inline_js'] ); 107 105 } 108 106 109 public function generate_inline_js() 107 public function generate_inline_js(): void 110 108 { 111 109 $selector = get_option('fitvids_wp_selector'); 112 110 $ignore = $this->prepare_field( get_option('fitvids_wp_ignore_selector') ); 113 111 $custom = $this->prepare_field( get_option('fitvids_wp_custom_selector') ); 114 $selector = $this->prepare_field( $selector ? $selector: 'body' );115 $options = array();112 $selector = $this->prepare_field( $selector ?: 'body' ); 113 $options = []; 116 114 $settings = ''; 117 115 … … 135 133 } 136 134 137 public function prepare_field( $value, $sanitize = true ) 135 public function prepare_field( $value, $sanitize = true ): string 138 136 { 139 137 if($value) { 140 $value = trim( $value );138 $value = trim( (string) $value ); 141 139 142 140 if($sanitize) { 143 $sanitized = wp_strip_all_tags( preg_replace('/"/', "'", $value), array());141 $sanitized = wp_strip_all_tags( preg_replace('/"/', "'", $value), [] ); 144 142 return $sanitized; 145 143 } … … 149 147 } 150 148 151 public function setup_request() 149 public function setup_request(): void 152 150 { 153 $this->request['post'] = ! empty($_POST) ? array_map('wp_unslash', $_POST ) : array();154 $this->request['get'] = ! empty($_GET) ? array_map('wp_unslash', $_GET ) : array();151 $this->request['post'] = ! empty($_POST) ? array_map('wp_unslash', $_POST ) : []; 152 $this->request['get'] = ! empty($_GET) ? array_map('wp_unslash', $_GET ) : []; 155 153 $this->request['uri'] = $_SERVER['REQUEST_URI']; 156 154 } 157 155 158 public function print_cdn_field_checked() 156 public function print_cdn_field_checked(): void 159 157 { 160 158 if (get_option('fitvids_wp_jq') == 'true') { … … 163 161 } 164 162 165 public function save_option( $field ) 163 public function save_option( $field ): void 166 164 { 167 165 if( !empty($this->request['post'][$field]) ) { -
fitvids-for-wordpress/tags/4.0.0/readme.txt
r2805249 r3114628 2 2 Contributors: kevindees 3 3 Tags: videos, fitvids, responsive 4 Requires at least: 3.9 5 Tested up to: 6.1 6 Stable Tag: 3.0.13 4 Requires at least: 6.5 5 Requires PHP: 8.2 6 Tested up to: 6.6 7 Stable Tag: 4.0.0 7 8 8 9 This plugin makes videos responsive using the FitVids jQuery plugin on WordPress. … … 25 26 26 27 == Changelog == 28 29 = 4.0.0 = 30 31 * Update plugin to require PHP 8.2. 32 * Update jQuery to version 3.7.1 from 3.4.1. 27 33 28 34 = 3.0.13 = -
fitvids-for-wordpress/trunk/admin.php
r2089277 r3114628 24 24 <input id="fitvids_wp_selector" 25 25 placeholder="body" 26 value="<?php echo esc_attr( get_option('fitvids_wp_selector', 'body') ); ?>"26 value="<?php echo esc_attr(get_option('fitvids_wp_selector', 'body') ); ?>" 27 27 name="fitvids_wp_selector" 28 28 type="text" … … 71 71 name="fitvids_wp_jq" 72 72 type="checkbox" 73 <?php $this->print_cdn_field_checked(); ?>73 <?php $this->print_cdn_field_checked(); ?> 74 74 > 75 My theme is missing jQuery. Add jQuery 3. 4.1 from Google CDN.75 My theme is missing jQuery. Add jQuery 3.7.1 from Google CDN. 76 76 </label> 77 77 </td> -
fitvids-for-wordpress/trunk/fitvids-for-wordpress.php
r2805249 r3114628 5 5 Description: This plugin makes videos responsive using the FitVids jQuery plugin on WordPress. 6 6 Version: 3.0.13 7 Requires at least: 6.5 8 Requires PHP: 8.2 7 9 Tags: videos, fitvids, responsive 8 10 Author: Kevin Dees … … 19 21 public $path = null; 20 22 public $message = ''; 21 public $request = array();23 public $request = []; 22 24 public $activating = false; 23 public $jquery_version = '3. 4.1';25 public $jquery_version = '3.7.1'; 24 26 public $transient = 'fitvids-admin-notice'; 25 27 public $id = 'fitvids-wp'; … … 29 31 $this->path = plugin_dir_path(__FILE__); 30 32 $this->setup_request(); 31 register_activation_hook( __FILE__, array($this, 'activation'));32 add_action('admin_notices', array($this, 'activation_notice'));33 add_action('admin_menu', array($this, 'menu'));34 add_action('wp_enqueue_scripts', array($this, 'scripts'));33 register_activation_hook( __FILE__, [$this, 'activation'] ); 34 add_action('admin_notices', [$this, 'activation_notice'] ); 35 add_action('admin_menu', [$this, 'menu'] ); 36 add_action('wp_enqueue_scripts', [$this, 'scripts'] ); 35 37 } 36 38 37 public function activation() 39 public function activation(): void 38 40 { 39 41 $this->activating = true; … … 41 43 } 42 44 43 public function activation_notice() 45 public function activation_notice(): void 44 46 { 45 47 if( get_transient( $this->transient ) && ! $this->activating ) { … … 53 55 } 54 56 55 function menu() 56 {57 $page = add_submenu_page('themes.php', 'FitVids for WordPress', 'FitVids', 'switch_themes', $this->id, array($this, 'settings_page'));58 add_action('load-' . $page, array($this, 'help_tab'));57 function menu(): void 58 { 59 $page = add_submenu_page('themes.php', 'FitVids for WordPress', 'FitVids', 'switch_themes', $this->id, [$this, 'settings_page']); 60 add_action('load-' . $page, [$this, 'help_tab'] ); 59 61 } 60 62 61 public function settings_page() 62 {63 public function settings_page(): void 64 { 63 65 $post = $this->request['post']; 64 66 … … 78 80 } 79 81 80 public function help_tab() 82 public function help_tab(): void 81 83 { 82 84 $screen = get_current_screen(); 83 $screen->add_help_tab( array( 84 'id' => $this->id, 85 'title' => 'Using FitVids', 86 'content' => '', 87 'callback' => array( $this, 'help_content') 88 ) ); 85 $screen->add_help_tab( ['id' => $this->id, 'title' => 'Using FitVids', 'content' => '', 'callback' => [$this, 'help_content']] ); 89 86 } 90 87 91 public function help_content() { 88 public function help_content(): void 89 { 92 90 require( $this->path . '/help.php' ); 93 91 } 94 92 95 public function scripts() 93 public function scripts(): void 96 94 { 97 95 if ( get_option('fitvids_wp_jq') == 'true') { 98 96 $v = $this->jquery_version; 99 97 wp_deregister_script('jquery'); 100 wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/'.$v.'/jquery.min.js', array(), $v );98 wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/'.$v.'/jquery.min.js', [], $v ); 101 99 wp_enqueue_script('jquery'); 102 100 } 103 101 104 wp_register_script('fitvids', plugins_url('/jquery.fitvids.js', __FILE__), array('jquery'), '1.1', true);102 wp_register_script('fitvids', plugins_url('/jquery.fitvids.js', __FILE__), ['jquery'], '1.1', true); 105 103 wp_enqueue_script('fitvids'); 106 add_action('wp_print_footer_scripts', array($this, 'generate_inline_js'));104 add_action('wp_print_footer_scripts', [$this, 'generate_inline_js'] ); 107 105 } 108 106 109 public function generate_inline_js() 107 public function generate_inline_js(): void 110 108 { 111 109 $selector = get_option('fitvids_wp_selector'); 112 110 $ignore = $this->prepare_field( get_option('fitvids_wp_ignore_selector') ); 113 111 $custom = $this->prepare_field( get_option('fitvids_wp_custom_selector') ); 114 $selector = $this->prepare_field( $selector ? $selector: 'body' );115 $options = array();112 $selector = $this->prepare_field( $selector ?: 'body' ); 113 $options = []; 116 114 $settings = ''; 117 115 … … 135 133 } 136 134 137 public function prepare_field( $value, $sanitize = true ) 135 public function prepare_field( $value, $sanitize = true ): string 138 136 { 139 137 if($value) { 140 $value = trim( $value );138 $value = trim( (string) $value ); 141 139 142 140 if($sanitize) { 143 $sanitized = wp_strip_all_tags( preg_replace('/"/', "'", $value), array());141 $sanitized = wp_strip_all_tags( preg_replace('/"/', "'", $value), [] ); 144 142 return $sanitized; 145 143 } … … 149 147 } 150 148 151 public function setup_request() 149 public function setup_request(): void 152 150 { 153 $this->request['post'] = ! empty($_POST) ? array_map('wp_unslash', $_POST ) : array();154 $this->request['get'] = ! empty($_GET) ? array_map('wp_unslash', $_GET ) : array();151 $this->request['post'] = ! empty($_POST) ? array_map('wp_unslash', $_POST ) : []; 152 $this->request['get'] = ! empty($_GET) ? array_map('wp_unslash', $_GET ) : []; 155 153 $this->request['uri'] = $_SERVER['REQUEST_URI']; 156 154 } 157 155 158 public function print_cdn_field_checked() 156 public function print_cdn_field_checked(): void 159 157 { 160 158 if (get_option('fitvids_wp_jq') == 'true') { … … 163 161 } 164 162 165 public function save_option( $field ) 163 public function save_option( $field ): void 166 164 { 167 165 if( !empty($this->request['post'][$field]) ) { -
fitvids-for-wordpress/trunk/readme.txt
r2805249 r3114628 2 2 Contributors: kevindees 3 3 Tags: videos, fitvids, responsive 4 Requires at least: 3.9 5 Tested up to: 6.1 6 Stable Tag: 3.0.13 4 Requires at least: 6.5 5 Requires PHP: 8.2 6 Tested up to: 6.6 7 Stable Tag: 4.0.0 7 8 8 9 This plugin makes videos responsive using the FitVids jQuery plugin on WordPress. … … 25 26 26 27 == Changelog == 28 29 = 4.0.0 = 30 31 * Update plugin to require PHP 8.2. 32 * Update jQuery to version 3.7.1 from 3.4.1. 27 33 28 34 = 3.0.13 =
Note: See TracChangeset
for help on using the changeset viewer.