| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
die('-1'); |
| 5 |
} |
| 6 |
|
| 7 |
class QuadMenu_Redux { |
| 8 |
|
| 9 |
public $theme; |
| 10 |
|
| 11 |
public function __construct() { |
| 12 |
|
| 13 |
if (!class_exists('Redux')) { |
| 14 |
require_once QUADMENU_PLUGIN_DIR . 'lib/ReduxCore/framework.php'; |
| 15 |
} |
| 16 |
|
| 17 |
add_action('admin_menu', array($this, 'remove_redux_menu'), 12); |
| 18 |
|
| 19 |
add_action('redux/options/' . QUADMENU_OPTIONS . '/settings/change', array($this, 'notification_bar'), 30, 2); |
| 20 |
|
| 21 |
add_filter('redux/options/' . QUADMENU_OPTIONS . '/ajax_save/response', array($this, 'reload')); |
| 22 |
|
| 23 |
add_action('redux/extensions/' . QUADMENU_OPTIONS . '/before', array($this, 'ad_remove'), 0); |
| 24 |
|
| 25 |
add_filter('redux/extension/' . QUADMENU_OPTIONS . '/customizer', '__return_null'); |
| 26 |
|
| 27 |
add_filter('redux/' . QUADMENU_OPTIONS . '/field/class/icons', array($this, 'field_icons')); |
| 28 |
|
| 29 |
add_filter('redux/' . QUADMENU_OPTIONS . '/field/class/rgba', array($this, 'field_rgba')); |
| 30 |
|
| 31 |
add_filter('redux/' . QUADMENU_OPTIONS . '/field/class/animation', array($this, 'field_animation')); |
| 32 |
|
| 33 |
add_filter('redux/' . QUADMENU_OPTIONS . '/panel/template/header.tpl.php', array($this, 'header')); |
| 34 |
|
| 35 |
add_filter('redux/' . QUADMENU_OPTIONS . '/panel/template/header_stickybar.tpl.php', array($this, 'header_stickybar')); |
| 36 |
|
| 37 |
add_filter('redux/' . QUADMENU_OPTIONS . '/panel/template/footer.tpl.php', array($this, 'footer')); |
| 38 |
|
| 39 |
add_filter('ReduxFramework_icons_classes', array($this, 'selected_icons_iconmap')); |
| 40 |
|
| 41 |
$this->redux(); |
| 42 |
} |
| 43 |
|
| 44 |
function selected_icons_iconmap() { |
| 45 |
return _QuadMenu()->selected_icons()->iconmap; |
| 46 |
} |
| 47 |
|
| 48 |
function header($path = false) { |
| 49 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/template/header.tpl.php'; |
| 50 |
} |
| 51 |
|
| 52 |
function header_stickybar($path = false) { |
| 53 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/template/header_stickybar.tpl.php'; |
| 54 |
} |
| 55 |
|
| 56 |
function footer($path = false) { |
| 57 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/template/footer.tpl.php'; |
| 58 |
} |
| 59 |
|
| 60 |
function remove_redux_menu() { |
| 61 |
remove_submenu_page('tools.php', 'redux-about'); |
| 62 |
} |
| 63 |
|
| 64 |
static function notification_bar() { |
| 65 |
|
| 66 |
if ($notices = get_option('quadmenu_redux_notices', false)) { |
| 67 |
foreach ($notices as $notice) { |
| 68 |
|
| 69 |
if (empty($notice['class']) || empty($notice['notice'])) |
| 70 |
continue; |
| 71 |
|
| 72 |
echo '<div class="saved_notice admin-notice notice-' . $notice['class'] . '">' . $notice['notice'] . '</div>'; |
| 73 |
} |
| 74 |
delete_option('quadmenu_redux_notices'); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
static function add_notification($class = 'updated', $notice = false) { |
| 79 |
|
| 80 |
if (!$notice) |
| 81 |
return; |
| 82 |
|
| 83 |
$notices = get_option('quadmenu_redux_notices', array()); |
| 84 |
|
| 85 |
$notices[] = array( |
| 86 |
'class' => $class, |
| 87 |
'notice' => $notice |
| 88 |
); |
| 89 |
|
| 90 |
update_option('quadmenu_redux_notices', $notices); |
| 91 |
} |
| 92 |
|
| 93 |
function ad_remove($ReduxFramework) { |
| 94 |
|
| 95 |
if (!class_exists('ReduxFramework_extension_ad_remove')) { |
| 96 |
|
| 97 |
require_once(QUADMENU_PLUGIN_DIR . 'lib/redux/ad_remove/extension_ad_remove.php'); |
| 98 |
|
| 99 |
new ReduxFramework_extension_ad_remove($ReduxFramework); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
function field_rgba($field) { |
| 104 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/rgba/field_rgba.php'; |
| 105 |
} |
| 106 |
|
| 107 |
function field_icons($field) { |
| 108 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/icons/field_icons.php'; |
| 109 |
} |
| 110 |
|
| 111 |
function field_animation($field) { |
| 112 |
return QUADMENU_PLUGIN_DIR . 'lib/redux/animation/field_animation.php'; |
| 113 |
} |
| 114 |
|
| 115 |
function reload($return_array) { |
| 116 |
|
| 117 |
if (get_transient('_quadmenu_saved_reload')) { |
| 118 |
|
| 119 |
$return_array['action'] = 'reload'; |
| 120 |
} |
| 121 |
|
| 122 |
return $return_array; |
| 123 |
} |
| 124 |
|
| 125 |
static function do_reload($run = true) { |
| 126 |
|
| 127 |
if ($run) { |
| 128 |
set_transient('_quadmenu_saved_reload', true, 30); |
| 129 |
} else { |
| 130 |
delete_transient('_quadmenu_saved_reload'); |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
public function redux() { |
| 135 |
|
| 136 |
$args = array( |
| 137 |
'class' => 'quadmenu-admin-wrap', |
| 138 |
'opt_name' => QUADMENU_OPTIONS, |
| 139 |
'disable_tracking' => true, |
| 140 |
'display_name' => QUADMENU_PLUGIN_NAME, |
| 141 |
'display_version' => QUADMENU_PLUGIN_VERSION, |
| 142 |
'menu_type' => 'submenu', |
| 143 |
'allow_sub_menu' => true, |
| 144 |
'menu_title' => QUADMENU_PLUGIN_NAME, |
| 145 |
'page' => QUADMENU_PLUGIN_NAME, |
| 146 |
'google_api_key' => 'AIzaSyBNsacnx37lZpIIyDyNAjGC1qdE7Z0CrEQ', |
| 147 |
'async_typography' => false, |
| 148 |
'show_options_object' => false, |
| 149 |
'global_variable' => 'quadmenu', |
| 150 |
'customizer' => true, |
| 151 |
'page_priority' => null, |
| 152 |
'page_parent' => 'themes.php', |
| 153 |
'page_permissions' => 'edit_theme_options', |
| 154 |
'page_slug' => QUADMENU_PANEL, |
| 155 |
'save_defaults' => true, |
| 156 |
'default_show' => false, |
| 157 |
'default_mark' => '', |
| 158 |
'transient_time' => 60 * MINUTE_IN_SECONDS, |
| 159 |
'output' => true, |
| 160 |
'output_tag' => false, |
| 161 |
'database' => '', |
| 162 |
'use_cdn' => true, |
| 163 |
'hints' => array( |
| 164 |
'icon' => 'el el-question-sign', |
| 165 |
'icon_position' => 'right', |
| 166 |
'icon_color' => 'lightgray', |
| 167 |
'icon_size' => 'normal', |
| 168 |
'tip_style' => array( |
| 169 |
'color' => 'dark', |
| 170 |
'shadow' => true, |
| 171 |
'rounded' => false, |
| 172 |
'style' => '', //youtube', |
| 173 |
), |
| 174 |
'tip_position' => array( |
| 175 |
'my' => 'top left', |
| 176 |
'at' => 'bottom right', |
| 177 |
), |
| 178 |
'tip_effect' => array( |
| 179 |
'show' => array( |
| 180 |
'effect' => 'slide', |
| 181 |
'duration' => '500', |
| 182 |
'event' => 'click', |
| 183 |
), |
| 184 |
'hide' => array( |
| 185 |
'effect' => 'slide', |
| 186 |
'duration' => '500', |
| 187 |
'event' => 'click mouseleave', |
| 188 |
), |
| 189 |
), |
| 190 |
), |
| 191 |
'show_import_export' => true, // REMOVE |
| 192 |
'dev_mode' => QUADMENU_DEV, // Show the time the page took to load, etc |
| 193 |
'dev_mode_icon' => 'quadmenu-database', |
| 194 |
'dev_mode_icon_class' => 'quadmenu-database', |
| 195 |
'system_info' => QUADMENU_DEV, // REMOVE |
| 196 |
'ajax_save' => true, |
| 197 |
'footer_credit' => ' ' |
| 198 |
); |
| 199 |
|
| 200 |
// Panel Intro text -> before the form |
| 201 |
if (!isset($args['global_variable']) || $args['global_variable'] !== false) { |
| 202 |
if (!empty($args['global_variable'])) { |
| 203 |
$v = $args['global_variable']; |
| 204 |
} else { |
| 205 |
$v = str_replace("-", "_", $args['opt_name']); |
| 206 |
} |
| 207 |
} |
| 208 |
|
| 209 |
if (class_exists('ReduxFramework')) { |
| 210 |
new ReduxFramework(array(), apply_filters('quadmenu_redux_args', $args)); |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
} |
| 215 |
|
| 216 |
new QuadMenu_Redux(); |
| 217 |
|