PluginProbe
Getwid – Gutenberg Blocks / 3.0.2
Getwid – Gutenberg Blocks v3.0.2
3.0.2 3.0.1 3.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 trunk 1.8.7 1.9.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9
← All changes | includes/getwid.php +234 -248 2.0.53.0.2 View file →
@@ -1,248 +1,234 @@
1 -<?php
2 -
3 -namespace Getwid;
4 -
5 -if ( ! defined( 'ABSPATH' ) ) {
6 - exit;
7 -}
8 -
9 -final class Getwid {
10 - /**
11 - * @var Getwid
12 - */
13 - private static $instance = null;
14 -
15 - /**
16 - * @var Settings
17 - */
18 - private $settings;
19 -
20 - /**
21 - * @var ScriptsManager
22 - */
23 - private $scriptsManager;
24 -
25 - /**
26 - * @var FontIconsManager
27 - */
28 - private $fontIconsManager;
29 -
30 - /**
31 - * @var BlocksManager
32 - */
33 - private $blocksManager;
34 -
35 - /**
36 - * @var InstagramTokenManager
37 - */
38 - private $instagramTokenManager;
39 -
40 - /**
41 - * @var VersionControl
42 - */
43 - private $versionControl;
44 -
45 - /**
46 - * @var SettingsPage
47 - */
48 - private $settingsPage;
49 -
50 - /**
51 - * @var RestAPI
52 - */
53 - private $restAPI;
54 -
55 - /**
56 - * @var PostTemplatePart
57 - */
58 - private $postTemplatePart;
59 -
60 - /**
61 - * @var AllowedCssTags
62 - */
63 - private $allowedCssTags;
64 -
65 - /**
66 - * @var Mailer
67 - */
68 - private $mailer;
69 -
70 - /**
71 - * @var AssetsOptimization
72 - */
73 - private $assetsOptimization;
74 -
75 - private function __construct() {
76 -
77 - require_once GETWID_PLUGIN_DIR . 'includes/load.php';
78 -
79 - $this->assetsOptimization = AssetsOptimization::getInstance();
80 -
81 - add_action( 'init', array( $this, 'init' ), 0 );
82 -
83 - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
84 - add_filter( 'plugin_action_links_' . GETWID_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
85 - }
86 -
87 - /**
88 - * Init Getwid when WordPress Initialises.
89 - */
90 - public function init() {
91 - $this->settings = new Settings();
92 - $this->versionControl = new VersionControl();
93 - $this->scriptsManager = new ScriptsManager();
94 - $this->fontIconsManager = new FontIconsManager();
95 - $this->blocksManager = new BlocksManager();
96 - $this->instagramTokenManager = new InstagramTokenManager();
97 - $this->settingsPage = new SettingsPage();
98 - $this->restAPI = new RestAPI();
99 - $this->postTemplatePart = new PostTemplatePart();
100 - $this->allowedCssTags = new AllowedCssTags();
101 - $this->mailer = new Mailer();
102 - }
103 -
104 - /**
105 - * @return ScriptsManager
106 - */
107 - public function scriptsManager(){
108 - return $this->scriptsManager;
109 - }
110 -
111 - /**
112 - * @return FontIconsManager
113 - */
114 - public function fontIconsManager(){
115 - return $this->fontIconsManager;
116 - }
117 -
118 - /**
119 - * @return BlocksManager
120 - */
121 - public function blocksManager(){
122 - return $this->blocksManager;
123 - }
124 -
125 - /**
126 - * @return InstagramTokenManager
127 - */
128 - public function instagramTokenManager(){
129 - return $this->instagramTokenManager;
130 - }
131 -
132 - /**
133 - * @return VersionControl
134 - */
135 - public function versionControl(){
136 - return $this->versionControl;
137 - }
138 -
139 - /**
140 - * @return SettingsPage
141 - */
142 - public function settingsPage(){
143 - return $this->settingsPage;
144 - }
145 -
146 - /**
147 - * @return RestAPI
148 - */
149 - public function restAPI(){
150 - return $this->restAPI;
151 - }
152 -
153 - /**
154 - * @return PostTemplatePart
155 - */
156 - public function postTemplatePart(){
157 - return $this->postTemplatePart;
158 - }
159 -
160 - /**
161 - * @return AllowedCssTags
162 - */
163 - public function allowedCssTags(){
164 - return $this->allowedCssTags;
165 - }
166 -
167 - /**
168 - * @return Mailer
169 - */
170 - public function mailer(){
171 - return $this->mailer;
172 - }
173 -
174 - /**
175 - * @return Settings
176 - */
177 - public function settings(){
178 - return $this->settings;
179 - }
180 -
181 - /**
182 - * @return AssetsOptimization
183 - */
184 - public function assetsOptimization(){
185 - return $this->assetsOptimization;
186 - }
187 -
188 - /**
189 - * @return Getwid
190 - */
191 - public static function getInstance(){
192 - if ( is_null( self::$instance ) ) {
193 - self::$instance = new self();
194 - }
195 -
196 - return self::$instance;
197 - }
198 -
199 - public function is_rest_api_request() {
200 -
201 - if ( empty( $_SERVER['REQUEST_URI'] ) ) {
202 - return false;
203 - }
204 -
205 - $rest_prefix = trailingslashit( rest_get_url_prefix() );
206 - $is_rest_api_request = ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix ) );
207 -
208 - return apply_filters( 'getwid/is_rest_api_request', $is_rest_api_request );
209 - }
210 -
211 - /**
212 - * Show row meta on the plugin screen.
213 - *
214 - * @return array
215 - */
216 - public function plugin_row_meta( $links, $file ) {
217 -
218 - if ( GETWID_PLUGIN_BASENAME === $file ) {
219 -
220 - $row_meta = array(
221 - 'support' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/getwid/' ) . '" aria-label="' .
222 - esc_attr__( 'Support', 'getwid' ) . '">' . esc_html__( 'Support', 'getwid' ) . '</a>',
223 - 'review' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/getwid/reviews/' ) . '" aria-label="' .
224 - esc_attr__( 'Write a Review', 'getwid' ) . '">' . esc_html__( 'Write a Review', 'getwid' ) . '</a>',
225 - );
226 -
227 - return array_merge( $links, $row_meta );
228 - }
229 -
230 - return (array) $links;
231 - }
232 -
233 - public function plugin_action_links( $actions ) {
234 -
235 - if ( current_user_can( 'manage_options' ) ) {
236 -
237 - $settings_url = $this->settingsPage->getTabUrl('general');
238 -
239 - return array_merge(
240 - $actions,
241 - array( 'settings' => sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'getwid' ) ) )
242 - );
243 - }
244 -
245 - return $actions;
246 - }
247 -
248 -}
1 +<?php
2 +
3 +namespace Getwid;
4 +
5 +if ( ! defined( 'ABSPATH' ) ) {
6 + exit;
7 +}
8 +
9 +final class Getwid {
10 + /**
11 + * @var Getwid
12 + */
13 + private static $instance = null;
14 +
15 + /**
16 + * @var Settings
17 + */
18 + private $settings;
19 +
20 + /**
21 + * @var ScriptsManager
22 + */
23 + private $scriptsManager;
24 +
25 + /**
26 + * @var FontIconsManager
27 + */
28 + private $fontIconsManager;
29 +
30 + /**
31 + * @var BlocksManager
32 + */
33 + private $blocksManager;
34 +
35 + /**
36 + * @var InstagramTokenManager
37 + */
38 + private $instagramTokenManager;
39 +
40 + /**
41 + * @var VersionControl
42 + */
43 + private $versionControl;
44 +
45 + /**
46 + * @var SettingsPage
47 + */
48 + private $settingsPage;
49 +
50 + /**
51 + * @var RestAPI
52 + */
53 + private $restAPI;
54 +
55 + /**
56 + * @var PostTemplatePart
57 + */
58 + private $postTemplatePart;
59 +
60 + /**
61 + * @var AllowedCssTags
62 + */
63 + private $allowedCssTags;
64 +
65 + /**
66 + * @var Mailer
67 + */
68 + private $mailer;
69 +
70 + private function __construct() {
71 +
72 + require_once GETWID_PLUGIN_DIR . 'includes/load.php';
73 +
74 + add_action( 'init', array( $this, 'init' ), 0 );
75 +
76 + add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
77 + add_filter( 'plugin_action_links_' . GETWID_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
78 + }
79 +
80 + /**
81 + * Init Getwid when WordPress Initialises.
82 + */
83 + public function init() {
84 + $this->settings = new Settings();
85 + $this->versionControl = new VersionControl();
86 + $this->scriptsManager = new ScriptsManager();
87 + $this->fontIconsManager = new FontIconsManager();
88 + $this->blocksManager = new BlocksManager();
89 + $this->instagramTokenManager = new InstagramTokenManager();
90 + $this->settingsPage = new SettingsPage();
91 + $this->restAPI = new RestAPI();
92 + $this->postTemplatePart = new PostTemplatePart();
93 + $this->allowedCssTags = new AllowedCssTags();
94 + $this->mailer = new Mailer();
95 + }
96 +
97 + /**
98 + * @return ScriptsManager
99 + */
100 + public function scriptsManager(){
101 + return $this->scriptsManager;
102 + }
103 +
104 + /**
105 + * @return FontIconsManager
106 + */
107 + public function fontIconsManager(){
108 + return $this->fontIconsManager;
109 + }
110 +
111 + /**
112 + * @return BlocksManager
113 + */
114 + public function blocksManager(){
115 + return $this->blocksManager;
116 + }
117 +
118 + /**
119 + * @return InstagramTokenManager
120 + */
121 + public function instagramTokenManager(){
122 + return $this->instagramTokenManager;
123 + }
124 +
125 + /**
126 + * @return VersionControl
127 + */
128 + public function versionControl(){
129 + return $this->versionControl;
130 + }
131 +
132 + /**
133 + * @return SettingsPage
134 + */
135 + public function settingsPage(){
136 + return $this->settingsPage;
137 + }
138 +
139 + /**
140 + * @return RestAPI
141 + */
142 + public function restAPI(){
143 + return $this->restAPI;
144 + }
145 +
146 + /**
147 + * @return PostTemplatePart
148 + */
149 + public function postTemplatePart(){
150 + return $this->postTemplatePart;
151 + }
152 +
153 + /**
154 + * @return AllowedCssTags
155 + */
156 + public function allowedCssTags(){
157 + return $this->allowedCssTags;
158 + }
159 +
160 + /**
161 + * @return Mailer
162 + */
163 + public function mailer(){
164 + return $this->mailer;
165 + }
166 +
167 + /**
168 + * @return Settings
169 + */
170 + public function settings(){
171 + return $this->settings;
172 + }
173 +
174 + /**
175 + * @return Getwid
176 + */
177 + public static function getInstance(){
178 + if ( is_null( self::$instance ) ) {
179 + self::$instance = new self();
180 + }
181 +
182 + return self::$instance;
183 + }
184 +
185 + public function is_rest_api_request() {
186 +
187 + if ( empty( $_SERVER['REQUEST_URI'] ) ) {
188 + return false;
189 + }
190 +
191 + $rest_prefix = trailingslashit( rest_get_url_prefix() );
192 + $is_rest_api_request = ( false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix ) );
193 +
194 + return apply_filters( 'getwid/is_rest_api_request', $is_rest_api_request );
195 + }
196 +
197 + /**
198 + * Show row meta on the plugin screen.
199 + *
200 + * @return array
201 + */
202 + public function plugin_row_meta( $links, $file ) {
203 +
204 + if ( GETWID_PLUGIN_BASENAME === $file ) {
205 +
206 + $row_meta = array(
207 + 'support' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/getwid/' ) . '" aria-label="' .
208 + esc_attr__( 'Support', 'getwid' ) . '">' . esc_html__( 'Support', 'getwid' ) . '</a>',
209 + 'review' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/getwid/reviews/' ) . '" aria-label="' .
210 + esc_attr__( 'Write a Review', 'getwid' ) . '">' . esc_html__( 'Write a Review', 'getwid' ) . '</a>',
211 + );
212 +
213 + return array_merge( $links, $row_meta );
214 + }
215 +
216 + return (array) $links;
217 + }
218 +
219 + public function plugin_action_links( $actions ) {
220 +
221 + if ( current_user_can( 'manage_options' ) ) {
222 +
223 + $settings_url = $this->settingsPage->getTabUrl('general');
224 +
225 + return array_merge(
226 + $actions,
227 + array( 'settings' => sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'getwid' ) ) )
228 + );
229 + }
230 +
231 + return $actions;
232 + }
233 +
234 +}