Changeset 3253826
- Timestamp:
- 03/11/2025 08:11:34 AM (12 months ago)
- Location:
- advanced-ads
- Files:
-
- 16 edited
- 1 copied
-
tags/2.0.1 (copied) (copied from advanced-ads/trunk)
-
tags/2.0.1/advanced-ads.php (modified) (2 diffs)
-
tags/2.0.1/includes/admin/class-version-control.php (modified) (6 diffs)
-
tags/2.0.1/includes/installation/class-compatibility.php (modified) (2 diffs)
-
tags/2.0.1/includes/utilities/class-wordpress.php (modified) (1 diff)
-
tags/2.0.1/packages/advanced-ads/framework/src/class-updates.php (modified) (1 diff)
-
tags/2.0.1/packages/composer/installed.json (modified) (2 diffs)
-
tags/2.0.1/packages/composer/installed.php (modified) (1 diff)
-
tags/2.0.1/readme.txt (modified) (2 diffs)
-
trunk/advanced-ads.php (modified) (2 diffs)
-
trunk/includes/admin/class-version-control.php (modified) (6 diffs)
-
trunk/includes/installation/class-compatibility.php (modified) (2 diffs)
-
trunk/includes/utilities/class-wordpress.php (modified) (1 diff)
-
trunk/packages/advanced-ads/framework/src/class-updates.php (modified) (1 diff)
-
trunk/packages/composer/installed.json (modified) (2 diffs)
-
trunk/packages/composer/installed.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advanced-ads/tags/2.0.1/advanced-ads.php
r3253289 r3253826 11 11 * @wordpress-plugin 12 12 * Plugin Name: Advanced Ads 13 * Version: 2.0. 013 * Version: 2.0.1 14 14 * Description: Manage and optimize your ads in WordPress 15 15 * Plugin URI: https://wpadvancedads.com … … 38 38 39 39 define( 'ADVADS_FILE', __FILE__ ); 40 define( 'ADVADS_VERSION', '2.0. 0' );40 define( 'ADVADS_VERSION', '2.0.1' ); 41 41 42 42 // Load the autoloader. -
advanced-ads/tags/2.0.1/includes/admin/class-version-control.php
r3253289 r3253826 113 113 } 114 114 115 $ info = $this->get_advanced_ads_info();116 117 if ( is_wp_error( $ info) ) {118 wp_send_json_error( $ info->get_error_message() . '>>' . $info->get_error_message(), $info->get_error_code() );119 } 120 121 $versions = $this->filter_version_number( $ info['versions']);115 $versions = $this->get_version_from_api(); 116 117 if ( is_wp_error( $versions ) ) { 118 wp_send_json_error( $versions->get_error_message() . '>>' . $versions->get_error_message(), $versions->get_error_code() ); 119 } 120 121 $versions = $this->filter_version_number( $versions ); 122 122 set_transient( self::VERSIONS_TRANSIENT, $versions, 3 * HOUR_IN_SECONDS ); 123 123 wp_send_json_success( $versions, 200 ); … … 145 145 * @return array 146 146 */ 147 p rivatefunction filter_version_number( $versions ) {147 public function filter_version_number( $versions ) { 148 148 $results = []; 149 149 … … 156 156 157 157 $version_numbers = array_reverse( $version_numbers ); 158 array_shift( $version_numbers ); 158 159 159 160 $major = ''; 160 161 $minor = ''; 161 $minor_version_changes = -1;162 $major_version_changes = -1;162 $minor_version_changes = 0; 163 $major_version_changes = 0; 163 164 164 165 foreach ( $version_numbers as $number ) { 165 if ( false !== stripos( $number, 'rc' ) || false !== stripos( $number, 'alpha' ) || false !== stripos( $number, 'beta' ) ) {166 // keep only production versions.166 // Skip pre-release versions. 167 if ( preg_match( '/(rc|alpha|beta)/i', $number ) ) { 167 168 continue; 168 169 } 170 169 171 $parts = explode( '.', $number ); 170 $major_part = $parts[ 0];171 $minor_part = explode( '-', $parts[1] )[0];172 $major_part = $parts[1]; 173 $minor_part = $parts[2]; 172 174 173 175 if ( $major !== $major_part ) { 174 176 $major = $major_part; 175 177 ++$major_version_changes; 178 $minor_version_changes = 0; 176 179 } 177 180 … … 181 184 } 182 185 183 if ( self::MINOR_VERSION_COUNT >= $minor_version_changes || 1 === $major_version_changes) {186 if ( $minor_version_changes <= self::MINOR_VERSION_COUNT ) { 184 187 $results[ $number ] = $versions[ $number ]; 185 188 } 186 189 187 if ( self::MINOR_VERSION_COUNT > $major_version_changes && 1 === $major_version_changes) {190 if ( $major_version_changes >= self::MINOR_VERSION_COUNT ) { 188 191 break; 189 192 } … … 201 204 * @return array|\WP_Error 202 205 */ 203 private function get_ advanced_ads_info() {206 private function get_version_from_api() { 204 207 $aa_info = wp_remote_get( 'https://api.wordpress.org/plugins/info/1.0/advanced-ads.json' ); 205 208 … … 211 214 212 215 if ( $info['versions'] ) { 213 return $info ;216 return $info['versions']; 214 217 } 215 218 -
advanced-ads/tags/2.0.1/includes/installation/class-compatibility.php
r3253289 r3253826 27 27 */ 28 28 public function hooks(): void { 29 add_action( 'plugin_loaded', [ $this, 'deactivate_plugins' ], 0 ); 29 if ( is_admin() ) { 30 add_action( 'plugin_loaded', [ $this, 'deactivate_plugins' ], 0 ); 31 } 30 32 add_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ], 10, 3 ); 31 33 } … … 54 56 */ 55 57 public function deactivate_plugins(): void { 58 // Early bail!! 59 if ( get_option( 'advanced-ads-2-compatibility-flag' ) ) { 60 return; 61 } 62 56 63 $plugins = WordPress::get_wp_plugins(); 57 64 foreach ( Constants::ADDONS_NON_COMPATIBLE_VERSIONS as $version => $slug ) { -
advanced-ads/tags/2.0.1/includes/utilities/class-wordpress.php
r3253289 r3253826 113 113 */ 114 114 public static function get_svg( $file, $folder = '/assets/img/' ): string { 115 $file_url = ADVADS_BASE_URL . $folder . $file; 116 117 return file_get_contents( $file_url ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents 115 $file_path = \untrailingslashit( ADVADS_ABSPATH ) . $folder . $file; 116 117 if ( file_exists( $file_path ) ) { 118 ob_start(); 119 include $file_path; 120 return ob_get_clean(); 121 } 122 123 return ''; 118 124 } 119 125 -
advanced-ads/tags/2.0.1/packages/advanced-ads/framework/src/class-updates.php
r3253289 r3253826 126 126 foreach ( $this->get_updates() as $version => $path ) { 127 127 if ( version_compare( $installed_version, $version, '<' ) ) { 128 include $this->get_folder() . $path;128 require_once $this->get_folder() . $path; 129 129 $this->save_version( $version ); 130 130 } -
advanced-ads/tags/2.0.1/packages/composer/installed.json
r3253289 r3253826 8 8 "type": "git", 9 9 "url": "https://github.com/advanced-ads/framework.git", 10 "reference": " 364c1de99e6e0e789857bc20ea97a2cc2970b4e1"10 "reference": "bafe2c32b1530cfb18d8b738adb9524f8406b9aa" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/advanced-ads/framework/zipball/ 364c1de99e6e0e789857bc20ea97a2cc2970b4e1",15 "reference": " 364c1de99e6e0e789857bc20ea97a2cc2970b4e1",14 "url": "https://api.github.com/repos/advanced-ads/framework/zipball/bafe2c32b1530cfb18d8b738adb9524f8406b9aa", 15 "reference": "bafe2c32b1530cfb18d8b738adb9524f8406b9aa", 16 16 "shasum": "" 17 17 }, … … 23 23 "wp-coding-standards/wpcs": "^3.0.0" 24 24 }, 25 "time": "2025-0 2-28T10:58:24+00:00",25 "time": "2025-03-10T12:31:18+00:00", 26 26 "default-branch": true, 27 27 "type": "wordpress-plugin", -
advanced-ads/tags/2.0.1/packages/composer/installed.php
r3253289 r3253826 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 364c1de99e6e0e789857bc20ea97a2cc2970b4e1',25 'reference' => 'bafe2c32b1530cfb18d8b738adb9524f8406b9aa', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../advanced-ads/framework', -
advanced-ads/tags/2.0.1/readme.txt
r3253289 r3253826 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 2.0. 07 Stable tag: 2.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 357 357 == Changelog == 358 358 359 = 2.0.1 (March 11, 2025) = 360 361 - Improvement: reduce high CPU usage in the frontend 362 - Fix: correct a fatal error from a function declared multiple times during activation 363 - Fix: correct the version numbers in the rollback function dropdown 364 - Fix: resolve a PHP warning in the backend when file_get_contents is disabled 365 359 366 = 2.0.0 (March 10, 2025) = 360 367 -
advanced-ads/trunk/advanced-ads.php
r3253289 r3253826 11 11 * @wordpress-plugin 12 12 * Plugin Name: Advanced Ads 13 * Version: 2.0. 013 * Version: 2.0.1 14 14 * Description: Manage and optimize your ads in WordPress 15 15 * Plugin URI: https://wpadvancedads.com … … 38 38 39 39 define( 'ADVADS_FILE', __FILE__ ); 40 define( 'ADVADS_VERSION', '2.0. 0' );40 define( 'ADVADS_VERSION', '2.0.1' ); 41 41 42 42 // Load the autoloader. -
advanced-ads/trunk/includes/admin/class-version-control.php
r3253289 r3253826 113 113 } 114 114 115 $ info = $this->get_advanced_ads_info();116 117 if ( is_wp_error( $ info) ) {118 wp_send_json_error( $ info->get_error_message() . '>>' . $info->get_error_message(), $info->get_error_code() );119 } 120 121 $versions = $this->filter_version_number( $ info['versions']);115 $versions = $this->get_version_from_api(); 116 117 if ( is_wp_error( $versions ) ) { 118 wp_send_json_error( $versions->get_error_message() . '>>' . $versions->get_error_message(), $versions->get_error_code() ); 119 } 120 121 $versions = $this->filter_version_number( $versions ); 122 122 set_transient( self::VERSIONS_TRANSIENT, $versions, 3 * HOUR_IN_SECONDS ); 123 123 wp_send_json_success( $versions, 200 ); … … 145 145 * @return array 146 146 */ 147 p rivatefunction filter_version_number( $versions ) {147 public function filter_version_number( $versions ) { 148 148 $results = []; 149 149 … … 156 156 157 157 $version_numbers = array_reverse( $version_numbers ); 158 array_shift( $version_numbers ); 158 159 159 160 $major = ''; 160 161 $minor = ''; 161 $minor_version_changes = -1;162 $major_version_changes = -1;162 $minor_version_changes = 0; 163 $major_version_changes = 0; 163 164 164 165 foreach ( $version_numbers as $number ) { 165 if ( false !== stripos( $number, 'rc' ) || false !== stripos( $number, 'alpha' ) || false !== stripos( $number, 'beta' ) ) {166 // keep only production versions.166 // Skip pre-release versions. 167 if ( preg_match( '/(rc|alpha|beta)/i', $number ) ) { 167 168 continue; 168 169 } 170 169 171 $parts = explode( '.', $number ); 170 $major_part = $parts[ 0];171 $minor_part = explode( '-', $parts[1] )[0];172 $major_part = $parts[1]; 173 $minor_part = $parts[2]; 172 174 173 175 if ( $major !== $major_part ) { 174 176 $major = $major_part; 175 177 ++$major_version_changes; 178 $minor_version_changes = 0; 176 179 } 177 180 … … 181 184 } 182 185 183 if ( self::MINOR_VERSION_COUNT >= $minor_version_changes || 1 === $major_version_changes) {186 if ( $minor_version_changes <= self::MINOR_VERSION_COUNT ) { 184 187 $results[ $number ] = $versions[ $number ]; 185 188 } 186 189 187 if ( self::MINOR_VERSION_COUNT > $major_version_changes && 1 === $major_version_changes) {190 if ( $major_version_changes >= self::MINOR_VERSION_COUNT ) { 188 191 break; 189 192 } … … 201 204 * @return array|\WP_Error 202 205 */ 203 private function get_ advanced_ads_info() {206 private function get_version_from_api() { 204 207 $aa_info = wp_remote_get( 'https://api.wordpress.org/plugins/info/1.0/advanced-ads.json' ); 205 208 … … 211 214 212 215 if ( $info['versions'] ) { 213 return $info ;216 return $info['versions']; 214 217 } 215 218 -
advanced-ads/trunk/includes/installation/class-compatibility.php
r3253289 r3253826 27 27 */ 28 28 public function hooks(): void { 29 add_action( 'plugin_loaded', [ $this, 'deactivate_plugins' ], 0 ); 29 if ( is_admin() ) { 30 add_action( 'plugin_loaded', [ $this, 'deactivate_plugins' ], 0 ); 31 } 30 32 add_filter( 'upgrader_post_install', [ $this, 'upgrader_post_install' ], 10, 3 ); 31 33 } … … 54 56 */ 55 57 public function deactivate_plugins(): void { 58 // Early bail!! 59 if ( get_option( 'advanced-ads-2-compatibility-flag' ) ) { 60 return; 61 } 62 56 63 $plugins = WordPress::get_wp_plugins(); 57 64 foreach ( Constants::ADDONS_NON_COMPATIBLE_VERSIONS as $version => $slug ) { -
advanced-ads/trunk/includes/utilities/class-wordpress.php
r3253289 r3253826 113 113 */ 114 114 public static function get_svg( $file, $folder = '/assets/img/' ): string { 115 $file_url = ADVADS_BASE_URL . $folder . $file; 116 117 return file_get_contents( $file_url ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents 115 $file_path = \untrailingslashit( ADVADS_ABSPATH ) . $folder . $file; 116 117 if ( file_exists( $file_path ) ) { 118 ob_start(); 119 include $file_path; 120 return ob_get_clean(); 121 } 122 123 return ''; 118 124 } 119 125 -
advanced-ads/trunk/packages/advanced-ads/framework/src/class-updates.php
r3253289 r3253826 126 126 foreach ( $this->get_updates() as $version => $path ) { 127 127 if ( version_compare( $installed_version, $version, '<' ) ) { 128 include $this->get_folder() . $path;128 require_once $this->get_folder() . $path; 129 129 $this->save_version( $version ); 130 130 } -
advanced-ads/trunk/packages/composer/installed.json
r3253289 r3253826 8 8 "type": "git", 9 9 "url": "https://github.com/advanced-ads/framework.git", 10 "reference": " 364c1de99e6e0e789857bc20ea97a2cc2970b4e1"10 "reference": "bafe2c32b1530cfb18d8b738adb9524f8406b9aa" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/advanced-ads/framework/zipball/ 364c1de99e6e0e789857bc20ea97a2cc2970b4e1",15 "reference": " 364c1de99e6e0e789857bc20ea97a2cc2970b4e1",14 "url": "https://api.github.com/repos/advanced-ads/framework/zipball/bafe2c32b1530cfb18d8b738adb9524f8406b9aa", 15 "reference": "bafe2c32b1530cfb18d8b738adb9524f8406b9aa", 16 16 "shasum": "" 17 17 }, … … 23 23 "wp-coding-standards/wpcs": "^3.0.0" 24 24 }, 25 "time": "2025-0 2-28T10:58:24+00:00",25 "time": "2025-03-10T12:31:18+00:00", 26 26 "default-branch": true, 27 27 "type": "wordpress-plugin", -
advanced-ads/trunk/packages/composer/installed.php
r3253289 r3253826 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 364c1de99e6e0e789857bc20ea97a2cc2970b4e1',25 'reference' => 'bafe2c32b1530cfb18d8b738adb9524f8406b9aa', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../advanced-ads/framework', -
advanced-ads/trunk/readme.txt
r3253289 r3253826 5 5 Tested up to: 6.7 6 6 Requires PHP: 7.4 7 Stable tag: 2.0. 07 Stable tag: 2.0.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 357 357 == Changelog == 358 358 359 = 2.0.1 (March 11, 2025) = 360 361 - Improvement: reduce high CPU usage in the frontend 362 - Fix: correct a fatal error from a function declared multiple times during activation 363 - Fix: correct the version numbers in the rollback function dropdown 364 - Fix: resolve a PHP warning in the backend when file_get_contents is disabled 365 359 366 = 2.0.0 (March 10, 2025) = 360 367
Note: See TracChangeset
for help on using the changeset viewer.