Changeset 3066251
- Timestamp:
- 04/07/2024 10:33:24 AM (11 months ago)
- Location:
- webp-svg-support
- Files:
-
- 8 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
webp-svg-support/trunk/readme.txt
r2824663 r3066251 4 4 Requires at least: 5.2 5 5 Requires PHP: 5.4 6 Tested up to: 6. 1.17 Stable tag: 1. 3.06 Tested up to: 6.5 7 Stable tag: 1.4.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 46 46 == Changelog == 47 47 48 = 1.4.0 ( April 05, 2024 ) = 49 Fix : Minor bug fix 50 Tweak : Compatible with Wordpress 6.5 major release 51 Tweak : Coding standard guideline update. 52 48 53 = 1.3.0 ( November 27, 2022 ) = 49 54 Fix : Minor bug fix -
webp-svg-support/trunk/webp-svg-support.php
r2824663 r3066251 4 4 * Plugin URI: https://wordpress.org/plugins/webp-svg-support/ 5 5 * Description: Allows WebP and SVG image file upload into WordPress media and sanitizes before saving it. 6 * Version: 1. 3.06 * Version: 1.4.0 7 7 * Author: Reza Khan 8 8 * Author URI: https://www.reza-khan.com/ … … 11 11 * Text Domain: webp-svg-support 12 12 * Domain Path: /languages 13 * 14 * WebP & SVG Support is a free software: you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation, either version 2 of the License, or 17 * any later version. 18 19 * WebP & SVG Support essential is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 24 * You should have received a copy of the GNU General Public License 25 * along with WebP & SVG Support. If not, see <http://www.gnu.org/licenses/>. 26 * 27 * @package webpsvg 28 * @category Core 29 * @author Reza Khan 30 * @version 1.4.0 13 31 */ 14 32 … … 16 34 17 35 /** 18 * Main function36 * Main class 19 37 * 20 38 * @since 1.0.0 … … 22 40 class Webpsvg_Support { 23 41 24 /** 25 * Instance of Webpsvg_Support class. 26 * 27 * @since 1.0.0 28 * 29 * @var Webpsvg_Support $instance Holds the class singleton instance. 30 */ 31 public static $instance = null; 32 33 /** 34 * Returns singleton instance of current class. 35 * 36 * @since 1.0.0 37 * 38 * @return Webpsvg_Support 39 */ 40 public static function init() { 41 42 if ( self::$instance === null ) { 43 self::$instance = new self(); 44 } 45 46 return self::$instance; 47 } 48 49 /** 50 * Constructor function for Webpsvg_Support class. 51 * 52 * @since 1.0.0 53 * 54 * @return Webpsvg_Support 55 */ 56 public function __construct() { 57 add_action( 'init', [$this, 'i18n'] ); 58 add_action( 'plugins_loaded', [$this, 'initialize_modules'] ); 59 } 60 61 /** 62 * Loads plugin textdomain directory. 63 * 64 * @since 1.0.0 65 */ 66 public function i18n() { 67 load_plugin_textdomain( 'webp-svg-support', false, self::plugin_dir() . 'languages/' ); 68 } 69 70 /** 71 * Initialize plugin modules. 72 * 73 * @since 1.0.0 74 */ 75 public function initialize_modules() { 76 do_action( 'webpsvg/before_load' ); 77 78 require_once self::core_dir() . 'bootstrap.php'; 79 Webpsvg_Support\Core\Bootstrap::instance()->init(); 80 81 do_action( 'webpsvg/after_load' ); 82 } 83 84 /** 85 * Sets an option when plugin activation hook is called. 86 * 87 * @since 1.0.0 88 * 89 * @return void 90 */ 91 static function webpsvg_activate() { 92 // do something 93 update_option( "webpsvg_allow_webp", 'yes' ); 94 update_option( "webpsvg_allow_svg", 'yes' ); 95 } 96 97 /** 98 * Sets an option when plugin deactivation hook is called. 99 * 100 * @since 1.0.0 101 * 102 * @return void 103 */ 104 static function webpsvg_deactivate() { 105 // do something 106 delete_option( 'webpsvg_allow_webp' ); 107 delete_option( 'webpsvg_allow_svg' ); 108 } 109 110 /** 111 * Plugin Version. 112 * 113 * @since 1.0.0 114 * 115 * @return string 116 */ 117 public static function version() { 118 return '1.3.0'; 119 } 120 121 /** 122 * Core Url. 123 * 124 * @since 1.0.0 125 * 126 * @return string 127 */ 128 public static function core_url() { 129 return trailingslashit( self::plugin_url() . 'core' ); 130 } 131 132 /** 133 * Core Directory Path. 134 * 135 * @since 1.0.0 136 * 137 * @return string 138 */ 139 public static function core_dir() { 140 return trailingslashit( self::plugin_dir() . 'core' ); 141 } 142 143 /** 144 * Plugin Url. 145 * 146 * @since 1.0.0 147 * 148 * @return string 149 */ 150 public static function plugin_url() { 151 return trailingslashit( plugin_dir_url( self::plugin_file() ) ); 152 } 153 154 /** 155 * Plugin Directory Path. 156 * 157 * @since 1.0.0 158 * 159 * @return string 160 */ 161 public static function plugin_dir() { 162 return trailingslashit( plugin_dir_path( self::plugin_file() ) ); 163 } 164 165 /** 166 * Plugins Basename. 167 * 168 * @since 1.0.0 169 * 170 * @return string 171 */ 172 public static function plugins_basename() { 173 return plugin_basename( self::plugin_file() ); 174 } 175 176 /** 177 * Plugin File. 178 * 179 * @since 1.0.0 180 * 181 * @return string 182 */ 183 public static function plugin_file() { 184 return __FILE__; 185 } 186 42 /** 43 * Instance of Webpsvg_Support class. 44 * 45 * @since 1.0.0 46 * 47 * @var Webpsvg_Support $instance Holds the class singleton instance. 48 */ 49 public static $instance = null; 50 51 /** 52 * Returns singleton instance of current class. 53 * 54 * @since 1.0.0 55 * 56 * @return Webpsvg_Support 57 */ 58 public static function init() { 59 60 if ( null === self::$instance ) { 61 self::$instance = new self(); 62 } 63 64 return self::$instance; 65 } 66 67 /** 68 * Constructor function for Webpsvg_Support class. 69 * 70 * @since 1.0.0 71 * 72 * @return void 73 */ 74 public function __construct() { 75 add_action( 'init', array( $this, 'i18n' ) ); 76 add_action( 'plugins_loaded', array( $this, 'initialize_modules' ) ); 77 } 78 79 /** 80 * Loads plugin textdomain directory. 81 * 82 * @since 1.0.0 83 */ 84 public function i18n() { 85 load_plugin_textdomain( 'webp-svg-support', false, self::plugin_dir() . 'languages/' ); 86 } 87 88 /** 89 * Initialize plugin modules. 90 * 91 * @since 1.0.0 92 */ 93 public function initialize_modules() { 94 do_action( 'webpsvg_before_load' ); 95 96 require_once self::core_dir() . 'bootstrap.php'; 97 Webpsvg_Support\Core\Bootstrap::instance()->init(); 98 99 do_action( 'webpsvg_after_load' ); 100 } 101 102 /** 103 * Sets an option when plugin activation hook is called. 104 * 105 * @since 1.0.0 106 * 107 * @return void 108 */ 109 public static function webpsvg_activate() { 110 // do something. 111 update_option( 'webpsvg_allow_webp', 'yes' ); 112 update_option( 'webpsvg_allow_svg', 'yes' ); 113 } 114 115 /** 116 * Sets an option when plugin deactivation hook is called. 117 * 118 * @since 1.0.0 119 * 120 * @return void 121 */ 122 public static function webpsvg_deactivate() { 123 // do something. 124 delete_option( 'webpsvg_allow_webp' ); 125 delete_option( 'webpsvg_allow_svg' ); 126 } 127 128 /** 129 * Plugin Version. 130 * 131 * @since 1.0.0 132 * 133 * @return string 134 */ 135 public static function version() { 136 return '1.4.0'; 137 } 138 139 /** 140 * Core Url. 141 * 142 * @since 1.0.0 143 * 144 * @return string 145 */ 146 public static function core_url() { 147 return trailingslashit( self::plugin_url() . 'core' ); 148 } 149 150 /** 151 * Core Directory Path. 152 * 153 * @since 1.0.0 154 * 155 * @return string 156 */ 157 public static function core_dir() { 158 return trailingslashit( self::plugin_dir() . 'core' ); 159 } 160 161 /** 162 * Plugin Url. 163 * 164 * @since 1.0.0 165 * 166 * @return string 167 */ 168 public static function plugin_url() { 169 return trailingslashit( plugin_dir_url( self::plugin_file() ) ); 170 } 171 172 /** 173 * Plugin Directory Path. 174 * 175 * @since 1.0.0 176 * 177 * @return string 178 */ 179 public static function plugin_dir() { 180 return trailingslashit( plugin_dir_path( self::plugin_file() ) ); 181 } 182 183 /** 184 * Plugins Basename. 185 * 186 * @since 1.0.0 187 * 188 * @return string 189 */ 190 public static function plugins_basename() { 191 return plugin_basename( self::plugin_file() ); 192 } 193 194 /** 195 * Plugin File. 196 * 197 * @since 1.0.0 198 * 199 * @return string 200 */ 201 public static function plugin_file() { 202 return __FILE__; 203 } 187 204 } 188 205 … … 195 212 */ 196 213 function webpsvg() { 197 214 return Webpsvg_Support::init(); 198 215 } 199 216 … … 202 219 203 220 /* Do something when the plugin is activated? */ 204 register_activation_hook( __FILE__, ['Webpsvg_Support', 'webpsvg_activate']);221 register_activation_hook( __FILE__, array( 'Webpsvg_Support', 'webpsvg_activate' ) ); 205 222 206 223 /* Do something when the plugin is deactivated? */ 207 register_deactivation_hook( __FILE__, ['Webpsvg_Support', 'webpsvg_deactivate']);224 register_deactivation_hook( __FILE__, array( 'Webpsvg_Support', 'webpsvg_deactivate' ) );
Note: See TracChangeset
for help on using the changeset viewer.