Absolutely Glamorous Custom Admin - Version 1.5.4

Version Description

  • Patched security issues
  • Added support for custom CSS on public pages
  • Fixed appearance issus for custom admin bar icon and log out button on mobile devices and smaller screens
  • Fixed missing link issue with Back to blog link when custom name is used
  • Added AGCA social buttons
  • Fixed broken links in admin bar and plugins page on multisite network site
  • Removed php short tags that are not supported in older PHP versions
  • Updated license to GPLv3
Download this release

Release Info

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

Code changes from version 1.5.3 to 1.5.4

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