PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 2.7.4
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v2.7.4
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Ends / Back / Settings.php
embedpress / EmbedPress / Ends / Back Last commit date
Handler.php 5 years ago Settings.php 5 years ago index.html 7 years ago
Settings.php
280 lines
1 <?php
2
3 namespace EmbedPress\Ends\Back;
4
5 (defined( 'ABSPATH' ) && defined( 'EMBEDPRESS_IS_LOADED' )) or die( "No direct script access allowed." );
6
7 /**
8 * Entity that handles the plugin's settings page.
9 *
10 * @package EmbedPress
11 * @subpackage EmbedPress/Ends/Back
12 * @author EmbedPress <help@embedpress.com>
13 * @copyright Copyright (C) 2020 WPDeveloper. All rights reserved.
14 * @license GPLv3 or later
15 * @since 1.0.0
16 */
17 class Settings {
18 /**
19 * This class namespace.
20 *
21 * @since 1.0.0
22 * @access private
23 * @static
24 *
25 * @var string $namespace
26 */
27 private static $namespace = '\\EmbedPress\\Ends\\Back\\Settings';
28
29 /**
30 * The plugin's unique identifier.
31 *
32 * @since 1.0.0
33 * @access private
34 * @static
35 *
36 * @var string $identifier
37 */
38 private static $identifier = "plg_embedpress";
39
40 /**
41 * Unique identifier to the plugin's admin settings section.
42 *
43 * @since 1.0.0
44 * @access private
45 * @static
46 *
47 * @var string $sectionAdminIdentifier
48 */
49 private static $sectionAdminIdentifier = "embedpress_options_admin";
50
51 /**
52 * Unique identifier to the plugin's general settings section.
53 *
54 * @since 1.0.0
55 * @access private
56 * @static
57 *
58 * @var string $sectionGroupIdentifier The name of the plugin.
59 */
60 private static $sectionGroupIdentifier = "embedpress";
61
62 /**
63 * Class constructor. This prevents the class being directly instantiated.
64 *
65 * @since 1.0.0
66 */
67 public function __construct() {
68 }
69
70 /**
71 * This prevents the class being cloned.
72 *
73 * @since 1.0.0
74 */
75 public function __clone() {
76 }
77
78 /**
79 * Method that adds an sub-item for EmbedPress to the WordPress Settings menu.
80 *
81 * @since 1.0.0
82 * @static
83 */
84 public static function registerMenuItem() {
85 add_menu_page( __('EmbedPress Settings', 'embedpress'), 'EmbedPress', 'manage_options', 'embedpress',
86 [ self::$namespace, 'renderForm' ], null, 64 );
87 }
88
89 /**
90 * Method that configures the EmbedPress settings page.
91 *
92 * @since 1.0.0
93 * @static
94 */
95 public static function registerActions() {
96 $activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
97 $action = ( $activeTab !== "embedpress" ) ? "embedpress:{$activeTab}:settings:register" : '';
98 if ( !empty( $activeTab ) && has_action( $action ) ) {
99 do_action( $action, [
100 'id' => self::$sectionAdminIdentifier,
101 'slug' => self::$identifier,
102 ] );
103 }
104 }
105
106 /**
107 * Returns true if the plugin is active
108 *
109 * @param string $plugin
110 *
111 * @return boolean
112 */
113 protected static function is_plugin_active( $plugin ) {
114 return is_plugin_active( "{$plugin}/{$plugin}.php" );
115 }
116
117 /**
118 * Returns true if the plugin is installed
119 *
120 * @param string $plugin
121 *
122 * @return boolean
123 */
124 protected static function is_plugin_installed( $plugin ) {
125 return file_exists( plugin_dir_path( EMBEDPRESS_ROOT ) . "{$plugin}/{$plugin}.php" );
126 }
127
128 /**
129 * Method that render the settings form.
130 *
131 * @since 1.0.0
132 * @static
133 */
134 public static function renderForm() {
135 // Add the color picker css file
136 wp_enqueue_style( 'wp-color-picker' );
137 // Include our custom jQuery file with WordPress Color Picker dependency
138 wp_enqueue_script( 'ep-settings', EMBEDPRESS_URL_ASSETS . 'js/settings.js', [ 'wp-color-picker' ],
139 EMBEDPRESS_VERSION, true );
140
141 $activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
142 $is_upgrade_tab_active = ($activeTab === 'embedpress_get_pro' || empty( $activeTab )) && !defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' );
143 $is_license_tab_active = ($activeTab === 'embedpress_license' || empty( $activeTab )) && defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' );
144 $settingsFieldsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$sectionGroupIdentifier;
145 $settingsSectionsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$identifier;
146 $five_stars = `
147 <span class="dashicons dashicons-star-filled"></span>
148 <span class="dashicons dashicons-star-filled"></span>
149 <span class="dashicons dashicons-star-filled"></span>
150 <span class="dashicons dashicons-star-filled"></span>
151 <span class="dashicons dashicons-star-filled"></span>
152 `;
153 ?>
154 <div id="embedpress-settings-wrapper">
155 <header>
156 <h1 class="pressshack-title">
157 <a href="//wordpress.org/plugins/embedpress" target="_blank" rel="noopener noreferrer"
158 title="EmbedPress">
159 EmbedPress
160 </a>
161 </h1>
162 <div class="embedpress-version-name">
163 <span class="free"> <?php esc_html_e("Core Version: ", "embedpress"); echo EMBEDPRESS_VERSION; ?></span>
164 <?php if ( defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ) { ?>
165 <span class="pro"> <?php esc_html_e("Pro Version: ", "embedpress"); echo EMBEDPRESS_PRO_PLUGIN_VERSION; ?></span>
166 <?php } ?>
167 </div>
168 </header>
169
170 <?php settings_errors(); ?>
171 <div>
172 <h2 class="nav-tab-wrapper">
173 <?php if ( !defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ): ?>
174 <a href="?page=embedpress&tab=embedpress_get_pro"
175 class="nav-tab<?php echo $is_upgrade_tab_active ? ' nav-tab-active' : ''; ?> ">
176 <?php esc_html_e( 'Go Premium', 'embedpress'); ?>
177 </a>
178 <?php endif; ?>
179 <?php do_action( 'embedpress:settings:render:tab', $activeTab ); ?>
180 <?php do_action( 'embedpress_license_tab', $activeTab ); ?>
181 </h2>
182
183 <?php if ( $activeTab !== 'addons' ) : ?>
184 <form action="options.php" method="POST" style="padding-bottom: 20px;">
185 <?php settings_fields( $settingsFieldsIdentifier ); ?>
186 <?php do_settings_sections( $settingsSectionsIdentifier ); ?>
187 <?php if ( !$is_license_tab_active && !$is_upgrade_tab_active ) {
188 ?>
189 <button type="submit" class="button button-primary embedpress-setting-save"><?php esc_html_e( 'Save Changes', 'embedpress'); ?>
190 </button>
191 <?php } ?>
192
193 </form>
194 <?php endif; ?>
195 <?php if ( $is_license_tab_active ) : ?>
196 <?php do_action( 'embedpress_license' ); ?>
197 <?php endif; ?>
198 <?php if ( $is_upgrade_tab_active ) : ?>
199 <div class=" embedpress-go-premium">
200 <div class="embedpress-col-half">
201 <div class="embedpress-admin-block-wrapper">
202 <div class="embedpress-admin-block embedpress-admin-block-docs">
203 <header class="embedpress-admin-block-header">
204 <div class="embedpress-admin-block-header-icon">
205 <img src="<?php echo plugins_url( 'assets/images/icon-why-premium.svg',
206 EMBEDPRESS_PLUGIN_BASENAME ); ?>" alt="embedpress-go-pro">
207 </div>
208 <h4 class="embedpress-admin-title"><?php esc_html_e( 'Why upgrade to Premium Version?', 'embedpress'); ?></h4>
209 </header>
210 <div class="embedpress-admin-block-content">
211 <p><?php esc_html_e( 'The premium version helps us to continue development of the product
212 incorporating even more features and enhancements.', 'embedpress'); ?></p>
213 <p><?php esc_html_e( 'You will also get world class support from our dedicated team, 24/7.', 'embedpress'); ?></p>
214 <a href="https://wpdeveloper.net/plugins/embedpress#pricing" target="_blank"
215 class="button embedpress-btn"><?php esc_html_e( 'Get Pro Version', 'embedpress'); ?></a>
216 </div>
217 </div>
218 </div><!--admin block-wrapper end-->
219 </div>
220 </div>
221 <?php endif; ?>
222 </div>
223
224 <footer>
225 <p>
226 <a href="//embedpress.com/go/review-ep" target="_blank"
227 rel="noopener noreferrer">
228 <?php
229 /* translators: 1: EmbedPress Plugin Name, 2: 5 stars. */
230 printf( __('If you like %1$s please leave us a 5 stars %2$s
231 rating. Thank you!', 'embedpress'), '<strong>EmbedPress</strong>', $five_stars ) ?>
232 </a>
233 </p>
234 <hr>
235 <nav>
236 <ul>
237 <li>
238 <a href="//embedpress.com" target="_blank" rel="noopener noreferrer"
239 title="About EmbedPress"><?php esc_html_e( 'About', 'embedpress'); ?></a>
240 </li>
241 <li>
242 <a href="//embedpress.com/sources/" target="_blank" rel="noopener noreferrer"
243 title="List of supported sources by EmbedPress"><?php esc_html_e( 'Supported Sources', 'embedpress'); ?></a>
244 </li>
245 <li>
246 <a href="//embedpress.com/documentation/" target="_blank" rel="noopener noreferrer"
247 title="EmbedPress Documentation"><?php esc_html_e( 'Documentation', 'embedpress'); ?></a>
248 </li>
249 <li>
250 <a href="//embedpress.com/#pricing" target="_blank" rel="noopener noreferrer"
251 title="Get EmbedPress Pro"><?php esc_html_e( 'Get EmbedPress Pro', 'embedpress'); ?></a>
252 </li>
253 <li>
254 <a href="//embedpress.com/support/" target="_blank" rel="noopener noreferrer"
255 title="Contact the EmbedPress team"><?php esc_html_e( 'Contact', 'embedpress'); ?></a>
256 </li>
257 <li>
258 <a href="//twitter.com/wpdevteam" target="_blank" rel="noopener noreferrer">
259 <span class="dashicons dashicons-twitter"></span>
260 </a>
261 </li>
262 <li>
263 <a href="//www.facebook.com/WPDeveloperNet/" target="_blank" rel="noopener noreferrer">
264 <span class="dashicons dashicons-facebook"></span>
265 </a>
266 </li>
267 </ul>
268 </nav>
269 <p>
270 <a href="//embedpress.com" target="_blank" rel="noopener noreferrer">
271 <img width="100" alt="embedpress logo" src="<?php echo plugins_url( 'assets/images/embedpress.png',
272 EMBEDPRESS_PLUGIN_BASENAME ); ?>">
273 </a>
274 </p>
275 </footer>
276 </div>
277 <?php
278 }
279 }
280