| @@ -1,0 +1,84 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * LearnDash Extension | |
| 4 | + * | |
| 5 | + * @package NotificationX\Extensions | |
| 6 | + */ | |
| 7 | + | |
| 8 | +namespace NotificationX\Extensions\LearnDash; | |
| 9 | + | |
| 10 | +use NotificationX\Core\Rules; | |
| 11 | +use NotificationX\GetInstance; | |
| 12 | +use NotificationX\Extensions\Extension; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * LearnDash Extension | |
| 16 | + * @method static LearnDash get_instance($args = null) | |
| 17 | + */ | |
| 18 | +class LearnDash extends Extension { | |
| 19 | + /** | |
| 20 | + * Instance of LearnDash | |
| 21 | + * | |
| 22 | + * @var LearnDash | |
| 23 | + */ | |
| 24 | + use GetInstance; | |
| 25 | + | |
| 26 | + public $priority = 10; | |
| 27 | + public $id = 'learndash'; | |
| 28 | + public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/learndash.png'; | |
| 29 | + public $doc_link = 'https://notificationx.com/docs/how-to-display-learndash-course-enrollment-alert-using-notificationx/'; | |
| 30 | + public $types = 'elearning'; | |
| 31 | + public $module = 'modules_learndash'; | |
| 32 | + public $module_priority = 18; | |
| 33 | + public $is_pro = true; | |
| 34 | + public $version = '1.2.0'; | |
| 35 | + public $class = '\LDLMS_Post_Types'; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Initially Invoked when initialized. | |
| 39 | + */ | |
| 40 | + public function __construct(){ | |
| 41 | + parent::__construct(); | |
| 42 | + } | |
| 43 | + | |
| 44 | + public function init_extension() | |
| 45 | + { | |
| 46 | + $this->title = __('LearnDash', 'notificationx'); | |
| 47 | + $this->module_title = __('LearnDash', 'notificationx'); | |
| 48 | + $this->popup = [ | |
| 49 | + "denyButtonText" => __("<a href='https://notificationx.com/docs/how-to-display-learndash-course-enrollment-alert-using-notificationx/' target='_blank'>More Info</a>", "notificationx"), | |
| 50 | + "confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"), | |
| 51 | + // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 52 | + "html"=> __(' | |
| 53 | + <span>A widely used WordPress learning management system.</span> | |
| 54 | + ', 'notificationx') | |
| 55 | + ]; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public function source_error_message($messages) { | |
| 59 | + if (!$this->class_exists()) { | |
| 60 | + $messages[$this->id] = [ | |
| 61 | + 'message' => __('You have to install <a target="_blank" rel="nofollow" href="https://www.learndash.com">LearnDash</a> plugin first.' , 'notificationx'), | |
| 62 | + 'html' => true, | |
| 63 | + 'type' => 'error', | |
| 64 | + 'rules' => Rules::is('source', $this->id), | |
| 65 | + ]; | |
| 66 | + } | |
| 67 | + return $messages; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public function doc(){ | |
| 71 | + /* translators: %1$s: LearnDash installed & configured link URL, %2$s: documentation link URL, %3$s: Watch video tutorial link URL, %4$s: Integration with LearnDash link URL, %5$s: LearnDash Course Enrollment Rates link URL */ | |
| 72 | + return sprintf(__('<p>Make sure that you have <a target="_blank" href="%1$s">LearnDash installed & configured</a> to use its campaign & course selling data. For further assistance, check out our step by step <a target="_blank" href="%2$s">documentation</a>.</p> | |
| 73 | + <p>🎦 <a target="_blank" href="%3$s">Watch video tutorial</a> to learn quickly</p> | |
| 74 | + <p>👉 NotificationX <a target="_blank" href="%4$s">Integration with LearnDash</a> </p> | |
| 75 | + <p><strong>Recommended Blog:</strong></p> | |
| 76 | + <p>🔥 How to Increase Your <a target="_blank" href="%5$s">LearnDash Course Enrollment Rates</a> With NotificationX</p>', 'notificationx'), | |
| 77 | + 'https://www.learndash.com/', | |
| 78 | + 'https://notificationx.com/docs/how-to-display-learndash-course-enrollment-alert-using-notificationx', | |
| 79 | + 'https://www.youtube.com/watch?v=sTbBt2DVsIA', | |
| 80 | + 'https://notificationx.com/integrations/learndash/', | |
| 81 | + 'https://wpdeveloper.com/learndash-course-enrollment-rate-notificationx/' | |
| 82 | + ); | |
| 83 | + } | |
| 84 | +} | |