non-sshare-styles
1 month ago
class-hustle-decorator-non-sshare.php
3 months ago
class-hustle-decorator-sshare.php
3 months ago
class-hustle-decorator_abstract.php
3 years ago
class-hustle-module-preview.php
1 year ago
hustle-module-front-ajax.php
3 days ago
hustle-module-front.php
3 days ago
hustle-module-inline-style-queue.php
3 months ago
hustle-module-renderer.php
1 month ago
hustle-renderer-abstract.php
3 months ago
hustle-renderer-sshare.php
3 days ago
class-hustle-decorator_abstract.php
85 lines
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | /** |
| 3 | * Hustle_Decorator_Abstract |
| 4 | * |
| 5 | * @package Hustle |
| 6 | */ |
| 7 | |
| 8 | /** |
| 9 | * Class Hustle_Decorator_Abstract |
| 10 | */ |
| 11 | abstract class Hustle_Decorator_Abstract { |
| 12 | |
| 13 | /** |
| 14 | * Module |
| 15 | * |
| 16 | * @var object |
| 17 | */ |
| 18 | protected $module; |
| 19 | |
| 20 | /** |
| 21 | * Instance of the design meta handler of the module. |
| 22 | * |
| 23 | * @since 4.3.0 |
| 24 | * @var Hustle_Meta_Base_Design |
| 25 | */ |
| 26 | protected $design_meta; |
| 27 | |
| 28 | /** |
| 29 | * Design |
| 30 | * |
| 31 | * @var array |
| 32 | */ |
| 33 | protected $design; |
| 34 | |
| 35 | /** |
| 36 | * Desktop breakpoint |
| 37 | * |
| 38 | * @var int |
| 39 | */ |
| 40 | protected $bp_desktop; |
| 41 | /** |
| 42 | * Mobile breakpoint |
| 43 | * |
| 44 | * @var int |
| 45 | */ |
| 46 | protected $bp_mobile; |
| 47 | |
| 48 | /** |
| 49 | * Gets the string with the module's styles. |
| 50 | * The meat of the class. |
| 51 | * |
| 52 | * @since 4.3.0 |
| 53 | * @return string |
| 54 | */ |
| 55 | abstract protected function get_styles(); |
| 56 | |
| 57 | /** |
| 58 | * Constructor |
| 59 | * |
| 60 | * @param Hustle_Model $module Module. |
| 61 | */ |
| 62 | public function __construct( Hustle_Model $module ) { |
| 63 | $this->module = $module; |
| 64 | |
| 65 | $this->bp_mobile = Hustle_Settings_Admin::get_mobile_breakpoint(); |
| 66 | $this->bp_desktop = $this->bp_mobile + 1; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get module styles |
| 71 | * |
| 72 | * @param type $module_type Module type. |
| 73 | * @return type |
| 74 | */ |
| 75 | public function get_module_styles( $module_type ) { |
| 76 | |
| 77 | $this->design_meta = $this->module->get_design(); |
| 78 | $this->design = (array) $this->module->design; // Making it an array to avoic changing all the decorator files. |
| 79 | |
| 80 | $styles = $this->get_styles(); |
| 81 | |
| 82 | return wp_strip_all_tags( $styles ); |
| 83 | } |
| 84 | } |
| 85 |