diff --git a/.eslintrc.json b/.eslintrc.json index 20a1a2fd4..a8e71723b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,6 +24,7 @@ "no-nested-ternary": "off", "jsx-a11y/click-events-have-key-events": "off", "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn" + "react-hooks/exhaustive-deps": "warn", + "@wordpress/no-global-event-listener": "off" } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..9c8656e79 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [ '5.6', '7.4', '8.3' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '16' + cache: 'npm' + + - name: Cache Composer + uses: actions/cache@v4 + with: + path: ~/.composer/cache + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer-${{ matrix.php }}- + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint + + - name: Run build + run: npm run build diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7c196ee81..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -dist: xenial - -language: php - -before_install: - - nvm install - - nvm use - -install: - - npm ci - -jobs: - - include: - - - php: "5.6" - script: - - npm run lint - - npm run build - - - php: "7.4" - script: - - npm run lint - - npm run build - -notifications: - email: false - -cache: - npm: true - directories: - - "$HOME/.composer/cache" diff --git a/cloudinary.php b/cloudinary.php index 94bc8629a..828e1b2e2 100644 --- a/cloudinary.php +++ b/cloudinary.php @@ -39,7 +39,7 @@ if ( version_compare( phpversion(), '5.6', '>=' ) ) { require_once __DIR__ . '/instance.php'; register_activation_hook( __FILE__, array( 'Cloudinary\Utils', 'install' ) ); -} else { +} else { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found if ( defined( 'WP_CLI' ) ) { WP_CLI::warning( php_version_text() ); } else { diff --git a/php/cache/class-cache-point.php b/php/cache/class-cache-point.php index d649235b8..dcdd85907 100644 --- a/php/cache/class-cache-point.php +++ b/php/cache/class-cache-point.php @@ -287,7 +287,6 @@ public function init() { $this->registered_cache_points[ $post->post_title ] = $post; } do_action( 'cloudinary_cache_init_cache_points' ); - } /** @@ -526,7 +525,7 @@ public function get_cache_items( $cache_point_id_url, $id_only = false ) { do { $found = $posts->get_posts(); $items = array_merge( $items, $found ); - $params['paged'] ++; + ++$params['paged']; $posts = new \WP_Query( $params ); } while ( $posts->have_posts() ); } @@ -884,7 +883,7 @@ public function query_cached_items( $urls ) { $found_posts[ $url ] = $meta[ self::META_KEYS['cached_urls'] ][ $url ]; } } - $params['paged'] ++; + ++$params['paged']; $posts = new \WP_Query( $params ); } while ( $posts->have_posts() ); diff --git a/php/class-admin.php b/php/class-admin.php index fe37dc294..eccbe9776 100644 --- a/php/class-admin.php +++ b/php/class-admin.php @@ -203,7 +203,7 @@ public function register_admin( $page ) { $page_handle = add_menu_page( $page['page_title'], $page['menu_title'], - $page['capability'], + $page['capability'], // phpcs:ignore WordPress.WP.Capabilities.Undetermined $page['slug'], '', $page['icon'], @@ -245,7 +245,7 @@ public function register_admin( $page ) { $page['slug'], $page_title, $menu_title, - $capability, + $capability, // phpcs:ignore WordPress.WP.Capabilities.Undetermined $render_slug, $render_function, $position diff --git a/php/class-assets.php b/php/class-assets.php index 52287e99f..34349c5df 100644 --- a/php/class-assets.php +++ b/php/class-assets.php @@ -1365,7 +1365,7 @@ public function is_asset( $url ) { global $wpdb; // Bail early if it's not an URL. - if ( empty( parse_url( $url, PHP_URL_HOST ) ) ) { + if ( empty( parse_url( $url, PHP_URL_HOST ) ) ) { // phpcs:ignore WordPress.WP.AlternativeFunctions.parse_url_parse_url return false; } diff --git a/php/class-cache.php b/php/class-cache.php index f79ceba45..ee6d18211 100644 --- a/php/class-cache.php +++ b/php/class-cache.php @@ -615,7 +615,6 @@ protected function get_plugins_table() { 'title' => __( 'Plugin', 'cloudinary' ), 'root_paths' => $rows, ); - } /** @@ -987,7 +986,7 @@ public function add_content_cache_paths() { if ( ! is_admin() ) { // Exclude content replacement in admin. $this->add_cache_paths( 'cache_content', 'content_files', 'cache_all_content' ); - }; + } } /** diff --git a/php/class-delivery-feature.php b/php/class-delivery-feature.php index da08b1c75..3f2b8468d 100644 --- a/php/class-delivery-feature.php +++ b/php/class-delivery-feature.php @@ -157,7 +157,6 @@ public function register_assets() { * Enqueue Assets. */ public function enqueue_assets() { - } /** diff --git a/php/class-delivery.php b/php/class-delivery.php index 564f967a0..a350081ef 100644 --- a/php/class-delivery.php +++ b/php/class-delivery.php @@ -1958,7 +1958,7 @@ protected function filter_unknown_urls( $urls ) { return $urls; } - $known_lookup = array_flip( $known_keys ); + $known_lookup = array_flip( $known_keys ); $potential_unknown = array_diff( $urls, $known_keys ); if ( empty( $potential_unknown ) ) { diff --git a/php/class-extensions.php b/php/class-extensions.php index 22099f4df..488f27ccc 100644 --- a/php/class-extensions.php +++ b/php/class-extensions.php @@ -115,7 +115,7 @@ public function get_active_count_text() { $active = 0; foreach ( $this->settings->get_value( $this->settings_slug ) as $value ) { if ( 'on' === $value ) { - $active ++; + ++$active; } } diff --git a/php/class-media-library.php b/php/class-media-library.php index 2241995ef..bcb2ba536 100644 --- a/php/class-media-library.php +++ b/php/class-media-library.php @@ -41,7 +41,7 @@ public function setup() { $this->handle = add_menu_page( __( 'Cloudinary Media Library', 'cloudinary' ), __( 'Cloudinary DAM', 'cloudinary' ), - Utils::user_can( 'manage_dam' ) ? 'exist' : false, + Utils::user_can( 'manage_dam' ) ? 'exist' : false, // phpcs:ignore WordPress.WP.Capabilities.Undetermined self::MEDIA_LIBRARY_SLUG, array( $this, 'render' ), 'dashicons-cloudinary-dam', diff --git a/php/class-media.php b/php/class-media.php index 182782b3d..f14db1748 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1305,7 +1305,7 @@ public function apply_default_transformations( array $transformations, $attachme * * @return array */ - public function default_image_transformations( $default ) { + public function default_image_transformations( $default ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound $config = $this->settings->get_value( 'image_settings' ); @@ -1330,7 +1330,7 @@ public function default_image_transformations( $default ) { * * @return array */ - public function default_image_freeform_transformations( $default ) { + public function default_image_freeform_transformations( $default ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound $config = $this->settings->get_value( 'image_settings' ); if ( ! empty( $config['image_freeform'] ) ) { $default[] = trim( $config['image_freeform'] ); @@ -2559,7 +2559,7 @@ public function get_transformation_from_meta( $post_id ) { * * @return mixed */ - public function get_post_meta( $post_id, $key = '', $single = false, $default = null ) { + public function get_post_meta( $post_id, $key = '', $single = false, $default = null ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound $meta = get_post_meta( $post_id, Sync::META_KEYS['cloudinary'], true ); if ( empty( $meta ) ) { diff --git a/php/class-plugin.php b/php/class-plugin.php index 8ed2765b7..03a94a8a0 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -598,7 +598,7 @@ protected function setup_endpoints() { * * @return void */ - public function autoload( $class ) { + public function autoload( $class ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.classFound // Assume we're using namespaces (because that's how the plugin is structured). $namespace = explode( '\\', $class ); $root = array_shift( $namespace ); @@ -744,7 +744,7 @@ public function print_script_data() { * * @return array */ - public function force_visit_plugin_site_link( $plugin_meta, $plugin_file, $plugin_data, $status ) { + public function force_visit_plugin_site_link( $plugin_meta, $plugin_file, $plugin_data, $status ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed if ( 'Cloudinary' === $plugin_data['Name'] ) { $plugin_site_link = sprintf( '%s', diff --git a/php/class-rest-api.php b/php/class-rest-api.php index 0200ce98d..76975dcde 100644 --- a/php/class-rest-api.php +++ b/php/class-rest-api.php @@ -26,7 +26,7 @@ class REST_API { * * @param Plugin $plugin Instance of the global Plugin. */ - public function __construct( Plugin $plugin ) { + public function __construct( Plugin $plugin ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found add_action( 'rest_api_init', array( $this, 'rest_api_init' ), PHP_INT_MAX ); } diff --git a/php/class-settings.php b/php/class-settings.php index ba655448e..9948400a1 100644 --- a/php/class-settings.php +++ b/php/class-settings.php @@ -241,7 +241,7 @@ public function get_storage_key( $slug, $type = null ) { * * @return Setting|\WP_Error */ - public function add( $slug, $default = array(), $params = array() ) { + public function add( $slug, $default = array(), $params = array() ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound $default_params = array( 'type' => 'tag', self::META_KEYS['storage'] => $slug, @@ -294,7 +294,7 @@ public function add( $slug, $default = array(), $params = array() ) { * * @return mixed|Setting */ - protected function register( $slug, $default, $params ) { + protected function register( $slug, $default, $params ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound if ( isset( $this->settings[ $slug ] ) ) { return $this->settings[ $slug ]; diff --git a/php/class-string-replace.php b/php/class-string-replace.php index f749a62f7..5b099d628 100644 --- a/php/class-string-replace.php +++ b/php/class-string-replace.php @@ -195,7 +195,7 @@ public function init_debug( $template ) { * * @return bool */ - public static function string_set( $string ) { + public static function string_set( $string ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.stringFound return isset( self::$replacements[ $string ] ); } @@ -206,7 +206,7 @@ public static function string_set( $string ) { * * @return bool */ - public static function string_not_set( $string ) { + public static function string_not_set( $string ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.stringFound return ! self::string_set( $string ); } diff --git a/php/class-sync.php b/php/class-sync.php index 4ec29f346..a8d8f0cdd 100644 --- a/php/class-sync.php +++ b/php/class-sync.php @@ -1105,11 +1105,11 @@ public function maybe_cleanup_errored() { delete_post_meta_by_key( self::META_KEYS['sync_error'] ); - wp_redirect( + wp_redirect( // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect add_query_arg( array( - 'page' => 'cloudinary', - 'action' => 'cleaned_up', + 'page' => 'cloudinary', + 'action' => 'cleaned_up', ), admin_url( 'admin.php' ) ) diff --git a/php/class-url.php b/php/class-url.php index a5bbcdffb..91fa7e43d 100644 --- a/php/class-url.php +++ b/php/class-url.php @@ -78,7 +78,6 @@ public function init_settings() { * Set up the object. */ public function setup() { - } /** diff --git a/php/class-utils.php b/php/class-utils.php index f88c307e8..6fa569aea 100644 --- a/php/class-utils.php +++ b/php/class-utils.php @@ -258,7 +258,7 @@ public static function user_can( $task, $capability = 'manage_options', $context $capability = apply_filters( 'cloudinary_task_capability', $capability, $task, $context, ...$args ); // phpcs:enable WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed - return current_user_can( $capability, ...$args ); + return current_user_can( $capability, ...$args ); // phpcs:ignore WordPress.WP.Capabilities.Undetermined } /** @@ -758,7 +758,7 @@ public static function purge_fragments() { public static function purge_fragment( $index ) { if ( isset( self::$file_fragments[ $index ] ) ) { fclose( self::$file_fragments[ $index ]['pointer'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose - unlink( self::$file_fragments[ $index ]['file'] ); + unlink( self::$file_fragments[ $index ]['file'] ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink } } diff --git a/php/component/class-config.php b/php/component/class-config.php index 28fef6364..8bd8b30ae 100644 --- a/php/component/class-config.php +++ b/php/component/class-config.php @@ -16,5 +16,4 @@ interface Config { * Retrive config from class. */ public function get_config(); - } diff --git a/php/component/class-notice.php b/php/component/class-notice.php index d0fcee019..79d3c2688 100644 --- a/php/component/class-notice.php +++ b/php/component/class-notice.php @@ -18,5 +18,4 @@ interface Notice { * @return array */ public function get_notices(); - } diff --git a/php/component/class-setup.php b/php/component/class-setup.php index d6086171c..2f5f49e38 100644 --- a/php/component/class-setup.php +++ b/php/component/class-setup.php @@ -16,5 +16,4 @@ interface Setup { * Setup the object. */ public function setup(); // phpcs:ignore - } diff --git a/php/connect/class-api.php b/php/connect/class-api.php index 91e272f54..3b6e370af 100644 --- a/php/connect/class-api.php +++ b/php/connect/class-api.php @@ -129,8 +129,8 @@ class Api { 'f' => 'fetch_format', 'q' => 'quality', 'if' => 'if', - 'y' => 'y_axis', - 'x' => 'x_axis', + 'y' => 'y_axis', + 'x' => 'x_axis', ), ); @@ -186,7 +186,7 @@ public function setup( Plugin $plugin ) { * * @return string */ - public function url( $resource, $function = null, $endpoint = false ) { + public function url( $resource, $function = null, $endpoint = false ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames $parts = array(); if ( $endpoint ) { diff --git a/php/cron/class-lock-object.php b/php/cron/class-lock-object.php index a53835950..b218ff122 100644 --- a/php/cron/class-lock-object.php +++ b/php/cron/class-lock-object.php @@ -83,5 +83,4 @@ public function set_lock_file( $file = null, $data = null ) { public function delete_lock_file( $file = null ) { delete_transient( self::PREFIX . $this->get_lock_file_name( $file ) ); } - } diff --git a/php/integrations/class-wpml.php b/php/integrations/class-wpml.php index dc0468e90..56199c037 100644 --- a/php/integrations/class-wpml.php +++ b/php/integrations/class-wpml.php @@ -243,7 +243,7 @@ public function language_switcher_items( $languages_links ) { break; } - $relationship = new Relationship( $args['asset'] ); + $relationship = new Relationship( $args['asset'] ); $contextual_relationship = $relationship->get_contextualized_relationship( $language ); if ( ! empty( $contextual_relationship ) ) { diff --git a/php/media/class-filter.php b/php/media/class-filter.php index 0831a358b..0867c9ccd 100644 --- a/php/media/class-filter.php +++ b/php/media/class-filter.php @@ -778,7 +778,7 @@ public function record_meta_update( $data, $id ) { * * @return bool */ - public function edit_match_src( $match, $image_location, $image_meta, $attachment_id ) { + public function edit_match_src( $match, $image_location, $image_meta, $attachment_id ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.matchFound if ( $this->media->is_cloudinary_url( $image_location ) ) { $test_id = $this->media->get_public_id_from_url( $image_location ); $public_id = $this->media->get_public_id( $attachment_id ); diff --git a/php/media/class-gallery.php b/php/media/class-gallery.php index 1d91a4e75..c7f8f236b 100644 --- a/php/media/class-gallery.php +++ b/php/media/class-gallery.php @@ -707,7 +707,7 @@ public function setup_hooks() { * @return bool */ if ( apply_filters( 'cloudinary_allow_glb_upload', false ) ) { - add_filter( 'upload_mimes', array( $this, 'add_glb_mime' ), 20, 1 ); + add_filter( 'upload_mimes', array( $this, 'add_glb_mime' ), 20, 1 ); // phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes add_filter( 'wp_check_filetype_and_ext', array( $this, 'pass_glb_filetype_check' ), 10, 3 ); add_filter( 'cloudinary_allowed_extensions', array( $this, 'allow_glb_for_cloudinary' ) ); add_filter( 'cloudinary_is_deliverable', array( $this, 'allow_glb_delivery_from_cloudinary' ), 10, 2 ); diff --git a/php/media/class-video.php b/php/media/class-video.php index 72d57041b..fd21e7dd2 100644 --- a/php/media/class-video.php +++ b/php/media/class-video.php @@ -295,7 +295,7 @@ public function filter_video_block_pre_render( $block, $source_block ) { } elseif ( $this->player_enabled() ) { foreach ( $block['innerContent'] as &$content ) { $urls = Utils::extract_urls( $content ); - $url = reset( $urls ); + $url = reset( $urls ); if ( wp_http_validate_url( $url ) ) { $video_tags = $this->media->filter->get_media_tags( $content ); @@ -532,7 +532,7 @@ protected function build_video_embed( $source, $attributes = array(), $overwrite * * @return array */ - public function default_video_transformations( $default ) { + public function default_video_transformations( $default ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound if ( 'on' === $this->config['video_optimization'] ) { if ( 'auto' === $this->config['video_format'] ) { @@ -555,7 +555,7 @@ public function default_video_transformations( $default ) { * * @return array */ - public function default_video_freeform_transformations( $default ) { + public function default_video_freeform_transformations( $default ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound if ( ! empty( $this->config['video_freeform'] ) ) { $default[] = trim( $this->config['video_freeform'] ); } @@ -664,7 +664,7 @@ function ( $atts ) { * * @return string */ - static function ( $return, $tag, $attr, $m ) { + static function ( $return, $tag, $attr, $m ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.returnFound global $shortcode_tags; if ( 'video' === $tag ) { $supported_formats = array_merge( diff --git a/php/relate/class-relationship.php b/php/relate/class-relationship.php index 072d7dd52..11afe910c 100644 --- a/php/relate/class-relationship.php +++ b/php/relate/class-relationship.php @@ -213,7 +213,7 @@ public static function set_cache( $post_id, $media_context, $data ) { public function delete() { global $wpdb; $table_name = Utils::get_relationship_table(); - $wpdb->delete( + $wpdb->delete( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching $table_name, array( 'post_id' => $this->post_id, diff --git a/php/settings/class-setting.php b/php/settings/class-setting.php index f3e514da2..28de73f29 100644 --- a/php/settings/class-setting.php +++ b/php/settings/class-setting.php @@ -85,7 +85,7 @@ public function __construct( $slug, $root = null, $params = array() ) { * * @param string $parent The slug of the parent setting. */ - public function set_parent( $parent ) { + public function set_parent( $parent ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.parentFound $this->parent = $parent; } @@ -100,7 +100,7 @@ public function get_parent( $depth = 1 ) { $slug = $this->slug; while ( 0 < $depth ) { $slug = substr( $slug, 0, strrpos( $slug, $this->separator ) ); - $depth --; + --$depth; } return $this->root->get_setting( $slug ); diff --git a/php/settings/storage/class-storage.php b/php/settings/storage/class-storage.php index 1189024eb..fa74bfd61 100644 --- a/php/settings/storage/class-storage.php +++ b/php/settings/storage/class-storage.php @@ -115,5 +115,4 @@ abstract public function delete( $slug ); * @return bool */ abstract public function save( $slug ); - } diff --git a/php/sync/class-download-sync.php b/php/sync/class-download-sync.php index 83816e27a..f0cc21272 100644 --- a/php/sync/class-download-sync.php +++ b/php/sync/class-download-sync.php @@ -84,7 +84,7 @@ public function rest_endpoints( $endpoints ) { * * @return bool */ - public function rest_can_upload_files( \WP_REST_Request $request ) { + public function rest_can_upload_files( \WP_REST_Request $request ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found // This would have been from an ajax call. Therefore verify based on capability. return Utils::user_can( 'manage_assets', 'upload_files', 'download' ); diff --git a/php/sync/class-push-sync.php b/php/sync/class-push-sync.php index 4d0d085f3..7c54079e1 100644 --- a/php/sync/class-push-sync.php +++ b/php/sync/class-push-sync.php @@ -275,7 +275,7 @@ public function process_queue( \WP_REST_Request $request ) { $action_message = sprintf( __( '%1$s - cycle %3$s: Syncing asset %2$d', 'cloudinary' ), $thread, $attachment_id, $runs ); do_action( '_cloudinary_queue_action', $action_message, $thread ); $this->process_assets( $attachment_id ); - $runs ++; + ++$runs; $last_id = $attachment_id; } $this->queue->stop_maybe( $thread_type ); diff --git a/php/sync/class-upload-sync.php b/php/sync/class-upload-sync.php index a48b20455..6eb9b9aed 100644 --- a/php/sync/class-upload-sync.php +++ b/php/sync/class-upload-sync.php @@ -136,7 +136,7 @@ public function add_inline_action( $actions, $post ) { esc_attr__( 'Sync and deliver from Cloudinary', 'cloudinary' ), esc_html__( 'Sync and deliver from Cloudinary', 'cloudinary' ) ); - } else if ( file_exists( get_attached_file( $post->ID ) ) ) { + } elseif ( file_exists( get_attached_file( $post->ID ) ) ) { $actions['cloudinary-push'] = sprintf( '%s', $action_url, diff --git a/php/traits/trait-cli.php b/php/traits/trait-cli.php index c5a23d3b2..2cbbfd024 100644 --- a/php/traits/trait-cli.php +++ b/php/traits/trait-cli.php @@ -501,7 +501,7 @@ protected function maybe_do_export( $unsynced_attachments, $errored_attachments protected function export_csv( $data, $type ) { $upload = wp_get_upload_dir(); $filename = trailingslashit( $upload['path'] ) . sanitize_file_name( 'cloudinary-' . $type . '-' . time() . '.csv' ); - $fp = fopen( $filename, 'wb+' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen + $fp = fopen( $filename, 'wb+' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen,WordPress.WP.AlternativeFunctions.file_system_operations_fopen foreach ( $data as $fields ) { fputcsv( $fp, $fields ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fputcsv diff --git a/php/traits/trait-params.php b/php/traits/trait-params.php index 7b8e7e715..a653885f8 100644 --- a/php/traits/trait-params.php +++ b/php/traits/trait-params.php @@ -213,7 +213,7 @@ public function has_params() { * * @return mixed|self */ - public function get_param( $param, $default = null ) { + public function get_param( $param, $default = null ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound $param = $this->sanitize_slug( $param ); $value = $this->get_array_param( $param ); diff --git a/php/ui/class-branch.php b/php/ui/class-branch.php index 4e48cd254..b8ca6c2b9 100644 --- a/php/ui/class-branch.php +++ b/php/ui/class-branch.php @@ -359,5 +359,4 @@ public function get_ids() { return $ids; } - } diff --git a/php/ui/class-component.php b/php/ui/class-component.php index 2af822f14..fe8918db6 100644 --- a/php/ui/class-component.php +++ b/php/ui/class-component.php @@ -327,7 +327,7 @@ protected function is_enabled() { * * @return string */ - public function render( $echo = false ) { + public function render( $echo = false ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.echoFound // Setup the component. $this->pre_render(); diff --git a/php/ui/class-state.php b/php/ui/class-state.php index a7f070649..a7cd1cda2 100644 --- a/php/ui/class-state.php +++ b/php/ui/class-state.php @@ -61,7 +61,7 @@ class State { * * @param Plugin $plugin Instance of the plugin. */ - public function __construct( Plugin $plugin ) { + public function __construct( Plugin $plugin ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found $this->plugin = get_plugin_instance(); $this->user_id = get_current_user_id(); @@ -158,7 +158,7 @@ public function set_state( \WP_REST_Request $request ) { * * @return mixed */ - public function get_state( $key, $default = null ) { + public function get_state( $key, $default = null ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.defaultFound // Add default if not set yet. if ( empty( $this->state[ $key ] ) ) { diff --git a/php/ui/component/class-asset-preview.php b/php/ui/component/class-asset-preview.php index 180f41a45..2d4272db1 100644 --- a/php/ui/component/class-asset-preview.php +++ b/php/ui/component/class-asset-preview.php @@ -130,5 +130,4 @@ public function enqueue_scripts() { $plugin = get_plugin_instance(); wp_enqueue_script( 'cloudinary-asset-edit', $plugin->dir_url . 'js/asset-edit.js', array(), $plugin->version, true ); } - } diff --git a/php/ui/component/class-asset.php b/php/ui/component/class-asset.php index be564c505..85209fcb8 100644 --- a/php/ui/component/class-asset.php +++ b/php/ui/component/class-asset.php @@ -11,8 +11,8 @@ use Cloudinary\Assets; use Cloudinary\UI\Component; use Cloudinary\Utils; -use function Cloudinary\get_plugin_instance; use Cloudinary\Settings\Setting; +use function Cloudinary\get_plugin_instance; /** * HTML Component to render components only. @@ -137,8 +137,8 @@ protected function get_item_row( $item ) { $item_container['children']['row'] = $row; // Content Row. - $row = $this->get_part( 'tr' ); - $row['children']['assets'] = $this->get_part( 'td' ); + $row = $this->get_part( 'tr' ); + $row['children']['assets'] = $this->get_part( 'td' ); $row['children']['assets']['attributes']['id'] = $item->get_slug() . '.viewer'; $row['children']['assets']['attributes']['data-state'] = $state; $row['children']['assets']['attributes']['class'] = array( @@ -216,11 +216,11 @@ protected function get_manager( $item ) { $header_search['children']['search_input'] = $search_box; $header_search['children']['search_button'] = $search_button; - $header_row['children']['search'] = $header_search; - $header_row['children']['action'] = $this->get_part( 'th' ); - $apply = $this->get_part( 'button' ); - $apply['content'] = __( 'Apply Changes', 'cloudinary' ); - $apply['attributes'] = array( + $header_row['children']['search'] = $header_search; + $header_row['children']['action'] = $this->get_part( 'th' ); + $apply = $this->get_part( 'button' ); + $apply['content'] = __( 'Apply Changes', 'cloudinary' ); + $apply['attributes'] = array( 'id' => 'apply_' . $slug, 'data-changes' => array(), 'class' => array( @@ -231,7 +231,7 @@ protected function get_manager( $item ) { 'float: right; margin-left: 6px;', ), ); - $apply['render'] = true; + $apply['render'] = true; $header_row['children']['action']['children']['apply'] = $apply; $header['children']['row'] = $header_row; $manager['children']['header'] = $header; diff --git a/php/ui/component/class-chart-stat.php b/php/ui/component/class-chart-stat.php index 47b657c31..fa94ba8d4 100644 --- a/php/ui/component/class-chart-stat.php +++ b/php/ui/component/class-chart-stat.php @@ -89,5 +89,4 @@ protected function canvas( $struct ) { return $struct; } - } diff --git a/php/ui/component/class-color.php b/php/ui/component/class-color.php index 7c82d3e25..c49d52407 100644 --- a/php/ui/component/class-color.php +++ b/php/ui/component/class-color.php @@ -50,7 +50,7 @@ protected function input( $struct ) { * * @return string|null */ - public function render( $echo = false ) { + public function render( $echo = false ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.echoFound $return = parent::render( $echo ); ?>