projecthuddle.php
78 lines
| 1 | <?php |
| 2 | /** |
| 3 | * ProjectHuddle core integrations file |
| 4 | * |
| 5 | * @since 1.0.0 |
| 6 | * @package SureTrigger |
| 7 | */ |
| 8 | |
| 9 | namespace SureTriggers\Integrations\ProjectHuddle; |
| 10 | |
| 11 | use Project_Huddle; |
| 12 | use SureTriggers\Controllers\IntegrationsController; |
| 13 | use SureTriggers\Integrations\Integrations; |
| 14 | use SureTriggers\Traits\SingletonLoader; |
| 15 | |
| 16 | /** |
| 17 | * Class SureTrigger |
| 18 | * |
| 19 | * @package SureTriggers\Integrations\ProjectHuddle |
| 20 | */ |
| 21 | class ProjectHuddle extends Integrations { |
| 22 | |
| 23 | |
| 24 | |
| 25 | use SingletonLoader; |
| 26 | |
| 27 | /** |
| 28 | * ID |
| 29 | * |
| 30 | * @var string |
| 31 | */ |
| 32 | protected $id = 'ProjectHuddle'; |
| 33 | |
| 34 | /** |
| 35 | * SureTrigger constructor. |
| 36 | */ |
| 37 | public function __construct() { |
| 38 | $this->name = __( 'SureFeedback', 'suretriggers' ); |
| 39 | $this->description = __( 'A WordPress plugin for Website & Design feedback.', 'suretriggers' ); |
| 40 | $this->icon_url = SURE_TRIGGERS_URL . 'assets/icons/projecthuddle.png'; |
| 41 | add_action( 'ph_website_pre_rest_update_thread_attribute', [ $this, 'ph_after_comment_resolved' ], 10, 3 ); |
| 42 | parent::__construct(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * On Comment resolved. |
| 47 | * |
| 48 | * @param string $attr Resolved. |
| 49 | * @param string $value Value. |
| 50 | * @param string $object Post object. |
| 51 | * @return void |
| 52 | */ |
| 53 | public function ph_after_comment_resolved( $attr, $value, $object ) { |
| 54 | |
| 55 | if ( 'resolved' !== $attr ) { |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | // if it is resolved, do something! |
| 60 | if ( $value ) { |
| 61 | $comment = $object; |
| 62 | do_action( 'suretriggers_ph_after_comment_approval', $comment ); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Is Plugin depended plugin is installed or not. |
| 68 | * |
| 69 | * @return bool |
| 70 | */ |
| 71 | public function is_plugin_installed() { |
| 72 | return class_exists( '\Project_Huddle' ); |
| 73 | } |
| 74 | |
| 75 | } |
| 76 | |
| 77 | IntegrationsController::register( ProjectHuddle::class ); |
| 78 |