Absolutely Glamorous Custom Admin - Version 1.5.4.3

Version Description

  • Patched security issues.
Download this release

Release Info

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

Code changes from version 1.5.4.2 to 1.5.4.3

Files changed (3) hide show
  1. plugin.php +660 -654
  2. readme.txt +7 -1
  3. script/agca_tmpl.js +59 -54
plugin.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: AG Custom Admin
4
  Plugin URI: http://wordpressadminpanel.com/ag-custom-admin/
5
  Description: All-in-one tool for admin panel customization. Change almost everything: admin menu, dashboard, login page, admin bar etc. Apply admin panel themes.
6
  Author: WAP
7
- Version: 1.5.4.2
8
  Author URI: http://www.wordpressadminpanel.com/
9
 
10
  Copyright 2016. WAP (email : info@wordpressadminpanel.com)
@@ -22,25 +22,25 @@ Author URI: http://www.wordpressadminpanel.com/
22
  You should have received a copy of the GNU General Public License
23
  along with this program. If not, see <http://www.gnu.org/licenses/>.
24
  */
25
-
26
  $agca = new AGCA();
27
 
28
  class AGCA{
29
- private $colorizer="";
30
  private $active_plugin;
31
- private $agca_version;
32
- private $agca_debug = false;
33
- private $admin_capabilities;
34
  private $context = "";
35
- private $saveAfterImport = false;
36
  private $templateCustomizations = "";
37
- private $templates_ep = "http://wordpressadminpanel.com/configuration.php";
38
  public function __construct()
39
- {
40
- $this->reloadScript();
41
  $this->checkPOST();
42
  $this->checkGET();
43
-
44
  if(function_exists("add_filter")){
45
  add_filter('admin_title', array(&$this,'change_title'), 10, 2);
46
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
@@ -48,20 +48,20 @@ class AGCA{
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.2";
64
-
65
  //TODO:upload images programmaticaly
66
 
67
  }
@@ -80,20 +80,20 @@ class AGCA{
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"){
@@ -104,42 +104,42 @@ class AGCA{
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
  if(isset($_POST['_agca_save_template'])){
116
- $this->checkIfUserAdmin();
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,
@@ -147,30 +147,30 @@ class AGCA{
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->checkIfUserAdmin();
155
  $this->agcaAdminSession();
156
  if($_POST['template'] !="")
157
- $_SESSION["AGCA"]["Templates"][$_POST['template']] = array("license"=>$_POST['license']);
158
-
159
  print_r($_SESSION);
160
  echo "_agca_templates_session:OK";
161
  exit;
162
- }else if(isset($_POST['_agca_templates_session_remove_license'])){
163
- $this->checkIfUserAdmin();
164
  $this->agcaAdminSession();
165
  if($_POST['template'] !="")
166
- $_SESSION["AGCA"]["Templates"][$_POST['template']] = null;
167
  print_r($_SESSION);
168
  echo "_agca_templates_session_remove_license:OK";
169
  exit;
170
  }else if(isset($_POST['_agca_get_templates'])){
171
- $this->checkIfUserAdmin();
172
  $templates = get_option( 'agca_templates' );
173
- if($templates == "") $templates = array();
174
  $results = array();
175
  foreach($templates as $key=>$val){
176
  $results[]=$key;
@@ -178,47 +178,47 @@ class AGCA{
178
  echo json_encode($results);
179
  exit;
180
  }else if(isset($_POST['_agca_activate_template'])){
181
- $this->checkIfUserAdmin();
182
  update_option('agca_selected_template', $_POST['_agca_activate_template']);
183
  $_POST = array();
184
  //unset($_POST);
185
  exit;
186
  }else if(isset($_POST['_agca_template_settings'])){
187
- $this->checkIfUserAdmin();
188
  $settings = $_POST['_agca_template_settings'];
189
-
190
- $templates = get_option( 'agca_templates' );
191
  if($templates == ""){
192
- $templates = array();
193
- }
194
  $template_name = $_POST["_agca_current_template"];
195
-
196
  $templates[$template_name]["settings"] = $settings;
197
  update_option('agca_templates', $templates);
198
-
199
- $_POST = array();
200
  //print_r($templates);
201
  exit;
202
- }else if(isset($_POST['_agca_upload_image'])){
203
- $this->checkIfUserAdmin();
204
  function my_sideload_image() {
205
- $remoteurl = $_POST['_agca_upload_image'];
206
- $file = media_sideload_image( $remoteurl, 0 ,"AG Custom Admin Template Image (do not delete)");
207
  $fileparts = explode("src='",$file);
208
- $url=explode("'",$fileparts[1]);
209
- echo $url[0];
210
- exit;
211
  }
212
  add_action( 'admin_init', 'my_sideload_image' );
213
-
214
- }else if(isset($_POST['_agca_remove_template_images'])){
215
- $this->checkIfUserAdmin();
216
- $this->delete_template_images($_POST['_agca_remove_template_images']);
217
  exit;
218
  }
219
  }
220
 
221
- function checkIfUserAdmin(){
222
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
223
  if(!is_admin()){
224
  exit;
@@ -228,9 +228,13 @@ class AGCA{
228
  if(!is_user_logged_in() || !current_user_can( 'manage_options' )){
229
  exit;
230
  }
 
 
 
 
231
  }
232
  }
233
-
234
  function admin_bar_changes(){
235
  if( current_user_can( 'manage_options' )){
236
  global $wp_admin_bar;
@@ -241,11 +245,11 @@ class AGCA{
241
  'href' => 'tools.php?page=ag-custom-admin/plugin.php#ag-templates'
242
  ));
243
  }
244
- }
245
  }
246
-
247
  function delete_template_images_all(){
248
- $templates = get_option('agca_templates');
249
  if($templates != null && $templates != ""){
250
  foreach($templates as $template){
251
  if($template != null && $template['images'] != null && $template['images'] != ""){
@@ -256,13 +260,13 @@ class AGCA{
256
  }
257
  //print_r($imgs);
258
  }
259
- }
260
  }
261
  //print_r($templates);
262
  }
263
-
264
  function delete_template_images($template_name){
265
- $templates = get_option('agca_templates');
266
  if($templates != null && $templates != ""){
267
  $template = $templates[$template_name];
268
  if($template != null && $template['images'] != null && $template['images'] != ""){
@@ -276,14 +280,14 @@ class AGCA{
276
  }
277
  //print_r($templates);
278
  }
279
-
280
  function delete_attachment_by_src ($image_src) {
281
  global $wpdb;
282
  $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
283
  $id = $wpdb->get_var($query);
284
  wp_delete_attachment( $id, $true );
285
  }
286
-
287
  function get_installed_agca_templates(){
288
  $templates = get_option( 'agca_templates' );
289
  if($templates == "")return '[]';
@@ -291,9 +295,9 @@ class AGCA{
291
  foreach($templates as $key=>$val){
292
  $results[]=$key;
293
  }
294
- return json_encode($results);
295
  }
296
-
297
  function isGuest(){
298
  global $user_login;
299
  if($user_login) {
@@ -303,62 +307,62 @@ class AGCA{
303
  }
304
  }
305
  function check_active_plugin(){
306
-
307
- $ozh = false;
308
-
309
- if (is_plugin_active('ozh-admin-drop-down-menu/wp_ozh_adminmenu.php')) {
310
  $ozh = true;
311
- }
312
-
313
  $this->active_plugin = array(
314
  "ozh" => $ozh
315
  );
316
  }
317
- function change_title($admin_title, $title){
318
  //return get_bloginfo('name').' - '.$title;
319
  if(get_option('agca_custom_title')!=""){
320
  $blog = get_bloginfo('name');
321
  $page = $title;
322
- $customTitle = get_option('agca_custom_title');
323
  $customTitle = str_replace('%BLOG%',$blog,$customTitle);
324
  $customTitle = str_replace('%PAGE%',$page,$customTitle);
325
  return $customTitle;
326
  }else{
327
  return $admin_title;
328
- }
329
  }
330
- function agca_get_includes() {
331
- ?>
332
  <script type="text/javascript">
333
- <?php
334
- //AGCA GLOBALS
335
- echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';";
336
  ?>
337
  </script>
338
  <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; ?>" />
339
- <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"; ?>" />
340
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
341
- <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>
342
-
343
  <?php
344
- if($this->context == "login"){
345
  ?>
346
- <link rel="stylesheet" type="text/css" 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" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/admin.min.css" />
351
  <?php
352
  }
353
  ?>
354
- <?php
355
- echo $this->templateCustomizations;
356
-
357
- if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
358
  ?>
359
- <style type="text/css">
360
  <?php
361
- echo get_option('agca_custom_css');
362
  ?>
363
  </style>
364
  <script type="text/javascript">
@@ -370,24 +374,24 @@ class AGCA{
370
  }
371
  </script>
372
  <?php
373
- }
374
  }
375
-
376
- function agca_enqueue_scripts() {
377
- wp_enqueue_script('jquery');
378
  }
379
-
380
  function reloadScript(){
381
  $isAdmin = false;
382
  if(defined('WP_ADMIN') && WP_ADMIN == 1){
383
  $isAdmin = true;
384
  }
385
- if(in_array((isset($GLOBALS['pagenow'])?$GLOBALS['pagenow']:""), array('wp-login.php', 'wp-register.php')) || $isAdmin){
386
- add_action('init', array(&$this,'agca_enqueue_scripts'));
387
- }
388
  }
389
-
390
- function agca_register_settings() {
391
  register_setting( 'agca-options-group', 'agca_role_allbutadmin' );
392
  register_setting( 'agca-options-group', 'agca_screen_options_menu' );
393
  register_setting( 'agca-options-group', 'agca_help_menu' );
@@ -397,7 +401,7 @@ class AGCA{
397
  register_setting( 'agca-options-group', 'agca_custom_title' );
398
  register_setting( 'agca-options-group', 'agca_howdy' );
399
  register_setting( 'agca-options-group', 'agca_header' );
400
- register_setting( 'agca-options-group', 'agca_header_show_logout' );
401
  register_setting( 'agca-options-group', 'agca_footer' );
402
  register_setting( 'agca-options-group', 'agca_privacy_options' );
403
  register_setting( 'agca-options-group', 'agca_header_logo' );
@@ -405,36 +409,36 @@ class AGCA{
405
  register_setting( 'agca-options-group', 'agca_wp_logo_custom' );
406
  register_setting( 'agca-options-group', 'agca_remove_site_link' );
407
  register_setting( 'agca-options-group', 'agca_wp_logo_custom_link' );
408
-
409
  register_setting( 'agca-options-group', 'agca_site_heading' );
410
  register_setting( 'agca-options-group', 'agca_custom_site_heading' );
411
  register_setting( 'agca-options-group', 'agca_update_bar' );
412
-
413
  register_setting( 'agca-options-group', 'agca_footer_left' );
414
- register_setting( 'agca-options-group', 'agca_footer_left_hide' );
415
  register_setting( 'agca-options-group', 'agca_footer_right' );
416
  register_setting( 'agca-options-group', 'agca_footer_right_hide' );
417
-
418
  register_setting( 'agca-options-group', 'agca_login_banner' );
419
  register_setting( 'agca-options-group', 'agca_login_banner_text' );
420
  register_setting( 'agca-options-group', 'agca_login_photo_remove' );
421
  register_setting( 'agca-options-group', 'agca_login_photo_url' );
422
  register_setting( 'agca-options-group', 'agca_login_photo_href' );
423
  register_setting( 'agca-options-group', 'agca_login_round_box' );
424
- register_setting( 'agca-options-group', 'agca_login_round_box_size' );
425
-
426
  register_setting( 'agca-options-group', 'agca_dashboard_icon' );
427
  register_setting( 'agca-options-group', 'agca_dashboard_text' );
428
  register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
429
  register_setting( 'agca-options-group', 'agca_dashboard_widget_welcome' );
430
- register_setting( 'agca-options-group', 'agca_dashboard_widget_activity' );
431
- register_setting( 'agca-options-group', 'agca_dashboard_widget_il' );
432
- register_setting( 'agca-options-group', 'agca_dashboard_widget_plugins' );
433
- register_setting( 'agca-options-group', 'agca_dashboard_widget_qp' );
434
- register_setting( 'agca-options-group', 'agca_dashboard_widget_rn' );
435
- register_setting( 'agca-options-group', 'agca_dashboard_widget_rd' );
436
- register_setting( 'agca-options-group', 'agca_dashboard_widget_primary' );
437
- register_setting( 'agca-options-group', 'agca_dashboard_widget_secondary' );
438
 
439
  //WP3.3
440
  register_setting( 'agca-options-group', 'agca_admin_bar_comments' );
@@ -443,81 +447,81 @@ class AGCA{
443
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_link' );
444
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_page' );
445
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_user' );
446
- register_setting( 'agca-options-group', 'agca_admin_bar_new_content_media' );
447
- register_setting( 'agca-options-group', 'agca_admin_bar_update_notifications' );
448
- register_setting( 'agca-options-group', 'agca_admin_bar_admin_themes' );
449
- register_setting( 'agca-options-group', 'agca_remove_top_bar_dropdowns' );
450
- register_setting( 'agca-options-group', 'agca_admin_bar_frontend' );
451
  register_setting( 'agca-options-group', 'agca_admin_bar_frontend_hide' );
452
  register_setting( 'agca-options-group', 'agca_login_register_remove' );
453
  register_setting( 'agca-options-group', 'agca_login_register_href' );
454
  register_setting( 'agca-options-group', 'agca_login_lostpassword_remove' );
455
- register_setting( 'agca-options-group', 'agca_admin_capability' );
456
  register_setting( 'agca-options-group', 'agca_disablewarning' );
457
- register_setting( 'agca-template-group', 'agca_selected_template' );
458
- register_setting( 'agca-template-group', 'agca_templates' );
459
- //delete_option( 'agca_templates' );
460
 
461
 
462
  /*Admin menu*/
463
- register_setting( 'agca-options-group', 'agca_admin_menu_turnonoff' );
464
- register_setting( 'agca-options-group', 'agca_admin_menu_agca_button_only' );
465
- register_setting( 'agca-options-group', 'agca_admin_menu_separators' );
466
- register_setting( 'agca-options-group', 'agca_admin_menu_icons' );
467
  register_setting( 'agca-options-group', 'agca_admin_menu_collapse_button' );
468
  register_setting( 'agca-options-group', 'agca_admin_menu_arrow' );
469
- register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round' );
470
  register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round_size' );
471
  register_setting( 'agca-options-group', 'agca_admin_menu_brand' );
472
- register_setting( 'agca-options-group', 'agca_admin_menu_brand_link' );
473
- register_setting( 'agca-options-group', 'agca_admin_menu_autofold' );
474
  register_setting( 'agca-options-group', 'ag_edit_adminmenu_json' );
475
  register_setting( 'agca-options-group', 'ag_edit_adminmenu_json_new' );
476
- register_setting( 'agca-options-group', 'ag_add_adminmenu_json' );
477
- register_setting( 'agca-options-group', 'ag_colorizer_json' );
478
- register_setting( 'agca-options-group', 'agca_colorizer_turnonoff' );
479
-
480
  register_setting( 'agca-options-group', 'agca_custom_js' );
481
- register_setting( 'agca-options-group', 'agca_custom_css' );
482
-
483
-
484
  if(!empty($_POST)){
485
- if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=="true"){
486
- $this->checkIfUserAdmin();
487
  if(isset($_FILES) && isset($_FILES['settings_import_file']) ){
488
- if($_FILES["settings_import_file"]["error"] > 0){
489
- }else{
490
  $file = $_FILES['settings_import_file'];
491
- if($this->startsWith($file['name'],'AGCA_Settings')){
492
  if (file_exists($file['tmp_name'])) {
493
  $fh = fopen($file['tmp_name'], 'r');
494
  $theData = "";
495
  if(filesize($file['tmp_name']) > 0){
496
  $theData = fread($fh,filesize($file['tmp_name']));
497
- }
498
- fclose($fh);
499
- $this->importSettings($theData);
500
- }
501
  }
502
- }
503
  }
504
  }else if(isset($_POST['_agca_export_settings']) && $_POST['_agca_export_settings']=="true"){
505
- $this->checkIfUserAdmin();
506
- $this->exportSettings();
507
- }
508
  }
509
-
510
  if(isset($_GET['agca_action'])){
511
  if($_GET['agca_action'] == "disablewarning"){
512
  update_option('agca_disablewarning', true);
513
- }
514
  }
515
  }
516
 
517
- function agca_deactivate() {
518
-
519
- }
520
-
521
  function getOptions(){
522
  return Array(
523
  'agca_role_allbutadmin',
@@ -561,7 +565,7 @@ class AGCA{
561
  'agca_dashboard_text',
562
  'agca_dashboard_text_paragraph',
563
  'agca_dashboard_widget_welcome',
564
- 'agca_dashboard_widget_activity',
565
  'agca_dashboard_widget_il',
566
  'agca_dashboard_widget_plugins',
567
  'agca_dashboard_widget_qp',
@@ -587,7 +591,7 @@ class AGCA{
587
  'agca_admin_menu_submenu_round',
588
  'agca_admin_menu_submenu_round_size',
589
  'agca_admin_menu_brand',
590
- 'agca_admin_menu_brand_link',
591
  'agca_admin_menu_autofold',
592
  'agca_admin_menu_collapse_button',
593
  'ag_edit_adminmenu_json',
@@ -597,18 +601,18 @@ class AGCA{
597
  'agca_colorizer_turnonof',
598
  'agca_custom_js',
599
  'agca_custom_css',
600
- 'agca_colorizer_turnonoff',
601
  'agca_disablewarning',
602
  'agca_selected_template',
603
  'agca_templates',
604
- );
605
- }
606
-
607
  function getTextEditor($name){
608
  $settings = array(
609
- 'textarea_name' => $name,
610
- 'media_buttons' => true,
611
- 'tinymce' => array(
612
  'theme_advanced_buttons1' => 'formatselect,|,bold,italic,underline,|,' .
613
  'bullist,blockquote,|,justifyleft,justifycenter' .
614
  ',justifyright,justifyfull,|,link,unlink,|' .
@@ -617,32 +621,32 @@ class AGCA{
617
  );
618
  wp_editor( get_option($name), $name, $settings );
619
  }
620
-
621
  function importSettings($settings){
622
  $exploaded = explode("|^|^|", $settings);
623
  // $str = "EEE: ";
624
-
625
  $savedOptions = array();
626
-
627
  foreach ($exploaded as $setting){
628
-
629
  $key = current(explode(':', $setting));
630
- $value = substr($setting, strlen($key)+1);
631
- $cleanedValue = str_replace('|^|^|','',$value);
632
- $savedOptions[$key] = $cleanedValue;
633
- }
634
-
635
  // print_r($savedOptions);
636
-
637
  $optionNames = $this->getOptions();
638
-
639
  foreach ($optionNames as $optionName){
640
- $optionValue = "";
641
  $optionValue = $savedOptions[$optionName];
642
-
643
  if($optionName == "ag_edit_adminmenu_json" || "ag_edit_adminmenu_json_new"|| $optionName == "ag_add_adminmenu_json" ||$optionName == "ag_colorizer_json"){
644
  $optionValue = str_replace("\\\"", "\"", $optionValue);
645
- $optionValue = str_replace("\\\'", "\'", $optionValue);
646
  }else if($optionName == "agca_custom_js" || $optionName == "agca_custom_css"){
647
  //fb($optionValue);
648
  $optionValue = htmlspecialchars_decode($optionValue);
@@ -650,40 +654,40 @@ class AGCA{
650
  $optionValue = str_replace('\"', "'", $optionValue);
651
  //fb($optionValue);
652
  }else{
653
-
654
- }
655
- update_option($optionName, $optionValue);
656
  $str.="/".$optionName."/".$optionValue."\n";
657
- }
658
-
659
  //Migration from 1.2.6. to 1.2.5.1 - remove in later versions
660
  //agca_script_css
661
  //
662
  // fb($savedOptions);
663
  if($savedOptions['agca_script_css'] != null){
664
- $optionValue = "";
665
- $optionValue = str_replace("\'", '"', $savedOptions['agca_script_css']);
666
  $optionValue = str_replace('\"', "'", $optionValue);
667
  update_option('agca_custom_css', $optionValue);
668
  }
669
  if($savedOptions['agca_script_js'] != null){
670
- $optionValue = "";
671
- $optionValue = str_replace("\'", '"', $savedOptions['agca_script_js']);
672
  $optionValue = str_replace('\"', "'", $optionValue);
673
  update_option('agca_custom_js', $optionValue);
674
- }
675
-
676
  //echo $str;
677
-
678
  //save imported settings
679
- $this->saveAfterImport = true;
680
  }
681
-
682
  function exportSettings(){
683
  $str = "";
684
-
685
  $include_menu_settings = false;
686
- if(isset($_POST['export_settings_include_admin_menu'])){
687
  if($_POST['export_settings_include_admin_menu'] == 'on'){
688
  $include_menu_settings = true;
689
  }
@@ -696,31 +700,31 @@ class AGCA{
696
  }else{
697
  $str .=$key. ":".$value."|^|^|";
698
  }
699
- }
700
  }
701
-
702
- $filename = 'AGCA_Settings_'.date("Y-M-d_H-i-s").'.agca';
703
  header("Cache-Control: public");
704
- header("Content-Description: File Transfer");
705
  header("Content-Disposition: attachment; filename=$filename");
706
- header("Content-Type: text/plain; ");
707
  header("Content-Transfer-Encoding: binary");
708
  echo $str;
709
  die();
710
- }
711
-
712
  function startsWith($haystack, $needle)
713
  {
714
  $length = strlen($needle);
715
  return (substr($haystack, 0, $length) === $needle);
716
  }
717
-
718
-
719
-
720
- function agca_create_menu() {
721
- add_management_page( 'AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this,'agca_admin_page') );
722
  }
723
-
724
  function agca_create_admin_button($name,$arr) {
725
 
726
  $href = $arr["value"];
@@ -728,16 +732,16 @@ class AGCA{
728
  $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>";
729
 
730
  return $button;
731
- }
732
  function agca_decode($code){
733
  $code = str_replace("{","",$code);
734
  $code = str_replace("}","",$code);
735
  $code = str_replace("\", \"","\"|||\"",$code);
736
  $elements = explode("|||",$code);
737
-
738
  return $elements;
739
  }
740
-
741
  function jsonMenuArray($json,$type){
742
  $arr = explode("|",$json);
743
  $elements = "";
@@ -752,9 +756,9 @@ class AGCA{
752
  }else if($type == "buttons"){
753
  $elements = json_decode($arr[0],true);
754
  if($elements !=""){
755
- foreach($elements as $k => $v){
756
- $array.=$this->agca_create_admin_button($k,$v);
757
- }
758
  }
759
  }else if($type == "buttonsJq"){
760
  $elements = json_decode($arr[0],true);
@@ -763,13 +767,13 @@ class AGCA{
763
  $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>';
764
  }
765
  }
766
- }else{
767
  if(isset($arr[$type])){
768
  $elements = $this->agca_decode($arr[$type]);
769
  }
770
-
771
  if($elements !=""){
772
- foreach($elements as $element){
773
  if(!$first){
774
  $array .=",";
775
  }
@@ -778,27 +782,27 @@ class AGCA{
778
  $array.="[".$parts[0].", ".$parts[1]."]";
779
  }
780
  $first=false;
781
- }
782
- }
783
  }
784
-
785
- return $array;
786
  }
787
-
788
- function remove_dashboard_widget($widget,$side)
789
  {
790
  //side can be 'normal' or 'side'
791
  global $wp_meta_boxes;
792
- remove_meta_box($widget, 'dashboard', $side);
793
  }
794
-
795
  function get_wp_version(){
796
  global $wp_version;
797
- $array = explode('-', $wp_version);
798
- $version = $array[0];
799
  return $version;
800
  }
801
-
802
  function print_page()
803
  {
804
  if($this->isGuest() && get_option('agca_admin_bar_frontend_hide')){
@@ -807,29 +811,29 @@ class AGCA{
807
  if(!$this->isGuest()){
808
  ?><style type="text/css"><?php echo get_option('agca_custom_css'); ?></style><?php
809
  }
810
-
811
  if(get_option('agca_admin_bar_frontend_hide')==true){
812
  add_filter( 'show_admin_bar', '__return_false' );
813
  ?>
814
  <style type="text/css">
815
  #wpadminbar{
816
- display: none;
817
- }
818
  </style>
819
  <script type="text/javascript">
820
- window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
821
  </script>
822
- <?php
823
  }
824
- if(get_option('agca_admin_bar_frontend')!=true){
825
-
826
  $this->context = "page";
827
  $wpversion = $this->get_wp_version();
828
 
829
  ?>
830
-
831
-
832
- <script type="text/javascript">
833
  var wpversion = "<?php echo $wpversion; ?>";
834
  var agca_version = "<?php echo $this->agca_version; ?>";
835
  var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
@@ -847,68 +851,68 @@ class AGCA{
847
  }
848
  setTimeout("initJQuery()", 50);
849
  } else {
850
- jQuery(function() {
851
  try
852
- {
853
  <?php if(get_option('agca_header')!=true){ ?>
854
  jQuery('#wpadminbar').show();
855
  <?php } ?>
856
-
857
  <?php $this->print_admin_bar_scripts(); ?>
858
  }catch(ex){}
859
- });
860
  }
861
  }
862
- initJQuery();
863
  </script>
864
- <script type="text/javascript">
865
  <?php echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';"; ?>
866
  </script>
867
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
868
- <script type="text/javascript">
869
- jQuery(document).ready(function(){
870
- <?php if(get_option('agca_colorizer_turnonoff') == 'on' && (get_option('agca_admin_bar_frontend_hide')!=true)){
871
  foreach($this->colorizer as $k => $v){
872
- if(($k !="") and ($v !="")){
873
  if(
874
  $k == "color_header" ||
875
  $k == "color_font_header"
876
  ){
877
  ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
878
  }
879
-
880
  }
881
  }
882
- ?>
883
-
884
  <?php
885
  }
886
  ?>
887
- });
888
- </script>
889
  <?php
890
  }
891
-
892
  }
893
-
894
  function print_admin_bar_scripts(){
895
- ?>
896
- <?php if(get_option('agca_remove_top_bar_dropdowns')==true){ ?>
897
  jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-sub-wrapper").hide();
898
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-site-name .ab-sub-wrapper").hide();
899
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item").attr('title','');
900
 
901
- <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
902
  jQuery(".new_content_header_submenu").hide();
903
- <?php } ?>
 
 
904
 
905
- <?php } ?>
906
-
907
  <?php if(get_option('agca_admin_bar_comments')!=""){ ?>
908
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-comments").css("display","none");
909
  <?php } ?>
910
- <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
911
- jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content").css("display","none");
912
  <?php } ?>
913
  <?php if(get_option('agca_admin_bar_new_content_post')!=""){ ?>
914
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-post").css("display","none");
@@ -924,149 +928,149 @@ class AGCA{
924
  <?php } ?>
925
  <?php if(get_option('agca_admin_bar_new_content_media')!=""){ ?>
926
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-media").css("display","none");
927
- <?php } ?>
928
  <?php if(get_option('agca_admin_bar_update_notifications')!=""){ ?>
929
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-updates").css("display","none");
930
  <?php } ?>
931
  <?php if(get_option('agca_admin_bar_admin_themes')!=""){ ?>
932
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-agca-admin-themes").css("display","none");
933
  <?php } ?>
934
-
935
-
936
-
937
  <?php if(get_option('agca_header_logo')==true){ ?>
938
- jQuery("#wphead #header-logo").css("display","none");
939
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-wp-logo").css("display","none");
940
 
941
  <?php } ?>
942
- <?php if(get_option('agca_header_logo_custom')!=""){ ?>
943
-
944
- var img_url = '<?php echo addslashes(get_option('agca_header_logo_custom')); ?>';
945
 
946
  advanced_url = img_url;
947
- image = jQuery("<img />").attr("src",advanced_url);
948
- jQuery(image).load(function() {
949
  jQuery("#wpbody-content").prepend(image);
950
- });
951
 
952
- <?php } ?>
953
- <?php if(get_option('agca_wp_logo_custom')!=""){ ?>
954
  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'); ?>\" />");
955
  jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('background-image','none');
956
- jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('width','auto');
957
- jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',"<?php echo get_bloginfo('wpurl'); ?>");
958
- jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item:before").attr('title','');
959
  jQuery('body #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon').attr('class','ab-icon2');
960
  jQuery("#wp-admin-bar-wp-logo").show();
961
  <?php }?>
962
  <?php if(get_option('agca_remove_site_link')==true){ ?>
963
- jQuery("#wp-admin-bar-site-name").css("display","none");
964
 
965
  <?php } ?>
966
- <?php if(get_option('agca_wp_logo_custom_link')!=""){ ?>
967
- var href = "<?php echo get_option('agca_wp_logo_custom_link'); ?>";
968
  href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
969
- if(href == "%SWITCH%"){
970
  href = "<?php echo get_bloginfo('wpurl'); ?>";
971
  <?php if($this->context == "page"){
972
- ?>href+="/wp-admin";<?php
973
  }
974
  ?>
975
  }
976
- jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',href);
977
-
978
  <?php }?>
979
  <?php if(get_option('agca_site_heading')==true){ ?>
980
  jQuery("#wphead #site-heading").css("display","none");
981
  <?php } ?>
982
- <?php if(get_option('agca_custom_site_heading')!=""){ ?>
983
  jQuery("#wphead #site-heading").after('<h1><?php echo addslashes(get_option('agca_custom_site_heading')); ?></h1>');
984
  jQuery("#wp-admin-bar-site-name a:first").html('<?php echo addslashes(get_option('agca_custom_site_heading')); ?>');
985
-
986
- <?php } ?>
987
- <?php if(get_option('agca_header')==true && $this->context =='admin'){
988
  ?>
989
- jQuery("#wpadminbar").css("display","none");
990
  jQuery("body.admin-bar").css("padding-top","0");
991
- jQuery("#wphead").css("display","none");
992
- jQuery('html.wp-toolbar').css("padding-top","0");
993
 
994
- <?php } ?>
995
- <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
996
  <?php
997
  $agca_logout_text = ((get_option('agca_logout')=="")?"Log Out":get_option('agca_logout'));
998
- ?>
999
- 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>');
1000
-
1001
 
1002
  <?php } ?>
1003
- <?php if(get_option('agca_howdy')!=""){ ?>
1004
- var alltext="";
1005
  alltext="";
1006
  jQuery('li#wp-admin-bar-my-account').css('cursor','default');
1007
  alltext = jQuery('li#wp-admin-bar-my-account').html();
1008
- if(alltext!=null){
1009
- var parts = alltext.split(',');
1010
  alltext = "<?php echo get_option('agca_howdy'); ?>" + ", " + parts[1];
1011
- }
1012
- jQuery("li#wp-admin-bar-my-account").html("<a href=\"#\" class=\"ab-item\">"+alltext+"</a>");
1013
-
1014
  <?php } ?>
1015
- <?php
1016
  if(get_option('agca_custom_title')!=""){
1017
- //add_filter('admin_title', '$this->change_title', 10, 2);
1018
-
1019
- }
1020
  ?>
1021
- <?php if(get_option('agca_logout')!=""){ ?>
1022
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-logout a").text("<?php echo get_option('agca_logout'); ?>");
1023
  <?php } ?>
1024
- <?php if(get_option('agca_remove_your_profile')==true){ ?>
1025
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("visibility","hidden");
1026
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("height","10px");
1027
  jQuery('#wpadminbar #wp-admin-bar-top-secondary > #wp-admin-bar-my-account > a').attr('href','#');
1028
  jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-user-info > a').attr('href','#');
1029
- jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-edit-profile > a').attr('href','#');
1030
- <?php } ?>
1031
- <?php if(get_option('agca_logout_only')==true){ ?>
1032
  var logout_content = jQuery("li#wp-admin-bar-logout").html();
1033
  jQuery("ul#wp-admin-bar-top-secondary").html('<li id="wp-admin-bar-logout" style="display:block;">'+ logout_content +'</li>');
1034
  jQuery("#wp-admin-bar-logout a").css('padding','0 8px');
1035
 
1036
-
1037
  <?php } ?>
1038
-
1039
  <?php
1040
-
1041
-
1042
  }
1043
-
1044
  function updateAllColors(){
1045
-
1046
- ?>
1047
  function updateAllColors(){
1048
  <?php
1049
  foreach($this->colorizer as $k => $v){
1050
- if(($k !="") and ($v !="")){
1051
  ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
1052
  }
1053
  }
1054
  ?>
1055
- jQuery('.color_picker').each(function(){
1056
  updateColor(jQuery(this).attr('id'),jQuery(this).val())
1057
  });
1058
  jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1059
  jQuery('#adminmenu li.wp-menu-open').css('border','none');
1060
- jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
1061
  }<?php
1062
-
1063
  }
1064
  function admin_capabilities(){
1065
  global $wp_roles;
1066
  $capabs = $wp_roles->roles['administrator']['capabilities'];
1067
  $capabilitySelector = "";
1068
-
1069
- $selectedValue = get_option('agca_admin_capability');
1070
  if($selectedValue == ""){
1071
  $selectedValue = "edit_dashboard";
1072
  }
@@ -1083,160 +1087,160 @@ class AGCA{
1083
  //$capabilitySelector .="<option val=\"$k\" $selected >".str_replace(' ', ' ', ucwords(str_replace('_', ' ', $k))) ."</option>\n";
1084
  $capabilitySelector .="<option val=\"$k\" $selected >".$k."</option>\n";
1085
  }
1086
-
1087
  $this->admin_capabilities = "<select class=\"agca-selectbox\" id=\"agca_admin_capability\" name=\"agca_admin_capability\" val=\"upload_files\">".$capabilitySelector."</select>";
1088
  }
1089
-
1090
  function admin_capability(){
1091
- $selectedValue = get_option('agca_admin_capability');
1092
  if($selectedValue == ""){
1093
  $selectedValue = "edit_dashboard";
1094
  }
1095
  return $selectedValue;
1096
  }
1097
-
1098
  function JSPrintAGCATemplateSettingsVar($settings){
1099
  echo "\n<script type=\"text/javascript\">\n";
1100
- echo "var agca_template_settings = ".preg_replace('#<script(.*?)>(.*?)</script>#is', '', $settings).";\n"; //TODO: think about this
1101
- echo "</script>";
1102
  }
1103
-
1104
  function appendSettingsToAGCATemplateCustomizations($customizations, $settings){
1105
  $template_settings = json_decode($settings);
1106
  //print_r($template_settings);
1107
  foreach($template_settings as $sett){
1108
  $key = $sett->code;
1109
-
1110
  //use default value if user's value is not set
1111
  $value="";
1112
  if($sett->value != ""){
1113
- $value = $sett->value;
1114
  }else{
1115
- $value = $sett->default_value;
1116
  }
1117
-
1118
- //Prepare settings
1119
  if($sett->type == 6){
1120
  if($value !== null && (strtolower($value) == "on" || $value == "1")){
1121
  $value = "true";
1122
  }else{
1123
  $value = "false";
1124
- }
1125
- }
1126
- $customizations = str_replace("%".$key."%",$value, $customizations);
1127
- }
1128
  return $customizations;
1129
  }
1130
-
1131
- function enableSpecificWPVersionCustomizations($customizations){
1132
- /*enable special CSS for this WP version*/
1133
- $ver = $this->get_wp_version();
1134
  $customizations = str_replace("/*".$ver," ", $customizations);
1135
  $customizations = str_replace($ver."*/"," ", $customizations);
1136
  return $customizations;
1137
  }
1138
-
1139
- function removeCSSComments($customizations){
1140
  $customizations = preg_replace('#/\*.*?\*/#si','',$customizations);
1141
  return $customizations;
1142
  }
1143
-
1144
  function prepareAGCAAdminTemplates(){
1145
  if(get_option( 'agca_templates' ) != ""){
1146
  //print_r(get_option( 'agca_templates' ));
1147
  $themes = get_option( 'agca_templates' );
1148
  $selectedTheme = get_option('agca_selected_template');
1149
- if(isset($themes[$selectedTheme])){
1150
  $theme = $themes[$selectedTheme];
1151
  add_filter('get_user_option_admin_color', array(&$this,'change_admin_color'));
1152
-
1153
  echo (stripslashes($theme['common']));
1154
  echo "<!--AGCAIMAGES: ".$theme['images']."-->";
1155
-
1156
  //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1157
- if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
1158
- if($theme['settings'] == "" || $theme['settings'] == " ") $theme['settings'] = "{}";
1159
- //print_r($templdata);
1160
-
1161
- $this->JSPrintAGCATemplateSettingsVar($theme['settings']);
1162
-
1163
- $admindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($theme['admin']), $theme['settings']);
1164
  $admindata = $this->enableSpecificWPVersionCustomizations($admindata);
1165
- $admindata = $this->removeCSSComments($admindata);
1166
-
1167
  //echo $admindata;
1168
- //REPLACE TAGS WITH CUSTOM TEMPLATE SETTINGS
1169
  $this->templateCustomizations = $admindata;
1170
  }
1171
  //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1172
- }
1173
  }
1174
  }
1175
-
1176
  function agcaAdminSession(){
1177
  $agcaTemplatesSession = array();
1178
-
1179
  //session_destroy();
1180
  //session_unset();
1181
-
1182
  /*if(!session_id()){
1183
- session_start();
1184
  }*/
1185
-
1186
  if(!isset($_SESSION["AGCA"])){
1187
- $_SESSION["AGCA"] = array();
1188
- $_SESSION["AGCA"]["Templates"] = array();
1189
  }
1190
  //print_r($_SESSION);
1191
-
1192
  if(isset($_SESSION["AGCA"])){
1193
  if(isset($_SESSION["AGCA"]["Templates"])){
1194
  //print_r($_SESSION["AGCA"]["Templates"]);
1195
- $agcaTemplatesSession = json_encode($_SESSION["AGCA"]["Templates"]);
1196
  }
1197
  }
1198
-
1199
-
1200
- if($agcaTemplatesSession == '""' || $agcaTemplatesSession == '"[]"'){
1201
  $agcaTemplatesSession = array();
1202
  }
1203
-
1204
-
1205
  return $agcaTemplatesSession;
1206
-
1207
  }
1208
-
1209
  function getAGCAColor($name){
1210
  if(isset($this->colorizer[$name])){
1211
- echo htmlspecialchars($this->colorizer[$name]);
1212
- }
1213
  }
1214
-
1215
  function prepareAGCALoginTemplates(){
1216
  if(get_option( 'agca_templates' ) != ""){
1217
  //print_r(get_option( 'agca_templates' ));
1218
  $templates = get_option( 'agca_templates' );
1219
  foreach($templates as $templname=>$templdata){
1220
  if($templname == get_option('agca_selected_template')){
1221
- echo (stripslashes($templdata['common']));
1222
-
1223
- if($templdata['settings'] == "" || $templdata['settings'] == " ") $templdata['settings'] = "{}";
1224
  $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1225
-
1226
- $logindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($templdata['login']), $templdata['settings']);
1227
  $logindata = $this->enableSpecificWPVersionCustomizations($logindata);
1228
- $logindata = $this->removeCSSComments($logindata);
1229
-
1230
  echo($logindata);
1231
  break;
1232
  }
1233
  }
1234
  }
1235
  }
1236
-
1237
  function agca_error_check(){
1238
  ?>
1239
- <script type="text/javascript">
1240
  function AGCAErrorPage(msg, url, line){
1241
  var agca_error_details = "___________________________________________________<br/>";
1242
  agca_error_details += '<br/>' + msg +'<br/>source:' + url + '<br/>line:' + line + '<br/>';
@@ -1244,16 +1248,16 @@ class AGCA{
1244
  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>';
1245
  document.getElementsByTagName('html')[0].style.visibility = "visible";
1246
  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;">\
1247
- 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>';
1248
-
1249
  var ph = document.getElementById('agca_error_placeholder');
1250
- ph.innerHTML = errorDivHtml;
1251
- document.getElementById('agca_news').style.visibility = "hidden";
1252
  }
1253
- window.onerror = function(msg, url, line) {
1254
  window.onload = function() {
1255
  AGCAErrorPage(msg, url, line);
1256
- }
1257
  return true;
1258
  };
1259
  </script>
@@ -1261,23 +1265,23 @@ class AGCA{
1261
  }
1262
  function error_check(){
1263
  ?>
1264
- <script type="text/javascript">
1265
  function AGCAErrorOtherPages(msg, url, line){
1266
  var agca_error_details = "___________________________________________________\n";
1267
  agca_error_details += '\n' + msg +'\nsource:' + url + '\nline:' + line + '\n';
1268
-
1269
- document.getElementsByTagName('html')[0].style.visibility = "visible";
1270
-
1271
  if(typeof window.console === "object"){
1272
  console.log("___________________________________________________");
1273
- console.log("AG Custom Admin caught a JavaScript on your site:");
1274
- console.log(agca_error_details);
1275
- }
1276
  }
1277
- window.onerror = function(msg, url, line) {
1278
  window.onload = function() {
1279
  AGCAErrorOtherPages(msg, url, line);
1280
- }
1281
  return true;
1282
  };
1283
  </script>
@@ -1501,9 +1505,9 @@ class AGCA{
1501
  update_option('ag_edit_adminmenu_json_new',json_encode($customizations));
1502
  }
1503
  function print_admin_css()
1504
- {
1505
  $agcaTemplateSession = $this->agcaAdminSession();
1506
- $wpversion = $this->get_wp_version();
1507
  $this->context = "admin";
1508
  $this->error_check();
1509
  $currentScreen = get_current_screen();
@@ -1516,16 +1520,16 @@ class AGCA{
1516
  var errors = false;
1517
  var isSettingsImport = false;
1518
  var agca_context = "admin";
1519
- var roundedSidberSize = 0;
1520
  var agca_installed_templates = <?php echo $this->get_installed_agca_templates(); ?>;
1521
  var agca_admin_menu = <?php echo json_encode($this->get_menu_customizations()) ?>;
1522
  </script>
1523
  <?php
1524
  $this->prepareAGCAAdminTemplates();
1525
  $this->agca_get_includes();
1526
- $this->admin_capabilities();
1527
  get_currentuserinfo() ;
1528
- ?>
1529
  <?php
1530
  //in case that javaScript is disabled only admin can access admin menu
1531
  if(!current_user_can($this->admin_capability())){
@@ -1535,20 +1539,20 @@ class AGCA{
1535
  </style>
1536
  <?php
1537
  }
1538
- ?>
1539
  <script type="text/javascript">
1540
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1541
  <?php
1542
  if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='true'){
1543
  echo 'isSettingsImport = true;';
1544
  }
1545
- ?>
1546
  </script>
1547
- <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1548
  <style type="text/css">
1549
  .wp-has-current-submenu:after{border:none !important;}
1550
  #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none !important;}
1551
- </style>
1552
  <?php }
1553
 
1554
  if($currentScreen->id == 'tools_page_ag-custom-admin/plugin'){
@@ -1568,30 +1572,30 @@ if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='t
1568
  /* <![CDATA[ */
1569
  jQuery(document).ready(function() {
1570
  try
1571
- {
1572
-
1573
  <?php /*CHECK OTHER PLUGINS*/
1574
- $this->check_active_plugin();
1575
-
1576
  if($this->active_plugin["ozh"]){
1577
- ?>
1578
- jQuery('ul#adminmenu').css('display','none');
1579
- jQuery('#footer-ozh-oam').css('display','none');
1580
  jQuery('#ag_main_menu li').each(function(){
1581
  if(jQuery(this).text() == "Admin Menu"){
1582
  jQuery(this).hide();
1583
  }
1584
- });
1585
  <?php
1586
  }
1587
  ?>
1588
-
1589
 
1590
  //get saved onfigurations
1591
 
1592
  <?php $buttons = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttons'); ?>
1593
- var buttons = '<?php echo $buttons; ?>';
1594
-
1595
  <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
1596
  var buttonsJq = '<?php echo $buttonsJq; ?>';
1597
 
@@ -1599,57 +1603,57 @@ try
1599
  //createEditMenuPageV32(checkboxes, textboxes);
1600
 
1601
  <?php
1602
- //if admin, and option to hide settings for admin is set
1603
-
1604
  if((get_option('agca_role_allbutadmin')==true) and current_user_can($this->admin_capability())){
1605
- ?>
1606
  <?php } else{ ?>
1607
  <?php if(get_option('agca_admin_menu_brand')!=""){ ?>
1608
- additionalStyles = ' style="margin-bottom:-4px" ';
1609
- jQuery("#adminmenu").before('<div '+additionalStyles+' id="sidebar_adminmenu_logo"><img width="160" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1610
- <?php } ?>
1611
- <?php if(get_option('agca_admin_menu_brand_link')!=""){ ?>
1612
-
1613
- var href = "<?php echo get_option('agca_admin_menu_brand_link'); ?>";
1614
  href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1615
 
1616
- jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1617
- jQuery("#sidebar_adminmenu_logo").attr('title',href);
1618
-
1619
  <?php }else{ ?>
1620
  href = "<?php echo get_bloginfo('wpurl'); ?>";
1621
- jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1622
  jQuery("#sidebar_adminmenu_logo").attr('title',href);
1623
  <?php } ?>
1624
-
1625
  <?php if(get_option('agca_admin_menu_submenu_round')==true){ ?>
1626
  jQuery("#adminmenu .wp-submenu").css("border-radius","<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1627
  jQuery("#adminmenu .wp-menu-open .wp-submenu").css('border-radius','');
1628
  <?php $roundedSidebarSize = get_option('agca_admin_menu_submenu_round_size'); ?>
1629
  roundedSidberSize = <?php echo ($roundedSidebarSize == "")?"0":$roundedSidebarSize; ?>;
1630
-
1631
-
1632
  <?php } ?>
1633
- <?php if(get_option('agca_admin_menu_autofold')=="force"){ ?>
1634
- jQuery("body").addClass("auto-fold");
1635
  <?php } else if(get_option('agca_admin_menu_autofold')=="disable"){ ?>
1636
- jQuery("body").removeClass("auto-fold");
1637
  <?php } ?>
1638
-
1639
- <?php $this->print_admin_bar_scripts(); ?>
1640
-
1641
  <?php if(get_option('agca_screen_options_menu')==true){ ?>
1642
  jQuery("#screen-options-link-wrap").css("display","none");
1643
- <?php } ?>
1644
  <?php if(get_option('agca_help_menu')==true){ ?>
1645
  jQuery("#contextual-help-link-wrap").css("display","none");
1646
- jQuery("#contextual-help-link").css("display","none");
1647
- <?php } ?>
1648
  <?php if(get_option('agca_privacy_options')==true){ ?>
1649
  jQuery("#privacy-on-link").css("display","none");
1650
- <?php } ?>
1651
-
1652
- <?php if(get_option('agca_update_bar')==true){ ?>
1653
  <?php
1654
  if ( ! function_exists( 'c2c_no_update_nag' ) ) :
1655
  function c2c_no_update_nag() {
@@ -1661,52 +1665,52 @@ try
1661
  jQuery("#update-nag").css("display","none");
1662
  jQuery(".update-nag").css("display","none");
1663
  <?php } ?>
1664
-
1665
  <?php if(get_option('agca_footer')==true){ ?>
1666
  jQuery("#footer,#wpfooter").css("display","none");
1667
- <?php } ?>
1668
-
1669
- <?php if(get_option('agca_footer_left')!=""){ ?>
1670
  jQuery("#footer-left").html('<?php echo addslashes(get_option('agca_footer_left')); ?>');
1671
- <?php } ?>
1672
- <?php if(get_option('agca_footer_left_hide')==true){ ?>
1673
  jQuery("#footer-left").css("display","none");
1674
  <?php } ?>
1675
  <?php if(get_option('agca_footer_right')!=""){ ?>
1676
  jQuery("#footer-upgrade").html('<?php echo addslashes(get_option('agca_footer_right')); ?>');
1677
  <?php } ?>
1678
- <?php if(get_option('agca_footer_right_hide')==true){ ?>
1679
  jQuery("#footer-upgrade").css("display","none");
1680
  <?php } ?>
1681
-
1682
  <?php if(get_option('agca_language_bar')==true){ ?>
1683
  jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
1684
- <?php } ?>
1685
  <?php if(get_option('agca_dashboard_icon')==true){ ?>
1686
  var className = jQuery("#icon-index").attr("class");
1687
  if(className=='icon32'){
1688
  jQuery("#icon-index").attr("id","icon-index-removed");
1689
  }
1690
  <?php } ?>
1691
- <?php if(get_option('agca_dashboard_text')!=""){ ?>
1692
  jQuery("#dashboard-widgets-wrap").parent().find("h1").html("<?php echo addslashes(get_option('agca_dashboard_text')); ?>");
1693
  <?php } ?>
1694
- <?php if(get_option('agca_dashboard_text_paragraph')!=""){
1695
  require_once(ABSPATH . 'wp-includes/formatting.php');
1696
- ?>
1697
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
1698
-
1699
  jQuery("#agca_custom_dashboard_content").html('<br /><?php echo preg_replace('/(\r\n|\r|\n)/', '\n', addslashes(wpautop(get_option('agca_dashboard_text_paragraph')))); ?>');
1700
  <?php } ?>
1701
-
1702
  <?php /*Remove Dashboard widgets*/ ?>
1703
- <?php
1704
 
1705
  if(get_option('agca_dashboard_widget_welcome')==true){
1706
  ?>jQuery("#welcome-panel").css("display","none");<?php
1707
  }else{
1708
  ?>jQuery("#welcome-panel").css("display","block");<?php
1709
- }
1710
  if(get_option('agca_dashboard_widget_il')==true){
1711
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1712
  }else{
@@ -1741,47 +1745,47 @@ try
1741
  $this->remove_dashboard_widget('dashboard_secondary','side');
1742
  }else{
1743
  ?>jQuery("#dashboard_secondary").css("display","block");<?php
1744
- }
1745
  if(get_option('agca_dashboard_widget_activity')==true){
1746
  remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
1747
  }else{
1748
  ?>jQuery("#dashboard_activity").css("display","block");<?php
1749
- }
1750
-
1751
- ?>
1752
-
1753
- <?php /*ADMIN MENU*/ ?>
1754
-
1755
- <?php if(get_option('agca_admin_menu_separators')==true){ ?>
1756
  jQuery("#adminmenu li.wp-menu-separator").css({height: 0, margin: 0});
1757
- <?php } ?>
1758
- <?php if(get_option('agca_admin_menu_icons') == true){ ?>
1759
  jQuery(".wp-menu-image").each(function(){
1760
  jQuery(this).css("display","none");
1761
  });
1762
  jQuery('#adminmenu div.wp-menu-name').css('padding','8px');
1763
  <?php } ?>
1764
- <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1765
- jQuery("#adminmenu .wp-menu-arrow").css("visibility","hidden");
1766
-
1767
  <?php } ?>
1768
  <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
1769
-
1770
- <?php /*If Turned on*/ ?>
1771
-
1772
- <?php if(get_option('agca_admin_menu_agca_button_only') == true){ ?>
1773
  jQuery('#adminmenu > li').each(function(){
1774
  if(!jQuery(this).hasClass('agca_button_only')){
1775
  jQuery(this).addClass('noclass');
1776
  }
1777
  });
1778
  <?php /*Only admin see button*/
1779
- if (current_user_can($this->admin_capability())){ ?>
1780
  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')); ?>');
1781
  <?php } ?>
1782
- <?php } ?>
1783
-
1784
-
1785
  <?php /*EDIT MENU ITEMS*/?>
1786
  <?php if(get_option('ag_edit_adminmenu_json')!=""){
1787
 
@@ -1799,53 +1803,53 @@ try
1799
  } ?>
1800
 
1801
 
1802
-
1803
-
1804
- /*Add user buttons*/
1805
- jQuery('#adminmenu').append(buttons);
1806
-
1807
  <?php /*END If Turned on*/ ?>
1808
  <?php } else{ ?>
1809
  jQuery("#adminmenu").removeClass("noclass");
1810
- <?php } ?>
1811
-
1812
  reloadRemoveButtonEvents();
1813
 
1814
  <?php if(get_option('agca_admin_menu_collapse_button') == true){ ?>
1815
  //remove collapse menu button
1816
  jQuery('#collapse-menu').remove();
1817
- <?php } ?>
1818
-
1819
  <?php //COLORIZER ?>
1820
  updateAllColors();
1821
- <?php //COLORIZER END ?>
1822
- <?php } //end of apply for any user except admin ?>
1823
- /*Add user buttons*/
1824
- jQuery('#ag_add_adminmenu').append(buttonsJq);
1825
 
1826
-
1827
- }catch(err){
1828
  errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
1829
- console.log(errors);
1830
  }finally{
1831
- jQuery('html').css('visibility','visible');
1832
- }
1833
  <?php
1834
  if($this->saveAfterImport == true){
1835
  ?>savePluginSettings();<?php
1836
  }
1837
  ?>
1838
-
1839
  });
1840
-
1841
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){
1842
  $this->updateAllColors();
1843
  }else{
1844
  ?>function updateAllColors(){}; <?php
1845
  } ?>
1846
 
1847
-
1848
- /* ]]> */
1849
  </script>
1850
  <style type="text/css">
1851
  .underline_text{
@@ -1853,166 +1857,166 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1853
  }
1854
  .form-table th{
1855
  width:300px;
1856
- }
1857
-
1858
- #dashboard-widgets div.empty-container{
1859
  border:none;
1860
  }
1861
  </style>
1862
- <?php
1863
  }
1864
-
1865
  function print_login_head(){
1866
- $this->context = "login";
1867
  $this->error_check();
1868
  $wpversion = $this->get_wp_version();
1869
-
1870
  ?>
1871
- <script type="text/javascript">
1872
- document.write('<style type="text/css">html{visibility:hidden;}</style>');
1873
  var agca_version = "<?php echo $this->agca_version; ?>";
1874
  <?php //var wpversion = "echo $wpversion; ?>
1875
  var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1876
  var isSettingsImport = false;
1877
- var agca_context = "login";
1878
  </script>
1879
  <?php
1880
  $this->prepareAGCALoginTemplates();
1881
- $this->agca_get_includes();
1882
-
1883
- ?>
1884
-
1885
  <script type="text/javascript">
1886
-
1887
-
1888
  /* <![CDATA[ */
1889
- jQuery(document).ready(function() {
1890
- try{
1891
  <?php if(get_option('agca_login_round_box')==true){ ?>
1892
  jQuery("form#loginform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1893
  jQuery("#login h1 a").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1894
- jQuery("#login h1 a").css("margin-bottom",'10px');
1895
  jQuery("#login h1 a").css("padding-bottom",'0');
1896
  jQuery("form#lostpasswordform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1897
  <?php } ?>
1898
  <?php if(get_option('agca_login_banner')==true){ ?>
1899
  jQuery("#backtoblog").css("display","none");
1900
- <?php } ?>
1901
  <?php if(get_option('agca_login_banner_text')==true){ ?>
1902
  jQuery("#backtoblog a").html('<?php echo "← " . addslashes(get_option('agca_login_banner_text')); ?>');
1903
  <?php } ?>
1904
  <?php if(get_option('agca_login_photo_url')==true && get_option('agca_login_photo_remove')!=true){ ?>
1905
  advanced_url = "<?php echo get_option('agca_login_photo_url'); ?>";
1906
  var $url = "url(" + advanced_url + ")";
1907
- jQuery("#login h1 a").css("background",$url+' no-repeat');
1908
  jQuery("#login h1 a").hide();
1909
- image = jQuery("<img />").attr("src",advanced_url);
1910
  jQuery(image).load(function() {
1911
  var originalWidth = 326;
1912
- var widthDiff = this.width - originalWidth;
1913
  jQuery("#login h1 a").height(this.height);
1914
- jQuery("#login h1 a").width(this.width);
1915
- jQuery("#login h1 a").css("background-size",this.width+"px "+this.height+"px");
1916
-
1917
  var loginWidth = jQuery('#login').width();
1918
  var originalLoginWidth = 320;
1919
  var photoWidth = this.width;
1920
-
1921
- if(loginWidth > photoWidth){
1922
  jQuery("#login h1 a").css('margin','auto');
1923
- }else{
1924
- jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+((loginWidth-originalLoginWidth)/2)+"px");
1925
- }
1926
-
1927
  jQuery("#login h1 a").show();
1928
- });
1929
  <?php } ?>
1930
- <?php if(get_option('agca_login_photo_href')==true){ ?>
1931
- var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
1932
- $href = $href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1933
-
1934
- jQuery("#login h1 a").attr("href",$href);
1935
  <?php } ?>
1936
  <?php if(get_option('agca_login_photo_remove')==true){ ?>
1937
  jQuery("#login h1 a").css("display","none");
1938
- <?php } ?>
1939
-
1940
- jQuery("#login h1 a").attr("title","");
1941
-
1942
  <?php if(get_option('agca_login_register_remove')==true){ ?>
1943
  if(jQuery('p#nav').size() > 0){
1944
- jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1945
- }
1946
  jQuery('p#nav a').each(function(){
1947
  if(jQuery(this).attr('href').indexOf('register') != -1){
1948
  jQuery(this).remove();
1949
  }
1950
- });
1951
-
1952
- <?php } ?>
1953
- <?php if(get_option('agca_login_register_href')!=""){ ?>
1954
  jQuery('p#nav a').each(function(){
1955
  if(jQuery(this).attr('href').indexOf('register') != -1){
1956
  jQuery(this).attr('href','<?php echo get_option('agca_login_register_href'); ?>');
1957
  }
1958
- });
1959
-
1960
- <?php } ?>
1961
-
1962
  <?php if(get_option('agca_login_lostpassword_remove')==true){ ?>
1963
  if(jQuery('p#nav').size() > 0){
1964
- jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1965
- }
1966
  jQuery('p#nav a').each(function(){
1967
  if(jQuery(this).attr('href').indexOf('lostpassword') != -1){
1968
  jQuery(this).remove();
1969
  }
1970
- });
1971
-
1972
- <?php } ?>
 
1973
 
1974
-
1975
  <?php //COLORIZER ?>
1976
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1977
- jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1978
- jQuery("body.login, html").css("background","<?php echo $this->colorizer['login_color_background'];?>");
1979
-
1980
-
1981
- <?php
1982
-
1983
-
1984
  } ?>
1985
- <?php //COLORIZER END ?>
1986
- }catch(err){
1987
- console.log("AGCA - LOGIN ERROR: " + err.name + " / " + err.message);
1988
- }finally{
1989
  jQuery('html').show();
1990
- jQuery('html').css('visibility','visible');
1991
  }
1992
  });
1993
  /* ]]> */
1994
-
1995
  </script>
1996
- <?php
1997
  }
1998
 
1999
  function agca_admin_page() {
2000
 
2001
  $wpversion = $this->get_wp_version();
2002
  $this->agca_error_check();
2003
- ?>
2004
  <?php //includes ?>
2005
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css?ver=<?php echo $wpversion; ?>" />
2006
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2007
-
2008
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css?ver=<?php echo $wpversion; ?>" />
2009
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2010
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/xd.js?ver=<?php echo $wpversion; ?>"></script>
2011
  <script type="text/javascript">
2012
- var templates_ep = "<?php echo $this->templates_ep; ?>";
2013
- var template_selected = '<?php echo get_option('agca_selected_template'); ?>';
2014
  </script>
2015
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_tmpl.js?ver=<?php echo $wpversion; ?>"></script>
2016
  <?php //includes ?>
2017
  <div class="wrap">
2018
  <h1 id="agca-title">AG Custom Admin Settings <span style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
@@ -2020,8 +2024,9 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2020
  <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>
2021
  </div>
2022
  <div id="agca_error_placeholder"></div>
2023
- <div id="agca_news">&nbsp;</div><br />
2024
  <form method="post" id="agca_form" action="options.php">
 
2025
  <?php settings_fields( 'agca-options-group' ); ?>
2026
  <div id="agca-your-feedback">
2027
  <strong>
@@ -2042,16 +2047,16 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2042
  <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard Page</a></li>
2043
  <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a></li>
2044
  <li class="normal" ><a href="#admin-menu-settings" title="Settings for main admin menu">Admin Menu</a></li>
2045
- <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a></li>
2046
  <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
2047
  <li class="normal" style=""><a style="color:#DB6014;font-weight:bolder;" href="#ag-templates" title="AG Custom Admin Themes">Admin Themes</a></li>
2048
-
2049
  <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>
2050
- </li>
2051
- <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
2052
  </ul>
2053
  <div id="agca_advertising">
2054
- <ul>
2055
  <li style="min-height:105px;display: block"></li>
2056
  </ul>
2057
  </div>
@@ -2351,8 +2356,8 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2351
 
2352
  </table>
2353
  </div>
2354
-
2355
- <div id="section_admin_footer" style="display:none" class="ag_section">
2356
  <h2 class="section_title">Admin Footer Settings</h2>
2357
  <table class="form-table" width="500px">
2358
  <?php
@@ -2416,8 +2421,8 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2416
  <th scope="row">
2417
  <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>
2418
  </th>
2419
- <td class="agca_editor">
2420
- <?php $this->getTextEditor('agca_dashboard_text_paragraph'); ?>
2421
  </td>
2422
  </tr>
2423
  <?php
@@ -2477,7 +2482,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2477
  </table>
2478
  </div>
2479
  <div id="section_login_page" style="display:none" class="ag_section">
2480
- <h2 class="section_title">Login Page Settings</h2>
2481
  <table class="form-table" width="500px">
2482
  <?php
2483
 
@@ -2596,7 +2601,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2596
  <td colspan="2">
2597
  <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 />
2598
  <p tabindex="0"><em>(click on the top menu item to show its sub-menus)</em></p>
2599
- <table id="ag_edit_adminmenu">
2600
  <tr style="background-color:#999;">
2601
  <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>
2602
  </td>
@@ -2621,14 +2626,14 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2621
  <option value="_self" selected>same tab</option>
2622
  <option value="_blank" >new tab</option>
2623
  </select>
2624
- <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" />
2625
- </td><td></td>
2626
  </tr>
2627
  </table>
2628
- <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')); ?>" />
2629
- </td>
2630
- <td>
2631
- </td>
2632
  </tr>
2633
  <?php
2634
  $this->print_options_h3('Admin Menu Settings');
@@ -2749,16 +2754,16 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2749
 
2750
  ?>
2751
  </table>
2752
- <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json" value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>" />
2753
- <div id="picker"></div>
2754
  </div>
2755
- <div id="section_templates" style="display:none" class="ag_section">
2756
- <h2 class="section_title"><span style="float:left">Admin Themes</span></h2>
2757
  <table class="form-table" width="500px">
2758
- <tr valign="center">
2759
- <td>
2760
  <div id="agca_templates"></div>
2761
- </td>
2762
  </tr>
2763
  <tr>
2764
  <td>
@@ -2789,7 +2794,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2789
  <td>
2790
  <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>
2791
  </td>
2792
- </tr>
2793
  <tr valign="center">
2794
  <th scope="row">
2795
  <label title="Add additional custom JavaScript" for="agca_custom_js">Custom JavaScript</label>
@@ -2804,24 +2809,25 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2804
  </th>
2805
  <td id="import_file_area">
2806
  <input class="agca_button" type="button" name="agca_export_settings" value="Export Settings" onclick="exportSettings();"/></br>
2807
- <input type="file" id="settings_import_file" name="settings_import_file" style="display: none"/>
2808
- <input type="hidden" id="_agca_import_settings" name="_agca_import_settings" value="false" />
2809
- <input type="hidden" id="_agca_export_settings" name="_agca_export_settings" value="false" />
2810
  <input class="agca_button" type="button" name="agca_import_settings" value="Import Settings" onclick="importSettings();"/>
2811
- </td>
2812
  </tr>
2813
  </table>
2814
  </div>
2815
  <p class="submit">
2816
  <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()" />
2817
  </p>
2818
-
2819
  </form>
2820
  <form id="agca_templates_form" name="agca_templates_form" action="<?php echo $_SERVER['PHP_SELF'];?>?page=ag-custom-admin/plugin.php" method="post">
 
2821
  <input type="hidden" name="_agca_save_template" value="true" />
2822
- <input type="hidden" id="templates_data" name="templates_data" value="" />
2823
- <input type="hidden" id="templates_name" name="templates_name" value="" />
2824
- </form>
2825
  </div>
2826
  <?php
2827
  }
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.3
8
  Author URI: http://www.wordpressadminpanel.com/
9
 
10
  Copyright 2016. WAP (email : info@wordpressadminpanel.com)
22
  You should have received a copy of the GNU General Public License
23
  along with this program. If not, see <http://www.gnu.org/licenses/>.
24
  */
25
+
26
  $agca = new AGCA();
27
 
28
  class AGCA{
29
+ 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);
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.3";
64
+
65
  //TODO:upload images programmaticaly
66
 
67
  }
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"){
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
  if(isset($_POST['_agca_save_template'])){
116
+ $this->verifyPostRequest();
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,
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->verifyPostRequest();
155
  $this->agcaAdminSession();
156
  if($_POST['template'] !="")
157
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = array("license"=>$_POST['license']);
158
+
159
  print_r($_SESSION);
160
  echo "_agca_templates_session:OK";
161
  exit;
162
+ }else if(isset($_POST['_agca_templates_session_remove_license'])){
163
+ $this->verifyPostRequest();
164
  $this->agcaAdminSession();
165
  if($_POST['template'] !="")
166
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = null;
167
  print_r($_SESSION);
168
  echo "_agca_templates_session_remove_license:OK";
169
  exit;
170
  }else if(isset($_POST['_agca_get_templates'])){
171
+ $this->verifyPostRequest();
172
  $templates = get_option( 'agca_templates' );
173
+ if($templates == "") $templates = array();
174
  $results = array();
175
  foreach($templates as $key=>$val){
176
  $results[]=$key;
178
  echo json_encode($results);
179
  exit;
180
  }else if(isset($_POST['_agca_activate_template'])){
181
+ $this->verifyPostRequest();
182
  update_option('agca_selected_template', $_POST['_agca_activate_template']);
183
  $_POST = array();
184
  //unset($_POST);
185
  exit;
186
  }else if(isset($_POST['_agca_template_settings'])){
187
+ $this->verifyPostRequest();
188
  $settings = $_POST['_agca_template_settings'];
189
+
190
+ $templates = get_option( 'agca_templates' );
191
  if($templates == ""){
192
+ $templates = array();
193
+ }
194
  $template_name = $_POST["_agca_current_template"];
195
+
196
  $templates[$template_name]["settings"] = $settings;
197
  update_option('agca_templates', $templates);
198
+
199
+ $_POST = array();
200
  //print_r($templates);
201
  exit;
202
+ }else if(isset($_POST['_agca_upload_image'])){
203
+ $this->verifyPostRequest();
204
  function my_sideload_image() {
205
+ $remoteurl = $_POST['_agca_upload_image'];
206
+ $file = media_sideload_image( $remoteurl, 0 ,"AG Custom Admin Template Image (do not delete)");
207
  $fileparts = explode("src='",$file);
208
+ $url=explode("'",$fileparts[1]);
209
+ echo $url[0];
210
+ exit;
211
  }
212
  add_action( 'admin_init', 'my_sideload_image' );
213
+
214
+ }else if(isset($_POST['_agca_remove_template_images'])){
215
+ $this->verifyPostRequest();
216
+ $this->delete_template_images($_POST['_agca_remove_template_images']);
217
  exit;
218
  }
219
  }
220
 
221
+ function verifyPostRequest(){
222
  if ($_SERVER['REQUEST_METHOD'] === 'POST') {
223
  if(!is_admin()){
224
  exit;
228
  if(!is_user_logged_in() || !current_user_can( 'manage_options' )){
229
  exit;
230
  }
231
+
232
+ if(!wp_verify_nonce($_POST['_agca_token'],'agca_form')){
233
+ exit;
234
+ }
235
  }
236
  }
237
+
238
  function admin_bar_changes(){
239
  if( current_user_can( 'manage_options' )){
240
  global $wp_admin_bar;
245
  'href' => 'tools.php?page=ag-custom-admin/plugin.php#ag-templates'
246
  ));
247
  }
248
+ }
249
  }
250
+
251
  function delete_template_images_all(){
252
+ $templates = get_option('agca_templates');
253
  if($templates != null && $templates != ""){
254
  foreach($templates as $template){
255
  if($template != null && $template['images'] != null && $template['images'] != ""){
260
  }
261
  //print_r($imgs);
262
  }
263
+ }
264
  }
265
  //print_r($templates);
266
  }
267
+
268
  function delete_template_images($template_name){
269
+ $templates = get_option('agca_templates');
270
  if($templates != null && $templates != ""){
271
  $template = $templates[$template_name];
272
  if($template != null && $template['images'] != null && $template['images'] != ""){
280
  }
281
  //print_r($templates);
282
  }
283
+
284
  function delete_attachment_by_src ($image_src) {
285
  global $wpdb;
286
  $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
287
  $id = $wpdb->get_var($query);
288
  wp_delete_attachment( $id, $true );
289
  }
290
+
291
  function get_installed_agca_templates(){
292
  $templates = get_option( 'agca_templates' );
293
  if($templates == "")return '[]';
295
  foreach($templates as $key=>$val){
296
  $results[]=$key;
297
  }
298
+ return json_encode($results);
299
  }
300
+
301
  function isGuest(){
302
  global $user_login;
303
  if($user_login) {
307
  }
308
  }
309
  function check_active_plugin(){
310
+
311
+ $ozh = false;
312
+
313
+ if (is_plugin_active('ozh-admin-drop-down-menu/wp_ozh_adminmenu.php')) {
314
  $ozh = true;
315
+ }
316
+
317
  $this->active_plugin = array(
318
  "ozh" => $ozh
319
  );
320
  }
321
+ function change_title($admin_title, $title){
322
  //return get_bloginfo('name').' - '.$title;
323
  if(get_option('agca_custom_title')!=""){
324
  $blog = get_bloginfo('name');
325
  $page = $title;
326
+ $customTitle = get_option('agca_custom_title');
327
  $customTitle = str_replace('%BLOG%',$blog,$customTitle);
328
  $customTitle = str_replace('%PAGE%',$page,$customTitle);
329
  return $customTitle;
330
  }else{
331
  return $admin_title;
332
+ }
333
  }
334
+ function agca_get_includes() {
335
+ ?>
336
  <script type="text/javascript">
337
+ <?php
338
+ //AGCA GLOBALS
339
+ echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';";
340
  ?>
341
  </script>
342
  <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; ?>" />
343
+ <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"; ?>" />
344
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
345
+ <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>
346
+
347
  <?php
348
+ if($this->context == "login"){
349
  ?>
350
+ <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/login.min.css" />
351
  <?php
352
  }else{
353
  ?>
354
+ <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/admin.min.css" />
355
  <?php
356
  }
357
  ?>
358
+ <?php
359
+ echo $this->templateCustomizations;
360
+
361
+ if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
362
  ?>
363
+ <style type="text/css">
364
  <?php
365
+ echo get_option('agca_custom_css');
366
  ?>
367
  </style>
368
  <script type="text/javascript">
374
  }
375
  </script>
376
  <?php
377
+ }
378
  }
379
+
380
+ function agca_enqueue_scripts() {
381
+ wp_enqueue_script('jquery');
382
  }
383
+
384
  function reloadScript(){
385
  $isAdmin = false;
386
  if(defined('WP_ADMIN') && WP_ADMIN == 1){
387
  $isAdmin = true;
388
  }
389
+ if(in_array((isset($GLOBALS['pagenow'])?$GLOBALS['pagenow']:""), array('wp-login.php', 'wp-register.php')) || $isAdmin){
390
+ add_action('init', array(&$this,'agca_enqueue_scripts'));
391
+ }
392
  }
393
+
394
+ function agca_register_settings() {
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' );
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' );
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' );
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
+ if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=="true"){
490
+ $this->verifyPostRequest();
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->verifyPostRequest();
510
+ $this->exportSettings();
511
+ }
512
  }
513
+
514
  if(isset($_GET['agca_action'])){
515
  if($_GET['agca_action'] == "disablewarning"){
516
  update_option('agca_disablewarning', true);
517
+ }
518
  }
519
  }
520
 
521
+ function agca_deactivate() {
522
+
523
+ }
524
+
525
  function getOptions(){
526
  return Array(
527
  'agca_role_allbutadmin',
565
  'agca_dashboard_text',
566
  'agca_dashboard_text_paragraph',
567
  'agca_dashboard_widget_welcome',
568
+ 'agca_dashboard_widget_activity',
569
  'agca_dashboard_widget_il',
570
  'agca_dashboard_widget_plugins',
571
  'agca_dashboard_widget_qp',
591
  'agca_admin_menu_submenu_round',
592
  'agca_admin_menu_submenu_round_size',
593
  'agca_admin_menu_brand',
594
+ 'agca_admin_menu_brand_link',
595
  'agca_admin_menu_autofold',
596
  'agca_admin_menu_collapse_button',
597
  'ag_edit_adminmenu_json',
601
  'agca_colorizer_turnonof',
602
  'agca_custom_js',
603
  'agca_custom_css',
604
+ 'agca_colorizer_turnonoff',
605
  'agca_disablewarning',
606
  'agca_selected_template',
607
  'agca_templates',
608
+ );
609
+ }
610
+
611
  function getTextEditor($name){
612
  $settings = array(
613
+ 'textarea_name' => $name,
614
+ 'media_buttons' => true,
615
+ 'tinymce' => array(
616
  'theme_advanced_buttons1' => 'formatselect,|,bold,italic,underline,|,' .
617
  'bullist,blockquote,|,justifyleft,justifycenter' .
618
  ',justifyright,justifyfull,|,link,unlink,|' .
621
  );
622
  wp_editor( get_option($name), $name, $settings );
623
  }
624
+
625
  function importSettings($settings){
626
  $exploaded = explode("|^|^|", $settings);
627
  // $str = "EEE: ";
628
+
629
  $savedOptions = array();
630
+
631
  foreach ($exploaded as $setting){
632
+
633
  $key = current(explode(':', $setting));
634
+ $value = substr($setting, strlen($key)+1);
635
+ $cleanedValue = str_replace('|^|^|','',$value);
636
+ $savedOptions[$key] = $cleanedValue;
637
+ }
638
+
639
  // print_r($savedOptions);
640
+
641
  $optionNames = $this->getOptions();
642
+
643
  foreach ($optionNames as $optionName){
644
+ $optionValue = "";
645
  $optionValue = $savedOptions[$optionName];
646
+
647
  if($optionName == "ag_edit_adminmenu_json" || "ag_edit_adminmenu_json_new"|| $optionName == "ag_add_adminmenu_json" ||$optionName == "ag_colorizer_json"){
648
  $optionValue = str_replace("\\\"", "\"", $optionValue);
649
+ $optionValue = str_replace("\\\'", "\'", $optionValue);
650
  }else if($optionName == "agca_custom_js" || $optionName == "agca_custom_css"){
651
  //fb($optionValue);
652
  $optionValue = htmlspecialchars_decode($optionValue);
654
  $optionValue = str_replace('\"', "'", $optionValue);
655
  //fb($optionValue);
656
  }else{
657
+
658
+ }
659
+ update_option($optionName, $optionValue);
660
  $str.="/".$optionName."/".$optionValue."\n";
661
+ }
662
+
663
  //Migration from 1.2.6. to 1.2.5.1 - remove in later versions
664
  //agca_script_css
665
  //
666
  // fb($savedOptions);
667
  if($savedOptions['agca_script_css'] != null){
668
+ $optionValue = "";
669
+ $optionValue = str_replace("\'", '"', $savedOptions['agca_script_css']);
670
  $optionValue = str_replace('\"', "'", $optionValue);
671
  update_option('agca_custom_css', $optionValue);
672
  }
673
  if($savedOptions['agca_script_js'] != null){
674
+ $optionValue = "";
675
+ $optionValue = str_replace("\'", '"', $savedOptions['agca_script_js']);
676
  $optionValue = str_replace('\"', "'", $optionValue);
677
  update_option('agca_custom_js', $optionValue);
678
+ }
679
+
680
  //echo $str;
681
+
682
  //save imported settings
683
+ $this->saveAfterImport = true;
684
  }
685
+
686
  function exportSettings(){
687
  $str = "";
688
+
689
  $include_menu_settings = false;
690
+ if(isset($_POST['export_settings_include_admin_menu'])){
691
  if($_POST['export_settings_include_admin_menu'] == 'on'){
692
  $include_menu_settings = true;
693
  }
700
  }else{
701
  $str .=$key. ":".$value."|^|^|";
702
  }
703
+ }
704
  }
705
+
706
+ $filename = 'AGCA_Settings_'.date("Y-M-d_H-i-s").'.agca';
707
  header("Cache-Control: public");
708
+ header("Content-Description: File Transfer");
709
  header("Content-Disposition: attachment; filename=$filename");
710
+ header("Content-Type: text/plain; ");
711
  header("Content-Transfer-Encoding: binary");
712
  echo $str;
713
  die();
714
+ }
715
+
716
  function startsWith($haystack, $needle)
717
  {
718
  $length = strlen($needle);
719
  return (substr($haystack, 0, $length) === $needle);
720
  }
721
+
722
+
723
+
724
+ function agca_create_menu() {
725
+ add_management_page( 'AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this,'agca_admin_page') );
726
  }
727
+
728
  function agca_create_admin_button($name,$arr) {
729
 
730
  $href = $arr["value"];
732
  $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>";
733
 
734
  return $button;
735
+ }
736
  function agca_decode($code){
737
  $code = str_replace("{","",$code);
738
  $code = str_replace("}","",$code);
739
  $code = str_replace("\", \"","\"|||\"",$code);
740
  $elements = explode("|||",$code);
741
+
742
  return $elements;
743
  }
744
+
745
  function jsonMenuArray($json,$type){
746
  $arr = explode("|",$json);
747
  $elements = "";
756
  }else if($type == "buttons"){
757
  $elements = json_decode($arr[0],true);
758
  if($elements !=""){
759
+ foreach($elements as $k => $v){
760
+ $array.=$this->agca_create_admin_button($k,$v);
761
+ }
762
  }
763
  }else if($type == "buttonsJq"){
764
  $elements = json_decode($arr[0],true);
767
  $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>';
768
  }
769
  }
770
+ }else{
771
  if(isset($arr[$type])){
772
  $elements = $this->agca_decode($arr[$type]);
773
  }
774
+
775
  if($elements !=""){
776
+ foreach($elements as $element){
777
  if(!$first){
778
  $array .=",";
779
  }
782
  $array.="[".$parts[0].", ".$parts[1]."]";
783
  }
784
  $first=false;
785
+ }
786
+ }
787
  }
788
+
789
+ return $array;
790
  }
791
+
792
+ function remove_dashboard_widget($widget,$side)
793
  {
794
  //side can be 'normal' or 'side'
795
  global $wp_meta_boxes;
796
+ remove_meta_box($widget, 'dashboard', $side);
797
  }
798
+
799
  function get_wp_version(){
800
  global $wp_version;
801
+ $array = explode('-', $wp_version);
802
+ $version = $array[0];
803
  return $version;
804
  }
805
+
806
  function print_page()
807
  {
808
  if($this->isGuest() && get_option('agca_admin_bar_frontend_hide')){
811
  if(!$this->isGuest()){
812
  ?><style type="text/css"><?php echo get_option('agca_custom_css'); ?></style><?php
813
  }
814
+
815
  if(get_option('agca_admin_bar_frontend_hide')==true){
816
  add_filter( 'show_admin_bar', '__return_false' );
817
  ?>
818
  <style type="text/css">
819
  #wpadminbar{
820
+ display: none;
821
+ }
822
  </style>
823
  <script type="text/javascript">
824
+ window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
825
  </script>
826
+ <?php
827
  }
828
+ if(get_option('agca_admin_bar_frontend')!=true){
829
+
830
  $this->context = "page";
831
  $wpversion = $this->get_wp_version();
832
 
833
  ?>
834
+
835
+
836
+ <script type="text/javascript">
837
  var wpversion = "<?php echo $wpversion; ?>";
838
  var agca_version = "<?php echo $this->agca_version; ?>";
839
  var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
851
  }
852
  setTimeout("initJQuery()", 50);
853
  } else {
854
+ jQuery(function() {
855
  try
856
+ {
857
  <?php if(get_option('agca_header')!=true){ ?>
858
  jQuery('#wpadminbar').show();
859
  <?php } ?>
860
+
861
  <?php $this->print_admin_bar_scripts(); ?>
862
  }catch(ex){}
863
+ });
864
  }
865
  }
866
+ initJQuery();
867
  </script>
868
+ <script type="text/javascript">
869
  <?php echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';"; ?>
870
  </script>
871
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
872
+ <script type="text/javascript">
873
+ jQuery(document).ready(function(){
874
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on' && (get_option('agca_admin_bar_frontend_hide')!=true)){
875
  foreach($this->colorizer as $k => $v){
876
+ if(($k !="") and ($v !="")){
877
  if(
878
  $k == "color_header" ||
879
  $k == "color_font_header"
880
  ){
881
  ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
882
  }
883
+
884
  }
885
  }
886
+ ?>
887
+
888
  <?php
889
  }
890
  ?>
891
+ });
892
+ </script>
893
  <?php
894
  }
895
+
896
  }
897
+
898
  function print_admin_bar_scripts(){
899
+ ?>
900
+ <?php if(get_option('agca_remove_top_bar_dropdowns')==true){ ?>
901
  jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-sub-wrapper").hide();
902
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-site-name .ab-sub-wrapper").hide();
903
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item").attr('title','');
904
 
905
+ <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
906
  jQuery(".new_content_header_submenu").hide();
907
+ <?php } ?>
908
+
909
+ <?php } ?>
910
 
 
 
911
  <?php if(get_option('agca_admin_bar_comments')!=""){ ?>
912
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-comments").css("display","none");
913
  <?php } ?>
914
+ <?php if(get_option('agca_admin_bar_new_content')!=""){ ?>
915
+ jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content").css("display","none");
916
  <?php } ?>
917
  <?php if(get_option('agca_admin_bar_new_content_post')!=""){ ?>
918
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-post").css("display","none");
928
  <?php } ?>
929
  <?php if(get_option('agca_admin_bar_new_content_media')!=""){ ?>
930
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-new-content li#wp-admin-bar-new-media").css("display","none");
931
+ <?php } ?>
932
  <?php if(get_option('agca_admin_bar_update_notifications')!=""){ ?>
933
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-updates").css("display","none");
934
  <?php } ?>
935
  <?php if(get_option('agca_admin_bar_admin_themes')!=""){ ?>
936
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-agca-admin-themes").css("display","none");
937
  <?php } ?>
938
+
939
+
940
+
941
  <?php if(get_option('agca_header_logo')==true){ ?>
942
+ jQuery("#wphead #header-logo").css("display","none");
943
  jQuery("ul#wp-admin-bar-root-default li#wp-admin-bar-wp-logo").css("display","none");
944
 
945
  <?php } ?>
946
+ <?php if(get_option('agca_header_logo_custom')!=""){ ?>
947
+
948
+ var img_url = '<?php echo addslashes(get_option('agca_header_logo_custom')); ?>';
949
 
950
  advanced_url = img_url;
951
+ image = jQuery("<img />").attr("src",advanced_url);
952
+ jQuery(image).load(function() {
953
  jQuery("#wpbody-content").prepend(image);
954
+ });
955
 
956
+ <?php } ?>
957
+ <?php if(get_option('agca_wp_logo_custom')!=""){ ?>
958
  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'); ?>\" />");
959
  jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('background-image','none');
960
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item span.ab-icon").css('width','auto');
961
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',"<?php echo get_bloginfo('wpurl'); ?>");
962
+ jQuery("#wpadminbar #wp-admin-bar-root-default > #wp-admin-bar-wp-logo .ab-item:before").attr('title','');
963
  jQuery('body #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon').attr('class','ab-icon2');
964
  jQuery("#wp-admin-bar-wp-logo").show();
965
  <?php }?>
966
  <?php if(get_option('agca_remove_site_link')==true){ ?>
967
+ jQuery("#wp-admin-bar-site-name").css("display","none");
968
 
969
  <?php } ?>
970
+ <?php if(get_option('agca_wp_logo_custom_link')!=""){ ?>
971
+ var href = "<?php echo get_option('agca_wp_logo_custom_link'); ?>";
972
  href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
973
+ if(href == "%SWITCH%"){
974
  href = "<?php echo get_bloginfo('wpurl'); ?>";
975
  <?php if($this->context == "page"){
976
+ ?>href+="/wp-admin";<?php
977
  }
978
  ?>
979
  }
980
+ jQuery("li#wp-admin-bar-wp-logo a.ab-item").attr('href',href);
981
+
982
  <?php }?>
983
  <?php if(get_option('agca_site_heading')==true){ ?>
984
  jQuery("#wphead #site-heading").css("display","none");
985
  <?php } ?>
986
+ <?php if(get_option('agca_custom_site_heading')!=""){ ?>
987
  jQuery("#wphead #site-heading").after('<h1><?php echo addslashes(get_option('agca_custom_site_heading')); ?></h1>');
988
  jQuery("#wp-admin-bar-site-name a:first").html('<?php echo addslashes(get_option('agca_custom_site_heading')); ?>');
989
+
990
+ <?php } ?>
991
+ <?php if(get_option('agca_header')==true && $this->context =='admin'){
992
  ?>
993
+ jQuery("#wpadminbar").css("display","none");
994
  jQuery("body.admin-bar").css("padding-top","0");
995
+ jQuery("#wphead").css("display","none");
996
+ jQuery('html.wp-toolbar').css("padding-top","0");
997
 
998
+ <?php } ?>
999
+ <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
1000
  <?php
1001
  $agca_logout_text = ((get_option('agca_logout')=="")?"Log Out":get_option('agca_logout'));
1002
+ ?>
1003
+ 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>');
1004
+
1005
 
1006
  <?php } ?>
1007
+ <?php if(get_option('agca_howdy')!=""){ ?>
1008
+ var alltext="";
1009
  alltext="";
1010
  jQuery('li#wp-admin-bar-my-account').css('cursor','default');
1011
  alltext = jQuery('li#wp-admin-bar-my-account').html();
1012
+ if(alltext!=null){
1013
+ var parts = alltext.split(',');
1014
  alltext = "<?php echo get_option('agca_howdy'); ?>" + ", " + parts[1];
1015
+ }
1016
+ jQuery("li#wp-admin-bar-my-account").html("<a href=\"#\" class=\"ab-item\">"+alltext+"</a>");
1017
+
1018
  <?php } ?>
1019
+ <?php
1020
  if(get_option('agca_custom_title')!=""){
1021
+ //add_filter('admin_title', '$this->change_title', 10, 2);
1022
+
1023
+ }
1024
  ?>
1025
+ <?php if(get_option('agca_logout')!=""){ ?>
1026
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-logout a").text("<?php echo get_option('agca_logout'); ?>");
1027
  <?php } ?>
1028
+ <?php if(get_option('agca_remove_your_profile')==true){ ?>
1029
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("visibility","hidden");
1030
  jQuery("ul#wp-admin-bar-user-actions li#wp-admin-bar-edit-profile").css("height","10px");
1031
  jQuery('#wpadminbar #wp-admin-bar-top-secondary > #wp-admin-bar-my-account > a').attr('href','#');
1032
  jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-user-info > a').attr('href','#');
1033
+ jQuery('#wpadminbar #wp-admin-bar-top-secondary #wp-admin-bar-edit-profile > a').attr('href','#');
1034
+ <?php } ?>
1035
+ <?php if(get_option('agca_logout_only')==true){ ?>
1036
  var logout_content = jQuery("li#wp-admin-bar-logout").html();
1037
  jQuery("ul#wp-admin-bar-top-secondary").html('<li id="wp-admin-bar-logout" style="display:block;">'+ logout_content +'</li>');
1038
  jQuery("#wp-admin-bar-logout a").css('padding','0 8px');
1039
 
1040
+
1041
  <?php } ?>
1042
+
1043
  <?php
1044
+
1045
+
1046
  }
1047
+
1048
  function updateAllColors(){
1049
+
1050
+ ?>
1051
  function updateAllColors(){
1052
  <?php
1053
  foreach($this->colorizer as $k => $v){
1054
+ if(($k !="") and ($v !="")){
1055
  ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
1056
  }
1057
  }
1058
  ?>
1059
+ jQuery('.color_picker').each(function(){
1060
  updateColor(jQuery(this).attr('id'),jQuery(this).val())
1061
  });
1062
  jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1063
  jQuery('#adminmenu li.wp-menu-open').css('border','none');
1064
+ jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
1065
  }<?php
1066
+
1067
  }
1068
  function admin_capabilities(){
1069
  global $wp_roles;
1070
  $capabs = $wp_roles->roles['administrator']['capabilities'];
1071
  $capabilitySelector = "";
1072
+
1073
+ $selectedValue = get_option('agca_admin_capability');
1074
  if($selectedValue == ""){
1075
  $selectedValue = "edit_dashboard";
1076
  }
1087
  //$capabilitySelector .="<option val=\"$k\" $selected >".str_replace(' ', ' ', ucwords(str_replace('_', ' ', $k))) ."</option>\n";
1088
  $capabilitySelector .="<option val=\"$k\" $selected >".$k."</option>\n";
1089
  }
1090
+
1091
  $this->admin_capabilities = "<select class=\"agca-selectbox\" id=\"agca_admin_capability\" name=\"agca_admin_capability\" val=\"upload_files\">".$capabilitySelector."</select>";
1092
  }
1093
+
1094
  function admin_capability(){
1095
+ $selectedValue = get_option('agca_admin_capability');
1096
  if($selectedValue == ""){
1097
  $selectedValue = "edit_dashboard";
1098
  }
1099
  return $selectedValue;
1100
  }
1101
+
1102
  function JSPrintAGCATemplateSettingsVar($settings){
1103
  echo "\n<script type=\"text/javascript\">\n";
1104
+ echo "var agca_template_settings = ".preg_replace('#<script(.*?)>(.*?)</script>#is', '', $settings).";\n"; //TODO: think about this
1105
+ echo "</script>";
1106
  }
1107
+
1108
  function appendSettingsToAGCATemplateCustomizations($customizations, $settings){
1109
  $template_settings = json_decode($settings);
1110
  //print_r($template_settings);
1111
  foreach($template_settings as $sett){
1112
  $key = $sett->code;
1113
+
1114
  //use default value if user's value is not set
1115
  $value="";
1116
  if($sett->value != ""){
1117
+ $value = $sett->value;
1118
  }else{
1119
+ $value = $sett->default_value;
1120
  }
1121
+
1122
+ //Prepare settings
1123
  if($sett->type == 6){
1124
  if($value !== null && (strtolower($value) == "on" || $value == "1")){
1125
  $value = "true";
1126
  }else{
1127
  $value = "false";
1128
+ }
1129
+ }
1130
+ $customizations = str_replace("%".$key."%",$value, $customizations);
1131
+ }
1132
  return $customizations;
1133
  }
1134
+
1135
+ function enableSpecificWPVersionCustomizations($customizations){
1136
+ /*enable special CSS for this WP version*/
1137
+ $ver = $this->get_wp_version();
1138
  $customizations = str_replace("/*".$ver," ", $customizations);
1139
  $customizations = str_replace($ver."*/"," ", $customizations);
1140
  return $customizations;
1141
  }
1142
+
1143
+ function removeCSSComments($customizations){
1144
  $customizations = preg_replace('#/\*.*?\*/#si','',$customizations);
1145
  return $customizations;
1146
  }
1147
+
1148
  function prepareAGCAAdminTemplates(){
1149
  if(get_option( 'agca_templates' ) != ""){
1150
  //print_r(get_option( 'agca_templates' ));
1151
  $themes = get_option( 'agca_templates' );
1152
  $selectedTheme = get_option('agca_selected_template');
1153
+ if(isset($themes[$selectedTheme])){
1154
  $theme = $themes[$selectedTheme];
1155
  add_filter('get_user_option_admin_color', array(&$this,'change_admin_color'));
1156
+
1157
  echo (stripslashes($theme['common']));
1158
  echo "<!--AGCAIMAGES: ".$theme['images']."-->";
1159
+
1160
  //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1161
+ if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
1162
+ if($theme['settings'] == "" || $theme['settings'] == " ") $theme['settings'] = "{}";
1163
+ //print_r($templdata);
1164
+
1165
+ $this->JSPrintAGCATemplateSettingsVar($theme['settings']);
1166
+
1167
+ $admindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($theme['admin']), $theme['settings']);
1168
  $admindata = $this->enableSpecificWPVersionCustomizations($admindata);
1169
+ $admindata = $this->removeCSSComments($admindata);
1170
+
1171
  //echo $admindata;
1172
+ //REPLACE TAGS WITH CUSTOM TEMPLATE SETTINGS
1173
  $this->templateCustomizations = $admindata;
1174
  }
1175
  //KEEP THIS FOR MIGRATION PURPOSE FOR SOME TIME
1176
+ }
1177
  }
1178
  }
1179
+
1180
  function agcaAdminSession(){
1181
  $agcaTemplatesSession = array();
1182
+
1183
  //session_destroy();
1184
  //session_unset();
1185
+
1186
  /*if(!session_id()){
1187
+ session_start();
1188
  }*/
1189
+
1190
  if(!isset($_SESSION["AGCA"])){
1191
+ $_SESSION["AGCA"] = array();
1192
+ $_SESSION["AGCA"]["Templates"] = array();
1193
  }
1194
  //print_r($_SESSION);
1195
+
1196
  if(isset($_SESSION["AGCA"])){
1197
  if(isset($_SESSION["AGCA"]["Templates"])){
1198
  //print_r($_SESSION["AGCA"]["Templates"]);
1199
+ $agcaTemplatesSession = json_encode($_SESSION["AGCA"]["Templates"]);
1200
  }
1201
  }
1202
+
1203
+
1204
+ if($agcaTemplatesSession == '""' || $agcaTemplatesSession == '"[]"'){
1205
  $agcaTemplatesSession = array();
1206
  }
1207
+
1208
+
1209
  return $agcaTemplatesSession;
1210
+
1211
  }
1212
+
1213
  function getAGCAColor($name){
1214
  if(isset($this->colorizer[$name])){
1215
+ echo htmlspecialchars($this->colorizer[$name]);
1216
+ }
1217
  }
1218
+
1219
  function prepareAGCALoginTemplates(){
1220
  if(get_option( 'agca_templates' ) != ""){
1221
  //print_r(get_option( 'agca_templates' ));
1222
  $templates = get_option( 'agca_templates' );
1223
  foreach($templates as $templname=>$templdata){
1224
  if($templname == get_option('agca_selected_template')){
1225
+ echo (stripslashes($templdata['common']));
1226
+
1227
+ if($templdata['settings'] == "" || $templdata['settings'] == " ") $templdata['settings'] = "{}";
1228
  $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1229
+
1230
+ $logindata = $this->appendSettingsToAGCATemplateCustomizations(stripslashes($templdata['login']), $templdata['settings']);
1231
  $logindata = $this->enableSpecificWPVersionCustomizations($logindata);
1232
+ $logindata = $this->removeCSSComments($logindata);
1233
+
1234
  echo($logindata);
1235
  break;
1236
  }
1237
  }
1238
  }
1239
  }
1240
+
1241
  function agca_error_check(){
1242
  ?>
1243
+ <script type="text/javascript">
1244
  function AGCAErrorPage(msg, url, line){
1245
  var agca_error_details = "___________________________________________________<br/>";
1246
  agca_error_details += '<br/>' + msg +'<br/>source:' + url + '<br/>line:' + line + '<br/>';
1248
  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>';
1249
  document.getElementsByTagName('html')[0].style.visibility = "visible";
1250
  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;">\
1251
+ 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>';
1252
+
1253
  var ph = document.getElementById('agca_error_placeholder');
1254
+ ph.innerHTML = errorDivHtml;
1255
+ document.getElementById('agca_news').style.visibility = "hidden";
1256
  }
1257
+ window.onerror = function(msg, url, line) {
1258
  window.onload = function() {
1259
  AGCAErrorPage(msg, url, line);
1260
+ }
1261
  return true;
1262
  };
1263
  </script>
1265
  }
1266
  function error_check(){
1267
  ?>
1268
+ <script type="text/javascript">
1269
  function AGCAErrorOtherPages(msg, url, line){
1270
  var agca_error_details = "___________________________________________________\n";
1271
  agca_error_details += '\n' + msg +'\nsource:' + url + '\nline:' + line + '\n';
1272
+
1273
+ document.getElementsByTagName('html')[0].style.visibility = "visible";
1274
+
1275
  if(typeof window.console === "object"){
1276
  console.log("___________________________________________________");
1277
+ console.log("AG Custom Admin caught a JavaScript on your site:");
1278
+ console.log(agca_error_details);
1279
+ }
1280
  }
1281
+ window.onerror = function(msg, url, line) {
1282
  window.onload = function() {
1283
  AGCAErrorOtherPages(msg, url, line);
1284
+ }
1285
  return true;
1286
  };
1287
  </script>
1505
  update_option('ag_edit_adminmenu_json_new',json_encode($customizations));
1506
  }
1507
  function print_admin_css()
1508
+ {
1509
  $agcaTemplateSession = $this->agcaAdminSession();
1510
+ $wpversion = $this->get_wp_version();
1511
  $this->context = "admin";
1512
  $this->error_check();
1513
  $currentScreen = get_current_screen();
1520
  var errors = false;
1521
  var isSettingsImport = false;
1522
  var agca_context = "admin";
1523
+ var roundedSidberSize = 0;
1524
  var agca_installed_templates = <?php echo $this->get_installed_agca_templates(); ?>;
1525
  var agca_admin_menu = <?php echo json_encode($this->get_menu_customizations()) ?>;
1526
  </script>
1527
  <?php
1528
  $this->prepareAGCAAdminTemplates();
1529
  $this->agca_get_includes();
1530
+ $this->admin_capabilities();
1531
  get_currentuserinfo() ;
1532
+ ?>
1533
  <?php
1534
  //in case that javaScript is disabled only admin can access admin menu
1535
  if(!current_user_can($this->admin_capability())){
1539
  </style>
1540
  <?php
1541
  }
1542
+ ?>
1543
  <script type="text/javascript">
1544
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1545
  <?php
1546
  if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='true'){
1547
  echo 'isSettingsImport = true;';
1548
  }
1549
+ ?>
1550
  </script>
1551
+ <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1552
  <style type="text/css">
1553
  .wp-has-current-submenu:after{border:none !important;}
1554
  #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none !important;}
1555
+ </style>
1556
  <?php }
1557
 
1558
  if($currentScreen->id == 'tools_page_ag-custom-admin/plugin'){
1572
  /* <![CDATA[ */
1573
  jQuery(document).ready(function() {
1574
  try
1575
+ {
1576
+
1577
  <?php /*CHECK OTHER PLUGINS*/
1578
+ $this->check_active_plugin();
1579
+
1580
  if($this->active_plugin["ozh"]){
1581
+ ?>
1582
+ jQuery('ul#adminmenu').css('display','none');
1583
+ jQuery('#footer-ozh-oam').css('display','none');
1584
  jQuery('#ag_main_menu li').each(function(){
1585
  if(jQuery(this).text() == "Admin Menu"){
1586
  jQuery(this).hide();
1587
  }
1588
+ });
1589
  <?php
1590
  }
1591
  ?>
1592
+
1593
 
1594
  //get saved onfigurations
1595
 
1596
  <?php $buttons = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttons'); ?>
1597
+ var buttons = '<?php echo $buttons; ?>';
1598
+
1599
  <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
1600
  var buttonsJq = '<?php echo $buttonsJq; ?>';
1601
 
1603
  //createEditMenuPageV32(checkboxes, textboxes);
1604
 
1605
  <?php
1606
+ //if admin, and option to hide settings for admin is set
1607
+
1608
  if((get_option('agca_role_allbutadmin')==true) and current_user_can($this->admin_capability())){
1609
+ ?>
1610
  <?php } else{ ?>
1611
  <?php if(get_option('agca_admin_menu_brand')!=""){ ?>
1612
+ additionalStyles = ' style="margin-bottom:-4px" ';
1613
+ jQuery("#adminmenu").before('<div '+additionalStyles+' id="sidebar_adminmenu_logo"><img width="160" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1614
+ <?php } ?>
1615
+ <?php if(get_option('agca_admin_menu_brand_link')!=""){ ?>
1616
+
1617
+ var href = "<?php echo get_option('agca_admin_menu_brand_link'); ?>";
1618
  href = href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1619
 
1620
+ jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1621
+ jQuery("#sidebar_adminmenu_logo").attr('title',href);
1622
+
1623
  <?php }else{ ?>
1624
  href = "<?php echo get_bloginfo('wpurl'); ?>";
1625
+ jQuery("#sidebar_adminmenu_logo").attr('onclick','window.open(\"'+ href+ '\");');
1626
  jQuery("#sidebar_adminmenu_logo").attr('title',href);
1627
  <?php } ?>
1628
+
1629
  <?php if(get_option('agca_admin_menu_submenu_round')==true){ ?>
1630
  jQuery("#adminmenu .wp-submenu").css("border-radius","<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1631
  jQuery("#adminmenu .wp-menu-open .wp-submenu").css('border-radius','');
1632
  <?php $roundedSidebarSize = get_option('agca_admin_menu_submenu_round_size'); ?>
1633
  roundedSidberSize = <?php echo ($roundedSidebarSize == "")?"0":$roundedSidebarSize; ?>;
1634
+
1635
+
1636
  <?php } ?>
1637
+ <?php if(get_option('agca_admin_menu_autofold')=="force"){ ?>
1638
+ jQuery("body").addClass("auto-fold");
1639
  <?php } else if(get_option('agca_admin_menu_autofold')=="disable"){ ?>
1640
+ jQuery("body").removeClass("auto-fold");
1641
  <?php } ?>
1642
+
1643
+ <?php $this->print_admin_bar_scripts(); ?>
1644
+
1645
  <?php if(get_option('agca_screen_options_menu')==true){ ?>
1646
  jQuery("#screen-options-link-wrap").css("display","none");
1647
+ <?php } ?>
1648
  <?php if(get_option('agca_help_menu')==true){ ?>
1649
  jQuery("#contextual-help-link-wrap").css("display","none");
1650
+ jQuery("#contextual-help-link").css("display","none");
1651
+ <?php } ?>
1652
  <?php if(get_option('agca_privacy_options')==true){ ?>
1653
  jQuery("#privacy-on-link").css("display","none");
1654
+ <?php } ?>
1655
+
1656
+ <?php if(get_option('agca_update_bar')==true){ ?>
1657
  <?php
1658
  if ( ! function_exists( 'c2c_no_update_nag' ) ) :
1659
  function c2c_no_update_nag() {
1665
  jQuery("#update-nag").css("display","none");
1666
  jQuery(".update-nag").css("display","none");
1667
  <?php } ?>
1668
+
1669
  <?php if(get_option('agca_footer')==true){ ?>
1670
  jQuery("#footer,#wpfooter").css("display","none");
1671
+ <?php } ?>
1672
+
1673
+ <?php if(get_option('agca_footer_left')!=""){ ?>
1674
  jQuery("#footer-left").html('<?php echo addslashes(get_option('agca_footer_left')); ?>');
1675
+ <?php } ?>
1676
+ <?php if(get_option('agca_footer_left_hide')==true){ ?>
1677
  jQuery("#footer-left").css("display","none");
1678
  <?php } ?>
1679
  <?php if(get_option('agca_footer_right')!=""){ ?>
1680
  jQuery("#footer-upgrade").html('<?php echo addslashes(get_option('agca_footer_right')); ?>');
1681
  <?php } ?>
1682
+ <?php if(get_option('agca_footer_right_hide')==true){ ?>
1683
  jQuery("#footer-upgrade").css("display","none");
1684
  <?php } ?>
1685
+
1686
  <?php if(get_option('agca_language_bar')==true){ ?>
1687
  jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
1688
+ <?php } ?>
1689
  <?php if(get_option('agca_dashboard_icon')==true){ ?>
1690
  var className = jQuery("#icon-index").attr("class");
1691
  if(className=='icon32'){
1692
  jQuery("#icon-index").attr("id","icon-index-removed");
1693
  }
1694
  <?php } ?>
1695
+ <?php if(get_option('agca_dashboard_text')!=""){ ?>
1696
  jQuery("#dashboard-widgets-wrap").parent().find("h1").html("<?php echo addslashes(get_option('agca_dashboard_text')); ?>");
1697
  <?php } ?>
1698
+ <?php if(get_option('agca_dashboard_text_paragraph')!=""){
1699
  require_once(ABSPATH . 'wp-includes/formatting.php');
1700
+ ?>
1701
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
1702
+
1703
  jQuery("#agca_custom_dashboard_content").html('<br /><?php echo preg_replace('/(\r\n|\r|\n)/', '\n', addslashes(wpautop(get_option('agca_dashboard_text_paragraph')))); ?>');
1704
  <?php } ?>
1705
+
1706
  <?php /*Remove Dashboard widgets*/ ?>
1707
+ <?php
1708
 
1709
  if(get_option('agca_dashboard_widget_welcome')==true){
1710
  ?>jQuery("#welcome-panel").css("display","none");<?php
1711
  }else{
1712
  ?>jQuery("#welcome-panel").css("display","block");<?php
1713
+ }
1714
  if(get_option('agca_dashboard_widget_il')==true){
1715
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1716
  }else{
1745
  $this->remove_dashboard_widget('dashboard_secondary','side');
1746
  }else{
1747
  ?>jQuery("#dashboard_secondary").css("display","block");<?php
1748
+ }
1749
  if(get_option('agca_dashboard_widget_activity')==true){
1750
  remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
1751
  }else{
1752
  ?>jQuery("#dashboard_activity").css("display","block");<?php
1753
+ }
1754
+
1755
+ ?>
1756
+
1757
+ <?php /*ADMIN MENU*/ ?>
1758
+
1759
+ <?php if(get_option('agca_admin_menu_separators')==true){ ?>
1760
  jQuery("#adminmenu li.wp-menu-separator").css({height: 0, margin: 0});
1761
+ <?php } ?>
1762
+ <?php if(get_option('agca_admin_menu_icons') == true){ ?>
1763
  jQuery(".wp-menu-image").each(function(){
1764
  jQuery(this).css("display","none");
1765
  });
1766
  jQuery('#adminmenu div.wp-menu-name').css('padding','8px');
1767
  <?php } ?>
1768
+ <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1769
+ jQuery("#adminmenu .wp-menu-arrow").css("visibility","hidden");
1770
+
1771
  <?php } ?>
1772
  <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
1773
+
1774
+ <?php /*If Turned on*/ ?>
1775
+
1776
+ <?php if(get_option('agca_admin_menu_agca_button_only') == true){ ?>
1777
  jQuery('#adminmenu > li').each(function(){
1778
  if(!jQuery(this).hasClass('agca_button_only')){
1779
  jQuery(this).addClass('noclass');
1780
  }
1781
  });
1782
  <?php /*Only admin see button*/
1783
+ if (current_user_can($this->admin_capability())){ ?>
1784
  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')); ?>');
1785
  <?php } ?>
1786
+ <?php } ?>
1787
+
1788
+
1789
  <?php /*EDIT MENU ITEMS*/?>
1790
  <?php if(get_option('ag_edit_adminmenu_json')!=""){
1791
 
1803
  } ?>
1804
 
1805
 
1806
+
1807
+
1808
+ /*Add user buttons*/
1809
+ jQuery('#adminmenu').append(buttons);
1810
+
1811
  <?php /*END If Turned on*/ ?>
1812
  <?php } else{ ?>
1813
  jQuery("#adminmenu").removeClass("noclass");
1814
+ <?php } ?>
1815
+
1816
  reloadRemoveButtonEvents();
1817
 
1818
  <?php if(get_option('agca_admin_menu_collapse_button') == true){ ?>
1819
  //remove collapse menu button
1820
  jQuery('#collapse-menu').remove();
1821
+ <?php } ?>
1822
+
1823
  <?php //COLORIZER ?>
1824
  updateAllColors();
1825
+ <?php //COLORIZER END ?>
1826
+ <?php } //end of apply for any user except admin ?>
1827
+ /*Add user buttons*/
1828
+ jQuery('#ag_add_adminmenu').append(buttonsJq);
1829
 
1830
+
1831
+ }catch(err){
1832
  errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
1833
+ console.log(errors);
1834
  }finally{
1835
+ jQuery('html').css('visibility','visible');
1836
+ }
1837
  <?php
1838
  if($this->saveAfterImport == true){
1839
  ?>savePluginSettings();<?php
1840
  }
1841
  ?>
1842
+
1843
  });
1844
+
1845
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){
1846
  $this->updateAllColors();
1847
  }else{
1848
  ?>function updateAllColors(){}; <?php
1849
  } ?>
1850
 
1851
+
1852
+ /* ]]> */
1853
  </script>
1854
  <style type="text/css">
1855
  .underline_text{
1857
  }
1858
  .form-table th{
1859
  width:300px;
1860
+ }
1861
+
1862
+ #dashboard-widgets div.empty-container{
1863
  border:none;
1864
  }
1865
  </style>
1866
+ <?php
1867
  }
1868
+
1869
  function print_login_head(){
1870
+ $this->context = "login";
1871
  $this->error_check();
1872
  $wpversion = $this->get_wp_version();
1873
+
1874
  ?>
1875
+ <script type="text/javascript">
1876
+ document.write('<style type="text/css">html{visibility:hidden;}</style>');
1877
  var agca_version = "<?php echo $this->agca_version; ?>";
1878
  <?php //var wpversion = "echo $wpversion; ?>
1879
  var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1880
  var isSettingsImport = false;
1881
+ var agca_context = "login";
1882
  </script>
1883
  <?php
1884
  $this->prepareAGCALoginTemplates();
1885
+ $this->agca_get_includes();
1886
+
1887
+ ?>
1888
+
1889
  <script type="text/javascript">
1890
+
1891
+
1892
  /* <![CDATA[ */
1893
+ jQuery(document).ready(function() {
1894
+ try{
1895
  <?php if(get_option('agca_login_round_box')==true){ ?>
1896
  jQuery("form#loginform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1897
  jQuery("#login h1 a").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1898
+ jQuery("#login h1 a").css("margin-bottom",'10px');
1899
  jQuery("#login h1 a").css("padding-bottom",'0');
1900
  jQuery("form#lostpasswordform").css("border-radius","<?php echo get_option('agca_login_round_box_size'); ?>px");
1901
  <?php } ?>
1902
  <?php if(get_option('agca_login_banner')==true){ ?>
1903
  jQuery("#backtoblog").css("display","none");
1904
+ <?php } ?>
1905
  <?php if(get_option('agca_login_banner_text')==true){ ?>
1906
  jQuery("#backtoblog a").html('<?php echo "← " . addslashes(get_option('agca_login_banner_text')); ?>');
1907
  <?php } ?>
1908
  <?php if(get_option('agca_login_photo_url')==true && get_option('agca_login_photo_remove')!=true){ ?>
1909
  advanced_url = "<?php echo get_option('agca_login_photo_url'); ?>";
1910
  var $url = "url(" + advanced_url + ")";
1911
+ jQuery("#login h1 a").css("background",$url+' no-repeat');
1912
  jQuery("#login h1 a").hide();
1913
+ image = jQuery("<img />").attr("src",advanced_url);
1914
  jQuery(image).load(function() {
1915
  var originalWidth = 326;
1916
+ var widthDiff = this.width - originalWidth;
1917
  jQuery("#login h1 a").height(this.height);
1918
+ jQuery("#login h1 a").width(this.width);
1919
+ jQuery("#login h1 a").css("background-size",this.width+"px "+this.height+"px");
1920
+
1921
  var loginWidth = jQuery('#login').width();
1922
  var originalLoginWidth = 320;
1923
  var photoWidth = this.width;
1924
+
1925
+ if(loginWidth > photoWidth){
1926
  jQuery("#login h1 a").css('margin','auto');
1927
+ }else{
1928
+ jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+((loginWidth-originalLoginWidth)/2)+"px");
1929
+ }
1930
+
1931
  jQuery("#login h1 a").show();
1932
+ });
1933
  <?php } ?>
1934
+ <?php if(get_option('agca_login_photo_href')==true){ ?>
1935
+ var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
1936
+ $href = $href.replace("%BLOG%", "<?php echo get_bloginfo('wpurl'); ?>");
1937
+
1938
+ jQuery("#login h1 a").attr("href",$href);
1939
  <?php } ?>
1940
  <?php if(get_option('agca_login_photo_remove')==true){ ?>
1941
  jQuery("#login h1 a").css("display","none");
1942
+ <?php } ?>
1943
+
1944
+ jQuery("#login h1 a").attr("title","");
1945
+
1946
  <?php if(get_option('agca_login_register_remove')==true){ ?>
1947
  if(jQuery('p#nav').size() > 0){
1948
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1949
+ }
1950
  jQuery('p#nav a').each(function(){
1951
  if(jQuery(this).attr('href').indexOf('register') != -1){
1952
  jQuery(this).remove();
1953
  }
1954
+ });
1955
+
1956
+ <?php } ?>
1957
+ <?php if(get_option('agca_login_register_href')!=""){ ?>
1958
  jQuery('p#nav a').each(function(){
1959
  if(jQuery(this).attr('href').indexOf('register') != -1){
1960
  jQuery(this).attr('href','<?php echo get_option('agca_login_register_href'); ?>');
1961
  }
1962
+ });
1963
+
1964
+ <?php } ?>
1965
+
1966
  <?php if(get_option('agca_login_lostpassword_remove')==true){ ?>
1967
  if(jQuery('p#nav').size() > 0){
1968
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1969
+ }
1970
  jQuery('p#nav a').each(function(){
1971
  if(jQuery(this).attr('href').indexOf('lostpassword') != -1){
1972
  jQuery(this).remove();
1973
  }
1974
+ });
1975
+
1976
+ <?php } ?>
1977
+
1978
 
 
1979
  <?php //COLORIZER ?>
1980
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1981
+ jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1982
+ jQuery("body.login, html").css("background","<?php echo $this->colorizer['login_color_background'];?>");
1983
+
1984
+
1985
+ <?php
1986
+
1987
+
1988
  } ?>
1989
+ <?php //COLORIZER END ?>
1990
+ }catch(err){
1991
+ console.log("AGCA - LOGIN ERROR: " + err.name + " / " + err.message);
1992
+ }finally{
1993
  jQuery('html').show();
1994
+ jQuery('html').css('visibility','visible');
1995
  }
1996
  });
1997
  /* ]]> */
1998
+
1999
  </script>
2000
+ <?php
2001
  }
2002
 
2003
  function agca_admin_page() {
2004
 
2005
  $wpversion = $this->get_wp_version();
2006
  $this->agca_error_check();
2007
+ ?>
2008
  <?php //includes ?>
2009
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css?ver=<?php echo $wpversion; ?>" />
2010
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2011
+
2012
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css?ver=<?php echo $wpversion; ?>" />
2013
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
2014
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/xd.js?ver=<?php echo $wpversion; ?>"></script>
2015
  <script type="text/javascript">
2016
+ var templates_ep = "<?php echo $this->templates_ep; ?>";
2017
+ var template_selected = '<?php echo get_option('agca_selected_template'); ?>';
2018
  </script>
2019
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_tmpl.js?ver=<?php echo $wpversion; ?>"></script>
2020
  <?php //includes ?>
2021
  <div class="wrap">
2022
  <h1 id="agca-title">AG Custom Admin Settings <span style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
2024
  <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>
2025
  </div>
2026
  <div id="agca_error_placeholder"></div>
2027
+ <div id="agca_news">&nbsp;</div><br />
2028
  <form method="post" id="agca_form" action="options.php">
2029
+ <?php wp_nonce_field('agca_form','_agca_token'); ?>
2030
  <?php settings_fields( 'agca-options-group' ); ?>
2031
  <div id="agca-your-feedback">
2032
  <strong>
2047
  <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard Page</a></li>
2048
  <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a></li>
2049
  <li class="normal" ><a href="#admin-menu-settings" title="Settings for main admin menu">Admin Menu</a></li>
2050
+ <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a></li>
2051
  <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
2052
  <li class="normal" style=""><a style="color:#DB6014;font-weight:bolder;" href="#ag-templates" title="AG Custom Admin Themes">Admin Themes</a></li>
2053
+
2054
  <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>
2055
+ </li>
2056
+ <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
2057
  </ul>
2058
  <div id="agca_advertising">
2059
+ <ul>
2060
  <li style="min-height:105px;display: block"></li>
2061
  </ul>
2062
  </div>
2356
 
2357
  </table>
2358
  </div>
2359
+
2360
+ <div id="section_admin_footer" style="display:none" class="ag_section">
2361
  <h2 class="section_title">Admin Footer Settings</h2>
2362
  <table class="form-table" width="500px">
2363
  <?php
2421
  <th scope="row">
2422
  <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>
2423
  </th>
2424
+ <td class="agca_editor">
2425
+ <?php $this->getTextEditor('agca_dashboard_text_paragraph'); ?>
2426
  </td>
2427
  </tr>
2428
  <?php
2482
  </table>
2483
  </div>
2484
  <div id="section_login_page" style="display:none" class="ag_section">
2485
+ <h2 class="section_title">Login Page Settings</h2>
2486
  <table class="form-table" width="500px">
2487
  <?php
2488
 
2601
  <td colspan="2">
2602
  <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 />
2603
  <p tabindex="0"><em>(click on the top menu item to show its sub-menus)</em></p>
2604
+ <table id="ag_edit_adminmenu">
2605
  <tr style="background-color:#999;">
2606
  <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>
2607
  </td>
2626
  <option value="_self" selected>same tab</option>
2627
  <option value="_blank" >new tab</option>
2628
  </select>
2629
+ <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" />
2630
+ </td><td></td>
2631
  </tr>
2632
  </table>
2633
+ <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')); ?>" />
2634
+ </td>
2635
+ <td>
2636
+ </td>
2637
  </tr>
2638
  <?php
2639
  $this->print_options_h3('Admin Menu Settings');
2754
 
2755
  ?>
2756
  </table>
2757
+ <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json" value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>" />
2758
+ <div id="picker"></div>
2759
  </div>
2760
+ <div id="section_templates" style="display:none" class="ag_section">
2761
+ <h2 class="section_title"><span style="float:left">Admin Themes</span></h2>
2762
  <table class="form-table" width="500px">
2763
+ <tr valign="center">
2764
+ <td>
2765
  <div id="agca_templates"></div>
2766
+ </td>
2767
  </tr>
2768
  <tr>
2769
  <td>
2794
  <td>
2795
  <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>
2796
  </td>
2797
+ </tr>
2798
  <tr valign="center">
2799
  <th scope="row">
2800
  <label title="Add additional custom JavaScript" for="agca_custom_js">Custom JavaScript</label>
2809
  </th>
2810
  <td id="import_file_area">
2811
  <input class="agca_button" type="button" name="agca_export_settings" value="Export Settings" onclick="exportSettings();"/></br>
2812
+ <input type="file" id="settings_import_file" name="settings_import_file" style="display: none"/>
2813
+ <input type="hidden" id="_agca_import_settings" name="_agca_import_settings" value="false" />
2814
+ <input type="hidden" id="_agca_export_settings" name="_agca_export_settings" value="false" />
2815
  <input class="agca_button" type="button" name="agca_import_settings" value="Import Settings" onclick="importSettings();"/>
2816
+ </td>
2817
  </tr>
2818
  </table>
2819
  </div>
2820
  <p class="submit">
2821
  <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()" />
2822
  </p>
2823
+
2824
  </form>
2825
  <form id="agca_templates_form" name="agca_templates_form" action="<?php echo $_SERVER['PHP_SELF'];?>?page=ag-custom-admin/plugin.php" method="post">
2826
+ <?php wp_nonce_field('agca_form','_agca_token'); ?>
2827
  <input type="hidden" name="_agca_save_template" value="true" />
2828
+ <input type="hidden" id="templates_data" name="templates_data" value="" />
2829
+ <input type="hidden" id="templates_name" name="templates_name" value="" />
2830
+ </form>
2831
  </div>
2832
  <?php
2833
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpressadminpanel.com/ag-custom-admin/
4
  Tags: admin, customize, hide, change admin, themes, admin themes, admin bar, login page
5
  Requires at least: 3.0
6
  Tested up to: 4.4.2
7
- Stable tag: 1.5.4.2
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl.txt
10
 
@@ -155,6 +155,9 @@ If you have the latest WordPress and plugin versions and you still experience so
155
 
156
  == Change Log ==
157
 
 
 
 
158
  = 1.5.4.2 =
159
  * Fixed new post blank page issue
160
 
@@ -470,6 +473,9 @@ If you have the latest WordPress and plugin versions and you still experience so
470
 
471
  == Upgrade Notice ==
472
 
 
 
 
473
  = 1.5.4.2 =
474
  * Fixed new post blank page issue.
475
 
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.4.3
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl.txt
10
 
155
 
156
  == Change Log ==
157
 
158
+ = 1.5.4.3 =
159
+ * Patched security issues.
160
+
161
  = 1.5.4.2 =
162
  * Fixed new post blank page issue
163
 
473
 
474
  == Upgrade Notice ==
475
 
476
+ = 1.5.4.3 =
477
+ * Patched security issues.
478
+
479
  = 1.5.4.2 =
480
  * Fixed new post blank page issue.
481
 
script/agca_tmpl.js CHANGED
@@ -415,13 +415,12 @@ function agca_saveTemplateSettingsFromForm(template){
415
  function agca_saveTemplateSettingsCore(template, settings, callback){
416
  agcaDebug('FN:agca_saveTemplateSettingsCore()');
417
  var url = window.location;
418
- jQuery.post(url,{"_agca_template_settings": JSON.stringify(settings),"_agca_current_template":template},
419
- callback
420
- )
421
- .fail(
422
- function(){
423
- console.log('AGCA Error: agca_saveTemplateSettingsCore()');
424
- });
425
  }
426
 
427
  /*function agca_saveTemplateSettingsCore(template, settings){
@@ -454,20 +453,20 @@ function agca_activateTemplate(template){
454
 
455
  //ajax submit form
456
  var frm = jQuery('#agca_form');
 
457
  jQuery.ajax({
458
  type: frm.attr('method'),
459
  url: frm.attr('action'),
460
- data: frm.serialize(),
461
  success: function (data) {
462
- var url = window.location;
463
- jQuery.post(url,{"_agca_activate_template":template},
464
- function(data){
465
- window.location = 'tools.php?page=ag-custom-admin/plugin.php';
466
- })
467
- .fail(
468
- function(){
469
- console.log('AGCA Error: agca_activateTemplate()');
470
- });
471
  }
472
  });
473
  }
@@ -516,22 +515,21 @@ function agca_updateInstallProgress(){
516
  }
517
  function agca_removeTemplateImages(template_name, callBack){
518
  agcaDebug('FN:agca_removeTemplateImages()');
519
- var url = window.location;
520
- jQuery.post(url,{"_agca_remove_template_images":template_name},
521
  function(data){
522
  console.log(data);
523
  if(callBack != null){
524
  callBack();
525
  }
526
- })
527
- .fail(
528
- function(e){
529
  console.log('AGCA Error: agca_removeTemplateImages()');
530
  console.log(e);
531
  if(callBack != null){
532
- callBack();
533
  }
534
- });
535
  }
536
  function agca_startUploadingRemoteImages(){
537
  agcaDebug('FN:agca_startUploadingRemoteImages()');
@@ -568,15 +566,14 @@ function agca_uploadRemoteImages(){
568
  function agca_uploadRemoteImage(remoteUrl, tag){
569
  agcaDebug('FN:agca_uploadRemoteImage('+remoteUrl+', '+tag+')');
570
  var url = window.location;
571
- jQuery.post(url,{"_agca_upload_image":remoteUrl},
572
  function(data){
573
- console.log(data);
574
- agca_local_images[tag] = data;
575
- delete agca_remote_images[tag];
576
- agca_uploadRemoteImages();
577
  //window.location = 'tools.php?page=ag-custom-admin/plugin.php';
578
- })
579
- .fail(
580
  function(){
581
  console.log('AGCA Error: agca_activateTemplate()');
582
  });
@@ -585,15 +582,16 @@ function agca_uploadRemoteImage(remoteUrl, tag){
585
  function agca_getLocalTemplates(){
586
  agcaDebug("FN:agca_getLocalTemplates()");
587
  var url = window.location;
588
- jQuery.post(url,{"_agca_get_templates":true},
589
- function(data){
590
- //console.log(data);
591
- templates_installed = JSON.parse(data);
 
 
 
592
  //agca_getTemplates();
593
  agca_getConfiguration();
594
-
595
- })
596
- .fail(
597
  function(){
598
  console.log('AGCA Error: agca_getLocalTemplates()');
599
  });
@@ -668,16 +666,11 @@ function agcaTemplatesSessionAdd(template, license, callback){
668
  }
669
  agcaTemplatesSession[template] = {};
670
  agcaTemplatesSession[template]["license"] = license;
671
- jQuery.ajax({
672
- type: "POST",
673
- url: window.location,
674
- data: {
675
  "_agca_templates_session" : "true",
676
  "template":template,
677
  "license":license
678
- },
679
- success: callback
680
- });
681
  }
682
 
683
  function agcaTemplatesSessionRemove(template, callback){
@@ -686,15 +679,27 @@ function agcaTemplatesSessionRemove(template, callback){
686
  callback = function(){};
687
  }
688
  agcaTemplatesSession[template]["license"] = null;
689
- jQuery.ajax({
690
- type: "POST",
691
- url: window.location,
692
- data: {
693
  "_agca_templates_session_remove_license" : "true",
694
- "template":template
695
- },
696
- success: callback
697
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
  }
699
 
700
 
@@ -735,4 +740,4 @@ var diff = expire - now;
735
  timer = setInterval(function(){
736
  showRemaining(diff);
737
  }, 1000);
738
- }
415
  function agca_saveTemplateSettingsCore(template, settings, callback){
416
  agcaDebug('FN:agca_saveTemplateSettingsCore()');
417
  var url = window.location;
418
+ agca_POST(url,{"_agca_template_settings": JSON.stringify(settings),"_agca_current_template":template},
419
+ callback,
420
+ function(){
421
+ console.log('AGCA Error: agca_saveTemplateSettingsCore()');
422
+ }
423
+ );
 
424
  }
425
 
426
  /*function agca_saveTemplateSettingsCore(template, settings){
453
 
454
  //ajax submit form
455
  var frm = jQuery('#agca_form');
456
+ var data = frm.serialize();
457
  jQuery.ajax({
458
  type: frm.attr('method'),
459
  url: frm.attr('action'),
460
+ data: data,
461
  success: function (data) {
462
+ var url = window.location;
463
+ agca_POST(url, {"_agca_activate_template":template},
464
+ function(data){
465
+ window.location = 'tools.php?page=ag-custom-admin/plugin.php';
466
+ },
467
+ function(){
468
+ console.log('AGCA Error: agca_activateTemplate()');
469
+ });
 
470
  }
471
  });
472
  }
515
  }
516
  function agca_removeTemplateImages(template_name, callBack){
517
  agcaDebug('FN:agca_removeTemplateImages()');
518
+ var url = window.location;
519
+ agca_POST(url,{"_agca_remove_template_images":template_name},
520
  function(data){
521
  console.log(data);
522
  if(callBack != null){
523
  callBack();
524
  }
525
+ },
526
+ function(e){
 
527
  console.log('AGCA Error: agca_removeTemplateImages()');
528
  console.log(e);
529
  if(callBack != null){
530
+ callBack();
531
  }
532
+ });
533
  }
534
  function agca_startUploadingRemoteImages(){
535
  agcaDebug('FN:agca_startUploadingRemoteImages()');
566
  function agca_uploadRemoteImage(remoteUrl, tag){
567
  agcaDebug('FN:agca_uploadRemoteImage('+remoteUrl+', '+tag+')');
568
  var url = window.location;
569
+ agca_POST(url,{"_agca_upload_image":remoteUrl},
570
  function(data){
571
+ console.log(data);
572
+ agca_local_images[tag] = data;
573
+ delete agca_remote_images[tag];
574
+ agca_uploadRemoteImages();
575
  //window.location = 'tools.php?page=ag-custom-admin/plugin.php';
576
+ },
 
577
  function(){
578
  console.log('AGCA Error: agca_activateTemplate()');
579
  });
582
  function agca_getLocalTemplates(){
583
  agcaDebug("FN:agca_getLocalTemplates()");
584
  var url = window.location;
585
+ agca_POST(url,{"_agca_get_templates":true},
586
+ function(data){
587
+ try{
588
+ templates_installed = JSON.parse(data);
589
+ }catch(e){
590
+ templates_installed = [];
591
+ };
592
  //agca_getTemplates();
593
  agca_getConfiguration();
594
+ },
 
 
595
  function(){
596
  console.log('AGCA Error: agca_getLocalTemplates()');
597
  });
666
  }
667
  agcaTemplatesSession[template] = {};
668
  agcaTemplatesSession[template]["license"] = license;
669
+ agca_POST(window.location, {
 
 
 
670
  "_agca_templates_session" : "true",
671
  "template":template,
672
  "license":license
673
+ }, callback);
 
 
674
  }
675
 
676
  function agcaTemplatesSessionRemove(template, callback){
679
  callback = function(){};
680
  }
681
  agcaTemplatesSession[template]["license"] = null;
682
+ agca_POST(window.location,{
 
 
 
683
  "_agca_templates_session_remove_license" : "true",
684
+ "template":template
685
+ }, callback);
686
+ }
687
+
688
+ function agca_POST(url, data, onSuccess, onError){
689
+ data['_agca_token'] = jQuery('[name=_agca_token]').val();
690
+ data['_wp_http_referer'] = jQuery('[name=_wp_http_referer]').val();
691
+ jQuery.post(url, data,
692
+ function(data){
693
+ if(onSuccess){
694
+ onSuccess(data);
695
+ }
696
+ })
697
+ .fail(
698
+ function(a,b,c){
699
+ if(onError){
700
+ onError(a,b,c);
701
+ }
702
+ });
703
  }
704
 
705
 
740
  timer = setInterval(function(){
741
  showRemaining(diff);
742
  }, 1000);
743
+ }