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.0.4 7.0.5 7.0.6 7.0.7
media-cleaner / common / admin.php
media-cleaner / common Last commit date
img 4 years ago admin.php 4 years ago helpers.php 4 years ago issues.php 4 years ago ratings.php 4 years ago releases.txt 4 years ago rest.php 4 years ago
admin.php
180 lines
1 <?php
2
3 if ( !class_exists( 'MeowCommon_Admin' ) ) {
4
5 class MeowCommon_Admin {
6
7 public static $loaded = false;
8 public static $version = "3.7";
9 public static $admin_version = "3.7";
10
11 public $prefix; // prefix used for actions, filters (mfrh)
12 public $mainfile; // plugin main file (media-file-renamer.php)
13 public $domain; // domain used for translation (media-file-renamer)
14 public $isPro = false;
15
16 public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
17
18 public function __construct( $prefix, $mainfile, $domain, $isPro = false, $disableReview = false, $freeOnly = false ) {
19
20 if ( !MeowCommon_Admin::$loaded ) {
21 if ( is_admin() ) {
22
23 // Check potential issues with this WordPress install, other plugins, etc.
24 new MeowCommon_Issues( $prefix, $mainfile, $domain );
25
26 // Create the Meow Apps Menu
27 add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
28 $page = isset( $_GET["page"] ) ? sanitize_text_field( $_GET["page"] ) : null;
29 if ( $page === 'meowapps-main-menu' ) {
30 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100000, 1 );
31 }
32 }
33 MeowCommon_Admin::$loaded = true;
34 }
35
36 // Variables for this plugin
37 $this->prefix = $prefix;
38 $this->mainfile = $mainfile;
39 $this->domain = $domain;
40 $this->isPro = $isPro;
41
42 // If there is no mainfile, it's either a Pro only Plugin (with no Free version available) or a Theme.
43 if ( is_admin() ) {
44 $license = get_option( $this->prefix . '_license', "" );
45 if ( !empty( $license ) && !$this->isPro ) {
46 add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
47 }
48 if ( !$disableReview ) {
49 new MeowCommon_Ratings( $prefix, $mainfile, $domain );
50 }
51 }
52 add_filter( 'plugin_row_meta', array( $this, 'custom_plugin_row_meta' ), 10, 2 );
53 add_filter( 'edd_sl_api_request_verify_ssl', array( $this, 'request_verify_ssl' ), 10, 0 );
54 }
55
56 function custom_plugin_row_meta( $links, $file ) {
57 $path = pathinfo( $file );
58 $pathName = basename( $path['dirname'] );
59 $thisPath = pathinfo( $this->mainfile );
60 $thisPathName = basename( $thisPath['dirname'] );
61 $isActive = is_plugin_active( $file );
62 if ( !$isActive ) {
63 return $links;
64 }
65 $isIssue = $this->isPro && !$this->is_registered();
66 if ( strpos( $pathName, $thisPathName ) !== false ) {
67 $new_links = array(
68 'settings' =>
69 sprintf( __( '<a href="admin.php?page=%s_settings">Settings</a>', $this->domain ), $this->prefix ),
70 'license' =>
71 $this->is_registered() ?
72 ('<span style="color: #a75bd6;">' . __( 'Pro Version', $this->domain ) . '</span>') :
73 ( $isIssue ? (sprintf( '<span style="color: #ff3434;">' . __( 'License Issue', $this->domain ), $this->prefix ) . '</span>') : (sprintf( '<span>' . __( '<a target="_blank" href="https://store.meowapps.com">Get the <u>Pro Version</u></a>', $this->domain ), $this->prefix ) . '</span>') ),
74 );
75 $links = array_merge( $new_links, $links );
76 }
77 return $links;
78 }
79
80 function request_verify_ssl() {
81 return get_option( 'force_sslverify', false );
82 }
83
84 function nice_name_from_file( $file ) {
85 $info = pathinfo( $file );
86 if ( !empty( $info ) ) {
87 if ( $info['filename'] == 'wplr-sync' ) {
88 return "WP/LR Sync";
89 }
90 $info['filename'] = str_replace( '-', ' ', $info['filename'] );
91 $file = ucwords( $info['filename'] );
92 }
93 return $file;
94 }
95
96 function admin_notices_licensed_free() {
97 if ( isset( $_POST[$this->prefix . '_reset_sub'] ) ) {
98 delete_option( $this->prefix . '_pro_serial' );
99 delete_option( $this->prefix . '_license' );
100 return;
101 }
102 $html = '<div class="notice notice-error">';
103 $html .= sprintf(
104 __( '<p>It looks like you are using the free version of the plugin (<b>%s</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.', $this->domain ),
105 $this->nice_name_from_file( $this->mainfile ) );
106 $html .= '<p>
107 <form method="post" action="">
108 <input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
109 <input type="submit" name="submit" id="submit" class="button" value="'
110 . __( 'Remove the license', $this->domain ) . '">
111 </form>
112 </p>';
113 $html .= '</div>';
114 wp_kses_post( $html );
115 }
116
117 function admin_menu_start() {
118 // Hide the admin if user doesn't like Meow much
119 if ( get_option( 'meowapps_hide_meowapps', false ) ) {
120 register_setting( 'general', 'meowapps_hide_meowapps' );
121 add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', array( $this, 'meowapps_hide_dashboard_callback' ), 'general' );
122 return;
123 }
124
125 // Create standard menu if it does not already exist
126 global $submenu;
127 if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
128 add_menu_page( 'Meow Apps', '<img alt="Meow Apps" style="width: 24px; margin-left: -30px; position: absolute; margin-top: -3px;" src="' . MeowCommon_Admin::$logo . '" />Meow Apps', 'manage_options', 'meowapps-main-menu',
129 array( $this, 'admin_meow_apps' ), '', 82 );
130 add_submenu_page( 'meowapps-main-menu', __( 'Dashboard', $this->domain ),
131 __( 'Dashboard', $this->domain ), 'manage_options',
132 'meowapps-main-menu', array( $this, 'admin_meow_apps' ) );
133 }
134 }
135
136 function meowapps_hide_dashboard_callback() {
137 $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
138 checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
139 $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a cleaner admin. This option will be reset if a new Meow Apps plugin is installed. <b>Once activated, an option will be added in your General settings to display it again.</b></small>', $this->domain );
140 echo wp_kses_post( $html );
141 }
142
143 function is_registered() {
144 return apply_filters( $this->prefix . '_meowapps_is_registered', false, $this->prefix );
145 }
146
147 function get_phpinfo() {
148 if ( !current_user_can( 'administrator' ) ) {
149 return;
150 }
151 ob_start();
152 // phpcs:disable WordPress.PHP.DevelopmentFunctions
153 phpinfo( INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES );
154 // phpcs:enable
155 $html = ob_get_contents();
156 ob_end_clean();
157 $html = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $html );
158 return $html;
159 }
160
161 function admin_meow_apps() {
162 $html = "<div id='meow-common-dashboard'></div>";
163 $html .= "<div style='height: 0; width: 0; overflow: hidden;' id='meow-common-phpinfo'>";
164 $html .= $this->get_phpinfo();
165 $html .= "</div>";
166 $html = preg_replace("/<img[^>]+\>/i", "", $html);
167 echo wp_kses_post( $html );
168 }
169
170 function admin_footer_text( $current ) {
171 return sprintf(
172 // translators: %1$s is the version of the interface; %2$s is a file path.
173 __( 'Thanks for using <a href="https://meowapps.com">Meow Apps</a>! This is the Meow Admin %1$s <br /><i>Loaded from %2$s </i>', $this->domain ),
174 MeowCommon_Admin::$version,
175 __FILE__
176 );
177 }
178 }
179 }
180