PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.2.16
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.2.16
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
← All changes | includes/Bootstrap.php +44 -40 2.0.32.2.16 View file →
@@ -1,8 +1,10 @@
1 1 <?php
2 2
3 3 namespace Hurrytimer;
4 4
5 +use Carbon\Carbon;
6 +
5 7 /**
6 8 * The file that defines the core plugin class
7 9 *
8 10 * A class definition that includes attributes and functions used across both the
@@ -59,9 +61,8 @@
59 61 $this->version = HURRYT_VERSION;
60 62 $this->pluginName = 'hurrytimer';
61 63 }
62 64
63 -
64 65 public function run()
65 66 {
66 67 $this->loadDependencies();
67 68 $this->setLocale();
@@ -70,9 +71,8 @@
70 71 $this->defineAdminHooks();
71 72 $this->defineFrontHooks();
72 73 }
73 74
74 -
75 75 /**
76 76 * Autoload the required dependencies for this plugin.
77 77 *
78 78 * @since 1.0.0
@@ -77,20 +77,27 @@
77 77 *
78 78 * @since 1.0.0
79 79 * @access private
80 80 */
81 - function loadDependencies()
81 + public function loadDependencies()
82 82 {
83 - \spl_autoload_register(function ($class) {
84 - if (strpos($class, __NAMESPACE__) !== 0) {
83 + require HURRYT_DIR . 'includes/vendor/autoload.php';
84 + \spl_autoload_register( function ( $class ) {
85 + if ( strpos( $class, __NAMESPACE__ ) !== 0 ) {
85 86 return;
86 87 }
87 - $class = str_replace('Hurrytimer', '', $class);
88 - $class = str_replace('\\', '/', $class);
88 + $class = str_replace( 'Hurrytimer', '', $class );
89 + $class = str_replace( '\\', '/', $class );
89 90 require_once HURRYT_DIR . "includes/{$class}.php";
90 - });
91 + } );
92 + require HURRYT_DIR . 'includes/functions.php';
91 93
92 -
94 + Carbon::macro( 'getBrowserTimestamp', function () {
95 + /**
96 + * @var Carbon $this
97 + */
98 + return $this->getTimestamp() * 1000;
99 + } );
93 100 }
94 101
95 102 /**
96 103 * Define the locale for this plugin for internationalization.
@@ -112,13 +119,11 @@
112 119
113 120 private function maybeUpgrade()
114 121 {
115 122 add_action(
116 - 'plugins_loaded',
117 - [
118 - Upgrade::getInstance(),
119 - 'run',
120 - ]
123 + 'plugins_loaded', function () {
124 + Upgrade::getInstance()->run();
125 + }
121 126 );
122 127 }
123 128
124 129 /**
@@ -133,16 +138,16 @@
133 138 $plugin_admin = new Admin(
134 139 $this->getPluginName(),
135 140 $this->getVersion()
136 141 );
137 - add_action('admin_menu', [$plugin_admin, 'menu']);
138 - add_action('admin_init', [$plugin_admin, 'settingsBox']);
142 + add_action( 'admin_menu', [ $plugin_admin, 'menu' ] );
143 + add_action( 'admin_init', [ $plugin_admin, 'settingsBox' ] );
139 144
140 145 //removeIf(pro)
141 - add_filter('add_meta_boxes', [$plugin_admin, 'upgradeBanner']);
146 + add_filter( 'add_meta_boxes', [ $plugin_admin, 'upgradeBanner' ] );
142 147 //endRemoveIf(pro)
143 - add_action('admin_enqueue_scripts', [$plugin_admin, 'enqueueStyles']);
144 - add_action('admin_enqueue_scripts', [$plugin_admin, 'enqueueScripts']);
148 + add_action( 'admin_enqueue_scripts', [ $plugin_admin, 'enqueueStyles' ] );
149 + add_action( 'admin_enqueue_scripts', [ $plugin_admin, 'enqueueScripts' ] );
145 150 }
146 151
147 152 /**
148 153 * Register all of the hooks related to the public-facing functionality
@@ -157,10 +162,10 @@
157 162 $this->getPluginName(),
158 163 $this->getVersion()
159 164 );
160 165
161 - add_action('wp_enqueue_scripts', [$front, 'enqueue_styles']);
162 - add_action('wp_enqueue_scripts', [$front, 'enqueue_scripts']);
166 + add_action( 'wp_enqueue_scripts', [ $front, 'enqueue_styles' ] );
167 + add_action( 'wp_enqueue_scripts', [ $front, 'enqueue_scripts' ] );
163 168 }
164 169
165 170 /**
166 171 * The name of the plugin used to uniquely identify it within the context of
@@ -165,10 +170,10 @@
165 170 /**
166 171 * The name of the plugin used to uniquely identify it within the context of
167 172 * WordPress and to define internationalization functionality.
168 173 *
174 + * @return string The name of the plugin.
169 175 * @since 1.0.0
170 - * @return string The name of the plugin.
171 176 */
172 177 public function getPluginName()
173 178 {
174 179 return $this->pluginName;
@@ -173,14 +178,13 @@
173 178 {
174 179 return $this->pluginName;
175 180 }
176 181
177 -
178 182 /**
179 183 * Retrieve the version number of the plugin.
180 184 *
185 + * @return string The version number of the plugin.
181 186 * @since 1.0.0
182 - * @return string The version number of the plugin.
183 187 */
184 188 public function getVersion()
185 189 {
186 190 return $this->version;
@@ -188,27 +192,27 @@
188 192
189 193 public function registerPostType()
190 194 {
191 195 $args = array(
192 - 'label' => __('All', DOMAIN),
196 + 'label' => __( 'All', DOMAIN ),
193 197 'labels' => array(
194 - 'name' => __('Campaign', DOMAIN),
195 - 'singular_name' => __('Campaign', DOMAIN),
196 - 'add_new' => __('Add Campaign', DOMAIN),
197 - 'add_new_item' => __('Add Campaign', DOMAIN),
198 - 'edit' => __('Edit', DOMAIN),
199 - 'edit_item' => __('Edit Campaign', DOMAIN),
200 - 'new_item' => __('New Campaign', DOMAIN),
201 - 'view' => __('View Campaign', DOMAIN),
202 - 'view_item' => __('View Campaign', DOMAIN),
203 - 'search_items' => __('Search Campaign', DOMAIN),
204 - 'not_found' => __('No Campaign', DOMAIN),
198 + 'name' => __( 'Campaigns', DOMAIN ),
199 + 'singular_name' => __( 'Campaign', DOMAIN ),
200 + 'add_new' => __( 'Add Campaign', DOMAIN ),
201 + 'add_new_item' => __( 'Add Campaign', DOMAIN ),
202 + 'edit' => __( 'Edit', DOMAIN ),
203 + 'edit_item' => __( 'Edit Campaign', DOMAIN ),
204 + 'new_item' => __( 'New Campaign', DOMAIN ),
205 + 'view' => __( 'View Campaign', DOMAIN ),
206 + 'view_item' => __( 'View Campaign', DOMAIN ),
207 + 'search_items' => __( 'Search Campaign', DOMAIN ),
208 + 'not_found' => __( 'No Campaign', DOMAIN ),
205 209 'not_found_in_trash' => __(
206 210 'No Countdown Timer found in trash',
207 211 DOMAIN
208 212 ),
209 - 'parent' => __('Parent Campaign', DOMAIN),
210 - 'menu_name' => __('All Campaigns', DOMAIN),
213 + 'parent' => __( 'Parent Campaign', DOMAIN ),
214 + 'menu_name' => __( 'All Campaigns', DOMAIN ),
211 215 ),
212 216 'public' => false,
213 217 'show_ui' => true,
214 218 'publicly_queryable' => false,
@@ -217,11 +221,11 @@
217 221 'hierarchical' => false,
218 222 'show_in_nav_menus' => false,
219 223 'rewrite' => false,
220 224 'query_var' => false,
221 - 'supports' => array('title'),
225 + 'supports' => array( 'title' ),
222 226 'has_archive' => false,
223 227 'menu_positon' => 65,
224 228 );
225 - register_post_type(HURRYT_POST_TYPE, $args);
229 + register_post_type( HURRYT_POST_TYPE, $args );
226 230 }
227 231 }