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 +54 -45 2.1.82.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
@@ -55,9 +57,9 @@
55 57 * @since 1.0.0
56 58 */
57 59 public function __construct()
58 60 {
59 - $this->version = HURRYT_VERSION;
61 + $this->version = HURRYT_VERSION;
60 62 $this->pluginName = 'hurrytimer';
61 63 }
62 64
63 65 public function run()
@@ -77,17 +79,25 @@
77 79 * @access private
78 80 */
79 81 public function loadDependencies()
80 82 {
81 - \spl_autoload_register(function ($class) {
82 - 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 ) {
83 86 return;
84 87 }
85 - $class = str_replace('Hurrytimer', '', $class);
86 - $class = str_replace('\\', '/', $class);
88 + $class = str_replace( 'Hurrytimer', '', $class );
89 + $class = str_replace( '\\', '/', $class );
87 90 require_once HURRYT_DIR . "includes/{$class}.php";
88 - });
91 + } );
92 + require HURRYT_DIR . 'includes/functions.php';
89 93
94 + Carbon::macro( 'getBrowserTimestamp', function () {
95 + /**
96 + * @var Carbon $this
97 + */
98 + return $this->getTimestamp() * 1000;
99 + } );
90 100 }
91 101
92 102 /**
93 103 * Define the locale for this plugin for internationalization.
@@ -110,11 +120,10 @@
110 120 private function maybeUpgrade()
111 121 {
112 122 add_action(
113 123 'plugins_loaded', function () {
114 -
115 - Upgrade::getInstance()->run();
116 - }
124 + Upgrade::getInstance()->run();
125 + }
117 126 );
118 127 }
119 128
120 129 /**
@@ -129,16 +138,16 @@
129 138 $plugin_admin = new Admin(
130 139 $this->getPluginName(),
131 140 $this->getVersion()
132 141 );
133 - add_action('admin_menu', [$plugin_admin, 'menu']);
134 - add_action('admin_init', [$plugin_admin, 'settingsBox']);
142 + add_action( 'admin_menu', [ $plugin_admin, 'menu' ] );
143 + add_action( 'admin_init', [ $plugin_admin, 'settingsBox' ] );
135 144
136 145 //removeIf(pro)
137 - add_filter('add_meta_boxes', [$plugin_admin, 'upgradeBanner']);
146 + add_filter( 'add_meta_boxes', [ $plugin_admin, 'upgradeBanner' ] );
138 147 //endRemoveIf(pro)
139 - add_action('admin_enqueue_scripts', [$plugin_admin, 'enqueueStyles']);
140 - 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' ] );
141 150 }
142 151
143 152 /**
144 153 * Register all of the hooks related to the public-facing functionality
@@ -153,10 +162,10 @@
153 162 $this->getPluginName(),
154 163 $this->getVersion()
155 164 );
156 165
157 - add_action('wp_enqueue_scripts', [$front, 'enqueue_styles']);
158 - 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' ] );
159 168 }
160 169
161 170 /**
162 171 * The name of the plugin used to uniquely identify it within the context of
@@ -161,10 +170,10 @@
161 170 /**
162 171 * The name of the plugin used to uniquely identify it within the context of
163 172 * WordPress and to define internationalization functionality.
164 173 *
174 + * @return string The name of the plugin.
165 175 * @since 1.0.0
166 - * @return string The name of the plugin.
167 176 */
168 177 public function getPluginName()
169 178 {
170 179 return $this->pluginName;
@@ -172,10 +181,10 @@
172 181
173 182 /**
174 183 * Retrieve the version number of the plugin.
175 184 *
185 + * @return string The version number of the plugin.
176 186 * @since 1.0.0
177 - * @return string The version number of the plugin.
178 187 */
179 188 public function getVersion()
180 189 {
181 190 return $this->version;
@@ -183,40 +192,40 @@
183 192
184 193 public function registerPostType()
185 194 {
186 195 $args = array(
187 - 'label' => __('All', DOMAIN),
188 - 'labels' => array(
189 - 'name' => __('Campaigns', DOMAIN),
190 - 'singular_name' => __('Campaign', DOMAIN),
191 - 'add_new' => __('Add Campaign', DOMAIN),
192 - 'add_new_item' => __('Add Campaign', DOMAIN),
193 - 'edit' => __('Edit', DOMAIN),
194 - 'edit_item' => __('Edit Campaign', DOMAIN),
195 - 'new_item' => __('New Campaign', DOMAIN),
196 - 'view' => __('View Campaign', DOMAIN),
197 - 'view_item' => __('View Campaign', DOMAIN),
198 - 'search_items' => __('Search Campaign', DOMAIN),
199 - 'not_found' => __('No Campaign', DOMAIN),
196 + 'label' => __( 'All', DOMAIN ),
197 + 'labels' => array(
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 ),
200 209 'not_found_in_trash' => __(
201 210 'No Countdown Timer found in trash',
202 211 DOMAIN
203 212 ),
204 - 'parent' => __('Parent Campaign', DOMAIN),
205 - 'menu_name' => __('All Campaigns', DOMAIN),
213 + 'parent' => __( 'Parent Campaign', DOMAIN ),
214 + 'menu_name' => __( 'All Campaigns', DOMAIN ),
206 215 ),
207 - 'public' => false,
208 - 'show_ui' => true,
209 - 'publicly_queryable' => false,
216 + 'public' => false,
217 + 'show_ui' => true,
218 + 'publicly_queryable' => false,
210 219 'exclude_from_search' => true,
211 - 'show_in_menu' => 'hurrytimer',
212 - 'hierarchical' => false,
213 - 'show_in_nav_menus' => false,
214 - 'rewrite' => false,
215 - 'query_var' => false,
216 - 'supports' => array('title'),
217 - 'has_archive' => false,
218 - 'menu_positon' => 65,
220 + 'show_in_menu' => 'hurrytimer',
221 + 'hierarchical' => false,
222 + 'show_in_nav_menus' => false,
223 + 'rewrite' => false,
224 + 'query_var' => false,
225 + 'supports' => array( 'title' ),
226 + 'has_archive' => false,
227 + 'menu_positon' => 65,
219 228 );
220 - register_post_type(HURRYT_POST_TYPE, $args);
229 + register_post_type( HURRYT_POST_TYPE, $args );
221 230 }
222 231 }