← All changes
|
inc/ExternalPlugin/Elementor/LPDynamicElementor.php
+69
-69
4.3.8
→
4.4.8
View file →
| @@ -1,69 +1,69 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Class LPDynamicElementor | |
| 4 | - * Declare base properties for dynamic course elementor | |
| 5 | - * | |
| 6 | - * @since 4.2.3.5 | |
| 7 | - * @version 1.0.0 | |
| 8 | - */ | |
| 9 | -namespace LearnPress\ExternalPlugin\Elementor; | |
| 10 | - | |
| 11 | -use Elementor\Modules\DynamicTags\Module; | |
| 12 | -use LearnPress\Models\CourseModel; | |
| 13 | -use LP_Course; | |
| 14 | - | |
| 15 | -defined( 'ABSPATH' ) || exit; | |
| 16 | - | |
| 17 | -trait LPDynamicElementor { | |
| 18 | - public $lp_dynamic_name = ''; | |
| 19 | - public $lp_dynamic_categories = [ Module::TEXT_CATEGORY ]; | |
| 20 | - public $lp_dynamic_title = ''; | |
| 21 | - public $lp_dynamic_group = LPElementor::GROUP_DYNAMIC; | |
| 22 | - | |
| 23 | - public function get_name() { | |
| 24 | - return $this->lp_dynamic_name; | |
| 25 | - } | |
| 26 | - | |
| 27 | - public function get_categories() { | |
| 28 | - return $this->lp_dynamic_categories; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function get_group() { | |
| 32 | - return $this->lp_dynamic_group; | |
| 33 | - } | |
| 34 | - | |
| 35 | - public function get_title() { | |
| 36 | - return $this->lp_dynamic_title; | |
| 37 | - } | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * Get course | |
| 41 | - * | |
| 42 | - * @return bool|LP_Course|mixed | |
| 43 | - * @deprecated 4.2.7.3 | |
| 44 | - */ | |
| 45 | - public function get_course() { | |
| 46 | - $id = get_the_ID(); | |
| 47 | - if ( ! $id ) { | |
| 48 | - return false; | |
| 49 | - } | |
| 50 | - | |
| 51 | - return learn_press_get_course( $id ); | |
| 52 | - } | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * Get course | |
| 56 | - * | |
| 57 | - * @return false|CourseModel | |
| 58 | - * @since 4.2.7.3 | |
| 59 | - * @version 1.0.0 | |
| 60 | - */ | |
| 61 | - public function get_course_model() { | |
| 62 | - $id = get_the_ID(); | |
| 63 | - if ( ! $id ) { | |
| 64 | - return false; | |
| 65 | - } | |
| 66 | - | |
| 67 | - return CourseModel::find( $id, true ); | |
| 68 | - } | |
| 69 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Class LPDynamicElementor | |
| 4 | + * Declare base properties for dynamic course elementor | |
| 5 | + * | |
| 6 | + * @since 4.2.3.5 | |
| 7 | + * @version 1.0.0 | |
| 8 | + */ | |
| 9 | +namespace LearnPress\ExternalPlugin\Elementor; | |
| 10 | + | |
| 11 | +use Elementor\Modules\DynamicTags\Module; | |
| 12 | +use LearnPress\Models\CourseModel; | |
| 13 | +use LP_Course; | |
| 14 | + | |
| 15 | +defined( 'ABSPATH' ) || exit; | |
| 16 | + | |
| 17 | +trait LPDynamicElementor { | |
| 18 | + public $lp_dynamic_name = ''; | |
| 19 | + public $lp_dynamic_categories = [ Module::TEXT_CATEGORY ]; | |
| 20 | + public $lp_dynamic_title = ''; | |
| 21 | + public $lp_dynamic_group = LPElementor::GROUP_DYNAMIC; | |
| 22 | + | |
| 23 | + public function get_name() { | |
| 24 | + return $this->lp_dynamic_name; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public function get_categories() { | |
| 28 | + return $this->lp_dynamic_categories; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public function get_group() { | |
| 32 | + return $this->lp_dynamic_group; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public function get_title() { | |
| 36 | + return $this->lp_dynamic_title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Get course | |
| 41 | + * | |
| 42 | + * @return bool|LP_Course|mixed | |
| 43 | + * @deprecated 4.2.7.3 | |
| 44 | + */ | |
| 45 | + public function get_course() { | |
| 46 | + $id = get_the_ID(); | |
| 47 | + if ( ! $id ) { | |
| 48 | + return false; | |
| 49 | + } | |
| 50 | + | |
| 51 | + return learn_press_get_course( $id ); | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Get course | |
| 56 | + * | |
| 57 | + * @return false|CourseModel | |
| 58 | + * @since 4.2.7.3 | |
| 59 | + * @version 1.0.0 | |
| 60 | + */ | |
| 61 | + public function get_course_model() { | |
| 62 | + $id = get_the_ID(); | |
| 63 | + if ( ! $id ) { | |
| 64 | + return false; | |
| 65 | + } | |
| 66 | + | |
| 67 | + return CourseModel::find( $id, true ); | |
| 68 | + } | |
| 69 | +} | |