strong-testimonials
Last commit date
.claude
1 month ago
admin
1 day ago
assets
1 month ago
includes
1 day ago
languages
1 year ago
templates
1 week ago
SECURITY.md
1 year ago
changelog.txt
1 day ago
class-strong-testimonials.php
1 month ago
license.txt
1 year ago
readme.txt
19 hours ago
strong-testimonials.php
19 hours ago
uninstall.php
1 year ago
webpack.config.react-apps.js
1 month ago
wpml-config.xml
1 year ago
class-strong-testimonials.php
554 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Class Strong_Testimonials - Main plugin class |
| 4 | * |
| 5 | * @since 3.1.16 |
| 6 | */ |
| 7 | |
| 8 | // Exit if accessed directly |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | if ( ! class_exists( 'Strong_Testimonials' ) ) : |
| 14 | |
| 15 | /** |
| 16 | * Main plugin class. |
| 17 | * |
| 18 | * @property Strong_Testimonials_View_Shortcode shortcode |
| 19 | * @property Strong_Testimonials_Render render |
| 20 | * @property Strong_Mail mail |
| 21 | * @property Strong_Templates templates |
| 22 | * @property Strong_Testimonials_Form form |
| 23 | * @since 1.15.0 |
| 24 | */ |
| 25 | final class Strong_Testimonials { |
| 26 | |
| 27 | private static $instance; |
| 28 | |
| 29 | private $db_version = '1.0'; |
| 30 | |
| 31 | public $plugin_data; |
| 32 | |
| 33 | /** |
| 34 | * @var Strong_Testimonials_View_Shortcode |
| 35 | */ |
| 36 | public $shortcode; |
| 37 | |
| 38 | /** |
| 39 | * @var Strong_Testimonials_Render |
| 40 | */ |
| 41 | public $render; |
| 42 | |
| 43 | /** |
| 44 | * @var Strong_Mail |
| 45 | */ |
| 46 | public $mail; |
| 47 | |
| 48 | /** |
| 49 | * @var Strong_Templates |
| 50 | */ |
| 51 | public $templates; |
| 52 | |
| 53 | /** |
| 54 | * @var Strong_Testimonials_Form |
| 55 | */ |
| 56 | public $form; |
| 57 | |
| 58 | /** |
| 59 | * A singleton instance. |
| 60 | * |
| 61 | * Used for preprocessing shortcodes and widgets to properly enqueue styles and scripts |
| 62 | * (1) to improve overall plugin flexibility, |
| 63 | * (2) to improve compatibility with page builder plugins, and |
| 64 | * (3) to maintain conditional loading best practices. |
| 65 | * |
| 66 | * Also used to store testimonial form data during Post-Redirect-Get. |
| 67 | * |
| 68 | * @return Strong_Testimonials Strong_Testimonials object |
| 69 | */ |
| 70 | public static function instance() { |
| 71 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Strong_Testimonials ) ) { |
| 72 | self::$instance = new Strong_Testimonials(); |
| 73 | self::$instance->setup_constants(); |
| 74 | self::$instance->includes(); |
| 75 | |
| 76 | add_action( 'init', array( self::$instance, 'init' ), 100 ); |
| 77 | |
| 78 | self::$instance->add_actions(); |
| 79 | } |
| 80 | |
| 81 | return self::$instance; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Throw error on object clone |
| 86 | * |
| 87 | * The whole idea of the singleton design pattern is that there is a single |
| 88 | * object therefore, we don't want the object to be cloned. |
| 89 | * |
| 90 | * @return void |
| 91 | * @since 1.21.0 |
| 92 | * @access protected |
| 93 | */ |
| 94 | public function __clone() { |
| 95 | // Cloning instances of the class is forbidden |
| 96 | _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'strong-testimonials' ), '1.21' ); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Disable unserializing of the class |
| 101 | * |
| 102 | * @return void |
| 103 | * @since 1.21.0 |
| 104 | * @access protected |
| 105 | */ |
| 106 | public function __wakeup() { |
| 107 | // Unserializing instances of the class is forbidden |
| 108 | _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'strong-testimonials' ), '1.21' ); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Plugin activation |
| 113 | */ |
| 114 | public static function plugin_activation( $network_wide = false ) { |
| 115 | |
| 116 | $first_install = ! get_option( 'wpmtst_db_version' ) ? true : false; |
| 117 | |
| 118 | // check if |
| 119 | if ( ! function_exists( 'is_plugin_active_for_network' ) ) { |
| 120 | require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
| 121 | } |
| 122 | |
| 123 | // check if it's multisite. |
| 124 | if ( is_multisite() && true === $network_wide ) { |
| 125 | |
| 126 | // get websites |
| 127 | $sites = get_sites(); |
| 128 | |
| 129 | // loop |
| 130 | if ( count( $sites ) > 0 ) { |
| 131 | foreach ( $sites as $site ) { |
| 132 | |
| 133 | // switch to blog |
| 134 | switch_to_blog( $site->blog_id ); |
| 135 | |
| 136 | // run installer on blog |
| 137 | wpmtst_update_tables(); |
| 138 | |
| 139 | // restore current blog |
| 140 | restore_current_blog(); |
| 141 | } |
| 142 | } |
| 143 | } else { |
| 144 | // no multisite so do normal install |
| 145 | wpmtst_update_tables(); |
| 146 | } |
| 147 | |
| 148 | wpmtst_create_default_views(); |
| 149 | |
| 150 | wpmtst_register_cpt(); |
| 151 | flush_rewrite_rules(); |
| 152 | |
| 153 | do_action( 'wpmtst_after_update_setup', $first_install ); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | /** |
| 158 | * Run installer for new blogs on multisite when plugin is network activated |
| 159 | * |
| 160 | * @param array $site Blog - WP_Site object. |
| 161 | * |
| 162 | * @since 3.1.8 |
| 163 | */ |
| 164 | public static function mu_new_blog( $site ) { |
| 165 | |
| 166 | // check if plugin is network activated. |
| 167 | if ( is_plugin_active_for_network( 'strong-testimonials/strong-testimonials.php' ) ) { |
| 168 | |
| 169 | // switch to new blog |
| 170 | switch_to_blog( $site->blog_id ); |
| 171 | |
| 172 | // run installer on blog |
| 173 | wpmtst_update_tables(); |
| 174 | |
| 175 | // restore current blog |
| 176 | restore_current_blog(); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Plugin deactivation |
| 182 | */ |
| 183 | public static function plugin_deactivation() { |
| 184 | flush_rewrite_rules(); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Setup plugin constants |
| 189 | * |
| 190 | * @access private |
| 191 | * @return void |
| 192 | */ |
| 193 | private function setup_constants() { |
| 194 | defined( 'WPMTST_DIR' ) || define( 'WPMTST_DIR', plugin_dir_path( __FILE__ ) ); |
| 195 | defined( 'WPMTST_URL' ) || define( 'WPMTST_URL', plugin_dir_url( __FILE__ ) ); |
| 196 | |
| 197 | defined( 'WPMTST_INC' ) || define( 'WPMTST_INC', WPMTST_DIR . 'includes/' ); |
| 198 | |
| 199 | defined( 'WPMTST_ADMIN' ) || define( 'WPMTST_ADMIN', WPMTST_DIR . 'admin/' ); |
| 200 | defined( 'WPMTST_ADMIN_URL' ) || define( 'WPMTST_ADMIN_URL', WPMTST_URL . 'admin/' ); |
| 201 | |
| 202 | defined( 'WPMTST_PUBLIC' ) || define( 'WPMTST_PUBLIC', WPMTST_DIR . 'assets/public/' ); |
| 203 | defined( 'WPMTST_PUBLIC_URL' ) || define( 'WPMTST_PUBLIC_URL', WPMTST_URL . 'assets/public/' ); |
| 204 | |
| 205 | defined( 'WPMTST_DEF_TPL' ) || define( 'WPMTST_DEF_TPL', WPMTST_DIR . 'templates/default/' ); |
| 206 | defined( 'WPMTST_DEF_TPL_URI' ) || define( 'WPMTST_DEF_TPL_URI', WPMTST_URL . 'templates/default/' ); |
| 207 | |
| 208 | defined( 'WPMTST_TPL' ) || define( 'WPMTST_TPL', WPMTST_DIR . 'templates' ); |
| 209 | defined( 'WPMTST_TPL_URI' ) || define( 'WPMTST_TPL_URI', WPMTST_URL . 'templates' ); |
| 210 | |
| 211 | defined( 'WPMTST_ASSETS_CSS' ) || define( 'WPMTST_ASSETS_CSS', WPMTST_URL . 'assets/css/' ); |
| 212 | defined( 'WPMTST_ASSETS_JS' ) || define( 'WPMTST_ASSETS_JS', WPMTST_URL . 'assets/dist/' ); |
| 213 | defined( 'WPMTST_ASSETS_SRC' ) || define( 'WPMTST_ASSETS_SRC', WPMTST_URL . 'assets/src/' ); |
| 214 | defined( 'WPMTST_ASSETS_IMG' ) || define( 'WPMTST_ASSETS_IMG', WPMTST_URL . 'assets/img/' ); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Instantiate our classes. |
| 219 | */ |
| 220 | public function init() { |
| 221 | $this->shortcode = new Strong_Testimonials_View_Shortcode(); |
| 222 | $this->render = new Strong_Testimonials_Render(); |
| 223 | $this->mail = new Strong_Mail(); |
| 224 | $this->templates = new Strong_Templates(); |
| 225 | $this->form = new Strong_Testimonials_Form(); |
| 226 | |
| 227 | new Strong_Testimonials_Count_Shortcode(); |
| 228 | new Strong_Testimonials_Average_Shortcode(); |
| 229 | new Strong_Testimonials_Privacy(); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Include required files |
| 234 | * |
| 235 | * @access private |
| 236 | * @return void |
| 237 | * @since 1.21.0 |
| 238 | */ |
| 239 | private function includes() { |
| 240 | require_once WPMTST_INC . 'logs/class-strong-testimonials-logger.php'; |
| 241 | require_once WPMTST_INC . 'class-strong-log.php'; |
| 242 | |
| 243 | require_once WPMTST_INC . 'class-strong-testimonials-privacy.php'; |
| 244 | |
| 245 | require_once WPMTST_INC . 'class-strong-testimonials-view-shortcode.php'; |
| 246 | require_once WPMTST_INC . 'class-strong-gutemberg.php'; |
| 247 | require_once WPMTST_INC . 'elementor/class-strong-testimonials-elementor-check.php'; |
| 248 | require_once WPMTST_INC . 'strong-testimonials-beaver-block/class-strong-testimonials-beaver.php'; |
| 249 | require_once WPMTST_INC . 'class-strong-testimonials-count-shortcode.php'; |
| 250 | require_once WPMTST_INC . 'class-strong-testimonials-average-shortcode.php'; |
| 251 | require_once WPMTST_INC . 'class-strong-testimonials-render.php'; |
| 252 | require_once WPMTST_INC . 'class-strong-view.php'; |
| 253 | require_once WPMTST_INC . 'class-strong-view-display.php'; |
| 254 | require_once WPMTST_INC . 'class-strong-testimonials-defaults.php'; |
| 255 | require_once WPMTST_INC . 'class-strong-view-slideshow.php'; |
| 256 | require_once WPMTST_INC . 'class-strong-view-form.php'; |
| 257 | |
| 258 | require_once WPMTST_INC . 'class-strong-testimonials-templates.php'; |
| 259 | require_once WPMTST_INC . 'class-strong-mail.php'; |
| 260 | require_once WPMTST_INC . 'class-strong-testimonials-form.php'; |
| 261 | require_once WPMTST_INC . 'class-walker-strong-category-checklist-front.php'; |
| 262 | |
| 263 | require_once WPMTST_INC . 'deprecated.php'; |
| 264 | require_once WPMTST_INC . 'filters.php'; |
| 265 | require_once WPMTST_INC . 'functions.php'; |
| 266 | require_once WPMTST_INC . 'functions-activation.php'; |
| 267 | require_once WPMTST_INC . 'functions-content.php'; |
| 268 | require_once WPMTST_INC . 'functions-rating.php'; |
| 269 | require_once WPMTST_INC . 'functions-image.php'; |
| 270 | require_once WPMTST_INC . 'functions-template.php'; |
| 271 | require_once WPMTST_INC . 'functions-template-form.php'; |
| 272 | require_once WPMTST_INC . 'functions-views.php'; |
| 273 | require_once WPMTST_INC . 'post-types.php'; |
| 274 | require_once WPMTST_INC . 'retro.php'; |
| 275 | require_once WPMTST_INC . 'scripts.php'; |
| 276 | require_once WPMTST_INC . 'class-strong-testimonials-view-widget.php'; |
| 277 | |
| 278 | if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
| 279 | require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu.php'; |
| 280 | require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-fields.php'; |
| 281 | require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-settings.php'; |
| 282 | require_once WPMTST_ADMIN . 'menu/class-strong-testimonials-menu-views.php'; |
| 283 | |
| 284 | require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-settings-form.php'; |
| 285 | require_once WPMTST_ADMIN . 'settings/class-strong-testimonials-forms.php'; |
| 286 | |
| 287 | require_once WPMTST_ADMIN . 'class-strong-testimonials-addons.php'; |
| 288 | |
| 289 | require_once WPMTST_ADMIN . 'class-strong-testimonials-list-table.php'; |
| 290 | require_once WPMTST_ADMIN . 'class-strong-views-list-table.php'; |
| 291 | require_once WPMTST_ADMIN . 'class-walker-strong-category-checklist.php'; |
| 292 | require_once WPMTST_ADMIN . 'class-walker-strong-form-category-checklist.php'; |
| 293 | require_once WPMTST_ADMIN . 'class-strong-testimonials-help.php'; |
| 294 | require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-scripts.php'; |
| 295 | require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-list.php'; |
| 296 | require_once WPMTST_ADMIN . 'class-strong-testimonials-admin-category-list.php'; |
| 297 | require_once WPMTST_ADMIN . 'class-strong-testimonials-post-editor.php'; |
| 298 | require_once WPMTST_ADMIN . 'class-strong-testimonials-exporter.php'; |
| 299 | require_once WPMTST_ADMIN . 'class-strong-testimonials-upsell.php'; |
| 300 | require_once WPMTST_ADMIN . 'class-strong-testimonials-updater.php'; |
| 301 | require_once WPMTST_ADMIN . 'class-strong-testimonials-review.php'; |
| 302 | require_once WPMTST_ADMIN . 'class-strong-testimonials-helper.php'; |
| 303 | require_once WPMTST_ADMIN . 'class-strong-testimonials-lite-vs-pro-page.php'; |
| 304 | |
| 305 | require_once WPMTST_ADMIN . 'admin.php'; |
| 306 | require_once WPMTST_ADMIN . 'admin-notices.php'; |
| 307 | require_once WPMTST_ADMIN . 'compat.php'; |
| 308 | require_once WPMTST_ADMIN . 'custom-fields.php'; |
| 309 | require_once WPMTST_ADMIN . 'custom-fields-ajax.php'; |
| 310 | require_once WPMTST_ADMIN . 'form-preview.php'; |
| 311 | require_once WPMTST_ADMIN . 'views.php'; |
| 312 | require_once WPMTST_ADMIN . 'views-ajax.php'; |
| 313 | require_once WPMTST_ADMIN . 'view-list-order.php'; |
| 314 | require_once WPMTST_ADMIN . 'views-validate.php'; |
| 315 | |
| 316 | require_once WPMTST_INC . 'class-strong-testimonials-order.php'; |
| 317 | |
| 318 | // Uninstall form |
| 319 | require_once WPMTST_ADMIN . 'uninstall/class-strong-testimonials-uninstall.php'; |
| 320 | |
| 321 | // WPMTST Challenge Modal |
| 322 | //require_once WPMTST_ADMIN . 'challenge/class-wpmtst-challenge-modal.php'; |
| 323 | |
| 324 | // Admin Helpers |
| 325 | require_once WPMTST_ADMIN . 'class-strong-testimonials-admin.php'; |
| 326 | |
| 327 | // WPMTST Onboarding |
| 328 | require_once WPMTST_ADMIN . 'class-wpmtst-onboarding.php'; |
| 329 | |
| 330 | // WPMTST Debuging |
| 331 | require_once WPMTST_ADMIN . 'class-strong-testimonials-debug.php'; |
| 332 | } |
| 333 | // WPMTST REST Api |
| 334 | require_once WPMTST_ADMIN . 'rest-api/class-strong-testimonials-rest-api-base.php'; |
| 335 | // WPChill Notifications |
| 336 | require_once WPMTST_ADMIN . 'wpchill/class-wpchill-notifications.php'; |
| 337 | |
| 338 | // WPChill Remote Upsells init |
| 339 | require_once WPMTST_ADMIN . 'wpchill/class-wpchill-upsells.php'; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Text domain |
| 344 | */ |
| 345 | public function load_textdomain() { |
| 346 | load_plugin_textdomain( 'strong-testimonials', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * Action and filters. |
| 351 | */ |
| 352 | private function add_actions() { |
| 353 | add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); |
| 354 | |
| 355 | /** |
| 356 | * Plugin setup. |
| 357 | */ |
| 358 | add_action( 'init', array( $this, 'l10n_check' ) ); |
| 359 | |
| 360 | /** |
| 361 | * Theme support for thumbnails. |
| 362 | */ |
| 363 | add_action( 'after_setup_theme', array( $this, 'add_theme_support' ) ); |
| 364 | |
| 365 | /** |
| 366 | * Add image size for widget. |
| 367 | */ |
| 368 | add_action( 'after_setup_theme', array( $this, 'add_image_size' ) ); |
| 369 | |
| 370 | if ( is_admin() ) { |
| 371 | // Check if we need to add lite vs pro page |
| 372 | $current_plan = Strong_Testimonials_Extensions_Base::get_instance()->get_current_plan(); |
| 373 | if ( 'free' === $current_plan ) { |
| 374 | if ( class_exists( 'Strong_Testimonials_Lite_Vs_PRO_Page' ) ) { |
| 375 | new Strong_Testimonials_Lite_Vs_PRO_Page(); |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Add theme support for this custom post type only. |
| 383 | * |
| 384 | * @since 1.4.0 |
| 385 | * @since 1.19.1 Appends our testimonial post type to the existing array. |
| 386 | * @since 2.26.5 Simply using add_theme_support(). Let the chips fall where they may. |
| 387 | */ |
| 388 | public function add_theme_support() { |
| 389 | /** |
| 390 | * This will fail if the theme uses add_theme_support incorrectly; |
| 391 | * e.g. add_theme_support( 'post-thumbnails', 'post' ); |
| 392 | * which WordPress does not catch. |
| 393 | * |
| 394 | * The plugin attempted to handle this in versions 1.19.1 - 2.26.4 |
| 395 | * but now it lets the condition occur so the underlying problem |
| 396 | * will surface and can be fixed. |
| 397 | */ |
| 398 | add_theme_support( 'post-thumbnails', array( 'wpm-testimonial' ) ); |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Add widget thumbnail size. |
| 403 | * |
| 404 | * @since 1.21.0 |
| 405 | */ |
| 406 | public function add_image_size() { |
| 407 | // name, width, height, crop = false |
| 408 | add_image_size( 'widget-thumbnail', 75, 75, true ); |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * Load specific files for translation plugins. |
| 413 | */ |
| 414 | public function l10n_check() { |
| 415 | // WPML |
| 416 | if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { |
| 417 | require_once WPMTST_INC . 'l10n-wpml.php'; |
| 418 | } |
| 419 | |
| 420 | // Polylang |
| 421 | if ( defined( 'POLYLANG_VERSION' ) ) { |
| 422 | require_once WPMTST_INC . 'l10n-polylang.php'; |
| 423 | } |
| 424 | |
| 425 | // WP Globus |
| 426 | if ( defined( 'WPGLOBUS_VERSION' ) ) { |
| 427 | // Translate |
| 428 | remove_filter( 'wpmtst_l10n', 'wpmtst_l10n_default' ); |
| 429 | add_filter( 'wpmtst_the_content', array( 'WPGlobus_Filters', 'filter__text' ), 0 ); |
| 430 | add_filter( 'wpmtst_get_the_excerpt', array( 'WPGlobus_Filters', 'filter__text' ), 0 ); |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Get att(s). |
| 436 | * |
| 437 | * @param null $keys |
| 438 | * |
| 439 | * @return array|bool |
| 440 | */ |
| 441 | public function atts( $keys = null ) { |
| 442 | // return all |
| 443 | if ( ! $keys ) { |
| 444 | return $this->render->view_atts; |
| 445 | } |
| 446 | |
| 447 | // return some |
| 448 | if ( is_array( $keys ) ) { |
| 449 | $found = array(); |
| 450 | foreach ( $keys as $key ) { |
| 451 | if ( isset( $this->render->view_atts[ $key ] ) ) { |
| 452 | $found[ $key ] = $this->render->view_atts[ $key ]; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | return $found; |
| 457 | } |
| 458 | |
| 459 | // return one |
| 460 | if ( isset( $this->render->view_atts[ $keys ] ) ) { |
| 461 | return $this->render->view_atts[ $keys ]; |
| 462 | } |
| 463 | |
| 464 | // return none |
| 465 | return false; |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * Set atts. |
| 470 | * |
| 471 | * @param $atts |
| 472 | */ |
| 473 | public function set_atts( $atts ) { |
| 474 | $this->render->set_atts( $atts ); |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * Store current query. |
| 479 | * |
| 480 | * @param $query |
| 481 | */ |
| 482 | public function set_query( $query ) { |
| 483 | $this->render->query = $query; |
| 484 | } |
| 485 | |
| 486 | /** |
| 487 | * Return current query. |
| 488 | * |
| 489 | * @return mixed |
| 490 | */ |
| 491 | public function get_query() { |
| 492 | return $this->render->query; |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * Get database tables version. |
| 497 | * |
| 498 | * @return string |
| 499 | */ |
| 500 | public function get_db_version() { |
| 501 | return $this->db_version; |
| 502 | } |
| 503 | |
| 504 | /** |
| 505 | * Set plugin data. |
| 506 | * |
| 507 | * @since 2.12.0 |
| 508 | */ |
| 509 | public function set_plugin_data() { |
| 510 | $this->plugin_data = array( |
| 511 | 'Version' => WPMTST_VERSION, |
| 512 | ); |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Get plugin data. |
| 517 | * |
| 518 | * @return array |
| 519 | * @since 2.12.0 |
| 520 | * |
| 521 | */ |
| 522 | public function get_plugin_data() { |
| 523 | return $this->plugin_data; |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Return plugin info. |
| 528 | * |
| 529 | * @return array |
| 530 | * @deprecated |
| 531 | * |
| 532 | */ |
| 533 | public function get_plugin_info() { |
| 534 | if ( ! function_exists( 'get_plugin_data' ) ) { |
| 535 | if ( file_exists( ABSPATH . 'wp-admin/includes/plugin.php' ) ) { |
| 536 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 537 | } |
| 538 | if ( file_exists( ABSPATH . 'wp-admin/includes/admin.php' ) ) { |
| 539 | require_once ABSPATH . 'wp-admin/includes/admin.php'; |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | return get_file_data( |
| 544 | __FILE__, |
| 545 | array( |
| 546 | 'name' => 'Plugin Name', |
| 547 | 'version' => 'Version', |
| 548 | ) |
| 549 | ); |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | endif; // class_exists check. |
| 554 |