PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.33
Strong Testimonials v2.33
3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / strong-testimonials.php
strong-testimonials Last commit date
admin 7 years ago includes 7 years ago languages 7 years ago public 7 years ago templates 7 years ago templates-scss 7 years ago .gitignore 9 years ago changelog.txt 7 years ago license.txt 7 years ago readme.txt 7 years ago strong-testimonials.php 7 years ago uninstall.php 8 years ago wpml-config.xml 9 years ago
strong-testimonials.php
525 lines
1 <?php
2 /**
3 * Plugin Name: Strong Testimonials
4 * Description: Collect and display your testimonials or reviews.
5 * Author: MachoThemes
6 * Version: 2.33
7 * Author URI: https://www.machothemes.com/
8 * Text Domain: strong-testimonials
9 * Domain Path: /languages
10 * Requires: 4.0 or higher
11 * License: GPLv3 or later
12 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
13 * Requires PHP: 5.6
14 *
15 * Copyright 2014-2019 Chris Dillon chris@strongwp.com
16 * Copyright 2019 MachoThemes office@machothemes.com
17 *
18 * Original Plugin URI: https://strongplugins.com/plugins/strong-testimonials
19 * Original Author URI: https://strongplugins.com
20 * Original Author: https://profiles.wordpress.org/cdillon27/
21 *
22 * NOTE:
23 * Chris Dillon ownership rights were ceased on: 01/20/2019 06:52:23 PM when ownership was turned over to MachoThemes
24 * MachoThemes ownership started on: 01/20/2019 06:52:24 PM
25 *
26 * This program is free software; you can redistribute it and/or modify
27 * it under the terms of the GNU General Public License as published by
28 * the Free Software Foundation; either version 3 of the License, or
29 * (at your option) any later version.
30 *
31 * This program is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU General Public License for more details.
35 *
36 * You should have received a copy of the GNU General Public License
37 * along with this program; if not, write to the Free Software
38 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39 */
40
41 // Exit if accessed directly
42 if ( ! defined( 'ABSPATH' ) ) {
43 exit;
44 }
45
46 define( 'WPMTST_VERSION', '2.33' );
47 define( 'WPMTST_PLUGIN', plugin_basename( __FILE__ ) ); // strong-testimonials/strong-testimonials.php
48 define( 'WPMTST', dirname( WPMTST_PLUGIN ) ); // strong-testimonials
49 define( 'STRONGPLUGINS_STORE_URL', 'https://strongplugins.com' );
50
51
52 if ( ! class_exists( 'Strong_Testimonials' ) ) :
53
54 /**
55 * Main plugin class.
56 *
57 * @property Strong_Testimonials_View_Shortcode shortcode
58 * @property Strong_Testimonials_Render render
59 * @property Strong_Mail mail
60 * @property Strong_Templates templates
61 * @property Strong_Testimonials_Form form
62 * @since 1.15.0
63 */
64 final class Strong_Testimonials {
65
66 private static $instance;
67
68 private $db_version = '1.0';
69
70 public $plugin_data;
71
72 /**
73 * @var Strong_Testimonials_View_Shortcode
74 */
75 public $shortcode;
76
77 /**
78 * @var Strong_Testimonials_Render
79 */
80 public $render;
81
82 /**
83 * @var Strong_Mail
84 */
85 public $mail;
86
87 /**
88 * @var Strong_Templates
89 */
90 public $templates;
91
92 /**
93 * @var Strong_Testimonials_Form
94 */
95 public $form;
96
97 /**
98 * A singleton instance.
99 *
100 * Used for preprocessing shortcodes and widgets to properly enqueue styles and scripts
101 * (1) to improve overall plugin flexibility,
102 * (2) to improve compatibility with page builder plugins, and
103 * (3) to maintain conditional loading best practices.
104 *
105 * Also used to store testimonial form data during Post-Redirect-Get.
106 *
107 * @return Strong_Testimonials Strong_Testimonials object
108 */
109 public static function instance() {
110 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Strong_Testimonials ) ) {
111 self::$instance = new Strong_Testimonials;
112 self::$instance->setup_constants();
113 self::$instance->includes();
114
115 add_action( 'init', array( self::$instance, 'init' ) );
116
117 self::$instance->add_actions();
118 }
119
120 return self::$instance;
121 }
122
123 /**
124 * Throw error on object clone
125 *
126 * The whole idea of the singleton design pattern is that there is a single
127 * object therefore, we don't want the object to be cloned.
128 *
129 * @since 1.21.0
130 * @access protected
131 * @return void
132 */
133 public function __clone() {
134 // Cloning instances of the class is forbidden
135 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'strong-testimonials' ), '1.21' );
136 }
137
138 /**
139 * Disable unserializing of the class
140 *
141 * @since 1.21.0
142 * @access protected
143 * @return void
144 */
145 public function __wakeup() {
146 // Unserializing instances of the class is forbidden
147 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'strong-testimonials' ), '1.21' );
148 }
149
150 /**
151 * Plugin activation
152 */
153 static function plugin_activation() {
154 wpmtst_update_tables();
155 wpmtst_register_cpt();
156 flush_rewrite_rules();
157 }
158
159 /**
160 * Plugin deactivation
161 */
162 static function plugin_deactivation() {
163 flush_rewrite_rules();
164
165 /**
166 * Unset stored version number to allow rollback and beta testing.
167 *
168 * @since 2.28.0
169 */
170 delete_option( 'wpmtst_plugin_version' );
171 }
172
173 /**
174 * Setup plugin constants
175 *
176 * @access private
177 * @return void
178 */
179 private function setup_constants() {
180 defined( 'WPMTST_DIR' ) || define( 'WPMTST_DIR', plugin_dir_path( __FILE__ ) );
181 defined( 'WPMTST_URL' ) || define( 'WPMTST_URL', plugin_dir_url( __FILE__ ) );
182
183 defined( 'WPMTST_INC' ) || define( 'WPMTST_INC', WPMTST_DIR . 'includes/' );
184
185 defined( 'WPMTST_ADMIN' ) || define( 'WPMTST_ADMIN', WPMTST_DIR . 'admin/' );
186 defined( 'WPMTST_ADMIN_URL' ) || define( 'WPMTST_ADMIN_URL', WPMTST_URL . 'admin/' );
187
188 defined( 'WPMTST_PUBLIC' ) || define( 'WPMTST_PUBLIC', WPMTST_DIR . 'public/' );
189 defined( 'WPMTST_PUBLIC_URL' ) || define( 'WPMTST_PUBLIC_URL', WPMTST_URL . 'public/' );
190
191 defined( 'WPMTST_DEF_TPL' ) || define( 'WPMTST_DEF_TPL', WPMTST_DIR . 'templates/default/' );
192 defined( 'WPMTST_DEF_TPL_URI' ) || define( 'WPMTST_DEF_TPL_URI', WPMTST_URL . 'templates/default/' );
193
194 defined( 'WPMTST_TPL' ) || define( 'WPMTST_TPL', WPMTST_DIR . 'templates' );
195 defined( 'WPMTST_TPL_URI' ) || define( 'WPMTST_TPL_URI', WPMTST_URL . 'templates' );
196 }
197
198 /**
199 * Instantiate our classes.
200 */
201 public function init() {
202 $this->shortcode = new Strong_Testimonials_View_Shortcode();
203 $this->render = new Strong_Testimonials_Render();
204 $this->mail = new Strong_Mail();
205 $this->templates = new Strong_Templates();
206 $this->form = new Strong_Testimonials_Form();
207
208 new Strong_Testimonials_Count_Shortcode();
209 new Strong_Testimonials_Average_Shortcode();
210 new Strong_Testimonials_Privacy();
211 }
212
213 /**
214 * Include required files
215 *
216 * @access private
217 * @since 1.21.0
218 * @return void
219 */
220 private function includes() {
221 require_once WPMTST_INC . 'class-strong-log.php';
222
223 require_once WPMTST_INC . 'class-strong-testimonials-privacy.php';
224
225 require_once WPMTST_INC . 'class-strong-testimonials-shortcode.php';
226 require_once WPMTST_INC . 'class-strong-testimonials-shortcode-count.php';
227 require_once WPMTST_INC . 'class-strong-testimonials-shortcode-average.php';
228 require_once WPMTST_INC . 'class-strong-testimonials-render.php';
229 require_once WPMTST_INC . 'class-strong-view.php';
230 require_once WPMTST_INC . 'class-strong-view-display.php';
231 require_once WPMTST_INC . 'class-strong-view-slideshow.php';
232 require_once WPMTST_INC . 'class-strong-view-form.php';
233
234 require_once WPMTST_INC . 'class-strong-templates.php';
235 require_once WPMTST_INC . 'class-strong-mail.php';
236 require_once WPMTST_INC . 'class-strong-form.php';
237 require_once WPMTST_INC . 'class-walker-strong-category-checklist-front.php';
238
239 require_once WPMTST_INC . 'deprecated.php';
240 require_once WPMTST_INC . 'filters.php';
241 require_once WPMTST_INC . 'functions.php';
242 require_once WPMTST_INC . 'functions-activation.php';
243 require_once WPMTST_INC . 'functions-content.php';
244 require_once WPMTST_INC . 'functions-rating.php';
245 require_once WPMTST_INC . 'functions-image.php';
246 require_once WPMTST_INC . 'functions-template.php';
247 require_once WPMTST_INC . 'functions-template-form.php';
248 require_once WPMTST_INC . 'functions-views.php';
249 require_once WPMTST_INC . 'post-types.php';
250 require_once WPMTST_INC . 'retro.php';
251 require_once WPMTST_INC . 'scripts.php';
252 require_once WPMTST_INC . 'widget2.php';
253
254 if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
255
256 require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu.php';
257 require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-fields.php';
258 require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-settings.php';
259 require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-views.php';
260 require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-shortcodes.php';
261 require_once WPMTST_ADMIN . 'class-strong-testimonials-page-shortcodes.php';
262
263 require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings.php';
264 require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings-general.php';
265 require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings-form.php';
266 require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings-compat.php';
267 require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings-licenses.php';
268
269 require_once WPMTST_ADMIN . 'about/class-strong-testimonials-about.php';
270
271 require_once WPMTST_ADMIN . 'class-strong-testimonials-defaults.php';
272 require_once WPMTST_ADMIN . 'class-strong-testimonials-list-table.php';
273 require_once WPMTST_ADMIN . 'class-strong-views-list-table.php';
274 require_once WPMTST_ADMIN . 'class-walker-strong-category-checklist.php';
275 require_once WPMTST_ADMIN . 'class-walker-strong-form-category-checklist.php';
276 require_once WPMTST_ADMIN . 'class-strong-testimonials-help.php';
277 require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-scripts.php';
278 require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-list.php';
279 require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-category-list.php';
280 require_once WPMTST_ADMIN . 'class-strong-testimonials-post-editor.php';
281
282 require_once WPMTST_ADMIN . 'admin.php';
283 require_once WPMTST_ADMIN . 'admin-notices.php';
284 require_once WPMTST_ADMIN . 'compat.php';
285 require_once WPMTST_ADMIN . 'custom-fields.php';
286 require_once WPMTST_ADMIN . 'custom-fields-ajax.php';
287 require_once WPMTST_ADMIN . 'form-preview.php';
288 require_once WPMTST_ADMIN . 'views.php';
289 require_once WPMTST_ADMIN . 'views-ajax.php';
290 require_once WPMTST_ADMIN . 'view-list-order.php';
291 require_once WPMTST_ADMIN . 'views-validate.php';
292
293 }
294 }
295
296 /**
297 * Text domain
298 */
299 public function load_textdomain() {
300 load_plugin_textdomain( 'strong-testimonials', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
301 }
302
303 /**
304 * Action and filters.
305 */
306 private function add_actions() {
307 add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
308
309 /**
310 * Plugin setup.
311 */
312 add_action( 'init', array( $this, 'l10n_check' ) );
313 add_action( 'init', array( $this, 'reorder_check' ) );
314 add_action( 'init', array( $this, 'font_check' ) );
315
316 /**
317 * Theme support for thumbnails.
318 */
319 add_action( 'after_setup_theme', array( $this, 'add_theme_support' ) );
320
321 /**
322 * Add image size for widget.
323 */
324 add_action( 'after_setup_theme', array( $this, 'add_image_size' ) );
325 }
326
327 /**
328 * Add theme support for this custom post type only.
329 *
330 * @since 1.4.0
331 * @since 1.19.1 Appends our testimonial post type to the existing array.
332 * @since 2.26.5 Simply using add_theme_support(). Let the chips fall where they may.
333 */
334 public function add_theme_support() {
335 /**
336 * This will fail if the theme uses add_theme_support incorrectly;
337 * e.g. add_theme_support( 'post-thumbnails', 'post' );
338 * which WordPress does not catch.
339 *
340 * The plugin attempted to handle this in versions 1.19.1 - 2.26.4
341 * but now it lets the condition occur so the underlying problem
342 * will surface and can be fixed.
343 */
344 add_theme_support( 'post-thumbnails', array( 'wpm-testimonial' ) );
345 }
346
347 /**
348 * Add widget thumbnail size.
349 *
350 * @since 1.21.0
351 */
352 public function add_image_size() {
353 // name, width, height, crop = false
354 add_image_size( 'widget-thumbnail', 75, 75, true );
355 }
356
357 /**
358 * Load specific files for translation plugins.
359 */
360 public function l10n_check() {
361 // WPML
362 if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
363 require_once WPMTST_INC . 'l10n-wpml.php';
364 }
365
366 // Polylang
367 if ( defined( 'POLYLANG_VERSION' ) ) {
368 require_once WPMTST_INC . 'l10n-polylang.php';
369 }
370
371 // WP Globus
372 if ( defined( 'WPGLOBUS_VERSION' ) ) {
373 // Translate
374 remove_filter( 'wpmtst_l10n', 'wpmtst_l10n_default' );
375 add_filter( 'wpmtst_the_content', array( 'WPGlobus_Filters', 'filter__text' ), 0 );
376 add_filter( 'wpmtst_get_the_excerpt', array( 'WPGlobus_Filters', 'filter__text' ), 0 );
377 }
378 }
379
380 /**
381 * Load reorder class if enabled.
382 */
383 public function reorder_check() {
384 $options = get_option( 'wpmtst_options' );
385 if ( isset( $options['reorder'] ) && $options['reorder'] ) {
386 require_once WPMTST_INC . 'class-strong-testimonials-order.php';
387 }
388 }
389
390 /**
391 * Forgo Font Awesome.
392 */
393 public function font_check() {
394 $options = get_option( 'wpmtst_options' );
395 if ( isset( $options['load_font_awesome'] ) && ! $options['load_font_awesome'] ) {
396 add_filter( 'wpmtst_load_font_awesome', '__return_false' );
397 }
398 }
399
400 /**
401 * Get att(s).
402 *
403 * @param null $keys
404 *
405 * @return array|bool
406 */
407 public function atts( $keys = null ) {
408 // return all
409 if ( ! $keys ) {
410 return $this->render->view_atts;
411 }
412
413 // return some
414 if ( is_array( $keys ) ) {
415 $found = array();
416 foreach ( $keys as $key ) {
417 if ( isset( $this->render->view_atts[ $key ] ) ) {
418 $found[ $key ] = $this->render->view_atts[ $key ];
419 }
420 }
421
422 return $found;
423 }
424
425 // return one
426 if ( isset( $this->render->view_atts[ $keys ] ) ) {
427 return $this->render->view_atts[ $keys ];
428 }
429
430 // return none
431 return false;
432 }
433
434 /**
435 * Set atts.
436 *
437 * @param $atts
438 */
439 public function set_atts( $atts ) {
440 $this->render->set_atts ($atts );
441 }
442
443 /**
444 * Store current query.
445 *
446 * @param $query
447 */
448 public function set_query( $query ) {
449 $this->render->query = $query;
450 }
451
452 /**
453 * Return current query.
454 *
455 * @return mixed
456 */
457 public function get_query() {
458 return $this->render->query;
459 }
460
461 /**
462 * Get database tables version.
463 *
464 * @return string
465 */
466 public function get_db_version() {
467 return $this->db_version;
468 }
469
470 /**
471 * Set plugin data.
472 *
473 * @since 2.12.0
474 */
475 public function set_plugin_data() {
476 $this->plugin_data = array(
477 'Version' => WPMTST_VERSION,
478 );
479 }
480
481 /**
482 * Get plugin data.
483 *
484 * @since 2.12.0
485 *
486 * @return array
487 */
488 public function get_plugin_data() {
489 return $this->plugin_data;
490 }
491
492 /**
493 * Return plugin info.
494 *
495 * @deprecated
496 *
497 * @return array
498 */
499 public function get_plugin_info() {
500 if ( ! function_exists( 'get_plugin_data' ) ) {
501 if ( file_exists( ABSPATH . 'wp-admin/includes/plugin.php' ) ) {
502 require_once ABSPATH . 'wp-admin/includes/plugin.php';
503 }
504 if ( file_exists( ABSPATH . 'wp-admin/includes/admin.php' ) ) {
505 require_once ABSPATH . 'wp-admin/includes/admin.php';
506 }
507 }
508
509 return get_file_data( __FILE__, array( 'name' => 'Plugin Name', 'version' => 'Version' ) );
510 }
511
512 }
513
514 endif; // class_exists check
515
516 register_activation_hook( __FILE__, array( 'Strong_Testimonials', 'plugin_activation' ) );
517 register_deactivation_hook( __FILE__, array( 'Strong_Testimonials', 'plugin_deactivation' ) );
518
519 function WPMST() {
520 return Strong_Testimonials::instance();
521 }
522
523 // Get plugin running
524 WPMST();
525