From fbf85a4a9ed2d3cd754c806bf1d811c49c75193a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 31 May 2023 16:00:44 +0100 Subject: [PATCH 1/3] Cleanup --- php/class-media.php | 1 - 1 file changed, 1 deletion(-) diff --git a/php/class-media.php b/php/class-media.php index c5e2333c9..1443164aa 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -982,7 +982,6 @@ public function get_transformations( $attachment_id, $transformations = array(), /** * Get the crop transformation for the attachment. - * Returns false if no crop is found. * * @param int|string $attachment_id The attachment ID or type. * @param array $size The requested size width and height. From 36bd5190baf947de242c7959675eb5f02b88bceb Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 31 May 2023 16:09:15 +0100 Subject: [PATCH 2/3] Improve documentation --- php/class-media.php | 15 ++++++++++++++- php/ui/component/class-crops.php | 8 ++++---- ui-definitions/settings-image.php | 11 +++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/php/class-media.php b/php/class-media.php index 1443164aa..f5ce440ed 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -1006,8 +1006,21 @@ public function get_crop_transformations( $attachment_id, $size ) { } } + /** + * Enable the crop size settings. + * + * @hook cloudinary_enabled_crop_sizes + * @since 3.1.3 + * @default {false} + * + * @param $enabeld {bool} Are the crop sizes enabled? + * + * @retrun {bool} + */ + $enabled_crop_sizes = apply_filters( 'cloudinary_enabled_crop_sizes', false ); + // Check for custom crop. - if ( is_numeric( $attachment_id ) && apply_filters( 'cloudinary_enabled_crop_sizes', false ) ) { + if ( is_numeric( $attachment_id ) && $enabled_crop_sizes ) { $meta_sizes = $this->get_post_meta( $attachment_id, 'cloudinary_metaboxes_crop_meta', true ); if ( ! empty( $meta_sizes['single_crop_sizes']['single_sizes'] ) ) { $custom_sizes = $meta_sizes['single_crop_sizes']['single_sizes']; diff --git a/php/ui/component/class-crops.php b/php/ui/component/class-crops.php index 6a0cd1113..d8311d19b 100644 --- a/php/ui/component/class-crops.php +++ b/php/ui/component/class-crops.php @@ -121,12 +121,12 @@ protected function make_selector() { /** * Filter the demo files. * - * @since 3.1.3 + * @hook cloudinary_registered_sizes + * @since 3.1.3 * - * @hook cloudinary_registered_sizes - * - * @param array $demo_files array of demo files. + * @param $demo_files {array} array of demo files. * + * @return {array} */ $examples = apply_filters( 'cloudinary_demo_crop_files', $this->demo_files ); if ( 'full' === $mode ) { diff --git a/ui-definitions/settings-image.php b/ui-definitions/settings-image.php index 47beae809..5ab24b2b8 100644 --- a/ui-definitions/settings-image.php +++ b/ui-definitions/settings-image.php @@ -202,6 +202,17 @@ 'slug' => 'crop_sizes', 'title' => __( 'Crops Sizes', 'cloudinary' ), 'enabled' => function () { + /** + * Enable the crop size settings. + * + * @hook cloudinary_enabled_crop_sizes + * @since 3.1.3 + * @default {false} + * + * @param $enabeld {bool} Are the crop sizes enabled? + * + * @retrun {bool} + */ return apply_filters( 'cloudinary_enabled_crop_sizes', false ); }, ), From 41fad2ea3ce2e6d7f7560ea98f8661107c7e397f Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 31 May 2023 16:11:07 +0100 Subject: [PATCH 3/3] Cleanup --- php/url/class-cloudinary.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/php/url/class-cloudinary.php b/php/url/class-cloudinary.php index 5a06e9f29..81002bb64 100644 --- a/php/url/class-cloudinary.php +++ b/php/url/class-cloudinary.php @@ -7,6 +7,7 @@ namespace Cloudinary\URL; +use Cloudinary\Connect\Api; use Cloudinary\Media; use function Cloudinary\get_plugin_instance; @@ -18,7 +19,7 @@ class Cloudinary extends Url_Object { /** * Holds the Connect API object. * - * @var \Cloudinary\Connect\Api + * @var Api */ protected $api;