1919 * @subpackage Shifter/admin
2020 * @author DigitalCube <hello@getshifter.io>
2121 */
22- class Shifter_Admin
23- {
22+ class Shifter_Admin {
23+
2424
2525 /**
2626 * The ID of this plugin.
@@ -47,8 +47,7 @@ class Shifter_Admin
4747 * @param string $plugin_name The name of this plugin.
4848 * @param string $version The version of this plugin.
4949 */
50- public function __construct ($ plugin_name , $ version )
51- {
50+ public function __construct ( $ plugin_name , $ version ) {
5251 $ this ->plugin_name = $ plugin_name ;
5352 $ this ->version = $ version ;
5453 }
@@ -58,30 +57,31 @@ public function __construct($plugin_name, $version)
5857 *
5958 * @since 1.0.0
6059 */
61- public function notice_shifter_dashboard_timer ()
62- {
60+ public function notice_shifter_dashboard_timer () {
6361 $ bootup_filename = '../.bootup ' ;
6462 $ hard_limit = 180 ;
65- if ($ _ENV ["SHIFTER_LOCAL " ]) return ;
63+ if ( $ _ENV ['SHIFTER_LOCAL ' ] ) {
64+ return ;
65+ }
6666
67- if (file_exists ($ bootup_filename) ) {
68- $ unixtime = file_get_contents ($ bootup_filename , true );
69- $ shifter_remain = $ hard_limit - round (( time () - intval ($ unixtime) ) / 60 );
70- if ($ shifter_remain < 3 ) { ?>
67+ if ( file_exists ( $ bootup_filename ) ) {
68+ $ unixtime = file_get_contents ( $ bootup_filename , true );
69+ $ shifter_remain = $ hard_limit - round ( ( time () - intval ( $ unixtime ) ) / 60 );
70+ if ( $ shifter_remain < 3 ) { ?>
7171 <div class="error">
7272 <ul>
7373 Notice: Shifter will power down WordPress in a few minutes. Please restart WordPress from the Shifter Dashboard.
7474 </ul>
7575 </div>
76- <?php
77- } elseif ($ shifter_remain < 30 ) {
78- ?>
76+ <?php
77+ } elseif ( $ shifter_remain < 30 ) {
78+ ?>
7979 <div class="error">
8080 <ul>
81- Notice: Shifter will power down WordPress in <?php echo esc_html ($ shifter_remain ); ?> minutes. Please restart WordPress from the Shifter Dashboard.
81+ Notice: Shifter will power down WordPress in <?php echo esc_html ( $ shifter_remain ); ?> minutes. Please restart WordPress from the Shifter Dashboard.
8282 </ul>
8383 </div>
84- <?php
84+ <?php
8585 }
8686 }
8787 }
@@ -94,20 +94,19 @@ public function notice_shifter_dashboard_timer()
9494 * @param string $old_value Old Value.
9595 * @param string $value Value.
9696 */
97- public function option_cache_flush ($ option , $ old_value = '' , $ value = '' )
98- {
99- if (!empty ($ option )) {
100- wp_cache_delete ($ option , 'options ' );
101- foreach (array ('alloptions ' , 'notoptions ' ) as $ options_name ) {
102- $ options = wp_cache_get ($ options_name , 'options ' );
103- if (!is_array ($ options )) {
97+ public function option_cache_flush ( $ option , $ old_value = '' , $ value = '' ) {
98+ if ( ! empty ( $ option ) ) {
99+ wp_cache_delete ( $ option , 'options ' );
100+ foreach ( array ( 'alloptions ' , 'notoptions ' ) as $ options_name ) {
101+ $ options = wp_cache_get ( $ options_name , 'options ' );
102+ if ( ! is_array ( $ options ) ) {
104103 $ options = array ();
105104 }
106- if (isset ($ options [$ option]) ) {
107- unset($ options [$ option] );
108- wp_cache_set ($ options_name , $ options , 'options ' );
105+ if ( isset ( $ options [ $ option ] ) ) {
106+ unset( $ options [ $ option ] );
107+ wp_cache_set ( $ options_name , $ options , 'options ' );
109108 }
110- unset($ options );
109+ unset( $ options );
111110 }
112111 }
113112 }
@@ -118,22 +117,21 @@ public function option_cache_flush($option, $old_value = '', $value = '')
118117 *
119118 * @since 1.0.0
120119 */
121- public function shifter_heartbert_on_sitepreview_write_script ()
122- {
123- if (is_user_logged_in ()) {
120+ public function shifter_heartbert_on_sitepreview_write_script () {
121+ if ( is_user_logged_in () ) {
124122 ?>
125123 <script>
126124 function shifter_heartbert_getajax() {
127125 var xhr = new XMLHttpRequest();
128- xhr.open("GET", "<?php echo esc_url (add_query_arg ('action ' , 'nopriv_heartbeat ' , site_url ('/wp-admin/admin-ajax.php ' )) ); ?> ");
126+ xhr.open("GET", "<?php echo esc_url ( add_query_arg ( 'action ' , 'nopriv_heartbeat ' , site_url ( '/wp-admin/admin-ajax.php ' ) ) ); ?> ");
129127 xhr.send();
130128 }
131129 var shifterHB = setInterval("shifter_heartbert_getajax()", 30000);
132130 setTimeout(function() {
133131 clearInterval(shifterHB)
134132 }, 1500000);
135133 </script>
136- <?php
134+ <?php
137135 }
138136 }
139137
@@ -144,8 +142,7 @@ function shifter_heartbert_getajax() {
144142 * @since 1.0.0
145143 * @param string $email_address Email address.
146144 */
147- public function shifter_mail_from ($ email_address )
148- {
145+ public function shifter_mail_from ( $ email_address ) {
149146 return 'wordpress@app.getshifter.io ' ;
150147 }
151148
@@ -157,19 +154,18 @@ public function shifter_mail_from($email_address)
157154 *
158155 * @since 1.1.1
159156 */
160- private function replace_url_to_public_domain ($ url )
161- {
162- $ replaced_domain = getenv ('SHIFTER_DOMAIN ' );
163- if (!$ replaced_domain ) {
164- $ replaced_domain = getenv ('CF_DOMAIN ' );
157+ private function replace_url_to_public_domain ( $ url ) {
158+ $ replaced_domain = getenv ( 'SHIFTER_DOMAIN ' );
159+ if ( ! $ replaced_domain ) {
160+ $ replaced_domain = getenv ( 'CF_DOMAIN ' );
165161 }
166- if ($ replaced_domain ) {
167- $ parsed_url = wp_parse_url ($ url );
162+ if ( $ replaced_domain ) {
163+ $ parsed_url = wp_parse_url ( $ url );
168164 $ replace_target = $ parsed_url ['host ' ];
169- if (isset ($ parsed_url ['port ' ]) && $ parsed_url ['port ' ]) {
165+ if ( isset ( $ parsed_url ['port ' ] ) && $ parsed_url ['port ' ] ) {
170166 $ replace_target .= ": {$ parsed_url ['port ' ]}" ;
171167 }
172- return preg_replace ("# {$ replace_target }#i " , $ replaced_domain , $ url );
168+ return preg_replace ( "# {$ replace_target }#i " , $ replaced_domain , $ url );
173169 }
174170 return $ url ;
175171 }
@@ -181,9 +177,8 @@ private function replace_url_to_public_domain($url)
181177 *
182178 * @since 1.0.0
183179 */
184- public function replace_algolia_posts_permalink ($ record )
185- {
186- $ record ['permalink ' ] = $ this ->replace_url_to_public_domain ($ record ['permalink ' ]);
180+ public function replace_algolia_posts_permalink ( $ record ) {
181+ $ record ['permalink ' ] = $ this ->replace_url_to_public_domain ( $ record ['permalink ' ] );
187182 return $ record ;
188183 }
189184 /**
@@ -193,9 +188,8 @@ public function replace_algolia_posts_permalink($record)
193188 *
194189 * @since 1.1.0
195190 */
196- public function replace_algolia_terms_permalink ($ record )
197- {
198- $ record ['permalink ' ] = $ this ->replace_url_to_public_domain ($ record ['permalink ' ]);
191+ public function replace_algolia_terms_permalink ( $ record ) {
192+ $ record ['permalink ' ] = $ this ->replace_url_to_public_domain ( $ record ['permalink ' ] );
199193 return $ record ;
200194 }
201195
@@ -206,9 +200,8 @@ public function replace_algolia_terms_permalink($record)
206200 *
207201 * @since 1.1.0
208202 */
209- public function replace_algolia_users_posts_url ($ record )
210- {
211- $ record ['posts_url ' ] = $ this ->replace_url_to_public_domain ($ record ['posts_url ' ]);
203+ public function replace_algolia_users_posts_url ( $ record ) {
204+ $ record ['posts_url ' ] = $ this ->replace_url_to_public_domain ( $ record ['posts_url ' ] );
212205 return $ record ;
213206 }
214207
@@ -217,8 +210,7 @@ public function replace_algolia_users_posts_url($record)
217210 *
218211 * @since 1.0.0
219212 */
220- public function shifter_icon ()
221- {
213+ public function shifter_icon () {
222214 return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4QUQCAwVRk5ANwAAAeFJREFUOMu9lEFIVEEYx38zs7LiQSja7BAaHcIoaqGDslFIyEadYusU0cki6yAaBV0FD8kSBGlLeVEwIcgkKMukDmEYLLXtJamI7dihQ0Qs+t73psM+t0V9vidI32mGmfl98/2/+Y/Cj9nMSN6IHIiJgxEHI+6ftplrW9hgxGrGFqgLWIscmk2OWqDajGS1ZS0A5RpwGeBDR7824hITB+05Xut8llLystKeKCNuRW/XVUpZ2fZlogKczYzQOdl1LiBpCYgD9aAO+vMe4Ea1Mq0KWDkO2BhA52QXr07dw3jSqj25YMTJp6Z7J/wDiQoMwC7L0ABs93lvEp/H06t0OjZ1EavUDNAHPHiXzu6PINnXHQujR3/sPR8ofKL6hpRKhMB+WaP3ATR9GgsAWo4Aj4Du9hdXX68D+yi6fuvO4v2l9bpMx5NLeeAMwNsTt0hN961J21UYflpKXtnYww6C/YMO/R+nRPHruO/xOuB32OaVdmPu5G2lrBf3fxyMuN6yU4y4uuoOcW1zMbcY5YaNvg3jIRf5BhyKAiz7TmgMqe5hpKYcftazhGUwBOY1F3M3I3c59bx3AMvjtVkWqzgN8D3ZHQ04n87S9vJ6BjgLzAGLFn4COWDP7vd3pgBaCndXnf0LIlef9HGSOIAAAAAASUVORK5CYII= ' ;
223215 }
224216
@@ -227,10 +219,9 @@ public function shifter_icon()
227219 *
228220 * @since 1.0.0
229221 */
230- public function shifter_mu_admin ()
231- {
222+ public function shifter_mu_admin () {
232223 echo "<div class='wrap'> " ;
233- echo '<h1> ' . esc_html__ ('Shifter ' , 'shifter-mu-admin ' ) . '</h1> ' ;
224+ echo '<h1> ' . esc_html__ ( 'Shifter ' , 'shifter-mu-admin ' ) . '</h1> ' ;
234225 echo "<div class='card'>
235226 <h2 class='title'>Generator Settings</h2>
236227 <span>Customize your static site generator settings for faster build times.</span>
@@ -254,8 +245,7 @@ public function shifter_mu_admin()
254245 *
255246 * @since 1.0.0
256247 */
257- public function shifter_mu_admin_page ()
258- {
248+ public function shifter_mu_admin_page () {
259249 add_menu_page (
260250 'Shifter ' ,
261251 'Shifter ' ,
@@ -274,18 +264,16 @@ public function shifter_mu_admin_page()
274264 *
275265 * @since 1.0.3
276266 */
277- public function hide_update_notice ()
278- {
279- remove_action ('admin_notices ' , 'update_nag ' , 3 );
267+ public function hide_update_notice () {
268+ remove_action ( 'admin_notices ' , 'update_nag ' , 3 );
280269 }
281270
282271 /**
283272 * Remove Core Update
284273 *
285274 * @since 1.0.4
286275 */
287- public function remove_core_updates ()
288- {
276+ public function remove_core_updates () {
289277 global $ wp_version ;
290278 return (object ) array (
291279 'last_checked ' => time (),
0 commit comments