Admin
6 years ago
Ajax
6 years ago
Autoloader
6 years ago
Capabilities
6 years ago
Check
6 years ago
Column
6 years ago
Deprecated
6 years ago
Exception
6 years ago
Form
6 years ago
Helper
6 years ago
Integration
6 years ago
ListScreen
6 years ago
Message
6 years ago
Meta
6 years ago
Plugin
6 years ago
Preferences
6 years ago
Relation
6 years ago
Request
6 years ago
Response
6 years ago
Screen
6 years ago
Settings
6 years ago
Storage
6 years ago
Table
6 years ago
ThirdParty
6 years ago
Transient
6 years ago
API.php
6 years ago
Addon.php
6 years ago
Admin.php
6 years ago
AdminColumns.php
6 years ago
ArrayIterator.php
6 years ago
Autoloader.php
6 years ago
Builder.php
6 years ago
Capabilities.php
6 years ago
Collection.php
6 years ago
Column.php
6 years ago
Config.php
6 years ago
DefaultColumns.php
6 years ago
Dependencies.php
6 years ago
Expirable.php
6 years ago
Groups.php
6 years ago
Helper.php
6 years ago
Integration.php
6 years ago
IntegrationFactory.php
6 years ago
Integrations.php
6 years ago
ListScreen.php
6 years ago
ListScreenFactory.php
6 years ago
ListScreenGroups.php
6 years ago
ListScreenPost.php
6 years ago
ListScreenWP.php
6 years ago
Message.php
6 years ago
MetaType.php
6 years ago
Middleware.php
6 years ago
Plugin.php
6 years ago
PluginInformation.php
6 years ago
Preferences.php
6 years ago
Registrable.php
6 years ago
Relation.php
6 years ago
Request.php
6 years ago
Screen.php
6 years ago
ScreenController.php
6 years ago
Settings.php
6 years ago
Transient.php
6 years ago
TypedArrayIterator.php
6 years ago
View.php
6 years ago
Integration.php
140 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC; |
| 4 | |
| 5 | abstract class Integration { |
| 6 | |
| 7 | /** @var string */ |
| 8 | private $basename; |
| 9 | |
| 10 | /** @var string */ |
| 11 | private $title; |
| 12 | |
| 13 | /** @var string */ |
| 14 | private $logo; |
| 15 | |
| 16 | /** @var string */ |
| 17 | private $page; |
| 18 | |
| 19 | /** @var string */ |
| 20 | private $plugin_link; |
| 21 | |
| 22 | /** |
| 23 | * @var string |
| 24 | */ |
| 25 | private $description; |
| 26 | |
| 27 | /** |
| 28 | * @param string $basename |
| 29 | * @param string $title |
| 30 | * @param string $logo |
| 31 | * @param string $description |
| 32 | * @param string $plugin_link |
| 33 | * @param string $page |
| 34 | */ |
| 35 | public function __construct( $basename, $title, $logo, $description, $plugin_link = null, $page = null ) { |
| 36 | if ( null === $plugin_link ) { |
| 37 | $plugin_link = $this->search_plugin( $title ); |
| 38 | } |
| 39 | |
| 40 | if ( null === $page ) { |
| 41 | $page = 'pricing-purchase'; |
| 42 | } |
| 43 | |
| 44 | $this->basename = $basename; |
| 45 | $this->title = $title; |
| 46 | $this->logo = $logo; |
| 47 | $this->description = $description; |
| 48 | $this->plugin_link = $plugin_link; |
| 49 | $this->page = $page; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @return bool |
| 54 | */ |
| 55 | abstract public function is_plugin_active(); |
| 56 | |
| 57 | /** |
| 58 | * @param Screen $screen |
| 59 | * |
| 60 | * @return bool |
| 61 | */ |
| 62 | abstract public function show_notice( Screen $screen ); |
| 63 | |
| 64 | /** |
| 65 | * @param string $name |
| 66 | * |
| 67 | * @return string |
| 68 | */ |
| 69 | private function search_plugin( $name ) { |
| 70 | return add_query_arg( |
| 71 | array( |
| 72 | 'tab' => 'search', |
| 73 | 'type' => 'term', |
| 74 | 's' => $name, |
| 75 | ), |
| 76 | admin_url( 'plugin-install.php' ) |
| 77 | ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @return string |
| 82 | */ |
| 83 | public function get_basename() { |
| 84 | return $this->basename; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @return string |
| 89 | */ |
| 90 | public function get_slug() { |
| 91 | return dirname( $this->basename ); |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @return string |
| 96 | */ |
| 97 | public function get_title() { |
| 98 | return $this->title; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @return string |
| 103 | */ |
| 104 | public function get_logo() { |
| 105 | return $this->logo; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * @return string |
| 110 | */ |
| 111 | public function get_description() { |
| 112 | return $this->description; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return string |
| 117 | */ |
| 118 | public function get_link() { |
| 119 | return ac_get_site_utm_url( $this->page, 'addon', $this->get_slug() ); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * @return string |
| 124 | */ |
| 125 | public function get_plugin_link() { |
| 126 | return $this->plugin_link; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Determines when the placeholder column is shown for a particular list screen. |
| 131 | * |
| 132 | * @param ListScreen $list_screen |
| 133 | * |
| 134 | * @return bool |
| 135 | */ |
| 136 | public function show_placeholder( ListScreen $list_screen ) { |
| 137 | return true; |
| 138 | } |
| 139 | |
| 140 | } |