PluginProbe ʕ •ᴥ•ʔ
External Links – nofollow, noopener & new window / 2.66
External Links – nofollow, noopener & new window v2.66
2.66 0.31 0.32 0.33 0.34 0.35 1.01 1.02 1.03 1.10 1.20 1.21 1.30 1.31 1.40 1.41 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.60 1.61 1.62 1.70 1.80 1.81 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 2.3 2.32 2.35 2.40 2.42 2.43 2.45 2.46 2.47 2.48 2.50 2.51 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 trunk 0.10 0.11 0.12 0.20 0.21 0.30
wp-external-links / libs / fwp / component-bases / class-fwp-plugin-base.php
wp-external-links / libs / fwp / component-bases Last commit date
class-fwp-plugin-base.php 1 year ago class-fwp-register-hook-base.php 1 year ago class-fwp-settings-section-base.php 3 years ago class-fwp-template-tag-base.php 3 years ago
class-fwp-plugin-base.php
127 lines
1 <?php
2 /**
3 * Class FWP_Plugin_Base
4 *
5 * @package FWP
6 * @category WordPress Library
7 * @version 1.0.0
8
9 * @link https://www.webfactoryltd.com/
10 */
11 abstract class FWP_Plugin_Base_1x0x0 extends WPRun_Base_1x0x0
12 {
13
14 /**
15 * @var string
16 */
17 private $plugin_file = null;
18 public static $filesystem_initialized = false;
19 /**
20 * @var string
21 */
22 private $plugin_dir = null;
23
24 /**
25 * Initialize plugin
26 * @param string $plugin_file
27 * @param string $plugin_dir
28 */
29 protected function init( $plugin_file, $plugin_dir )
30 {
31 $this->set_plugin_file( $plugin_file );
32 $this->set_plugin_dir( $plugin_dir );
33 }
34
35 /**
36 * Action for "plugins_loaded"
37 */
38 protected function action_plugins_loaded()
39 {
40 $plugin_data = get_file_data( $this->plugin_file, array(
41 'TextDomain' => 'Text Domain',
42 'DomainPath' => 'Domain Path',
43 ) );
44
45 if ( ! $plugin_data[ 'TextDomain' ] || ! $plugin_data[ 'DomainPath' ] ) {
46 return;
47 }
48
49 load_plugin_textdomain(
50 $plugin_data[ 'TextDomain' ]
51 , false
52 , $this->get_plugin_dir( $plugin_data[ 'DomainPath' ] )
53 );
54 }
55
56 /**
57 * Action for "admin_action_wpel_dismiss_notice"
58 */
59 protected function action_admin_action_wpel_dismiss_notice()
60 {
61 check_admin_referer( 'wpel_dismiss_rate' );
62
63 update_option( 'wpel-notice-dismissed-rate', true );
64
65 if ( !empty( $_GET['redirect'] ) ) {
66 wp_safe_redirect( sanitize_url(wp_unslash($_GET['redirect'])) );
67 } else {
68 wp_safe_redirect( admin_url() );
69 }
70
71 exit;
72 }
73
74 /**
75 * @param string $plugin_file
76 */
77 final protected function set_plugin_file( $plugin_file )
78 {
79 $this->plugin_file = $plugin_file;
80 }
81
82 /**
83 * @param string $plugin_dir
84 */
85 final protected function set_plugin_dir( $plugin_dir )
86 {
87 $this->plugin_dir = untrailingslashit( $plugin_dir );;
88 }
89
90 /**
91 * @return string
92 */
93 final public static function get_plugin_file()
94 {
95 return self::get_instance()->plugin_file;
96 }
97
98 /**
99 * @param string $path Optional
100 * @return string
101 */
102 final public static function get_plugin_dir( $path = '' )
103 {
104 return self::get_instance()->plugin_dir . $path;
105 }
106
107 /**
108 * @param string $path Optional
109 * @return string
110 */
111 public static function wp_init_filesystem()
112 {
113 if (! self::$filesystem_initialized) {
114 if (! class_exists('WP_Filesystem')) {
115 require_once ABSPATH . 'wp-admin/includes/file.php';
116 }
117
118 WP_Filesystem();
119 self::$filesystem_initialized = true;
120 }
121
122 return true;
123 }
124
125
126 }
127