Absolutely Glamorous Custom Admin - Version 1.5.3

Version Description

  • Fixed issue on PHP 5.3 when short PHP tags are not supported
Download this release

Release Info

Developer argonius
Plugin Icon 128x128 Absolutely Glamorous Custom Admin
Version 1.5.3
Comparing to
See all releases

Code changes from version 1.5.2 to 1.5.3

Files changed (2) hide show
  1. plugin.php +3064 -2825
  2. readme.txt +7 -1
plugin.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: AG Custom Admin
4
  Plugin URI: http://wordpressadminpanel.com/ag-custom-admin/
5
  Description: All-in-one tool for admin panel customization. Change almost everything: admin menu, dashboard, login page, admin bar etc. Apply admin panel themes.
6
  Author: WAP
7
- Version: 1.5.2
8
  Author URI: http://www.wordpressadminpanel.com/
9
 
10
  Copyright 2015. WAP (email : info@wordpressadminpanel.com)
@@ -22,2893 +22,3132 @@ Author URI: http://www.wordpressadminpanel.com/
22
  You should have received a copy of the GNU General Public License
23
  along with this program. If not, see <http://www.gnu.org/licenses/>.
24
  */
25
-
26
  $agca = new AGCA();
27
 
28
- class AGCA{
29
- private $colorizer="";
30
- private $active_plugin;
31
- private $agca_version;
32
- private $agca_debug = false;
33
- private $admin_capabilities;
 
34
  private $context = "";
35
- private $saveAfterImport = false;
36
- private $templateCustomizations = "";
37
- private $templates_ep = "http://wordpressadminpanel.com/configuration.php";
38
- public function __construct()
39
- {
40
- $this->reloadScript();
41
- $this->checkPOST();
42
- $this->checkGET();
43
-
44
- if(function_exists("add_filter")){
45
- add_filter('admin_title', array(&$this,'change_title'), 10, 2);
46
- add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
47
- }
48
-
49
- add_action('admin_init', array(&$this,'agca_register_settings'));
50
- add_action('admin_init', array(&$this,'agca_init_session'));
51
- add_action('admin_head', array(&$this,'print_admin_css'));
52
- add_action('login_head', array(&$this,'print_login_head'));
53
- add_action('admin_menu', array(&$this,'agca_create_menu'));
54
- add_action('wp_head', array(&$this,'print_page'));
55
- add_action( 'wp_before_admin_bar_render', array(&$this,'admin_bar_changes') );
56
- register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
57
-
58
- add_action( 'customize_controls_enqueue_scripts', array(&$this,'agca_customizer_php') );
59
-
60
- /*Initialize properties*/
61
- $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'),'colorizer');
62
-
63
- $this->agca_version = "1.5.2";
64
-
65
- //TODO:upload images programmatically
66
-
67
- }
68
- // Add donate and support information
69
- function jk_filter_plugin_links($links, $file)
70
- {
71
- if ( $file == plugin_basename(__FILE__) )
72
- {
73
- $links[] = '<a href="tools.php?page=ag-custom-admin/plugin.php">' . __('Settings') . '</a>';
74
- $links[] = '<a href="tools.php?page=ag-custom-admin/plugin.php#ag-templates">' . __('Admin Themes') . '</a>';
75
- $links[] = '<a href="http://wordpressadminpanel.com/agca-support/">' . __('Support') . '</a>';
76
- $links[] = '<a href="http://wordpressadminpanel.com/agca-support/support-for-future-development">' . __('Donate') . '</a>';
77
- }
78
- return $links;
79
- }
80
-
81
- function change_admin_color(){
82
- return 'default';
83
- }
84
-
85
- function agca_customizer_php(){
86
- $this->agca_get_includes();
87
- }
88
-
89
- function agca_init_session(){
90
- if (!session_id())
91
- session_start();
92
- }
93
-
94
- function checkGET(){
95
- if(isset($_GET['agca_action'])){
96
- if($_GET['agca_action'] =="remove_templates"){
97
- $this->delete_template_images_all();
98
- update_option('agca_templates', "");
99
- update_option('agca_selected_template', "");
100
- }
101
- }
102
- if(isset($_GET['agca_debug'])){
103
- if($_GET['agca_debug'] =="true"){
104
- $this->agca_debug = true;
105
- }else{
106
- $this->agca_debug = false;
107
- }
108
- }
109
- }
110
-
111
- function checkPOST(){
112
-
113
- if(isset($_POST['_agca_save_template'])){
114
- //print_r($_POST);
115
- $data = $_POST['templates_data'];
116
- $parts = explode("|||",$data);
117
-
118
- $common_data = $parts [0];
119
- $admin_js = $parts [1];
120
- $admin_css = $parts [2];
121
- $login_js = $parts [3];
122
- $login_css = $parts [4];
123
- $settings = $parts [5];
124
- $images = $parts [6];
125
-
126
- $template_name = $_POST['templates_name'];
127
-
128
- update_option('agca_selected_template', $template_name);
129
-
130
- $templates = get_option( 'agca_templates' );
131
- if($templates == ""){
132
- $templates = array();
133
- }
134
-
135
- $templates[$template_name] = array(
136
- 'common'=>$common_data,
137
- 'admin'=>"",
138
- 'adminjs'=>$admin_js,
139
- 'admincss'=>$admin_css,
140
- 'login'=>"",
141
- 'loginjs'=>$login_js,
142
- 'logincss'=>$login_css,
143
- 'images'=>$images,
144
- 'settings'=>$settings
145
- );
146
- update_option('agca_templates', $templates);
147
-
148
- $_POST = array();
149
-
150
- }else if(isset($_POST['_agca_templates_session'])){
151
- $this->agcaAdminSession();
152
- if($_POST['template'] !="")
153
- $_SESSION["AGCA"]["Templates"][$_POST['template']] = array("license"=>$_POST['license']);
154
-
155
- print_r($_SESSION);
156
- echo "_agca_templates_session:OK";
157
- exit;
158
- }else if(isset($_POST['_agca_templates_session_remove_license'])){
159
- $this->agcaAdminSession();
160
- if($_POST['template'] !="")
161
- $_SESSION["AGCA"]["Templates"][$_POST['template']] = null;
162
- print_r($_SESSION);
163
- echo "_agca_templates_session_remove_license:OK";
164
- exit;
165
- }else if(isset($_POST['_agca_get_templates'])){
166
- $templates = get_option( 'agca_templates' );
167
- if($templates == "") $templates = array();
168
- $results = array();
169
- foreach($templates as $key=>$val){
170
- $results[]=$key;
171
- }
172
- echo json_encode($results);
173
- exit;
174
- }else if(isset($_POST['_agca_activate_template'])){
175
- update_option('agca_selected_template', $_POST['_agca_activate_template']);
176
- $_POST = array();
177
- //unset($_POST);
178
- exit;
179
- }else if(isset($_POST['_agca_template_settings'])){
180
- $settings = $_POST['_agca_template_settings'];
181
-
182
- $templates = get_option( 'agca_templates' );
183
- if($templates == ""){
184
- $templates = array();
185
- }
186
- $template_name = $_POST["_agca_current_template"];
187
-
188
- $templates[$template_name]["settings"] = $settings;
189
- update_option('agca_templates', $templates);
190
-
191
- $_POST = array();
192
- //print_r($templates);
193
- exit;
194
- }else if(isset($_POST['_agca_upload_image'])){
195
- function my_sideload_image() {
196
- $remoteurl = $_POST['_agca_upload_image'];
197
- $file = media_sideload_image( $remoteurl, 0 ,"AG Custom Admin Template Image (do not delete)");
198
- $fileparts = explode("src='",$file);
199
- $url=explode("'",$fileparts[1]);
200
- echo $url[0];
201
- exit;
202
- }
203
- add_action( 'admin_init', 'my_sideload_image' );
204
-
205
- }else if(isset($_POST['_agca_remove_template_images'])){
206
- $this->delete_template_images($_POST['_agca_remove_template_images']);
207
- exit;
208
- }
209
- }
210
-
211
- function admin_bar_changes(){
212
- if( current_user_can( 'manage_options' )){
213
- global $wp_admin_bar;
214
- $wp_admin_bar->add_menu( array(
215
- 'id' => 'agca-admin-themes',
216
- 'title' => '<span class="ab-icon"></span>'.__( 'Admin Themes', 'agca-admin-themes' ),
217
- 'href' => 'tools.php?page=ag-custom-admin/plugin.php#ag-templates'
218
- ) );
219
- }
220
- }
221
-
222
- function delete_template_images_all(){
223
- $templates = get_option('agca_templates');
224
- if($templates != null && $templates != ""){
225
- foreach($templates as $template){
226
- if($template != null && $template['images'] != null && $template['images'] != ""){
227
- //print_r($template['images']);
228
- $imgs = explode(',',$template['images']);
229
- foreach($imgs as $imageSrc){
230
- $this->delete_attachment_by_src($imageSrc);
231
- }
232
- //print_r($imgs);
233
- }
234
- }
235
- }
236
- //print_r($templates);
237
- }
238
-
239
- function delete_template_images($template_name){
240
- $templates = get_option('agca_templates');
241
- if($templates != null && $templates != ""){
242
- $template = $templates[$template_name];
243
- if($template != null && $template['images'] != null && $template['images'] != ""){
244
- //print_r($template['images']); exit;
245
- $imgs = explode(',',$template['images']);
246
- foreach($imgs as $imageSrc){
247
- $this->delete_attachment_by_src($imageSrc);
248
- }
249
- //print_r($imgs);
250
- }
251
- }
252
- //print_r($templates);
253
- }
254
-
255
- function delete_attachment_by_src ($image_src) {
256
- global $wpdb;
257
- $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
258
- $id = $wpdb->get_var($query);
259
- wp_delete_attachment( $id, $true );
260
- }
261
-
262
- function get_installed_agca_templates(){
263
- $templates = get_option( 'agca_templates' );
264
- if($templates == "")return '[]';
265
- $results = array();
266
- foreach($templates as $key=>$val){
267
- $results[]=$key;
268
- }
269
- return json_encode($results);
270
- }
271
-
272
- function isGuest(){
273
- global $user_login;
274
- if($user_login) {
275
- return false;
276
- }else{
277
- return true;
278
- }
279
- }
280
- function check_active_plugin(){
281
-
282
- $ozh = false;
283
-
284
- if (is_plugin_active('ozh-admin-drop-down-menu/wp_ozh_adminmenu.php')) {
285
- $ozh = true;
286
- }
287
-
288
- $this->active_plugin = array(
289
- "ozh" => $ozh
290
- );
291
- }
292
- function change_title($admin_title, $title){
293
- //return get_bloginfo('name').' - '.$title;
294
- if(get_option('agca_custom_title')!=""){
295
- $blog = get_bloginfo('name');
296
- $page = $title;
297
- $customTitle = get_option('agca_custom_title');
298
- $customTitle = str_replace('%BLOG%',$blog,$customTitle);
299
- $customTitle = str_replace('%PAGE%',$page,$customTitle);
300
- return $customTitle;
301
- }else{
302
- return $admin_title;
303
- }
304
- }
305
- function agca_get_includes() {
306
- ?>
307
- <script type="text/javascript">
308
- <?php
309
- //AGCA GLOBALS
310
- echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';";
311
- ?>
312
- </script>
313
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/ag_style.css?ver=<?php echo $this->agca_version; ?>" />
314
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>require/dynamic.php?type=css&context=<?php echo $this->context; ?>&ver=<?php echo "changed_theme"; ?>" />
315
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
316
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>require/dynamic.php?type=js&context=<?php echo $this->context; ?>&ver=<?php echo "changed_theme"; ?>"></script>
317
-
318
- <?php
319
- if($this->context == "login"){
320
- ?>
321
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/login.min.css" />
322
- <?php
323
- }else{
324
- ?>
325
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/admin.min.css" />
326
- <?php
327
- }
328
- ?>
329
- <?php
330
- echo $this->templateCustomizations;
331
-
332
- if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
333
- ?>
334
- <style type="text/css">
335
- <?php
336
- echo get_option('agca_custom_css');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  ?>
338
- </style>
339
- <script type="text/javascript">
340
- try{
341
- eval("<?php echo str_replace(array("\r\n", "\n", "\r"), ' ', get_option('agca_custom_js')); ?>");
342
- }catch(e){
343
- alert('AG CUSTOM ADMIN : There is an error in your custom JS script. Please fix it: \n\n' + e + '\n\n (AG CUSTOM ADMIN -> Advanced -> Custom JavaScript)');
344
- console.log(e);
345
- }
346
- </script>
347
- <?php
348
- }
349
- }
350
-
351
- function agca_enqueue_scripts() {
352
- wp_enqueue_script('jquery');
353
- }
354
-
355
- function reloadScript(){
356
- $isAdmin = false;
357
- if(defined('WP_ADMIN') && WP_ADMIN == 1){
358
- $isAdmin = true;
359
- }
360
- if(in_array((isset($GLOBALS['pagenow'])?$GLOBALS['pagenow']:""), array('wp-login.php', 'wp-register.php')) || $isAdmin){
361
- add_action('init', array(&$this,'agca_enqueue_scripts'));
362
- }
363
- }
364
-
365
- function agca_register_settings() {
366
- register_setting( 'agca-options-group', 'agca_role_allbutadmin' );
367
- register_setting( 'agca-options-group', 'agca_screen_options_menu' );
368
- register_setting( 'agca-options-group', 'agca_help_menu' );
369
- register_setting( 'agca-options-group', 'agca_logout' );
370
- register_setting( 'agca-options-group', 'agca_remove_your_profile' );
371
- register_setting( 'agca-options-group', 'agca_logout_only' );
372
- register_setting( 'agca-options-group', 'agca_custom_title' );
373
- register_setting( 'agca-options-group', 'agca_howdy' );
374
- register_setting( 'agca-options-group', 'agca_header' );
375
- register_setting( 'agca-options-group', 'agca_header_show_logout' );
376
- register_setting( 'agca-options-group', 'agca_footer' );
377
- register_setting( 'agca-options-group', 'agca_privacy_options' );
378
- register_setting( 'agca-options-group', 'agca_header_logo' );
379
- register_setting( 'agca-options-group', 'agca_header_logo_custom' );
380
- register_setting( 'agca-options-group', 'agca_wp_logo_custom' );
381
- register_setting( 'agca-options-group', 'agca_remove_site_link' );
382
- register_setting( 'agca-options-group', 'agca_wp_logo_custom_link' );
383
-
384
- register_setting( 'agca-options-group', 'agca_site_heading' );
385
- register_setting( 'agca-options-group', 'agca_custom_site_heading' );
386
- register_setting( 'agca-options-group', 'agca_update_bar' );
387
-
388
- register_setting( 'agca-options-group', 'agca_footer_left' );
389
- register_setting( 'agca-options-group', 'agca_footer_left_hide' );
390
- register_setting( 'agca-options-group', 'agca_footer_right' );
391
- register_setting( 'agca-options-group', 'agca_footer_right_hide' );
392
-
393
- register_setting( 'agca-options-group', 'agca_login_banner' );
394
- register_setting( 'agca-options-group', 'agca_login_banner_text' );
395
- register_setting( 'agca-options-group', 'agca_login_photo_remove' );
396
- register_setting( 'agca-options-group', 'agca_login_photo_url' );
397
- register_setting( 'agca-options-group', 'agca_login_photo_href' );
398
- register_setting( 'agca-options-group', 'agca_login_round_box' );
399
- register_setting( 'agca-options-group', 'agca_login_round_box_size' );
400
-
401
- register_setting( 'agca-options-group', 'agca_dashboard_icon' );
402
- register_setting( 'agca-options-group', 'agca_dashboard_text' );
403
- register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
404
- register_setting( 'agca-options-group', 'agca_dashboard_widget_welcome' );
405
- register_setting( 'agca-options-group', 'agca_dashboard_widget_activity' );
406
- register_setting( 'agca-options-group', 'agca_dashboard_widget_il' );
407
- register_setting( 'agca-options-group', 'agca_dashboard_widget_plugins' );
408
- register_setting( 'agca-options-group', 'agca_dashboard_widget_qp' );
409
- register_setting( 'agca-options-group', 'agca_dashboard_widget_rn' );
410
- register_setting( 'agca-options-group', 'agca_dashboard_widget_rd' );
411
- register_setting( 'agca-options-group', 'agca_dashboard_widget_primary' );
412
- register_setting( 'agca-options-group', 'agca_dashboard_widget_secondary' );
413
-
414
- //WP3.3
415
- register_setting( 'agca-options-group', 'agca_admin_bar_comments' );
416
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content' );
417
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_post' );
418
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_link' );
419
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_page' );
420
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_user' );
421
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_media' );
422
- register_setting( 'agca-options-group', 'agca_admin_bar_update_notifications' );
423
- register_setting( 'agca-options-group', 'agca_admin_bar_admin_themes' );
424
- register_setting( 'agca-options-group', 'agca_remove_top_bar_dropdowns' );
425
- register_setting( 'agca-options-group', 'agca_admin_bar_frontend' );
426
- register_setting( 'agca-options-group', 'agca_admin_bar_frontend_hide' );
427
- register_setting( 'agca-options-group', 'agca_login_register_remove' );
428
- register_setting( 'agca-options-group', 'agca_login_register_href' );
429
- register_setting( 'agca-options-group', 'agca_login_lostpassword_remove' );
430
- register_setting( 'agca-options-group', 'agca_admin_capability' );
431
- register_setting( 'agca-options-group', 'agca_disablewarning' );
432
- register_setting( 'agca-template-group', 'agca_selected_template' );
433
- register_setting( 'agca-template-group', 'agca_templates' );
434
- //delete_option( 'agca_templates' );
435
-
436
-
437
- /*Admin menu*/
438
- register_setting( 'agca-options-group', 'agca_admin_menu_turnonoff' );
439
- register_setting( 'agca-options-group', 'agca_admin_menu_agca_button_only' );
440
- register_setting( 'agca-options-group', 'agca_admin_menu_separators' );
441
- register_setting( 'agca-options-group', 'agca_admin_menu_icons' );
442
- register_setting( 'agca-options-group', 'agca_admin_menu_collapse_button' );
443
- register_setting( 'agca-options-group', 'agca_admin_menu_arrow' );
444
- register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round' );
445
- register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round_size' );
446
- register_setting( 'agca-options-group', 'agca_admin_menu_brand' );
447
- register_setting( 'agca-options-group', 'agca_admin_menu_brand_link' );
448
- register_setting( 'agca-options-group', 'agca_admin_menu_autofold' );
449
- register_setting( 'agca-options-group', 'ag_edit_adminmenu_json' );
450
- register_setting( 'agca-options-group', 'ag_edit_adminmenu_json_new' );
451
- register_setting( 'agca-options-group', 'ag_add_adminmenu_json' );
452
- register_setting( 'agca-options-group', 'ag_colorizer_json' );
453
- register_setting( 'agca-options-group', 'agca_colorizer_turnonoff' );
454
-
455
- register_setting( 'agca-options-group', 'agca_custom_js' );
456
- register_setting( 'agca-options-group', 'agca_custom_css' );
457
-
458
-
459
- if(!empty($_POST)){
460
- // fb($_POST);
461
- if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=="true"){
462
- if(isset($_FILES) && isset($_FILES['settings_import_file']) ){
463
- if($_FILES["settings_import_file"]["error"] > 0){
464
- }else{
465
- $file = $_FILES['settings_import_file'];
466
- if($this->startsWith($file['name'],'AGCA_Settings')){
467
- if (file_exists($file['tmp_name'])) {
468
- $fh = fopen($file['tmp_name'], 'r');
469
- $theData = "";
470
- if(filesize($file['tmp_name']) > 0){
471
- $theData = fread($fh,filesize($file['tmp_name']));
472
- }
473
- fclose($fh);
474
- $this->importSettings($theData);
475
- }
476
- }
477
- }
478
  }
479
- }else if(isset($_POST['_agca_export_settings']) && $_POST['_agca_export_settings']=="true"){
480
- $this->exportSettings();
481
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  }
483
-
484
- if(isset($_GET['agca_action'])){
485
- if($_GET['agca_action'] == "disablewarning"){
486
- update_option('agca_disablewarning', true);
487
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  }
489
- }
490
-
491
- function agca_deactivate() {
492
-
493
- }
494
-
495
- function getOptions(){
496
- return Array(
497
- 'agca_role_allbutadmin',
498
- 'agca_admin_bar_frontend',
499
- 'agca_admin_bar_frontend_hide',
500
- 'agca_login_register_remove',
501
- 'agca_login_register_href',
502
- 'agca_login_lostpassword_remove',
503
- 'agca_admin_capability',
504
- 'agca_screen_options_menu',
505
- 'agca_help_menu',
506
- 'agca_logout',
507
- 'agca_remove_your_profile',
508
- 'agca_logout_only',
509
- 'agca_custom_title',
510
- 'agca_howdy',
511
- 'agca_header',
512
- 'agca_header_show_logout',
513
- 'agca_footer',
514
- 'agca_privacy_options',
515
- 'agca_header_logo',
516
- 'agca_header_logo_custom',
517
- 'agca_remove_site_link',
518
- 'agca_wp_logo_custom',
519
- 'agca_wp_logo_custom_link',
520
- 'agca_site_heading',
521
- 'agca_custom_site_heading',
522
- 'agca_update_bar',
523
- 'agca_footer_left',
524
- 'agca_footer_left_hide',
525
- 'agca_footer_right',
526
- 'agca_footer_right_hide',
527
- 'agca_login_banner',
528
- 'agca_login_banner_text',
529
- 'agca_login_photo_remove',
530
- 'agca_login_photo_url',
531
- 'agca_login_photo_href',
532
- 'agca_login_round_box',
533
- 'agca_login_round_box_size',
534
- 'agca_dashboard_icon',
535
- 'agca_dashboard_text',
536
- 'agca_dashboard_text_paragraph',
537
- 'agca_dashboard_widget_welcome',
538
- 'agca_dashboard_widget_activity',
539
- 'agca_dashboard_widget_il',
540
- 'agca_dashboard_widget_plugins',
541
- 'agca_dashboard_widget_qp',
542
- 'agca_dashboard_widget_rn',
543
- 'agca_dashboard_widget_rd',
544
- 'agca_dashboard_widget_primary',
545
- 'agca_dashboard_widget_secondary',
546
- 'agca_admin_bar_comments',
547
- 'agca_admin_bar_new_content',
548
- 'agca_admin_bar_new_content_post',
549
- 'agca_admin_bar_new_content_link',
550
- 'agca_admin_bar_new_content_page',
551
- 'agca_admin_bar_new_content_user',
552
- 'agca_admin_bar_new_content_media',
553
- 'agca_admin_bar_update_notifications',
554
- 'agca_admin_bar_admin_themes',
555
- 'agca_remove_top_bar_dropdowns',
556
- 'agca_admin_menu_turnonoff',
557
- 'agca_admin_menu_agca_button_only',
558
- 'agca_admin_menu_separators',
559
- 'agca_admin_menu_icons',
560
- 'agca_admin_menu_arrow',
561
- 'agca_admin_menu_submenu_round',
562
- 'agca_admin_menu_submenu_round_size',
563
- 'agca_admin_menu_brand',
564
- 'agca_admin_menu_brand_link',
565
- 'agca_admin_menu_autofold',
566
- 'agca_admin_menu_collapse_button',
567
- 'ag_edit_adminmenu_json',
568
- 'ag_edit_adminmenu_json_new',
569
- 'ag_add_adminmenu_json',
570
- 'ag_colorizer_json',
571
- 'agca_colorizer_turnonof',
572
- 'agca_custom_js',
573
- 'agca_custom_css',
574
- 'agca_colorizer_turnonoff',
575
- 'agca_disablewarning',
576
- 'agca_selected_template',
577
- 'agca_templates',
578
- );
579
- }
580
-
581
- function getTextEditor($name){
582
- $settings = array(
583
- 'textarea_name' => $name,
584
- 'media_buttons' => true,
585
- 'tinymce' => array(
586
- 'theme_advanced_buttons1' => 'formatselect,|,bold,italic,underline,|,' .
587
- 'bullist,blockquote,|,justifyleft,justifycenter' .
588
- ',justifyright,justifyfull,|,link,unlink,|' .
589
- ',spellchecker,wp_fullscreen,wp_adv'
590
- )
591
- );
592
- wp_editor( get_option($name), $name, $settings );
593
- }
594
-
595
- function importSettings($settings){
596
- $exploaded = explode("|^|^|", $settings);
597
- // $str = "EEE: ";
598
-
599
- $savedOptions = array();
600
-
601
- foreach ($exploaded as $setting){
602
-
603
- $key = current(explode(':', $setting));
604
- $value = substr($setting, strlen($key)+1);
605
- $cleanedValue = str_replace('|^|^|','',$value);
606
- $savedOptions[$key] = $cleanedValue;
607
- }
608
-
609
- // print_r($savedOptions);
610
-
611
- $optionNames = $this->getOptions();
612
-
613
- foreach ($optionNames as $optionName){
614
- $optionValue = "";
615
- $optionValue = $savedOptions[$optionName];
616
-
617
- if($optionName == "ag_edit_adminmenu_json" || "ag_edit_adminmenu_json_new"|| $optionName == "ag_add_adminmenu_json" ||$optionName == "ag_colorizer_json"){
618
- $optionValue = str_replace("\\\"", "\"", $optionValue);
619
- $optionValue = str_replace("\\\'", "\'", $optionValue);
620
- }else if($optionName == "agca_custom_js" || $optionName == "agca_custom_css"){
621
- //fb($optionValue);
622
- $optionValue = htmlspecialchars_decode($optionValue);
623
- $optionValue = str_replace("\'", '"', $optionValue);
624
- $optionValue = str_replace('\"', "'", $optionValue);
625
- //fb($optionValue);
626
- }else{
627
-
628
- }
629
- update_option($optionName, $optionValue);
630
- $str.="/".$optionName."/".$optionValue."\n";
631
- }
632
-
633
- //Migration from 1.2.6. to 1.2.5.1 - remove in later versions
634
- //agca_script_css
635
- //
636
- // fb($savedOptions);
637
- if($savedOptions['agca_script_css'] != null){
638
- $optionValue = "";
639
- $optionValue = str_replace("\'", '"', $savedOptions['agca_script_css']);
640
- $optionValue = str_replace('\"', "'", $optionValue);
641
- update_option('agca_custom_css', $optionValue);
642
- }
643
- if($savedOptions['agca_script_js'] != null){
644
- $optionValue = "";
645
- $optionValue = str_replace("\'", '"', $savedOptions['agca_script_js']);
646
- $optionValue = str_replace('\"', "'", $optionValue);
647
- update_option('agca_custom_js', $optionValue);
648
- }
649
-
650
- //echo $str;
651
-
652
- //save imported settings
653
- $this->saveAfterImport = true;
654
- }
655
-
656
- function exportSettings(){
657
- $str = "";
658
-
659
- $include_menu_settings = false;
660
- if(isset($_POST['export_settings_include_admin_menu'])){
661
- if($_POST['export_settings_include_admin_menu'] == 'on'){
662
- $include_menu_settings = true;
663
  }
664
  }
 
 
 
 
665
 
666
- foreach ($_POST as $key => $value) {
667
- if ($this->startsWith($key,'ag')||$this->startsWith($key,'color')) {
668
- if($this->startsWith($key,'ag_edit_adminmenu')){
669
- if($include_menu_settings) $str .=$key. ":".$value."|^|^|";
670
- }else{
671
- $str .=$key. ":".$value."|^|^|";
672
  }
673
- }
 
 
 
 
 
674
  }
675
-
676
- $filename = 'AGCA_Settings_'.date("Y-M-d_H-i-s").'.agca';
677
- header("Cache-Control: public");
678
- header("Content-Description: File Transfer");
679
- header("Content-Disposition: attachment; filename=$filename");
680
- header("Content-Type: text/plain; ");
681
- header("Content-Transfer-Encoding: binary");
682
- echo $str;
683
- die();
684
- }
685
-
686
- function startsWith($haystack, $needle)
687
- {
688
- $length = strlen($needle);
689
- return (substr($haystack, 0, $length) === $needle);
690
- }
691
-
692
-
693
-
694
- function agca_create_menu() {
695
- add_management_page( 'AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this,'agca_admin_page') );
696
- }
697
-
698
- function agca_create_admin_button($name,$arr) {
699
-
700
- $href = $arr["value"];
701
- $target =$arr["target"];
702
- $button ="<li class=\"wp-not-current-submenu menu-top menu-top-last\" id=\"menu-$name\"><a href=\"$href\" target=\"$target\" class=\"wp-not-current-submenu menu-top\"><div class=\"wp-menu-arrow\"><div></div></div><div class=\"wp-menu-image dashicons-before dashicons-admin-$name\"><br></div><div class=\"wp-menu-name\">$name</div></a></li>";
703
-
704
- return $button;
705
- }
706
- function agca_decode($code){
707
- $code = str_replace("{","",$code);
708
- $code = str_replace("}","",$code);
709
- $code = str_replace("\", \"","\"|||\"",$code);
710
- $elements = explode("|||",$code);
711
-
712
- return $elements;
713
- }
714
-
715
- function jsonMenuArray($json,$type){
716
- $arr = explode("|",$json);
717
- $elements = "";
718
- $array ="";
719
- $first = true;
720
- //print_r($json);
721
- if($type == "colorizer"){
722
- $elements = json_decode($arr[0],true);
723
- if($elements !=""){
724
- return $elements;
725
- }
726
- }else if($type == "buttons"){
727
- $elements = json_decode($arr[0],true);
728
- if($elements !=""){
729
- foreach($elements as $k => $v){
730
- $array.=$this->agca_create_admin_button($k,$v);
731
- }
732
- }
733
- }else if($type == "buttonsJq"){
734
- $elements = json_decode($arr[0],true);
735
- if($elements !=""){
736
- foreach($elements as $k => $v){
737
- $array.='<tr><td colspan="2"><button target="'.$v['target'].'" title="'.$v['value'].'" type="button">'.$k.'</button>&nbsp;<a style="cursor:pointer;" title="Edit" class="button_edit"><span class="dashicons dashicons-edit"></span></a>&nbsp;<a style="cursor:pointer" title="Delete" class="button_remove"><span class="dashicons dashicons-no"></span></a></td><td></td></tr>';
738
- }
739
- }
740
- }else{
741
- if(isset($arr[$type])){
742
- $elements = $this->agca_decode($arr[$type]);
743
- }
744
-
745
- if($elements !=""){
746
- foreach($elements as $element){
747
- if(!$first){
748
- $array .=",";
749
- }
750
- $parts = explode(" : ",$element);
751
- if(isset($parts[0]) && isset($parts[1])){
752
- $array.="[".$parts[0].", ".$parts[1]."]";
753
- }
754
- $first=false;
755
- }
756
- }
757
- }
758
-
759
- return $array;
760
- }
761
-
762
- function remove_dashboard_widget($widget,$side)
763
- {
764
- //side can be 'normal' or 'side'
765
- global $wp_meta_boxes;
766
- remove_meta_box($widget, 'dashboard', $side);
767
- }
768
-
769
- function get_wp_version(){
770
- global $wp_version;
771
- $array = explode('-', $wp_version);
772
- $version = $array[0];
773
- return $version;
774
- }
775
-
776
- function print_page()
777
- {
778
- if($this->isGuest() && get_option('agca_admin_bar_frontend_hide')){
779
- return false;
780
- }
781
-
782
- if(get_option('agca_admin_bar_frontend_hide')==true){
783
- add_filter( 'show_admin_bar', '__return_false' );
784
- ?>
785
- <style type="text/css">
786
- #wpadminbar{
787
- display: none;
788
- }
789
- </style>
790
- <script type="text/javascript">
791
- window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
792
- </script>
793
- <?php
794
- }
795
- if(get_option('agca_admin_bar_frontend')!=true){
796
-
797
  $this->context = "page";
798
  $wpversion = $this->get_wp_version();
799
 
800
- ?>
801
-
802
-
803
- <script type="text/javascript">
804
- var wpversion = "<?php echo $wpversion; ?>";
805
- var agca_version = "<?php echo $this->agca_version; ?>";
806
- var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
807
- var jQueryScriptOutputted = false;
808
- var agca_context = "page";
809
- var agca_orig_admin_menu = [];
810
- function initJQuery() {
811
- //if the jQuery object isn't available
812
- if (typeof(jQuery) == 'undefined') {
813
- if (! jQueryScriptOutputted) {
814
- //only output the script once..
815
- jQueryScriptOutputted = true;
816
- //output the script (load it from google api)
817
- document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></scr" + "ipt>");
818
- }
819
- setTimeout("initJQuery()", 50);
820
- } else {
821
- jQuery(function() {
822
- try
823
- {
824
- <?php if(get_option('agca_header')!=true){ ?>
825
- jQuery('#wpadminbar').show();
826
- <?php } ?>
827
-
828
- <?php $this->print_admin_bar_scripts(); ?>
829
- }catch(ex){}
830
- });
831
  }
 
 
 
 
 
 
 
 
 
 
 
 
832
  }
833
- initJQuery();
834
- </script>
835
- <script type="text/javascript">
836
- <?php echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';"; ?>
837
- </script>
838
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
839
- <script type="text/javascript">
840
- jQuery(document).ready(function(){
841
- <?php if(get_option('agca_colorizer_turnonoff') == 'on' && (get_option('agca_admin_bar_frontend_hide')!=true)){
842
- foreach($this->colorizer as $k => $v){
843
- if(($k !="") and ($v !="")){
844
- if(
845
- $k == "color_header" ||
846
- $k == "color_font_header"
847
- ){
848
- ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
849
- }
850
-
851
- }
852
- }
853
- ?>
854
-
855
- <?php
856
- }
857
- ?>
858
- });
859
- </script>
860
  <?php
861
- }
862
-
863
- }
864
-
865
- function print_admin_bar_scripts(){
866
- ?>
867
- <?php if(get_option('agca_remove_top_bar_dropdowns')==true){ ?>
868
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-sub-wrapper").hide();
869
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-site-name .ab-sub-wrapper").hide();
870
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item").attr('title','');
871
-
872
- <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
873
- jQuery(".new_content_header_submenu").hide();
874
- <?php } ?>
875
-
876
- <?php } ?>
877
-
878
- <?php if(get_option('agca_admin_bar_comments')!=""){ ?>
879
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-comments").css("display","none");
880
- <?php } ?>
881
- <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
882
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content").css("display","none");
883
- <?php } ?>
884
- <?php if(get_option('agca_admin_bar_new_content_post')!=""){ ?>
885
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-post").css("display","none");
886
- <?php } ?>
887
- <?php if(get_option('agca_admin_bar_new_content_link')!=""){ ?>
888
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-link").css("display","none");
889
- <?php } ?>
890
- <?php if(get_option('agca_admin_bar_new_content_page')!=""){ ?>
891
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-page").css("display","none");
892
- <?php } ?>
893
- <?php if(get_option('agca_admin_bar_new_content_user')!=""){ ?>
894
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-user").css("display","none");
895
- <?php } ?>
896
- <?php if(get_option('agca_admin_bar_new_content_media')!=""){ ?>
897
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-media").css("display","none");
898
- <?php } ?>
899
- <?php if(get_option('agca_admin_bar_update_notifications')!=""){ ?>
900
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-updates").css("display","none");
901
- <?php } ?>
902
- <?php if(get_option('agca_admin_bar_admin_themes')!=""){ ?>
903
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-agca-admin-themes").css("display","none");
904
- <?php } ?>
905
-
906
-
907
-
908
- <?php if(get_option('agca_header_logo')==true){ ?>
909
- jQuery("#wphead #header-logo").css("display","none");
910
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-wp-logo").css("display","none");
911
-
912
- <?php } ?>
913
- <?php if(get_option('agca_header_logo_custom')!=""){ ?>
914
-
915
- var img_url = '<?php echo addslashes(get_option('agca_header_logo_custom')); ?>';
916
-
917
- advanced_url = img_url;
918
- image = jQuery("<img />").attr("src",advanced_url);
919
- jQuery(image).load(function() {
920
- jQuery("#wpbody-content").prepend(image);
921
- });
922
-
923
- <?php } ?>
924
- <?php if(get_option('agca_wp_logo_custom')!=""){ ?>
925
- jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").html("<img style=\"height:28px;margin-top:-4px\" src=\"<?php echo get_option('agca_wp_logo_custom'); ?>\" />");
926
- jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('background-image','none');
927
- jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('width','auto');
928
- jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',"<?php echo get_bloginfo('wpurl'); ?>");
929
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item:before").attr('title','');
930
- jQuery('body #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon').attr('class','ab-icon2');
931
- <?php }?>
932
- <?php if(get_option('agca_remove_site_link')==true){ ?>
933
- jQuery("#wp-admin-bar-site-name").css("display","none");
934
-
935
- <?php } ?>
936
- <?php if(get_option('agca_wp_logo_custom_link')!=""){ ?>
937
- var href = "<?php echo get_option('agca_wp_logo_custom_link'); ?>";
938
- href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
939
- if(href == "%SWITCH%"){
940
- href = "<?php echo get_bloginfo('wpurl'); ?>";
941
- <?php if($this->context == "page"){
942
- ?>href+="/wp-admin";<?php
943
- }
944
- ?>
945
- }
946
- jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',href);
947
-
948
- <?php }?>
949
- <?php if(get_option('agca_site_heading')==true){ ?>
950
- jQuery("#wphead #site-heading").css("display","none");
951
- <?php } ?>
952
- <?php if(get_option('agca_custom_site_heading')!=""){ ?>
953
- jQuery("#wphead #site-heading").after('<h1><?php echo addslashes(get_option('agca_custom_site_heading')); ?></h1>');
954
- jQuery("#wp-admin-bar-site-name a:first").html('<?php echo addslashes(get_option('agca_custom_site_heading')); ?>');
955
-
956
- <?php } ?>
957
- <?php if(get_option('agca_header')==true && $this->context =='admin'){
958
- ?>
959
- jQuery("#wpadminbar").css("display","none");
960
- jQuery("body.admin-bar").css("padding-top","0");
961
- jQuery("#wphead").css("display","none");
962
- jQuery('html.wp-toolbar').css("padding-top","0");
963
-
964
- <?php } ?>
965
- <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
966
- <?php
967
- $agca_logout_text = ((get_option('agca_logout')=="")?"Log Out":get_option('agca_logout'));
968
- ?>
969
- jQuery("#wpbody-content").prepend('<a href="../wp-login.php?action=logout" tabindex="10" style="float:right;margin-right:20px" class="ab-item agca_logout_button"><?php echo $agca_logout_text; ?></a>');
970
-
971
-
972
- <?php } ?>
973
- <?php if(get_option('agca_howdy')!=""){ ?>
974
- var alltext="";
975
- alltext="";
976
- jQuery('li#wp-admin-bar-my-account').css('cursor','default');
977
- alltext = jQuery('li#wp-admin-bar-my-account').html();
978
- if(alltext!=null){
979
- var parts = alltext.split(',');
980
- alltext = "<?php echo get_option('agca_howdy'); ?>" + ", " + parts[1];
981
- }
982
- jQuery("li#wp-admin-bar-my-account").html("<a href=\"#\" class=\"ab-item\">"+alltext+"</a>");
983
-
984
- <?php } ?>
985
- <?php
986
- if(get_option('agca_custom_title')!=""){
987
- //add_filter('admin_title', '$this->change_title', 10, 2);
988
-
989
- }
990
- ?>
991
- <?php if(get_option('agca_logout')!=""){ ?>
992
- jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-logout a").text("<?php echo get_option('agca_logout'); ?>");
993
- <?php } ?>
994
- <?php if(get_option('agca_remove_your_profile')==true){ ?>
995
- jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("visibility","hidden");
996
- jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("height","10px");
997
- jQuery('#wpadminbar #wp-admin-bar-top-secondary > #wp-admin-bar-my-account > a').attr('href','#');
998
- jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-user-info > a').attr('href','#');
999
- jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-edit-profile > a').attr('href','#');
1000
- <?php } ?>
1001
- <?php if(get_option('agca_logout_only')==true){ ?>
1002
- var logout_content = jQuery("li#wp-admin-bar-logout").html();
1003
- jQuery("ul#wp-admin-bar-top-secondary").html('<li id="wp-admin-bar-logout">'+ logout_content +'</li>');
1004
-
1005
- <?php } ?>
1006
-
1007
- <?php
1008
-
1009
-
1010
- }
1011
-
1012
- function updateAllColors(){
1013
-
1014
- ?>
1015
- function updateAllColors(){
1016
- <?php
1017
- foreach($this->colorizer as $k => $v){
1018
- if(($k !="") and ($v !="")){
1019
- ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
1020
- }
1021
- }
1022
- ?>
1023
- jQuery('.color_picker').each(function(){
1024
- updateColor(jQuery(this).attr('id'),jQuery(this).val())
1025
- });
1026
- jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1027
- jQuery('#adminmenu li.wp-menu-open').css('border','none');
1028
- jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
1029
- }<?php
1030
-
1031
- }
1032
- function admin_capabilities(){
1033
- global $wp_roles;
1034
- $capabs = $wp_roles->roles['administrator']['capabilities'];
1035
- $capabilitySelector = "";
1036
-
1037
- $selectedValue = get_option('agca_admin_capability');
1038
- if($selectedValue == ""){
1039
- $selectedValue = "edit_dashboard";
1040
- }
1041
- /*echo $selectedValue;
 
 
 
 
 
 
 
 
 
 
 
 
 
1042
  die;*/
1043
- ksort($capabs);
1044
- foreach($capabs as $k=>$v){
1045
- $selected = "";
1046
- if($this->startsWith($k, 'level_')) continue;
1047
- if($selectedValue == $k){
1048
- $selected = " selected=\"selected\" ";
1049
- }
1050
- //TODO:Find out why this does not work
1051
- //$capabilitySelector .="<option val=\"$k\" $selected >".str_replace(' ', ' ', ucwords(str_replace('_', ' ', $k))) ."</option>\n";
1052
- $capabilitySelector .="<option val=\"$k\" $selected >".$k."</option>\n";
1053
- }
1054
-
1055
- $this->admin_capabilities = "<select class=\"agca-selectbox\" id=\"agca_admin_capability\" name=\"agca_admin_capability\" val=\"upload_files\">".$capabilitySelector."</select>";
1056
- }
1057
-
1058
- function admin_capability(){
1059
- $selectedValue = get_option('agca_admin_capability');
1060
- if($selectedValue == ""){
1061
- $selectedValue = "edit_dashboard";
1062
- }
1063
- return $selectedValue;
1064
- }
1065
-
1066
- function JSPrintAGCATemplateSettingsVar($settings){
1067
- echo "\n<script type=\"text/javascript\">\n";
1068
- echo "var agca_template_settings = ".preg_replace('#<script(.*?)>(.*?)</script>#is', '', $settings).";\n"; //TODO: think about this
1069
- echo "</script>";
1070
- }
1071
-
1072
- function appendSettingsToAGCATemplateCustomizations($customizations, $settings){
1073
- $template_settings = json_decode($settings);
1074
- //print_r($template_settings);
1075
- foreach($template_settings as $sett){
1076
- $key = $sett->code;
1077
-
1078
- //use default value if user's value is not set
1079
- $value="";
1080
- if($sett->value != ""){
1081
- $value = $sett->value;
1082
- }else{
1083
- $value = $sett->default_value;
1084
- }
1085
-
1086
- //Prepare settings
1087
- if($sett->type == 6){
1088
- if($value !== null && (strtolower($value) == "on" || $value == "1")){
1089
- $value = "true";
1090
- }else{
1091
- $value = "false";
1092
- }
1093
- }
1094
- $customizations = str_replace("%".$key."%",$value, $customizations);
1095
- }
1096
- return $customizations;
1097
- }
1098
-
1099
- function enableSpecificWPVersionCustomizations($customizations){
1100
- /*enable special CSS for this WP version*/
1101
- $ver = $this->get_wp_version();
1102
- $customizations = str_replace("/*".$ver," ", $customizations);
1103
- $customizations = str_replace($ver."*/"," ", $customizations);
1104
- return $customizations;
1105
- }
1106
-
1107
- function removeCSSComments($customizations){
1108
- $customizations = preg_replace('#/\*.*?\*/#si','',$customizations);
1109
- return $customizations;
1110
- }
1111
-
1112
- function prepareAGCAAdminTemplates(){
1113
- if(get_option( 'agca_templates' ) != ""){
1114
- //print_r(get_option( 'agca_templates' ));
1115
- $themes = get_option( 'agca_templates' );
1116
- $selectedTheme = get_option('agca_selected_template');
1117
- if(isset($themes[$selectedTheme])){
1118
- $theme = $themes[$selectedTheme];
1119
- add_filter('get_user_option_admin_color', array(&$this,'change_admin_color'));
1120
-
1121
- echo (stripslashes($theme['common']));
1122
- echo "<!--AGCAIMAGES: ".$theme['images']."-->";
1123
-
1124
- //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1125
- if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
1126
- if($theme['settings'] == "" || $theme['settings'] == " ") $theme['settings'] = "{}";
1127
- //print_r($templdata);
1128
-
1129
- $this->JSPrintAGCATemplateSettingsVar($theme['settings']);
1130
-
1131
- $admindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($theme['admin']), $theme['settings']);
1132
- $admindata = $this->enableSpecificWPVersionCustomizations($admindata);
1133
- $admindata = $this->removeCSSComments($admindata);
1134
-
1135
- //echo $admindata;
1136
- //REPLACE TAGS WITH CUSTOM TEMPLATE SETTINGS
1137
- $this->templateCustomizations = $admindata;
1138
- }
1139
- //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1140
- }
1141
- }
1142
- }
1143
-
1144
- function agcaAdminSession(){
1145
- $agcaTemplatesSession = array();
1146
-
1147
- //session_destroy();
1148
- //session_unset();
1149
-
1150
- /*if(!session_id()){
1151
- session_start();
 
 
 
 
 
 
 
1152
  }*/
1153
-
1154
- if(!isset($_SESSION["AGCA"])){
1155
- $_SESSION["AGCA"] = array();
1156
- $_SESSION["AGCA"]["Templates"] = array();
1157
- }
1158
- //print_r($_SESSION);
1159
-
1160
- if(isset($_SESSION["AGCA"])){
1161
- if(isset($_SESSION["AGCA"]["Templates"])){
1162
- //print_r($_SESSION["AGCA"]["Templates"]);
1163
- $agcaTemplatesSession = json_encode($_SESSION["AGCA"]["Templates"]);
1164
- }
1165
- }
1166
-
1167
-
1168
- if($agcaTemplatesSession == '""' || $agcaTemplatesSession == '"[]"'){
1169
- $agcaTemplatesSession = array();
1170
- }
1171
-
1172
-
1173
- return $agcaTemplatesSession;
1174
-
1175
- }
1176
-
1177
- function getAGCAColor($name){
1178
- if(isset($this->colorizer[$name])){
1179
- echo htmlspecialchars($this->colorizer[$name]);
1180
- }
1181
- }
1182
-
1183
- function prepareAGCALoginTemplates(){
1184
- if(get_option( 'agca_templates' ) != ""){
1185
- //print_r(get_option( 'agca_templates' ));
1186
- $templates = get_option( 'agca_templates' );
1187
- foreach($templates as $templname=>$templdata){
1188
- if($templname == get_option('agca_selected_template')){
1189
- echo (stripslashes($templdata['common']));
1190
-
1191
- if($templdata['settings'] == "" || $templdata['settings'] == " ") $templdata['settings'] = "{}";
1192
- $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1193
-
1194
- $logindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($templdata['login']), $templdata['settings']);
1195
- $logindata = $this->enableSpecificWPVersionCustomizations($logindata);
1196
- $logindata = $this->removeCSSComments($logindata);
1197
-
1198
- echo($logindata);
1199
- break;
1200
- }
1201
- }
1202
- }
1203
- }
1204
-
1205
- function agca_error_check(){
1206
- ?>
1207
- <script type="text/javascript">
1208
- function AGCAErrorPage(msg, url, line){
1209
- var agca_error_details = "___________________________________________________<br/>";
1210
- agca_error_details += '<br/>' + msg +'<br/>source:' + url + '<br/>line:' + line + '<br/>';
1211
- agca_error_details += "___________________________________________________<br/>";
1212
- window.agca_error_details_text = agca_error_details + '<br/>This JavaScript error could stop AG Custom Admin plugin to work properly. If everything still works, you can ignore this notification. <br/><br/>Possible solutions:<br/><br/>1) Make sure to have everything up to date: WordPress site, plugins and themes.<br/><br/>2) Try disabling plugins one by one to see if problem can be resolved this way. If so, one of disabled plugins caused this error.<br/><br/>3) Check "source" path of this error. This could be indicator of the plugin/theme that caused the error.<br/><br/>4) If it\'s obvious that error is thrown from a particular plugin/theme, please report this error to their support. <br/><br/>5) Try activating default WordPress theme instead of your current theme.<br/><br/>6) Advanced: Try fixing this issue manually: Navigate to the link above in your browser and open the source of the page (right click -> view page source) and find the line in code where it fails. You should access this file via FTP and try to fix this error on that line.<br/><br/>7) Contact us if nothing above helps. Please do not post errors that are caused by other plugins/themes to our support page. Contact their support instead. If you think that error is somehow related to AG Custom Admin plugin, or something unexpected happens, please report that on our <a href="http://wordpressadminpanel.com/agca-support/ag_custom_admin/error-ocurred-javascript-error-caught/" target="_blank">SUPPORT PAGE</a>';
1213
- document.getElementsByTagName('html')[0].style.visibility = "visible";
1214
- var errorDivHtml = '<div style="background: #f08080;border-radius: 3px;color: #ffffff;height: auto; margin-right: 13px;padding: 6px 14px;width: 450px;z-index: 99999; position:absolute;">\
1215
- AG Custom Admin caught an error on your site!&nbsp;<a target="_blank" href="#" onclick="var aedt = document.getElementById(\'agca_error_details_text\'); if(aedt.style.display !== \'block\') {aedt.style.display = \'block\';} else{aedt.style.display = \'none\';} return false;" style="color: #ffffff !important;float:right;font-weight: bold;text-decoration: none;">(show/hide more...)</a><div id="agca_error_details_text" style="display:none;margin: 10px 0;background:#ffffff;border-radius: 5px;padding:8px;color: #777;">'+agca_error_details_text+'</div></div>';
1216
-
1217
- var ph = document.getElementById('agca_error_placeholder');
1218
- ph.innerHTML = errorDivHtml;
1219
- document.getElementById('agca_news').style.visibility = "hidden";
1220
- }
1221
- window.onerror = function(msg, url, line) {
1222
- window.onload = function() {
1223
- AGCAErrorPage(msg, url, line);
1224
- }
1225
- return true;
1226
- };
1227
- </script>
1228
- <?php
1229
  }
1230
- function error_check(){
1231
- ?>
1232
- <script type="text/javascript">
1233
- function AGCAErrorOtherPages(msg, url, line){
1234
- var agca_error_details = "___________________________________________________\n";
1235
- agca_error_details += '\n' + msg +'\nsource:' + url + '\nline:' + line + '\n';
1236
-
1237
- document.getElementsByTagName('html')[0].style.visibility = "visible";
1238
-
1239
- if(typeof window.console === "object"){
1240
- console.log("___________________________________________________");
1241
- console.log("AG Custom Admin caught a JavaScript on your site:");
1242
- console.log(agca_error_details);
1243
- }
1244
- }
1245
- window.onerror = function(msg, url, line) {
1246
- window.onload = function() {
1247
- AGCAErrorOtherPages(msg, url, line);
1248
- }
1249
- return true;
1250
- };
1251
- </script>
1252
- <?php
1253
  }
1254
 
1255
- function menu_item_cleartext($name){
1256
- if(strpos($name,' <span') !== false){
1257
- $parts = explode(' <span', $name);
1258
- $name = $parts[0];
1259
- }
1260
- $name = trim($name);
1261
- return $name;
1262
- }
1263
-
1264
- /**
1265
- * Loops through all original menu items, and creates customizations array
1266
- * applies previous customizations if set
1267
- * @return array|mixed|object
1268
- */
1269
- function get_menu_customizations(){
1270
- global $menu;
1271
- global $submenu;
1272
-
1273
- //var_dump($menu); die;
1274
- $previousCustomizations = json_decode(get_option('ag_edit_adminmenu_json_new'), true);
1275
-
1276
- $customizationsSet = true;
1277
- if($previousCustomizations == null){
1278
- $customizationsSet = false;
1279
- }
1280
-
1281
- //set default menu configuration
1282
- //and apply previously saved customizations
1283
- $m = array();
1284
- foreach($menu as $top){
1285
- $name = $top[0];
1286
- $url = $top[2];
1287
- $cls = isset($top[5])?$top[5]:"";
1288
- $remove = false;
1289
- if($name == '') continue;
1290
- $pc = null;
1291
- $name = $this->menu_item_cleartext($name);
1292
-
1293
- //apply previous submenu customizations
1294
- if($customizationsSet){
1295
- $pc = $previousCustomizations[$url];
1296
- }
1297
-
1298
- //get submenu
1299
- $s = array();
1300
- if(isset($submenu[$url])){
1301
- $sitems = $submenu[$url];
1302
- foreach($sitems as $key=>$sub){
1303
- $nameSub = $sub[0];
1304
- $urlSub = $sub[2];
1305
- $removeSub = false;
1306
- $nameSub = $this->menu_item_cleartext($nameSub);
1307
- $s[$key]=array(
1308
- 'name'=>$nameSub,
1309
- 'new'=>'',
1310
- 'remove'=>$removeSub,
1311
- 'url'=>$urlSub
1312
- );
1313
-
1314
- if(isset($pc) && isset($pc['submenus'])){
1315
- $s[$key]['new'] = $pc['submenus'][$key]['new'];
1316
- $s[$key]['remove'] = $pc['submenus'][$key]['remove'];
1317
-
1318
- if($s[$key]['new'] == null){
1319
- $s[$key]['new'] = '';
1320
- }
1321
- if($s[$key]['remove'] == null){
1322
- $s[$key]['remove'] = false;
1323
- }
1324
- }
1325
- }
1326
- }
1327
-
1328
- $m[$url]=array(
1329
- 'name'=>$name,
1330
- 'remove'=>$remove,
1331
- 'new'=>'',
1332
- 'url'=>$url,
1333
- 'cls'=>$cls,
1334
- 'submenus'=>$s
1335
- );
1336
-
1337
- //apply previous top menu customizations
1338
- if($customizationsSet){
1339
- $pc = $previousCustomizations[$url];
1340
- if(isset($pc)){
1341
- $m[$url]['remove'] = $pc['remove'];
1342
- $m[$url]['new'] = $pc['new'];
1343
- }
1344
- }
1345
- }
1346
- return $m;
1347
- }
1348
-
1349
- /**
1350
- * Applies customizations to admin menu
1351
- */
1352
- function customized_menu(){
1353
- $customizations = $this->get_menu_customizations();
1354
- global $menu;
1355
- global $submenu;
1356
-
1357
- //print_r($submenu);die;
1358
- //apply customizations to original admin menu
1359
- foreach($menu as $key=>$top){
1360
- $url = $top[2];
1361
- if(isset($customizations[$url])){
1362
- $topCustomized = $customizations[$url];
1363
- if($topCustomized['new']) {
1364
- $menu[$key][0] = $topCustomized['new'];
1365
- }
1366
- if($topCustomized['remove']){
1367
- unset($menu[$key]);
1368
- }
1369
- }
1370
- }
1371
- foreach($submenu as $topkey=>$subs){
1372
- foreach($subs as $subkey=>$sub){
1373
- if(isset($customizations[$topkey]['submenus'][$subkey])){
1374
- $cs = $customizations[$topkey]['submenus'][$subkey];
1375
- if($cs['new']) {
1376
- $submenu[$topkey][$subkey][0] = preg_replace("/".$cs['name']."/",$cs['new'], $submenu[$topkey][$subkey][0],1);
1377
- }
1378
- if($cs['remove']){
1379
- unset($submenu[$topkey][$subkey]);
1380
- }
1381
- }
1382
- }
1383
- }
1384
- }
1385
-
1386
- /**
1387
- * Used only for removing admin menu customizations to AGCA 1.5 version or later
1388
- * @param $checkboxes
1389
- * @param $textboxes
1390
- */
1391
- function migrate_menu_customizations($checkboxes, $textboxes){
1392
- $customizations = $this->get_menu_customizations();
1393
- global $menu;
1394
- /*print_r($menu);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1395
  print_r($customizations);
1396
  print_r($textboxes);*/
1397
 
1398
- $oldTopValue = "";
1399
-
1400
-
1401
- //Migrate checkboxes
1402
- foreach($checkboxes as $key=>$value){
1403
- $isTop = false;
1404
- $oldSubValue = "";
1405
- if (strpos($key,'<-TOP->') !== false) {
1406
- $oldTopValue = str_replace('<-TOP->','',$key);
1407
- $isTop = true;
1408
- }else{
1409
- $oldSubValue = $key;
1410
- }
1411
- if($value == 'checked'){
1412
- $topIndex = "";
1413
- foreach($customizations as $k=>$c){
1414
- if($c['cls'] == $oldTopValue){
1415
- $topIndex = $k;
1416
- break;
1417
- }
1418
- }
1419
- if($topIndex == "") continue;
1420
- if($isTop){
1421
- $customizations[$topIndex]['remove'] = true;
1422
- }else{
1423
- if(is_array($customizations[$topIndex]['submenus'])){
1424
- foreach($customizations[$topIndex]['submenus'] as $skey=>$sval){
1425
- if($sval['name'] == $oldSubValue){
1426
- $customizations[$topIndex]['submenus'][$skey]['remove'] = true;
1427
- }
1428
- }
1429
- }
1430
- }
1431
- }
1432
- }
1433
-
1434
- //Migrate textboxes
1435
- foreach($textboxes as $key=>$value){
1436
- $isTop = false;
1437
- $oldSubValue = "";
1438
- if (strpos($key,'<-TOP->') !== false) {
1439
- $oldTopValue = str_replace('<-TOP->','',$key);
1440
- $isTop = true;
1441
- }else{
1442
- $oldSubValue = $key;
1443
- }
1444
- if($value != ''){
1445
- $topIndex = "";
1446
- foreach($customizations as $k=>$c){
1447
- if($c['cls'] == $oldTopValue){
1448
- $topIndex = $k;
1449
- break;
1450
- }
1451
- }
1452
- if($topIndex == "") continue;
1453
- if($isTop){
1454
- $customizations[$topIndex]['new'] = $value;
1455
- }else{
1456
- if(is_array($customizations[$topIndex]['submenus'])){
1457
- foreach($customizations[$topIndex]['submenus'] as $skey=>$sval){
1458
- if($sval['name'] == $oldSubValue){
1459
- if($customizations[$topIndex]['submenus'][$skey]['name'] != $value){
1460
- $customizations[$topIndex]['submenus'][$skey]['new'] = $value;
1461
- }
1462
- }
1463
- }
1464
- }
1465
- }
1466
- }
1467
- }
1468
- update_option('ag_edit_adminmenu_json','');//remove previous admin menu configuration
1469
- update_option('ag_edit_adminmenu_json_new',json_encode($customizations));
1470
- }
1471
- function print_admin_css()
1472
- {
1473
- $agcaTemplateSession = $this->agcaAdminSession();
1474
- $wpversion = $this->get_wp_version();
1475
- $this->context = "admin";
1476
- $this->error_check();
1477
- ?>
1478
- <script type="text/javascript">
1479
- var wpversion = "<?php echo $wpversion; ?>";
1480
- var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1481
- var agca_version = "<?php echo $this->agca_version; ?>";
1482
- var agcaTemplatesSession = <?php echo ($agcaTemplateSession==null)?"[]":$agcaTemplateSession; ?>;
1483
- var errors = false;
1484
- var isSettingsImport = false;
1485
- var agca_context = "admin";
1486
- var roundedSidberSize = 0;
1487
- var agca_installed_templates = <?php echo $this->get_installed_agca_templates(); ?>;
1488
- var agca_admin_menu = <?= json_encode($this->get_menu_customizations()) ?>;
1489
- </script>
1490
- <?php
1491
- $this->prepareAGCAAdminTemplates();
1492
- $this->agca_get_includes();
1493
- $this->admin_capabilities();
1494
- get_currentuserinfo() ;
1495
-
1496
- ?>
1497
- <?php
1498
- //in case that javaScript is disabled only admin can access admin menu
1499
- if(!current_user_can($this->admin_capability())){
1500
- ?>
1501
- <style type="text/css">
1502
- #adminmenu{display:none;}
1503
- </style>
1504
- <?php
1505
- }
1506
- ?>
1507
- <script type="text/javascript">
1508
- document.write('<style type="text/css">html{visibility:hidden;}</style>');
1509
- <?php
1510
- if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='true'){
1511
- echo 'isSettingsImport = true;';
1512
- }
1513
- ?>
1514
- </script>
1515
- <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1516
- <style type="text/css">
1517
- .wp-has-current-submenu:after{border:none !important;}
1518
- #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none !important;}
1519
- </style>
1520
- <?php } ?>
1521
- <script type="text/javascript">
1522
- /* <![CDATA[ */
1523
- jQuery(document).ready(function() {
1524
- try
1525
- {
1526
-
1527
- <?php /*CHECK OTHER PLUGINS*/
1528
- $this->check_active_plugin();
1529
-
1530
- if($this->active_plugin["ozh"]){
1531
- ?>
1532
- jQuery('ul#adminmenu').css('display','none');
1533
- jQuery('#footer-ozh-oam').css('display','none');
1534
- jQuery('#ag_main_menu li').each(function(){
1535
- if(jQuery(this).text() == "Admin Menu"){
1536
- jQuery(this).hide();
1537
- }
1538
- });
1539
- <?php
1540
- }
1541
- ?>
1542
-
1543
-
1544
- //get saved onfigurations
1545
-
1546
- <?php $buttons = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttons'); ?>
1547
- var buttons = '<?php echo $buttons; ?>';
1548
-
1549
- <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
1550
- var buttonsJq = '<?php echo $buttonsJq; ?>';
1551
-
1552
- createEditMenuPageNew(agca_admin_menu);
1553
- //createEditMenuPageV32(checkboxes, textboxes);
1554
-
1555
- <?php
1556
- //if admin, and option to hide settings for admin is set
1557
-
1558
- if((get_option('agca_role_allbutadmin')==true) and current_user_can($this->admin_capability())){
1559
- ?>
1560
- <?php } else{ ?>
1561
- <?php if(get_option('agca_admin_menu_brand')!=""){ ?>
1562
- additionalStyles = ' style="margin-bottom:-4px" ';
1563
- jQuery("#adminmenu").before('<div '+additionalStyles+' id="sidebar_adminmenu_logo"><img width="160" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1564
- <?php } ?>
1565
- <?php if(get_option('agca_admin_menu_brand_link')!=""){ ?>
1566
-
1567
- var href = "<?php echo get_option('agca_admin_menu_brand_link'); ?>";
1568
- href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1569
-
1570
- jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1571
- jQuery("#sidebar_adminmenu_logo").attr('title',href);
1572
-
1573
- <?php }else{ ?>
1574
- href = "<?php echo get_bloginfo('wpurl'); ?>";
1575
- jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1576
- jQuery("#sidebar_adminmenu_logo").attr('title',href);
1577
- <?php } ?>
1578
-
1579
- <?php if(get_option('agca_admin_menu_submenu_round')==true){ ?>
1580
- jQuery("#adminmenu .wp-submenu").css("border-radius","<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1581
- jQuery("#adminmenu .wp-menu-open .wp-submenu").css('border-radius','');
1582
- <?php $roundedSidebarSize = get_option('agca_admin_menu_submenu_round_size'); ?>
1583
- roundedSidberSize = <?php echo ($roundedSidebarSize == "")?"0":$roundedSidebarSize; ?>;
1584
-
1585
-
1586
- <?php } ?>
1587
- <?php if(get_option('agca_admin_menu_autofold')=="force"){ ?>
1588
- jQuery("body").addClass("auto-fold");
1589
- <?php } else if(get_option('agca_admin_menu_autofold')=="disable"){ ?>
1590
- jQuery("body").removeClass("auto-fold");
1591
- <?php } ?>
1592
-
1593
- <?php $this->print_admin_bar_scripts(); ?>
1594
-
1595
- <?php if(get_option('agca_screen_options_menu')==true){ ?>
1596
- jQuery("#screen-options-link-wrap").css("display","none");
1597
- <?php } ?>
1598
- <?php if(get_option('agca_help_menu')==true){ ?>
1599
- jQuery("#contextual-help-link-wrap").css("display","none");
1600
- jQuery("#contextual-help-link").css("display","none");
1601
- <?php } ?>
1602
- <?php if(get_option('agca_privacy_options')==true){ ?>
1603
- jQuery("#privacy-on-link").css("display","none");
1604
- <?php } ?>
1605
-
1606
- <?php if(get_option('agca_update_bar')==true){ ?>
1607
- <?php
1608
- if ( ! function_exists( 'c2c_no_update_nag' ) ) :
1609
- function c2c_no_update_nag() {
1610
- remove_action( 'admin_notices', 'update_nag', 3 );
1611
- }
1612
- endif;
1613
- add_action( 'admin_init', 'c2c_no_update_nag' );
1614
- ?>
1615
- jQuery("#update-nag").css("display","none");
1616
- jQuery(".update-nag").css("display","none");
1617
- <?php } ?>
1618
-
1619
- <?php if(get_option('agca_footer')==true){ ?>
1620
- jQuery("#footer,#wpfooter").css("display","none");
1621
- <?php } ?>
1622
-
1623
- <?php if(get_option('agca_footer_left')!=""){ ?>
1624
- jQuery("#footer-left").html('<?php echo addslashes(get_option('agca_footer_left')); ?>');
1625
- <?php } ?>
1626
- <?php if(get_option('agca_footer_left_hide')==true){ ?>
1627
- jQuery("#footer-left").css("display","none");
1628
- <?php } ?>
1629
- <?php if(get_option('agca_footer_right')!=""){ ?>
1630
- jQuery("#footer-upgrade").html('<?php echo addslashes(get_option('agca_footer_right')); ?>');
1631
- <?php } ?>
1632
- <?php if(get_option('agca_footer_right_hide')==true){ ?>
1633
- jQuery("#footer-upgrade").css("display","none");
1634
- <?php } ?>
1635
-
1636
- <?php if(get_option('agca_language_bar')==true){ ?>
1637
- jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
1638
- <?php } ?>
1639
- <?php if(get_option('agca_dashboard_icon')==true){ ?>
1640
- var className = jQuery("#icon-index").attr("class");
1641
- if(className=='icon32'){
1642
- jQuery("#icon-index").attr("id","icon-index-removed");
1643
- }
1644
- <?php } ?>
1645
- <?php if(get_option('agca_dashboard_text')!=""){ ?>
1646
- jQuery("#dashboard-widgets-wrap").parent().find("h1").html("<?php echo addslashes(get_option('agca_dashboard_text')); ?>");
1647
- <?php } ?>
1648
- <?php if(get_option('agca_dashboard_text_paragraph')!=""){
1649
- require_once(ABSPATH . 'wp-includes/formatting.php');
1650
- ?>
1651
- jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
1652
-
1653
- jQuery("#agca_custom_dashboard_content").html('<br /><?php echo preg_replace('/(\r\n|\r|\n)/', '\n', addslashes(wpautop(get_option('agca_dashboard_text_paragraph')))); ?>');
1654
- <?php } ?>
1655
-
1656
- <?php /*Remove Dashboard widgets*/ ?>
1657
- <?php
 
 
 
 
 
 
 
 
1658
 
1659
  if(get_option('agca_dashboard_widget_welcome')==true){
1660
- ?>jQuery("#welcome-panel").css("display","none");<?php
 
1661
  }else{
1662
- ?>jQuery("#welcome-panel").css("display","block");<?php
1663
- }
 
1664
  if(get_option('agca_dashboard_widget_il')==true){
1665
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1666
  }else{
1667
- ?>jQuery("#dashboard_incoming_links").css("display","block");<?php
 
1668
  }
1669
  if(get_option('agca_dashboard_widget_plugins')==true){
1670
  $this->remove_dashboard_widget('dashboard_plugins','normal');
1671
  }else{
1672
- ?>jQuery("#dashboard_plugins").css("display","block");<?php
 
1673
  }
1674
  if(get_option('agca_dashboard_widget_qp')==true){
1675
  $this->remove_dashboard_widget('dashboard_quick_press','side');
1676
  }else{
1677
- ?>jQuery("#dashboard_quick_press").css("display","block");<?php
 
1678
  }
1679
  if(get_option('agca_dashboard_widget_rn')==true){
1680
  $this->remove_dashboard_widget('dashboard_right_now','normal');
1681
  }else{
1682
- ?>jQuery("#dashboard_right_now").css("display","block");<?php
 
1683
  }
1684
  if(get_option('agca_dashboard_widget_rd')==true){
1685
  $this->remove_dashboard_widget('dashboard_recent_drafts','side');
1686
  }else{
1687
- ?>jQuery("#dashboard_recent_drafts").css("display","block");<?php
 
1688
  }
1689
  if(get_option('agca_dashboard_widget_primary')==true){
1690
  $this->remove_dashboard_widget('dashboard_primary','side');
1691
  }else{
1692
- ?>jQuery("#dashboard_primary").css("display","block");<?php
 
1693
  }
1694
  if(get_option('agca_dashboard_widget_secondary')==true){
1695
  $this->remove_dashboard_widget('dashboard_secondary','side');
1696
  }else{
1697
- ?>jQuery("#dashboard_secondary").css("display","block");<?php
1698
- }
 
1699
  if(get_option('agca_dashboard_widget_activity')==true){
1700
  remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
1701
  }else{
1702
- ?>jQuery("#dashboard_activity").css("display","block");<?php
1703
- }
1704
-
1705
- ?>
1706
-
1707
- <?php /*ADMIN MENU*/ ?>
1708
-
1709
- <?php if(get_option('agca_admin_menu_separators')==true){ ?>
1710
- jQuery("#adminmenu li.wp-menu-separator").css({height: 0, margin: 0});
1711
- <?php } ?>
1712
- <?php if(get_option('agca_admin_menu_icons') == true){ ?>
1713
- jQuery(".wp-menu-image").each(function(){
1714
- jQuery(this).css("display","none");
1715
- });
1716
- jQuery('#adminmenu div.wp-menu-name').css('padding','8px');
1717
- <?php } ?>
1718
- <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1719
- jQuery("#adminmenu .wp-menu-arrow").css("visibility","hidden");
1720
-
1721
- <?php } ?>
1722
- <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
1723
-
1724
- <?php /*If Turned on*/ ?>
1725
-
1726
- <?php if(get_option('agca_admin_menu_agca_button_only') == true){ ?>
1727
- jQuery('#adminmenu > li').each(function(){
1728
- if(!jQuery(this).hasClass('agca_button_only')){
1729
- jQuery(this).addClass('noclass');
1730
- }
1731
- });
1732
- <?php /*Only admin see button*/
1733
- if (current_user_can($this->admin_capability())){ ?>
1734
- jQuery('#adminmenu').append('<?php echo $this->agca_create_admin_button('AG Custom Admin',array('value'=>'tools.php?page=ag-custom-admin/plugin.php','target'=>'_self')); ?>');
1735
- <?php } ?>
1736
- <?php } ?>
1737
-
1738
-
1739
- <?php /*EDIT MENU ITEMS*/?>
1740
- <?php if(get_option('ag_edit_adminmenu_json')!=""){
1741
-
1742
- $arr = explode("|",get_option('ag_edit_adminmenu_json'));
1743
-
1744
- $checkboxes = json_decode($arr[0]);
1745
- $textboxes = json_decode($arr[1]);
1746
-
1747
- $this->migrate_menu_customizations($checkboxes, $textboxes);
1748
-
1749
- } ?>
1750
-
1751
- <?php if(get_option('ag_edit_adminmenu_json_new')!=""){
1752
- $this->customized_menu();
1753
- } ?>
1754
-
1755
-
1756
-
1757
-
1758
- /*Add user buttons*/
1759
- jQuery('#adminmenu').append(buttons);
1760
-
1761
- <?php /*END If Turned on*/ ?>
1762
- <?php } else{ ?>
1763
- jQuery("#adminmenu").removeClass("noclass");
1764
- <?php } ?>
1765
-
1766
- reloadRemoveButtonEvents();
1767
-
1768
- <?php if(get_option('agca_admin_menu_collapse_button') == true){ ?>
1769
- //remove collapse menu button
1770
- jQuery('#collapse-menu').remove();
1771
- <?php } ?>
1772
-
1773
- <?php //COLORIZER ?>
1774
- updateAllColors();
1775
- <?php //COLORIZER END ?>
1776
- <?php } //end of apply for any user except admin ?>
1777
- /*Add user buttons*/
1778
- jQuery('#ag_add_adminmenu').append(buttonsJq);
1779
-
1780
-
1781
- }catch(err){
1782
- errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
1783
- console.log(errors);
1784
- }finally{
1785
- jQuery('html').css('visibility','visible');
1786
- }
1787
- <?php
1788
  if($this->saveAfterImport == true){
1789
  ?>savePluginSettings();<?php
1790
- }
1791
- ?>
1792
-
1793
- });
1794
-
1795
- <?php if(get_option('agca_colorizer_turnonoff') == 'on'){
1796
- $this->updateAllColors();
1797
- }else{
1798
- ?>function updateAllColors(){}; <?php
1799
- } ?>
1800
-
1801
-
1802
- /* ]]> */
1803
- </script>
1804
- <style type="text/css">
1805
- .underline_text{
1806
- text-decoration:underline;
1807
- }
1808
- .form-table th{
1809
- width:300px;
1810
- }
1811
-
1812
- #dashboard-widgets div.empty-container{
1813
- border:none;
1814
- }
1815
- </style>
1816
- <?php
1817
- }
1818
-
1819
- function print_login_head(){
1820
- $this->context = "login";
1821
- $this->error_check();
1822
- $wpversion = $this->get_wp_version();
1823
-
1824
- ?>
1825
- <script type="text/javascript">
1826
- document.write('<style type="text/css">html{visibility:hidden;}</style>');
1827
- var agca_version = "<?php echo $this->agca_version; ?>";
1828
- <?php //var wpversion = "echo $wpversion; ?>
1829
- var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1830
- var isSettingsImport = false;
1831
- var agca_context = "login";
1832
- </script>
1833
- <?php
1834
- $this->prepareAGCALoginTemplates();
1835
- $this->agca_get_includes();
1836
-
1837
- ?>
1838
-
1839
- <script type="text/javascript">
1840
-
1841
-
1842
- /* <![CDATA[ */
1843
- jQuery(document).ready(function() {
1844
- try{
1845
- <?php if(get_option('agca_login_round_box')==true){ ?>
1846
- jQuery("form#loginform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1847
- jQuery("#login h1 a").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1848
- jQuery("#login h1 a").css("margin-bottom",'10px');
1849
- jQuery("#login h1 a").css("padding-bottom",'0');
1850
- jQuery("form#lostpasswordform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1851
- <?php } ?>
1852
- <?php if(get_option('agca_login_banner')==true){ ?>
1853
- jQuery("#backtoblog").css("display","none");
1854
- <?php } ?>
1855
- <?php if(get_option('agca_login_banner_text')==true){ ?>
1856
- jQuery("#backtoblog").html('<?php echo addslashes(get_option('agca_login_banner_text')); ?>');
1857
- <?php } ?>
1858
- <?php if(get_option('agca_login_photo_url')==true && get_option('agca_login_photo_remove')!=true){ ?>
1859
- advanced_url = "<?php echo get_option('agca_login_photo_url'); ?>";
1860
- var $url = "url(" + advanced_url + ")";
1861
- jQuery("#login h1 a").css("background",$url+' no-repeat');
1862
- jQuery("#login h1 a").hide();
1863
- image = jQuery("<img />").attr("src",advanced_url);
1864
- jQuery(image).load(function() {
1865
- var originalWidth = 326;
1866
- var widthDiff = this.width - originalWidth;
1867
- jQuery("#login h1 a").height(this.height);
1868
- jQuery("#login h1 a").width(this.width);
1869
- jQuery("#login h1 a").css("background-size",this.width+"px "+this.height+"px");
1870
-
1871
- var loginWidth = jQuery('#login').width();
1872
- var originalLoginWidth = 320;
1873
- var photoWidth = this.width;
1874
-
1875
- if(loginWidth > photoWidth){
1876
- jQuery("#login h1 a").css('margin','auto');
1877
- }else{
1878
- jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+((loginWidth-originalLoginWidth)/2)+"px");
1879
- }
1880
-
1881
- jQuery("#login h1 a").show();
1882
- });
1883
- <?php } ?>
1884
- <?php if(get_option('agca_login_photo_href')==true){ ?>
1885
- var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
1886
- $href = $href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1887
-
1888
- jQuery("#login h1 a").attr("href",$href);
1889
- <?php } ?>
1890
- <?php if(get_option('agca_login_photo_remove')==true){ ?>
1891
- jQuery("#login h1 a").css("display","none");
1892
- <?php } ?>
1893
-
1894
- jQuery("#login h1 a").attr("title","");
1895
-
1896
- <?php if(get_option('agca_login_register_remove')==true){ ?>
1897
- if(jQuery('p#nav').size() > 0){
1898
- jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1899
- }
1900
- jQuery('p#nav a').each(function(){
1901
- if(jQuery(this).attr('href').indexOf('register') != -1){
1902
- jQuery(this).remove();
1903
- }
1904
- });
1905
-
1906
- <?php } ?>
1907
- <?php if(get_option('agca_login_register_href')!=""){ ?>
1908
- jQuery('p#nav a').each(function(){
1909
- if(jQuery(this).attr('href').indexOf('register') != -1){
1910
- jQuery(this).attr('href','<?php echo get_option('agca_login_register_href'); ?>');
1911
- }
1912
- });
1913
-
1914
- <?php } ?>
1915
-
1916
- <?php if(get_option('agca_login_lostpassword_remove')==true){ ?>
1917
- if(jQuery('p#nav').size() > 0){
1918
- jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1919
- }
1920
- jQuery('p#nav a').each(function(){
1921
- if(jQuery(this).attr('href').indexOf('lostpassword') != -1){
1922
- jQuery(this).remove();
1923
- }
1924
- });
1925
-
1926
- <?php } ?>
1927
-
1928
-
1929
- <?php //COLORIZER ?>
1930
- <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1931
- jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1932
- jQuery("body.login, html").css("background","<?php echo $this->colorizer['login_color_background'];?>");
1933
-
1934
-
1935
- <?php
1936
-
1937
-
1938
- } ?>
1939
- <?php //COLORIZER END ?>
1940
- }catch(err){
1941
- console.log("AGCA - LOGIN ERROR: " + err.name + " / " + err.message);
1942
- }finally{
1943
- jQuery('html').show();
1944
- jQuery('html').css('visibility','visible');
1945
- }
1946
  });
1947
- /* ]]> */
1948
-
 
 
 
 
 
 
 
 
 
1949
  </script>
1950
- <?php
1951
- }
1952
-
1953
- function agca_admin_page() {
1954
-
1955
- $wpversion = $this->get_wp_version();
1956
- $this->agca_error_check();
1957
- ?>
1958
- <?php //includes ?>
1959
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css?ver=<?php echo $wpversion; ?>" />
1960
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
1961
-
1962
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css?ver=<?php echo $wpversion; ?>" />
1963
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
1964
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/xd.js?ver=<?php echo $wpversion; ?>"></script>
1965
- <script type="text/javascript">
1966
- var templates_ep = "<?php echo $this->templates_ep; ?>";
1967
- var template_selected = '<?php echo get_option('agca_selected_template'); ?>';
1968
- </script>
1969
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_tmpl.js?ver=<?php echo $wpversion; ?>"></script>
1970
- <?php //includes ?>
1971
- <div class="wrap">
1972
- <h1 id="agca-title">AG Custom Admin Settings <span style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
1973
- <div id="agca_error_placeholder"></div>
1974
- <div id="agca_news">&nbsp;</div><br />
1975
- <form method="post" id="agca_form" action="options.php">
1976
- <?php settings_fields( 'agca-options-group' ); ?>
1977
- <div id="agca-your-feedback">
1978
- <strong>
1979
- <span style="color:#005B69">Your feedback:</span>
1980
- </strong>
1981
- <a class="feedback positive" target="_blank" title="POSITIVE FEEDBACK: I like this plugin!" href="http://wordpressadminpanel.com/agca-support/feedback/ag-custom-admin-positive-feedback/">
1982
- <span class="dashicons dashicons-thumbs-up"></span>
1983
- </a>
1984
- <a class="feedback negative" target="_blank" title="NEGATIVE FEEDBACK: I don't like this plugin." href="http://wordpressadminpanel.com/agca-support/feedback/ag-custom-admin-negative-feedback/">
1985
- <span class="dashicons dashicons-thumbs-down"></span>
1986
- </a>
1987
- </div>
1988
- <br />
1989
- <ul id="ag_main_menu">
1990
- <li class="selected"><a href="#general-settings" title="General Settings" >General</a></li>
1991
- <li class="normal"><a href="#admin-bar-settings" title="Settings for admin bar" >Admin Bar</a></li>
1992
- <li class="normal"><a href="#admin-footer-settings" title="Settings for admin footer" >Admin Footer</a></li>
1993
- <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard Page</a></li>
1994
- <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a></li>
1995
- <li class="normal" ><a href="#admin-menu-settings" title="Settings for main admin menu">Admin Menu</a></li>
1996
- <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a></li>
1997
- <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
1998
- <li class="normal" style=""><a style="color:#DB6014;font-weight:bolder;" href="#ag-templates" title="AG Custom Admin Themes">Admin Themes</a></li>
1999
-
2000
- <li style="background:none;border:none;padding:0;"><a id="agca_donate_button" target="_blank" style="margin-left:8px" title="Like this plugin? You can support its future development by giving a donation by your wish " href="http://wordpressadminpanel.com/agca-support/support-for-future-development/"><img alt="Donate" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/btn_donate_LG.gif" /></a>
2001
- </li>
2002
- <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
2003
- </ul>
2004
- <div id="agca_advertising">
2005
- <ul>
2006
- <li style="min-height:105px;display: block"></li>
2007
- </ul>
2008
- </div>
2009
- <div class="agca-clear"></div>
2010
- <div id="section_general" style="display:none" class="ag_section">
2011
- <h2 class="section_title">General Settings</h2>
2012
- <p tabindex="0" class="agca-clear agca-tip"><i><strong>Tip: </strong>Move mouse cursor over the option label to see more information about an option</i></p>
2013
- <table class="agca-clear form-table" width="500px">
2014
- <?php
2015
-
2016
- $this->print_checkbox(array(
2017
- 'name'=>'agca_role_allbutadmin',
2018
- 'label'=>'Exclude AGCA admin from customizations',
2019
- 'title'=>'<h3>Applying customizations</h3><br><strong>Checked</strong> - apply to all users, except admin<br><strong>Not checked</strong> - apply to everyone</br></br><strong>Q</strong>: Who is AGCA administrator?</br><strong>A</strong>: Go to <i>Advanced</i> tab and change capability option to define administrators. Only the users with selected capability will be AGCA administrators.</br>'
2020
- ));
2021
-
2022
- $this->print_options_h3('Pages');
2023
-
2024
- $this->print_checkbox(array(
2025
- 'hide'=>true,
2026
- 'name'=>'agca_screen_options_menu',
2027
- 'label'=>'"Screen Options" menu',
2028
- 'title'=>'Hides the menu from the admin pages (located on the top right corner of the page, below the admin bar)'
2029
- ));
2030
-
2031
- $this->print_checkbox(array(
2032
- 'hide'=>true,
2033
- 'name'=>'agca_help_menu',
2034
- 'label'=>'"Help" menu',
2035
- 'title'=>'Hides the menu from the admin pages (located on the top right corner of the page, below the admin bar)'
2036
- ));
2037
-
2038
- $this->print_options_h3('Security');
2039
-
2040
- ?>
2041
-
2042
- <tr valign="center">
2043
- <th scope="row">
2044
- <label title="Choose which WordPress capability will be used to distinguish AGCA admin users from other users.</br>AGCA admin users have access to AGCA settings. AGCA administrators can be excluded from customizations if that option is checked" for="agca_admin_capability">AGCA admin capability:</label>
2045
- </th>
2046
- <td><?php echo $this->admin_capabilities; ?>&nbsp;&nbsp;<i>(<strong>Edit Dashboard</strong> - selected by default)</i>
2047
- <p style="margin-left:5px;"><i>Find more information about <a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">WordPress capabilities</a></i></p>
2048
- </td>
2049
- <td>
2050
- </td>
2051
- </tr>
2052
- <?php
2053
- $this->print_options_h3('Feedback and Support');
2054
-
2055
- ?>
2056
- <tr valign="center">
2057
- <td colspan="2">
2058
- <div class="agca-feedback-and-support">
2059
- <ul>
2060
- <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=feature" target="_blank"><span class="dashicons dashicons-lightbulb"></span>&nbsp;&nbsp;Idea for improvement</a> - submit your idea for improvement </li>
2061
- </ul>
2062
- <ul>
2063
- <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=bug" target="_blank"><span class="dashicons dashicons-megaphone"></span>&nbsp;&nbsp;Report an issue</a> - if plugin does not work as expected </li>
2064
- </ul>
2065
- <ul>
2066
- <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=theme" target="_blank"><span class="dashicons dashicons-art"></span>&nbsp;&nbsp;Idea for admin theme</a> - submit your idea for admin theme </li>
2067
- </ul>
2068
- <ul>
2069
- <li><a href="https://wordpress.org/support/view/plugin-reviews/ag-custom-admin" target="_blank"><span class="dashicons dashicons-awards"></span>&nbsp;&nbsp;Add a review on WordPress.org</a> - add your review and rate us on WordPress.org </li>
2070
- </ul>
2071
- <ul>
2072
- <li><a href="http://wordpressadminpanel.com/agca-support/" target="_blank"><span class="dashicons dashicons-shield-alt"></span>&nbsp;&nbsp;Visit our support site</a> - for any other questions, feel free to contact us </li>
2073
- </ul>
2074
- <ul>
2075
- <li><a href="http://wordpressadminpanel.com/agca-support/support-for-future-development/" target="_blank"><span class="dashicons dashicons-palmtree"></span>&nbsp;&nbsp;Donate</a> - only if you find this plugin helpful for your needs </li>
2076
- </ul>
2077
- </div>
2078
- </td>
2079
- <td></td>
2080
- </tr>
2081
- </table>
2082
- </div>
2083
- <div id="section_admin_bar" class="ag_section">
2084
- <h2 class="section_title">Admin Bar Settings</h2>
2085
- <table class="form-table" width="500px">
2086
-
2087
- <?php
2088
- $this->print_checkbox(array(
2089
- 'attributes'=>array(
2090
- 'class'=>'ag_table_major_options',
2091
- ),
2092
- 'hide'=>true,
2093
- 'title'=>'Hides admin bar completely from the admin panel',
2094
- 'name'=>'agca_header',
2095
- 'label'=>'<strong>Admin bar</strong>',
2096
- 'input-attributes'=>'data-dependant="#agca_header_show_logout_content"',
2097
- 'input-class'=>'has-dependant',
2098
- ));
2099
-
2100
- $this->print_checkbox(array(
2101
- 'attributes'=>array(
2102
- 'class'=>'ag_table_major_options',
2103
- 'style'=> ((get_option('agca_header')!='true')?'display:none':''),
2104
- 'id'=>'agca_header_show_logout_content',
2105
- ),
2106
- 'title'=>'Check this if you want to show Log Out button in top right corner of the admin page',
2107
- 'name'=>'agca_header_show_logout',
2108
- 'checked'=> ((get_option('agca_header')==true) && (get_option('agca_header_show_logout')==true)),
2109
- 'label'=>'<strong>(but show Log Out button)</strong>'
2110
- ));
2111
-
2112
- $this->print_checkbox(array(
2113
- 'title'=>'Removes admin bar customizations for authenticated users on site pages.</br>This option can be useful if you want to remove AGCA scripts (styles, JavaScript) on your website for any reason.',
2114
- 'name'=>'agca_admin_bar_frontend',
2115
- 'hide'=>true,
2116
- 'label'=>'Site pages: Admin bar customizations'
2117
- ));
2118
-
2119
- $this->print_checkbox(array(
2120
- 'title'=>'Hides admin bar completely for authenticated users on site pages.',
2121
- 'name'=>'agca_admin_bar_frontend_hide',
2122
- 'hide'=>true,
2123
- 'label'=>'Site pages: Admin bar'
2124
- ));
2125
-
2126
- $this->print_options_h3('Left Side');
2127
-
2128
- $this->print_input(array(
2129
- 'title'=>'Change default WordPress logo with custom image.',
2130
- 'name'=>'agca_wp_logo_custom',
2131
- 'label'=>'Admin bar logo',
2132
- 'hint' =>'Image URL (maximum height is 28px)'
2133
- ));
2134
-
2135
- $this->print_input(array(
2136
- 'title'=>'Custom link on admin bar logo.</br></br>Use:</br><strong>%BLOG%</strong> - for blog URL</br><strong>%SWITCH%</strong> - to switch betweent admin and site area',
2137
- 'name'=>'agca_wp_logo_custom_link',
2138
- 'label'=>'Admin bar logo link',
2139
- 'hint' =>'Link'
2140
- ));
2141
-
2142
- $this->print_input(array(
2143
- 'title'=>'Customize WordPress title using custom title template.</br></br>Examples:</br><strong>%BLOG% -- %PAGE%</strong> (will be) <i>My Blog -- Add New Post</i></br><strong>%BLOG%</strong> (will be) <i>My Blog</i></br><strong>My Company > %BLOG% > %PAGE%</strong> (will be) <i>My Company > My Blog > Tools</i>',
2144
- 'name'=>'agca_custom_title',
2145
- 'label'=>'Page title template',
2146
- 'hint' =>'Please use <strong>%BLOG%</strong> and <strong>%PAGE%</strong> in your title template.'
2147
- ));
2148
-
2149
- $this->print_input(array(
2150
- 'title'=>'Add custom image on the top of the admin content.',
2151
- 'name'=>'agca_header_logo_custom',
2152
- 'label'=>'Header image',
2153
- 'hint' =>'Image URL'
2154
- ));
2155
-
2156
-
2157
- $this->print_checkbox(array(
2158
- 'hide'=>true,
2159
- 'title'=>'Hides small Wordpress logo from the admin bar',
2160
- 'name'=>'agca_header_logo',
2161
- 'label'=>'WordPress logo'
2162
- ));
2163
-
2164
- $this->print_checkbox(array(
2165
- 'hide'=>true,
2166
- 'title'=>'Hides WordPress context menu on WordPress logo icon from admin bar',
2167
- 'name'=>'agca_remove_top_bar_dropdowns',
2168
- 'label'=>'WordPress logo context menu'
2169
- ));
2170
-
2171
- $this->print_checkbox(array(
2172
- 'hide'=>true,
2173
- 'title'=>'Hides site name link from the admin bar',
2174
- 'name'=>'agca_remove_site_link',
2175
- 'label'=>'Site name'
2176
- ));
2177
-
2178
- $this->print_checkbox(array(
2179
- 'hide'=>true,
2180
- 'title'=>'Hides update notifications from admin bar',
2181
- 'name'=>'agca_admin_bar_update_notifications',
2182
- 'label'=>'Update notifications'
2183
- ));
2184
-
2185
- $this->print_checkbox(array(
2186
- 'hide'=>true,
2187
- 'title'=>'Hides comments block from admin bar',
2188
- 'name'=>'agca_admin_bar_comments',
2189
- 'label'=>'"Comments" block'
2190
- ));
2191
-
2192
- $this->print_checkbox(array(
2193
- 'hide'=>true,
2194
- 'attributes'=>array(
2195
- 'style'=>'margin-top:20px;'
2196
- ),
2197
- 'title'=>'Hides "+ New" block and its context menu from admin bar',
2198
- 'name'=>'agca_admin_bar_new_content',
2199
- 'label'=>'"+ New" block',
2200
- 'input-attributes'=>'data-dependant=".new_content_header_submenu"',
2201
- 'input-class'=>'has-dependant dependant-opposite'
2202
- ));
2203
-
2204
- $this->print_checkbox(array(
2205
- 'hide'=>true,
2206
- 'attributes'=>array(
2207
- 'class'=>'new_content_header_submenu'
2208
- ),
2209
- 'title'=>'Hides "Post" sub-menu from "+ New" block on admin bar',
2210
- 'name'=>'agca_admin_bar_new_content_post',
2211
- 'label'=>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Post sub-menu'
2212
- ));
2213
-
2214
- $this->print_checkbox(array(
2215
- 'hide'=>true,
2216
- 'attributes'=>array(
2217
- 'class'=>'new_content_header_submenu'
2218
- ),
2219
- 'title'=>'Hides "Link" sub-menu from "+ New" block on admin bar',
2220
- 'name'=>'agca_admin_bar_new_content_link',
2221
- 'label'=>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Link sub-menu'
2222
- ));
2223
-
2224
- $this->print_checkbox(array(
2225
- 'hide'=>true,
2226
- 'attributes'=>array(
2227
- 'class'=>'new_content_header_submenu'
2228
- ),
2229
- 'title'=>'Hides "Page" sub-menu from "+ New" block on admin bar',
2230
- 'name'=>'agca_admin_bar_new_content_page',
2231
- 'label'=>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Page sub-menu'
2232
- ));
2233
-
2234
- $this->print_checkbox(array(
2235
- 'hide'=>true,
2236
- 'attributes'=>array(
2237
- 'class'=>'new_content_header_submenu'
2238
- ),
2239
- 'title'=>'Hides "User" sub-menu from "+ New" block on admin bar',
2240
- 'name'=>'agca_admin_bar_new_content_user',
2241
- 'label'=>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> User sub-menu'
2242
- ));
2243
-
2244
- $this->print_checkbox(array(
2245
- 'hide'=>true,
2246
- 'attributes'=>array(
2247
- 'class'=>'new_content_header_submenu'
2248
- ),
2249
- 'title'=>'Hides "Media" sub-menu from "+ New" block on admin bar',
2250
- 'name'=>'agca_admin_bar_new_content_media',
2251
- 'label'=>'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Media sub-menu'
2252
- ));
2253
-
2254
- $this->print_checkbox(array(
2255
- 'hide'=>true,
2256
- 'title'=>'Hides "Admin themes" from admin bar',
2257
- 'name'=>'agca_admin_bar_admin_themes',
2258
- 'label'=>'"Admin themes"'
2259
- ));
2260
-
2261
- $this->print_textarea(array(
2262
- 'title'=>'Adds custom text in admin top bar.',
2263
- 'name'=>'agca_custom_site_heading',
2264
- 'label'=>'Custom blog heading',
2265
- 'hint'=>"<strong>Tip: </strong>You can use HTML tags like &lt;h1&gt; or &lt;a&gt;"
2266
- ));
2267
-
2268
-
2269
- $this->print_checkbox(array(
2270
- 'hide'=>true,
2271
- 'title'=>'Hides yellow bar with information about new WordPress release',
2272
- 'name'=>'agca_update_bar',
2273
- 'label'=>'Update WordPress notification'
2274
- ));
2275
-
2276
- $this->print_options_h3('Right Side');
2277
-
2278
- $this->print_input(array(
2279
- 'name'=>'agca_howdy',
2280
- 'label'=>'Change Howdy text',
2281
- ));
2282
-
2283
- $this->print_input(array(
2284
- 'title'=>'Put \'Exit\', for example',
2285
- 'name'=>'agca_logout',
2286
- 'label'=>'Change Log out text',
2287
- ));
2288
-
2289
- $this->print_checkbox(array(
2290
- 'hide'=>true,
2291
- 'name'=>'agca_remove_your_profile',
2292
- 'label'=>'"Edit My Profile" option from dropdown menu'
2293
- ));
2294
-
2295
- $this->print_checkbox(array(
2296
- 'title'=>'If selected, hides all elements in top right corner, except Log Out button',
2297
- 'name'=>'agca_logout_only',
2298
- 'label'=>'Log out only'
2299
- ));
2300
-
2301
- ?>
2302
-
2303
- </table>
2304
- </div>
2305
-
2306
- <div id="section_admin_footer" style="display:none" class="ag_section">
2307
- <h2 class="section_title">Admin Footer Settings</h2>
2308
- <table class="form-table" width="500px">
2309
- <?php
2310
- $this->print_checkbox(array(
2311
- 'hide'=>true,
2312
- 'attributes'=>array(
2313
- 'class'=>'ag_table_major_options'
2314
- ),
2315
- 'title'=>'Hides footer with all elements',
2316
- 'name'=>'agca_footer',
2317
- 'label'=>'<strong>Footer</strong>'
2318
- ));
2319
-
2320
- $this->print_options_h3('Footer Options');
2321
-
2322
- $this->print_checkbox(array(
2323
- 'hide'=>true,
2324
- 'title'=>'Hides default text in footer',
2325
- 'name'=>'agca_footer_left_hide',
2326
- 'label'=>'Footer text'
2327
- ));
2328
-
2329
- $this->print_textarea(array(
2330
- 'title'=>'Replaces text \'Thank you for creating with WordPress\' with custom text',
2331
- 'name'=>'agca_footer_left',
2332
- 'label'=>'Change footer text'
2333
- ));
2334
-
2335
- $this->print_checkbox(array(
2336
- 'hide'=>true,
2337
- 'title'=>'Hides text \'Get Version ...\' on right',
2338
- 'name'=>'agca_footer_right_hide',
2339
- 'label'=>'Version text'
2340
- ));
2341
-
2342
- $this->print_textarea(array(
2343
- 'title'=>'Replaces text \'Get Version ...\' with custom text',
2344
- 'name'=>'agca_footer_right',
2345
- 'label'=>'Change version text'
2346
- ));
2347
-
2348
- ?>
2349
-
2350
- </table>
2351
- </div>
2352
- <div id="section_dashboard_page" style="display:none" class="ag_section">
2353
- <h2 class="section_title">Dashboard Page Settings</h2>
2354
- <table class="form-table" width="500px">
2355
- <?php
2356
-
2357
- $this->print_options_h3('Dashboard Page Options');
2358
-
2359
- $this->print_input(array(
2360
- 'title'=>"Main heading ('Dashboard') on Dashboard page",
2361
- 'name'=>'agca_dashboard_text',
2362
- 'label'=>'Change Dashboard heading text',
2363
- ));
2364
-
2365
- ?>
2366
- <tr valign="center">
2367
- <th scope="row">
2368
- <label title="Adds custom text (or HTML) between heading and widgets area on Dashboard page" for="agca_dashboard_text_paragraph">Add custom Dashboard content<br> <em>(text or HTML content)</em></label>
2369
- </th>
2370
- <td class="agca_editor">
2371
- <?php $this->getTextEditor('agca_dashboard_text_paragraph'); ?>
2372
- </td>
2373
- </tr>
2374
- <?php
2375
-
2376
- $this->print_options_h3('Dashboard Widgets Options');
2377
-
2378
- ?>
2379
- <tr>
2380
- <td colspan="2">
2381
- <p tabindex="0" class="agca-tip"><i><strong>Note:</strong> These settings override settings in Screen options on Dashboard page.</i></p>
2382
- </td>
2383
- </tr>
2384
- <?php
2385
- $this->print_checkbox(array(
2386
- 'hide'=>true,
2387
- 'title'=>'Hides Welcome WordPress widget',
2388
- 'name'=>'agca_dashboard_widget_welcome',
2389
- 'label'=>'"Welcome" widget'
2390
- ));
2391
-
2392
- $this->print_checkbox(array(
2393
- 'hide'=>true,
2394
- 'title'=>'Hides Activity dashboard widget',
2395
- 'name'=>'agca_dashboard_widget_activity',
2396
- 'label'=>'"Activity" widget'
2397
- ));
2398
-
2399
- $this->print_checkbox(array(
2400
- 'hide'=>true,
2401
- 'title'=>'Hides Quick Draft dashboard widget',
2402
- 'name'=>'agca_dashboard_widget_qp',
2403
- 'label'=>'"Quick Draft" widget'
2404
- ));
2405
-
2406
- $this->print_checkbox(array(
2407
- 'hide'=>true,
2408
- 'title'=>'Hides At a Glance dashboard widget',
2409
- 'name'=>'agca_dashboard_widget_rn',
2410
- 'label'=>'"At a Glance" widget'
2411
- ));
2412
-
2413
- $this->print_checkbox(array(
2414
- 'hide'=>true,
2415
- 'name'=>'agca_dashboard_widget_primary',
2416
- 'title'=>"This is 'WordPress News' or 'WordPress Development Blog' widget in older WordPress versions",
2417
- 'label'=>'"WordPress News" widget'
2418
- ));
2419
-
2420
- $this->print_checkbox(array(
2421
- 'hide'=>true,
2422
- 'name'=>'agca_dashboard_widget_secondary',
2423
- 'title'=>"This is 'Other WordPress News' widget by default",
2424
- 'label'=>'Secondary widget area'
2425
- ));
2426
-
2427
- ?>
2428
- </table>
2429
- </div>
2430
- <div id="section_login_page" style="display:none" class="ag_section">
2431
- <h2 class="section_title">Login Page Settings</h2>
2432
- <table class="form-table" width="500px">
2433
- <?php
2434
-
2435
- $this->print_options_h3('Login Page Options');
2436
-
2437
- $this->print_checkbox(array(
2438
- 'hide'=>true,
2439
- 'name'=>'agca_login_banner',
2440
- 'title'=>"Hide back to blog block",
2441
- 'label'=>'Back to blog text'
2442
- ));
2443
-
2444
- $this->print_textarea(array(
2445
- 'name'=>'agca_login_banner_text',
2446
- 'title'=>"Changes '<- Back to ...' text in top bar on Login page",
2447
- 'label'=>'Change back to blog text',
2448
- 'hint'=>'Should be wrapped with an anchor tag &lt;a&gt;&lt;/a&gt;'
2449
- ));
2450
-
2451
- $this->print_input(array(
2452
- 'title'=>'If this field is not empty, image from provided url will be visible on Login page',
2453
- 'name'=>'agca_login_photo_url',
2454
- 'label'=>'Change Login header image',
2455
- 'hint'=>'Image URL'
2456
- ));
2457
-
2458
- $this->print_input(array(
2459
- 'title'=>'Put here custom link to a web location, that will be triggered on image click',
2460
- 'name'=>'agca_login_photo_href',
2461
- 'label'=>'Change link on login image',
2462
- 'hint'=>'For blog URL use %BLOG%'
2463
- ));
2464
-
2465
- $this->print_checkbox(array(
2466
- 'hide'=>true,
2467
- 'title'=>'Hides login image completely',
2468
- 'name'=>'agca_login_photo_remove',
2469
- 'label'=>'Login header image',
2470
- ));
2471
-
2472
- $this->print_checkbox(array(
2473
- 'title'=>'Rounds box on login page',
2474
- 'name'=>'agca_login_round_box',
2475
- 'label'=>'Round box corners',
2476
- 'input-class'=>'has-dependant',
2477
- 'input-attributes'=>'data-dependant="#agca_login_round_box_size_block"'
2478
- ));
2479
-
2480
- $this->print_input(array(
2481
- 'attributes'=>array(
2482
- 'style'=> ((get_option('agca_login_round_box')=='true')?'display:none':''),
2483
- 'id'=>'agca_login_round_box_size_block'
2484
- ),
2485
- 'title'=>'Size of rounded box curve',
2486
- 'name'=>'agca_login_round_box_size',
2487
- 'label'=>'Round box corners - size',
2488
- 'input-class'=>'validateNumber',
2489
- 'hint'=>'(Size in px)'
2490
- ));
2491
-
2492
- $this->print_checkbox(array(
2493
- 'hide'=>true,
2494
- 'title'=>'Hides register link on login page',
2495
- 'name'=>'agca_login_register_remove',
2496
- 'label'=>'Register link',
2497
- 'input-class'=>'has-dependant dependant-opposite',
2498
- 'input-attributes'=>'data-dependant="#agca_login_register_href_block"'
2499
- ));
2500
-
2501
- $this->print_input(array(
2502
- 'attributes'=>array(
2503
- 'style'=> ((get_option('agca_login_register_remove')=='true')?'display:none':''),
2504
- 'id'=>'agca_login_register_href_block'
2505
- ),
2506
- 'title'=>'Change register link on login page to point to your custom registration page.',
2507
- 'name'=>'agca_login_register_href',
2508
- 'label'=>'Change register link',
2509
- 'hint'=>'Link to new registration page'
2510
- ));
2511
-
2512
- $this->print_checkbox(array(
2513
- 'hide'=>true,
2514
- 'title'=>'Hides lost password link on login page',
2515
- 'name'=>'agca_login_lostpassword_remove',
2516
- 'label'=>'Lost password link',
2517
- ));
2518
- ?>
2519
- </table>
2520
- </div>
2521
- <?php
2522
- /*ADMIN MENU*/
2523
- ?>
2524
- <div id="section_admin_menu" style="display:none" class="ag_section">
2525
- <h2 class="section_title">Admin Menu Settings</h2>
2526
- <table class="form-table" width="500px">
2527
- <tr valign="center" class="ag_table_major_options">
2528
- <td><label for="agca_admin_menu_turnonoff"><strong>Apply admin menu customizations</strong></label></td>
2529
- <td>
2530
- <strong>
2531
-
2532
- <input class="agca-radio" type="radio" id="agca_admin_menu_turnonoff_on" name="agca_admin_menu_turnonoff" title="Apply admin menu customizations" value="on" <?php if(get_option('agca_admin_menu_turnonoff') == 'on') echo 'checked="checked" '; ?> />
2533
- <span class="agca-radio-text on">YES</span>
2534
- &nbsp;&nbsp;&nbsp;&nbsp;
2535
- <input class="agca-radio" type="radio" name="agca_admin_menu_turnonoff" title="Do not apply admin menu customizations" value="off" <?php if(get_option('agca_admin_menu_turnonoff') != 'on') echo 'checked="checked"'; ?> />
2536
- <span class="agca-radio-text off">NO</span>
2537
- </strong>
2538
- </td>
2539
- </tr>
2540
- <tr valign="center" class="ag_table_major_options">
2541
- <td><label for="agca_admin_menu_agca_button_only"><strong>Admin menu</strong></label></td>
2542
- <td><input class="agca-checkbox visibility" type="checkbox" name="agca_admin_menu_agca_button_only" title="Hides admin menu completly (administrator can see 'AG custom admin' button)" value="true" <?php if (get_option('agca_admin_menu_agca_button_only')==true) echo 'checked="checked" '; ?> /></td>
2543
- </tr>
2544
- <?php
2545
- $this->print_options_h3('Edit / Remove Menu Items');
2546
- ?>
2547
- <tr>
2548
- <td colspan="2">
2549
- <input type="button" class="agca_button" id="ag_edit_adminmenu_reset_button" title="Reset menu settings to default values" name="ag_edit_adminmenu_reset_button" value="Reset to default settings" /><br />
2550
- <p tabindex="0"><em>(click on the top menu item to show its sub-menus)</em></p>
2551
- <table id="ag_edit_adminmenu">
2552
- <tr style="background-color:#999;">
2553
- <td width="300px"><div style="float:left;color:#fff;"><h3>Item</h3></div><div style="float:right;color:#fff;"><h3>Visibility</h3></div></td><td width="300px" style="color:#fff;" ><h3>Change Text</h3>
2554
- </td>
2555
- </tr>
2556
- </table>
2557
- <input type="hidden" size="47" id="ag_edit_adminmenu_json" name="ag_edit_adminmenu_json" value="<?php echo htmlspecialchars(get_option('ag_edit_adminmenu_json')); ?>" />
2558
- <input type="hidden" size="47" id="ag_edit_adminmenu_json_new" name="ag_edit_adminmenu_json_new" value="" />
2559
- </td>
2560
- <td></td>
2561
- </tr>
2562
- <?php
2563
- $this->print_options_h3('Add New Menu Items');
2564
- ?>
2565
- <tr>
2566
- <td colspan="2">
2567
- <table id="ag_add_adminmenu">
2568
- <tr>
2569
- <td colspan="2">
2570
- name:<input type="text" size="47" title="New button visible name" id="ag_add_adminmenu_name" name="ag_add_adminmenu_name" />
2571
- url:<input type="text" size="47" title="New button link" id="ag_add_adminmenu_url" name="ag_add_adminmenu_url" />
2572
- open in:<select id="ag_add_adminmenu_target" class="agca-selectbox" style="width:95px">
2573
- <option value="_self" selected>same tab</option>
2574
- <option value="_blank" >new tab</option>
2575
- </select>
2576
- <input type="button" id="ag_add_adminmenu_button" class="agca_button" title="Add new item button" name="ag_add_adminmenu_button" value="Add new item" />
2577
- </td><td></td>
2578
- </tr>
2579
- </table>
2580
- <input type="hidden" size="47" id="ag_add_adminmenu_json" name="ag_add_adminmenu_json" value="<?php echo htmlspecialchars(get_option('ag_add_adminmenu_json')); ?>" />
2581
- </td>
2582
- <td>
2583
- </td>
2584
- </tr>
2585
- <?php
2586
- $this->print_options_h3('Admin Menu Settings');
2587
- ?>
2588
- <tr valign="center">
2589
- <th scope="row">
2590
- <label title="Choose how admin menu should behave on mobile devices / small screens" for="agca_admin_menu_autofold">Admin menu auto folding</label>
2591
- </th>
2592
- <td>
2593
- <select title="Choose how admin menu should behave on mobile devices / small screens" class="agca-selectbox" name="agca_admin_menu_autofold" >
2594
- <option value="" <?php echo (get_option('agca_admin_menu_autofold') == "")?" selected ":""; ?> >Default</option>
2595
- <option value="force" <?php echo (get_option('agca_admin_menu_autofold') == "force")?" selected ":""; ?> >Force admin menu auto-folding</option>
2596
- <option value="disable" <?php echo (get_option('agca_admin_menu_autofold') == "disable")?" selected ":""; ?> >Disable admin menu auto-folding</option>
2597
- </select>
2598
- </td>
2599
- </tr>
2600
- <?php
2601
-
2602
- $this->print_checkbox(array(
2603
- 'hide'=>true,
2604
- 'title'=>'Removes empty space between some top menu items',
2605
- 'name'=>'agca_admin_menu_separators',
2606
- 'label'=>'Menu items separators',
2607
- ));
2608
-
2609
- $this->print_checkbox(array(
2610
- 'hide'=>true,
2611
- 'title'=>'Removes icons from dmin menu buttons',
2612
- 'name'=>'agca_admin_menu_icons',
2613
- 'label'=>'Menu icons',
2614
- ));
2615
-
2616
- $this->print_checkbox(array(
2617
- 'hide'=>true,
2618
- 'title'=>'Removes small arrow that appears on the top button hover',
2619
- 'name'=>'agca_admin_menu_arrow',
2620
- 'label'=>'Sub-menu arrow',
2621
- ));
2622
-
2623
- $this->print_checkbox(array(
2624
- 'hide'=>true,
2625
- 'title'=>'Removes collapse button at the end of admin menu',
2626
- 'name'=>'agca_admin_menu_collapse_button',
2627
- 'label'=>'"Collapse menu" button',
2628
- ));
2629
-
2630
- $this->print_checkbox(array(
2631
- 'title'=>'Rounds submenu pop-up box',
2632
- 'name'=>'agca_admin_menu_submenu_round',
2633
- 'label'=>'Round sub-menu pop-up box',
2634
- 'input-attributes'=>'data-dependant="#agca_admin_menu_submenu_round_size"',
2635
- 'input-class'=>'has-dependant',
2636
- ));
2637
-
2638
- $this->print_input(array(
2639
- 'attributes'=>array(
2640
- 'style'=> ((get_option('agca_admin_menu_submenu_round')!='true')?'display:none':''),
2641
- 'id'=>'agca_admin_menu_submenu_round_size'
2642
- ),
2643
- 'title'=>'Size of rounded box curve',
2644
- 'name'=>'agca_admin_menu_submenu_round_size',
2645
- 'label'=>'Round sub-menu pop-up box - size',
2646
- 'input-class'=>'validateNumber',
2647
- 'hint'=>'(Size in px)'
2648
- ));
2649
-
2650
- $this->print_input(array(
2651
- 'title'=>'Adds custom logo above the admin menu',
2652
- 'name'=>'agca_admin_menu_brand',
2653
- 'label'=>'Admin menu branding with logo',
2654
- 'hint'=>'Image URL'
2655
- ));
2656
-
2657
- $this->print_input(array(
2658
- 'title'=>'Change branding logo link</br></br>Use:</br><strong>%BLOG%</strong> - for blog URL',
2659
- 'name'=>'agca_admin_menu_brand_link',
2660
- 'label'=>'Branding logo link',
2661
- 'hint'=>'Branding image URL'
2662
- ));
2663
- ?>
2664
- </table>
2665
- </div>
2666
- <div id="section_ag_colorizer_settings" style="display:none" class="ag_section">
2667
- <h2 class="section_title">Colorizer Page</h2>
2668
- <table class="form-table" width="500px">
2669
- <tr valign="center" class="ag_table_major_options">
2670
- <td><label for="agca_colorizer_turnonoff"><strong>Apply Colorizer settings</strong></label></td>
2671
- <td><strong><input class="agca-radio" type="radio" name="agca_colorizer_turnonoff" title="Apply Colorizer customizations" value="on" <?php if(get_option('agca_colorizer_turnonoff') == 'on') echo 'checked="checked" '; ?> /><span class="agca-radio-text on">YES</span>&nbsp;&nbsp;&nbsp;&nbsp;<input class="agca-radio" type="radio" name="agca_colorizer_turnonoff" title="Do not apply Colorizer customizations" value="off" <?php if(get_option('agca_colorizer_turnonoff') != 'on') echo 'checked="checked"'; ?> /><span class="agca-radio-text off">NO</span></strong></td>
2672
- </tr>
2673
- <?php
2674
- $this->print_options_h3('Global Color Options');
2675
-
2676
- $this->print_color('color_background','Background:','Change admin page background color');
2677
- $this->print_color('login_color_background','Login page background:','Change login page background color');
2678
- $this->print_color('color_header','Admin bar:','Change admin bar (on top) color in admin panel');
2679
-
2680
- $this->print_options_h3('Admin Menu Color Options');
2681
-
2682
- $this->print_color('color_admin_menu_top_button_background','Button background:','Change button background color');
2683
- $this->print_color('color_admin_menu_font','Button text:','Change button text color');
2684
- $this->print_color('color_admin_menu_top_button_current_background','Selected button background:','Change button background color for current button');
2685
- $this->print_color('color_admin_menu_top_button_hover_background','Hover button background:','Change button background color on mouseover');
2686
- $this->print_color('color_admin_menu_submenu_background','Sub-menu button background:','Change submenu item background color');
2687
- $this->print_color('color_admin_menu_submenu_background_hover','Sub-menu hover button background:','Change submenu item background color on mouseover');
2688
- $this->print_color('color_admin_submenu_font','Sub-menu text:','Sub-menu text color');
2689
- $this->print_color('color_admin_menu_behind_background','Wrapper background:','Change background color of element behind admin menu');
2690
-
2691
- $this->print_options_h3('Font Color Options');
2692
-
2693
- $this->print_color('color_font_content','Content text:','Change color in content text');
2694
- $this->print_color('color_font_header','Admin bar text:','Change color of admin bar text');
2695
- $this->print_color('color_font_footer','Footer text:','Change color in fotter text');
2696
-
2697
- $this->print_options_h3('Widgets Color Options');
2698
-
2699
- $this->print_color('color_widget_bar','Title bar background:','Change color in header text');
2700
- $this->print_color('color_widget_background','Background:','Change widget background color');
2701
-
2702
- ?>
2703
- </table>
2704
- <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json" value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>" />
2705
- <div id="picker"></div>
2706
- </div>
2707
- <div id="section_templates" style="display:none" class="ag_section">
2708
- <h2 class="section_title"><span style="float:left">Admin Themes</span></h2>
2709
- <table class="form-table" width="500px">
2710
- <tr valign="center">
2711
- <td>
2712
- <div id="agca_templates"></div>
2713
- </td>
2714
- </tr>
2715
- <tr>
2716
- <td>
2717
- <div id="advanced_template_options" style="display:none">
2718
- <div class="agca-feedback-and-support">
2719
- <ul>
2720
- <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=theme" title="If you have any ideas for theme improvements, or you have new themes requests, please feel free to send us a message" target="_blank"><span class="dashicons dashicons-art"></span>&nbsp;&nbsp;Submit your admin themes ideas</a></li>
2721
- <li><a style="background: #f08080;color:#fff;" href="javascript:agca_removeAllTemplates();" title="WARNING: All installed themes will be removed. To activate them again, you would need to install theme and activate using valid license keys. Free themes can be installed again."><span style="color:#fff" class="dashicons dashicons-trash"></span>&nbsp;&nbsp;Uninstall all installed themes</a></li>
2722
- </ul>
2723
- </div>
2724
- </div>
2725
- </td>
2726
- </tr>
2727
- </table>
2728
- </div>
2729
- <div id="section_advanced" style="display:none" class="ag_section">
2730
- <h2 class="section_title">Advanced</h2>
2731
- <table class="form-table" width="500px">
2732
- <tr valign="center">
2733
- <td colspan="2">
2734
- <p class="agca-tip"><i><strong>Note: </strong>These options will override existing customizations</i></p>
2735
- </td><td></td>
2736
- </tr>
2737
- <tr valign="center">
2738
- <th scope="row">
2739
- <label title="Add custom CSS script to override existing styles" for="agca_script_css">Custom CSS script</em></label>
2740
- </th>
2741
- <td>
2742
- <textarea style="width:100%;height:200px" title="Add custom CSS script to override existing styles" rows="5" id="agca_custom_css" name="agca_custom_css" cols="40"><?php echo htmlspecialchars(get_option('agca_custom_css')); ?></textarea>
2743
- </td>
2744
- </tr>
2745
- <tr valign="center">
2746
- <th scope="row">
2747
- <label title="Add additional custom JavaScript" for="agca_custom_js">Custom JavaScript</label>
2748
- </th>
2749
- <td>
2750
- <textarea style="width:100%;height:200px" title="Add additional custom JavaScript" rows="5" name="agca_custom_js" id="agca_custom_js" cols="40"><?php echo htmlspecialchars(get_option('agca_custom_js')); ?></textarea>
2751
- </td>
2752
- </tr>
2753
- <tr valign="center">
2754
- <th scope="row">
2755
- <label title="Export / import settings" for="agca_export_import">Export / import settings</label>
2756
- </th>
2757
- <td id="import_file_area">
2758
- <input class="agca_button" type="button" name="agca_export_settings" value="Export Settings" onclick="exportSettings();"/></br>
2759
- <input type="file" id="settings_import_file" name="settings_import_file" style="display: none"/>
2760
- <input type="hidden" id="_agca_import_settings" name="_agca_import_settings" value="false" />
2761
- <input type="hidden" id="_agca_export_settings" name="_agca_export_settings" value="false" />
2762
- <input class="agca_button" type="button" name="agca_import_settings" value="Import Settings" onclick="importSettings();"/>
2763
- </td>
2764
- </tr>
2765
- </table>
2766
- </div>
2767
- <p class="submit">
2768
- <input type="button" id="save_plugin_settings" style="padding:0px" title="Save AG Custom Admin configuration" class="button-primary" value="<?php _e('Save Changes') ?>" onClick="savePluginSettings()" />
2769
- </p>
2770
-
2771
- </form>
2772
- <form id="agca_templates_form" name="agca_templates_form" action="<?php echo $_SERVER['PHP_SELF'];?>?page=ag-custom-admin/plugin.php" method="post">
2773
- <input type="hidden" name="_agca_save_template" value="true" />
2774
- <input type="hidden" id="templates_data" name="templates_data" value="" />
2775
- <input type="hidden" id="templates_name" name="templates_name" value="" />
2776
- </form>
2777
- </div>
2778
- <?php
2779
- }
2780
-
2781
- #region PRIVATE METHODS
2782
- function print_checkbox($data){
2783
- $strAttributes = '';
2784
- $strOnchange = '';
2785
- $strInputClass='';
2786
- $strInputAttributes='';
2787
- $isChecked = false;
2788
-
2789
- if(isset($data['attributes'])){
2790
- foreach($data['attributes'] as $key=>$val){
2791
- $strAttributes.=' '.$key.'="'.$val.'"';
2792
- }
2793
- }
2794
- if(isset($data['input-class'])){
2795
- $strInputClass = $data['input-class'];
2796
- }
2797
- if(isset($data['hide'])){
2798
- $strInputClass .= " visibility";
2799
- }
2800
- if(isset($data['input-attributes'])){
2801
- $strInputAttributes = $data['input-attributes'];
2802
- }
2803
- if(isset($data['onchange'])){
2804
- $strOnchange = $data['onchange'];
2805
- }
2806
- if(!isset($data['title'])){
2807
- $data['title'] = $data['label'];
2808
- }
2809
- if(isset($data['checked'])){
2810
- $isChecked = $data['checked'];
2811
- }else{
2812
- //use default check with the option
2813
- $isChecked = get_option($data['name'])==true;
2814
- }
2815
- ?>
2816
- <tr valign="center" <?= $strAttributes ?> >
2817
- <th>
2818
- <label tabindex="0" title='<?= $data['title'] ?>' for="<?= $data['name'] ?>" ><?= $data['label'] ?></label>
2819
- </th>
2820
- <td>
2821
- <input type="checkbox" class="agca-checkbox <?= $strInputClass ?> " <?= $strOnchange ?> <?= $strInputAttributes ?> title='Toggle on/off' name="<?= $data['name'] ?>" value="true" <?= ($isChecked)?' checked="checked"':'' ?> />
2822
- </td>
2823
- </tr>
2824
- <?php
2825
- }
2826
- function print_input($data){
2827
- $strHint = '';
2828
- $suffix ='';
2829
- $strAttributes = '';
2830
- $parentAttr = '';
2831
- if(isset($data['hint'])){
2832
- $strHint = '&nbsp;<p><i>'.$data['hint'].'</i></p>';
2833
- }
2834
- if(!isset($data['title'])){
2835
- $data['title'] = $data['label'];
2836
- }
2837
- if(isset($data['suffix'])){
2838
- $suffix = $data['suffix'];
2839
- }
2840
- if(isset($data['attributes'])){
2841
- foreach($data['attributes'] as $key=>$val){
2842
- $strAttributes.=' '.$key.'="'.$val.'"';
2843
- }
2844
- }
2845
- ?>
2846
- <tr valign="center" <?= $strAttributes ?> >
2847
- <th >
2848
- <label title="<?= $data['title'] ?>" for="<?= $data['name'] ?>"><?= $data['label'] ?></label>
2849
- </th>
2850
- <td>
2851
- <input id="<?= $data['name'] ?>" title="<?= $data['title'] ?>" type="text" size="47" name="<?= $data['name'] ?>" value="<?php echo get_option($data['name']); ?>" />
2852
- <a title="Clear" class="agca_button clear" onClick="jQuery('#<?= $data['name'] ?>').val('');"><span class="dashicons clear dashicons-no-alt"></span></a><?= $suffix ?>
2853
- <?= $strHint ?>
2854
- </td>
2855
- </tr>
2856
- <?php
2857
- }
2858
- function print_textarea($data){
2859
- $strHint = '';
2860
- if(isset($data['hint'])){
2861
- $strHint = '&nbsp;<p><i>'.$data['hint'].'</i>.</p>';
2862
- }
2863
- if(!isset($data['title'])){
2864
- $data['title'] = $data['label'];
2865
- }
2866
- ?>
2867
- <tr valign="center">
2868
- <th scope="row">
2869
- <label title="<?= $data['title'] ?>" for="<?= $data['name'] ?>"><?= $data['label'] ?></label>
2870
- </th>
2871
- <td>
2872
- <textarea title="<?= $data['title'] ?>" rows="5" name="<?= $data['name'] ?>" cols="40"><?php echo htmlspecialchars(get_option($data['name'])); ?></textarea>
2873
- <?= $strHint ?>
2874
- </td>
2875
- </tr>
2876
- <?php
2877
- }
2878
- function print_color($name, $label, $title){
2879
- ?>
2880
- <tr valign="center" class="color">
2881
- <th><label title="<?= $title ?>" for="<?= $name ?>"><?= $label ?></label></th>
2882
- <td><input type="text" id="<?= $name ?>" name="<?= $name ?>" class="color_picker" value="<?php echo $this->getAGCAColor($name); ?>" />
2883
- <a title="Pick Color" alt="<?= $name ?>" class="pick_color_button agca_button"><span class="dashicons dashicons-art"></span></a>
2884
- <a title="Clear" alt="<?= $name ?>" class="pick_color_button_clear agca_button" ><span class="dashicons clear dashicons-no-alt"></span></a>
2885
- </td>
2886
- </tr>
2887
- <?php
2888
- }
2889
- function print_options_h3($title){
2890
- ?>
2891
- <tr valign="center">
2892
- <td colspan="2">
2893
- <div class="ag_table_heading"><h3 tabindex="0"><?= $title ?></h3></div>
2894
- </td>
2895
- <td></td>
2896
- </tr>
2897
- <?php
2898
- }
2899
- function print_option_tr(){
2900
- ?>
2901
-
2902
- <tr valign="center">
2903
- <th><label title="Change submenu item background color" for="color_admin_menu_submenu_background">Submenu button background color:</label></th>
2904
- <td><input type="text" id="color_admin_menu_submenu_background" name="color_admin_menu_submenu_background" class="color_picker" value="<?php echo $this->getAGCAColor('color_admin_menu_submenu_background'); ?>" />
2905
- <input type="button" alt="color_admin_menu_submenu_background" class="pick_color_button agca_button" value="Pick color" />
2906
- <input type="button" alt="color_admin_menu_submenu_background" class="pick_color_button_clear agca_button" value="Clear" />
2907
- </td>
2908
- </tr>
2909
- <?php
2910
- }
2911
- #endregion
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2912
 
2913
  }
 
2914
  ?>
4
  Plugin URI: http://wordpressadminpanel.com/ag-custom-admin/
5
  Description: All-in-one tool for admin panel customization. Change almost everything: admin menu, dashboard, login page, admin bar etc. Apply admin panel themes.
6
  Author: WAP
7
+ Version: 1.5.3
8
  Author URI: http://www.wordpressadminpanel.com/
9
 
10
  Copyright 2015. WAP (email : info@wordpressadminpanel.com)
22
  You should have received a copy of the GNU General Public License
23
  along with this program. If not, see <http://www.gnu.org/licenses/>.
24
  */
25
+
26
  $agca = new AGCA();
27
 
28
+ class AGCA
29
+ {
30
+ private $colorizer = "";
31
+ private $active_plugin;
32
+ private $agca_version;
33
+ private $agca_debug = false;
34
+ private $admin_capabilities;
35
  private $context = "";
36
+ private $saveAfterImport = false;
37
+ private $templateCustomizations = "";
38
+ private $templates_ep = "http://wordpressadminpanel.com/configuration.php";
39
+
40
+ public function __construct()
41
+ {
42
+ $this->reloadScript();
43
+ $this->checkPOST();
44
+ $this->checkGET();
45
+
46
+ if (function_exists("add_filter")) {
47
+ add_filter('admin_title', array(&$this, 'change_title'), 10, 2);
48
+ add_filter('plugin_row_meta', array(&$this, 'jk_filter_plugin_links'), 10, 2);
49
+ }
50
+
51
+ add_action('admin_init', array(&$this, 'agca_register_settings'));
52
+ add_action('admin_init', array(&$this, 'agca_init_session'));
53
+ add_action('admin_head', array(&$this, 'print_admin_css'));
54
+ add_action('login_head', array(&$this, 'print_login_head'));
55
+ add_action('admin_menu', array(&$this, 'agca_create_menu'));
56
+ add_action('wp_head', array(&$this, 'print_page'));
57
+ add_action('wp_before_admin_bar_render', array(&$this, 'admin_bar_changes'));
58
+ register_deactivation_hook(__FILE__, array(&$this, 'agca_deactivate'));
59
+
60
+ add_action('customize_controls_enqueue_scripts', array(&$this, 'agca_customizer_php'));
61
+
62
+ /*Initialize properties*/
63
+ $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'), 'colorizer');
64
+
65
+ $this->agca_version = "1.5.3";
66
+
67
+ //TODO:upload images programmatically
68
+ }
69
+
70
+ // Add donate and support information
71
+ function jk_filter_plugin_links($links, $file)
72
+ {
73
+ if ($file == plugin_basename(__FILE__)) {
74
+ $links[] = '<a href="tools.php?page=ag-custom-admin/plugin.php">' . __('Settings') . '</a>';
75
+ $links[] = '<a href="tools.php?page=ag-custom-admin/plugin.php#ag-templates">' . __('Admin Themes') . '</a>';
76
+ $links[] = '<a href="http://wordpressadminpanel.com/agca-support/">' . __('Support') . '</a>';
77
+ $links[] = '<a href="http://wordpressadminpanel.com/agca-support/support-for-future-development">' . __('Donate') . '</a>';
78
+ }
79
+ return $links;
80
+ }
81
+
82
+ function change_admin_color()
83
+ {
84
+ return 'default';
85
+ }
86
+
87
+ function agca_customizer_php()
88
+ {
89
+ $this->agca_get_includes();
90
+ }
91
+
92
+ function agca_init_session()
93
+ {
94
+ if (!session_id())
95
+ session_start();
96
+ }
97
+
98
+ function checkGET()
99
+ {
100
+ if (isset($_GET['agca_action'])) {
101
+ if ($_GET['agca_action'] == "remove_templates") {
102
+ $this->delete_template_images_all();
103
+ update_option('agca_templates', "");
104
+ update_option('agca_selected_template', "");
105
+ }
106
+ }
107
+ if (isset($_GET['agca_debug'])) {
108
+ if ($_GET['agca_debug'] == "true") {
109
+ $this->agca_debug = true;
110
+ } else {
111
+ $this->agca_debug = false;
112
+ }
113
+ }
114
+ }
115
+
116
+ function checkPOST()
117
+ {
118
+
119
+ if (isset($_POST['_agca_save_template'])) {
120
+ //print_r($_POST);
121
+ $data = $_POST['templates_data'];
122
+ $parts = explode("|||", $data);
123
+
124
+ $common_data = $parts [0];
125
+ $admin_js = $parts [1];
126
+ $admin_css = $parts [2];
127
+ $login_js = $parts [3];
128
+ $login_css = $parts [4];
129
+ $settings = $parts [5];
130
+ $images = $parts [6];
131
+
132
+ $template_name = $_POST['templates_name'];
133
+
134
+ update_option('agca_selected_template', $template_name);
135
+
136
+ $templates = get_option('agca_templates');
137
+ if ($templates == "") {
138
+ $templates = array();
139
+ }
140
+
141
+ $templates[$template_name] = array(
142
+ 'common' => $common_data,
143
+ 'admin' => "",
144
+ 'adminjs' => $admin_js,
145
+ 'admincss' => $admin_css,
146
+ 'login' => "",
147
+ 'loginjs' => $login_js,
148
+ 'logincss' => $login_css,
149
+ 'images' => $images,
150
+ 'settings' => $settings
151
+ );
152
+ update_option('agca_templates', $templates);
153
+
154
+ $_POST = array();
155
+
156
+ } else if (isset($_POST['_agca_templates_session'])) {
157
+ $this->agcaAdminSession();
158
+ if ($_POST['template'] != "")
159
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = array("license" => $_POST['license']);
160
+
161
+ print_r($_SESSION);
162
+ echo "_agca_templates_session:OK";
163
+ exit;
164
+ } else if (isset($_POST['_agca_templates_session_remove_license'])) {
165
+ $this->agcaAdminSession();
166
+ if ($_POST['template'] != "")
167
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = null;
168
+ print_r($_SESSION);
169
+ echo "_agca_templates_session_remove_license:OK";
170
+ exit;
171
+ } else if (isset($_POST['_agca_get_templates'])) {
172
+ $templates = get_option('agca_templates');
173
+ if ($templates == "") $templates = array();
174
+ $results = array();
175
+ foreach ($templates as $key => $val) {
176
+ $results[] = $key;
177
+ }
178
+ echo json_encode($results);
179
+ exit;
180
+ } else if (isset($_POST['_agca_activate_template'])) {
181
+ update_option('agca_selected_template', $_POST['_agca_activate_template']);
182
+ $_POST = array();
183
+ //unset($_POST);
184
+ exit;
185
+ } else if (isset($_POST['_agca_template_settings'])) {
186
+ $settings = $_POST['_agca_template_settings'];
187
+
188
+ $templates = get_option('agca_templates');
189
+ if ($templates == "") {
190
+ $templates = array();
191
+ }
192
+ $template_name = $_POST["_agca_current_template"];
193
+
194
+ $templates[$template_name]["settings"] = $settings;
195
+ update_option('agca_templates', $templates);
196
+
197
+ $_POST = array();
198
+ //print_r($templates);
199
+ exit;
200
+ } else if (isset($_POST['_agca_upload_image'])) {
201
+ function my_sideload_image()
202
+ {
203
+ $remoteurl = $_POST['_agca_upload_image'];
204
+ $file = media_sideload_image($remoteurl, 0, "AG Custom Admin Template Image (do not delete)");
205
+ $fileparts = explode("src='", $file);
206
+ $url = explode("'", $fileparts[1]);
207
+ echo $url[0];
208
+ exit;
209
+ }
210
+
211
+ add_action('admin_init', 'my_sideload_image');
212
+
213
+ } else if (isset($_POST['_agca_remove_template_images'])) {
214
+ $this->delete_template_images($_POST['_agca_remove_template_images']);
215
+ exit;
216
+ }
217
+ }
218
+
219
+ function admin_bar_changes()
220
+ {
221
+ if (current_user_can('manage_options')) {
222
+ global $wp_admin_bar;
223
+ $wp_admin_bar->add_menu(array(
224
+ 'id' => 'agca-admin-themes',
225
+ 'title' => '<span class="ab-icon"></span>' . __('Admin Themes', 'agca-admin-themes'),
226
+ 'href' => 'tools.php?page=ag-custom-admin/plugin.php#ag-templates'
227
+ ));
228
+ }
229
+ }
230
+
231
+ function delete_template_images_all()
232
+ {
233
+ $templates = get_option('agca_templates');
234
+ if ($templates != null && $templates != "") {
235
+ foreach ($templates as $template) {
236
+ if ($template != null && $template['images'] != null && $template['images'] != "") {
237
+ //print_r($template['images']);
238
+ $imgs = explode(',', $template['images']);
239
+ foreach ($imgs as $imageSrc) {
240
+ $this->delete_attachment_by_src($imageSrc);
241
+ }
242
+ //print_r($imgs);
243
+ }
244
+ }
245
+ }
246
+ //print_r($templates);
247
+ }
248
+
249
+ function delete_template_images($template_name)
250
+ {
251
+ $templates = get_option('agca_templates');
252
+ if ($templates != null && $templates != "") {
253
+ $template = $templates[$template_name];
254
+ if ($template != null && $template['images'] != null && $template['images'] != "") {
255
+ //print_r($template['images']); exit;
256
+ $imgs = explode(',', $template['images']);
257
+ foreach ($imgs as $imageSrc) {
258
+ $this->delete_attachment_by_src($imageSrc);
259
+ }
260
+ //print_r($imgs);
261
+ }
262
+ }
263
+ //print_r($templates);
264
+ }
265
+
266
+ function delete_attachment_by_src($image_src)
267
+ {
268
+ global $wpdb;
269
+ $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
270
+ $id = $wpdb->get_var($query);
271
+ wp_delete_attachment($id, $true);
272
+ }
273
+
274
+ function get_installed_agca_templates()
275
+ {
276
+ $templates = get_option('agca_templates');
277
+ if ($templates == "") return '[]';
278
+ $results = array();
279
+ foreach ($templates as $key => $val) {
280
+ $results[] = $key;
281
+ }
282
+ return json_encode($results);
283
+ }
284
+
285
+ function isGuest()
286
+ {
287
+ global $user_login;
288
+ if ($user_login) {
289
+ return false;
290
+ } else {
291
+ return true;
292
+ }
293
+ }
294
+
295
+ function check_active_plugin()
296
+ {
297
+
298
+ $ozh = false;
299
+
300
+ if (is_plugin_active('ozh-admin-drop-down-menu/wp_ozh_adminmenu.php')) {
301
+ $ozh = true;
302
+ }
303
+
304
+ $this->active_plugin = array(
305
+ "ozh" => $ozh
306
+ );
307
+ }
308
+
309
+ function change_title($admin_title, $title)
310
+ {
311
+ //return get_bloginfo('name').' - '.$title;
312
+ if (get_option('agca_custom_title') != "") {
313
+ $blog = get_bloginfo('name');
314
+ $page = $title;
315
+ $customTitle = get_option('agca_custom_title');
316
+ $customTitle = str_replace('%BLOG%', $blog, $customTitle);
317
+ $customTitle = str_replace('%PAGE%', $page, $customTitle);
318
+ return $customTitle;
319
+ } else {
320
+ return $admin_title;
321
+ }
322
+ }
323
+
324
+ function agca_get_includes()
325
+ {
326
+ ?>
327
+ <script type="text/javascript">
328
+ <?php
329
+ //AGCA GLOBALS
330
+ echo "var agca_global_plugin_url = '" . trailingslashit(plugins_url(basename(dirname(__FILE__)))) . "';";
331
+ ?>
332
+ </script>
333
+ <link rel="stylesheet" type="text/css"
334
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/ag_style.css?ver=<?php echo $this->agca_version; ?>"/>
335
+ <link rel="stylesheet" type="text/css"
336
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>require/dynamic.php?type=css&context=<?php echo $this->context; ?>&ver=<?php echo "changed_theme"; ?>"/>
337
+ <script type="text/javascript"
338
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
339
+ <script type="text/javascript"
340
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>require/dynamic.php?type=js&context=<?php echo $this->context; ?>&ver=<?php echo "changed_theme"; ?>"></script>
341
+
342
+ <?php
343
+ if ($this->context == "login") {
344
+ ?>
345
+ <link rel="stylesheet" type="text/css"
346
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/login.min.css"/>
347
+ <?php
348
+ } else {
349
+ ?>
350
+ <link rel="stylesheet" type="text/css"
351
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/admin.min.css"/>
352
+ <?php
353
+ }
354
+ ?>
355
+ <?php
356
+ echo $this->templateCustomizations;
357
+
358
+ if (!((get_option('agca_role_allbutadmin') == true) and (current_user_can($this->admin_capability())))) {
359
+ ?>
360
+ <style type="text/css">
361
+ <?php
362
+ echo get_option('agca_custom_css');
363
  ?>
364
+ </style>
365
+ <script type="text/javascript">
366
+ try {
367
+ eval("<?php echo str_replace(array("\r\n", "\n", "\r"), ' ', get_option('agca_custom_js')); ?>");
368
+ } catch (e) {
369
+ alert('AG CUSTOM ADMIN : There is an error in your custom JS script. Please fix it: \n\n' + e + '\n\n (AG CUSTOM ADMIN -> Advanced -> Custom JavaScript)');
370
+ console.log(e);
371
+ }
372
+ </script>
373
+ <?php
374
+ }
375
+ }
376
+
377
+ function agca_enqueue_scripts()
378
+ {
379
+ wp_enqueue_script('jquery');
380
+ }
381
+
382
+ function reloadScript()
383
+ {
384
+ $isAdmin = false;
385
+ if (defined('WP_ADMIN') && WP_ADMIN == 1) {
386
+ $isAdmin = true;
387
+ }
388
+ if (in_array((isset($GLOBALS['pagenow']) ? $GLOBALS['pagenow'] : ""), array('wp-login.php', 'wp-register.php')) || $isAdmin) {
389
+ add_action('init', array(&$this, 'agca_enqueue_scripts'));
390
+ }
391
+ }
392
+
393
+ function agca_register_settings()
394
+ {
395
+ register_setting('agca-options-group', 'agca_role_allbutadmin');
396
+ register_setting('agca-options-group', 'agca_screen_options_menu');
397
+ register_setting('agca-options-group', 'agca_help_menu');
398
+ register_setting('agca-options-group', 'agca_logout');
399
+ register_setting('agca-options-group', 'agca_remove_your_profile');
400
+ register_setting('agca-options-group', 'agca_logout_only');
401
+ register_setting('agca-options-group', 'agca_custom_title');
402
+ register_setting('agca-options-group', 'agca_howdy');
403
+ register_setting('agca-options-group', 'agca_header');
404
+ register_setting('agca-options-group', 'agca_header_show_logout');
405
+ register_setting('agca-options-group', 'agca_footer');
406
+ register_setting('agca-options-group', 'agca_privacy_options');
407
+ register_setting('agca-options-group', 'agca_header_logo');
408
+ register_setting('agca-options-group', 'agca_header_logo_custom');
409
+ register_setting('agca-options-group', 'agca_wp_logo_custom');
410
+ register_setting('agca-options-group', 'agca_remove_site_link');
411
+ register_setting('agca-options-group', 'agca_wp_logo_custom_link');
412
+
413
+ register_setting('agca-options-group', 'agca_site_heading');
414
+ register_setting('agca-options-group', 'agca_custom_site_heading');
415
+ register_setting('agca-options-group', 'agca_update_bar');
416
+
417
+ register_setting('agca-options-group', 'agca_footer_left');
418
+ register_setting('agca-options-group', 'agca_footer_left_hide');
419
+ register_setting('agca-options-group', 'agca_footer_right');
420
+ register_setting('agca-options-group', 'agca_footer_right_hide');
421
+
422
+ register_setting('agca-options-group', 'agca_login_banner');
423
+ register_setting('agca-options-group', 'agca_login_banner_text');
424
+ register_setting('agca-options-group', 'agca_login_photo_remove');
425
+ register_setting('agca-options-group', 'agca_login_photo_url');
426
+ register_setting('agca-options-group', 'agca_login_photo_href');
427
+ register_setting('agca-options-group', 'agca_login_round_box');
428
+ register_setting('agca-options-group', 'agca_login_round_box_size');
429
+
430
+ register_setting('agca-options-group', 'agca_dashboard_icon');
431
+ register_setting('agca-options-group', 'agca_dashboard_text');
432
+ register_setting('agca-options-group', 'agca_dashboard_text_paragraph');
433
+ register_setting('agca-options-group', 'agca_dashboard_widget_welcome');
434
+ register_setting('agca-options-group', 'agca_dashboard_widget_activity');
435
+ register_setting('agca-options-group', 'agca_dashboard_widget_il');
436
+ register_setting('agca-options-group', 'agca_dashboard_widget_plugins');
437
+ register_setting('agca-options-group', 'agca_dashboard_widget_qp');
438
+ register_setting('agca-options-group', 'agca_dashboard_widget_rn');
439
+ register_setting('agca-options-group', 'agca_dashboard_widget_rd');
440
+ register_setting('agca-options-group', 'agca_dashboard_widget_primary');
441
+ register_setting('agca-options-group', 'agca_dashboard_widget_secondary');
442
+
443
+ //WP3.3
444
+ register_setting('agca-options-group', 'agca_admin_bar_comments');
445
+ register_setting('agca-options-group', 'agca_admin_bar_new_content');
446
+ register_setting('agca-options-group', 'agca_admin_bar_new_content_post');
447
+ register_setting('agca-options-group', 'agca_admin_bar_new_content_link');
448
+ register_setting('agca-options-group', 'agca_admin_bar_new_content_page');
449
+ register_setting('agca-options-group', 'agca_admin_bar_new_content_user');
450
+ register_setting('agca-options-group', 'agca_admin_bar_new_content_media');
451
+ register_setting('agca-options-group', 'agca_admin_bar_update_notifications');
452
+ register_setting('agca-options-group', 'agca_admin_bar_admin_themes');
453
+ register_setting('agca-options-group', 'agca_remove_top_bar_dropdowns');
454
+ register_setting('agca-options-group', 'agca_admin_bar_frontend');
455
+ register_setting('agca-options-group', 'agca_admin_bar_frontend_hide');
456
+ register_setting('agca-options-group', 'agca_login_register_remove');
457
+ register_setting('agca-options-group', 'agca_login_register_href');
458
+ register_setting('agca-options-group', 'agca_login_lostpassword_remove');
459
+ register_setting('agca-options-group', 'agca_admin_capability');
460
+ register_setting('agca-options-group', 'agca_disablewarning');
461
+ register_setting('agca-template-group', 'agca_selected_template');
462
+ register_setting('agca-template-group', 'agca_templates');
463
+ //delete_option( 'agca_templates' );
464
+
465
+
466
+ /*Admin menu*/
467
+ register_setting('agca-options-group', 'agca_admin_menu_turnonoff');
468
+ register_setting('agca-options-group', 'agca_admin_menu_agca_button_only');
469
+ register_setting('agca-options-group', 'agca_admin_menu_separators');
470
+ register_setting('agca-options-group', 'agca_admin_menu_icons');
471
+ register_setting('agca-options-group', 'agca_admin_menu_collapse_button');
472
+ register_setting('agca-options-group', 'agca_admin_menu_arrow');
473
+ register_setting('agca-options-group', 'agca_admin_menu_submenu_round');
474
+ register_setting('agca-options-group', 'agca_admin_menu_submenu_round_size');
475
+ register_setting('agca-options-group', 'agca_admin_menu_brand');
476
+ register_setting('agca-options-group', 'agca_admin_menu_brand_link');
477
+ register_setting('agca-options-group', 'agca_admin_menu_autofold');
478
+ register_setting('agca-options-group', 'ag_edit_adminmenu_json');
479
+ register_setting('agca-options-group', 'ag_edit_adminmenu_json_new');
480
+ register_setting('agca-options-group', 'ag_add_adminmenu_json');
481
+ register_setting('agca-options-group', 'ag_colorizer_json');
482
+ register_setting('agca-options-group', 'agca_colorizer_turnonoff');
483
+
484
+ register_setting('agca-options-group', 'agca_custom_js');
485
+ register_setting('agca-options-group', 'agca_custom_css');
486
+
487
+
488
+ if (!empty($_POST)) {
489
+ // fb($_POST);
490
+ if (isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings'] == "true") {
491
+ if (isset($_FILES) && isset($_FILES['settings_import_file'])) {
492
+ if ($_FILES["settings_import_file"]["error"] > 0) {
493
+ } else {
494
+ $file = $_FILES['settings_import_file'];
495
+ if ($this->startsWith($file['name'], 'AGCA_Settings')) {
496
+ if (file_exists($file['tmp_name'])) {
497
+ $fh = fopen($file['tmp_name'], 'r');
498
+ $theData = "";
499
+ if (filesize($file['tmp_name']) > 0) {
500
+ $theData = fread($fh, filesize($file['tmp_name']));
501
+ }
502
+ fclose($fh);
503
+ $this->importSettings($theData);
504
  }
505
+ }
506
+ }
507
+ }
508
+ } else if (isset($_POST['_agca_export_settings']) && $_POST['_agca_export_settings'] == "true") {
509
+ $this->exportSettings();
510
+ }
511
+ }
512
+
513
+ if (isset($_GET['agca_action'])) {
514
+ if ($_GET['agca_action'] == "disablewarning") {
515
+ update_option('agca_disablewarning', true);
516
+ }
517
+ }
518
+ }
519
+
520
+ function agca_deactivate()
521
+ {
522
+
523
+ }
524
+
525
+ function getOptions()
526
+ {
527
+ return Array(
528
+ 'agca_role_allbutadmin',
529
+ 'agca_admin_bar_frontend',
530
+ 'agca_admin_bar_frontend_hide',
531
+ 'agca_login_register_remove',
532
+ 'agca_login_register_href',
533
+ 'agca_login_lostpassword_remove',
534
+ 'agca_admin_capability',
535
+ 'agca_screen_options_menu',
536
+ 'agca_help_menu',
537
+ 'agca_logout',
538
+ 'agca_remove_your_profile',
539
+ 'agca_logout_only',
540
+ 'agca_custom_title',
541
+ 'agca_howdy',
542
+ 'agca_header',
543
+ 'agca_header_show_logout',
544
+ 'agca_footer',
545
+ 'agca_privacy_options',
546
+ 'agca_header_logo',
547
+ 'agca_header_logo_custom',
548
+ 'agca_remove_site_link',
549
+ 'agca_wp_logo_custom',
550
+ 'agca_wp_logo_custom_link',
551
+ 'agca_site_heading',
552
+ 'agca_custom_site_heading',
553
+ 'agca_update_bar',
554
+ 'agca_footer_left',
555
+ 'agca_footer_left_hide',
556
+ 'agca_footer_right',
557
+ 'agca_footer_right_hide',
558
+ 'agca_login_banner',
559
+ 'agca_login_banner_text',
560
+ 'agca_login_photo_remove',
561
+ 'agca_login_photo_url',
562
+ 'agca_login_photo_href',
563
+ 'agca_login_round_box',
564
+ 'agca_login_round_box_size',
565
+ 'agca_dashboard_icon',
566
+ 'agca_dashboard_text',
567
+ 'agca_dashboard_text_paragraph',
568
+ 'agca_dashboard_widget_welcome',
569
+ 'agca_dashboard_widget_activity',
570
+ 'agca_dashboard_widget_il',
571
+ 'agca_dashboard_widget_plugins',
572
+ 'agca_dashboard_widget_qp',
573
+ 'agca_dashboard_widget_rn',
574
+ 'agca_dashboard_widget_rd',
575
+ 'agca_dashboard_widget_primary',
576
+ 'agca_dashboard_widget_secondary',
577
+ 'agca_admin_bar_comments',
578
+ 'agca_admin_bar_new_content',
579
+ 'agca_admin_bar_new_content_post',
580
+ 'agca_admin_bar_new_content_link',
581
+ 'agca_admin_bar_new_content_page',
582
+ 'agca_admin_bar_new_content_user',
583
+ 'agca_admin_bar_new_content_media',
584
+ 'agca_admin_bar_update_notifications',
585
+ 'agca_admin_bar_admin_themes',
586
+ 'agca_remove_top_bar_dropdowns',
587
+ 'agca_admin_menu_turnonoff',
588
+ 'agca_admin_menu_agca_button_only',
589
+ 'agca_admin_menu_separators',
590
+ 'agca_admin_menu_icons',
591
+ 'agca_admin_menu_arrow',
592
+ 'agca_admin_menu_submenu_round',
593
+ 'agca_admin_menu_submenu_round_size',
594
+ 'agca_admin_menu_brand',
595
+ 'agca_admin_menu_brand_link',
596
+ 'agca_admin_menu_autofold',
597
+ 'agca_admin_menu_collapse_button',
598
+ 'ag_edit_adminmenu_json',
599
+ 'ag_edit_adminmenu_json_new',
600
+ 'ag_add_adminmenu_json',
601
+ 'ag_colorizer_json',
602
+ 'agca_colorizer_turnonof',
603
+ 'agca_custom_js',
604
+ 'agca_custom_css',
605
+ 'agca_colorizer_turnonoff',
606
+ 'agca_disablewarning',
607
+ 'agca_selected_template',
608
+ 'agca_templates',
609
+ );
610
+ }
611
+
612
+ function getTextEditor($name)
613
+ {
614
+ $settings = array(
615
+ 'textarea_name' => $name,
616
+ 'media_buttons' => true,
617
+ 'tinymce' => array(
618
+ 'theme_advanced_buttons1' => 'formatselect,|,bold,italic,underline,|,' .
619
+ 'bullist,blockquote,|,justifyleft,justifycenter' .
620
+ ',justifyright,justifyfull,|,link,unlink,|' .
621
+ ',spellchecker,wp_fullscreen,wp_adv'
622
+ )
623
+ );
624
+ wp_editor(get_option($name), $name, $settings);
625
+ }
626
+
627
+ function importSettings($settings)
628
+ {
629
+ $exploaded = explode("|^|^|", $settings);
630
+ // $str = "EEE: ";
631
+
632
+ $savedOptions = array();
633
+
634
+ foreach ($exploaded as $setting) {
635
+
636
+ $key = current(explode(':', $setting));
637
+ $value = substr($setting, strlen($key) + 1);
638
+ $cleanedValue = str_replace('|^|^|', '', $value);
639
+ $savedOptions[$key] = $cleanedValue;
640
+ }
641
+
642
+ // print_r($savedOptions);
643
+
644
+ $optionNames = $this->getOptions();
645
+
646
+ foreach ($optionNames as $optionName) {
647
+ $optionValue = "";
648
+ $optionValue = $savedOptions[$optionName];
649
+
650
+ if ($optionName == "ag_edit_adminmenu_json" || "ag_edit_adminmenu_json_new" || $optionName == "ag_add_adminmenu_json" || $optionName == "ag_colorizer_json") {
651
+ $optionValue = str_replace("\\\"", "\"", $optionValue);
652
+ $optionValue = str_replace("\\\'", "\'", $optionValue);
653
+ } else if ($optionName == "agca_custom_js" || $optionName == "agca_custom_css") {
654
+ //fb($optionValue);
655
+ $optionValue = htmlspecialchars_decode($optionValue);
656
+ $optionValue = str_replace("\'", '"', $optionValue);
657
+ $optionValue = str_replace('\"', "'", $optionValue);
658
+ //fb($optionValue);
659
+ } else {
660
+
661
+ }
662
+ update_option($optionName, $optionValue);
663
+ $str .= "/" . $optionName . "/" . $optionValue . "\n";
664
+ }
665
+
666
+ //Migration from 1.2.6. to 1.2.5.1 - remove in later versions
667
+ //agca_script_css
668
+ //
669
+ // fb($savedOptions);
670
+ if ($savedOptions['agca_script_css'] != null) {
671
+ $optionValue = "";
672
+ $optionValue = str_replace("\'", '"', $savedOptions['agca_script_css']);
673
+ $optionValue = str_replace('\"', "'", $optionValue);
674
+ update_option('agca_custom_css', $optionValue);
675
+ }
676
+ if ($savedOptions['agca_script_js'] != null) {
677
+ $optionValue = "";
678
+ $optionValue = str_replace("\'", '"', $savedOptions['agca_script_js']);
679
+ $optionValue = str_replace('\"', "'", $optionValue);
680
+ update_option('agca_custom_js', $optionValue);
681
+ }
682
+
683
+ //echo $str;
684
+
685
+ //save imported settings
686
+ $this->saveAfterImport = true;
687
+ }
688
+
689
+ function exportSettings()
690
+ {
691
+ $str = "";
692
+
693
+ $include_menu_settings = false;
694
+ if (isset($_POST['export_settings_include_admin_menu'])) {
695
+ if ($_POST['export_settings_include_admin_menu'] == 'on') {
696
+ $include_menu_settings = true;
697
+ }
698
+ }
699
+
700
+ foreach ($_POST as $key => $value) {
701
+ if ($this->startsWith($key, 'ag') || $this->startsWith($key, 'color')) {
702
+ if ($this->startsWith($key, 'ag_edit_adminmenu')) {
703
+ if ($include_menu_settings) $str .= $key . ":" . $value . "|^|^|";
704
+ } else {
705
+ $str .= $key . ":" . $value . "|^|^|";
706
  }
707
+ }
708
+ }
709
+
710
+ $filename = 'AGCA_Settings_' . date("Y-M-d_H-i-s") . '.agca';
711
+ header("Cache-Control: public");
712
+ header("Content-Description: File Transfer");
713
+ header("Content-Disposition: attachment; filename=$filename");
714
+ header("Content-Type: text/plain; ");
715
+ header("Content-Transfer-Encoding: binary");
716
+ echo $str;
717
+ die();
718
+ }
719
+
720
+ function startsWith($haystack, $needle)
721
+ {
722
+ $length = strlen($needle);
723
+ return (substr($haystack, 0, $length) === $needle);
724
+ }
725
+
726
+
727
+ function agca_create_menu()
728
+ {
729
+ add_management_page('AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this, 'agca_admin_page'));
730
+ }
731
+
732
+ function agca_create_admin_button($name, $arr)
733
+ {
734
+
735
+ $href = $arr["value"];
736
+ $target = $arr["target"];
737
+ $button = "<li class=\"wp-not-current-submenu menu-top menu-top-last\" id=\"menu-$name\"><a href=\"$href\" target=\"$target\" class=\"wp-not-current-submenu menu-top\"><div class=\"wp-menu-arrow\"><div></div></div><div class=\"wp-menu-image dashicons-before dashicons-admin-$name\"><br></div><div class=\"wp-menu-name\">$name</div></a></li>";
738
+
739
+ return $button;
740
+ }
741
+
742
+ function agca_decode($code)
743
+ {
744
+ $code = str_replace("{", "", $code);
745
+ $code = str_replace("}", "", $code);
746
+ $code = str_replace("\", \"", "\"|||\"", $code);
747
+ $elements = explode("|||", $code);
748
+
749
+ return $elements;
750
+ }
751
+
752
+ function jsonMenuArray($json, $type)
753
+ {
754
+ $arr = explode("|", $json);
755
+ $elements = "";
756
+ $array = "";
757
+ $first = true;
758
+ //print_r($json);
759
+ if ($type == "colorizer") {
760
+ $elements = json_decode($arr[0], true);
761
+ if ($elements != "") {
762
+ return $elements;
763
+ }
764
+ } else if ($type == "buttons") {
765
+ $elements = json_decode($arr[0], true);
766
+ if ($elements != "") {
767
+ foreach ($elements as $k => $v) {
768
+ $array .= $this->agca_create_admin_button($k, $v);
769
  }
770
+ }
771
+ } else if ($type == "buttonsJq") {
772
+ $elements = json_decode($arr[0], true);
773
+ if ($elements != "") {
774
+ foreach ($elements as $k => $v) {
775
+ $array .= '<tr><td colspan="2"><button target="' . $v['target'] . '" title="' . $v['value'] . '" type="button">' . $k . '</button>&nbsp;<a style="cursor:pointer;" title="Edit" class="button_edit"><span class="dashicons dashicons-edit"></span></a>&nbsp;<a style="cursor:pointer" title="Delete" class="button_remove"><span class="dashicons dashicons-no"></span></a></td><td></td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
776
  }
777
  }
778
+ } else {
779
+ if (isset($arr[$type])) {
780
+ $elements = $this->agca_decode($arr[$type]);
781
+ }
782
 
783
+ if ($elements != "") {
784
+ foreach ($elements as $element) {
785
+ if (!$first) {
786
+ $array .= ",";
 
 
787
  }
788
+ $parts = explode(" : ", $element);
789
+ if (isset($parts[0]) && isset($parts[1])) {
790
+ $array .= "[" . $parts[0] . ", " . $parts[1] . "]";
791
+ }
792
+ $first = false;
793
+ }
794
  }
795
+ }
796
+
797
+ return $array;
798
+ }
799
+
800
+ function remove_dashboard_widget($widget, $side)
801
+ {
802
+ //side can be 'normal' or 'side'
803
+ global $wp_meta_boxes;
804
+ remove_meta_box($widget, 'dashboard', $side);
805
+ }
806
+
807
+ function get_wp_version()
808
+ {
809
+ global $wp_version;
810
+ $array = explode('-', $wp_version);
811
+ $version = $array[0];
812
+ return $version;
813
+ }
814
+
815
+ function print_page()
816
+ {
817
+ if ($this->isGuest() && get_option('agca_admin_bar_frontend_hide')) {
818
+ return false;
819
+ }
820
+
821
+ if (get_option('agca_admin_bar_frontend_hide') == true) {
822
+ add_filter('show_admin_bar', '__return_false');
823
+ ?>
824
+ <style type="text/css">
825
+ #wpadminbar {
826
+ display: none;
827
+ }
828
+ </style>
829
+ <script type="text/javascript">
830
+ window.setTimeout(function () {
831
+ document.getElementsByTagName('html')[0].setAttribute('style', "margin-top:0px !important");
832
+ }, 50);
833
+ </script>
834
+ <?php
835
+ }
836
+ if (get_option('agca_admin_bar_frontend') != true) {
837
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
838
  $this->context = "page";
839
  $wpversion = $this->get_wp_version();
840
 
841
+ ?>
842
+
843
+
844
+ <script type="text/javascript">
845
+ var wpversion = "<?php echo $wpversion; ?>";
846
+ var agca_version = "<?php echo $this->agca_version; ?>";
847
+ var agca_debug = <?php echo ($this->agca_debug) ? "true" : "false"; ?>;
848
+ var jQueryScriptOutputted = false;
849
+ var agca_context = "page";
850
+ var agca_orig_admin_menu = [];
851
+ function initJQuery() {
852
+ //if the jQuery object isn't available
853
+ if (typeof(jQuery) == 'undefined') {
854
+ if (!jQueryScriptOutputted) {
855
+ //only output the script once..
856
+ jQueryScriptOutputted = true;
857
+ //output the script (load it from google api)
858
+ document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></scr" + "ipt>");
 
 
 
 
 
 
 
 
 
 
 
 
 
859
  }
860
+ setTimeout("initJQuery()", 50);
861
+ } else {
862
+ jQuery(function () {
863
+ try {
864
+ <?php if(get_option('agca_header') != true){ ?>
865
+ jQuery('#wpadminbar').show();
866
+ <?php } ?>
867
+
868
+ <?php $this->print_admin_bar_scripts(); ?>
869
+ } catch (ex) {
870
+ }
871
+ });
872
  }
873
+ }
874
+ initJQuery();
875
+ </script>
876
+ <script type="text/javascript">
877
+ <?php echo "var agca_global_plugin_url = '" . trailingslashit(plugins_url(basename(dirname(__FILE__)))) . "';"; ?>
878
+ </script>
879
+ <script type="text/javascript"
880
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
881
+ <script type="text/javascript">
882
+ jQuery(document).ready(function () {
883
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on' && (get_option('agca_admin_bar_frontend_hide') != true)){
884
+ foreach($this->colorizer as $k => $v){
885
+ if(($k != "") and ($v != "")){
886
+ if(
887
+ $k == "color_header" ||
888
+ $k == "color_font_header"
889
+ ){
890
+ ?> updateTargetColor("<?php echo $k;?>", "<?php echo $v;?>"); <?php
891
+ }
892
+
893
+ }
894
+ }
895
+ ?>
896
+
 
 
 
897
  <?php
898
+ }
899
+ ?>
900
+ });
901
+ </script>
902
+ <?php
903
+ }
904
+
905
+ }
906
+
907
+ function print_admin_bar_scripts()
908
+ {
909
+ ?>
910
+ <?php if (get_option('agca_remove_top_bar_dropdowns') == true) { ?>
911
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-sub-wrapper").hide();
912
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-site-name .ab-sub-wrapper").hide();
913
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item").attr('title','');
914
+
915
+ <?php if (get_option('agca_admin_bar_new_content') != "") { ?>
916
+ jQuery(".new_content_header_submenu").hide();
917
+ <?php } ?>
918
+
919
+ <?php } ?>
920
+
921
+ <?php if (get_option('agca_admin_bar_comments') != "") { ?>
922
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-comments").css("display","none");
923
+ <?php } ?>
924
+ <?php if (get_option('agca_admin_bar_new_content') != "") { ?>
925
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content").css("display","none");
926
+ <?php } ?>
927
+ <?php if (get_option('agca_admin_bar_new_content_post') != "") { ?>
928
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-post").css("display","none");
929
+ <?php } ?>
930
+ <?php if (get_option('agca_admin_bar_new_content_link') != "") { ?>
931
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-link").css("display","none");
932
+ <?php } ?>
933
+ <?php if (get_option('agca_admin_bar_new_content_page') != "") { ?>
934
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-page").css("display","none");
935
+ <?php } ?>
936
+ <?php if (get_option('agca_admin_bar_new_content_user') != "") { ?>
937
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-user").css("display","none");
938
+ <?php } ?>
939
+ <?php if (get_option('agca_admin_bar_new_content_media') != "") { ?>
940
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-media").css("display","none");
941
+ <?php } ?>
942
+ <?php if (get_option('agca_admin_bar_update_notifications') != "") { ?>
943
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-updates").css("display","none");
944
+ <?php } ?>
945
+ <?php if (get_option('agca_admin_bar_admin_themes') != "") { ?>
946
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-agca-admin-themes").css("display","none");
947
+ <?php } ?>
948
+
949
+
950
+ <?php if (get_option('agca_header_logo') == true) { ?>
951
+ jQuery("#wphead #header-logo").css("display","none");
952
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-wp-logo").css("display","none");
953
+
954
+ <?php } ?>
955
+ <?php if (get_option('agca_header_logo_custom') != "") { ?>
956
+
957
+ var img_url = '<?php echo addslashes(get_option('agca_header_logo_custom')); ?>';
958
+
959
+ advanced_url = img_url;
960
+ image = jQuery("<img/>").attr("src",advanced_url);
961
+ jQuery(image).load(function() {
962
+ jQuery("#wpbody-content").prepend(image);
963
+ });
964
+
965
+ <?php } ?>
966
+ <?php if (get_option('agca_wp_logo_custom') != "") { ?>
967
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").html("<img style=\"height:28px;margin-top:-4px\"
968
+ src=\"<?php echo get_option('agca_wp_logo_custom'); ?>\"/>");
969
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('background-image','none');
970
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('width','auto');
971
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',"<?php echo get_bloginfo('wpurl'); ?>");
972
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item:before").attr('title','');
973
+ jQuery('body #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon').attr('class','ab-icon2');
974
+ <?php } ?>
975
+ <?php if (get_option('agca_remove_site_link') == true) { ?>
976
+ jQuery("#wp-admin-bar-site-name").css("display","none");
977
+
978
+ <?php } ?>
979
+ <?php if (get_option('agca_wp_logo_custom_link') != "") { ?>
980
+ var href = "<?php echo get_option('agca_wp_logo_custom_link'); ?>";
981
+ href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
982
+ if(href == "%SWITCH%"){
983
+ href = "<?php echo get_bloginfo('wpurl'); ?>";
984
+ <?php if ($this->context == "page") {
985
+ ?>href+="/wp-admin";<?php
986
+ }
987
+ ?>
988
+ }
989
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',href);
990
+
991
+ <?php } ?>
992
+ <?php if (get_option('agca_site_heading') == true) { ?>
993
+ jQuery("#wphead #site-heading").css("display","none");
994
+ <?php } ?>
995
+ <?php if (get_option('agca_custom_site_heading') != "") { ?>
996
+ jQuery("#wphead #site-heading").after('
997
+ <h1><?php echo addslashes(get_option('agca_custom_site_heading')); ?></h1>');
998
+ jQuery("#wp-admin-bar-site-name a:first").html('<?php echo addslashes(get_option('agca_custom_site_heading')); ?>');
999
+
1000
+ <?php } ?>
1001
+ <?php if (get_option('agca_header') == true && $this->context == 'admin') {
1002
+ ?>
1003
+ jQuery("#wpadminbar").css("display","none");
1004
+ jQuery("body.admin-bar").css("padding-top","0");
1005
+ jQuery("#wphead").css("display","none");
1006
+ jQuery('html.wp-toolbar').css("padding-top","0");
1007
+
1008
+ <?php } ?>
1009
+ <?php if ((get_option('agca_header') == true) && (get_option('agca_header_show_logout') == true)) { ?>
1010
+ <?php
1011
+ $agca_logout_text = ((get_option('agca_logout') == "") ? "Log Out" : get_option('agca_logout'));
1012
+ ?>
1013
+ jQuery("#wpbody-content").prepend('<a href="../wp-login.php?action=logout" tabindex="10"
1014
+ style="float:right;margin-right:20px"
1015
+ class="ab-item agca_logout_button"><?php echo $agca_logout_text; ?></a>');
1016
+
1017
+
1018
+ <?php } ?>
1019
+ <?php if (get_option('agca_howdy') != "") { ?>
1020
+ var alltext="";
1021
+ alltext="";
1022
+ jQuery('li#wp-admin-bar-my-account').css('cursor','default');
1023
+ alltext = jQuery('li#wp-admin-bar-my-account').html();
1024
+ if(alltext!=null){
1025
+ var parts = alltext.split(',');
1026
+ alltext = "<?php echo get_option('agca_howdy'); ?>" + ", " + parts[1];
1027
+ }
1028
+ jQuery("li#wp-admin-bar-my-account").html("<a href=\"#\" class=\"ab-item\">"+alltext+"</a>");
1029
+
1030
+ <?php } ?>
1031
+ <?php
1032
+ if (get_option('agca_custom_title') != "") {
1033
+ //add_filter('admin_title', '$this->change_title', 10, 2);
1034
+
1035
+ }
1036
+ ?>
1037
+ <?php if (get_option('agca_logout') != "") { ?>
1038
+ jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-logout a").text("<?php echo get_option('agca_logout'); ?>");
1039
+ <?php } ?>
1040
+ <?php if (get_option('agca_remove_your_profile') == true) { ?>
1041
+ jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("visibility","hidden");
1042
+ jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("height","10px");
1043
+ jQuery('#wpadminbar #wp-admin-bar-top-secondary > #wp-admin-bar-my-account > a').attr('href','#');
1044
+ jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-user-info > a').attr('href','#');
1045
+ jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-edit-profile > a').attr('href','#');
1046
+ <?php } ?>
1047
+ <?php if (get_option('agca_logout_only') == true) { ?>
1048
+ var logout_content = jQuery("li#wp-admin-bar-logout").html();
1049
+ jQuery("ul#wp-admin-bar-top-secondary").html('
1050
+ <li id="wp-admin-bar-logout">'+ logout_content +'</li>');
1051
+
1052
+ <?php } ?>
1053
+
1054
+ <?php
1055
+
1056
+
1057
+ }
1058
+
1059
+ function updateAllColors()
1060
+ {
1061
+
1062
+ ?>
1063
+ function updateAllColors(){
1064
+ <?php
1065
+ foreach ($this->colorizer as $k => $v) {
1066
+ if (($k != "") and ($v != "")) {
1067
+ ?> updateTargetColor("<?php echo $k; ?>","<?php echo $v; ?>"); <?php
1068
+ }
1069
+ }
1070
+ ?>
1071
+ jQuery('.color_picker').each(function(){
1072
+ updateColor(jQuery(this).attr('id'),jQuery(this).val())
1073
+ });
1074
+ jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1075
+ jQuery('#adminmenu li.wp-menu-open').css('border','none');
1076
+ jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
1077
+ }<?php
1078
+
1079
+ }
1080
+
1081
+ function admin_capabilities()
1082
+ {
1083
+ global $wp_roles;
1084
+ $capabs = $wp_roles->roles['administrator']['capabilities'];
1085
+ $capabilitySelector = "";
1086
+
1087
+ $selectedValue = get_option('agca_admin_capability');
1088
+ if ($selectedValue == "") {
1089
+ $selectedValue = "edit_dashboard";
1090
+ }
1091
+ /*echo $selectedValue;
1092
  die;*/
1093
+ ksort($capabs);
1094
+ foreach ($capabs as $k => $v) {
1095
+ $selected = "";
1096
+ if ($this->startsWith($k, 'level_')) continue;
1097
+ if ($selectedValue == $k) {
1098
+ $selected = " selected=\"selected\" ";
1099
+ }
1100
+ //TODO:Find out why this does not work
1101
+ //$capabilitySelector .="<option val=\"$k\" $selected >".str_replace(' ', ' ', ucwords(str_replace('_', ' ', $k))) ."</option>\n";
1102
+ $capabilitySelector .= "<option val=\"$k\" $selected >" . $k . "</option>\n";
1103
+ }
1104
+
1105
+ $this->admin_capabilities = "<select class=\"agca-selectbox\" id=\"agca_admin_capability\" name=\"agca_admin_capability\" val=\"upload_files\">" . $capabilitySelector . "</select>";
1106
+ }
1107
+
1108
+ function admin_capability()
1109
+ {
1110
+ $selectedValue = get_option('agca_admin_capability');
1111
+ if ($selectedValue == "") {
1112
+ $selectedValue = "edit_dashboard";
1113
+ }
1114
+ return $selectedValue;
1115
+ }
1116
+
1117
+ function JSPrintAGCATemplateSettingsVar($settings)
1118
+ {
1119
+ echo "\n<script type=\"text/javascript\">\n";
1120
+ echo "var agca_template_settings = " . preg_replace('#<script(.*?)>(.*?)</script>#is', '', $settings) . ";\n"; //TODO: think about this
1121
+ echo "</script>";
1122
+ }
1123
+
1124
+ function appendSettingsToAGCATemplateCustomizations($customizations, $settings)
1125
+ {
1126
+ $template_settings = json_decode($settings);
1127
+ //print_r($template_settings);
1128
+ foreach ($template_settings as $sett) {
1129
+ $key = $sett->code;
1130
+
1131
+ //use default value if user's value is not set
1132
+ $value = "";
1133
+ if ($sett->value != "") {
1134
+ $value = $sett->value;
1135
+ } else {
1136
+ $value = $sett->default_value;
1137
+ }
1138
+
1139
+ //Prepare settings
1140
+ if ($sett->type == 6) {
1141
+ if ($value !== null && (strtolower($value) == "on" || $value == "1")) {
1142
+ $value = "true";
1143
+ } else {
1144
+ $value = "false";
1145
+ }
1146
+ }
1147
+ $customizations = str_replace("%" . $key . "%", $value, $customizations);
1148
+ }
1149
+ return $customizations;
1150
+ }
1151
+
1152
+ function enableSpecificWPVersionCustomizations($customizations)
1153
+ {
1154
+ /*enable special CSS for this WP version*/
1155
+ $ver = $this->get_wp_version();
1156
+ $customizations = str_replace("/*" . $ver, " ", $customizations);
1157
+ $customizations = str_replace($ver . "*/", " ", $customizations);
1158
+ return $customizations;
1159
+ }
1160
+
1161
+ function removeCSSComments($customizations)
1162
+ {
1163
+ $customizations = preg_replace('#/\*.*?\*/#si', '', $customizations);
1164
+ return $customizations;
1165
+ }
1166
+
1167
+ function prepareAGCAAdminTemplates()
1168
+ {
1169
+ if (get_option('agca_templates') != "") {
1170
+ //print_r(get_option( 'agca_templates' ));
1171
+ $themes = get_option('agca_templates');
1172
+ $selectedTheme = get_option('agca_selected_template');
1173
+ if (isset($themes[$selectedTheme])) {
1174
+ $theme = $themes[$selectedTheme];
1175
+ add_filter('get_user_option_admin_color', array(&$this, 'change_admin_color'));
1176
+
1177
+ echo(stripslashes($theme['common']));
1178
+ echo "<!--AGCAIMAGES: " . $theme['images'] . "-->";
1179
+
1180
+ //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1181
+ if (!((get_option('agca_role_allbutadmin') == true) and (current_user_can($this->admin_capability())))) {
1182
+ if ($theme['settings'] == "" || $theme['settings'] == " ") $theme['settings'] = "{}";
1183
+ //print_r($templdata);
1184
+
1185
+ $this->JSPrintAGCATemplateSettingsVar($theme['settings']);
1186
+
1187
+ $admindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($theme['admin']), $theme['settings']);
1188
+ $admindata = $this->enableSpecificWPVersionCustomizations($admindata);
1189
+ $admindata = $this->removeCSSComments($admindata);
1190
+
1191
+ //echo $admindata;
1192
+ //REPLACE TAGS WITH CUSTOM TEMPLATE SETTINGS
1193
+ $this->templateCustomizations = $admindata;
1194
+ }
1195
+ //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1196
+ }
1197
+ }
1198
+ }
1199
+
1200
+ function agcaAdminSession()
1201
+ {
1202
+ $agcaTemplatesSession = array();
1203
+
1204
+ //session_destroy();
1205
+ //session_unset();
1206
+
1207
+ /*if(!session_id()){
1208
+ session_start();
1209
  }*/
1210
+
1211
+ if (!isset($_SESSION["AGCA"])) {
1212
+ $_SESSION["AGCA"] = array();
1213
+ $_SESSION["AGCA"]["Templates"] = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1214
  }
1215
+ //print_r($_SESSION);
1216
+
1217
+ if (isset($_SESSION["AGCA"])) {
1218
+ if (isset($_SESSION["AGCA"]["Templates"])) {
1219
+ //print_r($_SESSION["AGCA"]["Templates"]);
1220
+ $agcaTemplatesSession = json_encode($_SESSION["AGCA"]["Templates"]);
1221
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1222
  }
1223
 
1224
+
1225
+ if ($agcaTemplatesSession == '""' || $agcaTemplatesSession == '"[]"') {
1226
+ $agcaTemplatesSession = array();
1227
+ }
1228
+
1229
+
1230
+ return $agcaTemplatesSession;
1231
+
1232
+ }
1233
+
1234
+ function getAGCAColor($name)
1235
+ {
1236
+ if (isset($this->colorizer[$name])) {
1237
+ echo htmlspecialchars($this->colorizer[$name]);
1238
+ }
1239
+ }
1240
+
1241
+ function prepareAGCALoginTemplates()
1242
+ {
1243
+ if (get_option('agca_templates') != "") {
1244
+ //print_r(get_option( 'agca_templates' ));
1245
+ $templates = get_option('agca_templates');
1246
+ foreach ($templates as $templname => $templdata) {
1247
+ if ($templname == get_option('agca_selected_template')) {
1248
+ echo(stripslashes($templdata['common']));
1249
+
1250
+ if ($templdata['settings'] == "" || $templdata['settings'] == " ") $templdata['settings'] = "{}";
1251
+ $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1252
+
1253
+ $logindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($templdata['login']), $templdata['settings']);
1254
+ $logindata = $this->enableSpecificWPVersionCustomizations($logindata);
1255
+ $logindata = $this->removeCSSComments($logindata);
1256
+
1257
+ echo($logindata);
1258
+ break;
1259
+ }
1260
+ }
1261
+ }
1262
+ }
1263
+
1264
+ function agca_error_check()
1265
+ {
1266
+ ?>
1267
+ <script type="text/javascript">
1268
+ function AGCAErrorPage(msg, url, line) {
1269
+ var agca_error_details = "___________________________________________________<br/>";
1270
+ agca_error_details += '<br/>' + msg + '<br/>source:' + url + '<br/>line:' + line + '<br/>';
1271
+ agca_error_details += "___________________________________________________<br/>";
1272
+ window.agca_error_details_text = agca_error_details + '<br/>This JavaScript error could stop AG Custom Admin plugin to work properly. If everything still works, you can ignore this notification. <br/><br/>Possible solutions:<br/><br/>1) Make sure to have everything up to date: WordPress site, plugins and themes.<br/><br/>2) Try disabling plugins one by one to see if problem can be resolved this way. If so, one of disabled plugins caused this error.<br/><br/>3) Check "source" path of this error. This could be indicator of the plugin/theme that caused the error.<br/><br/>4) If it\'s obvious that error is thrown from a particular plugin/theme, please report this error to their support. <br/><br/>5) Try activating default WordPress theme instead of your current theme.<br/><br/>6) Advanced: Try fixing this issue manually: Navigate to the link above in your browser and open the source of the page (right click -> view page source) and find the line in code where it fails. You should access this file via FTP and try to fix this error on that line.<br/><br/>7) Contact us if nothing above helps. Please do not post errors that are caused by other plugins/themes to our support page. Contact their support instead. If you think that error is somehow related to AG Custom Admin plugin, or something unexpected happens, please report that on our <a href="http://wordpressadminpanel.com/agca-support/ag_custom_admin/error-ocurred-javascript-error-caught/" target="_blank">SUPPORT PAGE</a>';
1273
+ document.getElementsByTagName('html')[0].style.visibility = "visible";
1274
+ var errorDivHtml = '<div style="background: #f08080;border-radius: 3px;color: #ffffff;height: auto; margin-right: 13px;padding: 6px 14px;width: 450px;z-index: 99999; position:absolute;">\
1275
+ AG Custom Admin caught an error on your site!&nbsp;<a target="_blank" href="#" onclick="var aedt = document.getElementById(\'agca_error_details_text\'); if(aedt.style.display !== \'block\') {aedt.style.display = \'block\';} else{aedt.style.display = \'none\';} return false;" style="color: #ffffff !important;float:right;font-weight: bold;text-decoration: none;">(show/hide more...)</a><div id="agca_error_details_text" style="display:none;margin: 10px 0;background:#ffffff;border-radius: 5px;padding:8px;color: #777;">' + agca_error_details_text + '</div></div>';
1276
+
1277
+ var ph = document.getElementById('agca_error_placeholder');
1278
+ ph.innerHTML = errorDivHtml;
1279
+ document.getElementById('agca_news').style.visibility = "hidden";
1280
+ }
1281
+ window.onerror = function (msg, url, line) {
1282
+ window.onload = function () {
1283
+ AGCAErrorPage(msg, url, line);
1284
+ }
1285
+ return true;
1286
+ };
1287
+ </script>
1288
+ <?php
1289
+ }
1290
+
1291
+ function error_check()
1292
+ {
1293
+ ?>
1294
+ <script type="text/javascript">
1295
+ function AGCAErrorOtherPages(msg, url, line) {
1296
+ var agca_error_details = "___________________________________________________\n";
1297
+ agca_error_details += '\n' + msg + '\nsource:' + url + '\nline:' + line + '\n';
1298
+
1299
+ document.getElementsByTagName('html')[0].style.visibility = "visible";
1300
+
1301
+ if (typeof window.console === "object") {
1302
+ console.log("___________________________________________________");
1303
+ console.log("AG Custom Admin caught a JavaScript on your site:");
1304
+ console.log(agca_error_details);
1305
+ }
1306
+ }
1307
+ window.onerror = function (msg, url, line) {
1308
+ window.onload = function () {
1309
+ AGCAErrorOtherPages(msg, url, line);
1310
+ }
1311
+ return true;
1312
+ };
1313
+ </script>
1314
+ <?php
1315
+ }
1316
+
1317
+ function menu_item_cleartext($name)
1318
+ {
1319
+ if (strpos($name, ' <span') !== false) {
1320
+ $parts = explode(' <span', $name);
1321
+ $name = $parts[0];
1322
+ }
1323
+ $name = trim($name);
1324
+ return $name;
1325
+ }
1326
+
1327
+ /**
1328
+ * Loops through all original menu items, and creates customizations array
1329
+ * applies previous customizations if set
1330
+ * @return array|mixed|object
1331
+ */
1332
+ function get_menu_customizations()
1333
+ {
1334
+ global $menu;
1335
+ global $submenu;
1336
+
1337
+ //var_dump($menu); die;
1338
+ $previousCustomizations = json_decode(get_option('ag_edit_adminmenu_json_new'), true);
1339
+
1340
+ $customizationsSet = true;
1341
+ if ($previousCustomizations == null) {
1342
+ $customizationsSet = false;
1343
+ }
1344
+
1345
+ //set default menu configuration
1346
+ //and apply previously saved customizations
1347
+ $m = array();
1348
+ foreach ($menu as $top) {
1349
+ $name = $top[0];
1350
+ $url = $top[2];
1351
+ $cls = isset($top[5]) ? $top[5] : "";
1352
+ $remove = false;
1353
+ if ($name == '') continue;
1354
+ $pc = null;
1355
+ $name = $this->menu_item_cleartext($name);
1356
+
1357
+ //apply previous submenu customizations
1358
+ if ($customizationsSet) {
1359
+ $pc = $previousCustomizations[$url];
1360
+ }
1361
+
1362
+ //get submenu
1363
+ $s = array();
1364
+ if (isset($submenu[$url])) {
1365
+ $sitems = $submenu[$url];
1366
+ foreach ($sitems as $key => $sub) {
1367
+ $nameSub = $sub[0];
1368
+ $urlSub = $sub[2];
1369
+ $removeSub = false;
1370
+ $nameSub = $this->menu_item_cleartext($nameSub);
1371
+ $s[$key] = array(
1372
+ 'name' => $nameSub,
1373
+ 'new' => '',
1374
+ 'remove' => $removeSub,
1375
+ 'url' => $urlSub
1376
+ );
1377
+
1378
+ if (isset($pc) && isset($pc['submenus'])) {
1379
+ $s[$key]['new'] = $pc['submenus'][$key]['new'];
1380
+ $s[$key]['remove'] = $pc['submenus'][$key]['remove'];
1381
+
1382
+ if ($s[$key]['new'] == null) {
1383
+ $s[$key]['new'] = '';
1384
+ }
1385
+ if ($s[$key]['remove'] == null) {
1386
+ $s[$key]['remove'] = false;
1387
+ }
1388
+ }
1389
+ }
1390
+ }
1391
+
1392
+ $m[$url] = array(
1393
+ 'name' => $name,
1394
+ 'remove' => $remove,
1395
+ 'new' => '',
1396
+ 'url' => $url,
1397
+ 'cls' => $cls,
1398
+ 'submenus' => $s
1399
+ );
1400
+
1401
+ //apply previous top menu customizations
1402
+ if ($customizationsSet) {
1403
+ $pc = $previousCustomizations[$url];
1404
+ if (isset($pc)) {
1405
+ $m[$url]['remove'] = $pc['remove'];
1406
+ $m[$url]['new'] = $pc['new'];
1407
+ }
1408
+ }
1409
+ }
1410
+ return $m;
1411
+ }
1412
+
1413
+ /**
1414
+ * Applies customizations to admin menu
1415
+ */
1416
+ function customized_menu()
1417
+ {
1418
+ $customizations = $this->get_menu_customizations();
1419
+ global $menu;
1420
+ global $submenu;
1421
+
1422
+ //print_r($submenu);die;
1423
+ //apply customizations to original admin menu
1424
+ foreach ($menu as $key => $top) {
1425
+ $url = $top[2];
1426
+ if (isset($customizations[$url])) {
1427
+ $topCustomized = $customizations[$url];
1428
+ if ($topCustomized['new']) {
1429
+ $menu[$key][0] = $topCustomized['new'];
1430
+ }
1431
+ if ($topCustomized['remove']) {
1432
+ unset($menu[$key]);
1433
+ }
1434
+ }
1435
+ }
1436
+ foreach ($submenu as $topkey => $subs) {
1437
+ foreach ($subs as $subkey => $sub) {
1438
+ if (isset($customizations[$topkey]['submenus'][$subkey])) {
1439
+ $cs = $customizations[$topkey]['submenus'][$subkey];
1440
+ if ($cs['new']) {
1441
+ $submenu[$topkey][$subkey][0] = preg_replace("/" . $cs['name'] . "/", $cs['new'], $submenu[$topkey][$subkey][0], 1);
1442
+ }
1443
+ if ($cs['remove']) {
1444
+ unset($submenu[$topkey][$subkey]);
1445
+ }
1446
+ }
1447
+ }
1448
+ }
1449
+ }
1450
+
1451
+ /**
1452
+ * Used only for removing admin menu customizations to AGCA 1.5 version or later
1453
+ * @param $checkboxes
1454
+ * @param $textboxes
1455
+ */
1456
+ function migrate_menu_customizations($checkboxes, $textboxes)
1457
+ {
1458
+ $customizations = $this->get_menu_customizations();
1459
+ global $menu;
1460
+ /*print_r($menu);
1461
  print_r($customizations);
1462
  print_r($textboxes);*/
1463
 
1464
+ $oldTopValue = "";
1465
+
1466
+
1467
+ //Migrate checkboxes
1468
+ foreach ($checkboxes as $key => $value) {
1469
+ $isTop = false;
1470
+ $oldSubValue = "";
1471
+ if (strpos($key, '<-TOP->') !== false) {
1472
+ $oldTopValue = str_replace('<-TOP->', '', $key);
1473
+ $isTop = true;
1474
+ } else {
1475
+ $oldSubValue = $key;
1476
+ }
1477
+ if ($value == 'checked') {
1478
+ $topIndex = "";
1479
+ foreach ($customizations as $k => $c) {
1480
+ if ($c['cls'] == $oldTopValue) {
1481
+ $topIndex = $k;
1482
+ break;
1483
+ }
1484
+ }
1485
+ if ($topIndex == "") continue;
1486
+ if ($isTop) {
1487
+ $customizations[$topIndex]['remove'] = true;
1488
+ } else {
1489
+ if (is_array($customizations[$topIndex]['submenus'])) {
1490
+ foreach ($customizations[$topIndex]['submenus'] as $skey => $sval) {
1491
+ if ($sval['name'] == $oldSubValue) {
1492
+ $customizations[$topIndex]['submenus'][$skey]['remove'] = true;
1493
+ }
1494
+ }
1495
+ }
1496
+ }
1497
+ }
1498
+ }
1499
+
1500
+ //Migrate textboxes
1501
+ foreach ($textboxes as $key => $value) {
1502
+ $isTop = false;
1503
+ $oldSubValue = "";
1504
+ if (strpos($key, '<-TOP->') !== false) {
1505
+ $oldTopValue = str_replace('<-TOP->', '', $key);
1506
+ $isTop = true;
1507
+ } else {
1508
+ $oldSubValue = $key;
1509
+ }
1510
+ if ($value != '') {
1511
+ $topIndex = "";
1512
+ foreach ($customizations as $k => $c) {
1513
+ if ($c['cls'] == $oldTopValue) {
1514
+ $topIndex = $k;
1515
+ break;
1516
+ }
1517
+ }
1518
+ if ($topIndex == "") continue;
1519
+ if ($isTop) {
1520
+ $customizations[$topIndex]['new'] = $value;
1521
+ } else {
1522
+ if (is_array($customizations[$topIndex]['submenus'])) {
1523
+ foreach ($customizations[$topIndex]['submenus'] as $skey => $sval) {
1524
+ if ($sval['name'] == $oldSubValue) {
1525
+ if ($customizations[$topIndex]['submenus'][$skey]['name'] != $value) {
1526
+ $customizations[$topIndex]['submenus'][$skey]['new'] = $value;
1527
+ }
1528
+ }
1529
+ }
1530
+ }
1531
+ }
1532
+ }
1533
+ }
1534
+ update_option('ag_edit_adminmenu_json', '');//remove previous admin menu configuration
1535
+ update_option('ag_edit_adminmenu_json_new', json_encode($customizations));
1536
+ }
1537
+
1538
+ function print_admin_css()
1539
+ {
1540
+ $agcaTemplateSession = $this->agcaAdminSession();
1541
+ $wpversion = $this->get_wp_version();
1542
+ $this->context = "admin";
1543
+ $this->error_check();
1544
+ ?>
1545
+ <script type="text/javascript">
1546
+ var wpversion = "<?php echo $wpversion; ?>";
1547
+ var agca_debug = <?php echo ($this->agca_debug) ? "true" : "false"; ?>;
1548
+ var agca_version = "<?php echo $this->agca_version; ?>";
1549
+ var agcaTemplatesSession = <?php echo ($agcaTemplateSession == null) ? "[]" : $agcaTemplateSession; ?>;
1550
+ var errors = false;
1551
+ var isSettingsImport = false;
1552
+ var agca_context = "admin";
1553
+ var roundedSidberSize = 0;
1554
+ var agca_installed_templates = <?php echo $this->get_installed_agca_templates(); ?>;
1555
+ var agca_admin_menu = <?php echo json_encode($this->get_menu_customizations()) ?>;
1556
+ </script>
1557
+ <?php
1558
+ $this->prepareAGCAAdminTemplates();
1559
+ $this->agca_get_includes();
1560
+ $this->admin_capabilities();
1561
+ get_currentuserinfo();
1562
+
1563
+ ?>
1564
+ <?php
1565
+ //in case that javaScript is disabled only admin can access admin menu
1566
+ if (!current_user_can($this->admin_capability())) {
1567
+ ?>
1568
+ <style type="text/css">
1569
+ #adminmenu {
1570
+ display: none;
1571
+ }
1572
+ </style>
1573
+ <?php
1574
+ }
1575
+ ?>
1576
+ <script type="text/javascript">
1577
+ document.write('<style type="text/css">html{visibility:hidden;}</style>');
1578
+ <?php
1579
+ if (isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings'] == 'true') {
1580
+ echo 'isSettingsImport = true;';
1581
+ }
1582
+ ?>
1583
+ </script>
1584
+ <?php if (get_option('agca_admin_menu_arrow') == true) { ?>
1585
+ <style type="text/css">
1586
+ .wp-has-current-submenu:after {
1587
+ border: none !important;
1588
+ }
1589
+
1590
+ #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
1591
+ border: none !important;
1592
+ }
1593
+ </style>
1594
+ <?php } ?>
1595
+ <script type="text/javascript">
1596
+ /* <![CDATA[ */
1597
+ jQuery(document).ready(function () {
1598
+ try {
1599
+
1600
+ <?php /*CHECK OTHER PLUGINS*/
1601
+ $this->check_active_plugin();
1602
+
1603
+ if($this->active_plugin["ozh"]){
1604
+ ?>
1605
+ jQuery('ul#adminmenu').css('display', 'none');
1606
+ jQuery('#footer-ozh-oam').css('display', 'none');
1607
+ jQuery('#ag_main_menu li').each(function () {
1608
+ if (jQuery(this).text() == "Admin Menu") {
1609
+ jQuery(this).hide();
1610
+ }
1611
+ });
1612
+ <?php
1613
+ }
1614
+ ?>
1615
+
1616
+
1617
+ //get saved onfigurations
1618
+
1619
+ <?php $buttons = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'), 'buttons'); ?>
1620
+ var buttons = '<?php echo $buttons; ?>';
1621
+
1622
+ <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'), 'buttonsJq'); ?>
1623
+ var buttonsJq = '<?php echo $buttonsJq; ?>';
1624
+
1625
+ createEditMenuPageNew(agca_admin_menu);
1626
+ //createEditMenuPageV32(checkboxes, textboxes);
1627
+
1628
+ <?php
1629
+ //if admin, and option to hide settings for admin is set
1630
+
1631
+ if((get_option('agca_role_allbutadmin') == true) and current_user_can($this->admin_capability())){
1632
+ ?>
1633
+ <?php } else{ ?>
1634
+ <?php if(get_option('agca_admin_menu_brand') != ""){ ?>
1635
+ additionalStyles = ' style="margin-bottom:-4px" ';
1636
+ jQuery("#adminmenu").before('<div ' + additionalStyles + ' id="sidebar_adminmenu_logo"><img width="160" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1637
+ <?php } ?>
1638
+ <?php if(get_option('agca_admin_menu_brand_link') != ""){ ?>
1639
+
1640
+ var href = "<?php echo get_option('agca_admin_menu_brand_link'); ?>";
1641
+ href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1642
+
1643
+ jQuery("#sidebar_adminmenu_logo").attr('onclick', 'window.open(\"' + href + '\");');
1644
+ jQuery("#sidebar_adminmenu_logo").attr('title', href);
1645
+
1646
+ <?php }else{ ?>
1647
+ href = "<?php echo get_bloginfo('wpurl'); ?>";
1648
+ jQuery("#sidebar_adminmenu_logo").attr('onclick', 'window.open(\"' + href + '\");');
1649
+ jQuery("#sidebar_adminmenu_logo").attr('title', href);
1650
+ <?php } ?>
1651
+
1652
+ <?php if(get_option('agca_admin_menu_submenu_round') == true){ ?>
1653
+ jQuery("#adminmenu .wp-submenu").css("border-radius", "<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1654
+ jQuery("#adminmenu .wp-menu-open .wp-submenu").css('border-radius', '');
1655
+ <?php $roundedSidebarSize = get_option('agca_admin_menu_submenu_round_size'); ?>
1656
+ roundedSidberSize = <?php echo ($roundedSidebarSize == "") ? "0" : $roundedSidebarSize; ?>;
1657
+
1658
+
1659
+ <?php } ?>
1660
+ <?php if(get_option('agca_admin_menu_autofold') == "force"){ ?>
1661
+ jQuery("body").addClass("auto-fold");
1662
+ <?php } else if(get_option('agca_admin_menu_autofold') == "disable"){ ?>
1663
+ jQuery("body").removeClass("auto-fold");
1664
+ <?php } ?>
1665
+
1666
+ <?php $this->print_admin_bar_scripts(); ?>
1667
+
1668
+ <?php if(get_option('agca_screen_options_menu') == true){ ?>
1669
+ jQuery("#screen-options-link-wrap").css("display", "none");
1670
+ <?php } ?>
1671
+ <?php if(get_option('agca_help_menu') == true){ ?>
1672
+ jQuery("#contextual-help-link-wrap").css("display", "none");
1673
+ jQuery("#contextual-help-link").css("display", "none");
1674
+ <?php } ?>
1675
+ <?php if(get_option('agca_privacy_options') == true){ ?>
1676
+ jQuery("#privacy-on-link").css("display", "none");
1677
+ <?php } ?>
1678
+
1679
+ <?php if(get_option('agca_update_bar') == true){ ?>
1680
+ <?php
1681
+ if (!function_exists('c2c_no_update_nag')) :
1682
+ function c2c_no_update_nag()
1683
+ {
1684
+ remove_action('admin_notices', 'update_nag', 3);
1685
+ }
1686
+ endif;
1687
+ add_action('admin_init', 'c2c_no_update_nag');
1688
+ ?>
1689
+ jQuery("#update-nag").css("display", "none");
1690
+ jQuery(".update-nag").css("display", "none");
1691
+ <?php } ?>
1692
+
1693
+ <?php if(get_option('agca_footer') == true){ ?>
1694
+ jQuery("#footer,#wpfooter").css("display", "none");
1695
+ <?php } ?>
1696
+
1697
+ <?php if(get_option('agca_footer_left') != ""){ ?>
1698
+ jQuery("#footer-left").html('<?php echo addslashes(get_option('agca_footer_left')); ?>');
1699
+ <?php } ?>
1700
+ <?php if(get_option('agca_footer_left_hide') == true){ ?>
1701
+ jQuery("#footer-left").css("display", "none");
1702
+ <?php } ?>
1703
+ <?php if(get_option('agca_footer_right') != ""){ ?>
1704
+ jQuery("#footer-upgrade").html('<?php echo addslashes(get_option('agca_footer_right')); ?>');
1705
+ <?php } ?>
1706
+ <?php if(get_option('agca_footer_right_hide') == true){ ?>
1707
+ jQuery("#footer-upgrade").css("display", "none");
1708
+ <?php } ?>
1709
+
1710
+ <?php if(get_option('agca_language_bar') == true){ ?>
1711
+ jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
1712
+ <?php } ?>
1713
+ <?php if(get_option('agca_dashboard_icon') == true){ ?>
1714
+ var className = jQuery("#icon-index").attr("class");
1715
+ if (className == 'icon32') {
1716
+ jQuery("#icon-index").attr("id", "icon-index-removed");
1717
+ }
1718
+ <?php } ?>
1719
+ <?php if(get_option('agca_dashboard_text') != ""){ ?>
1720
+ jQuery("#dashboard-widgets-wrap").parent().find("h1").html("<?php echo addslashes(get_option('agca_dashboard_text')); ?>");
1721
+ <?php } ?>
1722
+ <?php if(get_option('agca_dashboard_text_paragraph') != ""){
1723
+ require_once(ABSPATH . 'wp-includes/formatting.php');
1724
+ ?>
1725
+ jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
1726
+
1727
+ jQuery("#agca_custom_dashboard_content").html('<br /><?php echo preg_replace('/(\r\n|\r|\n)/', '\n', addslashes(wpautop(get_option('agca_dashboard_text_paragraph')))); ?>');
1728
+ <?php } ?>
1729
+
1730
+ <?php /*Remove Dashboard widgets*/ ?>
1731
+ <?php
1732
 
1733
  if(get_option('agca_dashboard_widget_welcome')==true){
1734
+ ?>jQuery("#welcome-panel").css("display", "none");
1735
+ <?php
1736
  }else{
1737
+ ?>jQuery("#welcome-panel").css("display", "block");
1738
+ <?php
1739
+ }
1740
  if(get_option('agca_dashboard_widget_il')==true){
1741
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1742
  }else{
1743
+ ?>jQuery("#dashboard_incoming_links").css("display", "block");
1744
+ <?php
1745
  }
1746
  if(get_option('agca_dashboard_widget_plugins')==true){
1747
  $this->remove_dashboard_widget('dashboard_plugins','normal');
1748
  }else{
1749
+ ?>jQuery("#dashboard_plugins").css("display", "block");
1750
+ <?php
1751
  }
1752
  if(get_option('agca_dashboard_widget_qp')==true){
1753
  $this->remove_dashboard_widget('dashboard_quick_press','side');
1754
  }else{
1755
+ ?>jQuery("#dashboard_quick_press").css("display", "block");
1756
+ <?php
1757
  }
1758
  if(get_option('agca_dashboard_widget_rn')==true){
1759
  $this->remove_dashboard_widget('dashboard_right_now','normal');
1760
  }else{
1761
+ ?>jQuery("#dashboard_right_now").css("display", "block");
1762
+ <?php
1763
  }
1764
  if(get_option('agca_dashboard_widget_rd')==true){
1765
  $this->remove_dashboard_widget('dashboard_recent_drafts','side');
1766
  }else{
1767
+ ?>jQuery("#dashboard_recent_drafts").css("display", "block");
1768
+ <?php
1769
  }
1770
  if(get_option('agca_dashboard_widget_primary')==true){
1771
  $this->remove_dashboard_widget('dashboard_primary','side');
1772
  }else{
1773
+ ?>jQuery("#dashboard_primary").css("display", "block");
1774
+ <?php
1775
  }
1776
  if(get_option('agca_dashboard_widget_secondary')==true){
1777
  $this->remove_dashboard_widget('dashboard_secondary','side');
1778
  }else{
1779
+ ?>jQuery("#dashboard_secondary").css("display", "block");
1780
+ <?php
1781
+ }
1782
  if(get_option('agca_dashboard_widget_activity')==true){
1783
  remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
1784
  }else{
1785
+ ?>jQuery("#dashboard_activity").css("display", "block");<?php
1786
+ }
1787
+
1788
+ ?>
1789
+
1790
+ <?php /*ADMIN MENU*/ ?>
1791
+
1792
+ <?php if(get_option('agca_admin_menu_separators') == true){ ?>
1793
+ jQuery("#adminmenu li.wp-menu-separator").css({height: 0, margin: 0});
1794
+ <?php } ?>
1795
+ <?php if(get_option('agca_admin_menu_icons') == true){ ?>
1796
+ jQuery(".wp-menu-image").each(function () {
1797
+ jQuery(this).css("display", "none");
1798
+ });
1799
+ jQuery('#adminmenu div.wp-menu-name').css('padding', '8px');
1800
+ <?php } ?>
1801
+ <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1802
+ jQuery("#adminmenu .wp-menu-arrow").css("visibility", "hidden");
1803
+
1804
+ <?php } ?>
1805
+ <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
1806
+
1807
+ <?php /*If Turned on*/ ?>
1808
+
1809
+ <?php if(get_option('agca_admin_menu_agca_button_only') == true){ ?>
1810
+ jQuery('#adminmenu > li').each(function () {
1811
+ if (!jQuery(this).hasClass('agca_button_only')) {
1812
+ jQuery(this).addClass('noclass');
1813
+ }
1814
+ });
1815
+ <?php /*Only admin see button*/
1816
+ if (current_user_can($this->admin_capability())){ ?>
1817
+ jQuery('#adminmenu').append('<?php echo $this->agca_create_admin_button('AG Custom Admin', array('value' => 'tools.php?page=ag-custom-admin/plugin.php', 'target' => '_self')); ?>');
1818
+ <?php } ?>
1819
+ <?php } ?>
1820
+
1821
+
1822
+ <?php /*EDIT MENU ITEMS*/?>
1823
+ <?php if (get_option('ag_edit_adminmenu_json') != "") {
1824
+
1825
+ $arr = explode("|", get_option('ag_edit_adminmenu_json'));
1826
+
1827
+ $checkboxes = json_decode($arr[0]);
1828
+ $textboxes = json_decode($arr[1]);
1829
+
1830
+ $this->migrate_menu_customizations($checkboxes, $textboxes);
1831
+
1832
+ } ?>
1833
+
1834
+ <?php if (get_option('ag_edit_adminmenu_json_new') != "") {
1835
+ $this->customized_menu();
1836
+ } ?>
1837
+
1838
+
1839
+
1840
+
1841
+ /*Add user buttons*/
1842
+ jQuery('#adminmenu').append(buttons);
1843
+
1844
+ <?php /*END If Turned on*/ ?>
1845
+ <?php } else{ ?>
1846
+ jQuery("#adminmenu").removeClass("noclass");
1847
+ <?php } ?>
1848
+
1849
+ reloadRemoveButtonEvents();
1850
+
1851
+ <?php if(get_option('agca_admin_menu_collapse_button') == true){ ?>
1852
+ //remove collapse menu button
1853
+ jQuery('#collapse-menu').remove();
1854
+ <?php } ?>
1855
+
1856
+ <?php //COLORIZER ?>
1857
+ updateAllColors();
1858
+ <?php //COLORIZER END ?>
1859
+ <?php } //end of apply for any user except admin ?>
1860
+ /*Add user buttons*/
1861
+ jQuery('#ag_add_adminmenu').append(buttonsJq);
1862
+
1863
+
1864
+ } catch (err) {
1865
+ errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
1866
+ console.log(errors);
1867
+ } finally {
1868
+ jQuery('html').css('visibility', 'visible');
1869
+ }
1870
+ <?php
1871
  if($this->saveAfterImport == true){
1872
  ?>savePluginSettings();<?php
1873
+ }
1874
+ ?>
1875
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1876
  });
1877
+
1878
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on'){
1879
+ $this->updateAllColors();
1880
+ }else{
1881
+ ?>function updateAllColors() {
1882
+ }
1883
+ ; <?php
1884
+ } ?>
1885
+
1886
+
1887
+ /* ]]> */
1888
  </script>
1889
+ <style type="text/css">
1890
+ .underline_text {
1891
+ text-decoration: underline;
1892
+ }
1893
+
1894
+ .form-table th {
1895
+ width: 300px;
1896
+ }
1897
+
1898
+ #dashboard-widgets div.empty-container {
1899
+ border: none;
1900
+ }
1901
+ </style>
1902
+ <?php
1903
+ }
1904
+
1905
+ function print_login_head()
1906
+ {
1907
+ $this->context = "login";
1908
+ $this->error_check();
1909
+ $wpversion = $this->get_wp_version();
1910
+
1911
+ ?>
1912
+ <script type="text/javascript">
1913
+ document.write('<style type="text/css">html{visibility:hidden;}</style>');
1914
+ var agca_version = "<?php echo $this->agca_version; ?>";
1915
+ <?php //var wpversion = "echo $wpversion; ?>
1916
+ var agca_debug = <?php echo ($this->agca_debug) ? "true" : "false"; ?>;
1917
+ var isSettingsImport = false;
1918
+ var agca_context = "login";
1919
+ </script>
1920
+ <?php
1921
+ $this->prepareAGCALoginTemplates();
1922
+ $this->agca_get_includes();
1923
+
1924
+ ?>
1925
+
1926
+ <script type="text/javascript">
1927
+
1928
+
1929
+ /* <![CDATA[ */
1930
+ jQuery(document).ready(function () {
1931
+ try {
1932
+ <?php if(get_option('agca_login_round_box') == true){ ?>
1933
+ jQuery("form#loginform").css("border-radius", "<?php echo get_option('agca_login_round_box_size'); ?>px");
1934
+ jQuery("#login h1 a").css("border-radius", "<?php echo get_option('agca_login_round_box_size'); ?>px");
1935
+ jQuery("#login h1 a").css("margin-bottom", '10px');
1936
+ jQuery("#login h1 a").css("padding-bottom", '0');
1937
+ jQuery("form#lostpasswordform").css("border-radius", "<?php echo get_option('agca_login_round_box_size'); ?>px");
1938
+ <?php } ?>
1939
+ <?php if(get_option('agca_login_banner') == true){ ?>
1940
+ jQuery("#backtoblog").css("display", "none");
1941
+ <?php } ?>
1942
+ <?php if(get_option('agca_login_banner_text') == true){ ?>
1943
+ jQuery("#backtoblog").html('<?php echo addslashes(get_option('agca_login_banner_text')); ?>');
1944
+ <?php } ?>
1945
+ <?php if(get_option('agca_login_photo_url') == true && get_option('agca_login_photo_remove') != true){ ?>
1946
+ advanced_url = "<?php echo get_option('agca_login_photo_url'); ?>";
1947
+ var $url = "url(" + advanced_url + ")";
1948
+ jQuery("#login h1 a").css("background", $url + ' no-repeat');
1949
+ jQuery("#login h1 a").hide();
1950
+ image = jQuery("<img />").attr("src", advanced_url);
1951
+ jQuery(image).load(function () {
1952
+ var originalWidth = 326;
1953
+ var widthDiff = this.width - originalWidth;
1954
+ jQuery("#login h1 a").height(this.height);
1955
+ jQuery("#login h1 a").width(this.width);
1956
+ jQuery("#login h1 a").css("background-size", this.width + "px " + this.height + "px");
1957
+
1958
+ var loginWidth = jQuery('#login').width();
1959
+ var originalLoginWidth = 320;
1960
+ var photoWidth = this.width;
1961
+
1962
+ if (loginWidth > photoWidth) {
1963
+ jQuery("#login h1 a").css('margin', 'auto');
1964
+ } else {
1965
+ jQuery("#login h1 a").css('margin-left', -(widthDiff / 2) + ((loginWidth - originalLoginWidth) / 2) + "px");
1966
+ }
1967
+
1968
+ jQuery("#login h1 a").show();
1969
+ });
1970
+ <?php } ?>
1971
+ <?php if(get_option('agca_login_photo_href') == true){ ?>
1972
+ var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
1973
+ $href = $href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1974
+
1975
+ jQuery("#login h1 a").attr("href", $href);
1976
+ <?php } ?>
1977
+ <?php if(get_option('agca_login_photo_remove') == true){ ?>
1978
+ jQuery("#login h1 a").css("display", "none");
1979
+ <?php } ?>
1980
+
1981
+ jQuery("#login h1 a").attr("title", "");
1982
+
1983
+ <?php if(get_option('agca_login_register_remove') == true){ ?>
1984
+ if (jQuery('p#nav').size() > 0) {
1985
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|', ''));
1986
+ }
1987
+ jQuery('p#nav a').each(function () {
1988
+ if (jQuery(this).attr('href').indexOf('register') != -1) {
1989
+ jQuery(this).remove();
1990
+ }
1991
+ });
1992
+
1993
+ <?php } ?>
1994
+ <?php if(get_option('agca_login_register_href') != ""){ ?>
1995
+ jQuery('p#nav a').each(function () {
1996
+ if (jQuery(this).attr('href').indexOf('register') != -1) {
1997
+ jQuery(this).attr('href', '<?php echo get_option('agca_login_register_href'); ?>');
1998
+ }
1999
+ });
2000
+
2001
+ <?php } ?>
2002
+
2003
+ <?php if(get_option('agca_login_lostpassword_remove') == true){ ?>
2004
+ if (jQuery('p#nav').size() > 0) {
2005
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|', ''));
2006
+ }
2007
+ jQuery('p#nav a').each(function () {
2008
+ if (jQuery(this).attr('href').indexOf('lostpassword') != -1) {
2009
+ jQuery(this).remove();
2010
+ }
2011
+ });
2012
+
2013
+ <?php } ?>
2014
+
2015
+
2016
+ <?php //COLORIZER ?>
2017
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
2018
+ jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow', 'none');
2019
+ jQuery("body.login, html").css("background", "<?php echo $this->colorizer['login_color_background'];?>");
2020
+
2021
+
2022
+ <?php
2023
+
2024
+
2025
+ } ?>
2026
+ <?php //COLORIZER END ?>
2027
+ } catch (err) {
2028
+ console.log("AGCA - LOGIN ERROR: " + err.name + " / " + err.message);
2029
+ } finally {
2030
+ jQuery('html').show();
2031
+ jQuery('html').css('visibility', 'visible');
2032
+ }
2033
+ });
2034
+ /* ]]> */
2035
+
2036
+ </script>
2037
+ <?php
2038
+ }
2039
+
2040
+ function agca_admin_page()
2041
+ {
2042
+
2043
+ $wpversion = $this->get_wp_version();
2044
+ $this->agca_error_check();
2045
+ ?>
2046
+ <?php //includes ?>
2047
+ <link rel="stylesheet" type="text/css"
2048
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css?ver=<?php echo $wpversion; ?>"/>
2049
+ <script type="text/javascript"
2050
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2051
+
2052
+ <link rel="stylesheet" type="text/css"
2053
+ href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css?ver=<?php echo $wpversion; ?>"/>
2054
+ <script type="text/javascript"
2055
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2056
+ <script type="text/javascript"
2057
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/xd.js?ver=<?php echo $wpversion; ?>"></script>
2058
+ <script type="text/javascript">
2059
+ var templates_ep = "<?php echo $this->templates_ep; ?>";
2060
+ var template_selected = '<?php echo get_option('agca_selected_template'); ?>';
2061
+ </script>
2062
+ <script type="text/javascript"
2063
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_tmpl.js?ver=<?php echo $wpversion; ?>"></script>
2064
+ <?php //includes ?>
2065
+ <div class="wrap">
2066
+ <h1 id="agca-title">AG Custom Admin Settings <span
2067
+ style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
2068
+ <div id="agca_error_placeholder"></div>
2069
+ <div id="agca_news">&nbsp;</div>
2070
+ <br/>
2071
+ <form method="post" id="agca_form" action="options.php">
2072
+ <?php settings_fields('agca-options-group'); ?>
2073
+ <div id="agca-your-feedback">
2074
+ <strong>
2075
+ <span style="color:#005B69">Your feedback:</span>
2076
+ </strong>
2077
+ <a class="feedback positive" target="_blank" title="POSITIVE FEEDBACK: I like this plugin!"
2078
+ href="http://wordpressadminpanel.com/agca-support/feedback/ag-custom-admin-positive-feedback/">
2079
+ <span class="dashicons dashicons-thumbs-up"></span>
2080
+ </a>
2081
+ <a class="feedback negative" target="_blank" title="NEGATIVE FEEDBACK: I don't like this plugin."
2082
+ href="http://wordpressadminpanel.com/agca-support/feedback/ag-custom-admin-negative-feedback/">
2083
+ <span class="dashicons dashicons-thumbs-down"></span>
2084
+ </a>
2085
+ </div>
2086
+ <br/>
2087
+ <ul id="ag_main_menu">
2088
+ <li class="selected"><a href="#general-settings" title="General Settings">General</a></li>
2089
+ <li class="normal"><a href="#admin-bar-settings" title="Settings for admin bar">Admin Bar</a></li>
2090
+ <li class="normal"><a href="#admin-footer-settings" title="Settings for admin footer">Admin
2091
+ Footer</a></li>
2092
+ <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard
2093
+ Page</a></li>
2094
+ <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a>
2095
+ </li>
2096
+ <li class="normal"><a href="#admin-menu-settings" title="Settings for main admin menu">Admin
2097
+ Menu</a></li>
2098
+ <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a>
2099
+ </li>
2100
+ <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
2101
+ <li class="normal" style=""><a style="color:#DB6014;font-weight:bolder;" href="#ag-templates"
2102
+ title="AG Custom Admin Themes">Admin Themes</a></li>
2103
+
2104
+ <li style="background:none;border:none;padding:0;"><a id="agca_donate_button" target="_blank"
2105
+ style="margin-left:8px"
2106
+ title="Like this plugin? You can support its future development by giving a donation by your wish "
2107
+ href="http://wordpressadminpanel.com/agca-support/support-for-future-development/"><img
2108
+ alt="Donate"
2109
+ src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/btn_donate_LG.gif"/></a>
2110
+ </li>
2111
+ <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
2112
+ </ul>
2113
+ <div id="agca_advertising">
2114
+ <ul>
2115
+ <li style="min-height:105px;display: block"></li>
2116
+ </ul>
2117
+ </div>
2118
+ <div class="agca-clear"></div>
2119
+ <div id="section_general" style="display:none" class="ag_section">
2120
+ <h2 class="section_title">General Settings</h2>
2121
+ <p tabindex="0" class="agca-clear agca-tip"><i><strong>Tip: </strong>Move mouse cursor over the
2122
+ option label to see more information about an option</i></p>
2123
+ <table class="agca-clear form-table" width="500px">
2124
+ <?php
2125
+
2126
+ $this->print_checkbox(array(
2127
+ 'name' => 'agca_role_allbutadmin',
2128
+ 'label' => 'Exclude AGCA admin from customizations',
2129
+ 'title' => '<h3>Applying customizations</h3><br><strong>Checked</strong> - apply to all users, except admin<br><strong>Not checked</strong> - apply to everyone</br></br><strong>Q</strong>: Who is AGCA administrator?</br><strong>A</strong>: Go to <i>Advanced</i> tab and change capability option to define administrators. Only the users with selected capability will be AGCA administrators.</br>'
2130
+ ));
2131
+
2132
+ $this->print_options_h3('Pages');
2133
+
2134
+ $this->print_checkbox(array(
2135
+ 'hide' => true,
2136
+ 'name' => 'agca_screen_options_menu',
2137
+ 'label' => '"Screen Options" menu',
2138
+ 'title' => 'Hides the menu from the admin pages (located on the top right corner of the page, below the admin bar)'
2139
+ ));
2140
+
2141
+ $this->print_checkbox(array(
2142
+ 'hide' => true,
2143
+ 'name' => 'agca_help_menu',
2144
+ 'label' => '"Help" menu',
2145
+ 'title' => 'Hides the menu from the admin pages (located on the top right corner of the page, below the admin bar)'
2146
+ ));
2147
+
2148
+ $this->print_options_h3('Security');
2149
+
2150
+ ?>
2151
+
2152
+ <tr valign="center">
2153
+ <th scope="row">
2154
+ <label
2155
+ title="Choose which WordPress capability will be used to distinguish AGCA admin users from other users.</br>AGCA admin users have access to AGCA settings. AGCA administrators can be excluded from customizations if that option is checked"
2156
+ for="agca_admin_capability">AGCA admin capability:</label>
2157
+ </th>
2158
+ <td><?php echo $this->admin_capabilities; ?>&nbsp;&nbsp;<i>(<strong>Edit Dashboard</strong>
2159
+ - selected by default)</i>
2160
+ <p style="margin-left:5px;"><i>Find more information about <a
2161
+ href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">WordPress
2162
+ capabilities</a></i></p>
2163
+ </td>
2164
+ <td>
2165
+ </td>
2166
+ </tr>
2167
+ <?php
2168
+ $this->print_options_h3('Feedback and Support');
2169
+
2170
+ ?>
2171
+ <tr valign="center">
2172
+ <td colspan="2">
2173
+ <div class="agca-feedback-and-support">
2174
+ <ul>
2175
+ <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=feature"
2176
+ target="_blank"><span class="dashicons dashicons-lightbulb"></span>&nbsp;&nbsp;Idea
2177
+ for improvement</a> - submit your idea for improvement
2178
+ </li>
2179
+ </ul>
2180
+ <ul>
2181
+ <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=bug"
2182
+ target="_blank"><span class="dashicons dashicons-megaphone"></span>&nbsp;&nbsp;Report
2183
+ an issue</a> - if plugin does not work as expected
2184
+ </li>
2185
+ </ul>
2186
+ <ul>
2187
+ <li><a href="http://wordpressadminpanel.com/agca-support/contact/?type=theme"
2188
+ target="_blank"><span class="dashicons dashicons-art"></span>&nbsp;&nbsp;Idea
2189
+ for admin theme</a> - submit your idea for admin theme
2190
+ </li>
2191
+ </ul>
2192
+ <ul>
2193
+ <li><a href="https://wordpress.org/support/view/plugin-reviews/ag-custom-admin"
2194
+ target="_blank"><span class="dashicons dashicons-awards"></span>&nbsp;&nbsp;Add
2195
+ a review on WordPress.org</a> - add your review and rate us on
2196
+ WordPress.org
2197
+ </li>
2198
+ </ul>
2199
+ <ul>
2200
+ <li><a href="http://wordpressadminpanel.com/agca-support/" target="_blank"><span
2201
+ class="dashicons dashicons-shield-alt"></span>&nbsp;&nbsp;Visit our
2202
+ support site</a> - for any other questions, feel free to contact us
2203
+ </li>
2204
+ </ul>
2205
+ <ul>
2206
+ <li>
2207
+ <a href="http://wordpressadminpanel.com/agca-support/support-for-future-development/"
2208
+ target="_blank"><span class="dashicons dashicons-palmtree"></span>&nbsp;&nbsp;Donate</a>
2209
+ - only if you find this plugin helpful for your needs
2210
+ </li>
2211
+ </ul>
2212
+ </div>
2213
+ </td>
2214
+ <td></td>
2215
+ </tr>
2216
+ </table>
2217
+ </div>
2218
+ <div id="section_admin_bar" class="ag_section">
2219
+ <h2 class="section_title">Admin Bar Settings</h2>
2220
+ <table class="form-table" width="500px">
2221
+
2222
+ <?php
2223
+ $this->print_checkbox(array(
2224
+ 'attributes' => array(
2225
+ 'class' => 'ag_table_major_options',
2226
+ ),
2227
+ 'hide' => true,
2228
+ 'title' => 'Hides admin bar completely from the admin panel',
2229
+ 'name' => 'agca_header',
2230
+ 'label' => '<strong>Admin bar</strong>',
2231
+ 'input-attributes' => 'data-dependant="#agca_header_show_logout_content"',
2232
+ 'input-class' => 'has-dependant',
2233
+ ));
2234
+
2235
+ $this->print_checkbox(array(
2236
+ 'attributes' => array(
2237
+ 'class' => 'ag_table_major_options',
2238
+ 'style' => ((get_option('agca_header') != 'true') ? 'display:none' : ''),
2239
+ 'id' => 'agca_header_show_logout_content',
2240
+ ),
2241
+ 'title' => 'Check this if you want to show Log Out button in top right corner of the admin page',
2242
+ 'name' => 'agca_header_show_logout',
2243
+ 'checked' => ((get_option('agca_header') == true) && (get_option('agca_header_show_logout') == true)),
2244
+ 'label' => '<strong>(but show Log Out button)</strong>'
2245
+ ));
2246
+
2247
+ $this->print_checkbox(array(
2248
+ 'title' => 'Removes admin bar customizations for authenticated users on site pages.</br>This option can be useful if you want to remove AGCA scripts (styles, JavaScript) on your website for any reason.',
2249
+ 'name' => 'agca_admin_bar_frontend',
2250
+ 'hide' => true,
2251
+ 'label' => 'Site pages: Admin bar customizations'
2252
+ ));
2253
+
2254
+ $this->print_checkbox(array(
2255
+ 'title' => 'Hides admin bar completely for authenticated users on site pages.',
2256
+ 'name' => 'agca_admin_bar_frontend_hide',
2257
+ 'hide' => true,
2258
+ 'label' => 'Site pages: Admin bar'
2259
+ ));
2260
+
2261
+ $this->print_options_h3('Left Side');
2262
+
2263
+ $this->print_input(array(
2264
+ 'title' => 'Change default WordPress logo with custom image.',
2265
+ 'name' => 'agca_wp_logo_custom',
2266
+ 'label' => 'Admin bar logo',
2267
+ 'hint' => 'Image URL (maximum height is 28px)'
2268
+ ));
2269
+
2270
+ $this->print_input(array(
2271
+ 'title' => 'Custom link on admin bar logo.</br></br>Use:</br><strong>%BLOG%</strong> - for blog URL</br><strong>%SWITCH%</strong> - to switch betweent admin and site area',
2272
+ 'name' => 'agca_wp_logo_custom_link',
2273
+ 'label' => 'Admin bar logo link',
2274
+ 'hint' => 'Link'
2275
+ ));
2276
+
2277
+ $this->print_input(array(
2278
+ 'title' => 'Customize WordPress title using custom title template.</br></br>Examples:</br><strong>%BLOG% -- %PAGE%</strong> (will be) <i>My Blog -- Add New Post</i></br><strong>%BLOG%</strong> (will be) <i>My Blog</i></br><strong>My Company > %BLOG% > %PAGE%</strong> (will be) <i>My Company > My Blog > Tools</i>',
2279
+ 'name' => 'agca_custom_title',
2280
+ 'label' => 'Page title template',
2281
+ 'hint' => 'Please use <strong>%BLOG%</strong> and <strong>%PAGE%</strong> in your title template.'
2282
+ ));
2283
+
2284
+ $this->print_input(array(
2285
+ 'title' => 'Add custom image on the top of the admin content.',
2286
+ 'name' => 'agca_header_logo_custom',
2287
+ 'label' => 'Header image',
2288
+ 'hint' => 'Image URL'
2289
+ ));
2290
+
2291
+
2292
+ $this->print_checkbox(array(
2293
+ 'hide' => true,
2294
+ 'title' => 'Hides small Wordpress logo from the admin bar',
2295
+ 'name' => 'agca_header_logo',
2296
+ 'label' => 'WordPress logo'
2297
+ ));
2298
+
2299
+ $this->print_checkbox(array(
2300
+ 'hide' => true,
2301
+ 'title' => 'Hides WordPress context menu on WordPress logo icon from admin bar',
2302
+ 'name' => 'agca_remove_top_bar_dropdowns',
2303
+ 'label' => 'WordPress logo context menu'
2304
+ ));
2305
+
2306
+ $this->print_checkbox(array(
2307
+ 'hide' => true,
2308
+ 'title' => 'Hides site name link from the admin bar',
2309
+ 'name' => 'agca_remove_site_link',
2310
+ 'label' => 'Site name'
2311
+ ));
2312
+
2313
+ $this->print_checkbox(array(
2314
+ 'hide' => true,
2315
+ 'title' => 'Hides update notifications from admin bar',
2316
+ 'name' => 'agca_admin_bar_update_notifications',
2317
+ 'label' => 'Update notifications'
2318
+ ));
2319
+
2320
+ $this->print_checkbox(array(
2321
+ 'hide' => true,
2322
+ 'title' => 'Hides comments block from admin bar',
2323
+ 'name' => 'agca_admin_bar_comments',
2324
+ 'label' => '"Comments" block'
2325
+ ));
2326
+
2327
+ $this->print_checkbox(array(
2328
+ 'hide' => true,
2329
+ 'attributes' => array(
2330
+ 'style' => 'margin-top:20px;'
2331
+ ),
2332
+ 'title' => 'Hides "+ New" block and its context menu from admin bar',
2333
+ 'name' => 'agca_admin_bar_new_content',
2334
+ 'label' => '"+ New" block',
2335
+ 'input-attributes' => 'data-dependant=".new_content_header_submenu"',
2336
+ 'input-class' => 'has-dependant dependant-opposite'
2337
+ ));
2338
+
2339
+ $this->print_checkbox(array(
2340
+ 'hide' => true,
2341
+ 'attributes' => array(
2342
+ 'class' => 'new_content_header_submenu'
2343
+ ),
2344
+ 'title' => 'Hides "Post" sub-menu from "+ New" block on admin bar',
2345
+ 'name' => 'agca_admin_bar_new_content_post',
2346
+ 'label' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Post sub-menu'
2347
+ ));
2348
+
2349
+ $this->print_checkbox(array(
2350
+ 'hide' => true,
2351
+ 'attributes' => array(
2352
+ 'class' => 'new_content_header_submenu'
2353
+ ),
2354
+ 'title' => 'Hides "Link" sub-menu from "+ New" block on admin bar',
2355
+ 'name' => 'agca_admin_bar_new_content_link',
2356
+ 'label' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Link sub-menu'
2357
+ ));
2358
+
2359
+ $this->print_checkbox(array(
2360
+ 'hide' => true,
2361
+ 'attributes' => array(
2362
+ 'class' => 'new_content_header_submenu'
2363
+ ),
2364
+ 'title' => 'Hides "Page" sub-menu from "+ New" block on admin bar',
2365
+ 'name' => 'agca_admin_bar_new_content_page',
2366
+ 'label' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Page sub-menu'
2367
+ ));
2368
+
2369
+ $this->print_checkbox(array(
2370
+ 'hide' => true,
2371
+ 'attributes' => array(
2372
+ 'class' => 'new_content_header_submenu'
2373
+ ),
2374
+ 'title' => 'Hides "User" sub-menu from "+ New" block on admin bar',
2375
+ 'name' => 'agca_admin_bar_new_content_user',
2376
+ 'label' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> User sub-menu'
2377
+ ));
2378
+
2379
+ $this->print_checkbox(array(
2380
+ 'hide' => true,
2381
+ 'attributes' => array(
2382
+ 'class' => 'new_content_header_submenu'
2383
+ ),
2384
+ 'title' => 'Hides "Media" sub-menu from "+ New" block on admin bar',
2385
+ 'name' => 'agca_admin_bar_new_content_media',
2386
+ 'label' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ New" -> Media sub-menu'
2387
+ ));
2388
+
2389
+ $this->print_checkbox(array(
2390
+ 'hide' => true,
2391
+ 'title' => 'Hides "Admin themes" from admin bar',
2392
+ 'name' => 'agca_admin_bar_admin_themes',
2393
+ 'label' => '"Admin themes"'
2394
+ ));
2395
+
2396
+ $this->print_textarea(array(
2397
+ 'title' => 'Adds custom text in admin top bar.',
2398
+ 'name' => 'agca_custom_site_heading',
2399
+ 'label' => 'Custom blog heading',
2400
+ 'hint' => "<strong>Tip: </strong>You can use HTML tags like &lt;h1&gt; or &lt;a&gt;"
2401
+ ));
2402
+
2403
+
2404
+ $this->print_checkbox(array(
2405
+ 'hide' => true,
2406
+ 'title' => 'Hides yellow bar with information about new WordPress release',
2407
+ 'name' => 'agca_update_bar',
2408
+ 'label' => 'Update WordPress notification'
2409
+ ));
2410
+
2411
+ $this->print_options_h3('Right Side');
2412
+
2413
+ $this->print_input(array(
2414
+ 'name' => 'agca_howdy',
2415
+ 'label' => 'Change Howdy text',
2416
+ ));
2417
+
2418
+ $this->print_input(array(
2419
+ 'title' => 'Put \'Exit\', for example',
2420
+ 'name' => 'agca_logout',
2421
+ 'label' => 'Change Log out text',
2422
+ ));
2423
+
2424
+ $this->print_checkbox(array(
2425
+ 'hide' => true,
2426
+ 'name' => 'agca_remove_your_profile',
2427
+ 'label' => '"Edit My Profile" option from dropdown menu'
2428
+ ));
2429
+
2430
+ $this->print_checkbox(array(
2431
+ 'title' => 'If selected, hides all elements in top right corner, except Log Out button',
2432
+ 'name' => 'agca_logout_only',
2433
+ 'label' => 'Log out only'
2434
+ ));
2435
+
2436
+ ?>
2437
+
2438
+ </table>
2439
+ </div>
2440
+
2441
+ <div id="section_admin_footer" style="display:none" class="ag_section">
2442
+ <h2 class="section_title">Admin Footer Settings</h2>
2443
+ <table class="form-table" width="500px">
2444
+ <?php
2445
+ $this->print_checkbox(array(
2446
+ 'hide' => true,
2447
+ 'attributes' => array(
2448
+ 'class' => 'ag_table_major_options'
2449
+ ),
2450
+ 'title' => 'Hides footer with all elements',
2451
+ 'name' => 'agca_footer',
2452
+ 'label' => '<strong>Footer</strong>'
2453
+ ));
2454
+
2455
+ $this->print_options_h3('Footer Options');
2456
+
2457
+ $this->print_checkbox(array(
2458
+ 'hide' => true,
2459
+ 'title' => 'Hides default text in footer',
2460
+ 'name' => 'agca_footer_left_hide',
2461
+ 'label' => 'Footer text'
2462
+ ));
2463
+
2464
+ $this->print_textarea(array(
2465
+ 'title' => 'Replaces text \'Thank you for creating with WordPress\' with custom text',
2466
+ 'name' => 'agca_footer_left',
2467
+ 'label' => 'Change footer text'
2468
+ ));
2469
+
2470
+ $this->print_checkbox(array(
2471
+ 'hide' => true,
2472
+ 'title' => 'Hides text \'Get Version ...\' on right',
2473
+ 'name' => 'agca_footer_right_hide',
2474
+ 'label' => 'Version text'
2475
+ ));
2476
+
2477
+ $this->print_textarea(array(
2478
+ 'title' => 'Replaces text \'Get Version ...\' with custom text',
2479
+ 'name' => 'agca_footer_right',
2480
+ 'label' => 'Change version text'
2481
+ ));
2482
+
2483
+ ?>
2484
+
2485
+ </table>
2486
+ </div>
2487
+ <div id="section_dashboard_page" style="display:none" class="ag_section">
2488
+ <h2 class="section_title">Dashboard Page Settings</h2>
2489
+ <table class="form-table" width="500px">
2490
+ <?php
2491
+
2492
+ $this->print_options_h3('Dashboard Page Options');
2493
+
2494
+ $this->print_input(array(
2495
+ 'title' => "Main heading ('Dashboard') on Dashboard page",
2496
+ 'name' => 'agca_dashboard_text',
2497
+ 'label' => 'Change Dashboard heading text',
2498
+ ));
2499
+
2500
+ ?>
2501
+ <tr valign="center">
2502
+ <th scope="row">
2503
+ <label
2504
+ title="Adds custom text (or HTML) between heading and widgets area on Dashboard page"
2505
+ for="agca_dashboard_text_paragraph">Add custom Dashboard content<br> <em>(text or
2506
+ HTML content)</em></label>
2507
+ </th>
2508
+ <td class="agca_editor">
2509
+ <?php $this->getTextEditor('agca_dashboard_text_paragraph'); ?>
2510
+ </td>
2511
+ </tr>
2512
+ <?php
2513
+
2514
+ $this->print_options_h3('Dashboard Widgets Options');
2515
+
2516
+ ?>
2517
+ <tr>
2518
+ <td colspan="2">
2519
+ <p tabindex="0" class="agca-tip"><i><strong>Note:</strong> These settings override
2520
+ settings in Screen options on Dashboard page.</i></p>
2521
+ </td>
2522
+ </tr>
2523
+ <?php
2524
+ $this->print_checkbox(array(
2525
+ 'hide' => true,
2526
+ 'title' => 'Hides Welcome WordPress widget',
2527
+ 'name' => 'agca_dashboard_widget_welcome',
2528
+ 'label' => '"Welcome" widget'
2529
+ ));
2530
+
2531
+ $this->print_checkbox(array(
2532
+ 'hide' => true,
2533
+ 'title' => 'Hides Activity dashboard widget',
2534
+ 'name' => 'agca_dashboard_widget_activity',
2535
+ 'label' => '"Activity" widget'
2536
+ ));
2537
+
2538
+ $this->print_checkbox(array(
2539
+ 'hide' => true,
2540
+ 'title' => 'Hides Quick Draft dashboard widget',
2541
+ 'name' => 'agca_dashboard_widget_qp',
2542
+ 'label' => '"Quick Draft" widget'
2543
+ ));
2544
+
2545
+ $this->print_checkbox(array(
2546
+ 'hide' => true,
2547
+ 'title' => 'Hides At a Glance dashboard widget',
2548
+ 'name' => 'agca_dashboard_widget_rn',
2549
+ 'label' => '"At a Glance" widget'
2550
+ ));
2551
+
2552
+ $this->print_checkbox(array(
2553
+ 'hide' => true,
2554
+ 'name' => 'agca_dashboard_widget_primary',
2555
+ 'title' => "This is 'WordPress News' or 'WordPress Development Blog' widget in older WordPress versions",
2556
+ 'label' => '"WordPress News" widget'
2557
+ ));
2558
+
2559
+ $this->print_checkbox(array(
2560
+ 'hide' => true,
2561
+ 'name' => 'agca_dashboard_widget_secondary',
2562
+ 'title' => "This is 'Other WordPress News' widget by default",
2563
+ 'label' => 'Secondary widget area'
2564
+ ));
2565
+
2566
+ ?>
2567
+ </table>
2568
+ </div>
2569
+ <div id="section_login_page" style="display:none" class="ag_section">
2570
+ <h2 class="section_title">Login Page Settings</h2>
2571
+ <table class="form-table" width="500px">
2572
+ <?php
2573
+
2574
+ $this->print_options_h3('Login Page Options');
2575
+
2576
+ $this->print_checkbox(array(
2577
+ 'hide' => true,
2578
+ 'name' => 'agca_login_banner',
2579
+ 'title' => "Hide back to blog block",
2580
+ 'label' => 'Back to blog text'
2581
+ ));
2582
+
2583
+ $this->print_textarea(array(
2584
+ 'name' => 'agca_login_banner_text',
2585
+ 'title' => "Changes '<- Back to ...' text in top bar on Login page",
2586
+ 'label' => 'Change back to blog text',
2587
+ 'hint' => 'Should be wrapped with an anchor tag &lt;a&gt;&lt;/a&gt;'
2588
+ ));
2589
+
2590
+ $this->print_input(array(
2591
+ 'title' => 'If this field is not empty, image from provided url will be visible on Login page',
2592
+ 'name' => 'agca_login_photo_url',
2593
+ 'label' => 'Change Login header image',
2594
+ 'hint' => 'Image URL'
2595
+ ));
2596
+
2597
+ $this->print_input(array(
2598
+ 'title' => 'Put here custom link to a web location, that will be triggered on image click',
2599
+ 'name' => 'agca_login_photo_href',
2600
+ 'label' => 'Change link on login image',
2601
+ 'hint' => 'For blog URL use %BLOG%'
2602
+ ));
2603
+
2604
+ $this->print_checkbox(array(
2605
+ 'hide' => true,
2606
+ 'title' => 'Hides login image completely',
2607
+ 'name' => 'agca_login_photo_remove',
2608
+ 'label' => 'Login header image',
2609
+ ));
2610
+
2611
+ $this->print_checkbox(array(
2612
+ 'title' => 'Rounds box on login page',
2613
+ 'name' => 'agca_login_round_box',
2614
+ 'label' => 'Round box corners',
2615
+ 'input-class' => 'has-dependant',
2616
+ 'input-attributes' => 'data-dependant="#agca_login_round_box_size_block"'
2617
+ ));
2618
+
2619
+ $this->print_input(array(
2620
+ 'attributes' => array(
2621
+ 'style' => ((get_option('agca_login_round_box') == 'true') ? 'display:none' : ''),
2622
+ 'id' => 'agca_login_round_box_size_block'
2623
+ ),
2624
+ 'title' => 'Size of rounded box curve',
2625
+ 'name' => 'agca_login_round_box_size',
2626
+ 'label' => 'Round box corners - size',
2627
+ 'input-class' => 'validateNumber',
2628
+ 'hint' => '(Size in px)'
2629
+ ));
2630
+
2631
+ $this->print_checkbox(array(
2632
+ 'hide' => true,
2633
+ 'title' => 'Hides register link on login page',
2634
+ 'name' => 'agca_login_register_remove',
2635
+ 'label' => 'Register link',
2636
+ 'input-class' => 'has-dependant dependant-opposite',
2637
+ 'input-attributes' => 'data-dependant="#agca_login_register_href_block"'
2638
+ ));
2639
+
2640
+ $this->print_input(array(
2641
+ 'attributes' => array(
2642
+ 'style' => ((get_option('agca_login_register_remove') == 'true') ? 'display:none' : ''),
2643
+ 'id' => 'agca_login_register_href_block'
2644
+ ),
2645
+ 'title' => 'Change register link on login page to point to your custom registration page.',
2646
+ 'name' => 'agca_login_register_href',
2647
+ 'label' => 'Change register link',
2648
+ 'hint' => 'Link to new registration page'
2649
+ ));
2650
+
2651
+ $this->print_checkbox(array(
2652
+ 'hide' => true,
2653
+ 'title' => 'Hides lost password link on login page',
2654
+ 'name' => 'agca_login_lostpassword_remove',
2655
+ 'label' => 'Lost password link',
2656
+ ));
2657
+ ?>
2658
+ </table>
2659
+ </div>
2660
+ <?php
2661
+ /*ADMIN MENU*/
2662
+ ?>
2663
+ <div id="section_admin_menu" style="display:none" class="ag_section">
2664
+ <h2 class="section_title">Admin Menu Settings</h2>
2665
+ <table class="form-table" width="500px">
2666
+ <tr valign="center" class="ag_table_major_options">
2667
+ <td><label for="agca_admin_menu_turnonoff"><strong>Apply admin menu customizations</strong></label>
2668
+ </td>
2669
+ <td>
2670
+ <strong>
2671
+
2672
+ <input class="agca-radio" type="radio" id="agca_admin_menu_turnonoff_on"
2673
+ name="agca_admin_menu_turnonoff" title="Apply admin menu customizations"
2674
+ value="on" <?php if (get_option('agca_admin_menu_turnonoff') == 'on') echo 'checked="checked" '; ?> />
2675
+ <span class="agca-radio-text on">YES</span>
2676
+ &nbsp;&nbsp;&nbsp;&nbsp;
2677
+ <input class="agca-radio" type="radio" name="agca_admin_menu_turnonoff"
2678
+ title="Do not apply admin menu customizations"
2679
+ value="off" <?php if (get_option('agca_admin_menu_turnonoff') != 'on') echo 'checked="checked"'; ?> />
2680
+ <span class="agca-radio-text off">NO</span>
2681
+ </strong>
2682
+ </td>
2683
+ </tr>
2684
+ <tr valign="center" class="ag_table_major_options">
2685
+ <td><label for="agca_admin_menu_agca_button_only"><strong>Admin menu</strong></label></td>
2686
+ <td><input class="agca-checkbox visibility" type="checkbox"
2687
+ name="agca_admin_menu_agca_button_only"
2688
+ title="Hides admin menu completly (administrator can see 'AG custom admin' button)"
2689
+ value="true" <?php if (get_option('agca_admin_menu_agca_button_only') == true) echo 'checked="checked" '; ?> />
2690
+ </td>
2691
+ </tr>
2692
+ <?php
2693
+ $this->print_options_h3('Edit / Remove Menu Items');
2694
+ ?>
2695
+ <tr>
2696
+ <td colspan="2">
2697
+ <input type="button" class="agca_button" id="ag_edit_adminmenu_reset_button"
2698
+ title="Reset menu settings to default values"
2699
+ name="ag_edit_adminmenu_reset_button" value="Reset to default settings"/><br/>
2700
+ <p tabindex="0"><em>(click on the top menu item to show its sub-menus)</em></p>
2701
+ <table id="ag_edit_adminmenu">
2702
+ <tr style="background-color:#999;">
2703
+ <td width="300px">
2704
+ <div style="float:left;color:#fff;"><h3>Item</h3></div>
2705
+ <div style="float:right;color:#fff;"><h3>Visibility</h3></div>
2706
+ </td>
2707
+ <td width="300px" style="color:#fff;"><h3>Change Text</h3>
2708
+ </td>
2709
+ </tr>
2710
+ </table>
2711
+ <input type="hidden" size="47" id="ag_edit_adminmenu_json" name="ag_edit_adminmenu_json"
2712
+ value="<?php echo htmlspecialchars(get_option('ag_edit_adminmenu_json')); ?>"/>
2713
+ <input type="hidden" size="47" id="ag_edit_adminmenu_json_new"
2714
+ name="ag_edit_adminmenu_json_new" value=""/>
2715
+ </td>
2716
+ <td></td>
2717
+ </tr>
2718
+ <?php
2719
+ $this->print_options_h3('Add New Menu Items');
2720
+ ?>
2721
+ <tr>
2722
+ <td colspan="2">
2723
+ <table id="ag_add_adminmenu">
2724
+ <tr>
2725
+ <td colspan="2">
2726
+ name:<input type="text" size="47" title="New button visible name"
2727
+ id="ag_add_adminmenu_name" name="ag_add_adminmenu_name"/>
2728
+ url:<input type="text" size="47" title="New button link"
2729
+ id="ag_add_adminmenu_url" name="ag_add_adminmenu_url"/>
2730
+ open in:<select id="ag_add_adminmenu_target" class="agca-selectbox"
2731
+ style="width:95px">
2732
+ <option value="_self" selected>same tab</option>
2733
+ <option value="_blank">new tab</option>
2734
+ </select>
2735
+ <input type="button" id="ag_add_adminmenu_button" class="agca_button"
2736
+ title="Add new item button" name="ag_add_adminmenu_button"
2737
+ value="Add new item"/>
2738
+ </td>
2739
+ <td></td>
2740
+ </tr>
2741
+ </table>
2742
+ <input type="hidden" size="47" id="ag_add_adminmenu_json" name="ag_add_adminmenu_json"
2743
+ value="<?php echo htmlspecialchars(get_option('ag_add_adminmenu_json')); ?>"/>
2744
+ </td>
2745
+ <td>
2746
+ </td>
2747
+ </tr>
2748
+ <?php
2749
+ $this->print_options_h3('Admin Menu Settings');
2750
+ ?>
2751
+ <tr valign="center">
2752
+ <th scope="row">
2753
+ <label title="Choose how admin menu should behave on mobile devices / small screens"
2754
+ for="agca_admin_menu_autofold">Admin menu auto folding</label>
2755
+ </th>
2756
+ <td>
2757
+ <select title="Choose how admin menu should behave on mobile devices / small screens"
2758
+ class="agca-selectbox" name="agca_admin_menu_autofold">
2759
+ <option
2760
+ value="" <?php echo (get_option('agca_admin_menu_autofold') == "") ? " selected " : ""; ?> >
2761
+ Default
2762
+ </option>
2763
+ <option
2764
+ value="force" <?php echo (get_option('agca_admin_menu_autofold') == "force") ? " selected " : ""; ?> >
2765
+ Force admin menu auto-folding
2766
+ </option>
2767
+ <option
2768
+ value="disable" <?php echo (get_option('agca_admin_menu_autofold') == "disable") ? " selected " : ""; ?> >
2769
+ Disable admin menu auto-folding
2770
+ </option>
2771
+ </select>
2772
+ </td>
2773
+ </tr>
2774
+ <?php
2775
+
2776
+ $this->print_checkbox(array(
2777
+ 'hide' => true,
2778
+ 'title' => 'Removes empty space between some top menu items',
2779
+ 'name' => 'agca_admin_menu_separators',
2780
+ 'label' => 'Menu items separators',
2781
+ ));
2782
+
2783
+ $this->print_checkbox(array(
2784
+ 'hide' => true,
2785
+ 'title' => 'Removes icons from dmin menu buttons',
2786
+ 'name' => 'agca_admin_menu_icons',
2787
+ 'label' => 'Menu icons',
2788
+ ));
2789
+
2790
+ $this->print_checkbox(array(
2791
+ 'hide' => true,
2792
+ 'title' => 'Removes small arrow that appears on the top button hover',
2793
+ 'name' => 'agca_admin_menu_arrow',
2794
+ 'label' => 'Sub-menu arrow',
2795
+ ));
2796
+
2797
+ $this->print_checkbox(array(
2798
+ 'hide' => true,
2799
+ 'title' => 'Removes collapse button at the end of admin menu',
2800
+ 'name' => 'agca_admin_menu_collapse_button',
2801
+ 'label' => '"Collapse menu" button',
2802
+ ));
2803
+
2804
+ $this->print_checkbox(array(
2805
+ 'title' => 'Rounds submenu pop-up box',
2806
+ 'name' => 'agca_admin_menu_submenu_round',
2807
+ 'label' => 'Round sub-menu pop-up box',
2808
+ 'input-attributes' => 'data-dependant="#agca_admin_menu_submenu_round_size"',
2809
+ 'input-class' => 'has-dependant',
2810
+ ));
2811
+
2812
+ $this->print_input(array(
2813
+ 'attributes' => array(
2814
+ 'style' => ((get_option('agca_admin_menu_submenu_round') != 'true') ? 'display:none' : ''),
2815
+ 'id' => 'agca_admin_menu_submenu_round_size'
2816
+ ),
2817
+ 'title' => 'Size of rounded box curve',
2818
+ 'name' => 'agca_admin_menu_submenu_round_size',
2819
+ 'label' => 'Round sub-menu pop-up box - size',
2820
+ 'input-class' => 'validateNumber',
2821
+ 'hint' => '(Size in px)'
2822
+ ));
2823
+
2824
+ $this->print_input(array(
2825
+ 'title' => 'Adds custom logo above the admin menu',
2826
+ 'name' => 'agca_admin_menu_brand',
2827
+ 'label' => 'Admin menu branding with logo',
2828
+ 'hint' => 'Image URL'
2829
+ ));
2830
+
2831
+ $this->print_input(array(
2832
+ 'title' => 'Change branding logo link</br></br>Use:</br><strong>%BLOG%</strong> - for blog URL',
2833
+ 'name' => 'agca_admin_menu_brand_link',
2834
+ 'label' => 'Branding logo link',
2835
+ 'hint' => 'Branding image URL'
2836
+ ));
2837
+ ?>
2838
+ </table>
2839
+ </div>
2840
+ <div id="section_ag_colorizer_settings" style="display:none" class="ag_section">
2841
+ <h2 class="section_title">Colorizer Page</h2>
2842
+ <table class="form-table" width="500px">
2843
+ <tr valign="center" class="ag_table_major_options">
2844
+ <td><label for="agca_colorizer_turnonoff"><strong>Apply Colorizer settings</strong></label>
2845
+ </td>
2846
+ <td><strong><input class="agca-radio" type="radio" name="agca_colorizer_turnonoff"
2847
+ title="Apply Colorizer customizations"
2848
+ value="on" <?php if (get_option('agca_colorizer_turnonoff') == 'on') echo 'checked="checked" '; ?> /><span
2849
+ class="agca-radio-text on">YES</span>&nbsp;&nbsp;&nbsp;&nbsp;<input
2850
+ class="agca-radio" type="radio" name="agca_colorizer_turnonoff"
2851
+ title="Do not apply Colorizer customizations"
2852
+ value="off" <?php if (get_option('agca_colorizer_turnonoff') != 'on') echo 'checked="checked"'; ?> /><span
2853
+ class="agca-radio-text off">NO</span></strong></td>
2854
+ </tr>
2855
+ <?php
2856
+ $this->print_options_h3('Global Color Options');
2857
+
2858
+ $this->print_color('color_background', 'Background:', 'Change admin page background color');
2859
+ $this->print_color('login_color_background', 'Login page background:', 'Change login page background color');
2860
+ $this->print_color('color_header', 'Admin bar:', 'Change admin bar (on top) color in admin panel');
2861
+
2862
+ $this->print_options_h3('Admin Menu Color Options');
2863
+
2864
+ $this->print_color('color_admin_menu_top_button_background', 'Button background:', 'Change button background color');
2865
+ $this->print_color('color_admin_menu_font', 'Button text:', 'Change button text color');
2866
+ $this->print_color('color_admin_menu_top_button_current_background', 'Selected button background:', 'Change button background color for current button');
2867
+ $this->print_color('color_admin_menu_top_button_hover_background', 'Hover button background:', 'Change button background color on mouseover');
2868
+ $this->print_color('color_admin_menu_submenu_background', 'Sub-menu button background:', 'Change submenu item background color');
2869
+ $this->print_color('color_admin_menu_submenu_background_hover', 'Sub-menu hover button background:', 'Change submenu item background color on mouseover');
2870
+ $this->print_color('color_admin_submenu_font', 'Sub-menu text:', 'Sub-menu text color');
2871
+ $this->print_color('color_admin_menu_behind_background', 'Wrapper background:', 'Change background color of element behind admin menu');
2872
+
2873
+ $this->print_options_h3('Font Color Options');
2874
+
2875
+ $this->print_color('color_font_content', 'Content text:', 'Change color in content text');
2876
+ $this->print_color('color_font_header', 'Admin bar text:', 'Change color of admin bar text');
2877
+ $this->print_color('color_font_footer', 'Footer text:', 'Change color in fotter text');
2878
+
2879
+ $this->print_options_h3('Widgets Color Options');
2880
+
2881
+ $this->print_color('color_widget_bar', 'Title bar background:', 'Change color in header text');
2882
+ $this->print_color('color_widget_background', 'Background:', 'Change widget background color');
2883
+
2884
+ ?>
2885
+ </table>
2886
+ <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json"
2887
+ value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>"/>
2888
+ <div id="picker"></div>
2889
+ </div>
2890
+ <div id="section_templates" style="display:none" class="ag_section">
2891
+ <h2 class="section_title"><span style="float:left">Admin Themes</span></h2>
2892
+ <table class="form-table" width="500px">
2893
+ <tr valign="center">
2894
+ <td>
2895
+ <div id="agca_templates"></div>
2896
+ </td>
2897
+ </tr>
2898
+ <tr>
2899
+ <td>
2900
+ <div id="advanced_template_options" style="display:none">
2901
+ <div class="agca-feedback-and-support">
2902
+ <ul>
2903
+ <li>
2904
+ <a href="http://wordpressadminpanel.com/agca-support/contact/?type=theme"
2905
+ title="If you have any ideas for theme improvements, or you have new themes requests, please feel free to send us a message"
2906
+ target="_blank"><span class="dashicons dashicons-art"></span>&nbsp;&nbsp;Submit
2907
+ your admin themes ideas</a></li>
2908
+ <li><a style="background: #f08080;color:#fff;"
2909
+ href="javascript:agca_removeAllTemplates();"
2910
+ title="WARNING: All installed themes will be removed. To activate them again, you would need to install theme and activate using valid license keys. Free themes can be installed again."><span
2911
+ style="color:#fff" class="dashicons dashicons-trash"></span>&nbsp;&nbsp;Uninstall
2912
+ all installed themes</a></li>
2913
+ </ul>
2914
+ </div>
2915
+ </div>
2916
+ </td>
2917
+ </tr>
2918
+ </table>
2919
+ </div>
2920
+ <div id="section_advanced" style="display:none" class="ag_section">
2921
+ <h2 class="section_title">Advanced</h2>
2922
+ <table class="form-table" width="500px">
2923
+ <tr valign="center">
2924
+ <td colspan="2">
2925
+ <p class="agca-tip"><i><strong>Note: </strong>These options will override existing
2926
+ customizations</i></p>
2927
+ </td>
2928
+ <td></td>
2929
+ </tr>
2930
+ <tr valign="center">
2931
+ <th scope="row">
2932
+ <label title="Add custom CSS script to override existing styles" for="agca_script_css">Custom
2933
+ CSS script</em></label>
2934
+ </th>
2935
+ <td>
2936
+ <textarea style="width:100%;height:200px"
2937
+ title="Add custom CSS script to override existing styles" rows="5"
2938
+ id="agca_custom_css" name="agca_custom_css"
2939
+ cols="40"><?php echo htmlspecialchars(get_option('agca_custom_css')); ?></textarea>
2940
+ </td>
2941
+ </tr>
2942
+ <tr valign="center">
2943
+ <th scope="row">
2944
+ <label title="Add additional custom JavaScript" for="agca_custom_js">Custom
2945
+ JavaScript</label>
2946
+ </th>
2947
+ <td>
2948
+ <textarea style="width:100%;height:200px" title="Add additional custom JavaScript"
2949
+ rows="5" name="agca_custom_js" id="agca_custom_js"
2950
+ cols="40"><?php echo htmlspecialchars(get_option('agca_custom_js')); ?></textarea>
2951
+ </td>
2952
+ </tr>
2953
+ <tr valign="center">
2954
+ <th scope="row">
2955
+ <label title="Export / import settings" for="agca_export_import">Export / import
2956
+ settings</label>
2957
+ </th>
2958
+ <td id="import_file_area">
2959
+ <input class="agca_button" type="button" name="agca_export_settings"
2960
+ value="Export Settings" onclick="exportSettings();"/></br>
2961
+ <input type="file" id="settings_import_file" name="settings_import_file"
2962
+ style="display: none"/>
2963
+ <input type="hidden" id="_agca_import_settings" name="_agca_import_settings"
2964
+ value="false"/>
2965
+ <input type="hidden" id="_agca_export_settings" name="_agca_export_settings"
2966
+ value="false"/>
2967
+ <input class="agca_button" type="button" name="agca_import_settings"
2968
+ value="Import Settings" onclick="importSettings();"/>
2969
+ </td>
2970
+ </tr>
2971
+ </table>
2972
+ </div>
2973
+ <p class="submit">
2974
+ <input type="button" id="save_plugin_settings" style="padding:0px"
2975
+ title="Save AG Custom Admin configuration" class="button-primary"
2976
+ value="<?php _e('Save Changes') ?>" onClick="savePluginSettings()"/>
2977
+ </p>
2978
+
2979
+ </form>
2980
+ <form id="agca_templates_form" name="agca_templates_form"
2981
+ action="<?php echo $_SERVER['PHP_SELF']; ?>?page=ag-custom-admin/plugin.php" method="post">
2982
+ <input type="hidden" name="_agca_save_template" value="true"/>
2983
+ <input type="hidden" id="templates_data" name="templates_data" value=""/>
2984
+ <input type="hidden" id="templates_name" name="templates_name" value=""/>
2985
+ </form>
2986
+ </div>
2987
+ <?php
2988
+ }
2989
+
2990
+ #region PRIVATE METHODS
2991
+ function print_checkbox($data)
2992
+ {
2993
+ $strAttributes = '';
2994
+ $strOnchange = '';
2995
+ $strInputClass = '';
2996
+ $strInputAttributes = '';
2997
+ $isChecked = false;
2998
+
2999
+ if (isset($data['attributes'])) {
3000
+ foreach ($data['attributes'] as $key => $val) {
3001
+ $strAttributes .= ' ' . $key . '="' . $val . '"';
3002
+ }
3003
+ }
3004
+ if (isset($data['input-class'])) {
3005
+ $strInputClass = $data['input-class'];
3006
+ }
3007
+ if (isset($data['hide'])) {
3008
+ $strInputClass .= " visibility";
3009
+ }
3010
+ if (isset($data['input-attributes'])) {
3011
+ $strInputAttributes = $data['input-attributes'];
3012
+ }
3013
+ if (isset($data['onchange'])) {
3014
+ $strOnchange = $data['onchange'];
3015
+ }
3016
+ if (!isset($data['title'])) {
3017
+ $data['title'] = $data['label'];
3018
+ }
3019
+ if (isset($data['checked'])) {
3020
+ $isChecked = $data['checked'];
3021
+ } else {
3022
+ //use default check with the option
3023
+ $isChecked = get_option($data['name']) == true;
3024
+ }
3025
+ ?>
3026
+ <tr valign="center" <?php echo $strAttributes ?> >
3027
+ <th>
3028
+ <label tabindex="0" title=' <?php echo $data['title'] ?>'
3029
+ for=" <?php echo $data['name'] ?>"> <?php echo $data['label'] ?></label>
3030
+ </th>
3031
+ <td>
3032
+ <input type="checkbox"
3033
+ class="agca-checkbox <?php echo $strInputClass ?> " <?php echo $strOnchange ?> <?php echo $strInputAttributes ?>
3034
+ title='Toggle on/off' name=" <?php echo $data['name'] ?>"
3035
+ value="true" <?php echo ($isChecked) ? ' checked="checked"' : '' ?> />
3036
+ </td>
3037
+ </tr>
3038
+ <?php
3039
+ }
3040
+
3041
+ function print_input($data)
3042
+ {
3043
+ $strHint = '';
3044
+ $suffix = '';
3045
+ $strAttributes = '';
3046
+ $parentAttr = '';
3047
+ if (isset($data['hint'])) {
3048
+ $strHint = '&nbsp;<p><i>' . $data['hint'] . '</i></p>';
3049
+ }
3050
+ if (!isset($data['title'])) {
3051
+ $data['title'] = $data['label'];
3052
+ }
3053
+ if (isset($data['suffix'])) {
3054
+ $suffix = $data['suffix'];
3055
+ }
3056
+ if (isset($data['attributes'])) {
3057
+ foreach ($data['attributes'] as $key => $val) {
3058
+ $strAttributes .= ' ' . $key . '="' . $val . '"';
3059
+ }
3060
+ }
3061
+ ?>
3062
+ <tr valign="center" <?php echo $strAttributes ?> >
3063
+ <th>
3064
+ <label title=" <?php echo $data['title'] ?>"
3065
+ for=" <?php echo $data['name'] ?>"> <?php echo $data['label'] ?></label>
3066
+ </th>
3067
+ <td>
3068
+ <input id=" <?php echo $data['name'] ?>" title=" <?php echo $data['title'] ?>" type="text" size="47"
3069
+ name=" <?php echo $data['name'] ?>" value="<?php echo get_option($data['name']); ?>"/>
3070
+ <a title="Clear" class="agca_button clear"
3071
+ onClick="jQuery('# <?php echo $data['name'] ?>').val('');"><span
3072
+ class="dashicons clear dashicons-no-alt"></span></a> <?php echo $suffix ?>
3073
+ <?php echo $strHint ?>
3074
+ </td>
3075
+ </tr>
3076
+ <?php
3077
+ }
3078
+
3079
+ function print_textarea($data)
3080
+ {
3081
+ $strHint = '';
3082
+ if (isset($data['hint'])) {
3083
+ $strHint = '&nbsp;<p><i>' . $data['hint'] . '</i>.</p>';
3084
+ }
3085
+ if (!isset($data['title'])) {
3086
+ $data['title'] = $data['label'];
3087
+ }
3088
+ ?>
3089
+ <tr valign="center">
3090
+ <th scope="row">
3091
+ <label title=" <?php echo $data['title'] ?>"
3092
+ for=" <?php echo $data['name'] ?>"> <?php echo $data['label'] ?></label>
3093
+ </th>
3094
+ <td>
3095
+ <textarea title=" <?php echo $data['title'] ?>" rows="5" name=" <?php echo $data['name'] ?>"
3096
+ cols="40"><?php echo htmlspecialchars(get_option($data['name'])); ?></textarea>
3097
+ <?php echo $strHint ?>
3098
+ </td>
3099
+ </tr>
3100
+ <?php
3101
+ }
3102
+
3103
+ function print_color($name, $label, $title)
3104
+ {
3105
+ ?>
3106
+ <tr valign="center" class="color">
3107
+ <th><label title=" <?php echo $title ?>" for=" <?php echo $name ?>"> <?php echo $label ?></label></th>
3108
+ <td><input type="text" id=" <?php echo $name ?>" name=" <?php echo $name ?>" class="color_picker"
3109
+ value="<?php echo $this->getAGCAColor($name); ?>"/>
3110
+ <a title="Pick Color" alt=" <?php echo $name ?>" class="pick_color_button agca_button"><span
3111
+ class="dashicons dashicons-art"></span></a>
3112
+ <a title="Clear" alt=" <?php echo $name ?>" class="pick_color_button_clear agca_button"><span
3113
+ class="dashicons clear dashicons-no-alt"></span></a>
3114
+ </td>
3115
+ </tr>
3116
+ <?php
3117
+ }
3118
+
3119
+ function print_options_h3($title)
3120
+ {
3121
+ ?>
3122
+ <tr valign="center">
3123
+ <td colspan="2">
3124
+ <div class="ag_table_heading"><h3 tabindex="0"> <?php echo $title ?></h3></div>
3125
+ </td>
3126
+ <td></td>
3127
+ </tr>
3128
+ <?php
3129
+ }
3130
+
3131
+ function print_option_tr()
3132
+ {
3133
+ ?>
3134
+
3135
+ <tr valign="center">
3136
+ <th><label title="Change submenu item background color" for="color_admin_menu_submenu_background">Submenu
3137
+ button background color:</label></th>
3138
+ <td><input type="text" id="color_admin_menu_submenu_background" name="color_admin_menu_submenu_background"
3139
+ class="color_picker"
3140
+ value="<?php echo $this->getAGCAColor('color_admin_menu_submenu_background'); ?>"/>
3141
+ <input type="button" alt="color_admin_menu_submenu_background" class="pick_color_button agca_button"
3142
+ value="Pick color"/>
3143
+ <input type="button" alt="color_admin_menu_submenu_background"
3144
+ class="pick_color_button_clear agca_button" value="Clear"/>
3145
+ </td>
3146
+ </tr>
3147
+ <?php
3148
+ }
3149
+ #endregion
3150
 
3151
  }
3152
+
3153
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpressadminpanel.com/ag-custom-admin/
4
  Tags: admin, customize, hide, change admin, themes, admin themes, admin bar, login page
5
  Requires at least: 3.0
6
  Tested up to: 4.4
7
- Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -155,6 +155,9 @@ If you have the latest WordPress and plugin versions and you still experience so
155
 
156
  == Change Log ==
157
 
 
 
 
158
  = 1.5.2 =
159
  * Small UX improvements on options
160
 
@@ -457,6 +460,9 @@ If you have the latest WordPress and plugin versions and you still experience so
457
 
458
  == Upgrade Notice ==
459
 
 
 
 
460
  = 1.5.2 =
461
  * Small UX improvements on options
462
 
4
  Tags: admin, customize, hide, change admin, themes, admin themes, admin bar, login page
5
  Requires at least: 3.0
6
  Tested up to: 4.4
7
+ Stable tag: 1.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
155
 
156
  == Change Log ==
157
 
158
+ = 1.5.3 =
159
+ * Fixed issue on PHP 5.3 when short PHP tags are not supported
160
+
161
  = 1.5.2 =
162
  * Small UX improvements on options
163
 
460
 
461
  == Upgrade Notice ==
462
 
463
+ = 1.5.3 =
464
+ * Fixed issue on PHP 5.3 when short PHP tags are not supported
465
+
466
  = 1.5.2 =
467
  * Small UX improvements on options
468