diff --git a/composer.json b/composer.json index ee7075cbf..6d9e4c601 100644 --- a/composer.json +++ b/composer.json @@ -1,30 +1,31 @@ { - "name": "cloudinary/cloudinary-image-management-and-manipulation-in-the-cloud-cdn", - "homepage": "https://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/", - "type": "wordpress-plugin", - "license": "GPL-2.0-or-later", - "require": { - "ext-json": "*" + "name": "cloudinary/cloudinary-image-management-and-manipulation-in-the-cloud-cdn", + "homepage": "https://wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/", + "type": "wordpress-plugin", + "license": "GPL-2.0-or-later", + "require": { + "ext-json": "*" + }, + "require-dev": { + "wp-coding-standards/wpcs": "^2.3", + "automattic/vipwpcs": "^2.2", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/phpcompatibility-wp": "*" + }, + "config": { + "platform": { + "php": "5.6.20" }, - "require-dev": { - "wp-coding-standards/wpcs": "^2.3", - "automattic/vipwpcs": "^2.2", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0" - }, - "config": { - "platform": { - "php": "5.6.20" - }, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } - }, - "scripts": { - "lint": [ - "phpcs --ignore=*js/*" - ], - "fix": [ - "phpcbf --ignore=*js/*" - ] - } + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + }, + "scripts": { + "lint": [ + "phpcs --ignore=*js/*" + ], + "fix": [ + "phpcbf --ignore=*js/*" + ] + } } diff --git a/composer.lock b/composer.lock index 0432a94fb..1962196cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1dbb6e06315a705d939f07c570849d47", + "content-hash": "ac504df0d7ec3ff0eac5fb70b9dc5a8a", "packages": [], "packages-dev": [ { "name": "automattic/vipwpcs", - "version": "2.3.2", + "version": "2.3.3", "source": { "type": "git", "url": "https://github.com/Automattic/VIP-Coding-Standards.git", - "reference": "efacebef421334d54b99afa92fb8fa645336a8a7" + "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/efacebef421334d54b99afa92fb8fa645336a8a7", - "reference": "efacebef421334d54b99afa92fb8fa645336a8a7", + "url": "https://api.github.com/repos/Automattic/VIP-Coding-Standards/zipball/6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", + "reference": "6cd0a6a82bc0ac988dbf9d6a7c2e293dc8ac640b", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7", "php": ">=5.4", - "sirbrillig/phpcs-variable-analysis": "^2.8.3", + "sirbrillig/phpcs-variable-analysis": "^2.11.1", "squizlabs/php_codesniffer": "^3.5.5", "wp-coding-standards/wpcs": "^2.3" }, @@ -57,31 +57,31 @@ "source": "https://github.com/Automattic/VIP-Coding-Standards", "wiki": "https://github.com/Automattic/VIP-Coding-Standards/wiki" }, - "time": "2021-04-28T16:41:50+00:00" + "time": "2021-09-29T16:20:23+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.1", + "version": "v0.7.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c" + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", - "reference": "fe390591e0241955f22eb9ba327d137e501c771c", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" }, "type": "composer-plugin", "extra": { @@ -102,6 +102,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -113,6 +117,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -127,20 +132,192 @@ "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" }, - "time": "2020-12-07T18:04:37+00:00" + "time": "2022-02-04T12:51:07+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", + "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "time": "2021-02-15T10:24:51+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "time": "2021-12-30T16:37:40+00:00" }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.0", + "version": "v2.11.2", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "e76e816236f401458dd8e16beecab905861b5867" + "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/e76e816236f401458dd8e16beecab905861b5867", - "reference": "e76e816236f401458dd8e16beecab905861b5867", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/3fad28475bfbdbf8aa5c440f8a8f89824983d85e", + "reference": "3fad28475bfbdbf8aa5c440f8a8f89824983d85e", "shasum": "" }, "require": { @@ -180,20 +357,20 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2021-03-09T22:32:14+00:00" + "time": "2021-07-06T23:45:17+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -236,7 +413,7 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-04-09T00:54:41+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "wp-coding-standards/wpcs", @@ -302,5 +479,5 @@ "platform-overrides": { "php": "5.6.20" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/php/class-media.php b/php/class-media.php index abf0e1f97..384ff1cac 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1357,7 +1357,7 @@ public function raw_cloudinary_url( $attachment_id ) { ) ); - $url = implode( '/', array_filter( $parts ) ); + $url = implode( '/', array_filter( $parts ) ); $this->update_post_meta( $attachment_id, Sync::META_KEYS['raw_url'], $url ); } @@ -2297,9 +2297,9 @@ public function get_process_logs( $attachment_id, $raw = false ) { continue; } if ( is_wp_error( $log ) ) { - $logs[ $signature ] = array(); + $logs[ $signature ] = array(); $logs[ $signature ][ '_' . time() ] = array( - 'code' => $log->get_error_code(), + 'code' => $log->get_error_code(), 'message' => $log->get_error_message(), ); continue; @@ -2320,12 +2320,12 @@ public function get_process_logs( $attachment_id, $raw = false ) { // Fix stored expanded time. if ( ! is_numeric( $time ) ) { $to_unset = $time; - $time = strtotime( $time ); + $time = strtotime( $time ); } $time = "_{$time}"; } else { // Readable request. $to_unset = "_{$time}"; - $time = gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $time ); + $time = gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $time ); } // Maybe cleanup log entries. diff --git a/php/class-sync.php b/php/class-sync.php index 41be8d443..54b43ad74 100644 --- a/php/class-sync.php +++ b/php/class-sync.php @@ -227,7 +227,7 @@ public function log_sync_result( $attachment_id, $type, $result ) { $keys = $this->sync_base_struct; if ( empty( $log ) || count( $log ) !== count( $keys ) ) { $missing_keys = array_diff_key( $keys, $log ); - $log = array_merge( + $log = array_merge( $log, array_fill_keys( array_keys( $missing_keys ), array() ) ); diff --git a/php/media/class-filter.php b/php/media/class-filter.php index 153d94d54..f8d321674 100644 --- a/php/media/class-filter.php +++ b/php/media/class-filter.php @@ -317,7 +317,7 @@ public function filter_out_cloudinary( $data ) { $compare_id = $this->media->get_public_id_from_url( $url ); if ( ! empty( $compare_id ) && $compare_id !== $public_id ) { $compare_id .= '.' . pathinfo( $local_url, PATHINFO_EXTENSION ); - $local_url = path_join( dirname( $local_url ), basename( $compare_id ) ); + $local_url = path_join( dirname( $local_url ), basename( $compare_id ) ); } // Replace old tag. $content = str_replace( $url, $local_url, $content ); diff --git a/php/sync/class-sync-queue.php b/php/sync/class-sync-queue.php index 63d621984..07d290b9d 100644 --- a/php/sync/class-sync-queue.php +++ b/php/sync/class-sync-queue.php @@ -304,7 +304,7 @@ public function is_running( $type = 'queue' ) { public static function get_optimized_assets() { global $wpdb; - $wpdb->cld_table = Utils::get_relationship_table(); + $wpdb->cld_table = Utils::get_relationship_table(); return (int) $wpdb->get_var( "SELECT COUNT( DISTINCT post_id ) as total FROM {$wpdb->cld_table} WHERE sync_type = 'media';" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 06ded67ca..270ecb9c7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,7 +1,7 @@ - +