default
3 days ago
dummy
3 days ago
shortpixel
3 days ago
class-foogallery-thumb-engine.php
3 days ago
class-foogallery-thumb-image-editor-gd.php
3 days ago
class-foogallery-thumb-image-editor-imagick.php
3 days ago
class-foogallery-thumb-manager.php
3 days ago
includes.php
3 days ago
class-foogallery-thumb-engine.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * Base class for the thumbnail engine |
| 9 | */ |
| 10 | if ( ! class_exists( 'FooGallery_Thumb_Engine' ) ) { |
| 11 | |
| 12 | abstract class FooGallery_Thumb_Engine { |
| 13 | |
| 14 | /** |
| 15 | * Does any initilization needed for the engine |
| 16 | */ |
| 17 | abstract function init(); |
| 18 | |
| 19 | /** |
| 20 | * Generates a thumbnail for an image based on arguments |
| 21 | * |
| 22 | * @param $url |
| 23 | * @param array $args |
| 24 | * |
| 25 | * @return string |
| 26 | */ |
| 27 | abstract function generate( $url, $args = array() ); |
| 28 | |
| 29 | /** |
| 30 | * Does the engine use a local cache to store thumbnails |
| 31 | * @return bool |
| 32 | */ |
| 33 | abstract function has_local_cache(); |
| 34 | |
| 35 | /** |
| 36 | * Clears the local cach for a file |
| 37 | * @param $file |
| 38 | */ |
| 39 | abstract function clear_local_cache_for_file( $file ); |
| 40 | |
| 41 | /** |
| 42 | * Returns the last error encountered when trying to generate a thumbnail |
| 43 | * @return mixed |
| 44 | */ |
| 45 | abstract function get_last_error(); |
| 46 | |
| 47 | /** |
| 48 | * Returns true if the engine utilizes WordPress Image Editors under the hood |
| 49 | * By default, if the engine has a local cache, then they would also use image editors |
| 50 | * |
| 51 | * @return bool |
| 52 | */ |
| 53 | function uses_image_editors() { |
| 54 | return $this->has_local_cache(); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns true if the engine requires thumb generation tests to be performed |
| 59 | * By default, if the engine has a local cache, then they would also use require tests |
| 60 | * |
| 61 | * @return bool |
| 62 | */ |
| 63 | function requires_thumbnail_generation_tests() { |
| 64 | return $this->has_local_cache(); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 |