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