peepso.php
81 lines
| 1 | <?php |
| 2 | /** |
| 3 | * PeepSo core integrations file |
| 4 | * |
| 5 | * @since 1.0.0 |
| 6 | * @package SureTrigger |
| 7 | */ |
| 8 | |
| 9 | namespace SureTriggers\Integrations\PeepSo; |
| 10 | |
| 11 | use SureTriggers\Controllers\IntegrationsController; |
| 12 | use SureTriggers\Integrations\Integrations; |
| 13 | use SureTriggers\Traits\SingletonLoader; |
| 14 | |
| 15 | /** |
| 16 | * Class SureTrigger |
| 17 | * |
| 18 | * @package SureTriggers\Integrations\PeepSo |
| 19 | */ |
| 20 | class PeepSo extends Integrations { |
| 21 | |
| 22 | |
| 23 | use SingletonLoader; |
| 24 | |
| 25 | /** |
| 26 | * ID |
| 27 | * |
| 28 | * @var string |
| 29 | */ |
| 30 | protected $id = 'PeepSo'; |
| 31 | |
| 32 | /** |
| 33 | * SureTrigger constructor. |
| 34 | */ |
| 35 | public function __construct() { |
| 36 | $this->name = __( 'PeepSo', 'suretriggers' ); |
| 37 | $this->description = __( 'PeepSo is a social network plugin for WordPress that allows you to quickly add a social network.', 'suretriggers' ); |
| 38 | $this->icon_url = SURE_TRIGGERS_URL . 'assets/icons/peepso.svg'; |
| 39 | |
| 40 | parent::__construct(); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get customer context data. |
| 45 | * |
| 46 | * @param int $post_id post details. |
| 47 | * @param int $activity_id activity id. |
| 48 | * |
| 49 | * @return array |
| 50 | */ |
| 51 | public static function get_pp_activity_context( $post_id, $activity_id ) { |
| 52 | |
| 53 | $pp_post = get_post( $post_id ); |
| 54 | if ( ! $pp_post instanceof \WP_Post ) { |
| 55 | return []; |
| 56 | } |
| 57 | $context['post_id'] = $pp_post->ID; |
| 58 | $context['activity_id'] = $activity_id; |
| 59 | $context['post_author'] = $pp_post->post_author; |
| 60 | $context['post_content'] = $pp_post->post_content; |
| 61 | $context['post_title'] = $pp_post->post_title; |
| 62 | $context['post_excerpt'] = $pp_post->post_excerpt; |
| 63 | $context['post_status'] = $pp_post->post_status; |
| 64 | $context['post_type'] = $pp_post->post_type; |
| 65 | |
| 66 | return $context; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Is Plugin depended on plugin is installed or not. |
| 71 | * |
| 72 | * @return bool |
| 73 | */ |
| 74 | public function is_plugin_installed() { |
| 75 | return class_exists( 'PeepSo' ); |
| 76 | } |
| 77 | |
| 78 | } |
| 79 | |
| 80 | IntegrationsController::register( PeepSo::class ); |
| 81 |