Orbit Fox by ThemeIsle - Version 2.4.0

Version Description

  • 2018-02-16
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Orbit Fox by ThemeIsle
Version 2.4.0
Comparing to
See all releases

Code changes from version 2.3.4 to 2.4.0

CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
 
2
- ### v2.3.4 - 2018-02-08
3
  **Changes:**
4
- * Enhancements for Hestia Theme
5
- * Made structure more modular
6
 
7
  ### v2.3.1 - 2018-01-17
8
  **Changes:**
1
 
2
+ ### v2.4.0 - 2018-02-16
3
  **Changes:**
4
+ * Adds a new module for uptime monitor of your website.
5
+ * Adds 4 more hooks for modules related actions.
6
 
7
  ### v2.3.1 - 2018-01-17
8
  **Changes:**
core/app/abstract/class-orbit-fox-module-abstract.php CHANGED
@@ -117,6 +117,17 @@ abstract class Orbit_Fox_Module_Abstract {
117
  $this->slug = str_replace( '_', '-', strtolower( str_replace( '_OBFX_Module', '', get_class( $this ) ) ) );
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
120
  /**
121
  * Method to return path to child class in a Reflective Way.
122
  *
@@ -160,15 +171,19 @@ abstract class Orbit_Fox_Module_Abstract {
160
 
161
  /**
162
  * Registers the loader.
 
163
  *
164
  * @codeCoverageIgnore
165
  *
166
  * @since 1.0.0
 
167
  * @access public
168
  * @param Orbit_Fox_Loader $loader The loader class used to register action hooks and filters.
169
  */
170
  public function register_loader( Orbit_Fox_Loader $loader ) {
171
  $this->loader = $loader;
 
 
172
  }
173
 
174
  /**
@@ -356,19 +371,40 @@ abstract class Orbit_Fox_Module_Abstract {
356
  return $this->model->set_module_option( $this->slug, $key, $value );
357
  }
358
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  /**
360
  * Method to update a set of options.
 
361
  *
362
  * @codeCoverageIgnore
363
  *
364
  * @since 1.0.0
 
365
  * @access public
366
  * @param array $options An associative array of options to be
367
  * updated. Eg. ( 'key' => 'new_value' ).
368
  * @return mixed
369
  */
370
  final public function set_options( $options ) {
371
- return $this->model->set_module_options( $this->slug, $options );
 
 
 
372
  }
373
 
374
  /**
117
  $this->slug = str_replace( '_', '-', strtolower( str_replace( '_OBFX_Module', '', get_class( $this ) ) ) );
118
  }
119
 
120
+ /**
121
+ * Getter method for slug.
122
+ *
123
+ * @since 2.3.3
124
+ * @access public
125
+ * @return mixed|string
126
+ */
127
+ public function get_slug() {
128
+ return $this->slug;
129
+ }
130
+
131
  /**
132
  * Method to return path to child class in a Reflective Way.
133
  *
171
 
172
  /**
173
  * Registers the loader.
174
+ * And setup activate and deactivate hooks. Added in v2.3.3.
175
  *
176
  * @codeCoverageIgnore
177
  *
178
  * @since 1.0.0
179
+ * @updated 2.3.3
180
  * @access public
181
  * @param Orbit_Fox_Loader $loader The loader class used to register action hooks and filters.
182
  */
183
  public function register_loader( Orbit_Fox_Loader $loader ) {
184
  $this->loader = $loader;
185
+ $this->loader->add_action( $this->get_slug() . '_activate', $this, 'activate' );
186
+ $this->loader->add_action( $this->get_slug() . '_deactivate', $this, 'deactivate' );
187
  }
188
 
189
  /**
371
  return $this->model->set_module_option( $this->slug, $key, $value );
372
  }
373
 
374
+ /**
375
+ * Stub for activate hook.
376
+ *
377
+ * @since 2.3.3
378
+ * @access public
379
+ */
380
+ public function activate() {}
381
+
382
+ /**
383
+ * Stub for deactivate hook.
384
+ *
385
+ * @since 2.3.3
386
+ * @access public
387
+ */
388
+ public function deactivate() {}
389
+
390
  /**
391
  * Method to update a set of options.
392
+ * Added in v2.3.3 actions for before and after options save.
393
  *
394
  * @codeCoverageIgnore
395
  *
396
  * @since 1.0.0
397
+ * @updated 2.3.3
398
  * @access public
399
  * @param array $options An associative array of options to be
400
  * updated. Eg. ( 'key' => 'new_value' ).
401
  * @return mixed
402
  */
403
  final public function set_options( $options ) {
404
+ do_action( $this->get_slug() . '_before_options_save', $options );
405
+ $result = $this->model->set_module_options( $this->slug, $options );
406
+ do_action( $this->get_slug() . '_after_options_save' );
407
+ return $result;
408
  }
409
 
410
  /**
core/app/class-orbit-fox-admin.php CHANGED
@@ -275,6 +275,7 @@ class Orbit_Fox_Admin {
275
  $response['type'] = 'warning';
276
  $response['message'] = __( 'Something went wrong, can not change module status!', 'themeisle-companion' );
277
  $result = $module->set_status( 'active', $data['checked'] );
 
278
  if ( $result ) {
279
  $response['type'] = 'success';
280
  $response['message'] = __( 'Module status changed!', 'themeisle-companion' );
@@ -284,6 +285,25 @@ class Orbit_Fox_Admin {
284
  return $response;
285
  }
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  /**
288
  * Method to display modules page.
289
  *
275
  $response['type'] = 'warning';
276
  $response['message'] = __( 'Something went wrong, can not change module status!', 'themeisle-companion' );
277
  $result = $module->set_status( 'active', $data['checked'] );
278
+ $this->trigger_activate_deactivate( $data['checked'], $module );
279
  if ( $result ) {
280
  $response['type'] = 'success';
281
  $response['message'] = __( 'Module status changed!', 'themeisle-companion' );
285
  return $response;
286
  }
287
 
288
+ /**
289
+ * A method to trigger module activation or deavtivation hook
290
+ * based in active status.
291
+ *
292
+ * @codeCoverageIgnore
293
+ *
294
+ * @since 2.3.3
295
+ * @access public
296
+ * @param boolean $active_status The active status.
297
+ * @param Orbit_Fox_Module_Abstract $module The module referenced.
298
+ */
299
+ public function trigger_activate_deactivate( $active_status, Orbit_Fox_Module_Abstract $module ) {
300
+ if ( $active_status == true ) {
301
+ do_action( $module->get_slug() . '_activate' );
302
+ } else {
303
+ do_action( $module->get_slug() . '_deactivate' );
304
+ }
305
+ }
306
+
307
  /**
308
  * Method to display modules page.
309
  *
core/app/class-orbit-fox-global-settings.php CHANGED
@@ -68,6 +68,7 @@ class Orbit_Fox_Global_Settings {
68
  'menu-icons',
69
  'mystock-import',
70
  'beaver-widgets',
 
71
  )
72
  );
73
  }// End if().
68
  'menu-icons',
69
  'mystock-import',
70
  'beaver-widgets',
71
+ 'uptime-monitor',
72
  )
73
  );
74
  }// End if().
core/assets/css/orbit-fox-admin.css CHANGED
@@ -8,7 +8,7 @@
8
  * Extends Spectre.css Library
9
  */
10
  /*
11
- Version: 2.3.4
12
  */
13
 
14
  /* Document
8
  * Extends Spectre.css Library
9
  */
10
  /*
11
+ Version: 2.4.0
12
  */
13
 
14
  /* Document
core/includes/class-orbit-fox.php CHANGED
@@ -69,7 +69,7 @@ class Orbit_Fox {
69
 
70
  $this->plugin_name = 'orbit-fox';
71
 
72
- $this->version = '2.3.4';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
69
 
70
  $this->plugin_name = 'orbit-fox';
71
 
72
+ $this->version = '2.4.0';
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
obfx_modules/menu-icons/init.php CHANGED
@@ -201,7 +201,7 @@ class Menu_Icons_OBFX_Module extends Orbit_Fox_Module_Abstract {
201
  if ( ! function_exists( 'get_current_screen' ) ) {
202
  return;
203
  }
204
-
205
  $screen = get_current_screen();
206
  if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) {
207
  return;
201
  if ( ! function_exists( 'get_current_screen' ) ) {
202
  return;
203
  }
204
+
205
  $screen = get_current_screen();
206
  if ( ! $screen instanceof WP_Screen || 'nav-menus' !== $screen->id ) {
207
  return;
obfx_modules/uptime-monitor/init.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Mock-up to demonstrate and test module use.
4
+ *
5
+ * @link https://themeisle.com
6
+ * @since 1.0.0
7
+ *
8
+ * @package Uptime_Monitor_OBFX_Module
9
+ */
10
+
11
+ /**
12
+ * The class defines a new module to be used by Orbit Fox plugin.
13
+ *
14
+ * @package Uptime_Monitor_OBFX_Module
15
+ * @author Themeisle <friends@themeisle.com>
16
+ */
17
+ class Uptime_Monitor_OBFX_Module extends Orbit_Fox_Module_Abstract {
18
+ /**
19
+ * @var string Uptime api endpoint.
20
+ */
21
+ private $monitor_url = 'https://monitor.orbitfox.com';
22
+
23
+ /**
24
+ * Test_OBFX_Module constructor.
25
+ *
26
+ * @since 1.0.0
27
+ * @access public
28
+ */
29
+ public function __construct() {
30
+ parent::__construct();
31
+ $this->name = __( 'Uptime Monitor', 'themeisle-companion' );
32
+ $this->description = __( 'A module to notify when you website goes down.', 'themeisle-companion' );
33
+
34
+ }
35
+
36
+ /**
37
+ * Determine if module should be loaded.
38
+ *
39
+ * @since 1.0.0
40
+ * @access public
41
+ * @return bool
42
+ */
43
+ public function enable_module() {
44
+ return true;
45
+ }
46
+
47
+ /**
48
+ * The loading logic for the module.
49
+ *
50
+ * @since 1.0.0
51
+ * @access public
52
+ */
53
+ public function load() {
54
+ }
55
+
56
+ /**
57
+ * Method called on module activation.
58
+ * Calls the API to register an url to monitor.
59
+ *
60
+ * @since 2.3.3
61
+ * @access public
62
+ */
63
+ public function after_options_save() {
64
+ $this->activate();
65
+ }
66
+
67
+ /**
68
+ * Method invoked after options save.
69
+ *
70
+ * @since 2.3.3
71
+ * @access public
72
+ */
73
+ public function activate() {
74
+ $monitor_url = $this->monitor_url . '/api/monitor/create';
75
+ $url = home_url();
76
+ $email = $this->get_option( 'monitor_email' );
77
+ $args = array(
78
+ 'body' => array( 'url' => $url, 'email' => $email )
79
+ );
80
+ $response = wp_remote_post( $monitor_url, $args );
81
+
82
+ }
83
+
84
+ /**
85
+ * Method invoked before options save.
86
+ *
87
+ * @since 2.3.3
88
+ * @access public
89
+ */
90
+ public function before_options_save( $options ) {
91
+ $this->deactivate();
92
+ }
93
+
94
+ /**
95
+ * Method called on module deactivation.
96
+ * Calls the API to unregister an url from the monitor.
97
+ *
98
+ * @since 2.3.3
99
+ * @access public
100
+ */
101
+ public function deactivate() {
102
+ $monitor_url = $this->monitor_url . '/api/monitor/remove';
103
+ $url = home_url();
104
+ $args = array(
105
+ 'body' => array( 'url' => $url )
106
+ );
107
+ $response = wp_remote_post( $monitor_url, $args );
108
+ $api_response = json_decode( $response['body'] );
109
+ }
110
+
111
+ /**
112
+ * Method to define hooks needed.
113
+ *
114
+ * @since 1.0.0
115
+ * @access public
116
+ */
117
+ public function hooks() {
118
+ $this->loader->add_action( $this->get_slug() . '_before_options_save', $this, 'before_options_save', 10, 1 );
119
+ $this->loader->add_action( $this->get_slug() . '_after_options_save', $this, 'after_options_save' );
120
+ }
121
+
122
+ /**
123
+ * Method that returns an array of scripts and styles to be loaded
124
+ * for the front end part.
125
+ *
126
+ * @since 1.0.0
127
+ * @access public
128
+ * @return array
129
+ */
130
+ public function public_enqueue() {
131
+ return array();
132
+ }
133
+
134
+ /**
135
+ * Method that returns an array of scripts and styles to be loaded
136
+ * for the admin part.
137
+ *
138
+ * @since 1.0.0
139
+ * @access public
140
+ * @return array|boolean
141
+ */
142
+ public function admin_enqueue() {
143
+ $current_screen = get_current_screen();
144
+
145
+ if ( ! isset( $current_screen->id ) ) {
146
+ return array();
147
+ }
148
+ if ( $current_screen->id != 'dashboard' ) {
149
+ return array();
150
+ }
151
+
152
+ return array(
153
+ 'js' => array(
154
+ 'stats' => array( 'jquery' ),
155
+ ),
156
+ 'css' => array(
157
+ 'stats' => false,
158
+ ),
159
+ );
160
+ }
161
+
162
+ /**
163
+ * Method to define the options fields for the module
164
+ *
165
+ * @since 1.0.0
166
+ * @access public
167
+ * @return array
168
+ */
169
+ public function options() {
170
+ return array(
171
+ array(
172
+ 'id' => 'monitor_email',
173
+ 'name' => 'monitor_email',
174
+ 'title' => 'Notification email',
175
+ 'description' => 'Email where we should notify you when the site goes down.',
176
+ 'type' => 'text',
177
+ 'default' => get_option( 'admin_email', '' ),
178
+ 'placeholder' => 'Add your email.',
179
+ )
180
+ );
181
+ }
182
+ }
readme.md CHANGED
@@ -89,10 +89,10 @@ Activating the Orbit Fox Companion plugin is just like any other plugin. If you'
89
  5. Social Sharing Module
90
 
91
  ## Changelog ##
92
- ### 2.3.4 - 2018-02-08 ###
93
 
94
- * Enhancements for Hestia Theme
95
- * Made structure more modular
96
 
97
 
98
  ### 2.3.1 - 2018-01-17 ###
89
  5. Social Sharing Module
90
 
91
  ## Changelog ##
92
+ ### 2.4.0 - 2018-02-16 ###
93
 
94
+ * Adds a new module for uptime monitor of your website.
95
+ * Adds 4 more hooks for modules related actions.
96
 
97
 
98
  ### 2.3.1 - 2018-01-17 ###
readme.txt CHANGED
@@ -89,10 +89,10 @@ Activating the Orbit Fox Companion plugin is just like any other plugin. If you'
89
  5. Social Sharing Module
90
 
91
  == Changelog ==
92
- = 2.3.4 - 2018-02-08 =
93
 
94
- * Enhancements for Hestia Theme
95
- * Made structure more modular
96
 
97
 
98
  = 2.3.1 - 2018-01-17 =
89
  5. Social Sharing Module
90
 
91
  == Changelog ==
92
+ = 2.4.0 - 2018-02-16 =
93
 
94
+ * Adds a new module for uptime monitor of your website.
95
+ * Adds 4 more hooks for modules related actions.
96
 
97
 
98
  = 2.3.1 - 2018-01-17 =
themeisle-companion.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Orbit Fox Companion
16
  * Plugin URI: https://themeisle.com/plugins/orbit-fox-companion
17
  * Description: This swiss-knife plugin comes with a quality template library, menu/sharing icons modules, and newly added Elementor/BeaverBuilder page builder widgets on each release.
18
- * Version: 2.3.4
19
  * Author: Themeisle
20
  * Author URI: https://themeisle.com
21
  * License: GPL-2.0+
15
  * Plugin Name: Orbit Fox Companion
16
  * Plugin URI: https://themeisle.com/plugins/orbit-fox-companion
17
  * Description: This swiss-knife plugin comes with a quality template library, menu/sharing icons modules, and newly added Elementor/BeaverBuilder page builder widgets on each release.
18
+ * Version: 2.4.0
19
  * Author: Themeisle
20
  * Author URI: https://themeisle.com
21
  * License: GPL-2.0+
themeisle-hash.json CHANGED
@@ -1 +1 @@
1
- {"class-autoloader.php":"57e533b653d235e76cb9953720e4f5e9","index.php":"39ab8276fb0e4bd3fcab3270822c5977","themeisle-companion.php":"a2753e2016d83ea261c43376891278ab","uninstall.php":"7abf753a29e0eb3a844c8a0ba9493b7c"}
1
+ {"class-autoloader.php":"57e533b653d235e76cb9953720e4f5e9","index.php":"39ab8276fb0e4bd3fcab3270822c5977","themeisle-companion.php":"8ef4be62e651fec4e682328c8c19ed0e","uninstall.php":"7abf753a29e0eb3a844c8a0ba9493b7c"}
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0a8b01582ba1f6dc622a30d8baec64ad::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit4035687531a206f15a6b6487aad54c2a
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire4035687531a206f15a6b6487aad54c2a($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequire4035687531a206f15a6b6487aad54c2a($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0a8b01582ba1f6dc622a30d8baec64ad
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0a8b01582ba1f6dc622a30d8baec64ad', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0a8b01582ba1f6dc622a30d8baec64ad', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequire0a8b01582ba1f6dc622a30d8baec64ad($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequire0a8b01582ba1f6dc622a30d8baec64ad($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;