Absolutely Glamorous Custom Admin - Version 1.3.1

Version Description

  • First production version with AGCA Themes
Download this release

Release Info

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

Code changes from version 1.2.8 to 1.3.1

Files changed (7) hide show
  1. plugin.php +459 -137
  2. readme.txt +19 -5
  3. script/ag_script.js +72 -45
  4. script/agca_tmpl.js +739 -0
  5. script/xd.js +1 -0
  6. style/ag_style.css +79 -1
  7. uninstall.php +11 -9
plugin.php CHANGED
@@ -4,10 +4,10 @@ Plugin Name: AG Custom Admin
4
  Plugin URI: http://agca.argonius.com/ag-custom-admin/category/ag_custom_admin
5
  Description: Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
6
  Author: Argonius
7
- Version: 1.2.8
8
  Author URI: http://www.argonius.com/
9
 
10
- Copyright 2013. Argonius (email : info@argonius.com)
11
 
12
  This program is free software: you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
@@ -29,12 +29,17 @@ class AGCA{
29
  private $colorizer="";
30
  private $active_plugin;
31
  private $agca_version;
 
32
  private $admin_capabilities;
33
- private $context = "";
34
- private $saveAfterImport = false;
 
 
35
  public function __construct()
36
- {
37
- $this->reloadScript();
 
 
38
 
39
  add_filter('admin_title', array(&$this,'change_title'), 10, 2);
40
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
@@ -48,7 +53,22 @@ class AGCA{
48
  /*Initialize properties*/
49
  $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'),'colorizer');
50
  //fb($this->colorizer);
51
- $this->agca_version = "1.2.8";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
  // Add donate and support information
54
  function jk_filter_plugin_links($links, $file)
@@ -61,6 +81,156 @@ class AGCA{
61
  }
62
  return $links;
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  function isGuest(){
65
  global $user_login;
66
  if($user_login) {
@@ -103,12 +273,12 @@ class AGCA{
103
  ?>
104
  </script>
105
  <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; ?>" />
106
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
107
- <?php if($this->context == "admin"){ ?>
108
  <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
109
- <?php } ?>
110
-
111
- <?php
112
  if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
113
  ?>
114
  <style type="text/css">
@@ -122,9 +292,7 @@ class AGCA{
122
  ?>
123
  </script>
124
  <?php
125
- }
126
- ?>
127
- <?php
128
  }
129
 
130
  function agca_enqueue_scripts() {
@@ -182,7 +350,7 @@ class AGCA{
182
  register_setting( 'agca-options-group', 'agca_dashboard_text' );
183
  register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
184
  register_setting( 'agca-options-group', 'agca_dashboard_widget_welcome' );
185
- register_setting( 'agca-options-group', 'agca_dashboard_widget_rc' );
186
  register_setting( 'agca-options-group', 'agca_dashboard_widget_il' );
187
  register_setting( 'agca-options-group', 'agca_dashboard_widget_plugins' );
188
  register_setting( 'agca-options-group', 'agca_dashboard_widget_qp' );
@@ -207,8 +375,10 @@ class AGCA{
207
  register_setting( 'agca-options-group', 'agca_login_register_href' );
208
  register_setting( 'agca-options-group', 'agca_login_lostpassword_remove' );
209
  register_setting( 'agca-options-group', 'agca_admin_capability' );
210
- register_setting( 'agca-options-group', 'agca_disablewarning' );
211
-
 
 
212
 
213
 
214
  /*Admin menu*/
@@ -313,7 +483,8 @@ class AGCA{
313
  'agca_dashboard_text',
314
  'agca_dashboard_text_paragraph',
315
  'agca_dashboard_widget_welcome',
316
- 'agca_dashboard_widget_rc',
 
317
  'agca_dashboard_widget_il',
318
  'agca_dashboard_widget_plugins',
319
  'agca_dashboard_widget_qp',
@@ -350,6 +521,8 @@ class AGCA{
350
  'agca_custom_css',
351
  'agca_colorizer_turnonoff',
352
  'agca_disablewarning',
 
 
353
  );
354
  }
355
 
@@ -528,10 +701,10 @@ class AGCA{
528
  }
529
  }
530
  }else{
531
- //$elements = json_decode($arr[$type],true);
532
  if(isset($arr[$type])){
533
  $elements = $this->agca_decode($arr[$type]);
534
- }
535
  if($elements !=""){
536
  foreach($elements as $element){
537
  if(!$first){
@@ -540,7 +713,7 @@ class AGCA{
540
  $parts = explode(" : ",$element);
541
  if(isset($parts[0]) && isset($parts[1])){
542
  $array.="[".$parts[0].", ".$parts[1]."]";
543
- }
544
  $first=false;
545
  }
546
  }
@@ -600,14 +773,12 @@ class AGCA{
600
  <style type="text/css">
601
  #wpadminbar{
602
  display: none;
603
- }
604
  </style>
605
- <?php if(get_option('agca_header')==true){ ?>
606
- <script type="text/javascript">
607
  window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
608
  </script>
609
-
610
- <?php }
611
  }
612
  if(get_option('agca_admin_bar_frontend')!=true){
613
 
@@ -619,6 +790,7 @@ class AGCA{
619
  <script type="text/javascript">
620
  var wpversion = "<?php echo $wpversion; ?>";
621
  var agca_version = "<?php echo $this->agca_version; ?>";
 
622
  var jQueryScriptOutputted = false;
623
  var agca_context = "page";
624
  function initJQuery() {
@@ -976,14 +1148,160 @@ class AGCA{
976
  }
977
  return $selectedValue;
978
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
 
980
  function print_admin_css()
981
- {
982
- $this->agca_get_includes();
983
- $this->admin_capabilities();
984
  $this->context = "admin";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
985
  get_currentuserinfo() ;
986
- $wpversion = $this->get_wp_version();
987
  ?>
988
  <?php
989
  //in case that javaScript is disabled only admin can access admin menu
@@ -998,31 +1316,23 @@ class AGCA{
998
  <script type="text/javascript">
999
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1000
  <?php $this->finalErrorCheck(); ?>
1001
- var wpversion = "<?php echo $wpversion; ?>";
1002
- var agca_version = "<?php echo $this->agca_version; ?>";
1003
- var errors = false;
1004
- var isSettingsImport = false;
1005
- var agca_context = "admin";
1006
- var roundedSidberSize = 0;
1007
-
1008
  <?php
1009
  if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='true'){
1010
  echo 'isSettingsImport = true;';
1011
  }
1012
  ?>
1013
- </script>
1014
  <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1015
  <style type="text/css">
1016
  .wp-has-current-submenu:after{border:none !important;}
1017
  #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none !important;}
1018
  </style>
1019
  <?php } ?>
1020
- <script type="text/javascript">
1021
  /* <![CDATA[ */
1022
- jQuery(document).ready(function() {
1023
-
1024
  try
1025
- {
1026
 
1027
  <?php /*CHECK OTHER PLUGNS*/
1028
  $this->check_active_plugin();
@@ -1076,7 +1386,7 @@ try
1076
  if(isWPHigherOrEqualThan("3.4")){
1077
  additionalStyles = ' style="margin-bottom:-4px" ';
1078
  }
1079
- jQuery("#adminmenu").before('<div '+additionalStyles+' id="sidebar_adminmenu_logo"><img width="145" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1080
 
1081
  <?php } ?>
1082
  <?php if(get_option('agca_admin_menu_brand_link')!=""){ ?>
@@ -1095,16 +1405,17 @@ try
1095
 
1096
  <?php if(get_option('agca_admin_menu_submenu_round')==true){ ?>
1097
  jQuery("#adminmenu .wp-submenu").css("border-radius","<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1098
- roundedSidberSize = <?php echo get_option('agca_admin_menu_submenu_round_size'); ?>;
 
 
1099
 
1100
 
1101
- <?php } ?>
1102
  <?php if(get_option('agca_admin_menu_autofold')=="force"){ ?>
1103
  jQuery("body").addClass("auto-fold");
1104
  <?php } else if(get_option('agca_admin_menu_autofold')=="disable"){ ?>
1105
  jQuery("body").removeClass("auto-fold");
1106
- <?php } ?>
1107
-
1108
 
1109
  <?php $this->print_admin_bar_scripts(); ?>
1110
 
@@ -1168,7 +1479,7 @@ try
1168
  }
1169
  <?php } ?>
1170
  <?php if(get_option('agca_dashboard_text')!=""){ ?>
1171
- jQuery("#dashboard-widgets-wrap").parent().find("h2").text("<?php echo get_option('agca_dashboard_text'); ?>");
1172
  <?php } ?>
1173
  <?php if(get_option('agca_dashboard_text_paragraph')!=""){ ?>
1174
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
@@ -1179,16 +1490,11 @@ try
1179
  <?php /*Remove Dashboard widgets*/ ?>
1180
  <?php
1181
 
1182
- if(get_option('agca_dashboard_widget_welcome')==true){
1183
  ?>jQuery("#welcome-panel").css("display","none");<?php
1184
  }else{
1185
  ?>jQuery("#welcome-panel").css("display","block");<?php
1186
- }
1187
- if(get_option('agca_dashboard_widget_rc')==true){
1188
- $this->remove_dashboard_widget('dashboard_recent_comments','normal');
1189
- }else{
1190
- ?>jQuery("#dashboard_recent_comments").css("display","block");<?php
1191
- }
1192
  if(get_option('agca_dashboard_widget_il')==true){
1193
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1194
  }else{
@@ -1223,7 +1529,12 @@ try
1223
  $this->remove_dashboard_widget('dashboard_secondary','side');
1224
  }else{
1225
  ?>jQuery("#dashboard_secondary").css("display","block");<?php
1226
- }
 
 
 
 
 
1227
 
1228
  ?>
1229
 
@@ -1242,9 +1553,10 @@ try
1242
  jQuery(".wp-menu-image").each(function(){
1243
  jQuery(this).css("display","none");
1244
  });
 
1245
  <?php } ?>
1246
  <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1247
- jQuery("#adminmenu .wp-menu-arrow").css("visibility","hidden");
1248
 
1249
  <?php } ?>
1250
  <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
@@ -1310,12 +1622,9 @@ try
1310
  var selector = '#' + topmenuitem + ' ul li';
1311
  var hoverPopupSelector = '#' + topmenuitem + ' .wp-submenu.wp-submenu-wrap';
1312
  //console.log(i+" "+checkboxes);
1313
- var allSubmenuItemsHidden = true;
1314
- //console.log(selector);
1315
- while((i<checkboxes.length) && (checkboxes[i][0].indexOf("<-TOP->") < 0)){
1316
-
1317
  jQuery(selector).each(function(){ //loop through all submenus
1318
-
1319
  var currentItemText = "";
1320
 
1321
  <?php if($wpversion >=3.5 ){ ?>
@@ -1326,23 +1635,22 @@ try
1326
  currentItemText = jQuery(this).text();
1327
  <?php } ?>
1328
 
1329
- //console.log("*"+checkboxes[i][0]);
1330
- if(checkboxes[i][0] == currentItemText){
1331
- if((checkboxes[i][1] == "true") || (checkboxes[i][1] == "checked")){
1332
- jQuery(this).addClass('noclass');
 
1333
  }else{
1334
  allSubmenuItemsHidden = false;
1335
  }
1336
- jQuery(this).find('a').text(textboxes[i][1]);
1337
  }
1338
  });
1339
-
1340
  i++;
1341
- }
1342
  if(allSubmenuItemsHidden){
1343
  jQuery(hoverPopupSelector).hide();
1344
- }
1345
- //console.log(allSubmenuItemsHidden);
1346
  };
1347
  }
1348
  }
@@ -1423,18 +1731,27 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1423
  }
1424
 
1425
  function print_login_head(){
1426
- $this->context = "login";
1427
- $this->agca_get_includes();
1428
  $wpversion = $this->get_wp_version();
1429
- ?>
1430
-
1431
- <script type="text/javascript">
1432
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1433
  <?php $this->finalErrorCheck(); ?>
1434
  var agca_version = "<?php echo $this->agca_version; ?>";
1435
- var wpversion = "<?php echo $wpversion; ?>";
1436
- var isSettingsImport = false;
1437
- var agca_context = "login";
 
 
 
 
 
 
 
 
 
 
 
1438
  /* <![CDATA[ */
1439
  jQuery(document).ready(function() {
1440
  try{
@@ -1513,36 +1830,8 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1513
 
1514
  <?php //COLORIZER ?>
1515
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1516
- jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1517
-
1518
- if(isWPHigherOrEqualThan("3.3")){
1519
- jQuery("body.login, html").css("background","<?php echo $this->colorizer['login_color_background'];?>");
1520
- }else{
1521
-
1522
- <?php
1523
- if($this->colorizer['login_color_background']!=""){
1524
- ?>
1525
- updateTargetColor("login_color_background","<?php echo $this->colorizer['login_color_background'];?>");
1526
-
1527
- <?php
1528
- }
1529
- if($this->colorizer['color_header']!=""){
1530
- ?>
1531
- <?php if($wpversion < 3.2){ ?>
1532
- jQuery("#backtoblog").css("background","<?php echo $this->colorizer['color_header'];?>");
1533
-
1534
- <?php } ?>
1535
- <?php
1536
- }
1537
- if($this->colorizer['color_font_header']!=""){
1538
- ?>
1539
- jQuery("#backtoblog a,#backtoblog p").css("color","<?php echo $this->colorizer['color_font_header'];?>");
1540
-
1541
- <?php
1542
- }
1543
-
1544
- ?>
1545
- }
1546
 
1547
 
1548
  <?php
@@ -1570,16 +1859,17 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1570
  $wpversion = $this->get_wp_version();
1571
  ?>
1572
  <?php //includes ?>
1573
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css" />
1574
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js"></script>
1575
 
1576
- <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css" />
1577
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js"></script>
1578
- <script type="text/javascript">
1579
- var isAGCAPage = true;
1580
- </script>
1581
- <?php //cache images ?>
1582
- <img src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/checkbox_over.png" style="display:none;"/>
 
1583
  <?php //includes ?>
1584
  <div class="wrap">
1585
  <h1 style="color:green">AG Custom Admin Settings <span style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
@@ -1604,8 +1894,10 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1604
  <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard Page</a></li>
1605
  <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a></li>
1606
  <li class="normal" ><a href="#admin-menu-settings" title="Settings for main admin menu">Admin Menu</a></li>
1607
- <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a></li>
1608
- <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
 
 
1609
  <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://agca.argonius.com/ag-custom-admin/support-for-future-development"><img alt="Donate" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/btn_donate_LG.gif" /></a>
1610
  </li>
1611
  <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
@@ -1964,14 +2256,14 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1964
  </td>
1965
  <td></td>
1966
  </tr>
1967
- <tr valign="center">
1968
  <th scope="row">
1969
  <label title="This is small 'house' icon next to main heading (Dashboard text by default) on Dashboard page" for="agca_dashboard_icon">Hide Dashboard heading icon</label>
1970
  </th>
1971
  <td>
1972
  <input class="agca-checkbox" title="This is small house icon next to main heading on Dashboard page. Dashboard text is shown by default" type="checkbox" name="agca_dashboard_icon" value="true" <?php if (get_option('agca_dashboard_icon')==true) echo 'checked="checked" '; ?> />
1973
  </td>
1974
- </tr>
1975
 
1976
  <tr valign="center">
1977
  <th scope="row">
@@ -1997,7 +2289,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1997
  <p tabindex="0"><i><strong>Info:</strong> These settings override settings in Screen options on Dashboard page.</i></p>
1998
  </td>
1999
  </tr>
2000
- <tr valign="center">
2001
  <th scope="row">
2002
  <label for="agca_dashboard_widget_welcome">Hide "Welcome" WordPress Message</label>
2003
  </th>
@@ -2005,33 +2297,33 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2005
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_welcome" value="true" <?php if (get_option('agca_dashboard_widget_welcome')==true) echo 'checked="checked" '; ?> />
2006
  </td>
2007
  </tr>
2008
- <tr valign="center">
2009
  <th scope="row">
2010
- <label for="agca_dashboard_widget_rc">Hide "Recent Comments"</label>
2011
  </th>
2012
  <td>
2013
- <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_rc" value="true" <?php if (get_option('agca_dashboard_widget_rc')==true) echo 'checked="checked" '; ?> />
2014
  </td>
2015
- </tr>
2016
- <tr valign="center">
2017
  <th scope="row">
2018
  <label for="agca_dashboard_widget_il">Hide "Incoming Links"</label>
2019
  </th>
2020
  <td>
2021
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_il" value="true" <?php if (get_option('agca_dashboard_widget_il')==true) echo 'checked="checked" '; ?> />
2022
  </td>
2023
- </tr>
2024
- <tr valign="center">
2025
  <th scope="row">
2026
  <label for="agca_dashboard_widget_plugins">Hide "Plugins"</label>
2027
  </th>
2028
  <td>
2029
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_plugins" value="true" <?php if (get_option('agca_dashboard_widget_plugins')==true) echo 'checked="checked" '; ?> />
2030
  </td>
2031
- </tr>
2032
  <tr valign="center">
2033
  <th scope="row">
2034
- <label for="agca_dashboard_widget_qp">Hide "Quick Press"</label>
2035
  </th>
2036
  <td>
2037
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_qp" value="true" <?php if (get_option('agca_dashboard_widget_qp')==true) echo 'checked="checked" '; ?> />
@@ -2039,20 +2331,20 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2039
  </tr>
2040
  <tr valign="center">
2041
  <th scope="row">
2042
- <label for="agca_dashboard_widget_rn">Hide "Right Now"</label>
2043
  </th>
2044
  <td>
2045
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_rn" value="true" <?php if (get_option('agca_dashboard_widget_rn')==true) echo 'checked="checked" '; ?> />
2046
  </td>
2047
  </tr>
2048
- <tr valign="center">
2049
  <th scope="row">
2050
  <label for="agca_dashboard_widget_rd">Hide "Recent Drafts"</label>
2051
  </th>
2052
  <td>
2053
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_rd" value="true" <?php if (get_option('agca_dashboard_widget_rd')==true) echo 'checked="checked" '; ?> />
2054
  </td>
2055
- </tr>
2056
  <tr valign="center">
2057
  <th scope="row">
2058
  <label title="This is 'WordPress Development Blog' widget by default" for="agca_dashboard_widget_primary">Hide primary widget area</label>
@@ -2254,7 +2546,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2254
  </tr>
2255
  <tr valign="center">
2256
  <th scope="row">
2257
- <label title="Rounds submenu pop-up box" for="agca_admin_menu_submenu_round">Round sub-menu pop-up box</label><p><i>(Please use it in combination with Colorizer)</i></p>
2258
  </th>
2259
  <td>
2260
  <input class="agca-checkbox" title="Rounds submenu pop-up box" type="checkbox" name="agca_admin_menu_submenu_round" value="true" <?php if (get_option('agca_admin_menu_submenu_round')==true) echo 'checked="checked" '; ?> />
@@ -2515,6 +2807,29 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2515
  <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json" value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>" />
2516
  <div id="picker"></div>
2517
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2518
  <div id="section_advanced" style="display:none" class="ag_section">
2519
  <h2 class="section_title" tabindex="-1">Advanced</h2>
2520
 
@@ -2579,6 +2894,11 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2579
  </p>
2580
 
2581
  </form>
 
 
 
 
 
2582
  </div>
2583
 
2584
  <br />
@@ -2586,4 +2906,6 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2586
  <?php
2587
  }
2588
  }
 
 
2589
  ?>
4
  Plugin URI: http://agca.argonius.com/ag-custom-admin/category/ag_custom_admin
5
  Description: Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
6
  Author: Argonius
7
+ Version: 1.3.1
8
  Author URI: http://www.argonius.com/
9
 
10
+ Copyright 2014. Argonius (email : info@argonius.com)
11
 
12
  This program is free software: you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
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
  add_filter('admin_title', array(&$this,'change_title'), 10, 2);
45
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
53
  /*Initialize properties*/
54
  $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'),'colorizer');
55
  //fb($this->colorizer);
56
+ $this->agca_version = "1.3.1";
57
+
58
+ /*upload images programmaticaly*/
59
+ //TODO upload with AJAX one by one, use post data to send urls one by one
60
+ /*function my_sideload_image() {
61
+ $file = media_sideload_image( 'http://a2.twimg.com/a/1318451435/phoenix/img/twitter_logo_right.png', 0 );
62
+ $file1 = media_sideload_image( 'http://agca.argonius.com/templates/trunk/images/templates/monday/j1.jpg', 0 );
63
+ $file2 = media_sideload_image( 'http://agca.argonius.com/templates/trunk/images/templates/monday/2.jpg', 0 );
64
+ $url=explode("'",explode("src='",$file)[1])[0];
65
+ $url.=explode("'",explode("src='",$file1)[1])[0];
66
+ $url.=explode("'",explode("src='",$file2)[1])[0];
67
+ echo $url;
68
+
69
+ }
70
+ add_action( 'admin_init', 'my_sideload_image' );*/
71
+ /*upload images programmaticaly*/
72
  }
73
  // Add donate and support information
74
  function jk_filter_plugin_links($links, $file)
81
  }
82
  return $links;
83
  }
84
+
85
+ function checkGET(){
86
+ if(isset($_GET['agca_action'])){
87
+ if($_GET['agca_action'] =="remove_templates"){
88
+ $this->delete_template_images_all();
89
+ update_option('agca_templates', "");
90
+ update_option('agca_selected_template', "");
91
+ }
92
+ }
93
+ }
94
+
95
+ function checkPOST(){
96
+ if(isset($_POST['_agca_save_template'])){
97
+ //print_r($_POST);
98
+ $data = $_POST['templates_data'];
99
+ $parts = explode("|||",$data);
100
+ $common_data = $parts [0];
101
+ $admin_data = $parts [1];
102
+ $login_data = $parts [2];
103
+ $settings = $parts [3];
104
+ $images = $parts [4];
105
+ $template_name = $_POST['templates_name'];
106
+
107
+ update_option('agca_selected_template', $template_name);
108
+
109
+ $templates = get_option( 'agca_templates' );
110
+ if($templates == ""){
111
+ $templates = array();
112
+ }
113
+
114
+ $templates[$template_name] = array(
115
+ 'common'=>$common_data,
116
+ 'admin'=>$admin_data,
117
+ 'login'=>$login_data,
118
+ 'images'=>$images,
119
+ 'settings'=>$settings
120
+ );
121
+ update_option('agca_templates', $templates);
122
+
123
+ $_POST = array();
124
+
125
+ }else if(isset($_POST['_agca_templates_session'])){
126
+ $this->agcaAdminSession();
127
+ if($_POST['template'] !="")
128
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = array("license"=>$_POST['license']);
129
+
130
+ print_r($_SESSION);
131
+ echo "_agca_templates_session:OK";
132
+ exit;
133
+ }else if(isset($_POST['_agca_templates_session_remove_license'])){
134
+ $this->agcaAdminSession();
135
+ if($_POST['template'] !="")
136
+ $_SESSION["AGCA"]["Templates"][$_POST['template']] = null;
137
+ print_r($_SESSION);
138
+ echo "_agca_templates_session_remove_license:OK";
139
+ exit;
140
+ }else if(isset($_POST['_agca_get_templates'])){
141
+ $templates = get_option( 'agca_templates' );
142
+ $results = array();
143
+ foreach($templates as $key=>$val){
144
+ $results[]=$key;
145
+ }
146
+ echo json_encode($results);
147
+ exit;
148
+ }else if(isset($_POST['_agca_activate_template'])){
149
+ update_option('agca_selected_template', $_POST['_agca_activate_template']);
150
+ $_POST = array();
151
+ //unset($_POST);
152
+ exit;
153
+ }else if(isset($_POST['_agca_template_settings'])){
154
+ $settings = $_POST['_agca_template_settings'];
155
+
156
+ $templates = get_option( 'agca_templates' );
157
+ if($templates == ""){
158
+ $templates = array();
159
+ }
160
+ $template_name = $_POST["_agca_current_template"];
161
+
162
+ $templates[$template_name]["settings"] = $settings;
163
+ update_option('agca_templates', $templates);
164
+
165
+ $_POST = array();
166
+ //print_r($templates);
167
+ exit;
168
+ }else if(isset($_POST['_agca_upload_image'])){
169
+
170
+ function my_sideload_image() {
171
+ $remoteurl = $_POST['_agca_upload_image'];
172
+ $file = media_sideload_image( $remoteurl, 0 ,"AG Custom Admin Template Image (do not delete)");
173
+ $url=explode("'",explode("src='",$file)[1])[0];
174
+ echo $url;
175
+ exit;
176
+ }
177
+ add_action( 'admin_init', 'my_sideload_image' );
178
+
179
+ }else if(isset($_POST['_agca_remove_template_images'])){
180
+ $this->delete_template_images($_POST['_agca_remove_template_images']);
181
+ exit;
182
+ }
183
+ }
184
+
185
+ function delete_template_images_all(){
186
+ $templates = get_option('agca_templates');
187
+ if($templates != null && $templates != ""){
188
+ foreach($templates as $template){
189
+ if($template != null && $template['images'] != null && $template['images'] != ""){
190
+ //print_r($template['images']);
191
+ $imgs = explode(',',$template['images']);
192
+ foreach($imgs as $imageSrc){
193
+ $this->delete_attachment_by_src($imageSrc);
194
+ }
195
+ //print_r($imgs);
196
+ }
197
+ }
198
+ }
199
+ //print_r($templates);
200
+ }
201
+
202
+ function delete_template_images($template_name){
203
+ $templates = get_option('agca_templates');
204
+ if($templates != null && $templates != ""){
205
+ $template = $templates[$template_name];
206
+ if($template != null && $template['images'] != null && $template['images'] != ""){
207
+ //print_r($template['images']); exit;
208
+ $imgs = explode(',',$template['images']);
209
+ foreach($imgs as $imageSrc){
210
+ $this->delete_attachment_by_src($imageSrc);
211
+ }
212
+ //print_r($imgs);
213
+ }
214
+ }
215
+ //print_r($templates);
216
+ }
217
+
218
+ function delete_attachment_by_src ($image_src) {
219
+ global $wpdb;
220
+ $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
221
+ $id = $wpdb->get_var($query);
222
+ wp_delete_attachment( $id, $true );
223
+ }
224
+
225
+ function get_installed_agca_templates(){
226
+ $templates = get_option( 'agca_templates' );
227
+ $results = array();
228
+ foreach($templates as $key=>$val){
229
+ $results[]=$key;
230
+ }
231
+ return json_encode($results);
232
+ }
233
+
234
  function isGuest(){
235
  global $user_login;
236
  if($user_login) {
273
  ?>
274
  </script>
275
  <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; ?>" />
276
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
277
+ <?php if($this->context == "admin"){ ?>
278
  <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
279
+ <?php }
280
+ echo $this->templateCustomizations;
281
+
282
  if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
283
  ?>
284
  <style type="text/css">
292
  ?>
293
  </script>
294
  <?php
295
+ }
 
 
296
  }
297
 
298
  function agca_enqueue_scripts() {
350
  register_setting( 'agca-options-group', 'agca_dashboard_text' );
351
  register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
352
  register_setting( 'agca-options-group', 'agca_dashboard_widget_welcome' );
353
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_activity' );
354
  register_setting( 'agca-options-group', 'agca_dashboard_widget_il' );
355
  register_setting( 'agca-options-group', 'agca_dashboard_widget_plugins' );
356
  register_setting( 'agca-options-group', 'agca_dashboard_widget_qp' );
375
  register_setting( 'agca-options-group', 'agca_login_register_href' );
376
  register_setting( 'agca-options-group', 'agca_login_lostpassword_remove' );
377
  register_setting( 'agca-options-group', 'agca_admin_capability' );
378
+ register_setting( 'agca-options-group', 'agca_disablewarning' );
379
+ register_setting( 'agca-template-group', 'agca_selected_template' );
380
+ register_setting( 'agca-template-group', 'agca_templates' );
381
+ //delete_option( 'agca_templates' );
382
 
383
 
384
  /*Admin menu*/
483
  'agca_dashboard_text',
484
  'agca_dashboard_text_paragraph',
485
  'agca_dashboard_widget_welcome',
486
+ 'agca_dashboard_widget_activity',
487
+ //'agca_dashboard_widget_rc', deprecated in 3.8 and 1.3.1
488
  'agca_dashboard_widget_il',
489
  'agca_dashboard_widget_plugins',
490
  'agca_dashboard_widget_qp',
521
  'agca_custom_css',
522
  'agca_colorizer_turnonoff',
523
  'agca_disablewarning',
524
+ 'agca_selected_template',
525
+ 'agca_templates',
526
  );
527
  }
528
 
701
  }
702
  }
703
  }else{
704
+ //$elements = json_decode($arr[$type],true);
705
  if(isset($arr[$type])){
706
  $elements = $this->agca_decode($arr[$type]);
707
+ }
708
  if($elements !=""){
709
  foreach($elements as $element){
710
  if(!$first){
713
  $parts = explode(" : ",$element);
714
  if(isset($parts[0]) && isset($parts[1])){
715
  $array.="[".$parts[0].", ".$parts[1]."]";
716
+ }
717
  $first=false;
718
  }
719
  }
773
  <style type="text/css">
774
  #wpadminbar{
775
  display: none;
776
+ }
777
  </style>
778
+ <script type="text/javascript">
 
779
  window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
780
  </script>
781
+ <?php
 
782
  }
783
  if(get_option('agca_admin_bar_frontend')!=true){
784
 
790
  <script type="text/javascript">
791
  var wpversion = "<?php echo $wpversion; ?>";
792
  var agca_version = "<?php echo $this->agca_version; ?>";
793
+ var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
794
  var jQueryScriptOutputted = false;
795
  var agca_context = "page";
796
  function initJQuery() {
1148
  }
1149
  return $selectedValue;
1150
  }
1151
+
1152
+ function JSPrintAGCATemplateSettingsVar($settings){
1153
+ echo "\n<script type=\"text/javascript\">\n";
1154
+ echo "var agca_template_settings = ".preg_replace('#<script(.*?)>(.*?)</script>#is', '', $settings).";\n"; //TODO: think about this
1155
+ echo "</script>";
1156
+ }
1157
+
1158
+ function appendSettingsToAGCATemplateCustomizations($customizations, $settings){
1159
+ $template_settings = json_decode($settings);
1160
+ //print_r($template_settings);
1161
+ foreach($template_settings as $sett){
1162
+ $key = $sett->code;
1163
+
1164
+ //use default value if user's value is not set
1165
+ $value="";
1166
+ if($sett->value != ""){
1167
+ $value = $sett->value;
1168
+ }else{
1169
+ $value = $sett->default_value;
1170
+ }
1171
+
1172
+ //Prepare settings
1173
+ if($sett->type == 6){
1174
+ if($value !== null && (strtolower($value) == "on" || $value == "1")){
1175
+ $value = "true";
1176
+ }else{
1177
+ $value = "false";
1178
+ }
1179
+ }
1180
+ $customizations = str_replace("%".$key."%",$value, $customizations);
1181
+ }
1182
+ return $customizations;
1183
+ }
1184
+
1185
+ function enableSpecificWPVersionCustomizations($customizations){
1186
+ /*enable special CSS for this WP version*/
1187
+ $ver = $this->get_wp_version();
1188
+ $customizations = str_replace("/*".$ver," ", $customizations);
1189
+ $customizations = str_replace($ver."*/"," ", $customizations);
1190
+ return $customizations;
1191
+ }
1192
+
1193
+ function removeCSSComments($customizations){
1194
+ $customizations = preg_replace('#/\*.*?\*/#si','',$customizations);
1195
+ return $customizations;
1196
+ }
1197
+
1198
+ function prepareAGCAAdminTemplates(){
1199
+ if(get_option( 'agca_templates' ) != ""){
1200
+ //print_r(get_option( 'agca_templates' ));
1201
+ $templates = get_option( 'agca_templates' );
1202
+ foreach($templates as $templname=>$templdata){
1203
+ if($templname == get_option('agca_selected_template')){
1204
+
1205
+ echo ($templdata['common']);
1206
+ echo "<!--AGCAIMAGES: ".$templdata['images']."-->";
1207
+ if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
1208
+ if($templdata['settings'] == "") $templdata['settings'] = "{}";
1209
+ //print_r($templdata);
1210
+
1211
+ $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1212
+
1213
+ $admindata = $this->appendSettingsToAGCATemplateCustomizations($templdata['admin'], $templdata['settings']);
1214
+ $admindata = $this->enableSpecificWPVersionCustomizations($admindata);
1215
+ $admindata = $this->removeCSSComments($admindata);
1216
+
1217
+ //echo $admindata;
1218
+ //REPLACE TAGS WITH CUSTOM TEMPLATE SETTINGS
1219
+ $this->templateCustomizations = $admindata;
1220
+ }
1221
+ break;
1222
+ }
1223
+ }
1224
+ }
1225
+ }
1226
+
1227
+ function agcaAdminSession(){
1228
+ $agcaTemplatesSession = array();
1229
+
1230
+ //session_destroy();
1231
+ //session_unset();
1232
+
1233
+ if(!session_id()){
1234
+ session_start();
1235
+ }
1236
+
1237
+ if(!isset($_SESSION["AGCA"])){
1238
+ $_SESSION["AGCA"] = array();
1239
+ $_SESSION["AGCA"]["Templates"] = array();
1240
+ }
1241
+ //print_r($_SESSION);
1242
+
1243
+ if(isset($_SESSION["AGCA"])){
1244
+ if(isset($_SESSION["AGCA"]["Templates"])){
1245
+ //print_r($_SESSION["AGCA"]["Templates"]);
1246
+ $agcaTemplatesSession = json_encode($_SESSION["AGCA"]["Templates"]);
1247
+ }
1248
+ }
1249
+
1250
+
1251
+ if($agcaTemplatesSession == '""' || $agcaTemplatesSession == '"[]"'){
1252
+ $agcaTemplatesSession = array();
1253
+ }
1254
+
1255
+
1256
+ return $agcaTemplatesSession;
1257
+
1258
+ }
1259
+
1260
+ function prepareAGCALoginTemplates(){
1261
+ if(get_option( 'agca_templates' ) != ""){
1262
+ //print_r(get_option( 'agca_templates' ));
1263
+ $templates = get_option( 'agca_templates' );
1264
+ foreach($templates as $templname=>$templdata){
1265
+ if($templname == get_option('agca_selected_template')){
1266
+ echo ($templdata['common']);
1267
+
1268
+ if($templdata['settings'] == "") $templdata['settings'] = "{}";
1269
+ $this->JSPrintAGCATemplateSettingsVar($templdata['settings']);
1270
+
1271
+ $logindata = $this->appendSettingsToAGCATemplateCustomizations($templdata['login'], $templdata['settings']);
1272
+ $logindata = $this->enableSpecificWPVersionCustomizations($logindata);
1273
+ $logindata = $this->removeCSSComments($logindata);
1274
+
1275
+ echo($logindata);
1276
+ break;
1277
+ }
1278
+ }
1279
+ }
1280
+ }
1281
 
1282
  function print_admin_css()
1283
+ {
1284
+ $agcaTemplateSession = $this->agcaAdminSession();
1285
+ $wpversion = $this->get_wp_version();
1286
  $this->context = "admin";
1287
+ ?>
1288
+ <script type="text/javascript">
1289
+ var wpversion = "<?php echo $wpversion; ?>";
1290
+ var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1291
+ var agca_version = "<?php echo $this->agca_version; ?>";
1292
+ var agcaTemplatesSession = <?php echo ($agcaTemplateSession==null)?"[]":$agcaTemplateSession; ?>;
1293
+ var errors = false;
1294
+ var isSettingsImport = false;
1295
+ var agca_context = "admin";
1296
+ var roundedSidberSize = 0;
1297
+ var agca_installed_templates = <?php echo $this->get_installed_agca_templates(); ?>;
1298
+ </script>
1299
+ <?php
1300
+ $this->prepareAGCAAdminTemplates();
1301
+ $this->agca_get_includes();
1302
+ $this->admin_capabilities();
1303
  get_currentuserinfo() ;
1304
+
1305
  ?>
1306
  <?php
1307
  //in case that javaScript is disabled only admin can access admin menu
1316
  <script type="text/javascript">
1317
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1318
  <?php $this->finalErrorCheck(); ?>
 
 
 
 
 
 
 
1319
  <?php
1320
  if(isset($_POST['_agca_import_settings']) && $_POST['_agca_import_settings']=='true'){
1321
  echo 'isSettingsImport = true;';
1322
  }
1323
  ?>
1324
+ </script>
1325
  <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1326
  <style type="text/css">
1327
  .wp-has-current-submenu:after{border:none !important;}
1328
  #adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none !important;}
1329
  </style>
1330
  <?php } ?>
1331
+ <script type="text/javascript">
1332
  /* <![CDATA[ */
1333
+ jQuery(document).ready(function() {
 
1334
  try
1335
+ {
1336
 
1337
  <?php /*CHECK OTHER PLUGNS*/
1338
  $this->check_active_plugin();
1386
  if(isWPHigherOrEqualThan("3.4")){
1387
  additionalStyles = ' style="margin-bottom:-4px" ';
1388
  }
1389
+ jQuery("#adminmenu").before('<div '+additionalStyles+' id="sidebar_adminmenu_logo"><img width="160" src="<?php echo get_option('agca_admin_menu_brand'); ?>" /></div>');
1390
 
1391
  <?php } ?>
1392
  <?php if(get_option('agca_admin_menu_brand_link')!=""){ ?>
1405
 
1406
  <?php if(get_option('agca_admin_menu_submenu_round')==true){ ?>
1407
  jQuery("#adminmenu .wp-submenu").css("border-radius","<?php echo get_option('agca_admin_menu_submenu_round_size'); ?>px");
1408
+ jQuery("#adminmenu .wp-menu-open .wp-submenu").css('border-radius','');
1409
+ <?php $roundedSidebarSize = get_option('agca_admin_menu_submenu_round_size'); ?>
1410
+ roundedSidberSize = <?php echo ($roundedSidebarSize == "")?"0":$roundedSidebarSize; ?>;
1411
 
1412
 
1413
+ <?php } ?>
1414
  <?php if(get_option('agca_admin_menu_autofold')=="force"){ ?>
1415
  jQuery("body").addClass("auto-fold");
1416
  <?php } else if(get_option('agca_admin_menu_autofold')=="disable"){ ?>
1417
  jQuery("body").removeClass("auto-fold");
1418
+ <?php } ?>
 
1419
 
1420
  <?php $this->print_admin_bar_scripts(); ?>
1421
 
1479
  }
1480
  <?php } ?>
1481
  <?php if(get_option('agca_dashboard_text')!=""){ ?>
1482
+ jQuery("#dashboard-widgets-wrap").parent().find("h2").html("<?php echo addslashes(get_option('agca_dashboard_text')); ?>");
1483
  <?php } ?>
1484
  <?php if(get_option('agca_dashboard_text_paragraph')!=""){ ?>
1485
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<div id="agca_custom_dashboard_content"></div>');
1490
  <?php /*Remove Dashboard widgets*/ ?>
1491
  <?php
1492
 
1493
+ if(get_option('agca_dashboard_widget_welcome')==true){
1494
  ?>jQuery("#welcome-panel").css("display","none");<?php
1495
  }else{
1496
  ?>jQuery("#welcome-panel").css("display","block");<?php
1497
+ }
 
 
 
 
 
1498
  if(get_option('agca_dashboard_widget_il')==true){
1499
  $this->remove_dashboard_widget('dashboard_incoming_links','normal');
1500
  }else{
1529
  $this->remove_dashboard_widget('dashboard_secondary','side');
1530
  }else{
1531
  ?>jQuery("#dashboard_secondary").css("display","block");<?php
1532
+ }
1533
+ if(get_option('agca_dashboard_widget_activity')==true){
1534
+ remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
1535
+ }else{
1536
+ ?>jQuery("#dashboard_activity").css("display","block");<?php
1537
+ }
1538
 
1539
  ?>
1540
 
1553
  jQuery(".wp-menu-image").each(function(){
1554
  jQuery(this).css("display","none");
1555
  });
1556
+ jQuery('#adminmenu div.wp-menu-name').css('padding','8px');
1557
  <?php } ?>
1558
  <?php if(get_option('agca_admin_menu_arrow') == true){ ?>
1559
+ jQuery("#adminmenu .wp-menu-arrow").css("visibility","hidden");
1560
 
1561
  <?php } ?>
1562
  <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
1622
  var selector = '#' + topmenuitem + ' ul li';
1623
  var hoverPopupSelector = '#' + topmenuitem + ' .wp-submenu.wp-submenu-wrap';
1624
  //console.log(i+" "+checkboxes);
1625
+ var allSubmenuItemsHidden = true;
1626
+ while((i<checkboxes.length) && (checkboxes[i][0].indexOf("<-TOP->") < 0)){
 
 
1627
  jQuery(selector).each(function(){ //loop through all submenus
 
1628
  var currentItemText = "";
1629
 
1630
  <?php if($wpversion >=3.5 ){ ?>
1635
  currentItemText = jQuery(this).text();
1636
  <?php } ?>
1637
 
1638
+ //console.log("*"+checkboxes[i][0]+":"+withoutNumber+"*");
1639
+ if(checkboxes[i][0] == currentItemText){
1640
+
1641
+ if((checkboxes[i][1] == "true") || (checkboxes[i][1] == "checked")){
1642
+ jQuery(this).addClass('noclass');
1643
  }else{
1644
  allSubmenuItemsHidden = false;
1645
  }
1646
+ jQuery(this).find('a').text(textboxes[i][1]);
1647
  }
1648
  });
 
1649
  i++;
1650
+ }
1651
  if(allSubmenuItemsHidden){
1652
  jQuery(hoverPopupSelector).hide();
1653
+ }
 
1654
  };
1655
  }
1656
  }
1731
  }
1732
 
1733
  function print_login_head(){
1734
+ $this->context = "login";
 
1735
  $wpversion = $this->get_wp_version();
1736
+ ?>
1737
+ <script type="text/javascript">
 
1738
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
1739
  <?php $this->finalErrorCheck(); ?>
1740
  var agca_version = "<?php echo $this->agca_version; ?>";
1741
+ <?php //var wpversion = "echo $wpversion; ?>
1742
+ var agca_debug = <?php echo ($this->agca_debug)?"true":"false"; ?>;
1743
+ var isSettingsImport = false;
1744
+ var agca_context = "login";
1745
+ </script>
1746
+ <?php
1747
+ $this->prepareAGCALoginTemplates();
1748
+ $this->agca_get_includes();
1749
+
1750
+ ?>
1751
+
1752
+ <script type="text/javascript">
1753
+
1754
+
1755
  /* <![CDATA[ */
1756
  jQuery(document).ready(function() {
1757
  try{
1830
 
1831
  <?php //COLORIZER ?>
1832
  <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1833
+ jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1834
+ jQuery("body.login, html").css("background","<?php echo $this->colorizer['login_color_background'];?>");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1835
 
1836
 
1837
  <?php
1859
  $wpversion = $this->get_wp_version();
1860
  ?>
1861
  <?php //includes ?>
1862
+ <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css?ver=<?php echo $wpversion; ?>" />
1863
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
1864
 
1865
+ <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/agca_farbtastic.css?ver=<?php echo $wpversion; ?>" />
1866
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js?ver=<?php echo $wpversion; ?>"></script>
1867
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/xd.js?ver=<?php echo $wpversion; ?>"></script>
1868
+ <script type="text/javascript">
1869
+ var templates_ep = "<?php echo $this->templates_ep; ?>";
1870
+ var template_selected = '<?php echo get_option('agca_selected_template'); ?>';
1871
+ </script>
1872
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_tmpl.js?ver=<?php echo $wpversion; ?>"></script>
1873
  <?php //includes ?>
1874
  <div class="wrap">
1875
  <h1 style="color:green">AG Custom Admin Settings <span style="font-size:15px;">(v<?php echo $this->agca_version; ?>)</span></h1>
1894
  <li class="normal"><a href="#dashboad-page-settings" title="Settings for Dashboard page">Dashboard Page</a></li>
1895
  <li class="normal"><a href="#login-page-settings" title="Settings for Login page">Login Page</a></li>
1896
  <li class="normal" ><a href="#admin-menu-settings" title="Settings for main admin menu">Admin Menu</a></li>
1897
+ <li class="normal"><a href="#ag-colorizer-setttings" title="AG colorizer settings">Colorizer</a></li>
1898
+ <li class="normal"><a href="#ag-advanced" title="My custom scripts">Advanced</a></li>
1899
+ <li class="normal" style=""><a style="color:#DB6014;font-weight:bolder;" href="#ag-templates" title="AG Custom Admin Themes">Admin Themes</a></li>
1900
+
1901
  <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://agca.argonius.com/ag-custom-admin/support-for-future-development"><img alt="Donate" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/btn_donate_LG.gif" /></a>
1902
  </li>
1903
  <li style="background:none;border:none;padding:0;padding-left:10px;margin-top:-7px"></li>
2256
  </td>
2257
  <td></td>
2258
  </tr>
2259
+ <!--<tr valign="center">
2260
  <th scope="row">
2261
  <label title="This is small 'house' icon next to main heading (Dashboard text by default) on Dashboard page" for="agca_dashboard_icon">Hide Dashboard heading icon</label>
2262
  </th>
2263
  <td>
2264
  <input class="agca-checkbox" title="This is small house icon next to main heading on Dashboard page. Dashboard text is shown by default" type="checkbox" name="agca_dashboard_icon" value="true" <?php if (get_option('agca_dashboard_icon')==true) echo 'checked="checked" '; ?> />
2265
  </td>
2266
+ </tr>-->
2267
 
2268
  <tr valign="center">
2269
  <th scope="row">
2289
  <p tabindex="0"><i><strong>Info:</strong> These settings override settings in Screen options on Dashboard page.</i></p>
2290
  </td>
2291
  </tr>
2292
+ <tr valign="center">
2293
  <th scope="row">
2294
  <label for="agca_dashboard_widget_welcome">Hide "Welcome" WordPress Message</label>
2295
  </th>
2297
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_welcome" value="true" <?php if (get_option('agca_dashboard_widget_welcome')==true) echo 'checked="checked" '; ?> />
2298
  </td>
2299
  </tr>
2300
+ <tr valign="center">
2301
  <th scope="row">
2302
+ <label for="agca_dashboard_widget_activity">Hide "Activity" Dashboard Widget</label>
2303
  </th>
2304
  <td>
2305
+ <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_activity" value="true" <?php if (get_option('agca_dashboard_widget_activity')==true) echo 'checked="checked" '; ?> />
2306
  </td>
2307
+ </tr>
2308
+ <!--<tr valign="center">
2309
  <th scope="row">
2310
  <label for="agca_dashboard_widget_il">Hide "Incoming Links"</label>
2311
  </th>
2312
  <td>
2313
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_il" value="true" <?php if (get_option('agca_dashboard_widget_il')==true) echo 'checked="checked" '; ?> />
2314
  </td>
2315
+ </tr>-->
2316
+ <!--<tr valign="center">
2317
  <th scope="row">
2318
  <label for="agca_dashboard_widget_plugins">Hide "Plugins"</label>
2319
  </th>
2320
  <td>
2321
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_plugins" value="true" <?php if (get_option('agca_dashboard_widget_plugins')==true) echo 'checked="checked" '; ?> />
2322
  </td>
2323
+ </tr> -->
2324
  <tr valign="center">
2325
  <th scope="row">
2326
+ <label for="agca_dashboard_widget_qp">Hide "Quick Draft"</label>
2327
  </th>
2328
  <td>
2329
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_qp" value="true" <?php if (get_option('agca_dashboard_widget_qp')==true) echo 'checked="checked" '; ?> />
2331
  </tr>
2332
  <tr valign="center">
2333
  <th scope="row">
2334
+ <label for="agca_dashboard_widget_rn">Hide "At a Glance"</label>
2335
  </th>
2336
  <td>
2337
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_rn" value="true" <?php if (get_option('agca_dashboard_widget_rn')==true) echo 'checked="checked" '; ?> />
2338
  </td>
2339
  </tr>
2340
+ <!--<tr valign="center">
2341
  <th scope="row">
2342
  <label for="agca_dashboard_widget_rd">Hide "Recent Drafts"</label>
2343
  </th>
2344
  <td>
2345
  <input class="agca-checkbox" type="checkbox" name="agca_dashboard_widget_rd" value="true" <?php if (get_option('agca_dashboard_widget_rd')==true) echo 'checked="checked" '; ?> />
2346
  </td>
2347
+ </tr> -->
2348
  <tr valign="center">
2349
  <th scope="row">
2350
  <label title="This is 'WordPress Development Blog' widget by default" for="agca_dashboard_widget_primary">Hide primary widget area</label>
2546
  </tr>
2547
  <tr valign="center">
2548
  <th scope="row">
2549
+ <label title="Rounds submenu pop-up box" for="agca_admin_menu_submenu_round">Round sub-menu pop-up box</label>
2550
  </th>
2551
  <td>
2552
  <input class="agca-checkbox" title="Rounds submenu pop-up box" type="checkbox" name="agca_admin_menu_submenu_round" value="true" <?php if (get_option('agca_admin_menu_submenu_round')==true) echo 'checked="checked" '; ?> />
2807
  <input type="hidden" size="47" id="ag_colorizer_json" name="ag_colorizer_json" value="<?php echo htmlspecialchars(get_option('ag_colorizer_json')); ?>" />
2808
  <div id="picker"></div>
2809
  </div>
2810
+ <div id="section_templates" style="display:none" class="ag_section">
2811
+ <h2 class="section_title" tabindex="-1"><span style="float:left">Admin Themes</span><span style="width:100px;color:red;font-size:15px;float:left;margin-top:-8px;margin-left:6px;display:block">(beta)</span></h2>
2812
+ <br /><br />
2813
+ <table class="form-table" width="500px">
2814
+ <tr valign="center">
2815
+ <td>
2816
+ <div id="agca_templates">
2817
+
2818
+ </div>
2819
+ </td>
2820
+ </tr>
2821
+ <tr>
2822
+ <td>
2823
+ <div id="advanced_template_options" style="display:none">
2824
+ <h4>Advanced Theme Actions</h4>
2825
+ <p style="color:red;"><strong>WARNING:</strong> Use these theme actions only if you are experiencing some problems with AGCA themes. With these options you can deactivate or remove all installed themes.</p>
2826
+ <p><a href="javascript:agca_activateTemplate('');" title="When used, currently applied AGCA theme will be disabled</br>and WordPress will use default admin UI.</br>Themes will not be removed, and you can use them again.">DEACTIVATE CURRENT THEME</a> - themes will be deactivated, but still installed.</p>
2827
+ <p><a href="javascript:agca_removeAllTemplates();" title="All themes will be removed, including all theme settings and customizations.</br>If you're using commercial theme, you can install it again on the same site and activation will not be charged">REMOVE ALL THEMES</a> - installed themes will be removed.</p>
2828
+ </div>
2829
+ </td>
2830
+ </tr>
2831
+ </table>
2832
+ </div>
2833
  <div id="section_advanced" style="display:none" class="ag_section">
2834
  <h2 class="section_title" tabindex="-1">Advanced</h2>
2835
 
2894
  </p>
2895
 
2896
  </form>
2897
+ <form id="agca_templates_form" name="agca_templates_form" action="<?php echo $_SERVER['PHP_SELF'];?>?page=ag-custom-admin/plugin.php" method="post">
2898
+ <input type="hidden" name="_agca_save_template" value="true" />
2899
+ <input type="hidden" id="templates_data" name="templates_data" value="" />
2900
+ <input type="hidden" id="templates_name" name="templates_name" value="" />
2901
+ </form>
2902
  </div>
2903
 
2904
  <br />
2906
  <?php
2907
  }
2908
  }
2909
+ //<link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ? >style/agca.css" />
2910
+ //<link rel="stylesheet" type="text/css" href="http://localhost/wp/351/wp-content/plugins/ag-custom-admin/style/agca.css" />
2911
  ?>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === AG Custom Admin ===
2
  Contributors: argonius
3
  Donate link: http://agca.argonius.com/ag-custom-admin/support-for-future-development
4
- Tags: admin, customize, hide, change admin, admin panel
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 1.2.8
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
@@ -65,19 +65,21 @@ Here is the list of options:
65
  - Round admin submenu popups
66
  - Add custom branding image above the admin menu
67
  - Add custom link to branding image
68
- - Admin menu auto-folding options for mobile devices
69
 
70
  Colorizer
71
  - Change background and text colors on admin and login page
72
  - Change admin menu colors
73
  - Change widget colors
74
 
 
 
 
75
  Advanced
76
  - Add custom CSS
77
  - Add custom JavaScript
78
  - Export/import customization settings
79
 
80
- **IMPORTANT**: AG Custom Admin should always be updated before updating WordPress. If you are unable to login or you have any other problems, please check our [FAQ](http://wordpress.org/extend/plugins/ag-custom-admin/faq/) and [SUPPORT](http://wordpress.org/support/plugin/ag-custom-admin) page. Check [POSITIVE](http://agca.argonius.com/ag-custom-admin/feedback/ag-custom-admin-positive-feedback) and [NEGATIVE](http://agca.argonius.com/ag-custom-admin/feedback/ag-custom-admin-negative-feedback) comments of our users.
81
 
82
  For more information about the plugin please check [PLUGIN WEBSITE](http://agca.argonius.com/ag-custom-admin/)
83
 
@@ -99,7 +101,7 @@ This is caused by JavaScript error thrown by AGCA or some other plugin. If you w
99
  Please use 'Reset Settings' button on Admin Menu page to reset menu configuration to defaults. Remember that you should postpone admin menu configuration to the very end of admin page customization, because, any changes made from other plugins to admin menu (e.g adding new button of plugin that is activated, or removing that button when plugin is deactivated) could corrupt admin menu configuration.
100
 
101
  = Some errors appear on my page =
102
- Go to browser's console and see if there are any errors. Try to locate them. If you can't fix error by yourself, post it back to plugin's support page.
103
 
104
  = Plugin does not work =
105
  Try clearing browser's cache. If that does not work, go to browser's console and see if there are any errors. Try to locate them. If you can't fix error by yourself, post it back to plugin's support page. When trying to locate the problem, the best way is to disable other plugins, because there could be a conflict with them. If there is a conflict with other plugin, it can be found by disabling one by one plugin, until the problem is solved.
@@ -114,6 +116,12 @@ Try clearing browser's cache. If that does not work, go to browser's console and
114
 
115
  == Changelog ==
116
 
 
 
 
 
 
 
117
  = 1.2.8 =
118
  * Fixed PHP errors in DEBUG mode
119
 
@@ -320,6 +328,12 @@ Try clearing browser's cache. If that does not work, go to browser's console and
320
 
321
  == Upgrade Notice ==
322
 
 
 
 
 
 
 
323
  = 1.2.8 =
324
  * Fixed PHP errors in DEBUG mode
325
 
1
  === AG Custom Admin ===
2
  Contributors: argonius
3
  Donate link: http://agca.argonius.com/ag-custom-admin/support-for-future-development
4
+ Tags: admin, customize, hide, change admin, themes, admin themes
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 1.3.1
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
65
  - Round admin submenu popups
66
  - Add custom branding image above the admin menu
67
  - Add custom link to branding image
 
68
 
69
  Colorizer
70
  - Change background and text colors on admin and login page
71
  - Change admin menu colors
72
  - Change widget colors
73
 
74
+ Admin Panel Themes
75
+ - Use predefined AG Custom Admin themes for WordPress Admin Panel
76
+
77
  Advanced
78
  - Add custom CSS
79
  - Add custom JavaScript
80
  - Export/import customization settings
81
 
82
+ **IMPORTANT**: AG Custom Admin should always be updated before updating WordPress. If you are unable to login or you have any other problems, please check our [FAQ](http://wordpress.org/extend/plugins/ag-custom-admin/faq/) and [SUPPORT](http://wordpress.org/support/plugin/ag-custom-admin) page.
83
 
84
  For more information about the plugin please check [PLUGIN WEBSITE](http://agca.argonius.com/ag-custom-admin/)
85
 
101
  Please use 'Reset Settings' button on Admin Menu page to reset menu configuration to defaults. Remember that you should postpone admin menu configuration to the very end of admin page customization, because, any changes made from other plugins to admin menu (e.g adding new button of plugin that is activated, or removing that button when plugin is deactivated) could corrupt admin menu configuration.
102
 
103
  = Some errors appear on my page =
104
+ Go to browser's console and see if there are any errors. Try to locate them. If you can't fix error by yourself, post it back to plugin's support page.
105
 
106
  = Plugin does not work =
107
  Try clearing browser's cache. If that does not work, go to browser's console and see if there are any errors. Try to locate them. If you can't fix error by yourself, post it back to plugin's support page. When trying to locate the problem, the best way is to disable other plugins, because there could be a conflict with them. If there is a conflict with other plugin, it can be found by disabling one by one plugin, until the problem is solved.
116
 
117
  == Changelog ==
118
 
119
+ = 1.3.1 =
120
+ * First production version with AGCA Themes
121
+
122
+ = 1.3 =
123
+ * Introducing AG Custom Admin Themes
124
+
125
  = 1.2.8 =
126
  * Fixed PHP errors in DEBUG mode
127
 
328
 
329
  == Upgrade Notice ==
330
 
331
+ = 1.3.1 =
332
+ Introducing AG Custom Admin Themes
333
+
334
+ = 1.3 =
335
+ Introducing AG Custom Admin Themes
336
+
337
  = 1.2.8 =
338
  * Fixed PHP errors in DEBUG mode
339
 
script/ag_script.js CHANGED
@@ -9,6 +9,22 @@ function booleanToChecked(bool){
9
  }
10
  }
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  function hideShowSubmenus(index){
13
 
14
  var finish = false;
@@ -108,7 +124,7 @@ function createEditMenuPage(checkboxes,textboxes){
108
 
109
  //console.log(checkboxes.replace('<-TOP->','')+"|"+textboxes.replace('<-TOP->',''));
110
  prettyEditMenuPage();
111
- agcaChangeCheckBoxStyles();
112
  }
113
 
114
  function createEditMenuPageV32(checkboxes,textboxes){
@@ -288,6 +304,14 @@ function showHideSection(text) {
288
  case 'Colorizer':
289
  jQuery('#section_ag_colorizer_settings').show();
290
  jQuery('#section_ag_colorizer_settings .section_title').trigger('focus');
 
 
 
 
 
 
 
 
291
  break;
292
  case 'Advanced':
293
  jQuery('#section_advanced').show();
@@ -424,42 +448,10 @@ jQuery(document).ready(function(){
424
  setTimeout(function(){
425
  jQuery('#agca_advertising').show(),700
426
  });
427
- });
428
-
429
- jQuery(document).ready(function(){
430
- /*Add click handler on main buttons*/
431
- jQuery('#ag_main_menu a, #ag_main_menu li').bind('click',function(){
432
- hideAllSections();
433
- var text = jQuery(this).text();
434
- jQuery(this).attr("class","selected");
435
- showHideSection(text);
436
- });
437
-
438
- /*Admin Menu Reset all setings button*/
439
- jQuery('#ag_edit_adminmenu_reset_button').click(function(){
440
- afterFormClickCreateJson = false;
441
- jQuery('#agca_form').submit();
442
- });
443
-
444
- /*Add new menu item button - creates new HTMl button elements*/
445
- jQuery('#ag_add_adminmenu_button').click(function(){
446
- var name = jQuery('#ag_add_adminmenu_name').val();
447
- var url = jQuery('#ag_add_adminmenu_url').val();
448
- var target = jQuery('#ag_add_adminmenu_target').val();
449
- name = name.replace(/["']{1}/gi,"");
450
- url = url.replace(/["']{1}/gi,"");
451
- jQuery('#ag_add_adminmenu_name').val("");
452
- jQuery('#ag_add_adminmenu_url').val("");
453
- jQuery('#ag_add_adminmenu_target').val("_none");
454
- jQuery('#ag_add_adminmenu').append('<tr><td colspan="2"><button target="'+target+'" title="'+url+'" type="button">'+name+'</button>&nbsp;(<a style="cursor:pointer" class="button_edit">edit</a>)&nbsp;(<a style="cursor:pointer" class="button_remove">remove</a>)</td><td></td></tr>');
455
- reloadRemoveButtonEvents();
456
- });
457
-
458
- /*Add tooltip box*/
459
- jQuery("body").append("<div id='AGToolTipDiv'></div>");
460
-
461
- /*ToolTip*/
462
- jQuery("label[title],#agca_donate_button, a.feedback").each(function() {
463
  jQuery(this).hover(function(e) {
464
  if(jQuery(this).hasClass('feedback')){
465
  jQuery(this).mousemove(function(e) {
@@ -489,20 +481,55 @@ jQuery(document).ready(function(){
489
  'border': '1px solid #FFFF00'
490
  });
491
  });
492
- }
493
-
494
- jQuery("#AGToolTipDiv")
495
- .html(jQuery(this).attr('title'))
496
- .stop(true,true)
497
- .fadeIn("fast");
498
- jQuery(this).removeAttr('title');
499
  }, function() {
500
  jQuery("#AGToolTipDiv")
501
  .stop(true,true)
502
  .fadeOut("fast");
503
  jQuery(this).attr('title', jQuery("#AGToolTipDiv").html());
504
  });
 
 
 
 
 
 
 
 
 
 
505
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
  /*SECTION FOCUS*/
508
  jQuery('.section_title').focus(function(){
@@ -683,7 +710,7 @@ function updateTargetColor(id, color){
683
  case 'login_color_background':
684
  jQuery('body.login').css({
685
  'background-color':color
686
- });
687
  break;
688
 
689
  case 'color_header':
9
  }
10
  }
11
 
12
+ function agcaLog(text){
13
+ console.log(text);
14
+ }
15
+
16
+ function agcaDebug(text){
17
+ if(agca_debug){
18
+ console.log('- '+text);
19
+ }
20
+ }
21
+
22
+ function agcaDebugObj(obj){
23
+ if(agca_debug){
24
+ console.log(obj);
25
+ }
26
+ }
27
+
28
  function hideShowSubmenus(index){
29
 
30
  var finish = false;
124
 
125
  //console.log(checkboxes.replace('<-TOP->','')+"|"+textboxes.replace('<-TOP->',''));
126
  prettyEditMenuPage();
127
+ agcaChangeCheckBoxStyles();
128
  }
129
 
130
  function createEditMenuPageV32(checkboxes,textboxes){
304
  case 'Colorizer':
305
  jQuery('#section_ag_colorizer_settings').show();
306
  jQuery('#section_ag_colorizer_settings .section_title').trigger('focus');
307
+ break;
308
+ case 'Admin Themes':
309
+ if(!jQuery('#section_templates').hasClass("loaded")){
310
+ jQuery('#section_templates').addClass('loaded');
311
+ agca_client_init();
312
+ }
313
+ jQuery('#section_templates').show();
314
+ jQuery('#section_templates .section_title').trigger('focus');
315
  break;
316
  case 'Advanced':
317
  jQuery('#section_advanced').show();
448
  setTimeout(function(){
449
  jQuery('#agca_advertising').show(),700
450
  });
451
+ });
452
+ /*ToolTip*/
453
+ function agcaApplyTooltip(){
454
+ if(jQuery(this).attr('title') != ""){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
455
  jQuery(this).hover(function(e) {
456
  if(jQuery(this).hasClass('feedback')){
457
  jQuery(this).mousemove(function(e) {
481
  'border': '1px solid #FFFF00'
482
  });
483
  });
484
+ }
485
+ jQuery("#AGToolTipDiv")
486
+ .html(jQuery(this).attr('title'))
487
+ .stop(true,true)
488
+ .fadeIn("fast");
489
+ jQuery(this).removeAttr('title');
 
490
  }, function() {
491
  jQuery("#AGToolTipDiv")
492
  .stop(true,true)
493
  .fadeOut("fast");
494
  jQuery(this).attr('title', jQuery("#AGToolTipDiv").html());
495
  });
496
+ }
497
+ }
498
+
499
+ jQuery(document).ready(function(){
500
+ /*Add click handler on main buttons*/
501
+ jQuery('#ag_main_menu a, #ag_main_menu li').bind('click',function(){
502
+ hideAllSections();
503
+ var text = jQuery(this).text();
504
+ jQuery(this).attr("class","selected");
505
+ showHideSection(text);
506
  });
507
+
508
+ /*Admin Menu Reset all setings button*/
509
+ jQuery('#ag_edit_adminmenu_reset_button').click(function(){
510
+ afterFormClickCreateJson = false;
511
+ jQuery('#agca_form').submit();
512
+ });
513
+
514
+ /*Add new menu item button - creates new HTMl button elements*/
515
+ jQuery('#ag_add_adminmenu_button').click(function(){
516
+ var name = jQuery('#ag_add_adminmenu_name').val();
517
+ var url = jQuery('#ag_add_adminmenu_url').val();
518
+ var target = jQuery('#ag_add_adminmenu_target').val();
519
+ name = name.replace(/["']{1}/gi,"");
520
+ url = url.replace(/["']{1}/gi,"");
521
+ jQuery('#ag_add_adminmenu_name').val("");
522
+ jQuery('#ag_add_adminmenu_url').val("");
523
+ jQuery('#ag_add_adminmenu_target').val("_none");
524
+ jQuery('#ag_add_adminmenu').append('<tr><td colspan="2"><button target="'+target+'" title="'+url+'" type="button">'+name+'</button>&nbsp;(<a style="cursor:pointer" class="button_edit">edit</a>)&nbsp;(<a style="cursor:pointer" class="button_remove">remove</a>)</td><td></td></tr>');
525
+ reloadRemoveButtonEvents();
526
+ });
527
+
528
+ /*Add tooltip box*/
529
+ jQuery("body").append("<div id='AGToolTipDiv'></div>");
530
+
531
+ /*ToolTip*/
532
+ jQuery("label[title],#agca_donate_button, a.feedback").each(agcaApplyTooltip);
533
 
534
  /*SECTION FOCUS*/
535
  jQuery('.section_title').focus(function(){
710
  case 'login_color_background':
711
  jQuery('body.login').css({
712
  'background-color':color
713
+ });
714
  break;
715
 
716
  case 'color_header':
script/agca_tmpl.js ADDED
@@ -0,0 +1,739 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var isAGCAPage = true;
2
+ var template_name = "";
3
+ var templates_installed = [];
4
+ var xhr =null;
5
+ var agcaLoadingTimeOut = null;
6
+
7
+ function agca_getTemplateCallback(data){
8
+ agcaDebug('FN:agca_getTemplateCallback()');
9
+ agcaDebug(JSON.stringify(data));
10
+ if(data.success == 0){
11
+ //alert(data.data);
12
+ agcaInfoMessage("Error",data.data);
13
+ jQuery('#agca_template_popup').hide();
14
+ }else{
15
+ jQuery("#templates_name").val(template_name);
16
+ var parts = data.data.split("||||");
17
+ jQuery("#templates_data").val(parts[1]);
18
+ //console.log(jQuery("#templates_data").val());
19
+ jQuery("body").append(parts[0]);
20
+
21
+ //load settings
22
+ agca_loadTemplateSettingsInitial(template_name);
23
+ }
24
+ }
25
+
26
+ function agca_getTemplateByLicenseKeyCallback(data){
27
+ agcaDebug('FN:agca_getTemplateByLicenseKeyCallback()');
28
+ agcaDebug(JSON.stringify(data));
29
+ if(data.success == 0){
30
+ agcaInfoMessage("Error",data.data);
31
+ }else{
32
+ if(data.data.length < 100){
33
+ template_selected = data.data;
34
+ var key = agcaTemplatesSessionGetLicenseKey(template_selected);
35
+ agcaProgress('Loading theme... Please wait...');
36
+ agca_getTemplate(template_selected,key);
37
+ }else{
38
+ agcaDebug("Uknown theme name" + data.data);
39
+ }
40
+
41
+ }
42
+ }
43
+
44
+ function agca_getTemplatesCallback(data){
45
+ agcaDebug('FN:agca_getTemplatesCallback()');
46
+ if(data.data == "CDbException"){
47
+ data.data = "Service is temporary to busy. Please reload the page or try again later.";
48
+ agcaDebugObj(data);
49
+ }else if(data.data == "PHP Error"){
50
+ data.data = "Error occurred on the server.";
51
+ agcaDebugObj(data);
52
+ }
53
+ jQuery('#agca_templates').html(data.data);
54
+ jQuery('#advanced_template_options').show();
55
+ jQuery("#agca_installed_templates .template img").each(agcaApplyTooltip);
56
+ jQuery("#agca_loaded_templates .template img").each(agcaApplyTooltip);
57
+ jQuery('#advanced_template_options a').each(agcaApplyTooltip);
58
+ }
59
+ function agca_client_init(){
60
+ agcaDebug('FN:agca_client_init()');
61
+ agca_getLocalTemplates();
62
+ checkIfTemplatesAreLoaded(1);
63
+ jQuery('#agca_templates').html('<p class="initialLoader" style="font-size:18px;color:gray;font-style:italic">Loading themes...</p>');
64
+ }
65
+
66
+ function agca_setupXHR(){
67
+ agcaDebug('FN:agca_setupXHR()');
68
+ if(xhr != null) return false;
69
+ xhr = new easyXDM.Rpc({
70
+ remote:templates_ep
71
+ //onReady: function () { alert('ready'); }
72
+ }, {
73
+ remote: {
74
+ request: {
75
+ }
76
+ },
77
+ handle: function(data, send){
78
+ if(data.success){
79
+ var callbackFname = data.url.split('callback=')[1];
80
+ var fn = window[callbackFname];
81
+ if(fn != undefined){
82
+ fn(data);
83
+ }
84
+ }else{ console.log('errr');
85
+ console.log(data.url);
86
+ var url = data.url;
87
+ if(url !== undefined && url != ""){
88
+ var cb = url.split('callback=')[1];
89
+ if(cb != ""){
90
+ var fn = window[cb];
91
+ if(fn != undefined){
92
+ fn(data);
93
+ }
94
+ }
95
+ }else{
96
+ printInitialAGCAError("Please update your browser in order to view AG Custom Admin themes.");
97
+ }
98
+ }
99
+ }
100
+ });
101
+ }
102
+
103
+ function agca_getTemplates(){
104
+ agcaDebug('FN:agca_getTemplates()');
105
+ //agca_uploadRemoteImage('http://www.neowing.co.jp/idol_site2/image/FDGD-21/fdgd-21-top.jpg');
106
+ agca_setupXHR();
107
+ if(typeof agca_active_template_version === 'undefined'){
108
+ agca_active_template_version = "";
109
+ }
110
+
111
+ xhr.request({
112
+ url: templates_ep + "service/client" + "&callback=agca_getTemplatesCallback",
113
+ method: "POST",
114
+ callBack: agca_getTemplatesCallback,
115
+ data: {isPost:true, wpv:wpversion, agcav:agca_version,selected:template_selected,installed:agca_installed_templates,template_version:agca_active_template_version}
116
+ });
117
+ }
118
+
119
+ function agca_getConfiguration(){
120
+ agcaDebug('FN:agca_getConfiguration()');
121
+ /*xhr.request({
122
+ url: templates_ep + "/configuration" + "?callback=agca_getConfigurationCallback",
123
+ method: "POST",
124
+ callBack: agca_getConfigurationCallback,
125
+ data: {isPost:true}
126
+ });*/
127
+ jQuery.getJSON(templates_ep + "?callback=?",
128
+ function(data){
129
+ console.log("EP:"+data.ep);
130
+ templates_ep = data.ep;
131
+ if(data.error !=""){
132
+ printInitialAGCAError(data.error);
133
+ }else{
134
+ agca_getTemplates();
135
+ }
136
+ }
137
+ ).error(function(jqXHR, textStatus, errorThrown) {
138
+ agca_error({url:templates_ep,data:textStatus + " " + jqXHR.responseText});
139
+ /*console.log("error " + textStatus);
140
+ console.log("incoming Text " + jqXHR.responseText);*/
141
+ });
142
+ }
143
+
144
+ function printInitialAGCAError(err){
145
+ jQuery('#agca_templates p.initialLoader').html(err);
146
+ jQuery('#agca_templates p').removeClass('initialLoader');
147
+ clearTimeout(agcaLoadingTimeOut);
148
+ }
149
+
150
+ function agca_getTemplate(template, key){
151
+ agcaDebug('FN:agca_getTemplate()');
152
+ template_name = template;
153
+ if(!agcaTemplatesSessionIsLicenseSet(template)){
154
+ agcaTemplatesSessionAdd(template, key);
155
+ }
156
+ xhr.request({
157
+ url: templates_ep + "service/gettemplate"+"&tmpl="+template+"&key="+key+"&callback=agca_getTemplateCallback",
158
+ method: "POST",
159
+ callBack: agca_getTemplateCallback,
160
+ data: {isPost:true, wpv:wpversion, agcav:agca_version}
161
+ });
162
+ }
163
+
164
+ function agca_getTemplateByLicenseKey(key){
165
+ agcaDebug('FN:agca_getTemplateByLicenseKey('+key+')');
166
+ //template_name = template;
167
+ xhr.request({
168
+ url: templates_ep + "service/gettemplatebylk"+"&tmpl=&key="+key+"&callback=agca_getTemplateByLicenseKeyCallback",
169
+ method: "POST",
170
+ callBack: agca_getTemplateByLicenseKeyCallback,
171
+ data: {isPost:true, wpv:wpversion, agcav:agca_version}
172
+ });
173
+ }
174
+
175
+ function agca_loadTemplateSettingsInitial(template){
176
+ agcaDebug('FN:agca_loadTemplateSettingsInitial()');
177
+ agca_loadTemplateSettingsCore(template, true);
178
+ }
179
+
180
+ function agca_loadTemplateSettings(template){
181
+ agcaDebug('FN:agca_loadTemplateSettings()');
182
+ agca_loadTemplateSettingsCore(template, false);
183
+ }
184
+
185
+ function agca_loadTemplateSettingsCore(template, isInitial){
186
+ agcaDebug('FN:agca_loadTemplateSettingsCore()');
187
+ template_name = template;
188
+ template_selected = template;
189
+
190
+ var licenseKey = "";
191
+ if(agcaTemplatesSession[template] != null && agcaTemplatesSession[template]['license'] != null){
192
+ licenseKey = agcaTemplatesSession[template]['license'];
193
+ }
194
+
195
+ var calb = agca_getTemplateSettingsCallback;
196
+ var calbName = "agca_getTemplateSettingsCallback";
197
+
198
+ if(isInitial){
199
+ agcaProgress("Loading theme settings...");
200
+ calb = agca_getTemplateSettingsInitialCallback;
201
+ calbName = "agca_getTemplateSettingsInitialCallback";
202
+ }
203
+ xhr.request({
204
+ url: templates_ep + "service/gettemplatesettings"+"&tmpl="+template+"&key="+licenseKey+"&callback="+calbName,
205
+ method: "POST",
206
+ callBack: calb,
207
+ data: {isPost:true, wpv:wpversion, agcav:agca_version}
208
+ });
209
+ //alert('saving template settings for template:' + template_name);
210
+ }
211
+
212
+ function agca_getTemplateSettingsInitialCallback(data){
213
+ agcaDebug('FN:agca_getTemplateSettingsInitialCallback()');
214
+ agcaDebug(JSON.stringify(data));
215
+ if(data.success == 0){
216
+ agcaInfoMessage("Error",data.data);
217
+ //TODO - what if template is loaded, but settings are not?
218
+ console.log('ERR:theme settings are not loaded');
219
+ }else{
220
+ var settings = "";
221
+ var filteredSettings = {};
222
+ try{
223
+ settings = JSON.parse(data.data);
224
+ if(settings.length == 0){
225
+ }else{
226
+ for(var ind in settings){
227
+ var type = settings[ind].type;
228
+ var text = "";
229
+ var defaultValue = "";
230
+ var newItem = {};
231
+ newItem.code = settings[ind].name;
232
+ newItem.type = settings[ind].type;
233
+ newItem.value = settings[ind].value;
234
+ newItem.default_value = settings[ind].default_value;
235
+ filteredSettings[ind] = newItem;
236
+ }
237
+ agcaDebug("Selected theme:" + template_selected);
238
+ console.log(filteredSettings);
239
+
240
+ }
241
+ }catch(e){
242
+ console.log('Error while loading settings');
243
+ console.log(e);
244
+ }
245
+ agca_saveTemplateSettingsInitial(template_selected, filteredSettings);
246
+ }
247
+ }
248
+ /*template settings - load them to UI popup window*/
249
+ function agca_getTemplateSettingsCallback(data){
250
+ agcaDebug('FN:agca_getTemplateSettingsCallback()');
251
+ //console.log(data.data);
252
+
253
+ if(data.success == 0){
254
+ agcaTemplatesSessionRemove(template_selected);
255
+ //alert(data.data);
256
+ jQuery('#agca_template_settings .agca_loader').html(data.data);
257
+ }else{
258
+
259
+ var settings = "";
260
+ try{
261
+ if(data.data.substring(0, "Exception:".length) === "Exception:"){
262
+ var errr= data.data.substr(10);
263
+ jQuery('#agca_template_settings .agca_loader').html(errr);
264
+ return false;
265
+ }
266
+ settings = JSON.parse(data.data);
267
+ if(settings.length == 0){
268
+ jQuery('#agca_template_settings .agca_loader').html("Additional settings are not available for this theme");
269
+ }else{
270
+ jQuery('#agca_template_settings .agca_loader').hide();
271
+ jQuery('#agca_save_template_settings').show();
272
+
273
+ var currentSettings = (agca_template_settings != null && agca_template_settings != undefined)?agca_template_settings:{};
274
+
275
+ //TODO: Change to use object name code object[code], instead of number object[i]
276
+ for(var ind in settings){
277
+ var type = settings[ind].type;
278
+ var text = "";
279
+ //console.log(settings[ind]);
280
+ var currentValue = "";
281
+
282
+ //get previously saved value
283
+ for(var ind2 in currentSettings){
284
+ if(currentSettings[ind2]!= null && currentSettings[ind2].code == settings[ind].name){
285
+ currentValue = currentSettings[ind2].value;
286
+ }
287
+ }
288
+
289
+ //if current value is still not defined, use default value
290
+ if(currentValue == ""){
291
+ currentValue = settings[ind].default_value;
292
+ }
293
+ /*text*/
294
+ if(type==1){
295
+ text = "<p>"+settings[ind].title+"</p><input type=\"text\" name=\"agcats_"+settings[ind].name+"\" value=\""+currentValue+"\" default_value=\""+settings[ind].default_value+"\" code=\""+settings[ind].name+"\" class=\"setting\" stype=\"1\" /></br>";
296
+ }else if(type==2){
297
+ text = "<p>"+settings[ind].title+"</p><textarea name=\"agcats_"+settings[ind].name+"\" class=\"setting\" code=\""+settings[ind].name+"\" default_value=\""+settings[ind].default_value+"\" stype=\"2\" >"+currentValue+"</textarea></br>";
298
+ }else if(type==3){
299
+ text = "<p>"+settings[ind].title+"</p><select name=\"agcats_"+settings[ind].name+"\" class=\"setting\" code=\""+settings[ind].name+"\" default_value=\""+settings[ind].default_value+"\" stype=\"3\" >";
300
+ var options = settings[ind].default_value.split(',');
301
+ for(var indopt in options){
302
+ var sel = "";
303
+ if(currentValue == options[indopt]){
304
+ sel = " selected=\"selected\" ";
305
+ }
306
+ text+="<option value="+options[indopt]+" "+sel+">"+options[indopt]+"</option>";
307
+ }
308
+ text+="</select>";
309
+ }else if(type==4){
310
+ text = "<p>"+settings[ind].title+"</p><div class=\"agca_form_0100_div\"><input value=\""+currentValue+"\" type=\"text\" name=\"agcats_"+settings[ind].name+"\" class=\"setting agca_form_0100\" code=\""+settings[ind].name+"\" default_value=\""+settings[ind].default_value+"\" stype=\"4\" /><input type=\"button\" name=\"agca_form_decr\" class=\"agca_form_decr\" value=\"-\"/><input type=\"button\" name=\"agca_form_incr\" class=\"agca_form_incr\" value=\"+\"/>&nbsp;(0-100)</div></br>";
311
+ }else if(type==6){
312
+ if(currentValue == true){
313
+ currentValue =" checked=\"checked\" ";
314
+ }else{
315
+ currentValue="";
316
+ }
317
+ text = "<p>"+settings[ind].title+"</p><input type=\"checkbox\" name=\"agcats_"+settings[ind].name+"\" class=\"setting\" default_value=\""+settings[ind].default_value+"\" code=\""+settings[ind].name+"\" stype=\"6\" "+currentValue+" /></br>";
318
+ }else if(type==7){
319
+ text = "<p>"+settings[ind].title+"</p><div name=\"agcats_"+settings[ind].name+"\" class=\"setting\" code=\""+settings[ind].name+"\" default_value=\""+settings[ind].default_value+"\" stype=\"7\" style=\"padding-left: 10px;color:white;\">";
320
+ var options = settings[ind].default_value.split(',');
321
+ for(var indopt in options){
322
+ var sel = "";
323
+ if(currentValue == options[indopt]){
324
+ sel = " checked ";
325
+ }
326
+ text+="<input name=\"agcats_"+settings[ind].name+"_val\" style=\"margin-right:6px;\" type=\"radio\" value="+options[indopt]+" "+sel+" name=\"sd\"/>"+options[indopt]+"</br>";
327
+ }
328
+ text+="</div>";
329
+ }
330
+ jQuery('#agca_template_settings').append(text);
331
+
332
+ //TODO: do similar to options above, clean a code up a litle bit, add them dinamicaly all attributes instead of inline adding
333
+ jQuery('.agca_form_0100_div .agca_form_decr').click(function(){
334
+ var val =jQuery(this).parent().find('.agca_form_0100').val();
335
+ val = parseInt(val.replace(/\D/g,''));//leave only numbers
336
+ if(isNaN(val)) val =0;
337
+ val--;
338
+ if(val < 0)val =0;
339
+ if(val > 100)val=100;
340
+ jQuery(this).parent().find('.agca_form_0100').val(val);
341
+ });
342
+ jQuery('.agca_form_0100_div .agca_form_incr').click(function(){
343
+ var val =jQuery(this).parent().find('.agca_form_0100').val();
344
+ val = parseInt(val.replace(/\D/g,''));//leave only numbers
345
+ if(isNaN(val)) val =0;
346
+ val++;
347
+ if(val < 0)val =0;
348
+ if(val > 100)val=100;
349
+ jQuery(this).parent().find('.agca_form_0100').val(val);
350
+ });
351
+ jQuery('.agca_form_0100').keyup(function(){
352
+
353
+ var val =jQuery(this).val();
354
+ val = parseInt(val.replace(/\D/g,''));//leave only numbers
355
+ if(val < 0 || isNaN(val))val =0;
356
+ if(val > 100)val=100;
357
+
358
+ jQuery(this).val(val);
359
+
360
+ });
361
+ }
362
+ }
363
+ }catch(e){
364
+ console.log(e);
365
+ }
366
+ }
367
+ //alert('callb');
368
+ }
369
+
370
+ function agca_saveTemplateSettingsInitial(template, settings){
371
+ agcaDebug('FN:agca_saveTemplateSettingsInitial()');
372
+ var originalText = jQuery("#templates_data").val();
373
+ jQuery("#templates_data").val(originalText+"|||"+JSON.stringify(settings));
374
+ agca_removeTemplateImages(template, agca_startUploadingRemoteImages);
375
+ }
376
+
377
+ function agca_saveTemplateSettingsFromForm(template){
378
+ agcaDebug('FN:agca_saveTemplateSettingsFromForm()');
379
+ template_name = template;
380
+
381
+ //get settings from the form
382
+ var settings = {};
383
+
384
+ jQuery('#agca_template_settings .setting').each(function(ind){
385
+ var setting_typ = jQuery(this).attr('stype');
386
+ var setting_val = jQuery(this).val();
387
+ var setting_cod = jQuery(this).attr('code');
388
+ var setting_def = jQuery(this).attr('default_value');
389
+
390
+ if(jQuery(this).attr('type')=="checkbox"){
391
+ setting_val = jQuery(this).is(':checked');
392
+ }
393
+
394
+ //radio
395
+ if(setting_typ == "7"){
396
+ setting_val = jQuery('input[name="agcats_'+setting_cod+'_val"]:checked').val();
397
+ }
398
+
399
+ settings[ind] = {
400
+ type: setting_typ,
401
+ value: setting_val,
402
+ code: setting_cod,
403
+ default_value: setting_def
404
+ };
405
+
406
+ });
407
+
408
+ jQuery('#agca_template_settings').html("<p>Applying theme settings...</p>");
409
+ agca_saveTemplateSettingsCore(template, settings, function(data){
410
+ window.location = 'tools.php?page=ag-custom-admin/plugin.php';
411
+ });
412
+ }
413
+
414
+
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){
428
+ var settings = {};
429
+ var url = window.location;
430
+ jQuery.post(url,{"_agca_template_settings":settings,"_agca_current_template":template},
431
+ function(data){
432
+ window.location = 'tools.php?page=ag-custom-admin/plugin.php';
433
+ //console.log('reload');
434
+ })
435
+ .fail(
436
+ function(){
437
+ console.log('AGCA Error: agca_saveTemplateSettingsCore()');
438
+ });
439
+ }*/
440
+
441
+ function agca_activateTemplate(template){
442
+ /*if(template_selected == ""){
443
+ alert('There are no active templates to deactivate.');
444
+ return false;
445
+ };*/
446
+ if(template == ""){
447
+ agcaProgress('Deactivating theme... Please wait...');
448
+ }else{
449
+ agcaProgress('Activating theme... Please wait...');
450
+ }
451
+
452
+ agcaDebug('FN:agca_activateTemplate('+template+')');
453
+ jQuery('input[name=agca_colorizer_turnonoff]').val("off");
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
+ }
474
+
475
+ function agca_removeAllTemplates(){
476
+ agcaDebug('FN:agca_removeAllTemplates()');
477
+ yesnoPopup("Confirm","Are you sure? All installed themes will be removed completely?",agca_removeAllTemplatesConfirmed);
478
+ }
479
+
480
+ function agca_removeAllTemplatesConfirmed(){
481
+ agcaDebug('FN:agca_removeAllTemplatesConfirmed()');
482
+ agcaProgress('Removing all themes... Please wait...');
483
+ window.setTimeout(function(){
484
+ window.location = 'tools.php?page=ag-custom-admin/plugin.php&agca_action=remove_templates';
485
+ },2000);
486
+ }
487
+
488
+ function handleLocalyStoredImages(){
489
+ agcaDebug('FN:handleLocalyStoredImages()');
490
+ agcaDebug(jQuery("#templates_data").val());
491
+ var originalText = jQuery("#templates_data").val();
492
+ var serializedImages = "";
493
+ for(var tag in agca_local_images){
494
+ if(tag != ""){
495
+ if(serializedImages !=""){
496
+ serializedImages+=",";
497
+ }
498
+ serializedImages+=agca_local_images[tag];
499
+ originalText = originalText.replace(new RegExp(tag, 'g'), agca_local_images[tag]);
500
+ }
501
+ }
502
+ jQuery("#templates_data").val(originalText+"|||"+serializedImages);
503
+ //console.log(jQuery("#templates_data").val());
504
+
505
+ //SAVE FINALY
506
+ jQuery("#agca_templates_form").submit();
507
+ }
508
+
509
+ function agca_updateInstallProgress(){
510
+ agcaDebug('FN:agca_updateInstallProgress()');
511
+ agca_local_images_count++;
512
+ var current = agca_remote_images_count - agca_local_images_count;
513
+ var proc= (agca_local_images_count / (parseInt(agca_remote_images_count)-1)).toFixed(2) * 100;
514
+
515
+ agcaProgress('Installing ('+proc+'%) ...');
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()');
538
+
539
+ //agcaDebug('templates data');
540
+ //agcaDebug(jQuery("#templates_data").val());
541
+ //upload remote images on callback
542
+ if(typeof agca_remote_images != 'undefined'){
543
+ agca_uploadRemoteImages();
544
+ }else{
545
+ jQuery("#templates_data").val(jQuery("#templates_data").val()+"|||");
546
+
547
+ //SAVE FINALY PAYED
548
+ jQuery("#agca_templates_form").submit();
549
+ }
550
+ }
551
+
552
+ function agca_uploadRemoteImages(){
553
+ agcaDebug('FN:agca_uploadRemoteImages()');
554
+ var found = false;
555
+ for(var tag in agca_remote_images){
556
+ found = true;
557
+ agca_updateInstallProgress();
558
+ agca_uploadRemoteImage(agca_remote_images[tag], tag);
559
+ break;
560
+ }
561
+ if(!found){
562
+ //jQuery('.agca_content #activating').text('Installation successful. Reloading...');
563
+ agcaProgress('Installation successful. Reloading...');
564
+ window.setTimeout(handleLocalyStoredImages,2000);
565
+ }
566
+ }
567
+
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
+ });
583
+ }
584
+
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
+ });
600
+ }
601
+ function agca_error(data){
602
+ agcaDebug("FN:agca_error()");
603
+ clearTimeout(agcaLoadingTimeOut);
604
+ if(jQuery('#agca_templates p:first').hasClass('initialLoader')){
605
+ jQuery('#agca_templates p:first').text('Unable to load themes. Please submit this error to AGCA support. Thank you!');
606
+ }
607
+ alert('AG CUSTOM ADMIN TEMPLATE - ERROR\n\nError occured while loading configuration:\n'+data.url+'\n\n'+data.data);
608
+ }
609
+
610
+ //check if templates loaded
611
+ function checkIfTemplatesAreLoaded(pass){
612
+ agcaDebug('FN:checkIfTemplatesAreLoaded('+pass+')');
613
+ if(pass == 1){
614
+ agcaLoadingTimeOut = window.setTimeout(function(){
615
+ if(jQuery('#agca_templates p:first').hasClass('initialLoader')){
616
+ jQuery('#agca_templates p:first').text('Loading, please wait...');
617
+ checkIfTemplatesAreLoaded(2);
618
+ }
619
+ },6000);
620
+
621
+ }else if(pass == 2){
622
+ agcaLoadingTimeOut = window.setTimeout(function(){
623
+ if(jQuery('#agca_templates p:first').hasClass('initialLoader')){
624
+ jQuery('#agca_templates p:first').text('Ready in a few moments...');
625
+ checkIfTemplatesAreLoaded(3);
626
+ }
627
+ },6000);
628
+
629
+ }
630
+ else if(pass == 3){
631
+ agcaLoadingTimeOut = window.setTimeout(function(){
632
+ if(jQuery('#agca_templates p:first').hasClass('initialLoader')){
633
+ jQuery('#agca_templates p:first').text('This takes a bit longer than usual, please wait...');
634
+ checkIfTemplatesAreLoaded(4);
635
+ }
636
+ },7000);
637
+ }
638
+ else if(pass == 4){
639
+ agcaLoadingTimeOut = window.setTimeout(function(){
640
+ if(jQuery('#agca_templates p:first').hasClass('initialLoader')){
641
+ jQuery('#agca_templates p:first').html('Sorry, unable to load themes right now. Please try again later.</br>We recommend using only latest browsers for theme management.');
642
+ agcaDebug('ERR:Unable to load themes');
643
+ }
644
+ },10000);
645
+ }
646
+ }
647
+
648
+ function agcaTemplatesSessionIsLicenseSet(template){
649
+ agcaDebug("FN:agcaTemplatesSessionIsLicenseSet(" + template + ")");
650
+ if(agcaTemplatesSession[template] != null && agcaTemplatesSession[template]["license"] != null){
651
+ return true;
652
+ }
653
+ return false;
654
+ }
655
+
656
+ function agcaTemplatesSessionGetLicenseKey(template){
657
+ agcaDebug("FN:agcaTemplatesSessionGetLicenseKey(" + template + ")");
658
+ if(agcaTemplatesSession[template] != null && agcaTemplatesSession[template]["license"] != null){
659
+ return agcaTemplatesSession[template]["license"];
660
+ }
661
+ return "";
662
+ }
663
+
664
+ function agcaTemplatesSessionAdd(template, license, callback){
665
+ agcaDebug("FN:agcaTemplatesSessionAdd(" + template + ", " + license + ", callback)");
666
+ if(callback == null){
667
+ callback = function(){};
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
+ //agcaTemplatesSession
682
+ }
683
+
684
+ function agcaTemplatesSessionRemove(template, callback){
685
+ agcaDebug("FN:agcaTemplatesSessionRemove(" + template + ", callback)");
686
+ if(callback == null){
687
+ callback = function(){};
688
+ }
689
+ agcaTemplatesSession[template]["license"] = null;
690
+ jQuery.ajax({
691
+ type: "POST",
692
+ url: window.location,
693
+ data: {
694
+ "_agca_templates_session_remove_license" : "true",
695
+ "template":template
696
+ },
697
+ success: callback
698
+ });
699
+ }
700
+
701
+
702
+ /*FAQ: Invalid template license key: reopen browser and add key again,
703
+ Wrong or expired license key. You can still use your template, but updates are not available any more.(1): reopen broeser
704
+ */
705
+
706
+ /*countdown*/
707
+ function agcaCountDownTimer(now, expire, id)
708
+ {
709
+ var _second = 1;
710
+ var _minute = _second * 60;
711
+ var _hour = _minute * 60;
712
+ var _day = _hour * 24;
713
+ var _year = _day * 365;
714
+
715
+ var nowParts = now.split('-');
716
+ var expireParts = expire.split('-');
717
+ var timer;
718
+ var diff = expire - now;
719
+
720
+ function showRemaining(df) {
721
+ diff = diff-1;
722
+ //console.log(diff);
723
+
724
+ var days = Math.floor((diff % _year) / _day);
725
+ var hours = Math.floor((diff % _day) / _hour);
726
+ var minutes = Math.floor((diff % _hour) / _minute);
727
+ var seconds = Math.floor((diff % _minute) / _second);
728
+ var str = days +"d " + hours +"h "+ minutes +"min "+ seconds+"sec";
729
+ jQuery(id+" .countdown").html("Available only for:</br>" + str);
730
+ if (diff < 0) {
731
+ clearInterval(timer);
732
+ jQuery(id+" .countdown").html("</br>About to expire...");
733
+ return;
734
+ }
735
+ }
736
+ timer = setInterval(function(){
737
+ showRemaining(diff);
738
+ }, 1000);
739
+ }
script/xd.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(N,d,p,K,k,H){var b=this;var n=Math.floor(Math.random()*10000);var q=Function.prototype;var Q=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/;var R=/[\-\w]+\/\.\.\//;var F=/([^:])\/\//g;var I="";var o={};var M=N.easyXDM;var U="easyXDM_";var E;var y=false;var i;var h;function C(X,Z){var Y=typeof X[Z];return Y=="function"||(!!(Y=="object"&&X[Z]))||Y=="unknown"}function u(X,Y){return !!(typeof(X[Y])=="object"&&X[Y])}function r(X){return Object.prototype.toString.call(X)==="[object Array]"}function c(){try{var X=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");i=Array.prototype.slice.call(X.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1);h=parseInt(i[0],10)>9&&parseInt(i[1],10)>0;X=null;return true}catch(Y){return false}}var v,x;if(C(N,"addEventListener")){v=function(Z,X,Y){Z.addEventListener(X,Y,false)};x=function(Z,X,Y){Z.removeEventListener(X,Y,false)}}else{if(C(N,"attachEvent")){v=function(X,Z,Y){X.attachEvent("on"+Z,Y)};x=function(X,Z,Y){X.detachEvent("on"+Z,Y)}}else{throw new Error("Browser not supported")}}var W=false,J=[],L;if("readyState" in d){L=d.readyState;W=L=="complete"||(~navigator.userAgent.indexOf("AppleWebKit/")&&(L=="loaded"||L=="interactive"))}else{W=!!d.body}function s(){if(W){return}W=true;for(var X=0;X<J.length;X++){J[X]()}J.length=0}if(!W){if(C(N,"addEventListener")){v(d,"DOMContentLoaded",s)}else{v(d,"readystatechange",function(){if(d.readyState=="complete"){s()}});if(d.documentElement.doScroll&&N===top){var g=function(){if(W){return}try{d.documentElement.doScroll("left")}catch(X){K(g,1);return}s()};g()}}v(N,"load",s)}function G(Y,X){if(W){Y.call(X);return}J.push(function(){Y.call(X)})}function m(){var Z=parent;if(I!==""){for(var X=0,Y=I.split(".");X<Y.length;X++){Z=Z[Y[X]]}}return Z.easyXDM}function e(X){N.easyXDM=M;I=X;if(I){U="easyXDM_"+I.replace(".","_")+"_"}return o}function z(X){return X.match(Q)[3]}function f(X){return X.match(Q)[4]||""}function j(Z){Z=Z.replace('htttp','http');var X=Z.toLowerCase().match(Q);var aa=X[2],ab=X[3],Y=X[4]||"";if((aa=="http:"&&Y==":80")||(aa=="https:"&&Y==":443")){Y=""}return aa+"//"+ab+Y}function B(X){X=X.replace(F,"$1/");if(!X.match(/^(http||https):\/\//)){var Y=(X.substring(0,1)==="/")?"":p.pathname;if(Y.substring(Y.length-1)!=="/"){Y=Y.substring(0,Y.lastIndexOf("/")+1)}X=p.protocol+"//"+p.host+Y+X}while(R.test(X)){X=X.replace(R,"")}return X}function P(X,aa){var ac="",Z=X.indexOf("#");if(Z!==-1){ac=X.substring(Z);X=X.substring(0,Z)}var ab=[];for(var Y in aa){if(aa.hasOwnProperty(Y)){ab.push(Y+"="+H(aa[Y]))}}return X+(y?"#":(X.indexOf("?")==-1?"?":"&"))+ab.join("&")+ac}var S=(function(X){X=X.substring(1).split("&");var Z={},aa,Y=X.length;while(Y--){aa=X[Y].split("=");Z[aa[0]]=k(aa[1])}return Z}(/xdm_e=/.test(p.search)?p.search:p.hash));function t(X){return typeof X==="undefined"}var O=function(){var Y={};var Z={a:[1,2,3]},X='{"a":[1,2,3]}';if(typeof JSON!="undefined"&&typeof JSON.stringify==="function"&&JSON.stringify(Z).replace((/\s/g),"")===X){return JSON}if(Object.toJSON){if(Object.toJSON(Z).replace((/\s/g),"")===X){Y.stringify=Object.toJSON}}if(typeof String.prototype.evalJSON==="function"){Z=X.evalJSON();if(Z.a&&Z.a.length===3&&Z.a[2]===3){Y.parse=function(aa){return aa.evalJSON()}}}if(Y.stringify&&Y.parse){O=function(){return Y};return Y}return null};function T(X,Y,Z){var ab;for(var aa in Y){if(Y.hasOwnProperty(aa)){if(aa in X){ab=Y[aa];if(typeof ab==="object"){T(X[aa],ab,Z)}else{if(!Z){X[aa]=Y[aa]}}}else{X[aa]=Y[aa]}}}return X}function a(){var Y=d.body.appendChild(d.createElement("form")),X=Y.appendChild(d.createElement("input"));X.name=U+"TEST"+n;E=X!==Y.elements[X.name];d.body.removeChild(Y)}function A(X){X.props.src=X.props.src.replace("xdm_e=http","xdm_e=htttp");if(t(E)){a()}var Z;if(E){Z=d.createElement('<iframe name="'+X.props.name+'"/>')}else{Z=d.createElement("IFRAME");Z.name=X.props.name}Z.id=Z.name=X.props.name;delete X.props.name;if(X.onLoad){v(Z,"load",X.onLoad)}if(typeof X.container=="string"){X.container=d.getElementById(X.container)}if(!X.container){T(Z.style,{position:"absolute",top:"-2000px"});X.container=d.body}var Y=X.props.src;delete X.props.src;T(Z,X.props);Z.border=Z.frameBorder=0;Z.allowTransparency=true;X.container.appendChild(Z);Z.src=Y;X.props.src=Y;return Z}function V(aa,Z){if(typeof aa=="string"){aa=[aa]}var Y,X=aa.length;while(X--){Y=aa[X];Y=new RegExp(Y.substr(0,1)=="^"?Y:("^"+Y.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"));if(Y.test(Z)){return true}}return false}function l(Z){var ae=Z.protocol,Y;Z.isHost=Z.isHost||t(S.xdm_p);y=Z.hash||false;if(!Z.props){Z.props={}}if(!Z.isHost){Z.channel=S.xdm_c;Z.secret=S.xdm_s;Z.remote=S.xdm_e;ae=S.xdm_p;if(Z.acl&&!V(Z.acl,Z.remote)){throw new Error("Access denied for "+Z.remote)}}else{Z.remote=B(Z.remote);Z.channel=Z.channel||"default"+n++;Z.secret=Math.random().toString(16).substring(2);if(t(ae)){if(j(p.href)==j(Z.remote)){ae="4"}else{if(C(N,"postMessage")||C(d,"postMessage")){ae="1"}else{if(Z.swf&&C(N,"ActiveXObject")&&c()){ae="6"}else{if(navigator.product==="Gecko"&&"frameElement" in N&&navigator.userAgent.indexOf("WebKit")==-1){ae="5"}else{if(Z.remoteHelper){Z.remoteHelper=B(Z.remoteHelper);ae="2"}else{ae="0"}}}}}}}Z.protocol=ae;switch(ae){case"0":T(Z,{interval:100,delay:2000,useResize:true,useParent:false,usePolling:false},true);if(Z.isHost){if(!Z.local){var ac=p.protocol+"//"+p.host,X=d.body.getElementsByTagName("img"),ad;var aa=X.length;while(aa--){ad=X[aa];if(ad.src.substring(0,ac.length)===ac){Z.local=ad.src;break}}if(!Z.local){Z.local=N}}var ab={xdm_c:Z.channel,xdm_p:0};if(Z.local===N){Z.usePolling=true;Z.useParent=true;Z.local=p.protocol+"//"+p.host+p.pathname+p.search;ab.xdm_e=Z.local;ab.xdm_pa=1}else{ab.xdm_e=B(Z.local)}if(Z.container){Z.useResize=false;ab.xdm_po=1}Z.remote=P(Z.remote,ab)}else{T(Z,{channel:S.xdm_c,remote:S.xdm_e,useParent:!t(S.xdm_pa),usePolling:!t(S.xdm_po),useResize:Z.useParent?false:Z.useResize})}Y=[new o.stack.HashTransport(Z),new o.stack.ReliableBehavior({}),new o.stack.QueueBehavior({encode:true,maxLength:4000-Z.remote.length}),new o.stack.VerifyBehavior({initiate:Z.isHost})];break;case"1":Y=[new o.stack.PostMessageTransport(Z)];break;case"2":Y=[new o.stack.NameTransport(Z),new o.stack.QueueBehavior(),new o.stack.VerifyBehavior({initiate:Z.isHost})];break;case"3":Y=[new o.stack.NixTransport(Z)];break;case"4":Y=[new o.stack.SameOriginTransport(Z)];break;case"5":Y=[new o.stack.FrameElementTransport(Z)];break;case"6":if(!i){c()}Y=[new o.stack.FlashTransport(Z)];break}Y.push(new o.stack.QueueBehavior({lazy:Z.lazy,remove:true}));return Y}function D(aa){var ab,Z={incoming:function(ad,ac){this.up.incoming(ad,ac)},outgoing:function(ac,ad){this.down.outgoing(ac,ad)},callback:function(ac){this.up.callback(ac)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}};for(var Y=0,X=aa.length;Y<X;Y++){ab=aa[Y];T(ab,Z,true);if(Y!==0){ab.down=aa[Y-1]}if(Y!==X-1){ab.up=aa[Y+1]}}return ab}function w(X){X.up.down=X.down;X.down.up=X.up;X.up=X.down=null}T(o,{version:"2.4.15.118",query:S,stack:{},apply:T,getJSONObject:O,whenReady:G,noConflict:e});o.DomHelper={on:v,un:x,requiresJSON:function(X){if(!u(N,"JSON")){d.write('<script type="text/javascript" src="'+X+'"><\/script>')}}};(function(){var X={};o.Fn={set:function(Y,Z){X[Y]=Z},get:function(Z,Y){var aa=X[Z];if(Y){delete X[Z]}return aa}}}());o.Socket=function(Y){var X=D(l(Y).concat([{incoming:function(ab,aa){Y.onMessage(ab,aa)},callback:function(aa){if(Y.onReady){Y.onReady(aa)}}}])),Z=j(Y.remote);this.origin=j(Y.remote);this.destroy=function(){X.destroy()};this.postMessage=function(aa){X.outgoing(aa,Z)};X.init()};o.Rpc=function(Z,Y){if(Y.local){for(var ab in Y.local){if(Y.local.hasOwnProperty(ab)){var aa=Y.local[ab];if(typeof aa==="function"){Y.local[ab]={method:aa}}}}}var X=D(l(Z).concat([new o.stack.RpcBehavior(this,Y),{callback:function(ac){if(Z.onReady){Z.onReady(ac)}}}]));this.origin=j(Z.remote);this.destroy=function(){X.destroy()};X.init()};o.stack.SameOriginTransport=function(Y){var Z,ab,aa,X;return(Z={outgoing:function(ad,ae,ac){aa(ad);if(ac){ac()}},destroy:function(){if(ab){ab.parentNode.removeChild(ab);ab=null}},onDOMReady:function(){X=j(Y.remote);if(Y.isHost){T(Y.props,{src:P(Y.remote,{xdm_e:p.protocol+"//"+p.host+p.pathname,xdm_c:Y.channel,xdm_p:4}),name:U+Y.channel+"_provider"});ab=A(Y);o.Fn.set(Y.channel,function(ac){aa=ac;K(function(){Z.up.callback(true)},0);return function(ad){Z.up.incoming(ad,X)}})}else{aa=m().Fn.get(Y.channel,true)(function(ac){Z.up.incoming(ac,X)});K(function(){Z.up.callback(true)},0)}},init:function(){G(Z.onDOMReady,Z)}})};o.stack.FlashTransport=function(aa){var ac,X,ab,ad,Y,ae;function af(ah,ag){K(function(){ac.up.incoming(ah,ad)},0)}function Z(ah){var ag=aa.swf+"?host="+aa.isHost;var aj="easyXDM_swf_"+Math.floor(Math.random()*10000);o.Fn.set("flash_loaded"+ah.replace(/[\-.]/g,"_"),function(){o.stack.FlashTransport[ah].swf=Y=ae.firstChild;var ak=o.stack.FlashTransport[ah].queue;for(var al=0;al<ak.length;al++){ak[al]()}ak.length=0});if(aa.swfContainer){ae=(typeof aa.swfContainer=="string")?d.getElementById(aa.swfContainer):aa.swfContainer}else{ae=d.createElement("div");T(ae.style,h&&aa.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0});d.body.appendChild(ae)}var ai="callback=flash_loaded"+ah.replace(/[\-.]/g,"_")+"&proto="+b.location.protocol+"&domain="+z(b.location.href)+"&port="+f(b.location.href)+"&ns="+I;ae.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+aj+"' data='"+ag+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+ag+"'></param><param name='flashvars' value='"+ai+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+ai+"' allowScriptAccess='always' wmode='transparent' src='"+ag+"' height='1' width='1'></embed></object>"}return(ac={outgoing:function(ah,ai,ag){Y.postMessage(aa.channel,ah.toString());if(ag){ag()}},destroy:function(){try{Y.destroyChannel(aa.channel)}catch(ag){}Y=null;if(X){X.parentNode.removeChild(X);X=null}},onDOMReady:function(){ad=aa.remote;o.Fn.set("flash_"+aa.channel+"_init",function(){K(function(){ac.up.callback(true)})});o.Fn.set("flash_"+aa.channel+"_onMessage",af);aa.swf=B(aa.swf);var ah=z(aa.swf);var ag=function(){o.stack.FlashTransport[ah].init=true;Y=o.stack.FlashTransport[ah].swf;Y.createChannel(aa.channel,aa.secret,j(aa.remote),aa.isHost);if(aa.isHost){if(h&&aa.swfNoThrottle){T(aa.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"})}T(aa.props,{src:P(aa.remote,{xdm_e:j(p.href),xdm_c:aa.channel,xdm_p:6,xdm_s:aa.secret}),name:U+aa.channel+"_provider"});X=A(aa)}};if(o.stack.FlashTransport[ah]&&o.stack.FlashTransport[ah].init){ag()}else{if(!o.stack.FlashTransport[ah]){o.stack.FlashTransport[ah]={queue:[ag]};Z(ah)}else{o.stack.FlashTransport[ah].queue.push(ag)}}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.PostMessageTransport=function(aa){var ac,ad,Y,Z;function X(ae){if(ae.origin){return j(ae.origin)}if(ae.uri){return j(ae.uri)}if(ae.domain){return p.protocol+"//"+ae.domain}throw"Unable to retrieve the origin of the event"}function ab(af){var ae=X(af);if(ae==Z&&af.data.substring(0,aa.channel.length+1)==aa.channel+" "){ac.up.incoming(af.data.substring(aa.channel.length+1),ae)}}return(ac={outgoing:function(af,ag,ae){Y.postMessage(aa.channel+" "+af,ag||Z);if(ae){ae()}},destroy:function(){x(N,"message",ab);if(ad){Y=null;ad.parentNode.removeChild(ad);ad=null}},onDOMReady:function(){Z=j(aa.remote);if(aa.isHost){var ae=function(af){if(af.data==aa.channel+"-ready"){Y=("postMessage" in ad.contentWindow)?ad.contentWindow:ad.contentWindow.document;x(N,"message",ae);v(N,"message",ab);K(function(){ac.up.callback(true)},0)}};v(N,"message",ae);T(aa.props,{src:P(aa.remote,{xdm_e:j(p.href),xdm_c:aa.channel,xdm_p:1}),name:U+aa.channel+"_provider"});ad=A(aa)}else{v(N,"message",ab);Y=("postMessage" in N.parent)?N.parent:N.parent.document;Y.postMessage(aa.channel+"-ready",Z);K(function(){ac.up.callback(true)},0)}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.FrameElementTransport=function(Y){var Z,ab,aa,X;return(Z={outgoing:function(ad,ae,ac){aa.call(this,ad);if(ac){ac()}},destroy:function(){if(ab){ab.parentNode.removeChild(ab);ab=null}},onDOMReady:function(){X=j(Y.remote);if(Y.isHost){T(Y.props,{src:P(Y.remote,{xdm_e:j(p.href),xdm_c:Y.channel,xdm_p:5}),name:U+Y.channel+"_provider"});ab=A(Y);ab.fn=function(ac){delete ab.fn;aa=ac;K(function(){Z.up.callback(true)},0);return function(ad){Z.up.incoming(ad,X)}}}else{if(d.referrer&&j(d.referrer)!=S.xdm_e){N.top.location=S.xdm_e}aa=N.frameElement.fn(function(ac){Z.up.incoming(ac,X)});Z.up.callback(true)}},init:function(){G(Z.onDOMReady,Z)}})};o.stack.NameTransport=function(ab){var ac;var ae,ai,aa,ag,ah,Y,X;function af(al){var ak=ab.remoteHelper+(ae?"#_3":"#_2")+ab.channel;ai.contentWindow.sendMessage(al,ak)}function ad(){if(ae){if(++ag===2||!ae){ac.up.callback(true)}}else{af("ready");ac.up.callback(true)}}function aj(ak){ac.up.incoming(ak,Y)}function Z(){if(ah){K(function(){ah(true)},0)}}return(ac={outgoing:function(al,am,ak){ah=ak;af(al)},destroy:function(){ai.parentNode.removeChild(ai);ai=null;if(ae){aa.parentNode.removeChild(aa);aa=null}},onDOMReady:function(){ae=ab.isHost;ag=0;Y=j(ab.remote);ab.local=B(ab.local);if(ae){o.Fn.set(ab.channel,function(al){if(ae&&al==="ready"){o.Fn.set(ab.channel,aj);ad()}});X=P(ab.remote,{xdm_e:ab.local,xdm_c:ab.channel,xdm_p:2});T(ab.props,{src:X+"#"+ab.channel,name:U+ab.channel+"_provider"});aa=A(ab)}else{ab.remoteHelper=ab.remote;o.Fn.set(ab.channel,aj)}ai=A({props:{src:ab.local+"#_4"+ab.channel},onLoad:function ak(){var al=ai||this;x(al,"load",ak);o.Fn.set(ab.channel+"_load",Z);(function am(){if(typeof al.contentWindow.sendMessage=="function"){ad()}else{K(am,50)}}())}})},init:function(){G(ac.onDOMReady,ac)}})};o.stack.HashTransport=function(Z){var ac;var ah=this,af,aa,X,ad,am,ab,al;var ag,Y;function ak(ao){if(!al){return}var an=Z.remote+"#"+(am++)+"_"+ao;((af||!ag)?al.contentWindow:al).location=an}function ae(an){ad=an;ac.up.incoming(ad.substring(ad.indexOf("_")+1),Y)}function aj(){if(!ab){return}var an=ab.location.href,ap="",ao=an.indexOf("#");if(ao!=-1){ap=an.substring(ao)}if(ap&&ap!=ad){ae(ap)}}function ai(){aa=setInterval(aj,X)}return(ac={outgoing:function(an,ao){ak(an)},destroy:function(){N.clearInterval(aa);if(af||!ag){al.parentNode.removeChild(al)}al=null},onDOMReady:function(){af=Z.isHost;X=Z.interval;ad="#"+Z.channel;am=0;ag=Z.useParent;Y=j(Z.remote);if(af){Z.props={src:Z.remote,name:U+Z.channel+"_provider"};if(ag){Z.onLoad=function(){ab=N;ai();ac.up.callback(true)}}else{var ap=0,an=Z.delay/50;(function ao(){if(++ap>an){throw new Error("Unable to reference listenerwindow")}try{ab=al.contentWindow.frames[U+Z.channel+"_consumer"]}catch(aq){}if(ab){ai();ac.up.callback(true)}else{K(ao,50)}}())}al=A(Z)}else{ab=N;ai();if(ag){al=parent;ac.up.callback(true)}else{T(Z,{props:{src:Z.remote+"#"+Z.channel+new Date(),name:U+Z.channel+"_consumer"},onLoad:function(){ac.up.callback(true)}});al=A(Z)}}},init:function(){G(ac.onDOMReady,ac)}})};o.stack.ReliableBehavior=function(Y){var aa,ac;var ab=0,X=0,Z="";return(aa={incoming:function(af,ad){var ae=af.indexOf("_"),ag=af.substring(0,ae).split(",");af=af.substring(ae+1);if(ag[0]==ab){Z="";if(ac){ac(true)}}if(af.length>0){aa.down.outgoing(ag[1]+","+ab+"_"+Z,ad);if(X!=ag[1]){X=ag[1];aa.up.incoming(af,ad)}}},outgoing:function(af,ad,ae){Z=af;ac=ae;aa.down.outgoing(X+","+(++ab)+"_"+af,ad)}})};o.stack.QueueBehavior=function(Z){var ac,ad=[],ag=true,aa="",af,X=0,Y=false,ab=false;function ae(){if(Z.remove&&ad.length===0){w(ac);return}if(ag||ad.length===0||af){return}ag=true;var ah=ad.shift();ac.down.outgoing(ah.data,ah.origin,function(ai){ag=false;if(ah.callback){K(function(){ah.callback(ai)},0)}ae()})}return(ac={init:function(){if(t(Z)){Z={}}if(Z.maxLength){X=Z.maxLength;ab=true}if(Z.lazy){Y=true}else{ac.down.init()}},callback:function(ai){ag=false;var ah=ac.up;ae();ah.callback(ai)},incoming:function(ak,ai){if(ab){var aj=ak.indexOf("_"),ah=parseInt(ak.substring(0,aj),10);aa+=ak.substring(aj+1);if(ah===0){if(Z.encode){aa=k(aa)}ac.up.incoming(aa,ai);aa=""}}else{ac.up.incoming(ak,ai)}},outgoing:function(al,ai,ak){if(Z.encode){al=H(al)}var ah=[],aj;if(ab){while(al.length!==0){aj=al.substring(0,X);al=al.substring(aj.length);ah.push(aj)}while((aj=ah.shift())){ad.push({data:ah.length+"_"+aj,origin:ai,callback:ah.length===0?ak:null})}}else{ad.push({data:al,origin:ai,callback:ak})}if(Y){ac.down.init()}else{ae()}},destroy:function(){af=true;ac.down.destroy()}})};o.stack.VerifyBehavior=function(ab){var ac,aa,Y,Z=false;function X(){aa=Math.random().toString(16).substring(2);ac.down.outgoing(aa)}return(ac={incoming:function(af,ad){var ae=af.indexOf("_");if(ae===-1){if(af===aa){ac.up.callback(true)}else{if(!Y){Y=af;if(!ab.initiate){X()}ac.down.outgoing(af)}}}else{if(af.substring(0,ae)===Y){ac.up.incoming(af.substring(ae+1),ad)}}},outgoing:function(af,ad,ae){ac.down.outgoing(aa+"_"+af,ad,ae)},callback:function(ad){if(ab.initiate){X()}}})};o.stack.RpcBehavior=function(ad,Y){var aa,af=Y.serializer||O();var ae=0,ac={};function X(ag){ag.jsonrpc="2.0";aa.down.outgoing(af.stringify(ag))}function ab(ag,ai){var ah=Array.prototype.slice;return function(){var aj=arguments.length,al,ak={method:ai};if(aj>0&&typeof arguments[aj-1]==="function"){if(aj>1&&typeof arguments[aj-2]==="function"){al={success:arguments[aj-2],error:arguments[aj-1]};ak.params=ah.call(arguments,0,aj-2)}else{al={success:arguments[aj-1]};ak.params=ah.call(arguments,0,aj-1)}ac[""+(++ae)]=al;ak.id=ae}else{ak.params=ah.call(arguments,0)}if(ag.namedParams&&ak.params.length===1){ak.params=ak.params[0]}X(ak)}}function Z(an,am,ai,al){if(!ai){if(am){X({id:am,error:{code:-32601,message:"Procedure not found."}})}return}var ak,ah;if(am){ak=function(ao){ak=q;X({id:am,result:ao})};ah=function(ao,ap){ah=q;var aq={id:am,error:{code:-32099,message:ao}};if(ap){aq.error.data=ap}X(aq)}}else{ak=ah=q}if(!r(al)){al=[al]}try{var ag=ai.method.apply(ai.scope,al.concat([ak,ah]));if(!t(ag)){ak(ag)}}catch(aj){ah(aj.message)}}return(aa={incoming:function(ah,ag){var ai=af.parse(ah);if(ai.method){if(Y.handle){Y.handle(ai,X)}else{Z(ai.method,ai.id,Y.local[ai.method],ai.params)}}else{var aj=ac[ai.id];if(ai.error){if(aj.error){aj.error(ai.error)}}else{if(aj.success){aj.success(ai.result)}}delete ac[ai.id]}},init:function(){if(Y.remote){for(var ag in Y.remote){if(Y.remote.hasOwnProperty(ag)){ad[ag]=ab(Y.remote[ag],ag)}}}aa.down.init()},destroy:function(){for(var ag in Y.remote){if(Y.remote.hasOwnProperty(ag)&&ad.hasOwnProperty(ag)){delete ad[ag]}}aa.down.destroy()}})};b.easyXDM=o})(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);
style/ag_style.css CHANGED
@@ -1,6 +1,6 @@
1
  #ag_main_menu {
2
  display:block;
3
- height:32px;
4
  border-bottom:3px solid green;
5
  margin-top:2px;
6
  }
@@ -125,6 +125,22 @@ td.ag_admin_menu_parent:hover{
125
  #agca_form .section_title{
126
  font-weight:bold;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  .ag-custom-button{
129
 
130
  /* margin-bottom:-4px !important;*/
@@ -182,6 +198,9 @@ td.ag_admin_menu_parent:hover{
182
  #agca_form textarea{
183
  width:400px;
184
  }
 
 
 
185
  #agca_form textarea:hover{
186
  background-color: #efffef;
187
  }
@@ -223,6 +242,62 @@ td.ag_admin_menu_parent:hover{
223
  .agca_editor{
224
  width:600px;
225
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  .agca_logout_button{
227
  background: none repeat scroll 0 0 #dddddd;
228
  float: right;
@@ -315,4 +390,7 @@ td.ag_admin_menu_parent:hover{
315
  }
316
  #agca_form .agca-radiobox.checked[value=off]{
317
  background:url(../images/radio-off.png);
 
 
 
318
  }
1
  #ag_main_menu {
2
  display:block;
3
+ height:35px;
4
  border-bottom:3px solid green;
5
  margin-top:2px;
6
  }
125
  #agca_form .section_title{
126
  font-weight:bold;
127
  }
128
+ #section_templates h2.section_title{
129
+ float: left;
130
+ font-size: 35px;
131
+ text-shadow:none;
132
+ margin-left: 8px;
133
+ }
134
+ #agca_form #templates_head_buttons input[type=button]{
135
+ background:#174F69;
136
+ color:white;
137
+ font-weight:bold;
138
+ }
139
+ #agca_form #templates_head_buttons input[type=button]:hover{
140
+ background:white;
141
+ color:#174F69;
142
+ }
143
+
144
  .ag-custom-button{
145
 
146
  /* margin-bottom:-4px !important;*/
198
  #agca_form textarea{
199
  width:400px;
200
  }
201
+ #agca_form textarea.wp-editor-area{
202
+ width:100%;
203
+ }
204
  #agca_form textarea:hover{
205
  background-color: #efffef;
206
  }
242
  .agca_editor{
243
  width:600px;
244
  }
245
+
246
+ /*templates*/
247
+ #agca_templates .error{
248
+ padding:8px;
249
+ font-size: 14px;
250
+ }
251
+
252
+ .agca_template{
253
+ display:block;
254
+ float:left;
255
+ border:3px solid #aaa;
256
+ margin:10px;
257
+ margin-top:15px;
258
+ cursor:pointer;
259
+ }
260
+ .agca_template:hover{
261
+ border:3px solid green;
262
+ }
263
+ .agca_template h3{
264
+ text-align: center;
265
+ color:green;
266
+ }
267
+ .agca_template h3 span{
268
+ color:#555;
269
+ font-size:16px;
270
+ }
271
+ .agca_template img{
272
+ width:250px;
273
+ }
274
+
275
+ #advanced_template_options {
276
+ background: none repeat scroll 0 0 #EEEEEE;
277
+ border: 2px solid green;
278
+ display: block;
279
+ height: 100%;
280
+ margin-top: 200px;
281
+ width: 500px;
282
+ padding:15px;
283
+ display:none;
284
+ }
285
+ #advanced_template_options a{
286
+ font-size:14px;
287
+ font-weight: bold;
288
+ text-decoration:none;
289
+ }
290
+ #advanced_template_options a:hover{
291
+ text-decoration:underline;
292
+ }
293
+ #advanced_template_options h4 {
294
+ background: none repeat scroll 0 0 green;
295
+ color: #FFFFFF;
296
+ font-size: 22px;
297
+ font-weight: bold;
298
+ margin-top: 0;
299
+ padding: 10px;
300
+ }
301
  .agca_logout_button{
302
  background: none repeat scroll 0 0 #dddddd;
303
  float: right;
390
  }
391
  #agca_form .agca-radiobox.checked[value=off]{
392
  background:url(../images/radio-off.png);
393
+ }
394
+ #agca_form #section_templates{
395
+ background: rgba(255, 255, 255, 0.95)
396
  }
uninstall.php CHANGED
@@ -3,8 +3,8 @@
3
  if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
4
  exit ();
5
 
6
- delete_option( 'agca_role_allbutadmin' );
7
- delete_option( 'agca_screen_options_menu' );
8
  delete_option( 'agca_help_menu' );
9
  delete_option( 'agca_logout' );
10
  delete_option( 'agca_remove_your_profile' );
@@ -39,8 +39,7 @@
39
  delete_option( 'agca_dashboard_icon' );
40
  delete_option( 'agca_dashboard_text' );
41
  delete_option( 'agca_dashboard_text_paragraph' );
42
- delete_option( 'agca_dashboard_widget_welcome' );
43
- delete_option( 'agca_dashboard_widget_rc' );
44
  delete_option( 'agca_dashboard_widget_il' );
45
  delete_option( 'agca_dashboard_widget_plugins' );
46
  delete_option( 'agca_dashboard_widget_qp' );
@@ -48,6 +47,7 @@
48
  delete_option( 'agca_dashboard_widget_rd' );
49
  delete_option( 'agca_dashboard_widget_primary' );
50
  delete_option( 'agca_dashboard_widget_secondary' );
 
51
 
52
  //WP3.3
53
  delete_option( 'agca_admin_bar_comments' );
@@ -70,8 +70,8 @@
70
  delete_option( 'agca_admin_menu_submenu_round' );
71
  delete_option( 'agca_admin_menu_submenu_round_size' );
72
  delete_option( 'agca_admin_menu_brand' );
73
- delete_option( 'agca_admin_menu_brand_link' );
74
- delete_option( 'agca_admin_menu_autofold' );
75
  delete_option( 'ag_edit_adminmenu_json' );
76
  delete_option( 'ag_add_adminmenu_json' );
77
  delete_option( 'ag_colorizer_json' );
@@ -80,6 +80,8 @@
80
  delete_option( 'agca_custom_js' );
81
  delete_option( 'agca_custom_css' );
82
 
83
- delete_option( 'agca_disablewarning' );
84
- ?>
85
-
 
 
3
  if( !defined( 'WP_UNINSTALL_PLUGIN' ) )
4
  exit ();
5
 
6
+ delete_option( 'agca_role_allbutadmin' );
7
+ delete_option( 'agca_screen_options_menu' );
8
  delete_option( 'agca_help_menu' );
9
  delete_option( 'agca_logout' );
10
  delete_option( 'agca_remove_your_profile' );
39
  delete_option( 'agca_dashboard_icon' );
40
  delete_option( 'agca_dashboard_text' );
41
  delete_option( 'agca_dashboard_text_paragraph' );
42
+ delete_option( 'agca_dashboard_widget_welcome' );
 
43
  delete_option( 'agca_dashboard_widget_il' );
44
  delete_option( 'agca_dashboard_widget_plugins' );
45
  delete_option( 'agca_dashboard_widget_qp' );
47
  delete_option( 'agca_dashboard_widget_rd' );
48
  delete_option( 'agca_dashboard_widget_primary' );
49
  delete_option( 'agca_dashboard_widget_secondary' );
50
+ delete_option( 'agca_dashboard_widget_activity' );
51
 
52
  //WP3.3
53
  delete_option( 'agca_admin_bar_comments' );
70
  delete_option( 'agca_admin_menu_submenu_round' );
71
  delete_option( 'agca_admin_menu_submenu_round_size' );
72
  delete_option( 'agca_admin_menu_brand' );
73
+ delete_option( 'agca_admin_menu_brand_link' );
74
+ delete_option( 'agca_admin_menu_autofold' );
75
  delete_option( 'ag_edit_adminmenu_json' );
76
  delete_option( 'ag_add_adminmenu_json' );
77
  delete_option( 'ag_colorizer_json' );
80
  delete_option( 'agca_custom_js' );
81
  delete_option( 'agca_custom_css' );
82
 
83
+ delete_option( 'agca_selected_template' );
84
+ delete_option( 'agca_templates' );
85
+ delete_option( 'agca_disablewarning' );
86
+
87
+ ?>