Version Description
- Fixed plugin issue causing admin to break for some users.
- Reduced plugin usage consumption when not needed.
Download this release
Release Info
Developer | hivewebstudios |
Plugin | Font Organizer |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- font-organizer.php +3 -3
- readme.txt +5 -1
- settings.php +46 -47
font-organizer.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Font_Organizer
|
4 |
-
* @version 2.1.
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Font Organizer
|
8 |
Plugin URI: https://wordpress.org/plugins/font-organizer/
|
9 |
Description: Font Organizer is the complete solution for font implementation in WordPress websites.
|
10 |
Author: Hive
|
11 |
-
Version: 2.1.
|
12 |
Author URI: https://hivewebstudios.com
|
13 |
Text Domain: font-organizer
|
14 |
*/
|
@@ -21,7 +21,7 @@ define( 'FO_DEFAULT_ROLE', 'administrator' );
|
|
21 |
require_once FO_ABSPATH . 'helpers/helpers.php';
|
22 |
|
23 |
global $fo_db_version;
|
24 |
-
$fo_db_version = '2.1.
|
25 |
|
26 |
$upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
|
27 |
global $fo_css_directory_path;
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Font_Organizer
|
4 |
+
* @version 2.1.1
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Font Organizer
|
8 |
Plugin URI: https://wordpress.org/plugins/font-organizer/
|
9 |
Description: Font Organizer is the complete solution for font implementation in WordPress websites.
|
10 |
Author: Hive
|
11 |
+
Version: 2.1.1
|
12 |
Author URI: https://hivewebstudios.com
|
13 |
Text Domain: font-organizer
|
14 |
*/
|
21 |
require_once FO_ABSPATH . 'helpers/helpers.php';
|
22 |
|
23 |
global $fo_db_version;
|
24 |
+
$fo_db_version = '2.1.1';
|
25 |
|
26 |
$upload_dir = wp_upload_dir(); // Must create a temp variable for PHP 5.3.
|
27 |
global $fo_css_directory_path;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: basaar,yardensade,hivewebstudios
|
|
3 |
Tags: fonts,google fonts,upload font,font,google,custom, free, download, style
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.7.5
|
6 |
-
Stable tag: 2.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -116,6 +116,10 @@ Example: Both "Arial Bold" or "Arial Italic" would get the "Font Name" of "Arial
|
|
116 |
|
117 |
== Changelog ==
|
118 |
|
|
|
|
|
|
|
|
|
119 |
= 2.1.0 =
|
120 |
* Added Black & Black italic to font weights.
|
121 |
* Added support for upload svg and eot font formats.
|
3 |
Tags: fonts,google fonts,upload font,font,google,custom, free, download, style
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 4.7.5
|
6 |
+
Stable tag: 2.1.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 2.1.1 =
|
120 |
+
* Fixed plugin issue causing admin to break for some users.
|
121 |
+
* Reduced plugin usage consumption when not needed.
|
122 |
+
|
123 |
= 2.1.0 =
|
124 |
* Added Black & Black italic to font weights.
|
125 |
* Added support for upload svg and eot font formats.
|
settings.php
CHANGED
@@ -158,49 +158,6 @@ class FoSettingsPage
|
|
158 |
|
159 |
$this->font_weights = array('300','300italic','regular','italic','600','600italic','700','700italic','800','800italic', '900', '900italic');
|
160 |
|
161 |
-
// An upload is made. Upload the file and proccess it.
|
162 |
-
if (isset($_POST['submit_upload_font'])){
|
163 |
-
if($args = $this->validate_upload()){
|
164 |
-
$this->upload_file($args);
|
165 |
-
$this->should_create_css = true;
|
166 |
-
}else{
|
167 |
-
add_action( 'admin_notices', array($this, 'upload_failed_admin_notice') );
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
if (isset($_POST['submit_usable_font'])){
|
172 |
-
if($args = $this->validate_add_usable()){
|
173 |
-
$this->use_font($args);
|
174 |
-
$this->should_create_css = true;
|
175 |
-
}else{
|
176 |
-
add_action( 'admin_notices', array($this, 'use_font_failed_admin_notice') );
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
if (isset($_POST['delete_usable_font'])){
|
181 |
-
if($args = $this->validate_delete_usable()){
|
182 |
-
$this->delete_font($args);
|
183 |
-
$this->should_create_css = true;
|
184 |
-
wp_cache_delete ( 'alloptions', 'options' );
|
185 |
-
|
186 |
-
}else{
|
187 |
-
add_action( 'admin_notices', array($this, 'delete_font_failed_admin_notice') );
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
if(isset($_POST['submit_custom_elements'])){
|
192 |
-
if($args = $this->validate_custom_elements()){
|
193 |
-
$this->add_custom_elements($args);
|
194 |
-
$this->should_create_css = true;
|
195 |
-
}else{
|
196 |
-
add_action( 'admin_notices', array($this, 'add_custom_elements_failed_admin_notice') );
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
if(isset($_GET['action']) && ($_GET['action'] == 'delete' || $_GET['action'] == 'bulk-delete') && isset($_GET['custom_element'])){
|
201 |
-
$this->should_create_css = true;
|
202 |
-
}
|
203 |
-
|
204 |
if($should_hook){
|
205 |
add_action( 'network_admin_menu', array( $this, 'add_plugin_page' ) );
|
206 |
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
@@ -213,6 +170,7 @@ class FoSettingsPage
|
|
213 |
* Register all the required scripts for this page.
|
214 |
*/
|
215 |
public function register_scripts() {
|
|
|
216 |
wp_enqueue_script( 'jquery-ui-core' );
|
217 |
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
218 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
@@ -259,7 +217,7 @@ class FoSettingsPage
|
|
259 |
editor.$blockScrolling = Infinity;
|
260 |
editor.getSession().setUseWrapMode( true );
|
261 |
editor.getSession().setMode( "ace/mode/css" );
|
262 |
-
editor.setValue("<?php echo array_key_exists('additional_css', $this->advanced_options) ? preg_replace('/[\r\n]+/', '\n',$this->advanced_options['additional_css']) : ''; ?>");
|
263 |
|
264 |
// Notify fields on change to allow save in WordPress options.
|
265 |
editor.getSession().on('change', function() {
|
@@ -422,8 +380,6 @@ class FoSettingsPage
|
|
422 |
|
423 |
add_action( 'load-' . $hook, array( $this, 'init_page' ) );
|
424 |
add_action( 'load-' . $hook, array( $this, 'register_scripts' ) );
|
425 |
-
add_action( 'load-' . $hook, array( $this, 'create_css_file' ) );
|
426 |
-
add_action( 'admin_footer', array( $this, 'add_footer_styles' ) );
|
427 |
add_filter( 'option_page_capability_fo_general_options', array($this, 'options_capability') );
|
428 |
add_filter( 'option_page_capability_fo_elements_options', array($this, 'options_capability') );
|
429 |
add_filter( 'option_page_capability_fo_advanced_options', array($this, 'options_capability') );
|
@@ -436,11 +392,54 @@ class FoSettingsPage
|
|
436 |
}
|
437 |
|
438 |
public function init_page(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
$this->init();
|
|
|
440 |
}
|
441 |
|
442 |
public function create_css_file($force = false){
|
443 |
-
|
444 |
if(((!isset($_GET['settings-updated']) || !$_GET['settings-updated']) && !$this->should_create_css) && !$force){
|
445 |
return;
|
446 |
}
|
158 |
|
159 |
$this->font_weights = array('300','300italic','regular','italic','600','600italic','700','700italic','800','800italic', '900', '900italic');
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
if($should_hook){
|
162 |
add_action( 'network_admin_menu', array( $this, 'add_plugin_page' ) );
|
163 |
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
170 |
* Register all the required scripts for this page.
|
171 |
*/
|
172 |
public function register_scripts() {
|
173 |
+
add_action( 'admin_footer', array( $this, 'add_footer_styles' ) );
|
174 |
wp_enqueue_script( 'jquery-ui-core' );
|
175 |
wp_enqueue_script( 'jquery-ui-autocomplete' );
|
176 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
217 |
editor.$blockScrolling = Infinity;
|
218 |
editor.getSession().setUseWrapMode( true );
|
219 |
editor.getSession().setMode( "ace/mode/css" );
|
220 |
+
editor.setValue("<?php echo array_key_exists('additional_css', $this->advanced_options) ? preg_replace('/[\r\n]+/', '\n',$this->advanced_options['additional_css']) : ''; ?>", 1);
|
221 |
|
222 |
// Notify fields on change to allow save in WordPress options.
|
223 |
editor.getSession().on('change', function() {
|
380 |
|
381 |
add_action( 'load-' . $hook, array( $this, 'init_page' ) );
|
382 |
add_action( 'load-' . $hook, array( $this, 'register_scripts' ) );
|
|
|
|
|
383 |
add_filter( 'option_page_capability_fo_general_options', array($this, 'options_capability') );
|
384 |
add_filter( 'option_page_capability_fo_elements_options', array($this, 'options_capability') );
|
385 |
add_filter( 'option_page_capability_fo_advanced_options', array($this, 'options_capability') );
|
392 |
}
|
393 |
|
394 |
public function init_page(){
|
395 |
+
// First in this page. Make sure to handle all events happend and crete
|
396 |
+
if (isset($_POST['submit_upload_font'])){
|
397 |
+
if($args = $this->validate_upload()){
|
398 |
+
$this->upload_file($args);
|
399 |
+
$this->should_create_css = true;
|
400 |
+
}else{
|
401 |
+
add_action( 'admin_notices', array($this, 'upload_failed_admin_notice') );
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
if (isset($_POST['submit_usable_font'])){
|
406 |
+
if($args = $this->validate_add_usable()){
|
407 |
+
$this->use_font($args);
|
408 |
+
$this->should_create_css = true;
|
409 |
+
}else{
|
410 |
+
add_action( 'admin_notices', array($this, 'use_font_failed_admin_notice') );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
if (isset($_POST['delete_usable_font'])){
|
415 |
+
if($args = $this->validate_delete_usable()){
|
416 |
+
$this->delete_font($args);
|
417 |
+
$this->should_create_css = true;
|
418 |
+
wp_cache_delete ( 'alloptions', 'options' );
|
419 |
+
|
420 |
+
}else{
|
421 |
+
add_action( 'admin_notices', array($this, 'delete_font_failed_admin_notice') );
|
422 |
+
}
|
423 |
+
}
|
424 |
+
|
425 |
+
if(isset($_POST['submit_custom_elements'])){
|
426 |
+
if($args = $this->validate_custom_elements()){
|
427 |
+
$this->add_custom_elements($args);
|
428 |
+
$this->should_create_css = true;
|
429 |
+
}else{
|
430 |
+
add_action( 'admin_notices', array($this, 'add_custom_elements_failed_admin_notice') );
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
if(isset($_GET['action']) && ($_GET['action'] == 'delete' || $_GET['action'] == 'bulk-delete') && isset($_GET['custom_element'])){
|
435 |
+
$this->should_create_css = true;
|
436 |
+
}
|
437 |
+
|
438 |
$this->init();
|
439 |
+
$this->create_css_file();
|
440 |
}
|
441 |
|
442 |
public function create_css_file($force = false){
|
|
|
443 |
if(((!isset($_GET['settings-updated']) || !$_GET['settings-updated']) && !$this->should_create_css) && !$force){
|
444 |
return;
|
445 |
}
|