Advanced Access Manager - Version 2.5

Version Description

  • Fixed issue with AAM Plus Package and Multisite
  • Introduced Development License
  • Minor internal adjustment for AAM Development Community
Download this release

Release Info

Developer vasyl_m
Plugin Icon 128x128 Advanced Access Manager
Version 2.5
Comparing to
See all releases

Code changes from version 2.4 to 2.5

Files changed (67) hide show
  1. aam.php +147 -59
  2. application/control/object.php +22 -5
  3. application/control/object/backup.php +0 -118
  4. application/control/object/capability.php +1 -8
  5. application/control/object/event.php +1 -8
  6. application/control/object/menu.php +3 -10
  7. application/control/object/metabox.php +1 -1
  8. application/control/object/post.php +110 -107
  9. application/control/object/term.php +15 -28
  10. application/control/subject.php +75 -24
  11. application/control/subject/role.php +46 -4
  12. application/control/subject/user.php +75 -12
  13. application/control/subject/visitor.php +44 -0
  14. application/core/api.php +64 -16
  15. application/core/extension.php +4 -6
  16. application/core/repository.php +54 -3
  17. application/core/request.php +1 -0
  18. application/core/settings.php +89 -0
  19. application/core/update.php +11 -32
  20. application/view/abstract.php +87 -11
  21. application/view/ajax.php +0 -572
  22. application/view/capability.php +1 -0
  23. application/view/collection.php +285 -0
  24. application/view/configpress.php +1 -0
  25. application/view/event.php +14 -0
  26. application/view/extension.php +12 -4
  27. application/view/manager.php +682 -202
  28. application/view/menu.php +13 -0
  29. application/view/metabox.php +15 -2
  30. application/view/post.php +84 -69
  31. application/view/role.php +15 -6
  32. application/view/tmpl/capability.phtml +1 -0
  33. application/view/tmpl/configpress.phtml +9 -0
  34. application/view/tmpl/control_area.phtml +230 -0
  35. application/view/tmpl/event.phtml +1 -0
  36. application/view/tmpl/extension.phtml +32 -0
  37. application/view/tmpl/manager.phtml +9 -7
  38. application/view/tmpl/menu.phtml +1 -0
  39. application/view/tmpl/metabox.phtml +1 -0
  40. application/view/tmpl/post.phtml +2 -183
  41. application/view/tmpl/role.phtml +1 -0
  42. application/view/tmpl/user.phtml +2 -0
  43. application/view/tmpl/visitor.phtml +1 -0
  44. application/view/user.php +66 -16
  45. application/view/visitor.php +6 -2
  46. config.php +2 -1
  47. extension/AAM_Activity_Log/activity.php +0 -8
  48. extension/AAM_Activity_Log/extension.php +46 -40
  49. extension/AAM_Activity_Log/index.php +1 -0
  50. extension/AAM_Activity_Log/ui.phtml +1 -0
  51. extension/AAM_Multisite_Support/extension.php +30 -30
  52. extension/AAM_Multisite_Support/index.php +1 -0
  53. extension/AAM_Multisite_Support/ui.phtml +1 -0
  54. extension/AAM_My_Feature/extension.php +42 -23
  55. extension/AAM_My_Feature/index.php +1 -0
  56. extension/AAM_My_Feature/ui.phtml +1 -0
  57. lang/{nb_NO.mo → aam-nb_NO.mo} +0 -0
  58. lang/aam.mo +0 -0
  59. lang/aam.pot +314 -278
  60. media/css/aam.css +19 -20
  61. media/css/extension.css +8 -0
  62. media/css/images/cmanager/lock.png +0 -0
  63. media/css/images/help.png +0 -0
  64. media/js/aam.js +243 -265
  65. media/js/configpress.js +1 -1
  66. media/js/extension.js +34 -2
  67. readme.txt +25 -3
aam.php CHANGED
@@ -3,15 +3,15 @@
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
- Version: 2.4
7
  Author: Vasyl Martyniuk <support@wpaam.com>
8
  Author URI: http://www.wpaam.com
9
 
 
 
 
 
10
  *
11
- * ======================================================================
12
- * LICENSE: This file is subject to the terms and conditions defined in *
13
- * file 'license.txt', which is part of this source code package. *
14
- * ======================================================================
15
  */
16
  require(dirname(__FILE__) . '/config.php');
17
 
@@ -95,9 +95,12 @@ class aam {
95
  add_filter('wp_die_handler', array($this, 'wpDie'), 10);
96
  //***For UI purposes***
97
  add_action('parse_tax_query', array($this, 'parseTaxQuery'), 10, 1);
 
98
  //control Admin area
99
  add_action('admin_init', array($this, 'adminInit'));
100
  } else {
 
 
101
  //control WordPress frontend
102
  add_action('wp', array($this, 'wp'), 999);
103
  //filter navigation pages & taxonomies
@@ -115,21 +118,21 @@ class aam {
115
 
116
  //load extensions only when admin
117
  $this->loadExtensions();
118
-
119
  //add shutdown action
120
  add_action('shutdown', array($this, 'shutdown'), 1);
121
  }
122
-
123
  /**
124
  * Control Admin Area access
125
- *
126
  * @return void
127
- *
128
  * @access public
129
  */
130
  public function adminInit() {
131
  global $plugin_page;
132
-
133
  //compile menu
134
  if (empty($plugin_page)){
135
  $menu = basename(aam_Core_Request::server('SCRIPT_NAME'));
@@ -143,7 +146,7 @@ class aam {
143
  $has = $this->getUser()->getObject(aam_Control_Object_Menu::UID)->has($menu);
144
  if ($has === true){
145
  $this->reject();
146
- } elseif(is_null($has)
147
  && aam_Core_ConfigPress::getParam('aam.menu.undefined') == 'deny'){
148
  $this->reject();
149
  }
@@ -384,7 +387,8 @@ class aam {
384
  'frontend.access.deny.redirect'
385
  );
386
  $message = aam_Core_ConfigPress::getParam(
387
- 'frontend.access.deny.message', __('Access denied', 'aam')
 
388
  );
389
  }
390
 
@@ -413,7 +417,7 @@ class aam {
413
  $message = aam_Core_ConfigPress::getParam(
414
  'backend.access.deny.message', __('Access denied', 'aam')
415
  );
416
-
417
  if (filter_var($redirect, FILTER_VALIDATE_URL)) {
418
  wp_redirect($redirect);
419
  exit;
@@ -608,7 +612,9 @@ class aam {
608
  wp_mail($event['action_specifier'], $subject, $message);
609
  } else if ($event['action'] == 'change_status') {
610
  $wpdb->update(
611
- $wpdb->posts, array('post_status' => $event['action_specifier']), array('ID' => $post_ID)
 
 
612
  );
613
  } else if ($event['action'] == 'custom') {
614
  if (is_callable($event['callback'])) {
@@ -754,7 +760,7 @@ class aam {
754
  'addUserURI' => admin_url('user-new.php'),
755
  'editUserURI' => admin_url('user-edit.php'),
756
  'defaultSegment' => array(
757
- 'role' => 'administrator',
758
  'blog' => get_current_blog_id(),
759
  'user' => 0
760
  ),
@@ -795,6 +801,19 @@ class aam {
795
  }
796
  }
797
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  /**
799
  * Render list of AAM Features
800
  *
@@ -807,9 +826,12 @@ class aam {
807
  */
808
  public function features() {
809
  check_ajax_referer('aam_ajax');
810
-
811
- $model = new aam_View_Manager;
812
- $model->retrieveFeatures();
 
 
 
813
  die();
814
  }
815
 
@@ -827,8 +849,12 @@ class aam {
827
  while (@ob_end_clean());
828
 
829
  //process ajax request
830
- $model = new aam_View_Ajax;
831
- echo $model->run();
 
 
 
 
832
  die();
833
  }
834
 
@@ -852,8 +878,10 @@ class aam {
852
  }
853
 
854
  if (aam_Core_Request::get('aam_meta_init')) {
855
- $model = new aam_View_Metabox;
856
- $model->run($screen);
 
 
857
  } else {
858
  $this->getUser()->getObject(aam_Control_Object_Metabox::UID)
859
  ->filterBackend($screen);
@@ -870,69 +898,77 @@ class aam {
870
  public function adminMenu() {
871
  //register the menu
872
  add_menu_page(
873
- __('AAM', 'aam'),
874
- __('AAM', 'aam'),
875
- 'administrator',
876
- 'aam',
877
- array($this, 'content'),
 
 
878
  AAM_BASE_URL . 'active-menu.png'
879
  );
880
  //register submenus
881
  add_submenu_page(
882
- 'aam',
883
- __('Access Control', 'aam'),
884
- __('Access Control', 'aam'),
885
- 'administrator',
886
- 'aam',
 
 
887
  array($this, 'content')
888
  );
889
  add_submenu_page(
890
- 'aam',
891
- __('ConfigPress', 'aam'),
892
- __('ConfigPress', 'aam'),
893
- 'administrator',
894
- 'aam-configpress',
 
 
895
  array($this, 'configPressContent')
896
  );
897
  add_submenu_page(
898
- 'aam',
899
- __('Extensions', 'aam'),
900
- __('Extensions', 'aam'),
901
- 'administrator',
902
- 'aam-ext',
 
 
903
  array($this, 'extensionContent')
904
  );
905
-
906
  }
907
-
908
  /**
909
  * Filter the Admin Menu
910
- *
911
  * @param string $parent_file
912
- *
913
  * @return string
914
- *
915
  * @access public
916
  */
917
  public function filterMenu($parent_file){
918
  //filter admin menu
919
  $this->getUser()->getObject(aam_Control_Object_Menu::UID)->filter();
920
-
921
  return $parent_file;
922
  }
923
 
924
  /**
925
  * Take control over Tax Query parser
926
- *
927
  * By default WordPress consider non-empty term & category pair as search by
928
  * slug. This is weird assumption and there is no other way to force core to
929
  * search posts within custom taxonomy rather than take control over it with
930
  * action parse_tax_query.
931
- *
932
  * @param WP_Query $query
933
- *
934
  * @return void
935
- *
936
  * @access public
937
  */
938
  public function parseTaxQuery($query) {
@@ -943,6 +979,37 @@ class aam {
943
  }
944
  }
945
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
946
  /**
947
  * Render Main Content page
948
  *
@@ -951,15 +1018,19 @@ class aam {
951
  * @access public
952
  */
953
  public function content() {
954
- $manager = new aam_View_Manager();
955
- echo $manager->run();
 
 
 
 
956
  }
957
 
958
  /**
959
  * Render ConfigPress Page
960
- *
961
  * @return void
962
- *
963
  * @access public
964
  */
965
  public function configPressContent() {
@@ -1009,6 +1080,22 @@ class aam {
1009
  $this->setUser(new aam_Control_Subject_Visitor(''));
1010
  }
1011
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1012
 
1013
  /**
1014
  * Uninstall hook
@@ -1077,8 +1164,9 @@ class aam {
1077
 
1078
  }
1079
 
1080
- //the highest priority
1081
- add_action('init', 'aam::initialize', 0);
 
1082
 
1083
  //register_activation_hook(__FILE__, array('aam', 'activate'));
1084
- register_uninstall_hook(__FILE__, array('aam', 'uninstall'));
3
  /**
4
  Plugin Name: Advanced Access Manager
5
  Description: Manage User and Role Access to WordPress Backend and Frontend.
6
+ Version: 2.5
7
  Author: Vasyl Martyniuk <support@wpaam.com>
8
  Author URI: http://www.wpaam.com
9
 
10
+ ===========================================================================
11
+ LICENSE: This file is subject to the terms and conditions defined in *
12
+ file 'license.txt', which is part of this source code package. *
13
+ ===========================================================================
14
  *
 
 
 
 
15
  */
16
  require(dirname(__FILE__) . '/config.php');
17
 
95
  add_filter('wp_die_handler', array($this, 'wpDie'), 10);
96
  //***For UI purposes***
97
  add_action('parse_tax_query', array($this, 'parseTaxQuery'), 10, 1);
98
+ add_filter('editable_roles', array($this, 'editableRoles'), 999);
99
  //control Admin area
100
  add_action('admin_init', array($this, 'adminInit'));
101
  } else {
102
+ //make sure that subject is initiated during the login
103
+ add_action('wp_login', array($this, 'login'), 0, 2);
104
  //control WordPress frontend
105
  add_action('wp', array($this, 'wp'), 999);
106
  //filter navigation pages & taxonomies
118
 
119
  //load extensions only when admin
120
  $this->loadExtensions();
121
+
122
  //add shutdown action
123
  add_action('shutdown', array($this, 'shutdown'), 1);
124
  }
125
+
126
  /**
127
  * Control Admin Area access
128
+ *
129
  * @return void
130
+ *
131
  * @access public
132
  */
133
  public function adminInit() {
134
  global $plugin_page;
135
+
136
  //compile menu
137
  if (empty($plugin_page)){
138
  $menu = basename(aam_Core_Request::server('SCRIPT_NAME'));
146
  $has = $this->getUser()->getObject(aam_Control_Object_Menu::UID)->has($menu);
147
  if ($has === true){
148
  $this->reject();
149
+ } elseif(is_null($has)
150
  && aam_Core_ConfigPress::getParam('aam.menu.undefined') == 'deny'){
151
  $this->reject();
152
  }
387
  'frontend.access.deny.redirect'
388
  );
389
  $message = aam_Core_ConfigPress::getParam(
390
+ 'frontend.access.deny.message',
391
+ __('Access denied', 'aam')
392
  );
393
  }
394
 
417
  $message = aam_Core_ConfigPress::getParam(
418
  'backend.access.deny.message', __('Access denied', 'aam')
419
  );
420
+
421
  if (filter_var($redirect, FILTER_VALIDATE_URL)) {
422
  wp_redirect($redirect);
423
  exit;
612
  wp_mail($event['action_specifier'], $subject, $message);
613
  } else if ($event['action'] == 'change_status') {
614
  $wpdb->update(
615
+ $wpdb->posts,
616
+ array('post_status' => $event['action_specifier']),
617
+ array('ID' => $post_ID)
618
  );
619
  } else if ($event['action'] == 'custom') {
620
  if (is_callable($event['callback'])) {
760
  'addUserURI' => admin_url('user-new.php'),
761
  'editUserURI' => admin_url('user-edit.php'),
762
  'defaultSegment' => array(
763
+ 'role' => $this->getDefaultEditableRole(),
764
  'blog' => get_current_blog_id(),
765
  'user' => 0
766
  ),
801
  }
802
  }
803
 
804
+ /**
805
+ * Get first editable role
806
+ *
807
+ * @return string
808
+ *
809
+ * @access public
810
+ */
811
+ public function getDefaultEditableRole(){
812
+ $role_keys = array_keys(get_editable_roles());
813
+
814
+ return array_shift($role_keys);
815
+ }
816
+
817
  /**
818
  * Render list of AAM Features
819
  *
826
  */
827
  public function features() {
828
  check_ajax_referer('aam_ajax');
829
+ try{
830
+ $model = new aam_View_Manager;
831
+ $model->retrieveFeatures();
832
+ } catch (Exception $e){
833
+ echo $e->getMessage();
834
+ }
835
  die();
836
  }
837
 
849
  while (@ob_end_clean());
850
 
851
  //process ajax request
852
+ try{
853
+ $model = new aam_View_Manager();
854
+ echo $model->processAjax();
855
+ } catch (Exception $e){
856
+ echo '-1';
857
+ }
858
  die();
859
  }
860
 
878
  }
879
 
880
  if (aam_Core_Request::get('aam_meta_init')) {
881
+ try {
882
+ $model = new aam_View_Metabox;
883
+ $model->run($screen);
884
+ } catch (Exception $e){}
885
  } else {
886
  $this->getUser()->getObject(aam_Control_Object_Metabox::UID)
887
  ->filterBackend($screen);
898
  public function adminMenu() {
899
  //register the menu
900
  add_menu_page(
901
+ __('AAM', 'aam'),
902
+ __('AAM', 'aam'),
903
+ aam_Core_ConfigPress::getParam(
904
+ 'aam.page.access_control.capability', 'administrator'
905
+ ),
906
+ 'aam',
907
+ array($this, 'content'),
908
  AAM_BASE_URL . 'active-menu.png'
909
  );
910
  //register submenus
911
  add_submenu_page(
912
+ 'aam',
913
+ __('Access Control', 'aam'),
914
+ __('Access Control', 'aam'),
915
+ aam_Core_ConfigPress::getParam(
916
+ 'aam.page.access_control.capability', 'administrator'
917
+ ),
918
+ 'aam',
919
  array($this, 'content')
920
  );
921
  add_submenu_page(
922
+ 'aam',
923
+ __('ConfigPress', 'aam'),
924
+ __('ConfigPress', 'aam'),
925
+ aam_Core_ConfigPress::getParam(
926
+ 'aam.page.configpress.capability', 'administrator'
927
+ ),
928
+ 'aam-configpress',
929
  array($this, 'configPressContent')
930
  );
931
  add_submenu_page(
932
+ 'aam',
933
+ __('Extensions', 'aam'),
934
+ __('Extensions', 'aam'),
935
+ aam_Core_ConfigPress::getParam(
936
+ 'aam.page.extensions.capability', 'administrator'
937
+ ),
938
+ 'aam-ext',
939
  array($this, 'extensionContent')
940
  );
941
+
942
  }
943
+
944
  /**
945
  * Filter the Admin Menu
946
+ *
947
  * @param string $parent_file
948
+ *
949
  * @return string
950
+ *
951
  * @access public
952
  */
953
  public function filterMenu($parent_file){
954
  //filter admin menu
955
  $this->getUser()->getObject(aam_Control_Object_Menu::UID)->filter();
956
+
957
  return $parent_file;
958
  }
959
 
960
  /**
961
  * Take control over Tax Query parser
962
+ *
963
  * By default WordPress consider non-empty term & category pair as search by
964
  * slug. This is weird assumption and there is no other way to force core to
965
  * search posts within custom taxonomy rather than take control over it with
966
  * action parse_tax_query.
967
+ *
968
  * @param WP_Query $query
969
+ *
970
  * @return void
971
+ *
972
  * @access public
973
  */
974
  public function parseTaxQuery($query) {
979
  }
980
  }
981
 
982
+ /**
983
+ * Filter list of editable roles
984
+ *
985
+ * Does not allow for current user manager roles that have same or higher Level
986
+ *
987
+ * @param array $roles
988
+ *
989
+ * @return array
990
+ *
991
+ * @access public
992
+ */
993
+ public function editableRoles($roles){
994
+ $filtered = array();
995
+ $level = aam_Core_API::getUserLevel();
996
+
997
+
998
+ //check if super admin is specified
999
+ if (aam_Core_API::isSuperAdmin() === false){
1000
+ foreach ($roles as $role => $info) {
1001
+ if (empty($info['capabilities']["level_{$level}"])
1002
+ || !$info['capabilities']["level_{$level}"]) {
1003
+ $filtered[$role] = $info;
1004
+ }
1005
+ }
1006
+ } else {
1007
+ $filtered = $roles;
1008
+ }
1009
+
1010
+ return $filtered;
1011
+ }
1012
+
1013
  /**
1014
  * Render Main Content page
1015
  *
1018
  * @access public
1019
  */
1020
  public function content() {
1021
+ try {
1022
+ $manager = new aam_View_Manager();
1023
+ echo $manager->run();
1024
+ } catch (Exception $e) {
1025
+ echo $e->getMessage();
1026
+ }
1027
  }
1028
 
1029
  /**
1030
  * Render ConfigPress Page
1031
+ *
1032
  * @return void
1033
+ *
1034
  * @access public
1035
  */
1036
  public function configPressContent() {
1080
  $this->setUser(new aam_Control_Subject_Visitor(''));
1081
  }
1082
  }
1083
+
1084
+ /**
1085
+ * User Login Hook
1086
+ *
1087
+ * This hook track the user's successfull login and update current subject
1088
+ *
1089
+ * @param string $username User Login name
1090
+ * @param Wp_User $user Current user object
1091
+ *
1092
+ * @return void
1093
+ *
1094
+ * @access public
1095
+ */
1096
+ public function login($username, $user) {
1097
+ $this->setUser(new aam_Control_Subject_User($user->ID));
1098
+ }
1099
 
1100
  /**
1101
  * Uninstall hook
1164
 
1165
  }
1166
 
1167
+ //the highest priority (higher the core)
1168
+ //this is important to have to catch events like register core post types
1169
+ add_action('init', 'aam::initialize', -1);
1170
 
1171
  //register_activation_hook(__FILE__, array('aam', 'activate'));
1172
+ register_uninstall_hook(__FILE__, array('aam', 'uninstall'));
application/control/object.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -14,7 +15,7 @@
14
  *
15
  * @package AAM
16
  * @author Vasyl Martyniuk <support@wpaam.com>
17
- * @copyright Copyright C 2013 Vasyl Martyniuk
18
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
19
  */
20
  abstract class aam_Control_Object {
@@ -116,18 +117,34 @@ abstract class aam_Control_Object {
116
  abstract public function getUID();
117
 
118
  /**
119
- *
 
 
 
 
 
 
120
  */
121
  abstract public function setOption($option);
122
 
123
  /**
124
- *
 
 
 
 
125
  */
126
  abstract public function getOption();
127
 
128
  /**
129
- *
 
 
 
 
 
 
130
  */
131
- abstract public function save($params = array());
132
 
133
  }
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
15
  *
16
  * @package AAM
17
  * @author Vasyl Martyniuk <support@wpaam.com>
18
+ * @copyright Copyright C Vasyl Martyniuk
19
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
20
  */
21
  abstract class aam_Control_Object {
117
  abstract public function getUID();
118
 
119
  /**
120
+ * Set Object options
121
+ *
122
+ * @param mixed $option
123
+ *
124
+ * @return void
125
+ *
126
+ * @access public
127
  */
128
  abstract public function setOption($option);
129
 
130
  /**
131
+ * Get Object options
132
+ *
133
+ * @return mixed
134
+ *
135
+ * @access public
136
  */
137
  abstract public function getOption();
138
 
139
  /**
140
+ * Save Object options
141
+ *
142
+ * @param mixed $params
143
+ *
144
+ * @return void
145
+ *
146
+ * @access public
147
  */
148
+ abstract public function save($params = null);
149
 
150
  }
application/control/object/backup.php DELETED
@@ -1,118 +0,0 @@
1
- <?php
2
- /**
3
- * ======================================================================
4
- * LICENSE: This file is subject to the terms and conditions defined in *
5
- * file 'license.txt', which is part of this source code package. *
6
- * ======================================================================
7
- */
8
-
9
- /**
10
- *
11
- * @package AAM
12
- * @author Vasyl Martyniuk <support@wpaam.com>
13
- * @copyright Copyright C 2013 Vasyl Martyniuk
14
- * @license GNU General Public License {@link http://www.gnu.org/licenses/}
15
- */
16
- class aam_Control_Object_Backup extends aam_Control_Object {
17
-
18
- /**
19
- *
20
- */
21
- const UID = 'backup';
22
-
23
- /**
24
- *
25
- */
26
- const ROLEBACK_TIMES = 1;
27
-
28
- /**
29
- *
30
- * @var type
31
- */
32
- private $_option = null;
33
-
34
- /**
35
- *
36
- * @var type
37
- */
38
- private $_roleback = false;
39
-
40
- /**
41
- *
42
- * @param type $backup
43
- */
44
- public function save($backup = null) {
45
- //define the index
46
- if ($this->_roleback === false) {
47
- if (count($this->_option) < self::ROLEBACK_TIMES) {
48
- $index = count($this->_option); //next index in array
49
- } else { //shift the array and use the last cell
50
- $original = array_shift($this->_option);
51
- $this->_option[0] = $original;
52
- $index = (self::ROLEBACK_TIMES - 1);
53
- }
54
-
55
- //save the backup
56
- $this->_option[$index] = $backup;
57
- }
58
-
59
- $this->getSubject()->updateOption($this->_option, self::UID);
60
- }
61
-
62
- /**
63
- *
64
- * @return type
65
- */
66
- public function getUID() {
67
- return self::UID;
68
- }
69
-
70
- /**
71
- * @inheritdoc
72
- */
73
- public function cacheObject(){
74
- return false;
75
- }
76
-
77
- /**
78
- *
79
- * @param type $option
80
- */
81
- public function setOption($option) {
82
- $this->_option = (is_array($option) ? $option : array());
83
- }
84
-
85
- /**
86
- *
87
- * @return type
88
- */
89
- public function getOption() {
90
- return $this->_option;
91
- }
92
-
93
- /**
94
- *
95
- * @return array
96
- */
97
- public function roleback() {
98
- $counter = count($this->_option);
99
- if ($counter) {
100
- $this->_roleback = true;
101
- $option = $this->_option[$counter - 1];
102
- unset($this->_option[$counter - 1]);
103
- } else {
104
- $option = array();
105
- }
106
-
107
- return $option;
108
- }
109
-
110
- /**
111
- *
112
- * @return type
113
- */
114
- public function has() {
115
- return (count($this->_option) ? true : false);
116
- }
117
-
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
application/control/object/capability.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -59,14 +60,6 @@ class aam_Control_Object_Capability extends aam_Control_Object {
59
  }
60
  }
61
 
62
- /**
63
- *
64
- * @return type
65
- */
66
- public function backup() {
67
- return $this->getSubject()->getCapabilities();
68
- }
69
-
70
  /**
71
  *
72
  * @return type
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
60
  }
61
  }
62
 
 
 
 
 
 
 
 
 
63
  /**
64
  *
65
  * @return type
application/control/object/event.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -43,14 +44,6 @@ class aam_Control_Object_Event extends aam_Control_Object {
43
  return true;
44
  }
45
 
46
- /**
47
- *
48
- * @return type
49
- */
50
- public function backup() {
51
- return $this->getSubject()->readOption(self::UID, '', array());
52
- }
53
-
54
  /**
55
  *
56
  * @return type
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
44
  return true;
45
  }
46
 
 
 
 
 
 
 
 
 
47
  /**
48
  *
49
  * @return type
application/control/object/menu.php CHANGED
@@ -105,12 +105,13 @@ class aam_Control_Object_Menu extends aam_Control_Object {
105
  }
106
 
107
  /**
108
- *
109
- * @param type $menu
110
  */
111
  public function save($menu = null) {
112
  if (is_array($menu)) {
113
  $this->getSubject()->updateOption($menu, self::UID);
 
 
114
  }
115
  }
116
 
@@ -121,14 +122,6 @@ class aam_Control_Object_Menu extends aam_Control_Object {
121
  return true;
122
  }
123
 
124
- /**
125
- *
126
- * @return type
127
- */
128
- public function backup() {
129
- return $this->getSubject()->readOption(self::UID, '', array());
130
- }
131
-
132
  /**
133
  *
134
  * @return type
105
  }
106
 
107
  /**
108
+ * @inheritdoc
 
109
  */
110
  public function save($menu = null) {
111
  if (is_array($menu)) {
112
  $this->getSubject()->updateOption($menu, self::UID);
113
+ //set flag that this subject has custom settings
114
+ $this->getSubject()->setFlag(aam_Control_Subject::FLAG_MODIFIED);
115
  }
116
  }
117
 
122
  return true;
123
  }
124
 
 
 
 
 
 
 
 
 
125
  /**
126
  *
127
  * @return type
application/control/object/metabox.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  * ======================================================================
3
  * LICENSE: This file is subject to the terms and conditions defined in *
4
  * file 'license.txt', which is part of this source code package. *
5
  * ======================================================================
6
  */
7
  *
8
  * @package AAM
9
  * @author Vasyl Martyniuk <support@wpaam.com>
10
  * @copyright Copyright C 2013 Vasyl Martyniuk
11
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
12
  */
13
  /**
14
  *
15
  */
16
  const UID = 'metabox';
17
  /**
18
  *
19
  * @var type
20
  */
21
  private $_option = array();
22
  /**
23
  *
24
  * @global type $wp_registered_widgets
25
  * @param type $sidebar_widgets
26
  * @return type
27
  */
28
  public function filterFrontend($sidebar_widgets) {
29
  global $wp_registered_widgets;
30
  if (is_array($wp_registered_widgets)) {
31
  foreach ($wp_registered_widgets as $id => $data) {
32
  if (is_object($data['callback'][0])) {
33
  $callback = get_class($data['callback'][0]);
34
  } elseif (is_string($data['callback'][0])) {
35
  $callback = $data['callback'][0];
36
  }
37
  if ($this->has('widgets', $callback)) {
38
  unregister_widget($callback);
39
  //remove it from registered widget global var!!
40
  //INFORM: Why Unregister Widget does not clear global var?
41
  unset($wp_registered_widgets[$id]);
42
  }
43
  }
44
  }
45
  return $sidebar_widgets;
46
  }
47
  /**
48
  *
49
  * @global type $wp_meta_boxes
50
  * @param type $screen
51
  * @param type $post
52
  */
53
  public function filterBackend($screen, $post = null) {
54
  global $wp_meta_boxes;
55
  if (is_array($wp_meta_boxes)) {
56
  foreach ($wp_meta_boxes as $screen_id => $zones) {
57
  if ($screen == $screen_id) {
58
  foreach ($zones as $zone => $priorities) {
59
  foreach ($priorities as $priority => $metaboxes) {
60
  foreach ($metaboxes as $metabox => $data) {
61
  if ($this->has($screen_id, $metabox)) {
62
  remove_meta_box($metabox, $screen_id, $zone);
63
  }
64
  }
65
  }
66
  }
67
  }
68
  }
69
  }
70
  }
71
  /**
72
  *
73
  * @param type $metaboxes
74
  */
75
  public function save($metaboxes = null) {
76
  if (is_array($metaboxes)) {
77
  $this->getSubject()->updateOption($metaboxes, self::UID);
78
  }
79
  }
80
  /**
81
  * @inheritdoc
82
  */
83
  public function cacheObject(){
84
  return true;
85
  }
86
  /**
87
  *
88
  * @return type
89
  */
90
  public function backup() {
91
  return $this->getSubject()->readOption(self::UID, '', array());
92
  }
93
  /**
94
  *
95
  * @return type
96
  */
97
  public function getUID() {
98
  return self::UID;
99
  }
100
  /**
101
  *
102
  * @param type $option
103
  */
104
  public function setOption($option) {
105
  $this->_option = (is_array($option) ? $option : array());
106
  }
107
  /**
108
  *
109
  * @return type
110
  */
111
  public function getOption() {
112
  return $this->_option;
113
  }
114
  /**
115
  *
116
  * @param type $group
117
  * @param type $metabox
118
  * @return type
119
  */
120
  public function has($group, $metabox) {
121
  $response = false;
122
  if (isset($this->_option[$group][$metabox])) {
123
  $response = (intval($this->_option[$group][$metabox]) ? true : false);
124
  }
125
  return $response;
126
  }
 
127
  * ======================================================================
128
  * LICENSE: This file is subject to the terms and conditions defined in *
129
  * file 'license.txt', which is part of this source code package. *
130
  * ======================================================================
131
  */
132
  *
133
  * @package AAM
134
  * @author Vasyl Martyniuk <support@wpaam.com>
135
  * @copyright Copyright C 2013 Vasyl Martyniuk
136
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
137
  */
138
  /**
139
  *
140
  */
141
  const UID = 'metabox';
142
  /**
143
  *
144
  * @var type
145
  */
146
  private $_option = array();
147
  /**
148
  *
149
  * @global type $wp_registered_widgets
150
  * @param type $sidebar_widgets
151
  * @return type
152
  */
153
  public function filterFrontend($sidebar_widgets) {
154
  global $wp_registered_widgets;
155
  if (is_array($wp_registered_widgets)) {
156
  foreach ($wp_registered_widgets as $id => $data) {
157
  if (is_object($data['callback'][0])) {
158
  $callback = get_class($data['callback'][0]);
159
  } elseif (is_string($data['callback'][0])) {
160
  $callback = $data['callback'][0];
161
  }
162
  if ($this->has('widgets', $callback)) {
163
  unregister_widget($callback);
164
  //remove it from registered widget global var!!
165
  //INFORM: Why Unregister Widget does not clear global var?
166
  unset($wp_registered_widgets[$id]);
167
  }
168
  }
169
  }
170
  return $sidebar_widgets;
171
  }
172
  /**
173
  *
174
  * @global type $wp_meta_boxes
175
  * @param type $screen
176
  * @param type $post
177
  */
178
  public function filterBackend($screen, $post = null) {
179
  global $wp_meta_boxes;
180
  if (is_array($wp_meta_boxes)) {
181
  foreach ($wp_meta_boxes as $screen_id => $zones) {
182
  if ($screen == $screen_id) {
183
  foreach ($zones as $zone => $priorities) {
184
  foreach ($priorities as $priority => $metaboxes) {
185
  foreach ($metaboxes as $metabox => $data) {
186
  if ($this->has($screen_id, $metabox)) {
187
  remove_meta_box($metabox, $screen_id, $zone);
188
  }
189
  }
190
  }
191
  }
192
  }
193
  }
194
  }
195
  }
196
  /**
197
  * @inheritdoc
198
  */
199
  public function save($metaboxes = null) {
200
  if (is_array($metaboxes)) {
201
  $this->getSubject()->updateOption($metaboxes, self::UID);
202
  //set flag that this subject has custom settings
203
  $this->getSubject()->setFlag(aam_Control_Subject::FLAG_MODIFIED);
204
  }
205
  }
206
  /**
207
  * @inheritdoc
208
  */
209
  public function cacheObject(){
210
  return true;
211
  }
212
  /**
213
  *
214
  * @return type
215
  */
216
  public function getUID() {
217
  return self::UID;
218
  }
219
  /**
220
  *
221
  * @param type $option
222
  */
223
  public function setOption($option) {
224
  $this->_option = (is_array($option) ? $option : array());
225
  }
226
  /**
227
  *
228
  * @return type
229
  */
230
  public function getOption() {
231
  return $this->_option;
232
  }
233
  /**
234
  *
235
  * @param type $group
236
  * @param type $metabox
237
  * @return type
238
  */
239
  public function has($group, $metabox) {
240
  $response = false;
241
  if (isset($this->_option[$group][$metabox])) {
242
  $response = (intval($this->_option[$group][$metabox]) ? true : false);
243
  }
244
  return $response;
245
  }
 
1
  * ======================================================================
2
  * LICENSE: This file is subject to the terms and conditions defined in *
3
  * file 'license.txt', which is part of this source code package. *
4
  * ======================================================================
5
  */
6
  *
7
  * @package AAM
8
  * @author Vasyl Martyniuk <support@wpaam.com>
9
  * @copyright Copyright C 2013 Vasyl Martyniuk
10
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
11
  */
12
  /**
13
  *
14
  */
15
  const UID = 'metabox';
16
  /**
17
  *
18
  * @var type
19
  */
20
  private $_option = array();
21
  /**
22
  *
23
  * @global type $wp_registered_widgets
24
  * @param type $sidebar_widgets
25
  * @return type
26
  */
27
  public function filterFrontend($sidebar_widgets) {
28
  global $wp_registered_widgets;
29
  if (is_array($wp_registered_widgets)) {
30
  foreach ($wp_registered_widgets as $id => $data) {
31
  if (is_object($data['callback'][0])) {
32
  $callback = get_class($data['callback'][0]);
33
  } elseif (is_string($data['callback'][0])) {
34
  $callback = $data['callback'][0];
35
  }
36
  if ($this->has('widgets', $callback)) {
37
  unregister_widget($callback);
38
  //remove it from registered widget global var!!
39
  //INFORM: Why Unregister Widget does not clear global var?
40
  unset($wp_registered_widgets[$id]);
41
  }
42
  }
43
  }
44
  return $sidebar_widgets;
45
  }
46
  /**
47
  *
48
  * @global type $wp_meta_boxes
49
  * @param type $screen
50
  * @param type $post
51
  */
52
  public function filterBackend($screen, $post = null) {
53
  global $wp_meta_boxes;
54
  if (is_array($wp_meta_boxes)) {
55
  foreach ($wp_meta_boxes as $screen_id => $zones) {
56
  if ($screen == $screen_id) {
57
  foreach ($zones as $zone => $priorities) {
58
  foreach ($priorities as $priority => $metaboxes) {
59
  foreach ($metaboxes as $metabox => $data) {
60
  if ($this->has($screen_id, $metabox)) {
61
  remove_meta_box($metabox, $screen_id, $zone);
62
  }
63
  }
64
  }
65
  }
66
  }
67
  }
68
  }
69
  }
70
  /**
71
  *
72
  * @param type $metaboxes
73
  */
74
  public function save($metaboxes = null) {
75
  if (is_array($metaboxes)) {
76
  $this->getSubject()->updateOption($metaboxes, self::UID);
77
  }
78
  }
79
  /**
80
  * @inheritdoc
81
  */
82
  public function cacheObject(){
83
  return true;
84
  }
85
  /**
86
  *
87
  * @return type
88
  */
89
  public function backup() {
90
  return $this->getSubject()->readOption(self::UID, '', array());
91
  }
92
  /**
93
  *
94
  * @return type
95
  */
96
  public function getUID() {
97
  return self::UID;
98
  }
99
  /**
100
  *
101
  * @param type $option
102
  */
103
  public function setOption($option) {
104
  $this->_option = (is_array($option) ? $option : array());
105
  }
106
  /**
107
  *
108
  * @return type
109
  */
110
  public function getOption() {
111
  return $this->_option;
112
  }
113
  /**
114
  *
115
  * @param type $group
116
  * @param type $metabox
117
  * @return type
118
  */
119
  public function has($group, $metabox) {
120
  $response = false;
121
  if (isset($this->_option[$group][$metabox])) {
122
  $response = (intval($this->_option[$group][$metabox]) ? true : false);
123
  }
124
  return $response;
125
  }
126
+ <?php
127
  * ======================================================================
128
  * LICENSE: This file is subject to the terms and conditions defined in *
129
  * file 'license.txt', which is part of this source code package. *
130
  * ======================================================================
131
  */
132
  *
133
  * @package AAM
134
  * @author Vasyl Martyniuk <support@wpaam.com>
135
  * @copyright Copyright C 2013 Vasyl Martyniuk
136
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
137
  */
138
  /**
139
  *
140
  */
141
  const UID = 'metabox';
142
  /**
143
  *
144
  * @var type
145
  */
146
  private $_option = array();
147
  /**
148
  *
149
  * @global type $wp_registered_widgets
150
  * @param type $sidebar_widgets
151
  * @return type
152
  */
153
  public function filterFrontend($sidebar_widgets) {
154
  global $wp_registered_widgets;
155
  if (is_array($wp_registered_widgets)) {
156
  foreach ($wp_registered_widgets as $id => $data) {
157
  if (is_object($data['callback'][0])) {
158
  $callback = get_class($data['callback'][0]);
159
  } elseif (is_string($data['callback'][0])) {
160
  $callback = $data['callback'][0];
161
  }
162
  if ($this->has('widgets', $callback)) {
163
  unregister_widget($callback);
164
  //remove it from registered widget global var!!
165
  //INFORM: Why Unregister Widget does not clear global var?
166
  unset($wp_registered_widgets[$id]);
167
  }
168
  }
169
  }
170
  return $sidebar_widgets;
171
  }
172
  /**
173
  *
174
  * @global type $wp_meta_boxes
175
  * @param type $screen
176
  * @param type $post
177
  */
178
  public function filterBackend($screen, $post = null) {
179
  global $wp_meta_boxes;
180
  if (is_array($wp_meta_boxes)) {
181
  foreach ($wp_meta_boxes as $screen_id => $zones) {
182
  if ($screen == $screen_id) {
183
  foreach ($zones as $zone => $priorities) {
184
  foreach ($priorities as $priority => $metaboxes) {
185
  foreach ($metaboxes as $metabox => $data) {
186
  if ($this->has($screen_id, $metabox)) {
187
  remove_meta_box($metabox, $screen_id, $zone);
188
  }
189
  }
190
  }
191
  }
192
  }
193
  }
194
  }
195
  }
196
  /**
197
  * @inheritdoc
198
  */
199
  public function save($metaboxes = null) {
200
  if (is_array($metaboxes)) {
201
  $this->getSubject()->updateOption($metaboxes, self::UID);
202
  //set flag that this subject has custom settings
203
  $this->getSubject()->setFlag(aam_Control_Subject::FLAG_MODIFIED);
204
  }
205
  }
206
  /**
207
  * @inheritdoc
208
  */
209
  public function cacheObject(){
210
  return true;
211
  }
212
  /**
213
  *
214
  * @return type
215
  */
216
  public function getUID() {
217
  return self::UID;
218
  }
219
  /**
220
  *
221
  * @param type $option
222
  */
223
  public function setOption($option) {
224
  $this->_option = (is_array($option) ? $option : array());
225
  }
226
  /**
227
  *
228
  * @return type
229
  */
230
  public function getOption() {
231
  return $this->_option;
232
  }
233
  /**
234
  *
235
  * @param type $group
236
  * @param type $metabox
237
  * @return type
238
  */
239
  public function has($group, $metabox) {
240
  $response = false;
241
  if (isset($this->_option[$group][$metabox])) {
242
  $response = (intval($this->_option[$group][$metabox]) ? true : false);
243
  }
244
  return $response;
245
  }
application/control/object/post.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -16,27 +17,35 @@
16
  class aam_Control_Object_Post extends aam_Control_Object {
17
 
18
  /**
19
- *
20
  */
21
  const UID = 'post';
22
 
23
  /**
 
24
  *
 
25
  */
26
  const ACTION_COMMENT = 'comment';
27
 
28
  /**
 
29
  *
 
30
  */
31
  const ACTION_READ = 'read';
32
 
33
  /**
 
34
  *
 
35
  */
36
  const ACTION_EXCLUDE = 'exclude';
37
 
38
  /**
 
39
  *
 
40
  */
41
  const ACTION_TRASH = 'trash';
42
 
@@ -61,89 +70,15 @@ class aam_Control_Object_Post extends aam_Control_Object {
61
  * @var type
62
  */
63
  private $_option = array();
64
-
65
- /**
66
- * Indicator that settings where inherited
67
- *
68
- * @var boolean
69
- *
70
- * @access private
71
- */
72
- private $_inherited = false;
73
-
74
- /**
75
- * @inheritdoc
76
- */
77
- public function __sleep(){
78
- return array('_post', '_option', '_inherited');
79
- }
80
-
81
- /**
82
- * @inheritdoc
83
- */
84
- public function cacheObject(){
85
- return true;
86
- }
87
-
88
- /**
89
- * Save Post Options
90
- *
91
- * @param array $params
92
- *
93
- * @return void
94
- *
95
- * @access public
96
- */
97
- public function save($params = null) {
98
- if (is_array($params)) {
99
- $this->setInherited(false);
100
- update_post_meta($this->getPost()->ID, $this->getOptionName(), $params);
101
- }
102
- //fire internal hook
103
- do_action_ref_array('aam_object_saved', $this, $params);
104
- }
105
-
106
- /**
107
- *
108
- * @param type $area
109
- * @return type
110
- */
111
- public function getAccessList($area) {
112
- if ($area == 'frontend') {
113
- $response = array(
114
- self::ACTION_READ, self::ACTION_EXCLUDE, self::ACTION_COMMENT
115
- );
116
- } elseif ($area == 'backend') {
117
- $response = array(
118
- self::ACTION_TRASH, self::ACTION_DELETE, self::ACTION_EDIT
119
- );
120
- } else {
121
- $response = array();
122
- }
123
-
124
- return apply_filters('aam_post_access_list', $response, $area);
125
- }
126
 
127
  /**
 
128
  *
129
- * @return type
130
- */
131
- public function getUID() {
132
- return self::UID;
133
- }
134
-
135
- /**
136
  *
137
- * @return type
138
  */
139
- protected function getOptionName() {
140
- $subject = $this->getSubject();
141
- //prepare option name
142
- $meta_key = 'aam_' . self::UID . '_access_' . $subject->getUID();
143
- $meta_key .= ($subject->getId() ? $subject->getId() : '');
144
-
145
- return $meta_key;
146
- }
147
 
148
  /**
149
  * Init Post Object
@@ -161,8 +96,8 @@ class aam_Control_Object_Post extends aam_Control_Object {
161
  } elseif (intval($object)) {
162
  $this->setPost(get_post($object));
163
  }
164
- //read options
165
- if ($this->getPost()) {
166
  $this->read();
167
  }
168
  }
@@ -179,7 +114,8 @@ class aam_Control_Object_Post extends aam_Control_Object {
179
  public function read() {
180
  $option = get_post_meta($this->getPost()->ID, $this->getOptionName(), true);
181
  //try to inherit it from parent category
182
- if (empty($option)) {
 
183
  $terms = $this->retrievePostTerms();
184
  //use only first term for inheritance
185
  $term_id = array_shift($terms);
@@ -192,6 +128,81 @@ class aam_Control_Object_Post extends aam_Control_Object {
192
  );
193
  }
194
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  /**
196
  *
197
  * @return type
@@ -201,8 +212,11 @@ class aam_Control_Object_Post extends aam_Control_Object {
201
  }
202
 
203
  /**
 
204
  *
205
  * @return array
 
 
206
  */
207
  private function retrievePostTerms() {
208
  $taxonomies = get_object_taxonomies($this->getPost());
@@ -224,26 +238,6 @@ class aam_Control_Object_Post extends aam_Control_Object {
224
  return $terms;
225
  }
226
 
227
- /**
228
- *
229
- * @param type $term_id
230
- * @return array
231
- */
232
- private function inheritAccess($term_id) {
233
- $term = new aam_Control_Object_Term($this->getSubject(), $term_id);
234
- $access = $term->getOption();
235
- if (isset($access['post']) && $access['post']) {
236
- $result = array('post' => $access['post']);
237
- $this->setInherited(true);
238
- } elseif (is_object($term->getTerm()) && $term->getTerm()->parent) {
239
- $result = $this->inheritAccess($term->getTerm()->parent);
240
- } else {
241
- $result = array();
242
- }
243
-
244
- return $result;
245
- }
246
-
247
  /**
248
  * Set Post. Cover all unexpectd wierd issues with WP Core
249
  *
@@ -287,17 +281,26 @@ class aam_Control_Object_Post extends aam_Control_Object {
287
  public function getOption() {
288
  return $this->_option;
289
  }
290
-
291
  /**
292
- *
293
- * @param type $flag
 
 
 
 
 
 
 
 
 
294
  */
295
  public function setInherited($flag){
296
  $this->_inherited = $flag;
297
  }
298
-
299
  /**
300
- *
301
  * @return type
302
  */
303
  public function getInherited(){
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
17
  class aam_Control_Object_Post extends aam_Control_Object {
18
 
19
  /**
20
+ * Object Identifier
21
  */
22
  const UID = 'post';
23
 
24
  /**
25
+ * Object Action: COMMENT
26
  *
27
+ * Control access to commenting ability
28
  */
29
  const ACTION_COMMENT = 'comment';
30
 
31
  /**
32
+ * Object Action: READ
33
  *
34
+ * Either Object can be read by user or not
35
  */
36
  const ACTION_READ = 'read';
37
 
38
  /**
39
+ * Object Action: EXCLUDE
40
  *
41
+ * If object is a part of frontend menu either exclude it from menu or not
42
  */
43
  const ACTION_EXCLUDE = 'exclude';
44
 
45
  /**
46
+ * Object Action: TRASH
47
  *
48
+ * Manage access to object trash ability
49
  */
50
  const ACTION_TRASH = 'trash';
51
 
70
  * @var type
71
  */
72
  private $_option = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  /**
75
+ * Indicator that settings where inherited
76
  *
77
+ * @var boolean
 
 
 
 
 
 
78
  *
79
+ * @access private
80
  */
81
+ private $_inherited = false;
 
 
 
 
 
 
 
82
 
83
  /**
84
  * Init Post Object
96
  } elseif (intval($object)) {
97
  $this->setPost(get_post($object));
98
  }
99
+
100
+ if ($this->getPost()){
101
  $this->read();
102
  }
103
  }
114
  public function read() {
115
  $option = get_post_meta($this->getPost()->ID, $this->getOptionName(), true);
116
  //try to inherit it from parent category
117
+ if (empty($option)
118
+ && (aam_Core_ConfigPress::getParam('aam.post.inherit', 'true') == 'true')) {
119
  $terms = $this->retrievePostTerms();
120
  //use only first term for inheritance
121
  $term_id = array_shift($terms);
128
  );
129
  }
130
 
131
+ /**
132
+ * Generate option name
133
+ *
134
+ * @return string
135
+ *
136
+ * @access protected
137
+ */
138
+ protected function getOptionName() {
139
+ $subject = $this->getSubject();
140
+ //prepare option name
141
+ $meta_key = 'aam_' . self::UID . '_access_' . $subject->getUID();
142
+ $meta_key .= ($subject->getId() ? $subject->getId() : '');
143
+
144
+ return $meta_key;
145
+ }
146
+
147
+ /**
148
+ *
149
+ * @param type $term_id
150
+ * @return array
151
+ */
152
+ private function inheritAccess($term_id) {
153
+ $term = new aam_Control_Object_Term($this->getSubject(), $term_id);
154
+ $access = $term->getOption();
155
+ if (isset($access['post']) && $access['post']) {
156
+ $result = array('post' => $access['post']);
157
+ $this->setInherited(true);
158
+ } elseif (is_object($term->getTerm()) && $term->getTerm()->parent) {
159
+ $result = $this->inheritAccess($term->getTerm()->parent);
160
+ } else {
161
+ $result = array();
162
+ }
163
+
164
+ return $result;
165
+ }
166
+
167
+ /**
168
+ * @inheritdoc
169
+ */
170
+ public function __sleep(){
171
+ return array('_post', '_option', '_inherited');
172
+ }
173
+
174
+ /**
175
+ * @inheritdoc
176
+ */
177
+ public function cacheObject(){
178
+ return true;
179
+ }
180
+
181
+ /**
182
+ * @inheritdoc
183
+ */
184
+ public function save($params = null) {
185
+ if (is_array($params)) {
186
+ $this->setInherited(false);
187
+ update_post_meta($this->getPost()->ID, $this->getOptionName(), $params);
188
+ //set flag that this subject has custom settings
189
+ $this->getSubject()->setFlag(aam_Control_Subject::FLAG_MODIFIED);
190
+ }
191
+ //fire internal hook
192
+ do_action_ref_array('aam_object_saved', $this, $params);
193
+ }
194
+
195
+ /**
196
+ * Get Object Unique ID
197
+ *
198
+ * @return string
199
+ *
200
+ * @access public
201
+ */
202
+ public function getUID() {
203
+ return self::UID;
204
+ }
205
+
206
  /**
207
  *
208
  * @return type
212
  }
213
 
214
  /**
215
+ * Retrieve list of all hierarchical terms the object belongs to
216
  *
217
  * @return array
218
+ *
219
+ * @access private
220
  */
221
  private function retrievePostTerms() {
222
  $taxonomies = get_object_taxonomies($this->getPost());
238
  return $terms;
239
  }
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  /**
242
  * Set Post. Cover all unexpectd wierd issues with WP Core
243
  *
281
  public function getOption() {
282
  return $this->_option;
283
  }
284
+
285
  /**
286
+ * Set inherited flag
287
+ *
288
+ * If post does not have access specified, it'll try to inherit it from the
289
+ * parent category and if parent category has access defined it'll inherit all
290
+ * settings and set _inherited flag to true.
291
+ *
292
+ * @param boolean $flag
293
+ *
294
+ * @return void
295
+ *
296
+ * @access public
297
  */
298
  public function setInherited($flag){
299
  $this->_inherited = $flag;
300
  }
301
+
302
  /**
303
+ *
304
  * @return type
305
  */
306
  public function getInherited(){
application/control/object/term.php CHANGED
@@ -61,41 +61,24 @@ class aam_Control_Object_Term extends aam_Control_Object {
61
  }
62
 
63
  /**
64
- *
65
- * @param type $params
66
  */
67
  public function save($params = null) {
68
  if (is_array($params)) {
69
  $this->getSubject()->updateOption(
70
  $params, self::UID, $this->getTerm()->term_id
71
  );
 
 
72
  }
73
  }
74
 
75
  /**
76
- *
77
- * @param type $area
78
- * @return type
79
- */
80
- public function getAccessList($area) {
81
- if ($area == 'frontend') {
82
- $response = array(
83
- self::ACTION_BROWSE, self::ACTION_EXCLUDE, self::ACTION_LIST
84
- );
85
- } elseif ($area == 'backend') {
86
- $response = array(
87
- self::ACTION_BROWSE, self::ACTION_EDIT, self::ACTION_LIST
88
- );
89
- } else {
90
- $response = array();
91
- }
92
-
93
- return apply_filters('aam_term_access_list', $response, $area);
94
- }
95
-
96
- /**
97
- *
98
- * @return type
99
  */
100
  public function getUID() {
101
  return self::UID;
@@ -108,12 +91,16 @@ class aam_Control_Object_Term extends aam_Control_Object {
108
  public function init($object_id) {
109
  if ($object_id) {
110
  //initialize term first
111
- $this->setTerm(get_term($object_id, $this->getTaxonomy($object_id)));
112
- if ($this->getTerm()) {
 
113
  $access = $this->getSubject()->readOption(
114
  self::UID, $this->getTerm()->term_id
115
  );
116
- if (empty($access)) {
 
 
 
117
  //try to get any parent restriction
118
  $access = $this->inheritAccess($this->getTerm()->parent);
119
  }
61
  }
62
 
63
  /**
64
+ * @inheritdoc
 
65
  */
66
  public function save($params = null) {
67
  if (is_array($params)) {
68
  $this->getSubject()->updateOption(
69
  $params, self::UID, $this->getTerm()->term_id
70
  );
71
+ //set flag that this subject has custom settings
72
+ $this->getSubject()->setFlag(aam_Control_Subject::FLAG_MODIFIED);
73
  }
74
  }
75
 
76
  /**
77
+ * Get Object Unique ID
78
+ *
79
+ * @return string
80
+ *
81
+ * @access public
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  */
83
  public function getUID() {
84
  return self::UID;
91
  public function init($object_id) {
92
  if ($object_id) {
93
  //initialize term first
94
+ $term = get_term($object_id, $this->getTaxonomy($object_id));
95
+ if ($term && !is_wp_error($term)) {
96
+ $this->setTerm($term);
97
  $access = $this->getSubject()->readOption(
98
  self::UID, $this->getTerm()->term_id
99
  );
100
+ $inherit = aam_Core_ConfigPress::getParam(
101
+ 'aam.term.inherit', 'true'
102
+ );
103
+ if (empty($access) && ($inherit == 'true')) {
104
  //try to get any parent restriction
105
  $access = $this->inheritAccess($this->getTerm()->parent);
106
  }
application/control/subject.php CHANGED
@@ -8,6 +8,7 @@
8
  */
9
 
10
  /**
 
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
@@ -16,6 +17,11 @@
16
  */
17
  abstract class aam_Control_Subject {
18
 
 
 
 
 
 
19
  /**
20
  * Subject ID
21
  *
@@ -145,7 +151,9 @@ abstract class aam_Control_Subject {
145
  */
146
  public function __get($name) {
147
  $subject = $this->getSubject();
148
- return $subject->$name;
 
 
149
  }
150
 
151
  /**
@@ -254,14 +262,14 @@ abstract class aam_Control_Subject {
254
  $class_name = 'aam_Control_Object_' . ucfirst($object);
255
  if (class_exists($class_name)) {
256
  $this->_objects[$object][$object_id] = new $class_name(
257
- $this, $object_id
258
  );
259
  } else {
260
  $this->_objects[$object][$object_id] = apply_filters(
261
- 'aam_object', null, $object, $object_id
262
  );
263
  }
264
-
265
  //set update cache flag to true if object can be cached
266
  if ($this->_objects[$object][$object_id]->cacheObject() === true){
267
  $this->_updateCache = true;
@@ -284,6 +292,22 @@ abstract class aam_Control_Subject {
284
  public function setObject(aam_Control_Object $object, $uid) {
285
  $this->_objects[$uid] = $object;
286
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
 
288
  /**
289
  * Get Subject Type
@@ -304,6 +328,26 @@ abstract class aam_Control_Subject {
304
  public function hasCapability($capability) {
305
  return $this->getSubject()->has_cap($capability);
306
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
  /**
309
  * Retrieve list of subject's capabilities
@@ -346,33 +390,39 @@ abstract class aam_Control_Subject {
346
  abstract public function clearCache();
347
 
348
  /**
349
- * Save Access Parameters
350
  *
351
- * @param array $params
 
352
  *
353
- * @return boolean
354
  *
355
  * @access public
356
  */
357
- public function save(array $params) {
358
- //initialize the backup first
359
- $backup = array();
360
-
361
- foreach ($params as $object_type => $dump) {
362
- if ($object = $this->getObject($object_type)) {
363
- if (method_exists($object, 'backup')) {
364
- $backup[$object_type] = $object->backup();
365
- }
366
- $object->save($dump);
367
- }
368
- }
369
 
370
- //store backup
371
- $this->getObject(aam_Control_Object_Backup::UID)->save($backup);
 
 
 
 
 
 
 
 
372
 
373
- //clear cache
374
- $this->clearCache();
375
- }
 
 
 
 
 
 
 
 
376
 
377
  /**
378
  * Retrieve subject based on used class
@@ -382,4 +432,5 @@ abstract class aam_Control_Subject {
382
  * @access protected
383
  */
384
  abstract protected function retrieveSubject();
 
385
  }
8
  */
9
 
10
  /**
11
+ * Abstract Subject Controller
12
  *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
17
  */
18
  abstract class aam_Control_Subject {
19
 
20
+ /**
21
+ * Flag that idicates that subject has been modified
22
+ */
23
+ const FLAG_MODIFIED = 'modified_flag';
24
+
25
  /**
26
  * Subject ID
27
  *
151
  */
152
  public function __get($name) {
153
  $subject = $this->getSubject();
154
+ //TODO - In multisite Wp_User roles are not initialized if admin not a part
155
+ //of the site
156
+ return @$subject->$name;
157
  }
158
 
159
  /**
262
  $class_name = 'aam_Control_Object_' . ucfirst($object);
263
  if (class_exists($class_name)) {
264
  $this->_objects[$object][$object_id] = new $class_name(
265
+ $this, $object_id, $this
266
  );
267
  } else {
268
  $this->_objects[$object][$object_id] = apply_filters(
269
+ 'aam_object', null, $object, $object_id, $this
270
  );
271
  }
272
+
273
  //set update cache flag to true if object can be cached
274
  if ($this->_objects[$object][$object_id]->cacheObject() === true){
275
  $this->_updateCache = true;
292
  public function setObject(aam_Control_Object $object, $uid) {
293
  $this->_objects[$uid] = $object;
294
  }
295
+
296
+ /**
297
+ * Release the object
298
+ *
299
+ * @param string $uid
300
+ * @param string|int $object_id
301
+ *
302
+ * @return void
303
+ *
304
+ * @access public
305
+ */
306
+ public function releaseObject($uid, $object_id = 0){
307
+ if (isset($this->_objects[$uid][$object_id])){
308
+ unset($this->_objects[$uid][$object_id]);
309
+ }
310
+ }
311
 
312
  /**
313
  * Get Subject Type
328
  public function hasCapability($capability) {
329
  return $this->getSubject()->has_cap($capability);
330
  }
331
+
332
+ /**
333
+ * Save Access Parameters
334
+ *
335
+ * @param array $params
336
+ *
337
+ * @return boolean
338
+ *
339
+ * @access public
340
+ */
341
+ public function save(array $params) {
342
+ foreach ($params as $object_type => $dump) {
343
+ if ($object = $this->getObject($object_type)) {
344
+ $object->save($dump);
345
+ }
346
+ }
347
+
348
+ //clear cache
349
+ $this->clearCache();
350
+ }
351
 
352
  /**
353
  * Retrieve list of subject's capabilities
390
  abstract public function clearCache();
391
 
392
  /**
393
+ * Clear all options
394
  *
395
+ * Remove all options related to current user from database and any other
396
+ * custom storage
397
  *
398
+ * @return void
399
  *
400
  * @access public
401
  */
402
+ abstract public function clearAllOptions();
 
 
 
 
 
 
 
 
 
 
 
403
 
404
+ /**
405
+ * Check if subject has specified flag
406
+ *
407
+ * @param string flag
408
+ *
409
+ * @return boolean
410
+ *
411
+ * @access public
412
+ */
413
+ abstract public function hasFlag($flag);
414
 
415
+ /**
416
+ * Set Subject Flag
417
+ *
418
+ * @param string $flag
419
+ * @param boolean $value
420
+ *
421
+ * @return void
422
+ *
423
+ * @access protected
424
+ */
425
+ abstract public function setFlag($flag, $value = true);
426
 
427
  /**
428
  * Retrieve subject based on used class
432
  * @access protected
433
  */
434
  abstract protected function retrieveSubject();
435
+
436
  }
application/control/subject/role.php CHANGED
@@ -43,11 +43,11 @@ class aam_Control_Subject_Role extends aam_Control_Subject {
43
 
44
  /**
45
  * Delete User Role and all User's in role if requested
46
- *
47
  * @param boolean $delete_users
48
- *
49
  * @return boolean
50
- *
51
  * @access public
52
  */
53
  public function delete($delete_users = false) {
@@ -64,7 +64,7 @@ class aam_Control_Subject_Role extends aam_Control_Subject {
64
  ));
65
  foreach ($users->get_results() as $user) {
66
  //user can not delete himself
67
- if (($user instanceof WP_User)
68
  && ($user->ID != get_current_user_id())) {
69
  wp_delete_user($user->ID);
70
  }
@@ -188,6 +188,48 @@ class aam_Control_Subject_Role extends aam_Control_Subject {
188
 
189
  return $name;
190
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
  /**
193
  *
43
 
44
  /**
45
  * Delete User Role and all User's in role if requested
46
+ *
47
  * @param boolean $delete_users
48
+ *
49
  * @return boolean
50
+ *
51
  * @access public
52
  */
53
  public function delete($delete_users = false) {
64
  ));
65
  foreach ($users->get_results() as $user) {
66
  //user can not delete himself
67
+ if (($user instanceof WP_User)
68
  && ($user->ID != get_current_user_id())) {
69
  wp_delete_user($user->ID);
70
  }
188
 
189
  return $name;
190
  }
191
+
192
+ /**
193
+ * @inheritdoc
194
+ */
195
+ public function hasFlag($flag){
196
+ $option = 'aam_' . self::UID . '_' . $this->getId() . "_{$flag}";
197
+ return aam_Core_API::getBlogOption($option);
198
+ }
199
+
200
+ /**
201
+ * @inheritdoc
202
+ */
203
+ public function setFlag($flag, $value = true) {
204
+ $option = 'aam_' . self::UID . '_' . $this->getId() . "_{$flag}";
205
+ if ($value === true){
206
+ aam_Core_API::updateBlogOption($option, $value);
207
+ } else {
208
+ aam_Core_API::deleteBlogOption($option);
209
+ }
210
+ }
211
+
212
+ /**
213
+ * @inheritdoc
214
+ */
215
+ public function clearAllOptions(){
216
+ global $wpdb;
217
+
218
+ //prepare option mask
219
+ $mask = 'aam_%_' . $this->getId();
220
+
221
+ //clear all settings in options table
222
+ $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '{$mask}'");
223
+
224
+ //clear all settings in postmeta table
225
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '{$mask}'");
226
+
227
+ $this->clearCache(); //delete cache
228
+ //clear modifield flag
229
+ $this->setFlag(aam_Control_Subject::FLAG_MODIFIED, false);
230
+
231
+ do_action('aam_clear_all_options', $this);
232
+ }
233
 
234
  /**
235
  *
application/control/subject/user.php CHANGED
@@ -8,6 +8,7 @@
8
  */
9
 
10
  /**
 
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
@@ -36,8 +37,7 @@ class aam_Control_Subject_User extends aam_Control_Subject {
36
  private $_cap_key = '';
37
 
38
  /**
39
- *
40
- * @param type $id
41
  */
42
  public function __construct($id) {
43
  parent::__construct($id);
@@ -55,8 +55,11 @@ class aam_Control_Subject_User extends aam_Control_Subject {
55
  }
56
 
57
  /**
 
58
  *
59
- * @return type
 
 
60
  */
61
  public function delete() {
62
  $response = false;
@@ -69,9 +72,12 @@ class aam_Control_Subject_User extends aam_Control_Subject {
69
  }
70
 
71
  /**
 
72
  *
73
- * @global type $wpdb
74
  * @return boolean
 
 
 
75
  */
76
  public function block() {
77
  global $wpdb;
@@ -104,7 +110,8 @@ class aam_Control_Subject_User extends aam_Control_Subject {
104
  protected function retrieveSubject() {
105
  global $current_user;
106
 
107
- if ($current_user instanceof WP_User && $current_user->ID == $this->getId()) {
 
108
  $subject = $current_user;
109
  } else {
110
  $subject = new WP_User($this->getId());
@@ -130,16 +137,20 @@ class aam_Control_Subject_User extends aam_Control_Subject {
130
 
131
  /**
132
  *
133
- * @return type
134
  */
135
  public function getCapabilities() {
136
  return $this->getSubject()->allcaps;
137
  }
138
 
139
  /**
 
140
  *
141
- * @param type $capability
142
- * @return type
 
 
 
143
  */
144
  public function hasCapability($capability) {
145
  return user_can($this->getSubject(), $capability);
@@ -228,7 +239,7 @@ class aam_Control_Subject_User extends aam_Control_Subject {
228
  * @param type $object
229
  * @param type $object_id
230
  * @param bool $inherit
231
- *
232
  * @return mixed
233
  */
234
  public function readOption($object, $object_id = 0, $inherit = true) {
@@ -261,12 +272,63 @@ class aam_Control_Subject_User extends aam_Control_Subject {
261
  $this->getId(), $this->getOptionName($object, $object_id)
262
  );
263
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
 
265
  /**
 
266
  *
267
- * @param type $object
268
- * @param type $object_id
269
- * @return type
 
 
 
 
 
 
 
270
  */
271
  protected function getOptionName($object, $object_id) {
272
  return "aam_{$object}" . ($object_id ? "_{$object_id}" : '');
@@ -294,6 +356,7 @@ class aam_Control_Subject_User extends aam_Control_Subject {
294
  */
295
  public function readCache(){
296
  $cache = get_user_option('aam_cache', $this->getId());
 
297
  return (is_array($cache) ? $cache : array());
298
  }
299
 
8
  */
9
 
10
  /**
11
+ * User's Subject
12
  *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
37
  private $_cap_key = '';
38
 
39
  /**
40
+ * @inheritdoc
 
41
  */
42
  public function __construct($id) {
43
  parent::__construct($id);
55
  }
56
 
57
  /**
58
+ * Delete User
59
  *
60
+ * @return boolean
61
+ *
62
+ * @access public
63
  */
64
  public function delete() {
65
  $response = false;
72
  }
73
 
74
  /**
75
+ * Block User
76
  *
 
77
  * @return boolean
78
+ *
79
+ * @access public
80
+ * @global wpdb $wpdb
81
  */
82
  public function block() {
83
  global $wpdb;
110
  protected function retrieveSubject() {
111
  global $current_user;
112
 
113
+ if (($current_user instanceof WP_User)
114
+ && ($current_user->ID == $this->getId())) {
115
  $subject = $current_user;
116
  } else {
117
  $subject = new WP_User($this->getId());
137
 
138
  /**
139
  *
140
+ * @return array
141
  */
142
  public function getCapabilities() {
143
  return $this->getSubject()->allcaps;
144
  }
145
 
146
  /**
147
+ * Check if user has specified capability
148
  *
149
+ * @param string $capability
150
+ *
151
+ * @return boolean
152
+ *
153
+ * @access public
154
  */
155
  public function hasCapability($capability) {
156
  return user_can($this->getSubject(), $capability);
239
  * @param type $object
240
  * @param type $object_id
241
  * @param bool $inherit
242
+ *
243
  * @return mixed
244
  */
245
  public function readOption($object, $object_id = 0, $inherit = true) {
272
  $this->getId(), $this->getOptionName($object, $object_id)
273
  );
274
  }
275
+
276
+ /**
277
+ * @inheritdoc
278
+ */
279
+ public function hasFlag($flag){
280
+ return get_user_option("aam_{$flag}", $this->getId());
281
+ }
282
+
283
+ /**
284
+ * @inheritdoc
285
+ */
286
+ public function setFlag($flag, $value = true) {
287
+ if ($value === true){
288
+ update_user_option($this->getId(), "aam_{$flag}", $value);
289
+ } else {
290
+ delete_user_option($this->getId(), "aam_{$flag}");
291
+ }
292
+ }
293
+
294
+ /**
295
+ * @inheritdoc
296
+ */
297
+ public function clearAllOptions()
298
+ {
299
+ global $wpdb;
300
+
301
+ $mask = 'aam_%_' . $this->getId();
302
+
303
+ //clear all settings in usermeta table
304
+ $prefix = $wpdb->get_blog_prefix();
305
+ $wpdb->query(
306
+ "DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '{$prefix}{$mask}'"
307
+ );
308
+
309
+ //clear all settings in postmeta table
310
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '{$mask}'");
311
+
312
+ $this->clearCache(); //delete cache
313
+ $this->resetCapability(); //reset default capabilities
314
+ $this->setFlag(aam_Control_Subject::FLAG_MODIFIED, false); //clear flag
315
+
316
+ do_action('aam_clear_all_options', $this);
317
+ }
318
 
319
  /**
320
+ * Prepare option's name
321
  *
322
+ * Compile option's name based on object name and object ID. As example if
323
+ * object name is "post" and object ID is "5", the compiled option's name is
324
+ * aam_post_5.
325
+ *
326
+ * @param string $object
327
+ * @param string|int $object_id
328
+ *
329
+ * @return string
330
+ *
331
+ * @access protected
332
  */
333
  protected function getOptionName($object, $object_id) {
334
  return "aam_{$object}" . ($object_id ? "_{$object_id}" : '');
356
  */
357
  public function readCache(){
358
  $cache = get_user_option('aam_cache', $this->getId());
359
+
360
  return (is_array($cache) ? $cache : array());
361
  }
362
 
application/control/subject/visitor.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -100,6 +101,26 @@ class aam_Control_Subject_Visitor extends aam_Control_Subject
100
  protected function getOptionName($object, $object_id){
101
  return 'aam_' . self::UID . "_{$object}" . ($object_id ? "_{$object_id}" : '');
102
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  /**
105
  *
@@ -120,6 +141,7 @@ class aam_Control_Subject_Visitor extends aam_Control_Subject
120
  */
121
  public function readCache(){
122
  $cache = aam_Core_API::getBlogOption('aam_visitor_cache', array());
 
123
  return (is_array($cache) ? $cache : array());
124
  }
125
 
@@ -147,4 +169,26 @@ class aam_Control_Subject_Visitor extends aam_Control_Subject
147
  return aam_Core_API::deleteBlogOption('aam_visitor_cache');
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
101
  protected function getOptionName($object, $object_id){
102
  return 'aam_' . self::UID . "_{$object}" . ($object_id ? "_{$object_id}" : '');
103
  }
104
+
105
+ /**
106
+ * @inheritdoc
107
+ */
108
+ public function hasFlag($flag) {
109
+ $option = 'aam_' . self::UID . "_{$flag}";
110
+ return aam_Core_API::getBlogOption($option);
111
+ }
112
+
113
+ /**
114
+ * @inheritdoc
115
+ */
116
+ public function setFlag($flag, $value = true) {
117
+ $option = 'aam_' . self::UID . "_{$flag}";
118
+ if ($value === true){
119
+ aam_Core_API::updateBlogOption($option, $value);
120
+ } else {
121
+ aam_Core_API::deleteBlogOption($option);
122
+ }
123
+ }
124
 
125
  /**
126
  *
141
  */
142
  public function readCache(){
143
  $cache = aam_Core_API::getBlogOption('aam_visitor_cache', array());
144
+
145
  return (is_array($cache) ? $cache : array());
146
  }
147
 
169
  return aam_Core_API::deleteBlogOption('aam_visitor_cache');
170
  }
171
 
172
+ /**
173
+ * @inheritdoc
174
+ */
175
+ public function clearAllOptions(){
176
+ global $wpdb;
177
+
178
+ $mask = 'aam_%_' . self::UID;
179
+ //clear postmeta data
180
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '{$mask}'");
181
+
182
+ //clear all settings in options table
183
+ //TODO - convert mask to the standart aam_%_[subject]
184
+ $mask = 'aam_' . self::UID . '_%';
185
+ $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '{$mask}'");
186
+
187
+ $this->clearCache(); //delete cache
188
+ //clear modifield flag
189
+ $this->setFlag(aam_Control_Subject::FLAG_MODIFIED, false);
190
+
191
+ do_action('aam_clear_all_options', $this);
192
+ }
193
+
194
  }
application/core/api.php CHANGED
@@ -74,13 +74,13 @@ final class aam_Core_API {
74
  * @static
75
  */
76
  public static function deleteBlogOption($option, $blog_id = null) {
77
- if (is_multisite()) {
78
  $blog = (is_null($blog_id) ? get_current_blog_id() : $blog_id);
79
  $response = delete_blog_option($blog, $option);
80
  } else {
81
  $response = delete_option($option);
82
  }
83
-
84
  return $response;
85
  }
86
 
@@ -141,7 +141,7 @@ final class aam_Core_API {
141
  public static function isNetworkPanel() {
142
  return (is_multisite() && is_network_admin() ? TRUE : FALSE);
143
  }
144
-
145
  /**
146
  * Check if SSL is used
147
  *
@@ -150,18 +150,66 @@ final class aam_Core_API {
150
  * @access public
151
  * @static
152
  */
153
- public static function isSSL(){
154
- if (force_ssl_admin()){
155
- $response = true;
156
- } elseif (aam_Core_Request::server('HTTPS')){
157
- $response = true;
158
- } elseif (aam_Core_Request::server('REQUEST_SCHEME') == 'https'){
159
- $response = true;
160
- } else {
161
- $response = false;
162
- }
163
-
164
- return $response;
165
- }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
74
  * @static
75
  */
76
  public static function deleteBlogOption($option, $blog_id = null) {
77
+ if (is_multisite()) {
78
  $blog = (is_null($blog_id) ? get_current_blog_id() : $blog_id);
79
  $response = delete_blog_option($blog, $option);
80
  } else {
81
  $response = delete_option($option);
82
  }
83
+
84
  return $response;
85
  }
86
 
141
  public static function isNetworkPanel() {
142
  return (is_multisite() && is_network_admin() ? TRUE : FALSE);
143
  }
144
+
145
  /**
146
  * Check if SSL is used
147
  *
150
  * @access public
151
  * @static
152
  */
153
+ public static function isSSL() {
154
+ if (force_ssl_admin()) {
155
+ $response = true;
156
+ } elseif (aam_Core_Request::server('HTTPS')) {
157
+ $response = true;
158
+ } elseif (aam_Core_Request::server('REQUEST_SCHEME') == 'https') {
159
+ $response = true;
160
+ } else {
161
+ $response = false;
162
+ }
 
 
 
163
 
164
+ return $response;
165
+ }
166
+
167
+ /**
168
+ * Get User Capability Level
169
+ *
170
+ * Iterate throught User Capabilities and find out the higher User Level
171
+ *
172
+ * @param WP_User $user
173
+ *
174
+ * @return int
175
+ *
176
+ * @access public
177
+ * @static
178
+ */
179
+ public static function getUserLevel(WP_User $user = null){
180
+ if (is_null($user) ){
181
+ $user = wp_get_current_user();
182
+ }
183
+
184
+ $caps = $user->allcaps;
185
+ //get users highest level
186
+ $level = 0;
187
+ do {
188
+ $level++;
189
+ } while (isset($caps["level_{$level}"]) && $caps["level_{$level}"]);
190
+
191
+ return $level - 1;
192
+ }
193
+
194
+ /**
195
+ * Check if current user is super admin
196
+ *
197
+ * Super admin is someone who is allowed to manage all roles and users. This
198
+ * user is defined in ConfigPress parameter aam.super_admin
199
+ *
200
+ * @return boolean
201
+ *
202
+ * @access public
203
+ * @static
204
+ */
205
+ public static function isSuperAdmin(){
206
+ if (is_multisite()){
207
+ $response = is_super_admin();
208
+ } else {
209
+ $super_admin = aam_Core_ConfigPress::getParam('aam.super_admin', 0);
210
+ $response = ($super_admin == get_current_user_id() ? true : false);
211
+ }
212
+
213
+ return $response;
214
+ }
215
  }
application/core/extension.php CHANGED
@@ -1,12 +1,10 @@
1
  <?php
2
 
3
  /**
4
- Copyright (C) <2013-2014> Vasyl Martyniuk <support@wpaam.com>
5
-
6
- This program is commercial software: you are not allowed to redistribute it
7
- and/or modify. Unauthorized copying of this file, via any medium is strictly
8
- prohibited.
9
- For any questions or concerns contact Vasyl Martyniuk <support@wpaam.com>
10
  */
11
 
12
  /**
1
  <?php
2
 
3
  /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
 
 
8
  */
9
 
10
  /**
application/core/repository.php CHANGED
@@ -42,10 +42,22 @@ class aam_Core_Repository {
42
  private $_basedir = '';
43
 
44
  /**
45
- *
46
- * @var type
 
 
 
47
  */
48
  private $_cache = array();
 
 
 
 
 
 
 
 
 
49
 
50
  /**
51
  * Main AAM class
@@ -90,7 +102,11 @@ class aam_Core_Repository {
90
  }
91
 
92
  /**
93
- *
 
 
 
 
94
  */
95
  public function download() {
96
  $this->initFilesystem();
@@ -162,6 +178,8 @@ class aam_Core_Repository {
162
  $response = true;
163
  unset($repository[$extension]);
164
  aam_Core_API::updateBlogOption('aam_extensions', $repository, 1);
 
 
165
  }
166
  }
167
 
@@ -205,7 +223,15 @@ class aam_Core_Repository {
205
  if ($content && $wp_filesystem->put_contents($zip, $content)) {
206
  $response = $this->insert($zip);
207
  $wp_filesystem->delete($zip);
 
 
 
 
 
 
208
  }
 
 
209
  }
210
 
211
  return $response;
@@ -220,6 +246,9 @@ class aam_Core_Repository {
220
  $response = true;
221
  if (is_wp_error(unzip_file($zip, $this->_basedir))) {
222
  $response = false;
 
 
 
223
  }
224
 
225
  return $response;
@@ -273,5 +302,27 @@ class aam_Core_Repository {
273
  public function getParent(){
274
  return $this->_parent;
275
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
 
277
  }
42
  private $_basedir = '';
43
 
44
  /**
45
+ * Extension list cache
46
+ *
47
+ * @var array
48
+ *
49
+ * @access private
50
  */
51
  private $_cache = array();
52
+
53
+ /**
54
+ * Repository Errors
55
+ *
56
+ * @var array
57
+ *
58
+ * @access private
59
+ */
60
+ private $_errors = array();
61
 
62
  /**
63
  * Main AAM class
102
  }
103
 
104
  /**
105
+ * Download extension from the external server
106
+ *
107
+ * @return void
108
+ *
109
+ * @access public
110
  */
111
  public function download() {
112
  $this->initFilesystem();
178
  $response = true;
179
  unset($repository[$extension]);
180
  aam_Core_API::updateBlogOption('aam_extensions', $repository, 1);
181
+ } else {
182
+ $this->addError(__('Failed to Remove Extension', 'aam'));
183
  }
184
  }
185
 
223
  if ($content && $wp_filesystem->put_contents($zip, $content)) {
224
  $response = $this->insert($zip);
225
  $wp_filesystem->delete($zip);
226
+ } elseif (empty($content)){
227
+ $this->addError(__('Invalid License Key', 'aam'));
228
+ } else {
229
+ $this->addError(
230
+ __('Failed to write file to wp-content/aam folder', 'aam')
231
+ );
232
  }
233
+ } else {
234
+ $this->addError(__('Failed to reach the WPAAM Server', 'aam'));
235
  }
236
 
237
  return $response;
246
  $response = true;
247
  if (is_wp_error(unzip_file($zip, $this->_basedir))) {
248
  $response = false;
249
+ $this->addError(
250
+ __('Failed to insert extension to extension folder', 'aam')
251
+ );
252
  }
253
 
254
  return $response;
302
  public function getParent(){
303
  return $this->_parent;
304
  }
305
+
306
+ /**
307
+ * Add error
308
+ *
309
+ * @param string $message
310
+ *
311
+ * @access public
312
+ */
313
+ public function addError($message){
314
+ $this->_errors[] = $message;
315
+ }
316
+
317
+ /**
318
+ * Get all errors
319
+ *
320
+ * @return array
321
+ *
322
+ * @access public
323
+ */
324
+ public function getErrors(){
325
+ return $this->_errors;
326
+ }
327
 
328
  }
application/core/request.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/core/settings.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ * Core Plugin Settings
12
+ *
13
+ * Collection of core and default settings that are used across the plugin
14
+ *
15
+ * @package AAM
16
+ * @author Vasyl Martyniuk <support@wpaam.com>
17
+ * @copyright Copyright C Vasyl Martyniuk
18
+ * @license GNU General Public License {@link http://www.gnu.org/licenses/}
19
+ */
20
+ final class aam_Core_Settings {
21
+
22
+ /**
23
+ * Collection of settings
24
+ *
25
+ * @var array
26
+ *
27
+ * @access private
28
+ * @static
29
+ */
30
+ private static $_collection = array();
31
+
32
+ /**
33
+ * Get Setting
34
+ *
35
+ * @param string $setting
36
+ * @param mixed $default
37
+ *
38
+ * @return mixed
39
+ *
40
+ * @access public
41
+ * @static
42
+ */
43
+ public static function get($setting, $default = null) {
44
+ if (empty(self::$_collection)) {
45
+ self::init();
46
+ }
47
+
48
+ if (isset(self::$_collection[$setting])) {
49
+ $response = self::$_collection[$setting];
50
+ } else {
51
+ $response = $default;
52
+ }
53
+
54
+ return apply_filters('aam_core_setting', $response, $setting);
55
+ }
56
+
57
+ /**
58
+ * Initialize all core & default settings
59
+ *
60
+ * @return void
61
+ *
62
+ * @access protected
63
+ * @static
64
+ */
65
+ protected static function init() {
66
+ //initialize default posts & terms restrictions
67
+ self::$_collection['term_frontend_restrictions'] = array(
68
+ aam_Control_Object_Term::ACTION_BROWSE,
69
+ aam_Control_Object_Term::ACTION_EXCLUDE,
70
+ aam_Control_Object_Term::ACTION_LIST
71
+ );
72
+ self::$_collection['term_backend_restrictions'] = array(
73
+ aam_Control_Object_Term::ACTION_BROWSE,
74
+ aam_Control_Object_Term::ACTION_EDIT,
75
+ aam_Control_Object_Term::ACTION_LIST
76
+ );
77
+ self::$_collection['post_frontend_restrictions'] = array(
78
+ aam_Control_Object_Post::ACTION_READ,
79
+ aam_Control_Object_Post::ACTION_EXCLUDE,
80
+ aam_Control_Object_Post::ACTION_COMMENT
81
+ );
82
+ self::$_collection['post_backend_restrictions'] = array(
83
+ aam_Control_Object_Post::ACTION_TRASH,
84
+ aam_Control_Object_Post::ACTION_DELETE,
85
+ aam_Control_Object_Post::ACTION_EDIT
86
+ );
87
+ }
88
+
89
+ }
application/core/update.php CHANGED
@@ -8,10 +8,11 @@
8
  */
9
 
10
  /**
 
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
14
- * @copyright Copyright C 2013 Vasyl Martyniuk
15
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
16
  */
17
  final class aam_Core_Update {
@@ -37,7 +38,6 @@ final class aam_Core_Update {
37
  $this->_stages = apply_filters('aam_update_stages', array(
38
  array($this, 'downloadRepository'),
39
  array($this, 'flashCache'),
40
- //array($this, 'muPlugin'), - TODO. Deactivated for futher use
41
  array($this, 'updateFlag')
42
  ));
43
  }
@@ -96,15 +96,20 @@ final class aam_Core_Update {
96
  $query = 'SELECT blog_id FROM ' . $wpdb->blogs;
97
  $blog_list = $wpdb->get_results($query);
98
  if (is_array($blog_list)) {
 
99
  foreach ($blog_list as $blog) {
100
- $query = 'DELETE FROM ' . $wpdb->get_blog_prefix($blog->blog_id) . 'options ';
101
- $query .= 'WHERE `option_name` = "aam_visitor_cache"';
102
- $wpdb->query($query);
 
 
 
 
103
  }
104
  }
105
  } else {
106
  $query = 'DELETE FROM ' . $wpdb->options . ' ';
107
- $query .= 'WHERE `option_name` = "aam_visitor_cache"';
108
  $wpdb->query($query);
109
  }
110
 
@@ -115,32 +120,6 @@ final class aam_Core_Update {
115
 
116
  return true;
117
  }
118
-
119
- /**
120
- * Create Must-Use Plugin
121
- *
122
- * Is used to hook into the earliest system load
123
- *
124
- * @return boolean
125
- *
126
- * @access public
127
- */
128
- public function muPlugin() {
129
- $base_dir = WP_CONTENT_DIR . '/mu-plugins';
130
-
131
- $continue = (file_exists($base_dir) ? true : @mkdir($base_dir, 0755));
132
-
133
- if ($continue) {
134
- $hook_file = $base_dir . '/aam.php';
135
- //remove current hook and replace with newer version
136
- if (file_exists($hook_file)) {
137
- @unlink($hook_file);
138
- }
139
- @copy(dirname(__FILE__) . '/mu.php', $base_dir . '/aam.php');
140
- }
141
-
142
- return true;
143
- }
144
 
145
  /**
146
  * Change the Update flag
8
  */
9
 
10
  /**
11
+ * AAM Plugin Update Hook
12
  *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
  */
18
  final class aam_Core_Update {
38
  $this->_stages = apply_filters('aam_update_stages', array(
39
  array($this, 'downloadRepository'),
40
  array($this, 'flashCache'),
 
41
  array($this, 'updateFlag')
42
  ));
43
  }
96
  $query = 'SELECT blog_id FROM ' . $wpdb->blogs;
97
  $blog_list = $wpdb->get_results($query);
98
  if (is_array($blog_list)) {
99
+ $query = 'DELETE FROM %s WHERE `option_name` = "aam_%s_cache"';
100
  foreach ($blog_list as $blog) {
101
+ $wpdb->query(
102
+ sprintf(
103
+ $query,
104
+ $wpdb->get_blog_prefix($blog->blog_id) . 'options',
105
+ aam_Control_Subject_Visitor::UID
106
+ )
107
+ );
108
  }
109
  }
110
  } else {
111
  $query = 'DELETE FROM ' . $wpdb->options . ' ';
112
+ $query .= 'WHERE `option_name` = "aam_' . aam_Control_Subject_Visitor::UID . '_cache"';
113
  $wpdb->query($query);
114
  }
115
 
120
 
121
  return true;
122
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
 
124
  /**
125
  * Change the Update flag
application/view/abstract.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -7,22 +8,33 @@
7
  */
8
 
9
  /**
10
- *
 
11
  * @package AAM
12
  * @author Vasyl Martyniuk <support@wpaam.com>
13
- * @copyright Copyright C 2013 Vasyl Martyniuk
14
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
15
  */
16
  abstract class aam_View_Abstract {
17
 
18
  /**
19
- *
20
- * @var type
 
 
 
21
  */
22
  static private $_subject = null;
23
 
24
  /**
25
- *
 
 
 
 
 
 
 
26
  */
27
  public function __construct() {
28
  if (is_null(self::$_subject)) {
@@ -33,30 +45,94 @@ abstract class aam_View_Abstract {
33
  $this->setSubject(new $subject_class(
34
  aam_Core_Request::request('subject_id')
35
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
  }
38
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  /**
41
- *
42
- * @return type
 
 
 
43
  */
44
  public function getSubject() {
45
  return self::$_subject;
46
  }
47
 
48
  /**
49
- *
 
50
  * @param aam_Control_Subject $subject
 
 
 
 
51
  */
52
  public function setSubject(aam_Control_Subject $subject) {
53
  self::$_subject = $subject;
54
  }
55
 
56
  /**
57
- *
58
- * @param type $tmpl_path
59
- * @return type
 
 
 
 
60
  */
61
  public function loadTemplate($tmpl_path) {
62
  ob_start();
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
8
  */
9
 
10
  /**
11
+ * Abstract class for all View Models
12
+ *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
  */
18
  abstract class aam_View_Abstract {
19
 
20
  /**
21
+ * Current Subject
22
+ *
23
+ * @var aam_Control_Subject
24
+ *
25
+ * @access private
26
  */
27
  static private $_subject = null;
28
 
29
  /**
30
+ * Construct the Object
31
+ *
32
+ * Instantiate the subject one type that is going to be shared with all view
33
+ * models.
34
+ *
35
+ * @return void
36
+ *
37
+ * @access public
38
  */
39
  public function __construct() {
40
  if (is_null(self::$_subject)) {
45
  $this->setSubject(new $subject_class(
46
  aam_Core_Request::request('subject_id')
47
  ));
48
+ //check if view for current subject can be managed
49
+ $this->isManagable();
50
+ }
51
+ }
52
+
53
+ //control default option list
54
+ add_filter('aam_default_option_list', array($this, 'defaultOption'));
55
+ }
56
+
57
+ /**
58
+ * Check if view can be managed
59
+ *
60
+ * @return void
61
+ *
62
+ * @access public
63
+ * @throw Exception You are not allowed to manage current view
64
+ */
65
+ public function isManagable(){
66
+ if ($this->getSubject()->getUID() == aam_Control_Subject_Role::UID){
67
+ $caps = $this->getSubject()->capabilities;
68
+ } elseif ($this->getSubject()->getUID == aam_Control_Subject_User::UID){
69
+ //AAM does not support multi-roles. Get only one first role
70
+ $roles = $this->getSubject()->roles;
71
+ $caps = get_role(array_shift($roles))->capabilities;
72
+ } else {
73
+ $caps = apply_filters('aam_managable_capabilities', null, $this);
74
+ }
75
+
76
+ if ($caps && !aam_Core_API::isSuperAdmin()){
77
+ //get user's highest level
78
+ $level = aam_Core_API::getUserLevel();
79
+ if (!empty($caps['level_' . $level]) && $caps['level_' . $level]){
80
+ Throw new Exception(
81
+ __('You are not allowed to manager current view', 'aam')
82
+ );
83
  }
84
  }
85
  }
86
+
87
+ /**
88
+ * Control default set of options
89
+ *
90
+ * This is very important function. It control the default option for each
91
+ * feature. It covers the scenario when the set of UI options is represented by
92
+ * checkboxes.
93
+ *
94
+ * @param array $options
95
+ *
96
+ * @return array
97
+ *
98
+ * @access public
99
+ */
100
+ public function defaultOption($options){
101
+ return $options;
102
+ }
103
 
104
  /**
105
+ * Get Subject
106
+ *
107
+ * @return aam_Control_Subject
108
+ *
109
+ * @access public
110
  */
111
  public function getSubject() {
112
  return self::$_subject;
113
  }
114
 
115
  /**
116
+ * Set Subject
117
+ *
118
  * @param aam_Control_Subject $subject
119
+ *
120
+ * @return void
121
+ *
122
+ * @access public
123
  */
124
  public function setSubject(aam_Control_Subject $subject) {
125
  self::$_subject = $subject;
126
  }
127
 
128
  /**
129
+ * Load View template
130
+ *
131
+ * @param string $tmpl_path
132
+ *
133
+ * @return string
134
+ *
135
+ * @access public
136
  */
137
  public function loadTemplate($tmpl_path) {
138
  ob_start();
application/view/ajax.php DELETED
@@ -1,572 +0,0 @@
1
- <?php
2
- /**
3
- * ======================================================================
4
- * LICENSE: This file is subject to the terms and conditions defined in *
5
- * file 'license.txt', which is part of this source code package. *
6
- * ======================================================================
7
- */
8
-
9
- /**
10
- * Ajax Call router
11
- *
12
- * Based on sub_action prepare and runs proper model
13
- *
14
- * @package AAM
15
- * @author Vasyl Martyniuk <support@wpaam.com>
16
- * @copyright Copyright C 2013 Vasyl Martyniuk
17
- * @license GNU General Public License {@link http://www.gnu.org/licenses/}
18
- */
19
- class aam_View_Ajax extends aam_View_Abstract{
20
-
21
- /**
22
- * Process the ajax call
23
- *
24
- * @return string
25
- *
26
- * @access public
27
- */
28
- public function run() {
29
- switch (aam_Core_Request::request('sub_action')) {
30
- case 'role_list':
31
- $response = $this->retrieveRoleList();
32
- break;
33
-
34
- case 'pure_role_list':
35
- $response = $this->retrievePureRoleList();
36
- break;
37
-
38
- case 'user_list':
39
- $response = $this->retrieveUserList();
40
- break;
41
-
42
- case 'add_role':
43
- $response = $this->addRole();
44
- break;
45
-
46
- case 'edit_role':
47
- $response = $this->editRole();
48
- break;
49
-
50
- case 'delete_role':
51
- $response = $this->deleteRole();
52
- break;
53
-
54
- case 'block_user':
55
- $response = $this->blockUser();
56
- break;
57
-
58
- case 'delete_user':
59
- $response = $this->deleteUser();
60
- break;
61
-
62
- case 'load_metaboxes':
63
- $response = $this->loadMetaboxes();
64
- break;
65
-
66
- case 'init_link':
67
- $response = $this->initLink();
68
- break;
69
-
70
- case 'load_capabilities':
71
- $response = $this->loadCapabilities();
72
- break;
73
-
74
- case 'role_capabilities':
75
- $response = $this->getRoleCapabilities();
76
- break;
77
-
78
- case 'add_capability':
79
- $response = $this->addCapability();
80
- break;
81
-
82
- case 'delete_capability':
83
- $response = $this->deleteCapability();
84
- break;
85
-
86
- case 'restore_capability':
87
- $response = $this->restoreCapability();
88
- break;
89
-
90
- case 'post_type_list':
91
- $response = $this->getPostTypeList();
92
- break;
93
-
94
- case 'post_list':
95
- $response = $this->getPostList();
96
- break;
97
-
98
- case 'post_tree':
99
- $response = $this->getPostTree();
100
- break;
101
-
102
- case 'post_breadcrumb':
103
- $response = $this->generatePostBreadcrumb();
104
- break;
105
-
106
- case 'save_access':
107
- $response = $this->saveAccess();
108
- break;
109
-
110
- case 'get_access':
111
- $response = $this->getAccess();
112
- break;
113
-
114
- case 'clear_access':
115
- $response = $this->clearAccess();
116
- break;
117
-
118
- case 'delete_post':
119
- $response = $this->deletePost();
120
- break;
121
-
122
- case 'event_list':
123
- $response = $this->getEventList();
124
- break;
125
-
126
- case 'save':
127
- $response = $this->save();
128
- break;
129
-
130
- case 'check_roleback':
131
- $response = $this->checkRoleback();
132
- break;
133
-
134
- case 'roleback':
135
- $response = $this->roleback();
136
- break;
137
-
138
- case 'install_extension':
139
- $response = $this->installExtension();
140
- break;
141
-
142
- case 'remove_extension':
143
- $response = $this->removeExtension();
144
- break;
145
-
146
- case 'save_configpress':
147
- $response = $this->saveConfigPress();
148
- break;
149
-
150
- //TODO - Remove in 07/15/2014
151
- case 'migrate':
152
- $response = $this->migrate();
153
- break;
154
-
155
- default:
156
- $response = apply_filters(
157
- 'aam_ajax_call', -1, $this->getSubject()
158
- );
159
- break;
160
- }
161
-
162
- return $response;
163
- }
164
-
165
- /**
166
- * Retrieve Available for Editing Role List
167
- *
168
- * @return string
169
- *
170
- * @access protected
171
- */
172
- protected function retrieveRoleList() {
173
- $model = new aam_View_Role;
174
-
175
- return $model->retrieveList();
176
- }
177
-
178
- /**
179
- * Retrieve Pure Role List
180
- *
181
- * @return string
182
- *
183
- * @access protected
184
- */
185
- protected function retrievePureRoleList(){
186
- $model = new aam_View_Role;
187
-
188
- return $model->retrievePureList();
189
- }
190
-
191
- /**
192
- * Retrieve Available User List
193
- *
194
- * @return string
195
- *
196
- * @access protected
197
- */
198
- protected function retrieveUserList() {
199
- $model = new aam_View_User;
200
-
201
- return $model->retrieveList();
202
- }
203
-
204
- /**
205
- * Add New Role
206
- *
207
- * @return string
208
- *
209
- * @access protected
210
- */
211
- protected function addRole() {
212
- $model = new aam_View_Role;
213
-
214
- return $model->add();
215
- }
216
-
217
- /**
218
- * Edit Existing Role
219
- *
220
- * @return string
221
- *
222
- * @access protected
223
- */
224
- protected function editRole() {
225
- $model = new aam_View_Role;
226
-
227
- return $model->edit();
228
- }
229
-
230
- /**
231
- * Delete Existing Role
232
- *
233
- * @return string
234
- *
235
- * @access protected
236
- */
237
- protected function deleteRole() {
238
- $model = new aam_View_Role;
239
-
240
- return $model->delete();
241
- }
242
-
243
- /**
244
- * Block Selected User
245
- *
246
- * @return string
247
- *
248
- * @access protected
249
- */
250
- protected function blockUser() {
251
- $model = new aam_View_User;
252
-
253
- return $model->block();
254
- }
255
-
256
- /**
257
- * Delete Selected User
258
- *
259
- * @return string
260
- *
261
- * @access protected
262
- */
263
- protected function deleteUser() {
264
- $model = new aam_View_User;
265
-
266
- return $model->delete();
267
- }
268
-
269
- /**
270
- * Load List of Metaboxes
271
- *
272
- * @return string
273
- *
274
- * @access protected
275
- */
276
- protected function loadMetaboxes() {
277
- $model = new aam_View_Metabox;
278
-
279
- return $model->retrieveList();
280
- }
281
-
282
- /**
283
- * Initialize list of metaboxes from individual link
284
- *
285
- * @return string
286
- *
287
- * @access protected
288
- */
289
- protected function initLink() {
290
- $model = new aam_View_Metabox;
291
-
292
- return $model->initLink();
293
- }
294
-
295
- /**
296
- * Load list of capabilities
297
- *
298
- * @return string
299
- *
300
- * @access protected
301
- */
302
- protected function loadCapabilities() {
303
- $model = new aam_View_Capability;
304
-
305
- return $model->retrieveList();
306
- }
307
-
308
- /**
309
- * Get list of Capabilities by selected Role
310
- *
311
- * @return string
312
- *
313
- * @access protected
314
- */
315
- protected function getRoleCapabilities() {
316
- $model = new aam_View_Capability;
317
-
318
- return $model->retrieveRoleCapabilities();
319
- }
320
-
321
- /**
322
- * Add New Capability
323
- *
324
- * @return string
325
- *
326
- * @access protected
327
- */
328
- protected function addCapability() {
329
- $model = new aam_View_Capability;
330
-
331
- return $model->addCapability();
332
- }
333
-
334
- /**
335
- * Delete Capability
336
- *
337
- * @return string
338
- *
339
- * @access protected
340
- */
341
- protected function deleteCapability() {
342
- $model = new aam_View_Capability;
343
-
344
- return $model->deleteCapability();
345
- }
346
-
347
- /**
348
- * Restore Capabilities
349
- *
350
- * @return string
351
- *
352
- * @access protected
353
- */
354
- protected function restoreCapability() {
355
- $model = new aam_View_Capability;
356
-
357
- return $model->restoreCapability();
358
- }
359
-
360
- /**
361
- * Get the list of Post Types
362
- *
363
- * This is used for Post & Term Access Feature
364
- *
365
- * @return string
366
- *
367
- * @access protected
368
- */
369
- protected function getPostTypeList() {
370
- $model = new aam_View_Post;
371
-
372
- return $model->retrievePostTypeList();
373
- }
374
-
375
- /**
376
- * Get the List of Posts
377
- *
378
- * @return string
379
- *
380
- * @access protected
381
- */
382
- protected function getPostList() {
383
- $model = new aam_View_Post;
384
-
385
- return $model->retrievePostList();
386
- }
387
-
388
- /**
389
- * Get Post Tree
390
- *
391
- * @return string
392
- *
393
- * @access protected
394
- */
395
- protected function getPostTree() {
396
- $model = new aam_View_Post;
397
-
398
- return $model->getPostTree();
399
- }
400
-
401
- /**
402
- * Save Access settings for Post or Term
403
- *
404
- * @return string
405
- *
406
- * @access protected
407
- */
408
- protected function saveAccess() {
409
- $model = new aam_View_Post();
410
-
411
- return $model->saveAccess();
412
- }
413
-
414
- /**
415
- * Get Access settings for Post or Term
416
- *
417
- * @return string
418
- *
419
- * @access protected
420
- */
421
- protected function getAccess() {
422
- $model = new aam_View_Post();
423
-
424
- return $model->getAccess();
425
- }
426
-
427
- /**
428
- * Restore default access level for Post or Term
429
- *
430
- * @return string
431
- *
432
- * @access protected
433
- */
434
- protected function clearAccess() {
435
- $model = new aam_View_Post();
436
-
437
- return $model->clearAccess();
438
- }
439
-
440
- /**
441
- * Delete Post
442
- *
443
- * @return string
444
- *
445
- * @access protected
446
- */
447
- protected function deletePost(){
448
- $model = new aam_View_Post();
449
-
450
- return $model->deletePost();
451
- }
452
-
453
- /**
454
- * Prepare and generate the post breadcrumb
455
- *
456
- * @return string
457
- *
458
- * @access protected
459
- */
460
- protected function generatePostBreadcrumb() {
461
- $model = new aam_View_Post;
462
-
463
- return $model->getPostBreadcrumb();
464
- }
465
-
466
- /**
467
- * Get Event List
468
- *
469
- * @return string
470
- *
471
- * @access protected
472
- */
473
- protected function getEventList() {
474
- $model = new aam_View_Event;
475
-
476
- return $model->retrieveEventList();
477
- }
478
-
479
- /**
480
- * Save AAM settings
481
- *
482
- * @return string
483
- *
484
- * @access protected
485
- */
486
- protected function save() {
487
- $model = new aam_View_Manager;
488
-
489
- return $model->save();
490
- }
491
-
492
- /**
493
- * Roleback the changes
494
- *
495
- * @return string
496
- *
497
- * @access protected
498
- */
499
- protected function roleback() {
500
- $model = new aam_View_Manager;
501
-
502
- return $model->roleback();
503
- }
504
-
505
- /**
506
- * Check whether roleback action can be performed
507
- *
508
- * @return string
509
- *
510
- * @access protected
511
- */
512
- protected function checkRoleback() {
513
- $model = new aam_View_Manager;
514
-
515
- return $model->checkRoleback();
516
- }
517
-
518
- /**
519
- * Install extension
520
- *
521
- * @return string
522
- *
523
- * @access protected
524
- */
525
- protected function installExtension() {
526
- $model = new aam_View_Extension();
527
-
528
- return $model->install();
529
- }
530
-
531
- /**
532
- * Remove extension
533
- *
534
- * @return string
535
- *
536
- * @access protected
537
- */
538
- protected function removeExtension() {
539
- $model = new aam_View_Extension();
540
-
541
- return $model->remove();
542
- }
543
-
544
- /**
545
- * Save ConfigPress
546
- *
547
- * @return string
548
- *
549
- * @access protected
550
- */
551
- protected function saveConfigPress(){
552
- $result = aam_Core_ConfigPress::write(aam_Core_Request::post('config'));
553
- return json_encode(array(
554
- 'status' => ($result === false ? 'failure' : 'success')
555
- ));
556
- }
557
-
558
- /**
559
- * Migrate
560
- *
561
- * @return string
562
- *
563
- * @access protected
564
- * @todo Remove in 07/15/2014
565
- */
566
- protected function migrate() {
567
- $model = new aam_Core_Migrate();
568
-
569
- return $model->run();
570
- }
571
-
572
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
application/view/capability.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/collection.php ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+
10
+ /**
11
+ * View collection
12
+ *
13
+ * Collection of features and subjects
14
+ *
15
+ * @package AAM
16
+ * @author Vasyl Martyniuk <support@wpaam.com>
17
+ * @copyright Copyright C Vasyl Martyniuk
18
+ * @license GNU General Public License {@link http://www.gnu.org/licenses/}
19
+ */
20
+ class aam_View_Collection {
21
+
22
+ /**
23
+ * Collection of subjects
24
+ *
25
+ * @var array
26
+ *
27
+ * @access private
28
+ * @static
29
+ */
30
+ static private $_subjects = array();
31
+
32
+ /**
33
+ * Collection of features
34
+ *
35
+ * @var array
36
+ *
37
+ * @access private
38
+ * @static
39
+ */
40
+ static private $_features = array();
41
+
42
+ /**
43
+ * Register Subject
44
+ *
45
+ * @param stdClass $subject
46
+ *
47
+ * @return boolean
48
+ *
49
+ * @access public
50
+ * @static
51
+ */
52
+ public static function registerSubject(stdClass $subject) {
53
+ self::$_subjects[] = $subject;
54
+
55
+ return true;
56
+ }
57
+
58
+ /**
59
+ * Register UI Feature
60
+ *
61
+ * @param stdClass $feature
62
+ *
63
+ * @return boolean
64
+ *
65
+ * @access public
66
+ * @static
67
+ */
68
+ public static function registerFeature(stdClass $feature) {
69
+ $response = false;
70
+
71
+ if (empty($feature->capability)){
72
+ $cap = aam_Core_ConfigPress::getParam(
73
+ 'aam.default_feature_capability', 'administrator'
74
+ );
75
+ } else {
76
+ $cap = $feature->capability;
77
+ }
78
+
79
+ if (self::accessGranted($feature->uid, $cap)) {
80
+ self::$_features[] = $feature;
81
+ $response = true;
82
+ }
83
+
84
+ return $response;
85
+ }
86
+
87
+ /**
88
+ * Check if feature registered
89
+ *
90
+ * If feature is restricted for current user or it does not exist, this function
91
+ * will return false result
92
+ *
93
+ * @param string $search
94
+ *
95
+ * @return boolean
96
+ *
97
+ * @access public
98
+ * @static
99
+ */
100
+ public static function hasFeature($search){
101
+ $found = false;
102
+ foreach(self::$_features as $feature){
103
+ if ($feature->uid == $search){
104
+ $found = true;
105
+ break;
106
+ }
107
+ }
108
+
109
+ return $found;
110
+ }
111
+
112
+ /**
113
+ * Check if subject is registered
114
+ *
115
+ * @param string $search
116
+ *
117
+ * @return boolean
118
+ *
119
+ * @access public
120
+ * @static
121
+ */
122
+ public static function hasSubject($search){
123
+ $found = false;
124
+ foreach(self::$_subjects as $subject){
125
+ if ($subject->uid == $search){
126
+ $found = true;
127
+ break;
128
+ }
129
+ }
130
+
131
+ return $found;
132
+ }
133
+
134
+ /**
135
+ * Get initiated feature
136
+ *
137
+ * Find the feature in the collection of registered features and initiate it if
138
+ * was not initiated already
139
+ *
140
+ * @param string $search
141
+ * @return boolean
142
+ */
143
+ public static function getFeature($search){
144
+ $response = null;
145
+ foreach(self::$_features as $feature){
146
+ if ($feature->uid == $search){
147
+ $response = self::initController($feature);
148
+ break;
149
+ }
150
+ }
151
+
152
+ return $response;
153
+ }
154
+
155
+ /**
156
+ * Get initiated subject
157
+ *
158
+ * Find the subject in the collection of registered subjects and initiate it if
159
+ * was not initiated already
160
+ *
161
+ * @param string $search
162
+ * @return boolean
163
+ */
164
+ public static function getSubject($search){
165
+ $response = null;
166
+ foreach(self::$_subjects as $subject){
167
+ if ($subject->uid == $search){
168
+ $response = self::initController($subject);
169
+ break;
170
+ }
171
+ }
172
+
173
+ return $response;
174
+ }
175
+
176
+ /**
177
+ * Initiate the Controller
178
+ *
179
+ * @param stdClass $feature
180
+ *
181
+ * @return stdClass
182
+ *
183
+ * @access public
184
+ * @static
185
+ */
186
+ public static function initController(stdClass $feature){
187
+ if (is_string($feature->controller)){
188
+ $feature->controller = new $feature->controller;
189
+ }
190
+
191
+ return $feature;
192
+ }
193
+
194
+ /**
195
+ * Retrieve subjects
196
+ *
197
+ * @return array
198
+ *
199
+ * @access public
200
+ * @static
201
+ */
202
+ public static function retrieveSubjects() {
203
+ $subjects = self::$_subjects; //keep originally copy
204
+ usort($subjects, 'aam_View_Collection::positionOrder');
205
+
206
+ //initiate controller
207
+ foreach($subjects as $subject){
208
+ self::initController($subject);
209
+ }
210
+
211
+ return $subjects;
212
+ }
213
+
214
+ /**
215
+ * Retrieve list of features
216
+ *
217
+ * Retrieve sorted list of featured based on current subject
218
+ *
219
+ * @param aam_Control_Subject $subject
220
+ *
221
+ * @return array
222
+ *
223
+ * @access public
224
+ * @static
225
+ */
226
+ public static function retriveFeatures(aam_Control_Subject $subject) {
227
+ $response = array();
228
+
229
+ foreach (self::$_features as $feature) {
230
+ if (in_array($subject->getUID(), $feature->subjects)) {
231
+ $response[] = self::initController($feature);
232
+ }
233
+ }
234
+ usort($response, 'aam_View_Collection::positionOrder');
235
+
236
+ return $response;
237
+ }
238
+
239
+ /**
240
+ * Check if current user can use feature
241
+ *
242
+ * Make sure that current user has enough capabilities to use feature
243
+ *
244
+ * @param string $feature
245
+ * @param string $cap
246
+ *
247
+ * @return boolean
248
+ *
249
+ * @access protected
250
+ * @static
251
+ */
252
+ protected static function accessGranted($feature, $cap = 'administrator') {
253
+ $capability = aam_Core_ConfigPress::getParam(
254
+ "aam.feature.{$feature}.capability", $cap
255
+ );
256
+
257
+ return current_user_can($capability);
258
+ }
259
+
260
+ /**
261
+ * Order list of features or subjectes
262
+ *
263
+ * Reorganize the list based on "position" attribute
264
+ *
265
+ * @param array $features
266
+ *
267
+ * @return array
268
+ *
269
+ * @access public
270
+ * @static
271
+ */
272
+ public static function positionOrder($feature_a, $feature_b){
273
+ $pos_a = (empty($feature_a->position) ? 9999 : $feature_a->position);
274
+ $pos_b = (empty($feature_b->position) ? 9999 : $feature_b->position);
275
+
276
+ if ($pos_a == $pos_b){
277
+ $response = 0;
278
+ } else {
279
+ $response = ($pos_a < $pos_b ? -1 : 1);
280
+ }
281
+
282
+ return $response;
283
+ }
284
+
285
+ }
application/view/configpress.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/event.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -65,5 +66,18 @@ class aam_View_Event extends aam_View_Abstract {
65
  public function content() {
66
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/event.phtml');
67
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  }
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
66
  public function content() {
67
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/event.phtml');
68
  }
69
+
70
+ /**
71
+ * @inheritdoc
72
+ */
73
+ public function defaultOption($options) {
74
+ //make sure that some parts are always in place
75
+ if (!isset($options[aam_Control_Object_Event::UID])) {
76
+ $options[aam_Control_Object_Event::UID] = array();
77
+ }
78
+
79
+ return $options;
80
+ }
81
+
82
 
83
  }
application/view/extension.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -7,10 +8,11 @@
7
  */
8
 
9
  /**
10
- *
 
11
  * @package AAM
12
  * @author Vasyl Martyniuk <support@wpaam.com>
13
- * @copyright Copyright C 2013 Vasyl Martyniuk
14
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
15
  */
16
  class aam_View_Extension extends aam_View_Abstract {
@@ -58,7 +60,10 @@ class aam_View_Extension extends aam_View_Abstract {
58
  if ($license && $repo->add($ext, $license)){
59
  $response = array('status' => 'success');
60
  } else {
61
- $response = array('status' => 'failure');
 
 
 
62
  }
63
 
64
  return json_encode($response);
@@ -79,7 +84,10 @@ class aam_View_Extension extends aam_View_Abstract {
79
  if ($repo && $repo->remove($ext, $license)){
80
  $response = array('status' => 'success');
81
  } else {
82
- $response = array('status' => 'failure');
 
 
 
83
  }
84
 
85
  return json_encode($response);
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
8
  */
9
 
10
  /**
11
+ * Extension UI controller
12
+ *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
  */
18
  class aam_View_Extension extends aam_View_Abstract {
60
  if ($license && $repo->add($ext, $license)){
61
  $response = array('status' => 'success');
62
  } else {
63
+ $response = array(
64
+ 'status' => 'failure',
65
+ 'reasons' => $repo->getErrors()
66
+ );
67
  }
68
 
69
  return json_encode($response);
84
  if ($repo && $repo->remove($ext, $license)){
85
  $response = array('status' => 'success');
86
  } else {
87
+ $response = array(
88
+ 'status' => 'failure',
89
+ 'reasons' => $repo->getErrors()
90
+ );
91
  }
92
 
93
  return json_encode($response);
application/view/manager.php CHANGED
@@ -7,25 +7,44 @@
7
  */
8
 
9
  /**
 
10
  *
11
  * @package AAM
12
  * @author Vasyl Martyniuk <support@wpaam.com>
13
- * @copyright Copyright C 2013 Vasyl Martyniuk
14
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
15
  */
16
  class aam_View_Manager extends aam_View_Abstract {
17
 
18
  /**
19
- *
20
- * @var type
21
  */
22
- private $_cmanager = array();
23
 
24
  /**
25
- *
26
- * @var type
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  */
28
- private $_features = array();
 
 
 
 
 
29
 
30
  /**
31
  * Constructor
@@ -39,294 +58,754 @@ class aam_View_Manager extends aam_View_Abstract {
39
  public function __construct() {
40
  parent::__construct();
41
 
42
- $this->setCManager(
43
- apply_filters('aam_ui_subjects', $this->getDefaultSubjects())
44
- );
45
- $this->setFeatures(
46
- apply_filters('aam_ui_features', $this->getDefaultFeatures())
47
- );
48
  }
49
 
50
  /**
 
 
 
51
  *
52
- * @return type
53
  */
54
- protected function getDefaultSubjects() {
55
- return array(
56
- 'roles' => array(
57
- 'position' => 5,
58
- 'segment' => 'role',
59
- 'label' => __('Roles', 'aam'),
60
- 'title' => __('Role Manager', 'aam'),
61
- 'class' => 'manager-item manager-item-role',
62
- 'id' => 'aam_role',
63
- 'content' => array(new aam_View_Role(), 'content')
64
- ),
65
- 'users' => array(
66
- 'position' => 10,
67
- 'segment' => 'user',
68
- 'label' => __('Users', 'aam'),
69
- 'title' => __('User Manager', 'aam'),
70
- 'class' => 'manager-item manager-item-user',
71
- 'id' => 'aam_user',
72
- 'content' => array(new aam_View_User(), 'content')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ),
74
- 'visitor' => array(
75
- 'position' => 15,
76
- 'segment' => 'visitor',
77
- 'label' => __('Visitor', 'aam'),
78
- 'title' => __('Visitor Manager', 'aam'),
79
- 'class' => 'manager-item manager-item-visitor',
80
- 'id' => 'aam_visitor',
81
- 'content' => array(new aam_View_Visitor(), 'content')
82
- )
83
- );
84
- }
85
-
86
- /**
87
- *
88
- * @return type
89
- */
90
- protected function getDefaultFeatures() {
91
- return array(
92
- 'admin_menu' => array(
93
- 'id' => 'admin_menu',
94
- 'position' => 5,
95
- 'title' => __('Admin Menu', 'aam'),
96
- 'anonimus' => false,
97
- 'content' => array(new aam_View_Menu(), 'content'),
98
- 'help' => __('Control Access to Admin Menu. Restrict access to entire Menu or Submenu. <b>Notice</b>, the menu is rendered based on Role\'s or User\'s capabilities.', 'aam')
99
  ),
100
- 'metabox' => array(
101
- 'id' => 'metabox',
102
- 'position' => 10,
103
- 'title' => __('Metabox & Widget', 'aam'),
104
- 'anonimus' => true,
105
- 'content' => array(new aam_View_Metabox(), 'content'),
106
- 'help' => __('Filter the list of Metaboxes or Widgets for selected Role or User. If metabox or widget is not listed, try to click <b>Refresh the List</b> button or Copy & Paste direct link to page where specific metabox or widget is shown and hit <b>Retrieve Metaboxes from Link</b> button.', 'aam')
 
 
 
107
  ),
108
- 'capability' => array(
109
- 'id' => 'capability',
110
- 'position' => 15,
111
- 'title' => __('Capability', 'aam'),
112
- 'anonimus' => false,
113
- 'content' => array(new aam_View_Capability(), 'content'),
114
- 'help' => __('Manage the list of Capabilities for selected User or Role. <b>Notice</b>, list of user\'s capabilities are inherited from user\'s Role.<br/><b>Warning!</b> Be very careful with capabilities. Deleting or unchecking any capability may cause temporary or permanent constrol lost over some features or WordPress dashboard.', 'aam')
 
 
 
 
 
115
  ),
116
- 'post_access' => array(
117
- 'id' => 'post_access',
118
- 'position' => 20,
119
- 'title' => __('Posts & Pages', 'aam'),
120
- 'anonimus' => true,
121
- 'content' => array(new aam_View_Post(), 'content'),
122
- 'help' => __('Manage access to individual <b>Post</b> or <b>Term</b>. Notice, under <b>Post</b>, we assume any post, page or custom post type. And under <b>Term</b> - any term like Post Categories.', 'aam')
 
 
 
123
  ),
124
- 'event_manager' => array(
125
- 'id' => 'event_manager',
126
- 'position' => 25,
127
- 'title' => __('Event Manager', 'aam'),
128
- 'anonimus' => false,
129
- 'content' => array(new aam_View_Event(), 'content'),
130
- 'help' => __('Define your own action when some event appeared in your WordPress blog. This sections allows you to trigger an action on event like post content change, or page status update. You can setup to send email notification, change the post status or write your own custom event handler.', 'aam')
131
- )
132
- );
 
 
 
 
 
 
133
  }
134
 
135
  /**
136
- * Set Control Panel items
137
  *
138
- * @param array $cpanel
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  *
140
  * @return void
141
  *
142
  * @access public
143
  */
144
- public function setCManager(array $cmanager) {
145
- $final = array();
146
- foreach ($cmanager as $item) {
147
- if (!isset($final[$item['position']])) {
148
- $final[$item['position']] = $item;
149
- } else {
150
- aam_Extension_Console::log(
151
- "Control Manager position {$item['position']} reserved already"
152
- );
153
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
155
- ksort($final);
 
156
 
157
- $this->_cmanager = $final;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
 
160
  /**
161
- * Get Control Panel items
162
  *
163
- * @return array
164
  *
165
  * @access public
166
  */
167
- public function getCManager() {
168
- return $this->_cmanager;
 
 
 
 
 
 
 
169
  }
170
 
171
  /**
 
172
  *
173
- * @param type $list
 
 
174
  */
175
- public function setFeatures($list) {
176
- $final = array();
177
- foreach ($list as $item) {
178
- if (!isset($final[$item['position']])) {
179
- $final[$item['position']] = $item;
180
- } else {
181
- aam_Extension_Console::log(
182
- "Feature position {$item['position']} reserved already"
183
- );
184
- }
185
  }
186
- ksort($final);
187
 
188
- $this->_features = $final;
189
  }
190
 
191
  /**
 
192
  *
193
- * @return type
 
 
194
  */
195
- public function getFeatures() {
196
- return $this->_features;
 
 
 
 
 
 
 
197
  }
198
 
199
  /**
200
- * Run the Manager
201
  *
202
  * @return string
203
  *
204
  * @access public
205
  */
206
- public function run() {
207
- return $this->loadTemplate(dirname(__FILE__) . '/tmpl/manager.phtml');
 
 
 
 
 
 
 
 
208
  }
209
 
210
  /**
 
211
  *
212
- * @return type
 
 
213
  */
214
- public function isVisitor() {
215
- return ($this->getSubject()->getUID() === 'visitor' ? true : false);
 
 
 
 
 
 
 
 
216
  }
217
 
218
  /**
 
219
  *
 
 
 
220
  */
221
- public function retrieveFeatures() {
222
- ?>
223
- <div class="aam-help">
224
- <?php
225
- foreach ($this->getFeatures() as $feature) {
226
- if (!$this->isVisitor() || $feature['anonimus']) {
227
- echo '<span id="feature_help_' . $feature['id'] . '">', $feature['help'], '</span>';
228
- }
229
- }
230
- ?>
231
- </div>
232
- <div class="feature-list">
233
- <?php
234
- foreach ($this->getFeatures() as $feature) {
235
- if (!$this->isVisitor() || $feature['anonimus']) {
236
- echo '<div class="feature-item" feature="' . $feature['id'] . '">';
237
- echo '<span>' . $feature['title'] . '</span></div>';
238
- }
239
- }
240
- ?>
241
- </div>
242
- <div class="feature-content">
243
- <?php
244
- foreach ($this->getFeatures() as $feature) {
245
- if (!$this->isVisitor() || $feature['anonimus']) {
246
- echo call_user_func($feature['content']);
247
- }
248
- }
249
- ?>
250
- </div>
251
- <br class="clear" />
252
- <?php
253
- do_action('aam_retrieve_features');
254
  }
255
 
256
  /**
 
 
 
257
  *
258
- * @return type
259
  */
260
- public function save() {
261
- $this->getSubject()->save(
262
- $this->prepareSaveOptions(aam_Core_Request::post('aam'))
263
- );
264
- return json_encode(array('status' => 'success'));
 
 
 
 
 
265
  }
266
 
267
  /**
 
268
  *
269
- * @param type $options
270
- * @return type
 
271
  */
272
- protected function prepareSaveOptions($options) {
273
- //make sure that some parts are always in place
274
- if (!isset($options[aam_Control_Object_Menu::UID])) {
275
- $options[aam_Control_Object_Menu::UID] = array();
 
 
 
276
  }
277
- if (!isset($options[aam_Control_Object_Metabox::UID])) {
278
- $options[aam_Control_Object_Metabox::UID] = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  }
280
- if (!isset($options[aam_Control_Object_Event::UID])) {
281
- $options[aam_Control_Object_Event::UID] = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
 
284
- return apply_filters('aam_prepare_option_list', $options);
285
  }
286
 
287
  /**
 
288
  *
289
- * @return type
 
 
290
  */
291
- public function roleback() {
292
- $params = $this->getSubject()->getObject(
293
- aam_Control_Object_Backup::UID)->roleback();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
 
295
- $this->getSubject()->save($this->prepareSaveOptions($params));
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  //clear cache
298
  $this->getSubject()->clearCache();
299
 
300
- return json_encode(
301
- array(
302
- 'status' => 'success',
303
- 'more' => intval(
304
- $this->getSubject()->getObject(
305
- aam_Control_Object_Backup::UID)->has()
306
- )
307
- )
308
- );
309
  }
310
 
311
  /**
 
312
  *
313
- * @return type
 
 
 
 
 
314
  */
315
- public function checkRoleback() {
316
  return json_encode(
317
- array(
318
- 'status' => intval($this->getSubject()->getObject(
319
- aam_Control_Object_Backup::UID)->has()
320
- )
 
321
  )
322
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  }
324
 
325
  /**
 
326
  *
327
- * @return type
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  */
329
- public static function uiLabels(){
330
  return apply_filters('aam_localization_labels', array(
331
  'Rollback Settings' => __('Rollback Settings', 'aam'),
332
  'Cancel' => __('Cancel', 'aam'),
@@ -375,7 +854,8 @@ class aam_View_Manager extends aam_View_Abstract {
375
  'Delete Permanently' => __('Delete Permanently', 'aam'),
376
  'Trash Post' => __('Trash Post', 'aam'),
377
  'Restore Default Access' => __('Restore Default Access', 'aam'),
378
- 'Duplicate' => __('Duplicate', 'aam')
 
379
  ));
380
  }
381
 
7
  */
8
 
9
  /**
10
+ * Main UI Controller
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
14
+ * @copyright Copyright C Vasyl Martyniuk
15
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
16
  */
17
  class aam_View_Manager extends aam_View_Abstract {
18
 
19
  /**
20
+ * Admin Menu Feature
 
21
  */
22
+ const FEATURE_ADMIN_MENU = 'admin_menu';
23
 
24
  /**
25
+ * Metaboxes & Widgetst Feature
26
+ */
27
+ const FEATURE_METABOX = 'metabox';
28
+
29
+ /**
30
+ * Capability Feature
31
+ */
32
+ const FEATURE_CAPABILITY = 'capability';
33
+
34
+ /**
35
+ * Post Access Feature
36
+ */
37
+ const FEATURE_POST_ACCESS = 'post_access';
38
+
39
+ /**
40
+ * Event Manager Feature
41
  */
42
+ const FEATURE_EVENT_MANAGER = 'event_manager';
43
+
44
+ /**
45
+ * Default ajax response
46
+ */
47
+ const DEFAULT_AJAX_RESPONSE = -1;
48
 
49
  /**
50
  * Constructor
58
  public function __construct() {
59
  parent::__construct();
60
 
61
+ $this->registerDefaultSubjects();
62
+ $this->registerDefaultFeatures();
 
 
 
 
63
  }
64
 
65
  /**
66
+ * Registet default list of subjects
67
+ *
68
+ * @return void
69
  *
70
+ * @access protected
71
  */
72
+ protected function registerDefaultSubjects() {
73
+ aam_View_Collection::registerSubject((object)array(
74
+ 'position' => 5,
75
+ 'segment' => aam_Control_Subject_Role::UID,
76
+ 'label' => __('Roles', 'aam'),
77
+ 'title' => __('Role Manager', 'aam'),
78
+ 'class' => 'manager-item manager-item-role',
79
+ 'uid' => 'role',
80
+ 'controller' => 'aam_View_Role'
81
+ ));
82
+
83
+ aam_View_Collection::registerSubject((object)array(
84
+ 'position' => 10,
85
+ 'segment' => aam_Control_Subject_User::UID,
86
+ 'label' => __('Users', 'aam'),
87
+ 'title' => __('User Manager', 'aam'),
88
+ 'class' => 'manager-item manager-item-user',
89
+ 'uid' => 'user',
90
+ 'controller' => 'aam_View_User'
91
+ ));
92
+
93
+ aam_View_Collection::registerSubject((object)array(
94
+ 'position' => 15,
95
+ 'segment' => aam_Control_Subject_Visitor::UID,
96
+ 'label' => __('Visitor', 'aam'),
97
+ 'title' => __('Visitor Manager', 'aam'),
98
+ 'class' => 'manager-item manager-item-visitor',
99
+ 'uid' => 'visitor',
100
+ 'controller' => 'aam_View_Visitor'
101
+ ));
102
+ }
103
+
104
+ /**
105
+ * Prepare default list of features
106
+ *
107
+ * Check if current user has proper capability to use the feature
108
+ *
109
+ * @return array
110
+ *
111
+ * @access protected
112
+ */
113
+ protected function registerDefaultFeatures() {
114
+ $features = array();
115
+
116
+ //Main Menu Tab
117
+ aam_View_Collection::registerFeature((object)array(
118
+ 'uid' => self::FEATURE_ADMIN_MENU,
119
+ 'position' => 5,
120
+ 'title' => __('Admin Menu', 'aam'),
121
+ 'subjects' => array(
122
+ aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID
123
  ),
124
+ 'controller' => 'aam_View_Menu'
125
+ ));
126
+
127
+
128
+ //Metaboxes & Widgets Tab
129
+ aam_View_Collection::registerFeature((object)array(
130
+ 'uid' => self::FEATURE_METABOX,
131
+ 'position' => 10,
132
+ 'title' => __('Metabox & Widget', 'aam'),
133
+ 'subjects' => array(
134
+ aam_Control_Subject_Role::UID,
135
+ aam_Control_Subject_User::UID,
136
+ aam_Control_Subject_Visitor::UID
 
 
 
 
 
 
 
 
 
 
 
 
137
  ),
138
+ 'controller' => 'aam_View_Metabox'
139
+ ));
140
+
141
+ //Capability Tab
142
+ aam_View_Collection::registerFeature((object)array(
143
+ 'uid' => self::FEATURE_CAPABILITY,
144
+ 'position' => 15,
145
+ 'title' => __('Capability', 'aam'),
146
+ 'subjects' => array(
147
+ aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID
148
  ),
149
+ 'controller' => 'aam_View_Capability'
150
+ ));
151
+
152
+ //Posts & Pages Tab
153
+ aam_View_Collection::registerFeature((object)array(
154
+ 'uid' => self::FEATURE_POST_ACCESS,
155
+ 'position' => 20,
156
+ 'title' => __('Posts & Pages', 'aam'),
157
+ 'subjects' => array(
158
+ aam_Control_Subject_Role::UID,
159
+ aam_Control_Subject_User::UID,
160
+ aam_Control_Subject_Visitor::UID
161
  ),
162
+ 'controller' => 'aam_View_Post'
163
+ ));
164
+
165
+ //Event Manager Tab
166
+ aam_View_Collection::registerFeature((object)array(
167
+ 'uid' => self::FEATURE_EVENT_MANAGER,
168
+ 'position' => 25,
169
+ 'title' => __('Event Manager', 'aam'),
170
+ 'subjects' => array(
171
+ aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID
172
  ),
173
+ 'controller' =>'aam_View_Event'
174
+ ));
175
+
176
+ return $features;
177
+ }
178
+
179
+ /**
180
+ * Run the Manager
181
+ *
182
+ * @return string
183
+ *
184
+ * @access public
185
+ */
186
+ public function run() {
187
+ return $this->loadTemplate(dirname(__FILE__) . '/tmpl/manager.phtml');
188
  }
189
 
190
  /**
191
+ * Process the ajax call
192
  *
193
+ * @return string
194
+ *
195
+ * @access public
196
+ */
197
+ public function processAjax()
198
+ {
199
+ $sub_method = aam_Core_Request::request('sub_action');
200
+
201
+ if (method_exists($this, $sub_method)) {
202
+ $response = call_user_func(array($this, $sub_method));
203
+ } else {
204
+ $response = apply_filters(
205
+ 'aam_ajax_call', self::DEFAULT_AJAX_RESPONSE, $this->getSubject()
206
+ );
207
+ }
208
+
209
+ return $response;
210
+ }
211
+
212
+ /**
213
+ * Render the Main Control Area
214
  *
215
  * @return void
216
  *
217
  * @access public
218
  */
219
+ public function retrieveFeatures() {
220
+ $features = aam_View_Collection::retriveFeatures($this->getSubject());
221
+ if (count($features)){
222
+ ?>
223
+ <div class="feature-list">
224
+ <?php
225
+ foreach ($features as $feature) {
226
+ echo '<div class="feature-item" feature="' . $feature->uid . '">';
227
+ echo '<span>' . $feature->title . '</span></div>';
228
+ }
229
+ ?>
230
+ </div>
231
+ <div class="feature-content">
232
+ <?php
233
+ foreach ($features as $feature) {
234
+ echo $feature->controller->content($this->getSubject());
235
+ }
236
+ ?>
237
+ </div>
238
+ <br class="clear" />
239
+ <?php
240
+ } else {
241
+ echo '<p class="feature-list-empty">';
242
+ echo __('You are not allowed to manage any AAM Features.', 'aam');
243
+ echo '</p>';
244
  }
245
+ do_action('aam_post_features_render');
246
+ }
247
 
248
+ /**
249
+ * Load List of Metaboxes
250
+ *
251
+ * @return string
252
+ *
253
+ * @access public
254
+ */
255
+ public function loadMetaboxes(){
256
+ if (aam_View_Collection::hasFeature(self::FEATURE_METABOX)){
257
+ $metabox = new aam_View_Metabox;
258
+ $response = $metabox->retrieveList();
259
+ } else {
260
+ $response = self::DEFAULT_AJAX_RESPONSE;
261
+ }
262
+
263
+ return $response;
264
  }
265
 
266
  /**
267
+ * Initialize list of metaboxes from individual link
268
  *
269
+ * @return string
270
  *
271
  * @access public
272
  */
273
+ public function initLink(){
274
+ if (aam_View_Collection::hasFeature(self::FEATURE_METABOX)){
275
+ $metabox = new aam_View_Metabox;
276
+ $response = $metabox->initLink();
277
+ } else {
278
+ $response = self::DEFAULT_AJAX_RESPONSE;
279
+ }
280
+
281
+ return $response;
282
  }
283
 
284
  /**
285
+ * Retrieve Available for Editing Role List
286
  *
287
+ * @return string
288
+ *
289
+ * @access public
290
  */
291
+ public function roleList(){
292
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_Role::UID)){
293
+ $role = new aam_View_Role;
294
+ $response = $role->retrieveList();
295
+ } else {
296
+ $response = self::DEFAULT_AJAX_RESPONSE;
 
 
 
 
297
  }
 
298
 
299
+ return $response;
300
  }
301
 
302
  /**
303
+ * Retrieve Pure Role List
304
  *
305
+ * @return string
306
+ *
307
+ * @access public
308
  */
309
+ public function plainRoleList(){
310
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_Role::UID)){
311
+ $role = new aam_View_Role;
312
+ $response = $role->retrievePureList();
313
+ } else {
314
+ $response = self::DEFAULT_AJAX_RESPONSE;
315
+ }
316
+
317
+ return $response;
318
  }
319
 
320
  /**
321
+ * Add New Role
322
  *
323
  * @return string
324
  *
325
  * @access public
326
  */
327
+ public function addRole()
328
+ {
329
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_Role::UID)) {
330
+ $role = new aam_View_Role;
331
+ $response = $role->add();
332
+ } else {
333
+ $response = self::DEFAULT_AJAX_RESPONSE;
334
+ }
335
+
336
+ return $response;
337
  }
338
 
339
  /**
340
+ * Edit Existing Role
341
  *
342
+ * @return string
343
+ *
344
+ * @access public
345
  */
346
+ public function editRole()
347
+ {
348
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_Role::UID)) {
349
+ $role = new aam_View_Role;
350
+ $response = $role->edit();
351
+ } else {
352
+ $response = self::DEFAULT_AJAX_RESPONSE;
353
+ }
354
+
355
+ return $response;
356
  }
357
 
358
  /**
359
+ * Delete Existing Role
360
  *
361
+ * @return string
362
+ *
363
+ * @access public
364
  */
365
+ public function deleteRole()
366
+ {
367
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_Role::UID)) {
368
+ $role = new aam_View_Role;
369
+ $response = $role->delete();
370
+ } else {
371
+ $response = self::DEFAULT_AJAX_RESPONSE;
372
+ }
373
+
374
+ return $response;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
 
377
  /**
378
+ * Retrieve Available User List
379
+ *
380
+ * @return string
381
  *
382
+ * @access public
383
  */
384
+ public function userList()
385
+ {
386
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_User::UID)) {
387
+ $user = new aam_View_User;
388
+ $response = $user->retrieveList();
389
+ } else {
390
+ $response = self::DEFAULT_AJAX_RESPONSE;
391
+ }
392
+
393
+ return $response;
394
  }
395
 
396
  /**
397
+ * Block Selected User
398
  *
399
+ * @return string
400
+ *
401
+ * @access public
402
  */
403
+ public function blockUser()
404
+ {
405
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_User::UID)) {
406
+ $user = new aam_View_User;
407
+ $response = $user->block();
408
+ } else {
409
+ $response = self::DEFAULT_AJAX_RESPONSE;
410
  }
411
+
412
+ return $response;
413
+ }
414
+
415
+ /**
416
+ * Delete Selected User
417
+ *
418
+ * @return string
419
+ *
420
+ * @access public
421
+ */
422
+ public function deleteList()
423
+ {
424
+ if (aam_View_Collection::hasSubject(aam_Control_Subject_User::UID)) {
425
+ $user = new aam_View_User;
426
+ $response = $user->delete();
427
+ } else {
428
+ $response = self::DEFAULT_AJAX_RESPONSE;
429
  }
430
+
431
+ return $response;
432
+ }
433
+
434
+ /**
435
+ * Load list of capabilities
436
+ *
437
+ * @return string
438
+ *
439
+ * @access public
440
+ */
441
+ public function loadCapabilities()
442
+ {
443
+ if (aam_View_Collection::hasFeature(self::FEATURE_CAPABILITY)){
444
+ $capability = new aam_View_Capability;
445
+ $response = $capability->retrieveList();
446
+ } else {
447
+ $response = self::DEFAULT_AJAX_RESPONSE;
448
  }
449
 
450
+ return $response;
451
  }
452
 
453
  /**
454
+ * Get list of Capabilities by selected Role
455
  *
456
+ * @return string
457
+ *
458
+ * @access public
459
  */
460
+ public function roleCapabilities()
461
+ {
462
+ if (aam_View_Collection::hasFeature(self::FEATURE_CAPABILITY)){
463
+ $capability = new aam_View_Capability;
464
+ $response = $capability->retrieveRoleCapabilities();
465
+ } else {
466
+ $response = self::DEFAULT_AJAX_RESPONSE;
467
+ }
468
+
469
+ return $response;
470
+ }
471
+
472
+ /**
473
+ * Add New Capability
474
+ *
475
+ * @return string
476
+ *
477
+ * @access public
478
+ */
479
+ public function addCapability()
480
+ {
481
+ if (aam_View_Collection::hasFeature(self::FEATURE_CAPABILITY)){
482
+ $capability = new aam_View_Capability;
483
+ $response = $capability->addCapability();
484
+ } else {
485
+ $response = self::DEFAULT_AJAX_RESPONSE;
486
+ }
487
+
488
+ return $response;
489
+ }
490
+
491
+ /**
492
+ * Delete Capability
493
+ *
494
+ * @return string
495
+ *
496
+ * @access protected
497
+ */
498
+ public function deleteCapability()
499
+ {
500
+ if (aam_View_Collection::hasFeature(self::FEATURE_CAPABILITY)){
501
+ $capability = new aam_View_Capability;
502
+ $response = $capability->deleteCapability();
503
+ } else {
504
+ $response = self::DEFAULT_AJAX_RESPONSE;
505
+ }
506
+
507
+ return $response;
508
+ }
509
+
510
+ /**
511
+ * Restore Capabilities
512
+ *
513
+ * @return string
514
+ *
515
+ * @access public
516
+ */
517
+ public function restoreCapabilities()
518
+ {
519
+ if (aam_View_Collection::hasFeature(self::FEATURE_CAPABILITY)){
520
+ $capability = new aam_View_Capability;
521
+ $response = $capability->restoreCapability();
522
+ } else {
523
+ $response = self::DEFAULT_AJAX_RESPONSE;
524
+ }
525
+
526
+ return $response;
527
+ }
528
+
529
+ /**
530
+ * Get the List of Posts
531
+ *
532
+ * @return string
533
+ *
534
+ * @access public
535
+ */
536
+ public function postList()
537
+ {
538
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
539
+ $post = new aam_View_Post;
540
+ $response = $post->retrievePostList();
541
+ } else {
542
+ $response = self::DEFAULT_AJAX_RESPONSE;
543
+ }
544
+
545
+ return $response;
546
+ }
547
+
548
+ /**
549
+ * Get Post Tree
550
+ *
551
+ * @return string
552
+ *
553
+ * @access public
554
+ */
555
+ public function postTree()
556
+ {
557
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
558
+ $post = new aam_View_Post;
559
+ $response = $post->getPostTree();
560
+ } else {
561
+ $response = self::DEFAULT_AJAX_RESPONSE;
562
+ }
563
+
564
+ return $response;
565
+ }
566
+
567
+ /**
568
+ * Save Access settings for Post or Term
569
+ *
570
+ * @return string
571
+ *
572
+ * @access public
573
+ */
574
+ public function saveAccess()
575
+ {
576
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
577
+ $post = new aam_View_Post;
578
+ $response = $post->saveAccess();
579
+ } else {
580
+ $response = self::DEFAULT_AJAX_RESPONSE;
581
+ }
582
+
583
+ return $response;
584
+ }
585
+
586
+ /**
587
+ * Get Access settings for Post or Term
588
+ *
589
+ * @return string
590
+ *
591
+ * @access public
592
+ */
593
+ public function getAccess()
594
+ {
595
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
596
+ $post = new aam_View_Post;
597
+ $response = $post->getAccess();
598
+ } else {
599
+ $response = self::DEFAULT_AJAX_RESPONSE;
600
+ }
601
+
602
+ return $response;
603
+ }
604
+
605
+ /**
606
+ * Restore default access level for Post or Term
607
+ *
608
+ * @return string
609
+ *
610
+ * @access public
611
+ */
612
+ public function clearAccess()
613
+ {
614
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
615
+ $post = new aam_View_Post;
616
+ $response = $post->clearAccess();
617
+ } else {
618
+ $response = self::DEFAULT_AJAX_RESPONSE;
619
+ }
620
+
621
+ return $response;
622
+ }
623
+
624
+ /**
625
+ * Delete Post
626
+ *
627
+ * @return string
628
+ *
629
+ * @access public
630
+ */
631
+ public function deletePost()
632
+ {
633
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
634
+ $post = new aam_View_Post;
635
+ $response = $post->deletePost();
636
+ } else {
637
+ $response = self::DEFAULT_AJAX_RESPONSE;
638
+ }
639
+
640
+ return $response;
641
+ }
642
+
643
+ /**
644
+ * Prepare and generate the post breadcrumb
645
+ *
646
+ * @return string
647
+ *
648
+ * @access public
649
+ */
650
+ public function postBreadcrumb()
651
+ {
652
+ if (aam_View_Collection::hasFeature(self::FEATURE_POST_ACCESS)){
653
+ $post = new aam_View_Post;
654
+ $response = $post->getPostBreadcrumb();
655
+ } else {
656
+ $response = self::DEFAULT_AJAX_RESPONSE;
657
+ }
658
+
659
+ return $response;
660
+ }
661
+
662
+ /**
663
+ * Get Event List
664
+ *
665
+ * @return string
666
+ *
667
+ * @access public
668
+ */
669
+ public function eventList()
670
+ {
671
+ if (aam_View_Collection::hasFeature(self::FEATURE_EVENT_MANAGER)){
672
+ $event = new aam_View_Event;
673
+ $response = $event->retrieveEventList();
674
+ } else {
675
+ $response = self::DEFAULT_AJAX_RESPONSE;
676
+ }
677
+
678
+ return $response;
679
+ }
680
 
681
+ /**
682
+ * Save AAM options
683
+ *
684
+ * @return string
685
+ *
686
+ * @access public
687
+ */
688
+ public function save() {
689
+ $this->getSubject()->save(
690
+ apply_filters(
691
+ 'aam_default_option_list', aam_Core_Request::post('aam')
692
+ ));
693
+ return json_encode(array('status' => 'success'));
694
+ }
695
 
696
+ /**
697
+ * Roleback changes
698
+ *
699
+ * Restore default settings for current Subject
700
+ *
701
+ * @return string
702
+ *
703
+ * @access public
704
+ */
705
+ public function roleback() {
706
+ //clear all settings
707
+ $this->getSubject()->clearAllOptions();
708
  //clear cache
709
  $this->getSubject()->clearCache();
710
 
711
+ return json_encode(array('status' => 'success'));
 
 
 
 
 
 
 
 
712
  }
713
 
714
  /**
715
+ * Check if current subject can perform roleback
716
  *
717
+ * This function checks if there is any saved set of settings and return
718
+ * true if roleback feature can be performed
719
+ *
720
+ * @return string
721
+ *
722
+ * @access public
723
  */
724
+ public function hasRoleback() {
725
  return json_encode(
726
+ array(
727
+ 'status' => intval(
728
+ $this->getSubject()->hasFlag(
729
+ aam_Control_Subject::FLAG_MODIFIED
730
+ )
731
  )
732
+ ));
733
+ }
734
+
735
+ /**
736
+ * Install extension
737
+ *
738
+ * @return string
739
+ *
740
+ * @access public
741
+ */
742
+ public function installExtension()
743
+ {
744
+ if (current_user_can(aam_Core_ConfigPress::getParam(
745
+ 'aam.menu.extensions.capability', 'administrator'
746
+ ))){
747
+ $model = new aam_View_Extension();
748
+ $response = $model->install();
749
+ } else {
750
+ $response = self::DEFAULT_AJAX_RESPONSE;
751
+ }
752
+
753
+ return $response;
754
  }
755
 
756
  /**
757
+ * Remove extension
758
  *
759
+ * @return string
760
+ *
761
+ * @access public
762
+ */
763
+ public function removeExtension()
764
+ {
765
+ if (current_user_can(aam_Core_ConfigPress::getParam(
766
+ 'aam.menu.extensions.capability', 'administrator'
767
+ ))){
768
+ $model = new aam_View_Extension();
769
+ $response = $model->remove();
770
+ } else {
771
+ $response = self::DEFAULT_AJAX_RESPONSE;
772
+ }
773
+
774
+ return $response;
775
+ }
776
+
777
+ /**
778
+ * Save ConfigPress
779
+ *
780
+ * @return string
781
+ *
782
+ * @access public
783
+ */
784
+ public function saveConfigPress()
785
+ {
786
+ if (current_user_can(aam_Core_ConfigPress::getParam(
787
+ 'aam.menu.configpress.capability', 'administrator'
788
+ ))){
789
+ $result = aam_Core_ConfigPress::write(aam_Core_Request::post('config'));
790
+ } else {
791
+ $result = false;
792
+ }
793
+
794
+ return json_encode(array(
795
+ 'status' => ($result === false ? 'failure' : 'success')
796
+ ));
797
+ }
798
+
799
+ /**
800
+ * UI Javascript labels
801
+ *
802
+ * @return array
803
+ *
804
+ * @access public
805
+ * @static
806
+ * @todo Move to other file
807
  */
808
+ public static function uiLabels() {
809
  return apply_filters('aam_localization_labels', array(
810
  'Rollback Settings' => __('Rollback Settings', 'aam'),
811
  'Cancel' => __('Cancel', 'aam'),
854
  'Delete Permanently' => __('Delete Permanently', 'aam'),
855
  'Trash Post' => __('Trash Post', 'aam'),
856
  'Restore Default Access' => __('Restore Default Access', 'aam'),
857
+ 'Duplicate' => __('Duplicate', 'aam'),
858
+ 'Actions Locked' => __('Actions Locked', 'aam')
859
  ));
860
  }
861
 
application/view/menu.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -22,6 +23,18 @@ class aam_View_Menu extends aam_View_Abstract {
22
  public function content() {
23
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/menu.phtml');
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  /**
27
  *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
23
  public function content() {
24
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/menu.phtml');
25
  }
26
+
27
+ /**
28
+ * @inheritdoc
29
+ */
30
+ public function defaultOption($options) {
31
+ //make sure that some parts are always in place
32
+ if (!isset($options[aam_Control_Object_Menu::UID])) {
33
+ $options[aam_Control_Object_Menu::UID] = array();
34
+ }
35
+
36
+ return $options;
37
+ }
38
 
39
  /**
40
  *
application/view/metabox.php CHANGED
@@ -8,10 +8,11 @@
8
  */
9
 
10
  /**
11
- *
 
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
14
- * @copyright Copyright C 2013 Vasyl Martyniuk
15
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
16
  */
17
  class aam_View_Metabox extends aam_View_Abstract {
@@ -272,5 +273,17 @@ class aam_View_Metabox extends aam_View_Abstract {
272
  public function content() {
273
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/metabox.phtml');
274
  }
 
 
 
 
 
 
 
 
 
 
 
 
275
 
276
  }
8
  */
9
 
10
  /**
11
+ * Metaboxes & Widgets Tab Controller
12
+ *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
  */
18
  class aam_View_Metabox extends aam_View_Abstract {
273
  public function content() {
274
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/metabox.phtml');
275
  }
276
+
277
+ /**
278
+ * @inheritdoc
279
+ */
280
+ public function defaultOption($options) {
281
+ //make sure that some parts are always in place
282
+ if (!isset($options[aam_Control_Object_Metabox::UID])) {
283
+ $options[aam_Control_Object_Metabox::UID] = array();
284
+ }
285
+
286
+ return $options;
287
+ }
288
 
289
  }
application/view/post.php CHANGED
@@ -17,19 +17,31 @@
17
  class aam_View_Post extends aam_View_Abstract {
18
 
19
  /**
 
20
  *
21
- * @var type
 
 
 
 
22
  */
23
  private $_post_type = 'post';
24
 
25
  /**
 
 
 
26
  *
27
- * @var type
28
  */
29
  private $_term = 0;
30
 
31
  /**
 
32
  *
 
 
 
33
  */
34
  public function __construct() {
35
  parent::__construct();
@@ -37,34 +49,6 @@ class aam_View_Post extends aam_View_Abstract {
37
  $this->_term = intval(aam_Core_Request::request('term'));
38
  }
39
 
40
- /**
41
- *
42
- * @global type $wp_post_types
43
- * @return type
44
- */
45
- public function retrievePostTypeList() {
46
- global $wp_post_types;
47
-
48
- $response = array(
49
- 'aaData' => array()
50
- );
51
-
52
- if (is_array($wp_post_types)) {
53
- foreach ($wp_post_types as $post_type => $data) {
54
- //show only list of post type which have User Interface
55
- if ($data->show_ui) {
56
- $response['aaData'][] = array(
57
- $post_type,
58
- $data->label,
59
- ''
60
- );
61
- }
62
- }
63
- }
64
-
65
- return json_encode($response);
66
- }
67
-
68
  /**
69
  *
70
  * @global type $wp_post_statuses
@@ -75,24 +59,24 @@ class aam_View_Post extends aam_View_Abstract {
75
  global $wp_post_statuses, $wp_post_types, $wp_taxonomies;
76
 
77
  $term = trim(aam_Core_Request::request('term'));
78
-
79
  //default behavior
80
  if (empty($term)) {
81
  $post_type = 'post';
82
- //root for each Post Type
83
  } elseif (isset($wp_post_types[$term])) {
84
  $post_type = $term;
85
  $term = '';
86
  } else {
87
  $taxonomy = $this->getTaxonomy($term);
88
- if (isset($wp_taxonomies[$taxonomy])){
89
  //take in consideration only first object type
90
  $post_type = $wp_taxonomies[$taxonomy]->object_type[0];
91
  } else {
92
  $post_type = 'post';
93
  }
94
  }
95
-
96
  $args = array(
97
  'numberposts' => aam_Core_Request::request('iDisplayLength'),
98
  'offset' => aam_Core_Request::request('iDisplayStart'),
@@ -115,7 +99,7 @@ class aam_View_Post extends aam_View_Abstract {
115
  'post_status' => array()
116
  );
117
 
118
- if ($post_type != 'attachment'){ //attachment has only inherit status
119
  foreach ($wp_post_statuses as $status => $data) {
120
  if ($data->show_in_admin_status_list) {
121
  $args['post_status'][] = $status;
@@ -130,7 +114,7 @@ class aam_View_Post extends aam_View_Abstract {
130
  $total += $number;
131
  }
132
  }
133
-
134
  //get displayed total
135
  $displayTotal = count(get_posts($argsAll));
136
 
@@ -140,7 +124,7 @@ class aam_View_Post extends aam_View_Abstract {
140
  'sEcho' => aam_Core_Request::request('sEcho'),
141
  'aaData' => array(),
142
  );
143
-
144
  foreach (get_posts($args) as $post_id) {
145
  $post = $this->getSubject()->getObject(
146
  aam_Control_Object_Post::UID, $post_id
@@ -158,10 +142,10 @@ class aam_View_Post extends aam_View_Abstract {
158
 
159
  return json_encode($response);
160
  }
161
-
162
  /**
163
  * Get Taxonomy by Term ID
164
- *
165
  * @global type $wpdb
166
  * @param type $object_id
167
  * @return type
@@ -183,7 +167,7 @@ class aam_View_Post extends aam_View_Abstract {
183
  public function getPostTree() {
184
  global $wp_post_types;
185
 
186
- $type = $_REQUEST['root'];
187
  $tree = array();
188
 
189
  if ($type == "source") {
@@ -221,23 +205,23 @@ class aam_View_Post extends aam_View_Abstract {
221
 
222
  return json_encode($tree);
223
  }
224
-
225
  /**
226
  * Delete Post
227
- *
228
  * @return string
229
- *
230
  * @access public
231
  */
232
- public function deletePost(){
233
  $post_id = aam_Core_Request::post('post');
234
-
235
- if (aam_Core_Request::post('force')){
236
  $result = wp_delete_post($post_id, true);
237
  } else {
238
  $result = wp_trash_post($post_id);
239
  }
240
-
241
  return json_encode(array('status' => ($result ? 'success' : 'failure')));
242
  }
243
 
@@ -356,7 +340,8 @@ class aam_View_Post extends aam_View_Abstract {
356
  global $wpdb;
357
 
358
  //get number of categories
359
- $query = "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} WHERE parent={$cat->term_id}";
 
360
  $counter = $wpdb->get_var($query);
361
 
362
  return ($counter ? TRUE : FALSE);
@@ -438,8 +423,11 @@ class aam_View_Post extends aam_View_Abstract {
438
  }
439
 
440
  /**
441
- *
442
- * @return type
 
 
 
443
  */
444
  public function saveAccess() {
445
  $object_id = aam_Core_Request::post('id');
@@ -455,7 +443,7 @@ class aam_View_Post extends aam_View_Abstract {
455
  $object = $this->getSubject()->getObject(
456
  aam_Control_Object_Term::UID, $object_id
457
  );
458
- if ($limit_counter !== -1 && isset($access['post'])){
459
  unset($access['post']);
460
  }
461
  } else {
@@ -468,7 +456,7 @@ class aam_View_Post extends aam_View_Abstract {
468
 
469
  //clear cache
470
  $this->getSubject()->clearCache();
471
-
472
  $response = array('status' => 'success');
473
  } else {
474
  $response = array(
@@ -482,25 +470,17 @@ class aam_View_Post extends aam_View_Abstract {
482
  }
483
 
484
  /**
 
485
  *
486
- * @return type
 
 
487
  */
488
  public function getAccess() {
489
- $type = aam_Core_Request::post('type');
490
- $object_id = aam_Core_Request::post('id');
491
-
492
- if ($type === 'term') {
493
- $object = $this->getSubject()->getObject(
494
- aam_Control_Object_Term::UID, $object_id
495
- );
496
- } else {
497
- $object = $this->getSubject()->getObject(
498
- aam_Control_Object_Post::UID, $object_id
499
- );
500
- }
501
-
502
  return json_encode(array(
503
- 'settings' => $object->getOption(),
 
 
504
  'counter' => apply_filters(
505
  'wpaccess_restrict_limit',
506
  aam_Core_API::getBlogOption('aam_access_limit', 0)
@@ -509,14 +489,17 @@ class aam_View_Post extends aam_View_Abstract {
509
  }
510
 
511
  /**
 
512
  *
513
- * @return type
 
 
514
  */
515
  public function clearAccess() {
516
  $type = aam_Core_Request::post('type');
517
  $object_id = aam_Core_Request::post('id');
518
 
519
- if ($type === 'term') {
520
  $object = $this->getSubject()->getObject(
521
  aam_Control_Object_Term::UID, $object_id
522
  );
@@ -531,4 +514,36 @@ class aam_View_Post extends aam_View_Abstract {
531
  ));
532
  }
533
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534
  }
17
  class aam_View_Post extends aam_View_Abstract {
18
 
19
  /**
20
+ * Type of browsing object
21
  *
22
+ * It can be either post or term
23
+ *
24
+ * @var string
25
+ *
26
+ * @access private
27
  */
28
  private $_post_type = 'post';
29
 
30
  /**
31
+ * Term ID
32
+ *
33
+ * @var int
34
  *
35
+ * @access private
36
  */
37
  private $_term = 0;
38
 
39
  /**
40
+ * Constructor
41
  *
42
+ * @return void
43
+ *
44
+ * @access public
45
  */
46
  public function __construct() {
47
  parent::__construct();
49
  $this->_term = intval(aam_Core_Request::request('term'));
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  /**
53
  *
54
  * @global type $wp_post_statuses
59
  global $wp_post_statuses, $wp_post_types, $wp_taxonomies;
60
 
61
  $term = trim(aam_Core_Request::request('term'));
62
+
63
  //default behavior
64
  if (empty($term)) {
65
  $post_type = 'post';
66
+ //root for each Post Type
67
  } elseif (isset($wp_post_types[$term])) {
68
  $post_type = $term;
69
  $term = '';
70
  } else {
71
  $taxonomy = $this->getTaxonomy($term);
72
+ if (isset($wp_taxonomies[$taxonomy])) {
73
  //take in consideration only first object type
74
  $post_type = $wp_taxonomies[$taxonomy]->object_type[0];
75
  } else {
76
  $post_type = 'post';
77
  }
78
  }
79
+
80
  $args = array(
81
  'numberposts' => aam_Core_Request::request('iDisplayLength'),
82
  'offset' => aam_Core_Request::request('iDisplayStart'),
99
  'post_status' => array()
100
  );
101
 
102
+ if ($post_type != 'attachment') { //attachment has only inherit status
103
  foreach ($wp_post_statuses as $status => $data) {
104
  if ($data->show_in_admin_status_list) {
105
  $args['post_status'][] = $status;
114
  $total += $number;
115
  }
116
  }
117
+
118
  //get displayed total
119
  $displayTotal = count(get_posts($argsAll));
120
 
124
  'sEcho' => aam_Core_Request::request('sEcho'),
125
  'aaData' => array(),
126
  );
127
+
128
  foreach (get_posts($args) as $post_id) {
129
  $post = $this->getSubject()->getObject(
130
  aam_Control_Object_Post::UID, $post_id
142
 
143
  return json_encode($response);
144
  }
145
+
146
  /**
147
  * Get Taxonomy by Term ID
148
+ *
149
  * @global type $wpdb
150
  * @param type $object_id
151
  * @return type
167
  public function getPostTree() {
168
  global $wp_post_types;
169
 
170
+ $type = aam_Core_Request::request('root');
171
  $tree = array();
172
 
173
  if ($type == "source") {
205
 
206
  return json_encode($tree);
207
  }
208
+
209
  /**
210
  * Delete Post
211
+ *
212
  * @return string
213
+ *
214
  * @access public
215
  */
216
+ public function deletePost() {
217
  $post_id = aam_Core_Request::post('post');
218
+
219
+ if (aam_Core_Request::post('force')) {
220
  $result = wp_delete_post($post_id, true);
221
  } else {
222
  $result = wp_trash_post($post_id);
223
  }
224
+
225
  return json_encode(array('status' => ($result ? 'success' : 'failure')));
226
  }
227
 
340
  global $wpdb;
341
 
342
  //get number of categories
343
+ $query = "SELECT COUNT(*) FROM {$wpdb->term_taxonomy} ";
344
+ $query .= "WHERE parent={$cat->term_id}";
345
  $counter = $wpdb->get_var($query);
346
 
347
  return ($counter ? TRUE : FALSE);
423
  }
424
 
425
  /**
426
+ * Save Post or Term access
427
+ *
428
+ * @return string
429
+ *
430
+ * @access public
431
  */
432
  public function saveAccess() {
433
  $object_id = aam_Core_Request::post('id');
443
  $object = $this->getSubject()->getObject(
444
  aam_Control_Object_Term::UID, $object_id
445
  );
446
+ if ($limit_counter !== -1 && isset($access['post'])) {
447
  unset($access['post']);
448
  }
449
  } else {
456
 
457
  //clear cache
458
  $this->getSubject()->clearCache();
459
+
460
  $response = array('status' => 'success');
461
  } else {
462
  $response = array(
470
  }
471
 
472
  /**
473
+ * Get Post or Term access
474
  *
475
+ * @return string
476
+ *
477
+ * @access public
478
  */
479
  public function getAccess() {
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  return json_encode(array(
481
+ 'html' => $this->loadTemplate(
482
+ dirname(__FILE__) . '/tmpl/control_area.phtml'
483
+ ),
484
  'counter' => apply_filters(
485
  'wpaccess_restrict_limit',
486
  aam_Core_API::getBlogOption('aam_access_limit', 0)
489
  }
490
 
491
  /**
492
+ * Restore default access level for object
493
  *
494
+ * @return string
495
+ *
496
+ * @access public
497
  */
498
  public function clearAccess() {
499
  $type = aam_Core_Request::post('type');
500
  $object_id = aam_Core_Request::post('id');
501
 
502
+ if ($type === aam_Control_Object_Term::UID) {
503
  $object = $this->getSubject()->getObject(
504
  aam_Control_Object_Term::UID, $object_id
505
  );
514
  ));
515
  }
516
 
517
+ /**
518
+ * Get Object Title
519
+ *
520
+ * @param string $type
521
+ * @param string $name
522
+ *
523
+ * @return string
524
+ *
525
+ * @access public
526
+ * @global array $wp_post_types
527
+ * @global array $wp_taxonomies
528
+ */
529
+ public function getObjectTitle($type, $name) {
530
+ global $wp_post_types, $wp_taxonomies;
531
+
532
+ if ($type == aam_Control_Object_Term::UID) {
533
+ if (!empty($wp_taxonomies[$name]->labels->name)) {
534
+ $title = $wp_taxonomies[$name]->labels->name;
535
+ } else {
536
+ $title = 'term';
537
+ }
538
+ } else {
539
+ if (!empty($wp_post_types[$name]->labels->name)) {
540
+ $title = $wp_post_types[$name]->labels->name;
541
+ } else {
542
+ $title = 'post';
543
+ }
544
+ }
545
+
546
+ return $title;
547
+ }
548
+
549
  }
application/view/role.php CHANGED
@@ -17,16 +17,22 @@
17
  class aam_View_Role extends aam_View_Abstract {
18
 
19
  /**
20
- *
21
- * @return type
 
 
 
22
  */
23
  public function content() {
24
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/role.phtml');
25
  }
26
 
27
  /**
28
- *
29
- * @return type
 
 
 
30
  */
31
  public function retrieveList() {
32
  //retrieve list of users
@@ -72,8 +78,11 @@ class aam_View_Role extends aam_View_Abstract {
72
  }
73
 
74
  /**
75
- *
76
- * @return type
 
 
 
77
  */
78
  public function add() {
79
  $name = trim(aam_Core_Request::post('name'));
17
  class aam_View_Role extends aam_View_Abstract {
18
 
19
  /**
20
+ * Generate UI Content
21
+ *
22
+ * @return string
23
+ *
24
+ * @access public
25
  */
26
  public function content() {
27
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/role.phtml');
28
  }
29
 
30
  /**
31
+ * Get Role List
32
+ *
33
+ * @return string JSON Encoded role list
34
+ *
35
+ * @access public
36
  */
37
  public function retrieveList() {
38
  //retrieve list of users
78
  }
79
 
80
  /**
81
+ * Add New Role
82
+ *
83
+ * @return string
84
+ *
85
+ * @access public
86
  */
87
  public function add() {
88
  $name = trim(aam_Core_Request::post('name'));
application/view/tmpl/capability.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/tmpl/configpress.phtml CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  <div class="wrap" id="aam">
2
  <div class="postbox-container" style="width:70%;">
3
  <div class="metabox-holder">
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+ ?>
10
  <div class="wrap" id="aam">
11
  <div class="postbox-container" style="width:70%;">
12
  <div class="metabox-holder">
application/view/tmpl/control_area.phtml ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+ global $wp_taxonomies;
10
+
11
+ if (aam_Core_Request::post('type') === aam_Control_Object_Term::UID) {
12
+ $object = $this->getSubject()->getObject(
13
+ aam_Control_Object_Term::UID, aam_Core_Request::post('id')
14
+ );
15
+ if (isset($wp_taxonomies[$object->getTerm()->taxonomy])){
16
+ //take in consideration only first object type
17
+ $post_type = $wp_taxonomies[$object->getTerm()->taxonomy]->object_type[0];
18
+ } else {
19
+ $post_type = 'post';
20
+ }
21
+ } else {
22
+ $object = $this->getSubject()->getObject(
23
+ aam_Control_Object_Post::UID, aam_Core_Request::post('id')
24
+ );
25
+ $post_type = $object->getPost()->post_type;
26
+ }
27
+
28
+ ?>
29
+ <?php if ($object->getUID() == aam_Control_Object_Term::UID) { ?>
30
+ <div id="term_access">
31
+ <table class="dataTable" id="term_access_frontend">
32
+ <thead>
33
+ <tr>
34
+ <th colspan="2" class="term-access-title">
35
+ <?php echo $this->getObjectTitle('term', $object->getTerm()->taxonomy) . ' ' . __('Access', 'aam'); ?>
36
+ </th>
37
+ </tr>
38
+ <tr>
39
+ <th><?php echo __('Capability', 'aam'); ?></th>
40
+ <th><?php echo __('Restrict', 'aam'); ?></th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <?php
45
+ $term_fcaps = aam_Core_ConfigPress::getParam(
46
+ 'aam.term.' . $object->getTerm()->taxonomy . '.caps.frontend',
47
+ apply_filters(
48
+ 'aam_term_access_list',
49
+ aam_Core_Settings::get('term_frontend_restrictions'),
50
+ 'frontend',
51
+ $object
52
+ )
53
+ );
54
+ foreach ($term_fcaps as $i => $action) {
55
+ ?>
56
+ <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
57
+ <td>
58
+ <div class="post-access">
59
+ <?php echo __($action, 'aam'); ?>
60
+ </div>
61
+ </td>
62
+ <td>
63
+ <div class="post-actions">
64
+ <div class="post-action">
65
+ <input type="checkbox" id="term_frontend_<?php echo $action; ?>" name="access[term][frontend][<?php echo $action; ?>]" <?php echo ($object->has('frontend', $action) ? 'checked="checked"' : ''); ?> />
66
+ <label for="term_frontend_<?php echo $action; ?>">
67
+ <span></span>
68
+ </label>
69
+ </div>
70
+ </div>
71
+ </td>
72
+ </tr>
73
+ <?php } ?>
74
+ </tbody>
75
+ </table>
76
+
77
+ <table class="dataTable" id="term_access_backend">
78
+ <thead>
79
+ <tr>
80
+ <th colspan="2" class="term-access-title">
81
+ <?php echo $this->getObjectTitle('term', $object->getTerm()->taxonomy) . ' ' . __('Access', 'aam'); ?>
82
+ </th>
83
+ </tr>
84
+ <tr>
85
+ <th><?php echo __('Capability', 'aam'); ?></th>
86
+ <th><?php echo __('Restrict', 'aam'); ?></th>
87
+ </tr>
88
+ </thead>
89
+ <tbody>
90
+ <?php
91
+ $term_bcaps = aam_Core_ConfigPress::getParam(
92
+ 'aam.term.' . $object->getTerm()->taxonomy . '.caps.backend',
93
+ apply_filters(
94
+ 'aam_term_access_list',
95
+ aam_Core_Settings::get('term_backend_restrictions'),
96
+ 'backend',
97
+ $object
98
+ )
99
+ );
100
+ foreach ($term_bcaps as $i => $action) {
101
+ ?>
102
+ <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
103
+ <td>
104
+ <div class="post-access">
105
+ <?php echo __($action, 'aam'); ?>
106
+ </div>
107
+ </td>
108
+ <td>
109
+ <div class="post-actions">
110
+ <div class="post-action">
111
+ <input type="checkbox" id="term_backend_<?php echo $action ?>" name="access[term][backend][<?php echo $action; ?>]" <?php echo ($object->has('backend', $action) ? 'checked="checked"' : ''); ?> />
112
+ <label for="term_backend_<?php echo $action ?>">
113
+ <span></span>
114
+ </label>
115
+ </div>
116
+ </div>
117
+ </td>
118
+ </tr>
119
+ <?php } ?>
120
+ </tbody>
121
+ </table>
122
+ </div>
123
+ <?php } ?>
124
+ <div id="post_access" class="post-access-list">
125
+ <table class="dataTable" id="post_access_frontend">
126
+ <thead>
127
+ <tr>
128
+ <th colspan="2" class="post-access-title">
129
+ <?php if (($object->getUID() == aam_Control_Object_Term::UID)){
130
+ echo sprintf(__('All %s in Term', 'aam'), $this->getObjectTitle('post', $post_type));
131
+ } else {
132
+ echo $this->getObjectTitle('post', $post_type) . ' ' . __('Access', 'aam');
133
+ }
134
+ ?>
135
+ </th>
136
+ </tr>
137
+ <tr>
138
+ <th><?php echo __('Capability', 'aam'); ?></th>
139
+ <th><?php echo __('Restrict', 'aam'); ?></th>
140
+ </tr>
141
+ </thead>
142
+ <tbody>
143
+ <?php
144
+ $post_fcaps = aam_Core_ConfigPress::getParam(
145
+ 'aam.post.' . $post_type . '.caps.frontend',
146
+ apply_filters(
147
+ 'aam_post_access_list',
148
+ aam_Core_Settings::get('post_frontend_restrictions'),
149
+ 'frontend',
150
+ $object
151
+ )
152
+ );
153
+ foreach ($post_fcaps as $i => $action) {
154
+ ?>
155
+ <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
156
+ <td>
157
+ <div class="post-access">
158
+ <?php echo __($action, 'aam'); ?>
159
+ </div>
160
+ </td>
161
+ <td>
162
+ <div class="post-actions">
163
+ <div class="post-action post-action-check">
164
+ <input type="checkbox" id="post_frontend_<?php echo $action ?>" name="access[post][frontend][<?php echo $action; ?>]" <?php echo ($object->has('frontend', $action) ? 'checked="checked"' : ''); ?> />
165
+ <label for="post_frontend_<?php echo $action ?>">
166
+ <span></span>
167
+ </label>
168
+ </div>
169
+ </div>
170
+ </td>
171
+ </tr>
172
+ <?php } ?>
173
+ </tbody>
174
+ </table>
175
+ <table class="dataTable" id="post_access_backend">
176
+ <thead>
177
+ <tr>
178
+ <th colspan="2" class="post-access-title">
179
+ <?php if (($object->getUID() == aam_Control_Object_Term::UID)){
180
+ echo sprintf(__('All %s in Term', 'aam'), $this->getObjectTitle('post', $post_type));
181
+ } else {
182
+ echo $this->getObjectTitle('post', $post_type) . ' ' . __('Access', 'aam');
183
+ }
184
+ ?>
185
+ </th>
186
+ </tr>
187
+ <tr>
188
+ <th><?php echo __('Capability', 'aam'); ?></th>
189
+ <th><?php echo __('Restrict', 'aam'); ?></th>
190
+ </tr>
191
+ </thead>
192
+ <tbody>
193
+ <?php
194
+ $post_bcaps = aam_Core_ConfigPress::getParam(
195
+ 'aam.post.' . $post_type . '.caps.backend',
196
+ apply_filters(
197
+ 'aam_post_access_list',
198
+ aam_Core_Settings::get('post_backend_restrictions'),
199
+ 'backend',
200
+ $object
201
+ )
202
+ );
203
+ foreach ($post_bcaps as $i => $action) {
204
+ ?>
205
+ <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
206
+ <td>
207
+ <div class="post-access">
208
+ <?php echo __($action, 'aam'); ?>
209
+ </div>
210
+ </td>
211
+ <td>
212
+ <div class="post-actions">
213
+ <div class="post-action post-action-check">
214
+ <input type="checkbox" id="post_backend_<?php echo $action ?>" name="access[post][backend][<?php echo $action; ?>]" <?php echo ($object->has('backend', $action) ? 'checked="checked"' : ''); ?> />
215
+ <label for="post_backend_<?php echo $action ?>">
216
+ <span></span>
217
+ </label>
218
+ </div>
219
+ </div>
220
+ </td>
221
+ </tr>
222
+ <?php } ?>
223
+ </tbody>
224
+ </table>
225
+ <div class="post-access-block">
226
+ <a href="#" class="aam-lock-big">
227
+ <span><?php echo __('Get AAM Plus Package', 'aam'); ?></span>
228
+ </a>
229
+ </div>
230
+ </div>
application/view/tmpl/event.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/tmpl/extension.phtml CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  <div class="wrap" id="aam">
2
  <div class="postbox-container" style="width:70%;">
3
  <div class="metabox-holder">
@@ -116,12 +125,14 @@
116
  <?php echo __('If you already have license key for current extension, please enter it below. Othewise click <b>Purchase</b> button to checkout your order.', 'aam'); ?>
117
  <input type="text" class="license-input" id="license_key" placeholder="License Key" />
118
  </p>
 
119
  </div>
120
  <div id="update_extension" class="aam-dialog" title="<?php echo __('Update Extension', 'aam'); ?>">
121
  <p class="dialog-content" style="text-align: center;">
122
  <?php echo __('Extension has been installed. Your license key: ', 'aam'); ?><br/>
123
  <b><span id="installed_license_key"></span></b>
124
  </p>
 
125
  </div>
126
  </div>
127
  </div>
@@ -168,6 +179,27 @@
168
  </div>
169
  </div>
170
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  </div>
172
 
173
 
1
+ <?php
2
+
3
+ /**
4
+ * ======================================================================
5
+ * LICENSE: This file is subject to the terms and conditions defined in *
6
+ * file 'license.txt', which is part of this source code package. *
7
+ * ======================================================================
8
+ */
9
+ ?>
10
  <div class="wrap" id="aam">
11
  <div class="postbox-container" style="width:70%;">
12
  <div class="metabox-holder">
125
  <?php echo __('If you already have license key for current extension, please enter it below. Othewise click <b>Purchase</b> button to checkout your order.', 'aam'); ?>
126
  <input type="text" class="license-input" id="license_key" placeholder="License Key" />
127
  </p>
128
+ <ul class="extension-error-list"></ul>
129
  </div>
130
  <div id="update_extension" class="aam-dialog" title="<?php echo __('Update Extension', 'aam'); ?>">
131
  <p class="dialog-content" style="text-align: center;">
132
  <?php echo __('Extension has been installed. Your license key: ', 'aam'); ?><br/>
133
  <b><span id="installed_license_key"></span></b>
134
  </p>
135
+ <ul class="extension-error-list"></ul>
136
  </div>
137
  </div>
138
  </div>
179
  </div>
180
  </div>
181
  </div>
182
+
183
+ <div class="postbox-container" style="width:25%; margin-left: 2%;">
184
+ <div class="metabox-holder">
185
+ <div class="meta-box-sortables">
186
+ <div class="postbox">
187
+ <div class="handlediv" title="<?php echo __('Click to toggle', 'aam'); ?>"></div>
188
+ <h3 class="hndle">
189
+ <span><?php echo __('Development License', 'aam'); ?></span>
190
+ </h3>
191
+ <div class="inside">
192
+ <p>
193
+ <?php echo __('Become a member of <b>AAM Community</b>. Obtain <b>Development License</b> today for $119 and get access to all extensions that are available today and will be developed witin a year.', 'aam'); ?>
194
+ </p>
195
+ <div style="text-align: center;">
196
+ <a href="http://wpaam.com/aam-development/aam-development-license/" target="_blank" class="button button-primary button-large"><?php echo __('Read More', 'aam'); ?></a>
197
+ </div>
198
+ </div>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </div>
203
  </div>
204
 
205
 
application/view/tmpl/manager.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -59,7 +60,7 @@
59
  </h3>
60
  <div class="inside">
61
  <div class="cpanel-major">
62
- <a href="#" class="cpanel-item cpanel-item-restore" id="aam_roleback" aam-tooltip="<?php echo __('Undo Change', 'aam'); ?>"><?php echo __('Undo Change', 'aam'); ?></a>
63
  <a href="#" class="cpanel-item cpanel-item-save" id="aam_save" ><?php echo __('Save', 'aam'); ?></a>
64
  </div>
65
  <div class="cpanel-minor">
@@ -91,18 +92,19 @@
91
  <div id="minor-publishing">
92
  <div id="misc-publishing-actions" class="control-manager">
93
  <?php
94
- foreach ($this->getCManager() as $item) {
95
- echo '<a href="#" class="', $item['class'], '" ';
96
- echo 'id="', $item['id'], '" aam-tooltip="', $item['title'], '" segment="' . $item['segment'] . '">';
97
- echo $item['label'], '</a>';
 
98
  }
99
  ?>
100
  </div>
101
  </div>
102
  <div class="control-manager-content">
103
  <?php
104
- foreach ($this->getCManager() as $item) {
105
- echo call_user_func($item['content']);
106
  }
107
  ?>
108
  </div>
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
60
  </h3>
61
  <div class="inside">
62
  <div class="cpanel-major">
63
+ <a href="#" class="cpanel-item cpanel-item-restore" id="aam_roleback" aam-tooltip="<?php echo __('Restore Default', 'aam'); ?>"><?php echo __('Default', 'aam'); ?></a>
64
  <a href="#" class="cpanel-item cpanel-item-save" id="aam_save" ><?php echo __('Save', 'aam'); ?></a>
65
  </div>
66
  <div class="cpanel-minor">
92
  <div id="minor-publishing">
93
  <div id="misc-publishing-actions" class="control-manager">
94
  <?php
95
+ $subjects = aam_View_Collection::retrieveSubjects();
96
+ foreach ($subjects as $subject) {
97
+ echo '<a href="#" class="', $subject->class, '" ';
98
+ echo '" aam-tooltip="', $subject->title, '" segment="' . $subject->segment . '">';
99
+ echo $subject->label, '</a>';
100
  }
101
  ?>
102
  </div>
103
  </div>
104
  <div class="control-manager-content">
105
  <?php
106
+ foreach ($subjects as $subject) {
107
+ echo $subject->controller->content();
108
  }
109
  ?>
110
  </div>
application/view/tmpl/menu.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/tmpl/metabox.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/tmpl/post.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -50,189 +51,7 @@
50
  <input type="radio" id="post_area_backend" value="backend" name="access_area" /><label for="post_area_backend"><?php echo __('Backend', 'aam'); ?></label>
51
  </div>
52
  <?php } ?>
53
-
54
- <div id="access_control_area">
55
- <div id="term_access">
56
- <table class="dataTable" id="term_access_frontend">
57
- <thead>
58
- <tr>
59
- <th colspan="2" class="term-access-title"><?php echo __('Term Access', 'aam'); ?></th>
60
- </tr>
61
- <tr>
62
- <th><?php echo __('Capability', 'aam'); ?></th>
63
- <th><?php echo __('Restrict', 'aam'); ?></th>
64
- </tr>
65
- </thead>
66
- <tbody>
67
- <?php
68
- $term = $this->getSubject()->getObject(aam_Control_Object_Term::UID);
69
- foreach ($term->getAccessList('frontend') as $i => $action) {
70
- ?>
71
- <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
72
- <td>
73
- <div class="post-access">
74
- <?php echo __($action, 'aam'); ?>
75
- </div>
76
- </td>
77
- <td>
78
- <div class="post-actions">
79
- <div class="post-action">
80
- <input type="checkbox" id="term_frontend_<?php echo $action; ?>" object="term" area="frontend" action="<?php echo $action; ?>" />
81
- <label for="term_frontend_<?php echo $action; ?>"><span></span></label>
82
- </div>
83
- </div>
84
- </td>
85
- </tr>
86
- <?php
87
- }
88
- ?>
89
- </tbody>
90
- <tfoot>
91
- <tr>
92
- <td colspan="2" class="post-access-description">
93
- <span class="aam-post-access-notice">*</span>
94
- <?php echo __('Control Frontend Term Access', 'aam'); ?>
95
- </td>
96
- </tr>
97
- </tfoot>
98
- </table>
99
- <table class="dataTable" id="term_access_backend">
100
- <thead>
101
- <tr>
102
- <th colspan="2" class="term-access-title"><?php echo __('Term Access', 'aam'); ?></th>
103
- </tr>
104
- <tr>
105
- <th><?php echo __('Capability', 'aam'); ?></th>
106
- <th><?php echo __('Restrict', 'aam'); ?></th>
107
- </tr>
108
- </thead>
109
- <tbody>
110
- <?php
111
- foreach ($term->getAccessList('backend') as $i => $action) {
112
- ?>
113
- <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
114
- <td>
115
- <div class="post-access">
116
- <?php echo __($action, 'aam'); ?>
117
- </div>
118
- </td>
119
- <td>
120
- <div class="post-actions">
121
- <div class="post-action">
122
- <input type="checkbox" id="term_backend_<?php echo $action ?>" object="term" area="backend" action="<?php echo $action ?>" />
123
- <label for="term_backend_<?php echo $action ?>"><span></span></label>
124
- </div>
125
- </div>
126
- </td>
127
- </tr>
128
- <?php
129
- }
130
- ?>
131
- </tbody>
132
- <tfoot>
133
- <tr>
134
- <td colspan="2" class="post-access-description">
135
- <span class="aam-post-access-notice">*</span>
136
- <?php echo __('Control Backend Term Access', 'aam'); ?>
137
- </td>
138
- </tr>
139
- </tfoot>
140
- </table>
141
- </div>
142
-
143
- <div id="post_access" class="post-access-list">
144
- <table class="dataTable" id="post_access_frontend">
145
- <thead>
146
- <tr>
147
- <th colspan="2" class="post-access-title"><?php echo __('All Posts in Term', 'aam'); ?></th>
148
- </tr>
149
- <tr>
150
- <th><?php echo __('Capability', 'aam'); ?></th>
151
- <th><?php echo __('Restrict', 'aam'); ?></th>
152
- </tr>
153
- </thead>
154
- <tbody>
155
- <?php
156
- $post = $this->getSubject()->getObject(aam_Control_Object_Post::UID);
157
- foreach ($post->getAccessList('frontend') as $i => $action) {
158
- ?>
159
- <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
160
- <td>
161
- <div class="post-access">
162
- <?php echo __($action, 'aam'); ?>
163
- </div>
164
- </td>
165
- <td>
166
- <div class="post-actions">
167
- <div class="post-action post-action-check">
168
- <input type="checkbox" id="post_frontend_<?php echo $action ?>" object="post" area="frontend" action="<?php echo $action ?>" />
169
- <label for="post_frontend_<?php echo $action ?>"><span></span></label>
170
- </div>
171
- </div>
172
- </td>
173
- </tr>
174
- <?php
175
- }
176
- ?>
177
- </tbody>
178
- <tfoot>
179
- <tr>
180
- <td colspan="2" class="post-access-description">
181
- <span class="aam-post-access-notice">*</span>
182
- <?php echo __('Control Frontend Post Access', 'aam'); ?>
183
- </td>
184
- </tr>
185
- </tfoot>
186
- </table>
187
- <table class="dataTable" id="post_access_backend">
188
- <thead>
189
- <tr>
190
- <th colspan="2" class="post-access-title"><?php echo __('All Posts in Term', 'aam'); ?></th>
191
- </tr>
192
- <tr>
193
- <th><?php echo __('Capability', 'aam'); ?></th>
194
- <th><?php echo __('Restrict', 'aam'); ?></th>
195
- </tr>
196
- </thead>
197
- <tbody>
198
- <?php
199
- foreach ($post->getAccessList('backend') as $i => $action) {
200
- ?>
201
- <tr class="<?php echo ($i % 2 ? 'event' : 'odd'); ?>">
202
- <td>
203
- <div class="post-access">
204
- <?php echo __($action, 'aam'); ?>
205
- </div>
206
- </td>
207
- <td>
208
- <div class="post-actions">
209
- <div class="post-action post-action-check">
210
- <input type="checkbox" id="post_backend_<?php echo $action ?>" object="post" area="backend" action="<?php echo $action ?>" />
211
- <label for="post_backend_<?php echo $action ?>"><span></span></label>
212
- </div>
213
- </div>
214
- </td>
215
- </tr>
216
- <?php
217
- }
218
- ?>
219
- </tbody>
220
- <tfoot>
221
- <tr>
222
- <td colspan="2" class="post-access-description">
223
- <span class="aam-post-access-notice">*</span>
224
- <?php echo __('Control Backend Post Access', 'aam'); ?>
225
- </td>
226
- </tr>
227
- </tfoot>
228
- </table>
229
- <div class="post-access-block">
230
- <a href="#" class="aam-lock-big">
231
- <span><?php echo __('Get AAM Plus Package', 'aam'); ?></span>
232
- </a>
233
- </div>
234
- </div>
235
- </div>
236
  <div class="aam-main-loader"></div>
237
  </div>
238
  </div>
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
51
  <input type="radio" id="post_area_backend" value="backend" name="access_area" /><label for="post_area_backend"><?php echo __('Backend', 'aam'); ?></label>
52
  </div>
53
  <?php } ?>
54
+ <div id="access_control_area"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  <div class="aam-main-loader"></div>
56
  </div>
57
  </div>
application/view/tmpl/role.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/tmpl/user.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -15,6 +16,7 @@
15
  <th width="60%"><?php echo __('Username', 'aam'); ?></th>
16
  <th><?php echo __('Action', 'aam'); ?></th>
17
  <th>Status</th>
 
18
  </tr>
19
  </thead>
20
  <tbody></tbody>
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
16
  <th width="60%"><?php echo __('Username', 'aam'); ?></th>
17
  <th><?php echo __('Action', 'aam'); ?></th>
18
  <th>Status</th>
19
+ <th>Managable</th>
20
  </tr>
21
  </thead>
22
  <tbody></tbody>
application/view/tmpl/visitor.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
application/view/user.php CHANGED
@@ -17,16 +17,24 @@
17
  class aam_View_User extends aam_View_Abstract {
18
 
19
  /**
20
- *
21
- * @return type
 
 
 
22
  */
23
  public function content() {
24
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/user.phtml');
25
  }
26
 
27
  /**
28
- *
29
- * @return type
 
 
 
 
 
30
  */
31
  public function retrieveList() {
32
  //get total number of users
@@ -44,16 +52,49 @@ class aam_View_User extends aam_View_Abstract {
44
  $user->user_login,
45
  ($user->display_name ? $user->display_name : $user->user_nicename),
46
  '',
47
- $user->user_status
 
48
  );
49
  }
50
 
51
  return json_encode($response);
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  /**
55
- *
 
 
 
56
  * @return \WP_User_Query
 
 
57
  */
58
  public function query() {
59
  if ($search = trim(aam_Core_Request::request('sSearch'))) {
@@ -76,11 +117,15 @@ class aam_View_User extends aam_View_Abstract {
76
  }
77
 
78
  /**
79
- *
80
- * @return type
 
 
 
81
  */
82
  public function block() {
83
- if ($this->getSubject()->block()){
 
84
  $response = array(
85
  'status' => 'success',
86
  'user_status' => $this->getSubject()->user_status
@@ -93,15 +138,20 @@ class aam_View_User extends aam_View_Abstract {
93
  }
94
 
95
  /**
96
- *
97
- * @return type
 
 
 
98
  */
99
  public function delete() {
100
- return json_encode(
101
- array(
102
- 'status' => $this->getSubject()->delete() ? 'success' : 'failure'
103
- )
104
- );
 
 
105
  }
106
 
107
  }
17
  class aam_View_User extends aam_View_Abstract {
18
 
19
  /**
20
+ * Generate UI content
21
+ *
22
+ * @return string
23
+ *
24
+ * @access public
25
  */
26
  public function content() {
27
  return $this->loadTemplate(dirname(__FILE__) . '/tmpl/user.phtml');
28
  }
29
 
30
  /**
31
+ * Retrieve list of users
32
+ *
33
+ * Based on filters, get list of users
34
+ *
35
+ * @return string JSON encoded list of users
36
+ *
37
+ * @access public
38
  */
39
  public function retrieveList() {
40
  //get total number of users
52
  $user->user_login,
53
  ($user->display_name ? $user->display_name : $user->user_nicename),
54
  '',
55
+ $user->user_status,
56
+ ($this->canManage($user) ? 1 : 0)
57
  );
58
  }
59
 
60
  return json_encode($response);
61
  }
62
+
63
+ /**
64
+ * Check if specified user can be managed by current user
65
+ *
66
+ * @param WP_User $user
67
+ *
68
+ * @return boolean
69
+ *
70
+ * @access public
71
+ */
72
+ public function canManage(WP_User $user = null){
73
+ //AAM does not support multi-roles. Get only one first role
74
+ $roles = $user->roles;
75
+ $role = get_role(array_shift($roles));
76
+ //get user's highest level
77
+ $level = aam_Core_API::getUserLevel();
78
+
79
+ if (empty($role->capabilities['level_' . $level])
80
+ || !$role->capabilities['level_' . $level]
81
+ || aam_Core_API::isSuperAdmin()){
82
+ $response = true;
83
+ } else {
84
+ $response = false;
85
+ }
86
+
87
+ return $response;
88
+ }
89
 
90
  /**
91
+ * Query database for list of users
92
+ *
93
+ * Based on filters and settings get the list of users from database
94
+ *
95
  * @return \WP_User_Query
96
+ *
97
+ * @access public
98
  */
99
  public function query() {
100
  if ($search = trim(aam_Core_Request::request('sSearch'))) {
117
  }
118
 
119
  /**
120
+ * Block user
121
+ *
122
+ * @return string
123
+ *
124
+ * @access public
125
  */
126
  public function block() {
127
+ if ($this->isManagable($this->getSubject()->getUser())
128
+ && $this->getSubject()->block()){
129
  $response = array(
130
  'status' => 'success',
131
  'user_status' => $this->getSubject()->user_status
138
  }
139
 
140
  /**
141
+ * Delete user
142
+ *
143
+ * @return string
144
+ *
145
+ * @access public
146
  */
147
  public function delete() {
148
+ if ($this->isManagable($this->getSubject()->getUser())){
149
+ $response = $this->getSubject()->delete();
150
+ } else {
151
+ $response = false;
152
+ }
153
+
154
+ return json_encode(array('status' => $response ? 'success' : 'failure'));
155
  }
156
 
157
  }
application/view/visitor.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -17,8 +18,11 @@ class aam_View_Visitor extends aam_View_Abstract
17
  {
18
 
19
  /**
20
- *
21
- * @return type
 
 
 
22
  */
23
  public function content()
24
  {
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
18
  {
19
 
20
  /**
21
+ * Get View content
22
+ *
23
+ * @return string
24
+ *
25
+ * @access public
26
  */
27
  public function content()
28
  {
config.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
@@ -7,7 +8,7 @@
7
  */
8
 
9
  //AAM Version for Update purpose
10
- define('AAM_VERSION', '2.4');
11
 
12
  define('AAM_BASE_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
13
 
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
8
  */
9
 
10
  //AAM Version for Update purpose
11
+ define('AAM_VERSION', '2.5');
12
 
13
  define('AAM_BASE_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
14
 
extension/AAM_Activity_Log/activity.php CHANGED
@@ -187,14 +187,6 @@ class aam_Control_Object_Activity extends aam_Control_Object {
187
  return false;
188
  }
189
 
190
- /**
191
- *
192
- * @return type
193
- */
194
- public function backup() {
195
- return array();
196
- }
197
-
198
  /**
199
  *
200
  * @return type
187
  return false;
188
  }
189
 
 
 
 
 
 
 
 
 
190
  /**
191
  *
192
  * @return type
extension/AAM_Activity_Log/extension.php CHANGED
@@ -8,6 +8,7 @@
8
  */
9
 
10
  /**
 
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
@@ -17,8 +18,9 @@
17
  class AAM_Extension_ActivityLog extends AAM_Core_Extension {
18
 
19
  /**
 
20
  *
21
- * @var type
22
  */
23
  private $_subject = null;
24
 
@@ -33,11 +35,7 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
33
  require_once(dirname(__FILE__) . '/activity.php');
34
 
35
  if (is_admin()) {
36
- add_action('admin_print_scripts', array($this, 'printScripts'));
37
- add_action('admin_print_styles', array($this, 'printStyles'));
38
- add_filter('aam_ui_features', array($this, 'feature'), 10);
39
- add_filter('aam_ajax_call', array($this, 'ajax'), 10, 2);
40
- add_action('aam_localization_labels', array($this, 'localizationLabels'));
41
  }
42
 
43
  //define new Activity Object
@@ -48,19 +46,51 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
48
  add_action('wp_logout', array($this, 'logout'));
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  *
53
  * @param type $username
54
  * @param type $user
55
  */
56
  public function login($username, $user) {
57
- $subject = new aam_Control_Subject_User($user->ID);
58
- $subject->getObject(aam_Control_Object_Activity::UID)->add(
59
- time(),
60
- array(
61
- 'action' => aam_Control_Object_Activity::ACTIVITY_LOGIN
62
- )
63
- );
64
  }
65
 
66
  /**
@@ -72,8 +102,7 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
72
  time(),
73
  array(
74
  'action' => aam_Control_Object_Activity::ACTIVITY_LOGOUT
75
- )
76
- );
77
  }
78
 
79
  /**
@@ -93,29 +122,6 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
93
  return $object;
94
  }
95
 
96
- /**
97
- *
98
- * @param type $features
99
- * @return string
100
- */
101
- public function feature($features) {
102
- //add feature
103
- $features['activity_log'] = array(
104
- 'id' => 'activity_log',
105
- 'position' => 35,
106
- 'title' => __('Activity Log', 'aam'),
107
- 'anonimus' => false,
108
- 'content' => array($this, 'content'),
109
- 'help' => __(
110
- 'Tracks User Activities like user login/logout or post changes. '
111
- . 'Check <b>AAM Activities</b> Extension to get advanced list of possible '
112
- . 'activities.', 'aam'
113
- )
114
- );
115
-
116
- return $features;
117
- }
118
-
119
  /**
120
  *
121
  * @return type
@@ -256,7 +262,7 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
256
 
257
  /**
258
  *
259
- * @param type $subject
260
  */
261
  public function setSubject($subject) {
262
  $this->_subject = $subject;
@@ -264,7 +270,7 @@ class AAM_Extension_ActivityLog extends AAM_Core_Extension {
264
 
265
  /**
266
  *
267
- * @return type
268
  */
269
  public function getSubject() {
270
  return $this->_subject;
8
  */
9
 
10
  /**
11
+ * Activity Log Controller
12
  *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
18
  class AAM_Extension_ActivityLog extends AAM_Core_Extension {
19
 
20
  /**
21
+ * Current subject
22
  *
23
+ * @var aam_Control_Subject
24
  */
25
  private $_subject = null;
26
 
35
  require_once(dirname(__FILE__) . '/activity.php');
36
 
37
  if (is_admin()) {
38
+ $this->registerFeature();
 
 
 
 
39
  }
40
 
41
  //define new Activity Object
46
  add_action('wp_logout', array($this, 'logout'));
47
  }
48
 
49
+ /**
50
+ * Register new UI feature
51
+ *
52
+ * @return void
53
+ *
54
+ * @access protected
55
+ */
56
+ protected function registerFeature() {
57
+ $capability = aam_Core_ConfigPress::getParam(
58
+ 'aam.feature.activity_log.capability', 'administrator'
59
+ );
60
+
61
+ if (current_user_can($capability)) {
62
+ add_action('admin_print_scripts', array($this, 'printScripts'));
63
+ add_action('admin_print_styles', array($this, 'printStyles'));
64
+ add_filter('aam_ajax_call', array($this, 'ajax'), 10, 2);
65
+ add_action(
66
+ 'aam_localization_labels', array($this, 'localizationLabels')
67
+ );
68
+
69
+ aam_View_Collection::registerFeature((object)array(
70
+ 'uid' => 'activity_log',
71
+ 'position' => 35,
72
+ 'title' => __('Activity Log', 'aam'),
73
+ 'subjects' => array(
74
+ aam_Control_Subject_Role::UID, aam_Control_Subject_User::UID
75
+ ),
76
+ 'controller' => $this
77
+ ));
78
+ }
79
+ }
80
+
81
  /**
82
  *
83
  * @param type $username
84
  * @param type $user
85
  */
86
  public function login($username, $user) {
87
+ $this->getParent()->getUser()
88
+ ->getObject(aam_Control_Object_Activity::UID)->add(
89
+ time(),
90
+ array(
91
+ 'action' => aam_Control_Object_Activity::ACTIVITY_LOGIN
92
+ )
93
+ );
94
  }
95
 
96
  /**
102
  time(),
103
  array(
104
  'action' => aam_Control_Object_Activity::ACTIVITY_LOGOUT
105
+ ));
 
106
  }
107
 
108
  /**
122
  return $object;
123
  }
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  /**
126
  *
127
  * @return type
262
 
263
  /**
264
  *
265
+ * @param aam_Control_Subject $subject
266
  */
267
  public function setSubject($subject) {
268
  $this->_subject = $subject;
270
 
271
  /**
272
  *
273
+ * @return aam_Control_Subject
274
  */
275
  public function getSubject() {
276
  return $this->_subject;
extension/AAM_Activity_Log/index.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
extension/AAM_Activity_Log/ui.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
extension/AAM_Multisite_Support/extension.php CHANGED
@@ -9,7 +9,7 @@
9
 
10
  /**
11
  * AAM Multisite Support Extension
12
- *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
  * @copyright Copyright C 2014 Vasyl Martyniuk
@@ -19,7 +19,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
19
 
20
  /**
21
  *
22
- * @var type
23
  */
24
  private $_subject = null;
25
 
@@ -33,15 +33,15 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
33
  add_action('admin_print_scripts', array($this, 'printScripts'));
34
  add_action('admin_print_styles', array($this, 'printStyles'));
35
  add_action('aam_localization_labels', array($this, 'localizationLabels'));
36
- add_filter('aam_ui_subjects', array($this, 'addUISubject'), 10, 1);
37
  add_action('wpmu_new_blog', array($this, 'newBlog'), 10, 6);
 
38
  } elseif (is_admin()) {
39
  add_filter('aam_ajax_call', array($this, 'ajax'), 10, 2);
40
  }
41
  }
42
 
43
  /**
44
- *
45
  * @param type $blog_id
46
  * @param type $user_id
47
  * @param type $domain
@@ -51,13 +51,13 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
51
  */
52
  public function newBlog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
53
  global $wpdb;
54
-
55
  if ($default_id = aam_Core_API::getBlogOption('aam_default_site', 0, 1)){
56
  $default_option = $wpdb->get_blog_prefix($default_id) . 'user_roles';
57
  $roles = aam_Core_API::getBlogOption($default_option, null, $default_id);
58
  if ($roles){
59
  aam_Core_API::updateBlogOption(
60
- $wpdb->get_blog_prefix($blog_id) . 'user_roles',
61
  $roles, $blog_id
62
  );
63
  }
@@ -65,13 +65,13 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
65
  }
66
 
67
  /**
68
- *
69
  * @return type
70
  */
71
  protected function getSiteList() {
72
  //retrieve site list first
73
  $blog_list = $this->retrieveSiteList();
74
-
75
  $response = array(
76
  'iTotalRecords' => count($blog_list),
77
  'iTotalDisplayRecords' => count($blog_list),
@@ -94,41 +94,41 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
94
 
95
  return json_encode($response);
96
  }
97
-
98
  /**
99
  * Retieve the list of sites
100
- *
101
  * @return array
102
- *
103
  * @access public
104
  */
105
  public function retrieveSiteList(){
106
  global $wpdb;
107
-
108
  return $wpdb->get_results('SELECT blog_id FROM ' . $wpdb->blogs);
109
  }
110
 
111
  /**
112
- *
113
- * @param type $subjects
114
- * @return type
 
 
115
  */
116
- public function addUISubject($subjects) {
117
- $subjects['multisite'] = array(
118
  'position' => 1,
119
  'segment' => 'multisite',
120
  'label' => __('Sites', 'aam'),
121
  'title' => __('Site Manager', 'aam'),
122
  'class' => 'manager-item manager-item-multisite',
123
- 'id' => 'aam_multisite',
124
- 'content' => array($this, 'content')
125
- );
126
-
127
- return $subjects;
128
  }
129
 
130
  /**
131
- *
132
  * @return type
133
  */
134
  public function content() {
@@ -150,8 +150,8 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
150
  public function printScripts() {
151
  if ($this->getParent()->isAAMScreen()) {
152
  wp_enqueue_script(
153
- 'aam-multisite-admin',
154
- AAM_MULTISITE_BASE_URL . '/multisite.js',
155
  array('aam-admin')
156
  );
157
  $localization = array(
@@ -167,7 +167,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
167
  }
168
 
169
  /**
170
- *
171
  */
172
  public function printStyles() {
173
  if ($this->getParent()->isAAMScreen()) {
@@ -178,7 +178,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
178
  }
179
 
180
  /**
181
- *
182
  * @param type $labels
183
  * @return type
184
  */
@@ -191,7 +191,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
191
  }
192
 
193
  /**
194
- *
195
  * @param type $default
196
  * @param aam_Control_Subject $subject
197
  * @return type
@@ -235,7 +235,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
235
  }
236
 
237
  /**
238
- *
239
  * @param type $subject
240
  */
241
  public function setSubject($subject) {
@@ -243,7 +243,7 @@ class AAM_Extension_Multisite extends AAM_Core_Extension {
243
  }
244
 
245
  /**
246
- *
247
  * @return type
248
  */
249
  public function getSubject() {
9
 
10
  /**
11
  * AAM Multisite Support Extension
12
+ *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
  * @copyright Copyright C 2014 Vasyl Martyniuk
19
 
20
  /**
21
  *
22
+ * @var type
23
  */
24
  private $_subject = null;
25
 
33
  add_action('admin_print_scripts', array($this, 'printScripts'));
34
  add_action('admin_print_styles', array($this, 'printStyles'));
35
  add_action('aam_localization_labels', array($this, 'localizationLabels'));
 
36
  add_action('wpmu_new_blog', array($this, 'newBlog'), 10, 6);
37
+ $this->registerSubject();
38
  } elseif (is_admin()) {
39
  add_filter('aam_ajax_call', array($this, 'ajax'), 10, 2);
40
  }
41
  }
42
 
43
  /**
44
+ *
45
  * @param type $blog_id
46
  * @param type $user_id
47
  * @param type $domain
51
  */
52
  public function newBlog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
53
  global $wpdb;
54
+
55
  if ($default_id = aam_Core_API::getBlogOption('aam_default_site', 0, 1)){
56
  $default_option = $wpdb->get_blog_prefix($default_id) . 'user_roles';
57
  $roles = aam_Core_API::getBlogOption($default_option, null, $default_id);
58
  if ($roles){
59
  aam_Core_API::updateBlogOption(
60
+ $wpdb->get_blog_prefix($blog_id) . 'user_roles',
61
  $roles, $blog_id
62
  );
63
  }
65
  }
66
 
67
  /**
68
+ *
69
  * @return type
70
  */
71
  protected function getSiteList() {
72
  //retrieve site list first
73
  $blog_list = $this->retrieveSiteList();
74
+
75
  $response = array(
76
  'iTotalRecords' => count($blog_list),
77
  'iTotalDisplayRecords' => count($blog_list),
94
 
95
  return json_encode($response);
96
  }
97
+
98
  /**
99
  * Retieve the list of sites
100
+ *
101
  * @return array
102
+ *
103
  * @access public
104
  */
105
  public function retrieveSiteList(){
106
  global $wpdb;
107
+
108
  return $wpdb->get_results('SELECT blog_id FROM ' . $wpdb->blogs);
109
  }
110
 
111
  /**
112
+ * Register new subject Multisite
113
+ *
114
+ * @return void
115
+ *
116
+ * @access public
117
  */
118
+ public function registerSubject() {
119
+ aam_View_Collection::registerSubject((object)array(
120
  'position' => 1,
121
  'segment' => 'multisite',
122
  'label' => __('Sites', 'aam'),
123
  'title' => __('Site Manager', 'aam'),
124
  'class' => 'manager-item manager-item-multisite',
125
+ 'uid' => 'multisite',
126
+ 'controller' => $this
127
+ ));
 
 
128
  }
129
 
130
  /**
131
+ *
132
  * @return type
133
  */
134
  public function content() {
150
  public function printScripts() {
151
  if ($this->getParent()->isAAMScreen()) {
152
  wp_enqueue_script(
153
+ 'aam-multisite-admin',
154
+ AAM_MULTISITE_BASE_URL . '/multisite.js',
155
  array('aam-admin')
156
  );
157
  $localization = array(
167
  }
168
 
169
  /**
170
+ *
171
  */
172
  public function printStyles() {
173
  if ($this->getParent()->isAAMScreen()) {
178
  }
179
 
180
  /**
181
+ *
182
  * @param type $labels
183
  * @return type
184
  */
191
  }
192
 
193
  /**
194
+ *
195
  * @param type $default
196
  * @param aam_Control_Subject $subject
197
  * @return type
235
  }
236
 
237
  /**
238
+ *
239
  * @param type $subject
240
  */
241
  public function setSubject($subject) {
243
  }
244
 
245
  /**
246
+ *
247
  * @return type
248
  */
249
  public function getSubject() {
extension/AAM_Multisite_Support/index.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
extension/AAM_Multisite_Support/ui.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
extension/AAM_My_Feature/extension.php CHANGED
@@ -8,49 +8,64 @@
8
  */
9
 
10
  /**
 
11
  *
12
  * @package AAM
13
  * @author Vasyl Martyniuk <support@wpaam.com>
14
- * @copyright Copyright C 2013 Vasyl Martyniuk
15
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
16
  */
17
  class AAM_Extension_MyFeature extends AAM_Core_Extension {
18
 
19
  /**
 
20
  *
21
- * @param aam|aam_View_Connector $parent
 
 
 
 
22
  */
23
  public function __construct(aam $parent) {
24
  parent::__construct($parent);
25
 
26
  if (is_admin()) {
27
- add_action('admin_print_scripts', array($this, 'printScripts'));
28
- add_action('admin_print_styles', array($this, 'printStyles'));
29
- add_filter('aam_ui_features', array($this, 'feature'), 10);
30
  }
31
  }
32
 
33
  /**
34
- *
35
- * @param type $features
36
- * @return array
 
 
37
  */
38
- public function feature($features) {
39
  //add feature
40
- $features['my_feature'] = array(
41
- 'id' => 'my_feature',
42
- 'position' => 100,
43
- 'title' => __('My Feature', 'aam'),
44
- 'anonimus' => true,
45
- 'content' => array($this, 'content'),
46
- 'help' => __('My customly developed feature', 'aam')
47
  );
48
 
49
- return $features;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
  /**
53
- *
54
  * @return type
55
  */
56
  public function content() {
@@ -72,23 +87,27 @@ class AAM_Extension_MyFeature extends AAM_Core_Extension {
72
  public function printScripts() {
73
  if ($this->getParent()->isAAMScreen()) {
74
  wp_enqueue_script(
75
- 'aam-my-feature-admin',
76
- AAM_MY_FEATURE_BASE_URL . '/my_feature.js',
77
  array('aam-admin')
78
  );
79
  }
80
  }
81
 
82
  /**
83
- *
 
 
 
 
84
  */
85
  public function printStyles() {
86
  if ($this->getParent()->isAAMScreen()) {
87
  wp_enqueue_style(
88
- 'aam-my-feature-admin',
89
  AAM_MY_FEATURE_BASE_URL . '/my_feature.css'
90
  );
91
  }
92
  }
93
 
94
- }
8
  */
9
 
10
  /**
11
+ * My Feature View Controller
12
  *
13
  * @package AAM
14
  * @author Vasyl Martyniuk <support@wpaam.com>
15
+ * @copyright Copyright C Vasyl Martyniuk
16
  * @license GNU General Public License {@link http://www.gnu.org/licenses/}
17
  */
18
  class AAM_Extension_MyFeature extends AAM_Core_Extension {
19
 
20
  /**
21
+ * Constructor
22
  *
23
+ * @param aam $parent
24
+ *
25
+ * @return void
26
+ *
27
+ * @access public
28
  */
29
  public function __construct(aam $parent) {
30
  parent::__construct($parent);
31
 
32
  if (is_admin()) {
33
+ $this->registerFeature();
 
 
34
  }
35
  }
36
 
37
  /**
38
+ * Register feature
39
+ *
40
+ * @return void
41
+ *
42
+ * @access protected
43
  */
44
+ protected function registerFeature() {
45
  //add feature
46
+ $capability = aam_Core_ConfigPress::getParam(
47
+ 'aam.feature.my_feature.capability', 'administrator'
 
 
 
 
 
48
  );
49
 
50
+ if (current_user_can($capability)) {
51
+ add_action('admin_print_scripts', array($this, 'printScripts'));
52
+ add_action('admin_print_styles', array($this, 'printStyles'));
53
+ aam_View_Collection::registerFeature((object)array(
54
+ 'uid' => 'my_feature',
55
+ 'position' => 100,
56
+ 'title' => __('My Feature', 'aam'),
57
+ 'subjects' => array(
58
+ aam_Control_Subject_Role::UID,
59
+ aam_Control_Subject_User::UID,
60
+ aam_Control_Subject_Visitor::UID
61
+ ),
62
+ 'controller' => $this
63
+ ));
64
+ }
65
  }
66
 
67
  /**
68
+ *
69
  * @return type
70
  */
71
  public function content() {
87
  public function printScripts() {
88
  if ($this->getParent()->isAAMScreen()) {
89
  wp_enqueue_script(
90
+ 'aam-my-feature-admin',
91
+ AAM_MY_FEATURE_BASE_URL . '/my_feature.js',
92
  array('aam-admin')
93
  );
94
  }
95
  }
96
 
97
  /**
98
+ * Register stylesheets
99
+ *
100
+ * @return void
101
+ *
102
+ * @access public
103
  */
104
  public function printStyles() {
105
  if ($this->getParent()->isAAMScreen()) {
106
  wp_enqueue_style(
107
+ 'aam-my-feature-admin',
108
  AAM_MY_FEATURE_BASE_URL . '/my_feature.css'
109
  );
110
  }
111
  }
112
 
113
+ }
extension/AAM_My_Feature/index.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
extension/AAM_My_Feature/ui.phtml CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * ======================================================================
4
  * LICENSE: This file is subject to the terms and conditions defined in *
1
  <?php
2
+
3
  /**
4
  * ======================================================================
5
  * LICENSE: This file is subject to the terms and conditions defined in *
lang/{nb_NO.mo → aam-nb_NO.mo} RENAMED
File without changes
lang/aam.mo CHANGED
Binary file
lang/aam.pot CHANGED
@@ -1,6 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: AAM\n"
 
 
 
4
  "Language-Team: WP AAM <support@wpaam.com>\n"
5
  "Language: en\n"
6
  "MIME-Version: 1.0\n"
@@ -10,345 +13,376 @@ msgstr ""
10
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
11
  "X-Poedit-SourceCharset: UTF-8\n"
12
  "X-Poedit-KeywordsList: __\n"
 
13
  "X-Poedit-SearchPath-0: .\n"
14
 
15
- #: aam.php:380 aam.php:387 aam.php:414
16
  msgid "Access denied"
17
  msgstr ""
18
 
19
- #: aam.php:873 aam.php:874
20
  msgid "AAM"
21
  msgstr ""
22
 
23
- #: aam.php:883 aam.php:884
24
  msgid "Access Control"
25
  msgstr ""
26
 
27
- #: aam.php:891 aam.php:892
28
  msgid "ConfigPress"
29
  msgstr ""
30
 
31
- #: aam.php:899 aam.php:900
32
  msgid "Extensions"
33
  msgstr ""
34
 
35
- #: application/view/capability.php:100 application/view/capability.php:204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  msgid "System"
37
  msgstr ""
38
 
39
- #: application/view/capability.php:101 application/view/capability.php:206
40
  msgid "Post & Page"
41
  msgstr ""
42
 
43
- #: application/view/capability.php:102 application/view/capability.php:208
44
  msgid "Backend Interface"
45
  msgstr ""
46
 
47
- #: application/view/capability.php:103 application/view/capability.php:210
48
  msgid "Miscellaneous"
49
  msgstr ""
50
 
51
- #: application/view/extension.php:99
52
  msgid "Folder advanced-access-manager/extension is not writable"
53
  msgstr ""
54
 
55
- #: application/view/manager.php:59
56
  msgid "Roles"
57
  msgstr ""
58
 
59
- #: application/view/manager.php:60
60
  msgid "Role Manager"
61
  msgstr ""
62
 
63
- #: application/view/manager.php:68
64
  msgid "Users"
65
  msgstr ""
66
 
67
- #: application/view/manager.php:69
68
  msgid "User Manager"
69
  msgstr ""
70
 
71
- #: application/view/manager.php:77
72
  msgid "Visitor"
73
  msgstr ""
74
 
75
- #: application/view/manager.php:78
76
  msgid "Visitor Manager"
77
  msgstr ""
78
 
79
- #: application/view/manager.php:95
80
  msgid "Admin Menu"
81
  msgstr ""
82
 
83
- #: application/view/manager.php:98
84
- msgid ""
85
- "Control Access to Admin Menu. Restrict access to entire Menu or Submenu. "
86
- "<b>Notice</b>, the menu is rendered based on Role's or User's capabilities."
87
- msgstr ""
88
-
89
- #: application/view/manager.php:103
90
  msgid "Metabox & Widget"
91
  msgstr ""
92
 
93
- #: application/view/manager.php:106
94
- msgid ""
95
- "Filter the list of Metaboxes or Widgets for selected Role or User. If "
96
- "metabox or widget is not listed, try to click <b>Refresh the List</b> button "
97
- "or Copy & Paste direct link to page where specific metabox or widget is "
98
- "shown and hit <b>Retrieve Metaboxes from Link</b> button."
99
- msgstr ""
100
-
101
- #: application/view/manager.php:111 application/view/tmpl/capability.phtml:16
102
- #: application/view/tmpl/post.phtml:62 application/view/tmpl/post.phtml:105
103
- #: application/view/tmpl/post.phtml:150 application/view/tmpl/post.phtml:193
104
  msgid "Capability"
105
  msgstr ""
106
 
107
- #: application/view/manager.php:114
108
- msgid ""
109
- "Manage the list of Capabilities for selected User or Role. <b>Notice</b>, "
110
- "list of user's capabilities are inherited from user's Role.<br/><b>Warning!</"
111
- "b> Be very careful with capabilities. Deleting or unchecking any capability "
112
- "may cause temporary or permanent constrol lost over some features or "
113
- "WordPress dashboard."
114
- msgstr ""
115
-
116
- #: application/view/manager.php:119
117
  msgid "Posts & Pages"
118
  msgstr ""
119
 
120
- #: application/view/manager.php:122
121
- msgid ""
122
- "Manage access to individual <b>Post</b> or <b>Term</b>. Notice, under "
123
- "<b>Post</b>, we assume any post, page or custom post type. And under "
124
- "<b>Term</b> - any term like Post Categories."
125
- msgstr ""
126
-
127
- #: application/view/manager.php:127
128
  msgid "Event Manager"
129
  msgstr ""
130
 
131
- #: application/view/manager.php:130
132
- msgid ""
133
- "Define your own action when some event appeared in your WordPress blog. This "
134
- "sections allows you to trigger an action on event like post content change, "
135
- "or page status update. You can setup to send email notification, change the "
136
- "post status or write your own custom event handler."
137
  msgstr ""
138
 
139
- #: application/view/manager.php:331
140
  msgid "Rollback Settings"
141
  msgstr ""
142
 
143
- #: application/view/manager.php:332
144
  msgid "Cancel"
145
  msgstr ""
146
 
147
- #: application/view/manager.php:333
148
  msgid "Send E-mail"
149
  msgstr ""
150
 
151
- #: application/view/manager.php:334 application/view/manager.php:340
152
  msgid "Add New Role"
153
  msgstr ""
154
 
155
- #: application/view/manager.php:335
156
  msgid "Manage"
157
  msgstr ""
158
 
159
- #: application/view/manager.php:336
160
  msgid "Edit"
161
  msgstr ""
162
 
163
- #: application/view/manager.php:337
164
  msgid "Delete"
165
  msgstr ""
166
 
167
- #: application/view/manager.php:338
168
  msgid "Filtered"
169
  msgstr ""
170
 
171
- #: application/view/manager.php:339
172
  msgid "Clear"
173
  msgstr ""
174
 
175
- #: application/view/manager.php:341
176
  msgid "Save Changes"
177
  msgstr ""
178
 
179
- #: application/view/manager.php:342
180
  #, php-format
181
  msgid ""
182
  "System detected %d user(s) with this role. All Users with Role <b>%s</b> "
183
  "will be deleted automatically!"
184
  msgstr ""
185
 
186
- #: application/view/manager.php:343
187
  #, php-format
188
  msgid "Are you sure that you want to delete role <b>%s</b>?"
189
  msgstr ""
190
 
191
- #: application/view/manager.php:344 application/view/tmpl/role.phtml:52
192
  msgid "Delete Role"
193
  msgstr ""
194
 
195
- #: application/view/manager.php:345
196
  msgid "Add User"
197
  msgstr ""
198
 
199
- #: application/view/manager.php:346
200
  msgid "Filter Users"
201
  msgstr ""
202
 
203
- #: application/view/manager.php:347 application/view/manager.php:363
204
  msgid "Refresh List"
205
  msgstr ""
206
 
207
- #: application/view/manager.php:348
208
  msgid "Block"
209
  msgstr ""
210
 
211
- #: application/view/manager.php:349
212
  #, php-format
213
  msgid "Are you sure you want to delete user <b>%s</b>?"
214
  msgstr ""
215
 
216
- #: application/view/manager.php:350
217
  msgid "Filter Capabilities by Category"
218
  msgstr ""
219
 
220
- #: application/view/manager.php:351 application/view/tmpl/capability.phtml:46
221
  msgid "Inherit Capabilities"
222
  msgstr ""
223
 
224
- #: application/view/manager.php:352 application/view/tmpl/capability.phtml:61
225
  msgid "Add New Capability"
226
  msgstr ""
227
 
228
- #: application/view/manager.php:353
229
  #, php-format
230
  msgid "Are you sure that you want to delete capability <b>%s</b>?"
231
  msgstr ""
232
 
233
- #: application/view/manager.php:354 application/view/tmpl/capability.phtml:80
234
  msgid "Delete Capability"
235
  msgstr ""
236
 
237
- #: application/view/manager.php:355
238
  msgid "Select Role"
239
  msgstr ""
240
 
241
- #: application/view/manager.php:356
242
  msgid "Add Capability"
243
  msgstr ""
244
 
245
- #: application/view/manager.php:357
246
  msgid "Add Event"
247
  msgstr ""
248
 
249
- #: application/view/manager.php:358
250
  msgid "Edit Event"
251
  msgstr ""
252
 
253
- #: application/view/manager.php:359 application/view/manager.php:361
254
- #: application/view/tmpl/event.phtml:104
255
  msgid "Delete Event"
256
  msgstr ""
257
 
258
- #: application/view/manager.php:360
259
  msgid "Save Event"
260
  msgstr ""
261
 
262
- #: application/view/manager.php:362
263
  msgid "Filter Posts by Post Type"
264
  msgstr ""
265
 
266
- #: application/view/manager.php:364
267
  msgid "Restore Default"
268
  msgstr ""
269
 
270
- #: application/view/manager.php:365
271
  msgid "Apply"
272
  msgstr ""
273
 
274
- #: application/view/manager.php:366
275
  msgid "Edit Term"
276
  msgstr ""
277
 
278
- #: application/view/manager.php:367
279
  msgid "Manager Access"
280
  msgstr ""
281
 
282
- #: application/view/manager.php:368
283
  msgid "Unlock Default Accesss Control"
284
  msgstr ""
285
 
286
- #: application/view/manager.php:369
287
  msgid "Close"
288
  msgstr ""
289
 
290
- #: application/view/manager.php:370
291
  msgid "Edit Role"
292
  msgstr ""
293
 
294
- #: application/view/manager.php:371
295
  msgid "Restore Default Capabilities"
296
  msgstr ""
297
 
298
- #: application/view/manager.php:372
299
  #, php-format
300
  msgid "Are you sure you want to delete <b>%s</b>?"
301
  msgstr ""
302
 
303
- #: application/view/manager.php:373
304
  #, php-format
305
  msgid "Are you sure you want to move <b>%s</b> to trash?"
306
  msgstr ""
307
 
308
- #: application/view/manager.php:374 application/view/tmpl/post.phtml:26
309
  msgid "Delete Post"
310
  msgstr ""
311
 
312
- #: application/view/manager.php:375
313
  msgid "Delete Permanently"
314
  msgstr ""
315
 
316
- #: application/view/manager.php:376
317
  msgid "Trash Post"
318
  msgstr ""
319
 
320
- #: application/view/manager.php:377
321
  msgid "Restore Default Access"
322
  msgstr ""
323
 
324
- #: application/view/manager.php:378
325
  msgid "Duplicate"
326
  msgstr ""
327
 
328
- #: application/view/metabox.php:190
 
 
 
 
329
  msgid "Dashboard Widgets"
330
  msgstr ""
331
 
332
- #: application/view/metabox.php:194
333
  msgid "Frontend Widgets"
334
  msgstr ""
335
 
336
- #: application/view/post.php:213
337
  msgid "[empty]"
338
  msgstr ""
339
 
340
- #: application/view/post.php:396 application/view/post.php:404
341
  msgid "All"
342
  msgstr ""
343
 
344
- #: config.php:61
345
  msgid "Failed to create wp-content/aam folder"
346
  msgstr ""
347
 
348
- #: config.php:64
349
  msgid "Folder wp-content/aam is not writable"
350
  msgstr ""
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  #: extension/AAM_Activity_Log/activity.php:98
353
  msgid "System Login"
354
  msgstr ""
@@ -361,431 +395,423 @@ msgstr ""
361
  msgid "Unknown Activity"
362
  msgstr ""
363
 
364
- #: extension/AAM_Activity_Log/extension.php:112
365
  msgid "Activity Log"
366
  msgstr ""
367
 
368
- #: extension/AAM_Activity_Log/extension.php:116
369
- msgid ""
370
- "Tracks User Activities like user login/logout or post changes. Check <b>AAM "
371
- "Activities</b> Extension to get advanced list of possible activities."
372
- msgstr ""
373
-
374
- #: extension/AAM_Activity_Log/extension.php:177
375
  msgid "Clear Logs"
376
  msgstr ""
377
 
378
- #: extension/AAM_Activity_Log/extension.php:178
379
  msgid "Get More"
380
  msgstr ""
381
 
382
- #: extension/AAM_Multisite_Support/extension.php:125
383
  msgid "Sites"
384
  msgstr ""
385
 
386
- #: extension/AAM_Multisite_Support/extension.php:126
387
  msgid "Site Manager"
388
  msgstr ""
389
 
390
- #: extension/AAM_Multisite_Support/extension.php:189
391
  msgid "Set Default"
392
  msgstr ""
393
 
394
- #: extension/AAM_Multisite_Support/extension.php:190
395
  msgid "Unset Default"
396
  msgstr ""
397
 
398
- #: extension/AAM_Multisite_Support/extension.php:191
399
  msgid "Set as Default"
400
  msgstr ""
401
 
402
- #: extension/AAM_My_Feature/extension.php:50
403
  msgid "My Feature"
404
  msgstr ""
405
 
406
- #: extension/AAM_My_Feature/extension.php:53
407
- msgid "My customly developed feature"
408
  msgstr ""
409
 
410
- #: application/view/tmpl/capability.phtml:15
411
  msgid "Category"
412
  msgstr ""
413
 
414
- #: application/view/tmpl/capability.phtml:17
415
- #: application/view/tmpl/event.phtml:18 application/view/tmpl/post.phtml:18
416
  msgid "Control"
417
  msgstr ""
418
 
419
- #: application/view/tmpl/capability.phtml:23
420
  msgid "Filter Capability List"
421
  msgstr ""
422
 
423
- #: application/view/tmpl/capability.phtml:27
424
  msgid "Group Name"
425
  msgstr ""
426
 
427
- #: application/view/tmpl/capability.phtml:28
428
  msgid "Select"
429
  msgstr ""
430
 
431
- #: application/view/tmpl/capability.phtml:52
432
- #: application/view/tmpl/role.phtml:26 application/view/tmpl/role.phtml:45
433
- #: application/view/tmpl/user.phtml:29
434
  msgid "Role Name"
435
  msgstr ""
436
 
437
- #: application/view/tmpl/capability.phtml:53
438
- #: application/view/tmpl/event.phtml:16 application/view/tmpl/event.phtml:64
439
- #: application/view/tmpl/role.phtml:16 application/view/tmpl/user.phtml:16
440
- #: application/view/tmpl/user.phtml:30
441
- #: extension/AAM_Multisite_Support/ui.phtml:17
442
  msgid "Action"
443
  msgstr ""
444
 
445
- #: application/view/tmpl/capability.phtml:65
446
  msgid "Capability Name"
447
  msgstr ""
448
 
449
- #: application/view/tmpl/capability.phtml:69
450
  msgid "Keep Unfiltered"
451
  msgstr ""
452
 
453
- #: application/view/tmpl/configpress.phtml:6
454
- #: application/view/tmpl/configpress.phtml:25
455
- #: application/view/tmpl/configpress.phtml:44
456
- #: application/view/tmpl/extension.phtml:6
457
- #: application/view/tmpl/extension.phtml:94
458
- #: application/view/tmpl/extension.phtml:113
459
- #: application/view/tmpl/manager.phtml:16
460
- #: application/view/tmpl/manager.phtml:37
461
- #: application/view/tmpl/manager.phtml:56
462
- #: application/view/tmpl/manager.phtml:86
463
  msgid "Click to toggle"
464
  msgstr ""
465
 
466
- #: application/view/tmpl/configpress.phtml:9
467
  msgid "AAM ConfigPress"
468
  msgstr ""
469
 
470
- #: application/view/tmpl/configpress.phtml:27
471
- #: application/view/tmpl/extension.phtml:96
472
- #: application/view/tmpl/manager.phtml:39
473
  msgid "AAM Warnings"
474
  msgstr ""
475
 
476
- #: application/view/tmpl/configpress.phtml:46
477
- #: application/view/tmpl/manager.phtml:58
478
  msgid "Control Panel"
479
  msgstr ""
480
 
481
- #: application/view/tmpl/configpress.phtml:50
482
  msgid "Tutorial"
483
  msgstr ""
484
 
485
- #: application/view/tmpl/configpress.phtml:51
486
- #: application/view/tmpl/manager.phtml:63
487
  msgid "Save"
488
  msgstr ""
489
 
490
- #: application/view/tmpl/configpress.phtml:54
491
- #: application/view/tmpl/manager.phtml:66
492
  msgid "Follow @wpaam"
493
  msgstr ""
494
 
495
- #: application/view/tmpl/configpress.phtml:54
496
- #: application/view/tmpl/manager.phtml:66
497
  msgid "Follow"
498
  msgstr ""
499
 
500
- #: application/view/tmpl/configpress.phtml:55
501
- #: application/view/tmpl/manager.phtml:67
502
  msgid "Help Forum"
503
  msgstr ""
504
 
505
- #: application/view/tmpl/configpress.phtml:55
506
- #: application/view/tmpl/manager.phtml:67
507
  msgid "Help"
508
  msgstr ""
509
 
510
- #: application/view/tmpl/configpress.phtml:56
511
- #: application/view/tmpl/manager.phtml:68
512
- #: application/view/tmpl/manager.phtml:76
513
  msgid "E-mail Us"
514
  msgstr ""
515
 
516
- #: application/view/tmpl/configpress.phtml:57
517
- #: application/view/tmpl/manager.phtml:69
518
  msgid "Rate AAM"
519
  msgstr ""
520
 
521
- #: application/view/tmpl/configpress.phtml:57
522
- #: application/view/tmpl/manager.phtml:69
523
  msgid "Rate Us"
524
  msgstr ""
525
 
526
- #: application/view/tmpl/event.phtml:13 application/view/tmpl/event.phtml:27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
  msgid "Event"
528
  msgstr ""
529
 
530
- #: application/view/tmpl/event.phtml:14
531
  msgid "Event Specifier"
532
  msgstr ""
533
 
534
- #: application/view/tmpl/event.phtml:15
535
  msgid "Bind Post Type"
536
  msgstr ""
537
 
538
- #: application/view/tmpl/event.phtml:17
539
  msgid "Action Specifier"
540
  msgstr ""
541
 
542
- #: application/view/tmpl/event.phtml:23
543
  msgid "Manager Event"
544
  msgstr ""
545
 
546
- #: application/view/tmpl/event.phtml:30
547
  msgid "Post Status Change"
548
  msgstr ""
549
 
550
- #: application/view/tmpl/event.phtml:31
551
  msgid "Post Content Change"
552
  msgstr ""
553
 
554
- #: application/view/tmpl/event.phtml:36
555
  msgid "Status Changed To"
556
  msgstr ""
557
 
558
- #: application/view/tmpl/event.phtml:51
559
  msgid "Bind to Post Type"
560
  msgstr ""
561
 
562
- #: application/view/tmpl/event.phtml:67
563
  msgid "Email Notification"
564
  msgstr ""
565
 
566
- #: application/view/tmpl/event.phtml:68
567
  msgid "Change Status"
568
  msgstr ""
569
 
570
- #: application/view/tmpl/event.phtml:69
571
  msgid "Callback"
572
  msgstr ""
573
 
574
- #: application/view/tmpl/event.phtml:74
575
  msgid "Email Address"
576
  msgstr ""
577
 
578
- #: application/view/tmpl/event.phtml:80
579
  msgid "Change Status To"
580
  msgstr ""
581
 
582
- #: application/view/tmpl/event.phtml:95
583
  msgid "Callback Function"
584
  msgstr ""
585
 
586
- #: application/view/tmpl/event.phtml:105
587
  msgid "Are you sure you want to delete selected Event?"
588
  msgstr ""
589
 
590
- #: application/view/tmpl/extension.phtml:9
591
  msgid "Extension List"
592
  msgstr ""
593
 
594
- #: application/view/tmpl/extension.phtml:16
595
- #: application/view/tmpl/post.phtml:16
596
  msgid "Name"
597
  msgstr ""
598
 
599
- #: application/view/tmpl/extension.phtml:17
600
  msgid "Description"
601
  msgstr ""
602
 
603
- #: application/view/tmpl/extension.phtml:18
604
  msgid "Price"
605
  msgstr ""
606
 
607
- #: application/view/tmpl/extension.phtml:19
608
  msgid "Actions"
609
  msgstr ""
610
 
611
- #: application/view/tmpl/extension.phtml:71
612
  msgid "Install Extension"
613
  msgstr ""
614
 
615
- #: application/view/tmpl/extension.phtml:73
616
  msgid ""
617
  "If you already have license key for current extension, please enter it "
618
  "below. Othewise click <b>Purchase</b> button to checkout your order."
619
  msgstr ""
620
 
621
- #: application/view/tmpl/extension.phtml:77
622
  msgid "Update Extension"
623
  msgstr ""
624
 
625
- #: application/view/tmpl/extension.phtml:79
626
  msgid "Extension has been installed. Your license key: "
627
  msgstr ""
628
 
629
- #: application/view/tmpl/extension.phtml:115
630
  msgid "Connect with AAM"
631
  msgstr ""
632
 
633
- #: application/view/tmpl/manager.phtml:62
634
- #: application/view/tmpl/manager.phtml:73
 
 
 
635
  msgid "Undo Change"
636
  msgstr ""
637
 
638
- #: application/view/tmpl/manager.phtml:74
639
  msgid "Would your like to role back current settings?"
640
  msgstr ""
641
 
642
- #: application/view/tmpl/manager.phtml:77
643
  msgid "Our E-mail address is <b>support@wpaam.com</b>"
644
  msgstr ""
645
 
646
- #: application/view/tmpl/manager.phtml:88
647
  msgid "Control Manager"
648
  msgstr ""
649
 
650
- #: application/view/tmpl/menu.phtml:32
651
  msgid "Restrict All"
652
  msgstr ""
653
 
654
- #: application/view/tmpl/menu.phtml:69
655
  msgid "There is no single menu item allowed for current Role or User"
656
  msgstr ""
657
 
658
- #: application/view/tmpl/metabox.phtml:14
659
  msgid "Retrieve Metaboxes From Link"
660
  msgstr ""
661
 
662
- #: application/view/tmpl/metabox.phtml:15
663
  msgid "Refresh the List"
664
  msgstr ""
665
 
666
- #: application/view/tmpl/post.phtml:17
667
  msgid "Status"
668
  msgstr ""
669
 
670
- #: application/view/tmpl/post.phtml:30
671
  msgid "Filter Posts by Type"
672
  msgstr ""
673
 
674
- #: application/view/tmpl/post.phtml:33
675
  msgid "Collapse All"
676
  msgstr ""
677
 
678
- #: application/view/tmpl/post.phtml:34
679
  msgid "Expand All"
680
  msgstr ""
681
 
682
- #: application/view/tmpl/post.phtml:35
683
  msgid "Refresh"
684
  msgstr ""
685
 
686
- #: application/view/tmpl/post.phtml:44
687
  msgid "You reached the limit. Get <a href=\""
688
  msgstr ""
689
 
690
- #: application/view/tmpl/post.phtml:49
691
  msgid "Frontend"
692
  msgstr ""
693
 
694
- #: application/view/tmpl/post.phtml:50
695
  msgid "Backend"
696
  msgstr ""
697
 
698
- #: application/view/tmpl/post.phtml:59 application/view/tmpl/post.phtml:102
699
- msgid "Term Access"
700
- msgstr ""
701
-
702
- #: application/view/tmpl/post.phtml:63 application/view/tmpl/post.phtml:106
703
- #: application/view/tmpl/post.phtml:151 application/view/tmpl/post.phtml:194
704
- msgid "Restrict"
705
- msgstr ""
706
-
707
- #: application/view/tmpl/post.phtml:94
708
- msgid "Control Frontend Term Access"
709
- msgstr ""
710
-
711
- #: application/view/tmpl/post.phtml:136
712
- msgid "Control Backend Term Access"
713
- msgstr ""
714
-
715
- #: application/view/tmpl/post.phtml:147 application/view/tmpl/post.phtml:190
716
- msgid "All Posts in Term"
717
- msgstr ""
718
-
719
- #: application/view/tmpl/post.phtml:182
720
- msgid "Control Frontend Post Access"
721
- msgstr ""
722
-
723
- #: application/view/tmpl/post.phtml:224
724
- msgid "Control Backend Post Access"
725
- msgstr ""
726
-
727
- #: application/view/tmpl/post.phtml:231
728
- msgid "Get AAM Plus Package"
729
- msgstr ""
730
-
731
- #: application/view/tmpl/role.phtml:15
732
  msgid "Role"
733
  msgstr ""
734
 
735
- #: application/view/tmpl/role.phtml:30
736
  msgid "Inherit Caps"
737
  msgstr ""
738
 
739
- #: application/view/tmpl/role.phtml:37 application/view/tmpl/role.phtml:41
740
  msgid "Duplicate Role"
741
  msgstr ""
742
 
743
- #: application/view/tmpl/role.phtml:55
744
  msgid "Notice"
745
  msgstr ""
746
 
747
- #: application/view/tmpl/role.phtml:57
748
  msgid "You can not delete <b>Administrator</b> Role"
749
  msgstr ""
750
 
751
- #: application/view/tmpl/user.phtml:15 extension/AAM_Activity_Log/ui.phtml:14
752
  msgid "Username"
753
  msgstr ""
754
 
755
- #: application/view/tmpl/user.phtml:23
756
  msgid "Filter Users by Role"
757
  msgstr ""
758
 
759
- #: application/view/tmpl/user.phtml:37
760
  msgid "Delete User"
761
  msgstr ""
762
 
763
- #: application/view/tmpl/visitor.phtml:10
764
  msgid ""
765
  "Control Access to your blog for visitor (any user that is not logged in)"
766
  msgstr ""
767
 
768
- #: extension/AAM_Activity_Log/ui.phtml:15
769
  msgid "Activity"
770
  msgstr ""
771
 
772
- #: extension/AAM_Activity_Log/ui.phtml:16
773
  msgid "Time"
774
  msgstr ""
775
 
776
- #: extension/AAM_Activity_Log/ui.phtml:22
777
  msgid "Clear Activity Log"
778
  msgstr ""
779
 
780
- #: extension/AAM_Activity_Log/ui.phtml:24
781
  msgid "Are you sure you want to clear activity log?"
782
  msgstr ""
783
 
784
- #: extension/AAM_Activity_Log/ui.phtml:27
785
  msgid "Activity Log Info"
786
  msgstr ""
787
 
788
- #: extension/AAM_Activity_Log/ui.phtml:29
789
  #, php-format
790
  msgid ""
791
  "Basic version of Activity Log tracks only user's login and logout. Consider "
@@ -793,34 +819,44 @@ msgid ""
793
  "activities as well as we can develop additional activities on demand."
794
  msgstr ""
795
 
796
- #: extension/AAM_Multisite_Support/ui.phtml:16
797
  msgid "Site"
798
  msgstr ""
799
 
800
- #: extension/AAM_Multisite_Support/ui.phtml:23
801
  msgid "Set Default Site"
802
  msgstr ""
803
 
804
- #: extension/AAM_Multisite_Support/ui.phtml:25
805
  msgid "Would you like to set the site"
806
  msgstr ""
807
 
808
- #: extension/AAM_Multisite_Support/ui.phtml:25
809
  msgid "as default?"
810
  msgstr ""
811
 
812
- #: extension/AAM_Multisite_Support/ui.phtml:28
813
  msgid "All newly created sites will inherit list of Roles & Capabilities."
814
  msgstr ""
815
 
816
- #: extension/AAM_My_Feature/ui.phtml:12
817
  msgid "Do you need a custom feature? Ask us and we will develop it for you."
818
  msgstr ""
819
 
820
- #: extension/AAM_My_Feature/ui.phtml:17
821
  msgid "Email Us"
822
  msgstr ""
823
 
824
- #: extension/AAM_My_Feature/ui.phtml:20
825
  msgid "Ask on Forum"
826
  msgstr ""
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: AAM\n"
4
+ "POT-Creation-Date: 2014-04-06 20:42-0500\n"
5
+ "PO-Revision-Date: \n"
6
+ "Last-Translator: WPAAM <support@wpaam.com>\n"
7
  "Language-Team: WP AAM <support@wpaam.com>\n"
8
  "Language: en\n"
9
  "MIME-Version: 1.0\n"
13
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "X-Poedit-KeywordsList: __\n"
16
+ "X-Poedit-Basepath: d:\\xampp\\htdocs\\aam\\wp-content\\plugins\\aam\\\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
 
19
+ #: aam.php:381 aam.php:389 aam.php:416
20
  msgid "Access denied"
21
  msgstr ""
22
 
23
+ #: aam.php:899 aam.php:900
24
  msgid "AAM"
25
  msgstr ""
26
 
27
+ #: aam.php:911 aam.php:912
28
  msgid "Access Control"
29
  msgstr ""
30
 
31
+ #: aam.php:921 aam.php:922
32
  msgid "ConfigPress"
33
  msgstr ""
34
 
35
+ #: aam.php:931 aam.php:932
36
  msgid "Extensions"
37
  msgstr ""
38
 
39
+ #: application/core/repository.php:182
40
+ msgid "Failed to Remove Extension"
41
+ msgstr ""
42
+
43
+ #: application/core/repository.php:227
44
+ msgid "Invalid License Key"
45
+ msgstr ""
46
+
47
+ #: application/core/repository.php:230
48
+ msgid "Failed to write file to wp-content/aam folder"
49
+ msgstr ""
50
+
51
+ #: application/core/repository.php:234
52
+ msgid "Failed to reach the WPAAM Server"
53
+ msgstr ""
54
+
55
+ #: application/core/repository.php:250
56
+ msgid "Failed to insert extension to extension folder"
57
+ msgstr ""
58
+
59
+ #: application/view/abstract.php:81
60
+ msgid "You are not allowed to manager current view"
61
+ msgstr ""
62
+
63
+ #: application/view/capability.php:101 application/view/capability.php:205
64
  msgid "System"
65
  msgstr ""
66
 
67
+ #: application/view/capability.php:102 application/view/capability.php:207
68
  msgid "Post & Page"
69
  msgstr ""
70
 
71
+ #: application/view/capability.php:103 application/view/capability.php:209
72
  msgid "Backend Interface"
73
  msgstr ""
74
 
75
+ #: application/view/capability.php:104 application/view/capability.php:211
76
  msgid "Miscellaneous"
77
  msgstr ""
78
 
79
+ #: application/view/extension.php:107
80
  msgid "Folder advanced-access-manager/extension is not writable"
81
  msgstr ""
82
 
83
+ #: application/view/manager.php:76
84
  msgid "Roles"
85
  msgstr ""
86
 
87
+ #: application/view/manager.php:77
88
  msgid "Role Manager"
89
  msgstr ""
90
 
91
+ #: application/view/manager.php:86
92
  msgid "Users"
93
  msgstr ""
94
 
95
+ #: application/view/manager.php:87
96
  msgid "User Manager"
97
  msgstr ""
98
 
99
+ #: application/view/manager.php:96
100
  msgid "Visitor"
101
  msgstr ""
102
 
103
+ #: application/view/manager.php:97
104
  msgid "Visitor Manager"
105
  msgstr ""
106
 
107
+ #: application/view/manager.php:120
108
  msgid "Admin Menu"
109
  msgstr ""
110
 
111
+ #: application/view/manager.php:132
 
 
 
 
 
 
112
  msgid "Metabox & Widget"
113
  msgstr ""
114
 
115
+ #: application/view/manager.php:145 application/view/tmpl/capability.phtml:17
116
+ #: application/view/tmpl/control_area.phtml:39
117
+ #: application/view/tmpl/control_area.phtml:85
118
+ #: application/view/tmpl/control_area.phtml:138
119
+ #: application/view/tmpl/control_area.phtml:188
120
+ #: extension/AAM_Plus_Package/ui.phtml:28
121
+ #: extension/AAM_Plus_Package/ui.phtml:60
122
+ #: extension/AAM_Plus_Package/ui.phtml:93
123
+ #: extension/AAM_Plus_Package/ui.phtml:125
 
 
124
  msgid "Capability"
125
  msgstr ""
126
 
127
+ #: application/view/manager.php:156
 
 
 
 
 
 
 
 
 
128
  msgid "Posts & Pages"
129
  msgstr ""
130
 
131
+ #: application/view/manager.php:169
 
 
 
 
 
 
 
132
  msgid "Event Manager"
133
  msgstr ""
134
 
135
+ #: application/view/manager.php:242
136
+ msgid "You are not allowed to manage any AAM Features."
 
 
 
 
137
  msgstr ""
138
 
139
+ #: application/view/manager.php:810
140
  msgid "Rollback Settings"
141
  msgstr ""
142
 
143
+ #: application/view/manager.php:811
144
  msgid "Cancel"
145
  msgstr ""
146
 
147
+ #: application/view/manager.php:812
148
  msgid "Send E-mail"
149
  msgstr ""
150
 
151
+ #: application/view/manager.php:813 application/view/manager.php:819
152
  msgid "Add New Role"
153
  msgstr ""
154
 
155
+ #: application/view/manager.php:814
156
  msgid "Manage"
157
  msgstr ""
158
 
159
+ #: application/view/manager.php:815
160
  msgid "Edit"
161
  msgstr ""
162
 
163
+ #: application/view/manager.php:816
164
  msgid "Delete"
165
  msgstr ""
166
 
167
+ #: application/view/manager.php:817
168
  msgid "Filtered"
169
  msgstr ""
170
 
171
+ #: application/view/manager.php:818
172
  msgid "Clear"
173
  msgstr ""
174
 
175
+ #: application/view/manager.php:820
176
  msgid "Save Changes"
177
  msgstr ""
178
 
179
+ #: application/view/manager.php:821
180
  #, php-format
181
  msgid ""
182
  "System detected %d user(s) with this role. All Users with Role <b>%s</b> "
183
  "will be deleted automatically!"
184
  msgstr ""
185
 
186
+ #: application/view/manager.php:822
187
  #, php-format
188
  msgid "Are you sure that you want to delete role <b>%s</b>?"
189
  msgstr ""
190
 
191
+ #: application/view/manager.php:823 application/view/tmpl/role.phtml:53
192
  msgid "Delete Role"
193
  msgstr ""
194
 
195
+ #: application/view/manager.php:824
196
  msgid "Add User"
197
  msgstr ""
198
 
199
+ #: application/view/manager.php:825
200
  msgid "Filter Users"
201
  msgstr ""
202
 
203
+ #: application/view/manager.php:826 application/view/manager.php:842
204
  msgid "Refresh List"
205
  msgstr ""
206
 
207
+ #: application/view/manager.php:827
208
  msgid "Block"
209
  msgstr ""
210
 
211
+ #: application/view/manager.php:828
212
  #, php-format
213
  msgid "Are you sure you want to delete user <b>%s</b>?"
214
  msgstr ""
215
 
216
+ #: application/view/manager.php:829
217
  msgid "Filter Capabilities by Category"
218
  msgstr ""
219
 
220
+ #: application/view/manager.php:830 application/view/tmpl/capability.phtml:47
221
  msgid "Inherit Capabilities"
222
  msgstr ""
223
 
224
+ #: application/view/manager.php:831 application/view/tmpl/capability.phtml:62
225
  msgid "Add New Capability"
226
  msgstr ""
227
 
228
+ #: application/view/manager.php:832
229
  #, php-format
230
  msgid "Are you sure that you want to delete capability <b>%s</b>?"
231
  msgstr ""
232
 
233
+ #: application/view/manager.php:833 application/view/tmpl/capability.phtml:81
234
  msgid "Delete Capability"
235
  msgstr ""
236
 
237
+ #: application/view/manager.php:834
238
  msgid "Select Role"
239
  msgstr ""
240
 
241
+ #: application/view/manager.php:835
242
  msgid "Add Capability"
243
  msgstr ""
244
 
245
+ #: application/view/manager.php:836
246
  msgid "Add Event"
247
  msgstr ""
248
 
249
+ #: application/view/manager.php:837
250
  msgid "Edit Event"
251
  msgstr ""
252
 
253
+ #: application/view/manager.php:838 application/view/manager.php:840
254
+ #: application/view/tmpl/event.phtml:105
255
  msgid "Delete Event"
256
  msgstr ""
257
 
258
+ #: application/view/manager.php:839
259
  msgid "Save Event"
260
  msgstr ""
261
 
262
+ #: application/view/manager.php:841
263
  msgid "Filter Posts by Post Type"
264
  msgstr ""
265
 
266
+ #: application/view/manager.php:843 application/view/tmpl/manager.phtml:68
267
  msgid "Restore Default"
268
  msgstr ""
269
 
270
+ #: application/view/manager.php:844
271
  msgid "Apply"
272
  msgstr ""
273
 
274
+ #: application/view/manager.php:845
275
  msgid "Edit Term"
276
  msgstr ""
277
 
278
+ #: application/view/manager.php:846
279
  msgid "Manager Access"
280
  msgstr ""
281
 
282
+ #: application/view/manager.php:847
283
  msgid "Unlock Default Accesss Control"
284
  msgstr ""
285
 
286
+ #: application/view/manager.php:848
287
  msgid "Close"
288
  msgstr ""
289
 
290
+ #: application/view/manager.php:849
291
  msgid "Edit Role"
292
  msgstr ""
293
 
294
+ #: application/view/manager.php:850
295
  msgid "Restore Default Capabilities"
296
  msgstr ""
297
 
298
+ #: application/view/manager.php:851
299
  #, php-format
300
  msgid "Are you sure you want to delete <b>%s</b>?"
301
  msgstr ""
302
 
303
+ #: application/view/manager.php:852
304
  #, php-format
305
  msgid "Are you sure you want to move <b>%s</b> to trash?"
306
  msgstr ""
307
 
308
+ #: application/view/manager.php:853 application/view/tmpl/post.phtml:27
309
  msgid "Delete Post"
310
  msgstr ""
311
 
312
+ #: application/view/manager.php:854
313
  msgid "Delete Permanently"
314
  msgstr ""
315
 
316
+ #: application/view/manager.php:855
317
  msgid "Trash Post"
318
  msgstr ""
319
 
320
+ #: application/view/manager.php:856
321
  msgid "Restore Default Access"
322
  msgstr ""
323
 
324
+ #: application/view/manager.php:857
325
  msgid "Duplicate"
326
  msgstr ""
327
 
328
+ #: application/view/manager.php:858
329
+ msgid "Actions Locked"
330
+ msgstr ""
331
+
332
+ #: application/view/metabox.php:191
333
  msgid "Dashboard Widgets"
334
  msgstr ""
335
 
336
+ #: application/view/metabox.php:195
337
  msgid "Frontend Widgets"
338
  msgstr ""
339
 
340
+ #: application/view/post.php:199
341
  msgid "[empty]"
342
  msgstr ""
343
 
344
+ #: application/view/post.php:383 application/view/post.php:391
345
  msgid "All"
346
  msgstr ""
347
 
348
+ #: config.php:62
349
  msgid "Failed to create wp-content/aam folder"
350
  msgstr ""
351
 
352
+ #: config.php:65
353
  msgid "Folder wp-content/aam is not writable"
354
  msgstr ""
355
 
356
+ #: extension/AAM_Activities/extension.php:133
357
+ #: extension/AAM_Activities/extension.php:146
358
+ #: extension/AAM_Activities/extension.php:160
359
+ msgid "Post does not exist."
360
+ msgstr ""
361
+
362
+ #: extension/AAM_Activities/extension.php:136
363
+ #, php-format
364
+ msgid "Updated %s: %s"
365
+ msgstr ""
366
+
367
+ #: extension/AAM_Activities/extension.php:149
368
+ #, php-format
369
+ msgid "Trashed %s: %s"
370
+ msgstr ""
371
+
372
+ #: extension/AAM_Activities/extension.php:163
373
+ #, php-format
374
+ msgid "Untrashed %s: %s"
375
+ msgstr ""
376
+
377
+ #: extension/AAM_Activities/extension.php:172
378
+ #, php-format
379
+ msgid "Deleted %s %s"
380
+ msgstr ""
381
+
382
+ #: extension/AAM_Activities/extension.php:229
383
+ msgid "Undefined Type"
384
+ msgstr ""
385
+
386
  #: extension/AAM_Activity_Log/activity.php:98
387
  msgid "System Login"
388
  msgstr ""
395
  msgid "Unknown Activity"
396
  msgstr ""
397
 
398
+ #: extension/AAM_Activity_Log/extension.php:72
399
  msgid "Activity Log"
400
  msgstr ""
401
 
402
+ #: extension/AAM_Activity_Log/extension.php:176
 
 
 
 
 
 
403
  msgid "Clear Logs"
404
  msgstr ""
405
 
406
+ #: extension/AAM_Activity_Log/extension.php:177
407
  msgid "Get More"
408
  msgstr ""
409
 
410
+ #: extension/AAM_Multisite_Support/extension.php:122
411
  msgid "Sites"
412
  msgstr ""
413
 
414
+ #: extension/AAM_Multisite_Support/extension.php:123
415
  msgid "Site Manager"
416
  msgstr ""
417
 
418
+ #: extension/AAM_Multisite_Support/extension.php:186
419
  msgid "Set Default"
420
  msgstr ""
421
 
422
+ #: extension/AAM_Multisite_Support/extension.php:187
423
  msgid "Unset Default"
424
  msgstr ""
425
 
426
+ #: extension/AAM_Multisite_Support/extension.php:188
427
  msgid "Set as Default"
428
  msgstr ""
429
 
430
+ #: extension/AAM_My_Feature/extension.php:56
431
  msgid "My Feature"
432
  msgstr ""
433
 
434
+ #: extension/AAM_Plus_Package/extension.php:165
435
+ msgid "Comments"
436
  msgstr ""
437
 
438
+ #: application/view/tmpl/capability.phtml:16
439
  msgid "Category"
440
  msgstr ""
441
 
442
+ #: application/view/tmpl/capability.phtml:18
443
+ #: application/view/tmpl/event.phtml:19 application/view/tmpl/post.phtml:19
444
  msgid "Control"
445
  msgstr ""
446
 
447
+ #: application/view/tmpl/capability.phtml:24
448
  msgid "Filter Capability List"
449
  msgstr ""
450
 
451
+ #: application/view/tmpl/capability.phtml:28
452
  msgid "Group Name"
453
  msgstr ""
454
 
455
+ #: application/view/tmpl/capability.phtml:29
456
  msgid "Select"
457
  msgstr ""
458
 
459
+ #: application/view/tmpl/capability.phtml:53
460
+ #: application/view/tmpl/role.phtml:27 application/view/tmpl/role.phtml:46
461
+ #: application/view/tmpl/user.phtml:31
462
  msgid "Role Name"
463
  msgstr ""
464
 
465
+ #: application/view/tmpl/capability.phtml:54
466
+ #: application/view/tmpl/event.phtml:17 application/view/tmpl/event.phtml:65
467
+ #: application/view/tmpl/role.phtml:17 application/view/tmpl/user.phtml:17
468
+ #: application/view/tmpl/user.phtml:32
469
+ #: extension/AAM_Multisite_Support/ui.phtml:18
470
  msgid "Action"
471
  msgstr ""
472
 
473
+ #: application/view/tmpl/capability.phtml:66
474
  msgid "Capability Name"
475
  msgstr ""
476
 
477
+ #: application/view/tmpl/capability.phtml:70
478
  msgid "Keep Unfiltered"
479
  msgstr ""
480
 
481
+ #: application/view/tmpl/configpress.phtml:15
482
+ #: application/view/tmpl/configpress.phtml:34
483
+ #: application/view/tmpl/configpress.phtml:53
484
+ #: application/view/tmpl/extension.phtml:15
485
+ #: application/view/tmpl/extension.phtml:148
486
+ #: application/view/tmpl/extension.phtml:167
487
+ #: application/view/tmpl/manager.phtml:17
488
+ #: application/view/tmpl/manager.phtml:43
489
+ #: application/view/tmpl/manager.phtml:62
490
+ #: application/view/tmpl/manager.phtml:92
491
  msgid "Click to toggle"
492
  msgstr ""
493
 
494
+ #: application/view/tmpl/configpress.phtml:18
495
  msgid "AAM ConfigPress"
496
  msgstr ""
497
 
498
+ #: application/view/tmpl/configpress.phtml:36
499
+ #: application/view/tmpl/extension.phtml:150
500
+ #: application/view/tmpl/manager.phtml:45
501
  msgid "AAM Warnings"
502
  msgstr ""
503
 
504
+ #: application/view/tmpl/configpress.phtml:55
505
+ #: application/view/tmpl/manager.phtml:64
506
  msgid "Control Panel"
507
  msgstr ""
508
 
509
+ #: application/view/tmpl/configpress.phtml:59
510
  msgid "Tutorial"
511
  msgstr ""
512
 
513
+ #: application/view/tmpl/configpress.phtml:60
514
+ #: application/view/tmpl/manager.phtml:69
515
  msgid "Save"
516
  msgstr ""
517
 
518
+ #: application/view/tmpl/configpress.phtml:63
519
+ #: application/view/tmpl/manager.phtml:72
520
  msgid "Follow @wpaam"
521
  msgstr ""
522
 
523
+ #: application/view/tmpl/configpress.phtml:63
524
+ #: application/view/tmpl/manager.phtml:72
525
  msgid "Follow"
526
  msgstr ""
527
 
528
+ #: application/view/tmpl/configpress.phtml:64
529
+ #: application/view/tmpl/manager.phtml:73
530
  msgid "Help Forum"
531
  msgstr ""
532
 
533
+ #: application/view/tmpl/configpress.phtml:64
534
+ #: application/view/tmpl/manager.phtml:73
535
  msgid "Help"
536
  msgstr ""
537
 
538
+ #: application/view/tmpl/configpress.phtml:65
539
+ #: application/view/tmpl/manager.phtml:74
540
+ #: application/view/tmpl/manager.phtml:82
541
  msgid "E-mail Us"
542
  msgstr ""
543
 
544
+ #: application/view/tmpl/configpress.phtml:66
545
+ #: application/view/tmpl/manager.phtml:75
546
  msgid "Rate AAM"
547
  msgstr ""
548
 
549
+ #: application/view/tmpl/configpress.phtml:66
550
+ #: application/view/tmpl/manager.phtml:75
551
  msgid "Rate Us"
552
  msgstr ""
553
 
554
+ #: application/view/tmpl/control_area.phtml:35
555
+ #: application/view/tmpl/control_area.phtml:81
556
+ #: application/view/tmpl/control_area.phtml:132
557
+ #: application/view/tmpl/control_area.phtml:182
558
+ msgid "Access"
559
+ msgstr ""
560
+
561
+ #: application/view/tmpl/control_area.phtml:40
562
+ #: application/view/tmpl/control_area.phtml:86
563
+ #: application/view/tmpl/control_area.phtml:139
564
+ #: application/view/tmpl/control_area.phtml:189
565
+ #: extension/AAM_Plus_Package/ui.phtml:29
566
+ #: extension/AAM_Plus_Package/ui.phtml:61
567
+ #: extension/AAM_Plus_Package/ui.phtml:94
568
+ #: extension/AAM_Plus_Package/ui.phtml:126
569
+ msgid "Restrict"
570
+ msgstr ""
571
+
572
+ #: application/view/tmpl/control_area.phtml:130
573
+ #: application/view/tmpl/control_area.phtml:180
574
+ #, php-format
575
+ msgid "All %s in Term"
576
+ msgstr ""
577
+
578
+ #: application/view/tmpl/control_area.phtml:227
579
+ msgid "Get AAM Plus Package"
580
+ msgstr ""
581
+
582
+ #: application/view/tmpl/event.phtml:14 application/view/tmpl/event.phtml:28
583
  msgid "Event"
584
  msgstr ""
585
 
586
+ #: application/view/tmpl/event.phtml:15
587
  msgid "Event Specifier"
588
  msgstr ""
589
 
590
+ #: application/view/tmpl/event.phtml:16
591
  msgid "Bind Post Type"
592
  msgstr ""
593
 
594
+ #: application/view/tmpl/event.phtml:18
595
  msgid "Action Specifier"
596
  msgstr ""
597
 
598
+ #: application/view/tmpl/event.phtml:24
599
  msgid "Manager Event"
600
  msgstr ""
601
 
602
+ #: application/view/tmpl/event.phtml:31
603
  msgid "Post Status Change"
604
  msgstr ""
605
 
606
+ #: application/view/tmpl/event.phtml:32
607
  msgid "Post Content Change"
608
  msgstr ""
609
 
610
+ #: application/view/tmpl/event.phtml:37
611
  msgid "Status Changed To"
612
  msgstr ""
613
 
614
+ #: application/view/tmpl/event.phtml:52
615
  msgid "Bind to Post Type"
616
  msgstr ""
617
 
618
+ #: application/view/tmpl/event.phtml:68
619
  msgid "Email Notification"
620
  msgstr ""
621
 
622
+ #: application/view/tmpl/event.phtml:69
623
  msgid "Change Status"
624
  msgstr ""
625
 
626
+ #: application/view/tmpl/event.phtml:70
627
  msgid "Callback"
628
  msgstr ""
629
 
630
+ #: application/view/tmpl/event.phtml:75
631
  msgid "Email Address"
632
  msgstr ""
633
 
634
+ #: application/view/tmpl/event.phtml:81
635
  msgid "Change Status To"
636
  msgstr ""
637
 
638
+ #: application/view/tmpl/event.phtml:96
639
  msgid "Callback Function"
640
  msgstr ""
641
 
642
+ #: application/view/tmpl/event.phtml:106
643
  msgid "Are you sure you want to delete selected Event?"
644
  msgstr ""
645
 
646
+ #: application/view/tmpl/extension.phtml:18
647
  msgid "Extension List"
648
  msgstr ""
649
 
650
+ #: application/view/tmpl/extension.phtml:25
651
+ #: application/view/tmpl/post.phtml:17
652
  msgid "Name"
653
  msgstr ""
654
 
655
+ #: application/view/tmpl/extension.phtml:26
656
  msgid "Description"
657
  msgstr ""
658
 
659
+ #: application/view/tmpl/extension.phtml:27
660
  msgid "Price"
661
  msgstr ""
662
 
663
+ #: application/view/tmpl/extension.phtml:28
664
  msgid "Actions"
665
  msgstr ""
666
 
667
+ #: application/view/tmpl/extension.phtml:123
668
  msgid "Install Extension"
669
  msgstr ""
670
 
671
+ #: application/view/tmpl/extension.phtml:125
672
  msgid ""
673
  "If you already have license key for current extension, please enter it "
674
  "below. Othewise click <b>Purchase</b> button to checkout your order."
675
  msgstr ""
676
 
677
+ #: application/view/tmpl/extension.phtml:130
678
  msgid "Update Extension"
679
  msgstr ""
680
 
681
+ #: application/view/tmpl/extension.phtml:132
682
  msgid "Extension has been installed. Your license key: "
683
  msgstr ""
684
 
685
+ #: application/view/tmpl/extension.phtml:169
686
  msgid "Connect with AAM"
687
  msgstr ""
688
 
689
+ #: application/view/tmpl/manager.phtml:68
690
+ msgid "Default"
691
+ msgstr ""
692
+
693
+ #: application/view/tmpl/manager.phtml:79
694
  msgid "Undo Change"
695
  msgstr ""
696
 
697
+ #: application/view/tmpl/manager.phtml:80
698
  msgid "Would your like to role back current settings?"
699
  msgstr ""
700
 
701
+ #: application/view/tmpl/manager.phtml:83
702
  msgid "Our E-mail address is <b>support@wpaam.com</b>"
703
  msgstr ""
704
 
705
+ #: application/view/tmpl/manager.phtml:94
706
  msgid "Control Manager"
707
  msgstr ""
708
 
709
+ #: application/view/tmpl/menu.phtml:33
710
  msgid "Restrict All"
711
  msgstr ""
712
 
713
+ #: application/view/tmpl/menu.phtml:70
714
  msgid "There is no single menu item allowed for current Role or User"
715
  msgstr ""
716
 
717
+ #: application/view/tmpl/metabox.phtml:15
718
  msgid "Retrieve Metaboxes From Link"
719
  msgstr ""
720
 
721
+ #: application/view/tmpl/metabox.phtml:16
722
  msgid "Refresh the List"
723
  msgstr ""
724
 
725
+ #: application/view/tmpl/post.phtml:18
726
  msgid "Status"
727
  msgstr ""
728
 
729
+ #: application/view/tmpl/post.phtml:31
730
  msgid "Filter Posts by Type"
731
  msgstr ""
732
 
733
+ #: application/view/tmpl/post.phtml:34
734
  msgid "Collapse All"
735
  msgstr ""
736
 
737
+ #: application/view/tmpl/post.phtml:35
738
  msgid "Expand All"
739
  msgstr ""
740
 
741
+ #: application/view/tmpl/post.phtml:36
742
  msgid "Refresh"
743
  msgstr ""
744
 
745
+ #: application/view/tmpl/post.phtml:45
746
  msgid "You reached the limit. Get <a href=\""
747
  msgstr ""
748
 
749
+ #: application/view/tmpl/post.phtml:50
750
  msgid "Frontend"
751
  msgstr ""
752
 
753
+ #: application/view/tmpl/post.phtml:51
754
  msgid "Backend"
755
  msgstr ""
756
 
757
+ #: application/view/tmpl/role.phtml:16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  msgid "Role"
759
  msgstr ""
760
 
761
+ #: application/view/tmpl/role.phtml:31
762
  msgid "Inherit Caps"
763
  msgstr ""
764
 
765
+ #: application/view/tmpl/role.phtml:38 application/view/tmpl/role.phtml:42
766
  msgid "Duplicate Role"
767
  msgstr ""
768
 
769
+ #: application/view/tmpl/role.phtml:56
770
  msgid "Notice"
771
  msgstr ""
772
 
773
+ #: application/view/tmpl/role.phtml:58
774
  msgid "You can not delete <b>Administrator</b> Role"
775
  msgstr ""
776
 
777
+ #: application/view/tmpl/user.phtml:16 extension/AAM_Activity_Log/ui.phtml:15
778
  msgid "Username"
779
  msgstr ""
780
 
781
+ #: application/view/tmpl/user.phtml:25
782
  msgid "Filter Users by Role"
783
  msgstr ""
784
 
785
+ #: application/view/tmpl/user.phtml:39
786
  msgid "Delete User"
787
  msgstr ""
788
 
789
+ #: application/view/tmpl/visitor.phtml:11
790
  msgid ""
791
  "Control Access to your blog for visitor (any user that is not logged in)"
792
  msgstr ""
793
 
794
+ #: extension/AAM_Activity_Log/ui.phtml:16
795
  msgid "Activity"
796
  msgstr ""
797
 
798
+ #: extension/AAM_Activity_Log/ui.phtml:17
799
  msgid "Time"
800
  msgstr ""
801
 
802
+ #: extension/AAM_Activity_Log/ui.phtml:23
803
  msgid "Clear Activity Log"
804
  msgstr ""
805
 
806
+ #: extension/AAM_Activity_Log/ui.phtml:25
807
  msgid "Are you sure you want to clear activity log?"
808
  msgstr ""
809
 
810
+ #: extension/AAM_Activity_Log/ui.phtml:28
811
  msgid "Activity Log Info"
812
  msgstr ""
813
 
814
+ #: extension/AAM_Activity_Log/ui.phtml:30
815
  #, php-format
816
  msgid ""
817
  "Basic version of Activity Log tracks only user's login and logout. Consider "
819
  "activities as well as we can develop additional activities on demand."
820
  msgstr ""
821
 
822
+ #: extension/AAM_Multisite_Support/ui.phtml:17
823
  msgid "Site"
824
  msgstr ""
825
 
826
+ #: extension/AAM_Multisite_Support/ui.phtml:24
827
  msgid "Set Default Site"
828
  msgstr ""
829
 
830
+ #: extension/AAM_Multisite_Support/ui.phtml:26
831
  msgid "Would you like to set the site"
832
  msgstr ""
833
 
834
+ #: extension/AAM_Multisite_Support/ui.phtml:26
835
  msgid "as default?"
836
  msgstr ""
837
 
838
+ #: extension/AAM_Multisite_Support/ui.phtml:29
839
  msgid "All newly created sites will inherit list of Roles & Capabilities."
840
  msgstr ""
841
 
842
+ #: extension/AAM_My_Feature/ui.phtml:13
843
  msgid "Do you need a custom feature? Ask us and we will develop it for you."
844
  msgstr ""
845
 
846
+ #: extension/AAM_My_Feature/ui.phtml:18
847
  msgid "Email Us"
848
  msgstr ""
849
 
850
+ #: extension/AAM_My_Feature/ui.phtml:21
851
  msgid "Ask on Forum"
852
  msgstr ""
853
+
854
+ #: extension/AAM_Plus_Package/ui.phtml:24
855
+ #: extension/AAM_Plus_Package/ui.phtml:56
856
+ msgid "All Categories Default Access"
857
+ msgstr ""
858
+
859
+ #: extension/AAM_Plus_Package/ui.phtml:89
860
+ #: extension/AAM_Plus_Package/ui.phtml:121
861
+ msgid "All Posts Default Access"
862
+ msgstr ""
media/css/aam.css CHANGED
@@ -5,7 +5,7 @@
5
  * ======================================================================
6
  */
7
 
8
- .alpha-notice{
9
  margin: 15px 10px;
10
  border: 1px solid #FF8888;
11
  border-radius: 4px;
@@ -80,25 +80,6 @@
80
  margin: 10px 0px;
81
  }
82
 
83
- .aam-help{
84
- width: 100%;
85
- border: 1px solid #CCCCCC;
86
- border-radius: 5px;
87
- background: transparent url('images/help.png') no-repeat 10px center;
88
- height: 40px;
89
- padding: 5px 0;
90
- margin-bottom: 10px;
91
- display: table;
92
- }
93
-
94
- .aam-help span{
95
- display: none;
96
- vertical-align: middle;
97
- font-family: 'Lucida Console', Monaco, monospace;
98
- text-align: justify;
99
- padding: 0 20px 0 50px;
100
- }
101
-
102
  .wrap a{
103
  outline: 0;
104
  }
@@ -222,6 +203,13 @@
222
  position: relative;
223
  }
224
 
 
 
 
 
 
 
 
225
  /** CONTROL PANEL STYLES */
226
  .cpanel-major{
227
  display: table;
@@ -246,6 +234,13 @@
246
  background-position: center top;
247
  }
248
 
 
 
 
 
 
 
 
249
  .cpanel-minor{
250
  display: table;
251
  width: 100%;
@@ -584,6 +579,10 @@
584
  background-image: url('images/cmanager/select-active.png');
585
  }
586
 
 
 
 
 
587
  .user-settings{
588
  border: 1px solid #E2E4FF;
589
  width: 100%;
5
  * ======================================================================
6
  */
7
 
8
+ .aam-beta-version{
9
  margin: 15px 10px;
10
  border: 1px solid #FF8888;
11
  border-radius: 4px;
80
  margin: 10px 0px;
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  .wrap a{
84
  outline: 0;
85
  }
203
  position: relative;
204
  }
205
 
206
+ .feature-list-empty{
207
+ text-align: center;
208
+ font-size: 1.1em;
209
+ color: #AAAAAA;
210
+ padding: 10px;
211
+ }
212
+
213
  /** CONTROL PANEL STYLES */
214
  .cpanel-major{
215
  display: table;
234
  background-position: center top;
235
  }
236
 
237
+ .cpanel-major .cpanel-item-disabled{
238
+ opacity: 0.8;
239
+ cursor: none;
240
+ pointer-events: none;
241
+ text-decoration: line-through;
242
+ }
243
+
244
  .cpanel-minor{
245
  display: table;
246
  width: 100%;
579
  background-image: url('images/cmanager/select-active.png');
580
  }
581
 
582
+ .user-action-locked{
583
+ background-image: url('images/cmanager/lock.png');
584
+ }
585
+
586
  .user-settings{
587
  border: 1px solid #E2E4FF;
588
  width: 100%;
media/css/extension.css CHANGED
@@ -208,4 +208,12 @@ input.license-input{
208
  vertical-align: middle;
209
  padding-left: 30px;
210
  font-size: 0.9em;
 
 
 
 
 
 
 
 
211
  }
208
  vertical-align: middle;
209
  padding-left: 30px;
210
  font-size: 0.9em;
211
+ }
212
+
213
+ .extension-error-list{
214
+ margin-top: 5px;
215
+ display: none;
216
+ font-size: 0.8em;
217
+ color: #FF8888;
218
+ font-weight: bold;
219
  }
media/css/images/cmanager/lock.png ADDED
Binary file
media/css/images/help.png DELETED
Binary file
media/js/aam.js CHANGED
@@ -140,8 +140,6 @@ AAM.prototype.setSubject = function(type, id) {
140
  /**
141
  * Get Current Subject
142
  *
143
- * @param {String} subject
144
- *
145
  * @returns {void}
146
  *
147
  * @access public
@@ -162,7 +160,7 @@ AAM.prototype.initUI = function() {
162
  this.initControlPanel();
163
  this.initControlManager();
164
 
165
- //Retrieve settings of default segment
166
  this.retrieveSettings();
167
  };
168
 
@@ -245,6 +243,28 @@ AAM.prototype.compileAjaxPackage = function(action, include_subject) {
245
  return data;
246
  };
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  /**
249
  * Initialize Control Panel Metabox
250
  *
@@ -257,43 +277,41 @@ AAM.prototype.initControlPanel = function() {
257
  //Role Back feature
258
  jQuery('#aam_roleback').bind('click', function(event) {
259
  event.preventDefault();
260
- var buttons = {};
261
- buttons[aamLocal.labels['Rollback Settings']] = function() {
262
- _this.showMetaboxLoader('#control_panel');
263
- jQuery.ajax(aamLocal.ajaxurl, {
264
- type: 'POST',
265
- dataType: 'json',
266
- data: _this.compileAjaxPackage('roleback', true),
267
- success: function(response) {
268
- if (response.status === 'success') {
269
- _this.retrieveSettings();
270
- if (response.more === 1) {
271
- jQuery('#aam_roleback').show();
272
- } else {
273
- jQuery('#aam_roleback').hide();
274
  }
 
 
 
 
 
 
 
 
275
  }
276
- _this.highlight('#control_panel .inside', response.status);
277
- },
278
- error: function() {
279
- _this.highlight('#control_panel .inside', 'failure');
280
- },
281
- complete: function() {
282
- _this.hideMetaboxLoader('#control_panel');
283
- jQuery("#restore_dialog").dialog("close");
284
- }
285
- });
286
- };
287
- buttons[aamLocal.labels['Cancel']] = function() {
288
- jQuery("#restore_dialog").dialog("close");
289
- };
290
 
291
- jQuery("#restore_dialog").dialog({
292
- resizable: false,
293
- height: 180,
294
- modal: true,
295
- buttons: buttons
296
- });
 
297
  });
298
 
299
  //Save the AAM settings
@@ -305,20 +323,26 @@ AAM.prototype.initControlPanel = function() {
305
  var data = _this.compileAjaxPackage('save', true);
306
  //collect data from the form
307
  //1. Collect Main Menu
308
- jQuery('input', '#admin_menu_content').each(function() {
309
- data[jQuery(this).attr('name')] = (jQuery(this).prop('checked') ? 1 : 0);
310
- });
 
 
311
  //2. Collect Metaboxes & Widgets
312
- jQuery('input', '#metabox_list').each(function() {
313
- data[jQuery(this).attr('name')] = (jQuery(this).prop('checked') ? 1 : 0);
314
- });
315
- if (_this.getSubject().type !== 'visitor') {
316
- //3. Collect Capabilities
 
 
317
  var caps = _this.blogTables.capabilities.fnGetData();
318
  for (var i in caps) {
319
  data['aam[capability][' + caps[i][0] + ']'] = caps[i][1];
320
  }
321
- //4. Collect Events
 
 
322
  var events = _this.blogTables.eventList.fnGetData();
323
  for (var j in events) {
324
  data['aam[event][' + j + '][event]'] = events[j][0];
@@ -328,6 +352,8 @@ AAM.prototype.initControlPanel = function() {
328
  data['aam[event][' + j + '][action_specifier]'] = events[j][4];
329
  }
330
  }
 
 
331
 
332
  //send the Ajax request to save the data
333
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -336,7 +362,6 @@ AAM.prototype.initControlPanel = function() {
336
  data: data,
337
  success: function(response) {
338
  if (response.status === 'success') {
339
- jQuery('#aam_roleback').show();
340
  _this.retrieveSettings();
341
  }
342
  _this.highlight('#control_panel .inside', response.status);
@@ -468,7 +493,7 @@ AAM.prototype.loadRoleSegment = function() {
468
  });
469
  aoData.push({
470
  name: 'sub_action',
471
- value: 'role_list'
472
  });
473
  aoData.push({
474
  name: '_ajax_nonce',
@@ -490,7 +515,7 @@ AAM.prototype.loadRoleSegment = function() {
490
  jQuery.ajax(aamLocal.ajaxurl, {
491
  type: 'POST',
492
  dataType: 'json',
493
- data: _this.compileAjaxPackage('pure_role_list'),
494
  success: function(response) {
495
  //reset selector
496
  jQuery('#parent_cap_role').empty();
@@ -515,11 +540,13 @@ AAM.prototype.loadRoleSegment = function() {
515
  _this.initTooltip(jQuery('#role_list_wrapper .role-top-actions'));
516
  },
517
  fnDrawCallback: function() {
518
- jQuery('#role_list_wrapper .clear-table-filter').bind('click', function(event) {
519
- event.preventDefault();
520
- jQuery('#role_list_filter input').val('');
521
- _this.segmentTables.roleList.fnFilter('');
522
- });
 
 
523
  },
524
  oLanguage: {
525
  sSearch: "",
@@ -570,7 +597,7 @@ AAM.prototype.loadRoleSegment = function() {
570
  _this.launch(jQuery(this), 'role-action-edit');
571
  _this.launchEditRoleDialog(this, aData);
572
  }));
573
-
574
  /**
575
  jQuery('.role-actions', nRow).append(jQuery('<a/>', {
576
  'href': '#',
@@ -690,9 +717,9 @@ AAM.prototype.launchAddRoleDialog = function(button) {
690
  var buttons = {};
691
  buttons[aamLocal.labels['Add New Role']] = function() {
692
  //prepare ajax package
693
- var data = _this.compileAjaxPackage('add_role');
694
  data.name = jQuery('#role_name').val();
695
- data.inherit = jQuery('#parent_cap_role').val()
696
 
697
  //send the request
698
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -729,6 +756,7 @@ AAM.prototype.launchAddRoleDialog = function(button) {
729
  * Launch Duplicate Role Dialog
730
  *
731
  * @param {Object} button
 
732
  *
733
  * @returns {void}
734
  *
@@ -795,7 +823,7 @@ AAM.prototype.launchEditRoleDialog = function(button, aData) {
795
  //launch the dialog
796
  var buttons = {};
797
  buttons[aamLocal.labels['Save Changes']] = function() {
798
- var data = _this.compileAjaxPackage('edit_role');
799
  data.subject = 'role';
800
  data.subject_id = aData[0];
801
  data.name = jQuery('#role_name').val();
@@ -862,7 +890,7 @@ AAM.prototype.launchDeleteRoleDialog = function(button, aData) {
862
  var buttons = {};
863
  buttons[aamLocal.labels['Delete Role']] = function() {
864
  //prepare ajax package
865
- var data = _this.compileAjaxPackage('delete_role');
866
  data.subject = 'role';
867
  data.subject_id = aData[0];
868
  data.delete_users = parseInt(aData[1]);
@@ -941,7 +969,7 @@ AAM.prototype.loadUserSegment = function() {
941
  });
942
  aoData.push({
943
  name: 'sub_action',
944
- value: 'user_list'
945
  });
946
  aoData.push({
947
  name: '_ajax_nonce',
@@ -955,7 +983,7 @@ AAM.prototype.loadUserSegment = function() {
955
  aoColumnDefs: [
956
  {
957
  bVisible: false,
958
- aTargets: [0, 1, 4]
959
  }
960
  ],
961
  fnInitComplete: function() {
@@ -991,12 +1019,14 @@ AAM.prototype.loadUserSegment = function() {
991
  _this.initTooltip(jQuery('#user_list_wrapper .user-top-actions'));
992
  },
993
  fnDrawCallback: function() {
994
- jQuery('#user_list_wrapper .clear-table-filter').bind('click', function(event) {
995
- event.preventDefault();
996
- jQuery('#user_list_filter input').val('');
997
- _this.userRoleFilter = '';
998
- _this.segmentTables.userList.fnFilter('');
999
- });
 
 
1000
  },
1001
  oLanguage: {
1002
  sSearch: "",
@@ -1014,51 +1044,52 @@ AAM.prototype.loadUserSegment = function() {
1014
  'class': 'user-actions'
1015
  }));
1016
 
1017
- jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1018
- 'href': '#',
1019
- 'class': 'user-action user-action-manage',
1020
- 'aam-tooltip': aamLocal.labels['Manager']
1021
- }).bind('click', function(event) {
1022
- event.preventDefault();
1023
- _this.setSubject('user', aData[0]);
1024
- _this.retrieveSettings();
1025
- _this.setCurrent('user', nRow, aData[2]);
1026
- }));
1027
-
1028
- jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1029
- 'href': aamLocal.editUserURI + '?user_id=' + aData[0],
1030
- 'target': '_blank',
1031
- 'class': 'user-action user-action-edit',
1032
- 'aam-tooltip': aamLocal.labels['Edit']
1033
- }));
1034
-
1035
- var status = (aData[4] === '1' ? 'user-action-block-active' : 'user-action-block');
1036
- jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1037
- 'href': '#',
1038
- 'class': 'user-action ' + status,
1039
- 'aam-tooltip': aamLocal.labels['Block']
1040
- }).bind('click', function(event) {
1041
- event.preventDefault();
1042
- _this.blockUser(this, aData);
1043
- }));
1044
- /**
1045
- jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1046
- 'href': '#',
1047
- 'class': 'user-action user-action-restore',
1048
- 'aam-tooltip': aamLocal.labels['Restore Default']
1049
- }).bind('click', function(event) {
1050
- event.preventDefault();
1051
- }));
1052
- */
1053
- jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1054
- 'href': '#',
1055
- 'class': 'user-action user-action-delete',
1056
- 'aam-tooltip': aamLocal.labels['Delete']
1057
- }).bind('click', function(event) {
1058
- event.preventDefault();
1059
- _this.launch(jQuery(this), 'user-action-delete');
1060
- _this.deleteUser(this, aData);
1061
- }));
 
1062
 
1063
  //set active
1064
  if (_this.getSubject().type === 'user'
@@ -1087,7 +1118,7 @@ AAM.prototype.loadUserSegment = function() {
1087
  */
1088
  AAM.prototype.blockUser = function(button, aData) {
1089
  var _this = this;
1090
- var data = this.compileAjaxPackage('block_user');
1091
  data.subject = 'user';
1092
  data.subject_id = aData[0];
1093
  //send the request
@@ -1127,7 +1158,7 @@ AAM.prototype.deleteUser = function(button, aData) {
1127
  );
1128
  var buttons = {};
1129
  buttons[aamLocal.labels['Delete']] = function() {
1130
- var data = _this.compileAjaxPackage('delete_user');
1131
  data.subject = 'user';
1132
  data.subject_id = aData[0];
1133
  //send request
@@ -1202,7 +1233,7 @@ AAM.prototype.launchFilterUserDialog = function(button) {
1202
  });
1203
  aoData.push({
1204
  name: 'sub_action',
1205
- value: 'role_list'
1206
  });
1207
  aoData.push({
1208
  name: '_ajax_nonce',
@@ -1210,11 +1241,13 @@ AAM.prototype.launchFilterUserDialog = function(button) {
1210
  });
1211
  },
1212
  fnDrawCallback: function() {
1213
- jQuery('#filter_role_list_wrapper .clear-table-filter').bind('click', function(event) {
1214
- event.preventDefault();
1215
- jQuery('#filter_role_list_filter input').val('');
1216
- _this.blogTables.filterRoleList.fnFilter('');
1217
- });
 
 
1218
  _this.initTooltip('#filter_role_list_wrapper');
1219
  },
1220
  oLanguage: {
@@ -1316,8 +1349,8 @@ AAM.prototype.retrieveSettings = function() {
1316
  },
1317
  success: function(response) {
1318
  jQuery('.aam-main-content').html(response);
1319
- _this.initSettings();
1320
  _this.checkRoleback();
 
1321
  },
1322
  complete: function() {
1323
  jQuery('.aam-main-loader').hide();
@@ -1336,12 +1369,12 @@ AAM.prototype.checkRoleback = function() {
1336
  jQuery.ajax(aamLocal.ajaxurl, {
1337
  type: 'POST',
1338
  dataType: 'json',
1339
- data: _this.compileAjaxPackage('check_roleback', true),
1340
  success: function(response) {
1341
- if (response.status === 1) {
1342
- jQuery('#aam_roleback').show();
1343
  } else {
1344
- jQuery('#aam_roleback').hide();
1345
  }
1346
  },
1347
  complete: function() {
@@ -1374,23 +1407,29 @@ AAM.prototype.initSettings = function() {
1374
 
1375
  jQuery('.feature-list .feature-item').removeClass(
1376
  'feature-item-active'
1377
- );
1378
  jQuery(this).addClass('feature-item-active');
1379
  jQuery('.feature-content .feature-content-container').hide();
1380
  jQuery('#' + jQuery(this).attr('feature') + '_content').show();
1381
- //hide help content
1382
- jQuery('.aam-help > span').hide();
1383
- jQuery('#feature_help_' + jQuery(this).attr('feature')).css(
1384
- 'display', 'table-cell'
1385
- );
1386
  });
1387
  });
1388
 
1389
- this.initMenuTab();
1390
- this.initMetaboxTab();
1391
- this.initCapabilityTab();
1392
- this.initPostTab();
1393
- this.initEventTab();
 
 
 
 
 
 
 
 
 
 
 
1394
 
1395
  this.doAction('aam_init_features');
1396
 
@@ -1442,7 +1481,7 @@ AAM.prototype.initCapabilityTab = function() {
1442
  });
1443
  aoData.push({
1444
  name: 'sub_action',
1445
- value: 'load_capabilities'
1446
  });
1447
  aoData.push({
1448
  name: '_ajax_nonce',
@@ -1504,7 +1543,7 @@ AAM.prototype.initCapabilityTab = function() {
1504
  'aam-tooltip': aamLocal.labels['Restore Default Capabilities']
1505
  }).bind('click', function(event) {
1506
  event.preventDefault();
1507
- var data = _this.compileAjaxPackage('restore_capability', true);
1508
  //show indicator that is running
1509
  jQuery(this).addClass('capability-top-action-restore-running');
1510
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -1569,12 +1608,14 @@ AAM.prototype.initCapabilityTab = function() {
1569
  _this.initTooltip(nRow);
1570
  },
1571
  fnDrawCallback: function() {
1572
- jQuery('#capability_list_wrapper .clear-table-filter').bind('click', function(event) {
1573
- event.preventDefault();
1574
- jQuery('#capability_list_wrapper input').val('');
1575
- _this.blogTables.capabilities.fnFilter('');
1576
- _this.blogTables.capabilities.fnFilter('', 2);
1577
- });
 
 
1578
  },
1579
  fnInfoCallback: function(oSettings, iStart, iEnd, iMax, iTotal, sPre) {
1580
  return (iMax !== iTotal ? _this.clearFilterIndicator() : '');
@@ -1597,6 +1638,7 @@ AAM.prototype.initCapabilityTab = function() {
1597
  *
1598
  * @param {Object} button
1599
  * @param {Object} aData
 
1600
  *
1601
  * @returns {void}
1602
  *
@@ -1606,10 +1648,11 @@ AAM.prototype.launchDeleteCapabilityDialog = function(button, aData, nRow) {
1606
  var _this = this;
1607
  jQuery('#delete_capability .dialog-content').html(
1608
  aamLocal.labels['Delete Capability Message'].replace('%s', aData[3])
1609
- );
 
1610
  var buttons = {};
1611
  buttons[aamLocal.labels['Delete Capability']] = function() {
1612
- var data = _this.compileAjaxPackage('delete_capability');
1613
  data.capability = aData[0];
1614
  jQuery.ajax(aamLocal.ajaxurl, {
1615
  type: 'POST',
@@ -1666,7 +1709,7 @@ AAM.prototype.launchCapabilityFilterDialog = function(button) {
1666
  event.preventDefault();
1667
  _this.blogTables.capabilities.fnFilter(
1668
  aData[0].replace('&amp;', '&'), 2
1669
- );
1670
  jQuery('#filter_capability_dialog').dialog('close');
1671
  });
1672
  }
@@ -1723,7 +1766,7 @@ AAM.prototype.launchRoleCopyDialog = function(button) {
1723
  });
1724
  aoData.push({
1725
  name: 'sub_action',
1726
- value: 'role_list'
1727
  });
1728
  aoData.push({
1729
  name: '_ajax_nonce',
@@ -1731,11 +1774,13 @@ AAM.prototype.launchRoleCopyDialog = function(button) {
1731
  });
1732
  },
1733
  fnDrawCallback: function() {
1734
- jQuery('#copy_role_list_wrapper .clear-table-filter').bind('click', function(event) {
1735
- event.preventDefault();
1736
- jQuery('#copy_role_list_filter input').val('');
1737
- _this.blogTables.inheritRole.fnFilter('');
1738
- });
 
 
1739
  },
1740
  oLanguage: {
1741
  sSearch: "",
@@ -1765,7 +1810,7 @@ AAM.prototype.launchRoleCopyDialog = function(button) {
1765
  }).bind('click', function(event) {
1766
  event.preventDefault();
1767
  _this.showMetaboxLoader('#copy_role_dialog');
1768
- var data = _this.compileAjaxPackage('role_capabilities');
1769
  data.subject = 'role';
1770
  data.subject_id = aData[0];
1771
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -1843,7 +1888,7 @@ AAM.prototype.launchAddCapabilityDialog = function(button) {
1843
  var capability = jQuery.trim(jQuery('#capability_name').val());
1844
  if (capability) {
1845
  _this.showMetaboxLoader('#capability_form_dialog');
1846
- var data = _this.compileAjaxPackage('add_capability');
1847
  data.capability = capability;
1848
  data.unfiltered = (jQuery('#capability_unfiltered').attr('checked') ? 1 : 0);
1849
 
@@ -1916,11 +1961,11 @@ AAM.prototype.initMenuTab = function() {
1916
  if (jQuery(this).attr('checked')) {
1917
  jQuery('input[type="checkbox"]', '#submenu_' + jQuery(this).attr('id')).attr(
1918
  'checked', 'checked'
1919
- );
1920
  } else {
1921
  jQuery('input[type="checkbox"]', '#submenu_' + jQuery(this).attr('id')).removeAttr(
1922
  'checked'
1923
- );
1924
  }
1925
  });
1926
  });
@@ -1970,7 +2015,7 @@ AAM.prototype.initMetaboxTab = function() {
1970
 
1971
  if (link) {
1972
  //init metaboxes
1973
- var data = _this.compileAjaxPackage('init_link');
1974
  data.link = link;
1975
 
1976
  //send the request
@@ -2017,7 +2062,7 @@ AAM.prototype.initMetaboxTab = function() {
2017
  AAM.prototype.loadMetaboxes = function(refresh) {
2018
  var _this = this;
2019
  //init metaboxes
2020
- var data = this.compileAjaxPackage('load_metaboxes', true);
2021
  data.refresh = refresh;
2022
  //show loader and reset the metabox list holder
2023
  jQuery('#metabox_list_container').empty();
@@ -2097,7 +2142,7 @@ AAM.prototype.initEventTab = function() {
2097
  });
2098
  aoData.push({
2099
  name: 'sub_action',
2100
- value: 'event_list'
2101
  });
2102
  aoData.push({
2103
  name: '_ajax_nonce',
@@ -2248,7 +2293,7 @@ AAM.prototype.launchManageEventDialog = function(button, aData, nRow) {
2248
  _this.terminate(
2249
  jQuery(button),
2250
  (aData ? 'event-action-edit' : 'event-top-action-add')
2251
- );
2252
  }
2253
  });
2254
  };
@@ -2356,7 +2401,7 @@ AAM.prototype.initPostTab = function() {
2356
  });
2357
  aoData.push({
2358
  name: 'sub_action',
2359
- value: 'post_list'
2360
  });
2361
  aoData.push({
2362
  name: '_ajax_nonce',
@@ -2448,7 +2493,7 @@ AAM.prototype.initPostTab = function() {
2448
  'aam-tooltip': aamLocal.labels['Edit']
2449
  }));
2450
 
2451
- if (aData[1] == 'trash') {
2452
  jQuery('.post-actions', nRow).append(jQuery('<a/>', {
2453
  'href': '#',
2454
  'class': 'post-action post-action-delete',
@@ -2488,11 +2533,13 @@ AAM.prototype.initPostTab = function() {
2488
  fnDrawCallback: function() {
2489
  jQuery('.post-breadcrumb').addClass('post-breadcrumb-loading');
2490
  _this.loadBreadcrumb();
2491
- jQuery('#event_list_wrapper .clear-table-filter').bind('click', function(event) {
2492
- event.preventDefault();
2493
- jQuery('#event_list_filter input').val('');
2494
- _this.blogTables.postList.fnFilter('');
2495
- });
 
 
2496
  },
2497
  fnInfoCallback: function(oSettings, iStart, iEnd, iMax, iTotal, sPre) {
2498
  return (iMax !== iTotal ? _this.clearFilterIndicator() : '');
@@ -2531,7 +2578,8 @@ AAM.prototype.launchFilterPostDialog = function(button) {
2531
  * Launch Manage Access Control for selected post
2532
  *
2533
  * @param {Object} button
2534
- * @param {Object} aData
 
2535
  * @param {String} type
2536
  *
2537
  * @returns {void}
@@ -2540,32 +2588,16 @@ AAM.prototype.launchFilterPostDialog = function(button) {
2540
  */
2541
  AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2542
  var _this = this;
2543
- //prepare form for view
2544
- jQuery('.dataTable', '#access_dialog').hide();
2545
-
2546
- if (type === 'term') {
2547
- jQuery('#term_access').show();
2548
- jQuery('#term_access_frontend').show();
2549
- } else {
2550
- jQuery('#term_access').hide();
2551
- }
2552
-
2553
- //by default show frontend access
2554
- jQuery('#post_access_frontend').show();
2555
 
2556
  //reset the Frontend/Backend radio
2557
  if (jQuery('.post-access-area', '#access_dialog').length) {
2558
  //in case it is Visitor, this section is not rendered
2559
- jQuery('.post-access-area input').attr('checked', false);
2560
  jQuery('.post-access-area #post_area_frontend').attr('checked', true);
2561
  jQuery('.post-access-area').buttonset('refresh');
2562
  }
2563
 
2564
- //reset all checkboxes
2565
- jQuery('input', '#access_dialog').prop('checked', false);
2566
-
2567
  //retrieve settings and display the dialog
2568
- var data = this.compileAjaxPackage('get_access', true);
2569
  data.id = aData[0];
2570
  data.type = type;
2571
 
@@ -2574,29 +2606,23 @@ AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2574
  dataType: 'json',
2575
  data: data,
2576
  success: function(response) {
 
 
 
2577
  if (type === 'term') {
2578
- jQuery('.post-access-title').html('All Posts in Term');
2579
- if (response.counter !== -1) {
2580
  jQuery('.post-access-block', '#access_dialog').show();
 
 
2581
  }
2582
  } else {
2583
  jQuery('.post-access-block', '#access_dialog').hide();
2584
- jQuery('.post-access-title').html('Post Access');
2585
- }
2586
- //populate the form
2587
- for (var object in response.settings) {
2588
- for (var area in response.settings[object]) {
2589
- for (var action in response.settings[object][area]) {
2590
- var element = '#' + object + '_' + area;
2591
- element += '_' + action;
2592
- jQuery(element, '#access_dialog').attr(
2593
- 'checked',
2594
- (parseInt(response.settings[object][area][action]) === 1 ? true : false)
2595
- );
2596
- }
2597
- }
2598
  }
2599
 
 
 
 
2600
  var buttons = {};
2601
  buttons[aamLocal.labels['Restore Default']] = function() {
2602
  _this.restorePostAccess(aData[0], type, nRow);
@@ -2606,17 +2632,12 @@ AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2606
  if (response.counter <= 10) {
2607
  buttons[aamLocal.labels['Apply']] = function() {
2608
  _this.showMetaboxLoader('#access_dialog');
2609
- var data = _this.compileAjaxPackage('save_access', true);
2610
  data.id = aData[0];
2611
  data.type = type;
2612
 
2613
  jQuery('input', '#access_control_area').each(function() {
2614
- if (jQuery(this).attr('object')) {
2615
- var name = 'access[' + jQuery(this).attr('object') + '][';
2616
- name += jQuery(this).attr('area') + '][';
2617
- name += jQuery(this).attr('action') + ']';
2618
- data[name] = (jQuery(this).prop('checked') ? 1 : 0);
2619
- }
2620
  });
2621
 
2622
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -2654,7 +2675,7 @@ AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2654
  close: function() {
2655
  _this.terminate(
2656
  jQuery(button), 'post-breadcrumb-line-action-manage'
2657
- );
2658
  }
2659
  });
2660
  },
@@ -2666,18 +2687,18 @@ AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2666
 
2667
  /**
2668
  * Restore Default Post/Term Access
2669
- *
2670
  * @param {type} id
2671
  * @param {type} type
2672
  * @param {type} nRow
2673
- *
2674
  * @returns {void}
2675
  */
2676
  AAM.prototype.restorePostAccess = function(id, type, nRow) {
2677
  var _this = this;
2678
 
2679
  //retrieve settings and display the dialog
2680
- var data = this.compileAjaxPackage('clear_access', true);
2681
  data.id = id;
2682
  data.type = type;
2683
 
@@ -2697,9 +2718,9 @@ AAM.prototype.restorePostAccess = function(id, type, nRow) {
2697
  /**
2698
  * Launch the Delete Post Dialog
2699
  *
2700
- * @param {Object} button
2701
- * @param {Object} aRow
2702
- * @param {Object} aData
2703
  * @param {Boolean} force
2704
  *
2705
  * @returns {void}
@@ -2711,7 +2732,7 @@ AAM.prototype.launchDeletePostDialog = function(button, nRow, aData, force) {
2711
 
2712
  jQuery('#delete_post_dialog .dialog-content').html(
2713
  aamLocal.labels[(force ? 'Delete' : 'Trash') + ' Post Message'].replace('%s', aData[3])
2714
- );
2715
  var buttons = {};
2716
 
2717
  if (force === false) {
@@ -2742,17 +2763,17 @@ AAM.prototype.launchDeletePostDialog = function(button, nRow, aData, force) {
2742
 
2743
  /**
2744
  * Delete or Trash the Post
2745
- *
2746
  * @param {type} id
2747
  * @param {type} force
2748
  * @param {type} nRow
2749
- *
2750
  * @returns {void}
2751
  */
2752
  AAM.prototype.deletePost = function(id, force, nRow) {
2753
  var _this = this;
2754
 
2755
- var data = _this.compileAjaxPackage('delete_post');
2756
  data.post = id;
2757
  data.force = (force ? 1 : 0);
2758
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -2852,7 +2873,7 @@ AAM.prototype.buildPostBreadcrumb = function(response) {
2852
  */
2853
  AAM.prototype.loadBreadcrumb = function() {
2854
  var _this = this;
2855
- var data = this.compileAjaxPackage('post_breadcrumb');
2856
  data.id = _this.postTerm;
2857
  //send the request
2858
  jQuery.ajax(aamLocal.ajaxurl, {
@@ -2878,7 +2899,7 @@ AAM.prototype.loadBreadcrumb = function() {
2878
  AAM.prototype.initPostTree = function() {
2879
  var _this = this;
2880
 
2881
- var data = this.compileAjaxPackage('post_tree');
2882
 
2883
  jQuery("#tree").treeview({
2884
  url: aamLocal.ajaxurl,
@@ -2961,49 +2982,6 @@ AAM.prototype.highlight = function(selector, status) {
2961
  }
2962
  };
2963
 
2964
- /**
2965
- * Grab and build Role Select dropdown
2966
- *
2967
- * @param {String} selector
2968
- * @param {String} selected
2969
- *
2970
- * @returns {void}
2971
- *
2972
- * @access public
2973
- */
2974
- AAM.prototype.renderRoleSelectList = function(selector, selected) {
2975
- var _this = this;
2976
- //load Role list
2977
- jQuery(selector).removeClass('dialog-input').addClass('dialog-input-dynamic').empty();
2978
- var data = this.compileAjaxPackage('role_list');
2979
- jQuery.ajax(aamLocal.ajaxurl, {
2980
- type: 'POST',
2981
- dataType: 'json',
2982
- data: data,
2983
- success: function(response) {
2984
- jQuery(selector).append(jQuery('<option/>', {
2985
- 'value': ''
2986
- }).html('Choose...'));
2987
- for (var i in response.aaData) {
2988
- jQuery(selector).append(jQuery('<option/>', {
2989
- 'value': response.aaData[i][0]
2990
- }).html(response.aaData[i][2]));
2991
- }
2992
-
2993
- if (typeof selected !== 'undefined') {
2994
- jQuery(selector).val(selected);
2995
- }
2996
-
2997
- jQuery(selector).removeClass('dialog-input-dynamic').addClass(
2998
- 'dialog-input'
2999
- );
3000
- },
3001
- error: function() {
3002
- _this.highlight(selector, 'failure');
3003
- }
3004
- });
3005
- };
3006
-
3007
  jQuery(document).ready(function() {
3008
  aamInterface = new AAM();
3009
  });
140
  /**
141
  * Get Current Subject
142
  *
 
 
143
  * @returns {void}
144
  *
145
  * @access public
160
  this.initControlPanel();
161
  this.initControlManager();
162
 
163
+ //Retrieve settings for default segment
164
  this.retrieveSettings();
165
  };
166
 
243
  return data;
244
  };
245
 
246
+ /**
247
+ * Disable roleback button
248
+ *
249
+ * @returns void
250
+ *
251
+ * @access public
252
+ */
253
+ AAM.prototype.disableRoleback = function(){
254
+ jQuery('#aam_roleback').addClass('cpanel-item-disabled');
255
+ };
256
+
257
+ /**
258
+ * Enable roleback button
259
+ *
260
+ * @returns void
261
+ *
262
+ * @access public
263
+ */
264
+ AAM.prototype.enableRoleback = function(){
265
+ jQuery('#aam_roleback').removeClass('cpanel-item-disabled');
266
+ };
267
+
268
  /**
269
  * Initialize Control Panel Metabox
270
  *
277
  //Role Back feature
278
  jQuery('#aam_roleback').bind('click', function(event) {
279
  event.preventDefault();
280
+ if (!jQuery(this).hasClass('cpanel-item-disabled')){
281
+ var buttons = {};
282
+ buttons[aamLocal.labels['Rollback Settings']] = function() {
283
+ _this.showMetaboxLoader('#control_panel');
284
+ jQuery.ajax(aamLocal.ajaxurl, {
285
+ type: 'POST',
286
+ dataType: 'json',
287
+ data: _this.compileAjaxPackage('roleback', true),
288
+ success: function(response) {
289
+ if (response.status === 'success') {
290
+ _this.retrieveSettings();
291
+ _this.disableRoleback();
 
 
292
  }
293
+ _this.highlight('#control_panel .inside', response.status);
294
+ },
295
+ error: function() {
296
+ _this.highlight('#control_panel .inside', 'failure');
297
+ },
298
+ complete: function() {
299
+ _this.hideMetaboxLoader('#control_panel');
300
+ jQuery("#restore_dialog").dialog("close");
301
  }
302
+ });
303
+ };
304
+ buttons[aamLocal.labels['Cancel']] = function() {
305
+ jQuery("#restore_dialog").dialog("close");
306
+ };
 
 
 
 
 
 
 
 
 
307
 
308
+ jQuery("#restore_dialog").dialog({
309
+ resizable: false,
310
+ height: 180,
311
+ modal: true,
312
+ buttons: buttons
313
+ });
314
+ }
315
  });
316
 
317
  //Save the AAM settings
323
  var data = _this.compileAjaxPackage('save', true);
324
  //collect data from the form
325
  //1. Collect Main Menu
326
+ if (jQuery('#admin_menu_content').length){
327
+ jQuery('input', '#admin_menu_content').each(function() {
328
+ data[jQuery(this).attr('name')] = (jQuery(this).prop('checked') ? 1 : 0);
329
+ });
330
+ }
331
  //2. Collect Metaboxes & Widgets
332
+ if (jQuery('#metabox_content').length){
333
+ jQuery('input', '#metabox_list').each(function() {
334
+ data[jQuery(this).attr('name')] = (jQuery(this).prop('checked') ? 1 : 0);
335
+ });
336
+ }
337
+ //3. Collect Capabilities
338
+ if (jQuery('#capability_content').length){
339
  var caps = _this.blogTables.capabilities.fnGetData();
340
  for (var i in caps) {
341
  data['aam[capability][' + caps[i][0] + ']'] = caps[i][1];
342
  }
343
+ }
344
+ //4. Collect Events
345
+ if (jQuery('#event_manager_content').length){
346
  var events = _this.blogTables.eventList.fnGetData();
347
  for (var j in events) {
348
  data['aam[event][' + j + '][event]'] = events[j][0];
352
  data['aam[event][' + j + '][action_specifier]'] = events[j][4];
353
  }
354
  }
355
+
356
+ _this.doAction('aam_before_save', data);
357
 
358
  //send the Ajax request to save the data
359
  jQuery.ajax(aamLocal.ajaxurl, {
362
  data: data,
363
  success: function(response) {
364
  if (response.status === 'success') {
 
365
  _this.retrieveSettings();
366
  }
367
  _this.highlight('#control_panel .inside', response.status);
493
  });
494
  aoData.push({
495
  name: 'sub_action',
496
+ value: 'roleList'
497
  });
498
  aoData.push({
499
  name: '_ajax_nonce',
515
  jQuery.ajax(aamLocal.ajaxurl, {
516
  type: 'POST',
517
  dataType: 'json',
518
+ data: _this.compileAjaxPackage('plainRoleList'),
519
  success: function(response) {
520
  //reset selector
521
  jQuery('#parent_cap_role').empty();
540
  _this.initTooltip(jQuery('#role_list_wrapper .role-top-actions'));
541
  },
542
  fnDrawCallback: function() {
543
+ jQuery('#role_list_wrapper .clear-table-filter').bind(
544
+ 'click', function(event) {
545
+ event.preventDefault();
546
+ jQuery('#role_list_filter input').val('');
547
+ _this.segmentTables.roleList.fnFilter('');
548
+ }
549
+ );
550
  },
551
  oLanguage: {
552
  sSearch: "",
597
  _this.launch(jQuery(this), 'role-action-edit');
598
  _this.launchEditRoleDialog(this, aData);
599
  }));
600
+
601
  /**
602
  jQuery('.role-actions', nRow).append(jQuery('<a/>', {
603
  'href': '#',
717
  var buttons = {};
718
  buttons[aamLocal.labels['Add New Role']] = function() {
719
  //prepare ajax package
720
+ var data = _this.compileAjaxPackage('addRole');
721
  data.name = jQuery('#role_name').val();
722
+ data.inherit = jQuery('#parent_cap_role').val();
723
 
724
  //send the request
725
  jQuery.ajax(aamLocal.ajaxurl, {
756
  * Launch Duplicate Role Dialog
757
  *
758
  * @param {Object} button
759
+ * @param {Array} aData
760
  *
761
  * @returns {void}
762
  *
823
  //launch the dialog
824
  var buttons = {};
825
  buttons[aamLocal.labels['Save Changes']] = function() {
826
+ var data = _this.compileAjaxPackage('editRole');
827
  data.subject = 'role';
828
  data.subject_id = aData[0];
829
  data.name = jQuery('#role_name').val();
890
  var buttons = {};
891
  buttons[aamLocal.labels['Delete Role']] = function() {
892
  //prepare ajax package
893
+ var data = _this.compileAjaxPackage('deleteRole');
894
  data.subject = 'role';
895
  data.subject_id = aData[0];
896
  data.delete_users = parseInt(aData[1]);
969
  });
970
  aoData.push({
971
  name: 'sub_action',
972
+ value: 'userList'
973
  });
974
  aoData.push({
975
  name: '_ajax_nonce',
983
  aoColumnDefs: [
984
  {
985
  bVisible: false,
986
+ aTargets: [0, 1, 4, 5]
987
  }
988
  ],
989
  fnInitComplete: function() {
1019
  _this.initTooltip(jQuery('#user_list_wrapper .user-top-actions'));
1020
  },
1021
  fnDrawCallback: function() {
1022
+ jQuery('#user_list_wrapper .clear-table-filter').bind(
1023
+ 'click', function(event) {
1024
+ event.preventDefault();
1025
+ jQuery('#user_list_filter input').val('');
1026
+ _this.userRoleFilter = '';
1027
+ _this.segmentTables.userList.fnFilter('');
1028
+ }
1029
+ );
1030
  },
1031
  oLanguage: {
1032
  sSearch: "",
1044
  'class': 'user-actions'
1045
  }));
1046
 
1047
+ if (parseInt(aData[5]) === 1){
1048
+ jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1049
+ 'href': '#',
1050
+ 'class': 'user-action user-action-manage',
1051
+ 'aam-tooltip': aamLocal.labels['Manager']
1052
+ }).bind('click', function(event) {
1053
+ event.preventDefault();
1054
+ _this.setSubject('user', aData[0]);
1055
+ _this.retrieveSettings();
1056
+ _this.setCurrent('user', nRow, aData[2]);
1057
+ }));
1058
+
1059
+ jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1060
+ 'href': aamLocal.editUserURI + '?user_id=' + aData[0],
1061
+ 'target': '_blank',
1062
+ 'class': 'user-action user-action-edit',
1063
+ 'aam-tooltip': aamLocal.labels['Edit']
1064
+ }));
1065
+
1066
+ var status = 'user-action-block' + (aData[4] === '1' ? '-active' : '');
1067
+ jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1068
+ 'href': '#',
1069
+ 'class': 'user-action ' + status,
1070
+ 'aam-tooltip': aamLocal.labels['Block']
1071
+ }).bind('click', function(event) {
1072
+ event.preventDefault();
1073
+ _this.blockUser(this, aData);
1074
+ }));
1075
+ jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1076
+ 'href': '#',
1077
+ 'class': 'user-action user-action-delete',
1078
+ 'aam-tooltip': aamLocal.labels['Delete']
1079
+ }).bind('click', function(event) {
1080
+ event.preventDefault();
1081
+ _this.launch(jQuery(this), 'user-action-delete');
1082
+ _this.deleteUser(this, aData);
1083
+ }));
1084
+ } else {
1085
+ jQuery('.user-actions', nRow).append(jQuery('<a/>', {
1086
+ 'href': '#',
1087
+ 'class': 'user-action user-action-locked',
1088
+ 'aam-tooltip': aamLocal.labels['Actions Locked']
1089
+ }).bind('click', function(event) {
1090
+ event.preventDefault();
1091
+ }));
1092
+ }
1093
 
1094
  //set active
1095
  if (_this.getSubject().type === 'user'
1118
  */
1119
  AAM.prototype.blockUser = function(button, aData) {
1120
  var _this = this;
1121
+ var data = this.compileAjaxPackage('blockUser');
1122
  data.subject = 'user';
1123
  data.subject_id = aData[0];
1124
  //send the request
1158
  );
1159
  var buttons = {};
1160
  buttons[aamLocal.labels['Delete']] = function() {
1161
+ var data = _this.compileAjaxPackage('deleteUser');
1162
  data.subject = 'user';
1163
  data.subject_id = aData[0];
1164
  //send request
1233
  });
1234
  aoData.push({
1235
  name: 'sub_action',
1236
+ value: 'roleList'
1237
  });
1238
  aoData.push({
1239
  name: '_ajax_nonce',
1241
  });
1242
  },
1243
  fnDrawCallback: function() {
1244
+ jQuery('#filter_role_list_wrapper .clear-table-filter').bind(
1245
+ 'click', function(event) {
1246
+ event.preventDefault();
1247
+ jQuery('#filter_role_list_filter input').val('');
1248
+ _this.blogTables.filterRoleList.fnFilter('');
1249
+ }
1250
+ );
1251
  _this.initTooltip('#filter_role_list_wrapper');
1252
  },
1253
  oLanguage: {
1349
  },
1350
  success: function(response) {
1351
  jQuery('.aam-main-content').html(response);
 
1352
  _this.checkRoleback();
1353
+ _this.initSettings();
1354
  },
1355
  complete: function() {
1356
  jQuery('.aam-main-loader').hide();
1369
  jQuery.ajax(aamLocal.ajaxurl, {
1370
  type: 'POST',
1371
  dataType: 'json',
1372
+ data: _this.compileAjaxPackage('hasRoleback', true),
1373
  success: function(response) {
1374
+ if (parseInt(response.status) === 0) {
1375
+ _this.disableRoleback();
1376
  } else {
1377
+ _this.enableRoleback();
1378
  }
1379
  },
1380
  complete: function() {
1407
 
1408
  jQuery('.feature-list .feature-item').removeClass(
1409
  'feature-item-active'
1410
+ );
1411
  jQuery(this).addClass('feature-item-active');
1412
  jQuery('.feature-content .feature-content-container').hide();
1413
  jQuery('#' + jQuery(this).attr('feature') + '_content').show();
 
 
 
 
 
1414
  });
1415
  });
1416
 
1417
+ //init default tabs
1418
+ if (jQuery('#admin_menu_content').length){
1419
+ this.initMenuTab();
1420
+ }
1421
+ if (jQuery('#metabox_content').length){
1422
+ this.initMetaboxTab();
1423
+ }
1424
+ if (jQuery('#capability_content').length){
1425
+ this.initCapabilityTab();
1426
+ }
1427
+ if (jQuery('#post_access_content').length){
1428
+ this.initPostTab();
1429
+ }
1430
+ if (jQuery('#event_manager_content').length){
1431
+ this.initEventTab();
1432
+ }
1433
 
1434
  this.doAction('aam_init_features');
1435
 
1481
  });
1482
  aoData.push({
1483
  name: 'sub_action',
1484
+ value: 'loadCapabilities'
1485
  });
1486
  aoData.push({
1487
  name: '_ajax_nonce',
1543
  'aam-tooltip': aamLocal.labels['Restore Default Capabilities']
1544
  }).bind('click', function(event) {
1545
  event.preventDefault();
1546
+ var data = _this.compileAjaxPackage('restoreCapabilities', true);
1547
  //show indicator that is running
1548
  jQuery(this).addClass('capability-top-action-restore-running');
1549
  jQuery.ajax(aamLocal.ajaxurl, {
1608
  _this.initTooltip(nRow);
1609
  },
1610
  fnDrawCallback: function() {
1611
+ jQuery('#capability_list_wrapper .clear-table-filter').bind(
1612
+ 'click', function(event) {
1613
+ event.preventDefault();
1614
+ jQuery('#capability_list_wrapper input').val('');
1615
+ _this.blogTables.capabilities.fnFilter('');
1616
+ _this.blogTables.capabilities.fnFilter('', 2);
1617
+ }
1618
+ );
1619
  },
1620
  fnInfoCallback: function(oSettings, iStart, iEnd, iMax, iTotal, sPre) {
1621
  return (iMax !== iTotal ? _this.clearFilterIndicator() : '');
1638
  *
1639
  * @param {Object} button
1640
  * @param {Object} aData
1641
+ * @param {Object} nRow
1642
  *
1643
  * @returns {void}
1644
  *
1648
  var _this = this;
1649
  jQuery('#delete_capability .dialog-content').html(
1650
  aamLocal.labels['Delete Capability Message'].replace('%s', aData[3])
1651
+ );
1652
+
1653
  var buttons = {};
1654
  buttons[aamLocal.labels['Delete Capability']] = function() {
1655
+ var data = _this.compileAjaxPackage('deleteCapability');
1656
  data.capability = aData[0];
1657
  jQuery.ajax(aamLocal.ajaxurl, {
1658
  type: 'POST',
1709
  event.preventDefault();
1710
  _this.blogTables.capabilities.fnFilter(
1711
  aData[0].replace('&amp;', '&'), 2
1712
+ );
1713
  jQuery('#filter_capability_dialog').dialog('close');
1714
  });
1715
  }
1766
  });
1767
  aoData.push({
1768
  name: 'sub_action',
1769
+ value: 'roleList'
1770
  });
1771
  aoData.push({
1772
  name: '_ajax_nonce',
1774
  });
1775
  },
1776
  fnDrawCallback: function() {
1777
+ jQuery('#copy_role_list_wrapper .clear-table-filter').bind(
1778
+ 'click', function(event) {
1779
+ event.preventDefault();
1780
+ jQuery('#copy_role_list_filter input').val('');
1781
+ _this.blogTables.inheritRole.fnFilter('');
1782
+ }
1783
+ );
1784
  },
1785
  oLanguage: {
1786
  sSearch: "",
1810
  }).bind('click', function(event) {
1811
  event.preventDefault();
1812
  _this.showMetaboxLoader('#copy_role_dialog');
1813
+ var data = _this.compileAjaxPackage('roleCapabilities');
1814
  data.subject = 'role';
1815
  data.subject_id = aData[0];
1816
  jQuery.ajax(aamLocal.ajaxurl, {
1888
  var capability = jQuery.trim(jQuery('#capability_name').val());
1889
  if (capability) {
1890
  _this.showMetaboxLoader('#capability_form_dialog');
1891
+ var data = _this.compileAjaxPackage('addCapability');
1892
  data.capability = capability;
1893
  data.unfiltered = (jQuery('#capability_unfiltered').attr('checked') ? 1 : 0);
1894
 
1961
  if (jQuery(this).attr('checked')) {
1962
  jQuery('input[type="checkbox"]', '#submenu_' + jQuery(this).attr('id')).attr(
1963
  'checked', 'checked'
1964
+ );
1965
  } else {
1966
  jQuery('input[type="checkbox"]', '#submenu_' + jQuery(this).attr('id')).removeAttr(
1967
  'checked'
1968
+ );
1969
  }
1970
  });
1971
  });
2015
 
2016
  if (link) {
2017
  //init metaboxes
2018
+ var data = _this.compileAjaxPackage('initLink');
2019
  data.link = link;
2020
 
2021
  //send the request
2062
  AAM.prototype.loadMetaboxes = function(refresh) {
2063
  var _this = this;
2064
  //init metaboxes
2065
+ var data = this.compileAjaxPackage('loadMetaboxes', true);
2066
  data.refresh = refresh;
2067
  //show loader and reset the metabox list holder
2068
  jQuery('#metabox_list_container').empty();
2142
  });
2143
  aoData.push({
2144
  name: 'sub_action',
2145
+ value: 'eventList'
2146
  });
2147
  aoData.push({
2148
  name: '_ajax_nonce',
2293
  _this.terminate(
2294
  jQuery(button),
2295
  (aData ? 'event-action-edit' : 'event-top-action-add')
2296
+ );
2297
  }
2298
  });
2299
  };
2401
  });
2402
  aoData.push({
2403
  name: 'sub_action',
2404
+ value: 'postList'
2405
  });
2406
  aoData.push({
2407
  name: '_ajax_nonce',
2493
  'aam-tooltip': aamLocal.labels['Edit']
2494
  }));
2495
 
2496
+ if (aData[1] === 'trash') {
2497
  jQuery('.post-actions', nRow).append(jQuery('<a/>', {
2498
  'href': '#',
2499
  'class': 'post-action post-action-delete',
2533
  fnDrawCallback: function() {
2534
  jQuery('.post-breadcrumb').addClass('post-breadcrumb-loading');
2535
  _this.loadBreadcrumb();
2536
+ jQuery('#event_list_wrapper .clear-table-filter').bind(
2537
+ 'click', function(event) {
2538
+ event.preventDefault();
2539
+ jQuery('#event_list_filter input').val('');
2540
+ _this.blogTables.postList.fnFilter('');
2541
+ }
2542
+ );
2543
  },
2544
  fnInfoCallback: function(oSettings, iStart, iEnd, iMax, iTotal, sPre) {
2545
  return (iMax !== iTotal ? _this.clearFilterIndicator() : '');
2578
  * Launch Manage Access Control for selected post
2579
  *
2580
  * @param {Object} button
2581
+ * @param {Object} nRow
2582
+ * @param {Array} aData
2583
  * @param {String} type
2584
  *
2585
  * @returns {void}
2588
  */
2589
  AAM.prototype.launchManageAccessDialog = function(button, nRow, aData, type) {
2590
  var _this = this;
 
 
 
 
 
 
 
 
 
 
 
 
2591
 
2592
  //reset the Frontend/Backend radio
2593
  if (jQuery('.post-access-area', '#access_dialog').length) {
2594
  //in case it is Visitor, this section is not rendered
 
2595
  jQuery('.post-access-area #post_area_frontend').attr('checked', true);
2596
  jQuery('.post-access-area').buttonset('refresh');
2597
  }
2598
 
 
 
 
2599
  //retrieve settings and display the dialog
2600
+ var data = this.compileAjaxPackage('getAccess', true);
2601
  data.id = aData[0];
2602
  data.type = type;
2603
 
2606
  dataType: 'json',
2607
  data: data,
2608
  success: function(response) {
2609
+ jQuery('#access_control_area').html(response.html);
2610
+ jQuery('#access_dialog .dataTable').hide();
2611
+
2612
  if (type === 'term') {
2613
+ jQuery('#term_access_frontend').show();
2614
+ if (parseInt(response.counter) !== -1) {
2615
  jQuery('.post-access-block', '#access_dialog').show();
2616
+ } else {
2617
+ jQuery('.post-access-block', '#access_dialog').hide();
2618
  }
2619
  } else {
2620
  jQuery('.post-access-block', '#access_dialog').hide();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2621
  }
2622
 
2623
+ jQuery('#post_access_frontend').show();
2624
+
2625
+
2626
  var buttons = {};
2627
  buttons[aamLocal.labels['Restore Default']] = function() {
2628
  _this.restorePostAccess(aData[0], type, nRow);
2632
  if (response.counter <= 10) {
2633
  buttons[aamLocal.labels['Apply']] = function() {
2634
  _this.showMetaboxLoader('#access_dialog');
2635
+ var data = _this.compileAjaxPackage('saveAccess', true);
2636
  data.id = aData[0];
2637
  data.type = type;
2638
 
2639
  jQuery('input', '#access_control_area').each(function() {
2640
+ data[jQuery(this).attr('name')] = (jQuery(this).prop('checked') ? 1 : 0);
 
 
 
 
 
2641
  });
2642
 
2643
  jQuery.ajax(aamLocal.ajaxurl, {
2675
  close: function() {
2676
  _this.terminate(
2677
  jQuery(button), 'post-breadcrumb-line-action-manage'
2678
+ );
2679
  }
2680
  });
2681
  },
2687
 
2688
  /**
2689
  * Restore Default Post/Term Access
2690
+ *
2691
  * @param {type} id
2692
  * @param {type} type
2693
  * @param {type} nRow
2694
+ *
2695
  * @returns {void}
2696
  */
2697
  AAM.prototype.restorePostAccess = function(id, type, nRow) {
2698
  var _this = this;
2699
 
2700
  //retrieve settings and display the dialog
2701
+ var data = this.compileAjaxPackage('clearAccess', true);
2702
  data.id = id;
2703
  data.type = type;
2704
 
2718
  /**
2719
  * Launch the Delete Post Dialog
2720
  *
2721
+ * @param {Object} button
2722
+ * @param {Object} nRow
2723
+ * @param {Object} aData
2724
  * @param {Boolean} force
2725
  *
2726
  * @returns {void}
2732
 
2733
  jQuery('#delete_post_dialog .dialog-content').html(
2734
  aamLocal.labels[(force ? 'Delete' : 'Trash') + ' Post Message'].replace('%s', aData[3])
2735
+ );
2736
  var buttons = {};
2737
 
2738
  if (force === false) {
2763
 
2764
  /**
2765
  * Delete or Trash the Post
2766
+ *
2767
  * @param {type} id
2768
  * @param {type} force
2769
  * @param {type} nRow
2770
+ *
2771
  * @returns {void}
2772
  */
2773
  AAM.prototype.deletePost = function(id, force, nRow) {
2774
  var _this = this;
2775
 
2776
+ var data = _this.compileAjaxPackage('deletePost');
2777
  data.post = id;
2778
  data.force = (force ? 1 : 0);
2779
  jQuery.ajax(aamLocal.ajaxurl, {
2873
  */
2874
  AAM.prototype.loadBreadcrumb = function() {
2875
  var _this = this;
2876
+ var data = this.compileAjaxPackage('postBreadcrumb');
2877
  data.id = _this.postTerm;
2878
  //send the request
2879
  jQuery.ajax(aamLocal.ajaxurl, {
2899
  AAM.prototype.initPostTree = function() {
2900
  var _this = this;
2901
 
2902
+ var data = this.compileAjaxPackage('postTree');
2903
 
2904
  jQuery("#tree").treeview({
2905
  url: aamLocal.ajaxurl,
2982
  }
2983
  };
2984
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2985
  jQuery(document).ready(function() {
2986
  aamInterface = new AAM();
2987
  });
media/js/configpress.js CHANGED
@@ -40,7 +40,7 @@ jQuery(document).ready(function() {
40
  dataType: 'json',
41
  data: {
42
  action: 'aam',
43
- sub_action: 'save_configpress',
44
  config: editor.getValue(),
45
  _ajax_nonce: aamLocal.nonce
46
  },
40
  dataType: 'json',
41
  data: {
42
  action: 'aam',
43
+ sub_action: 'saveConfigpress',
44
  config: editor.getValue(),
45
  _ajax_nonce: aamLocal.nonce
46
  },
media/js/extension.js CHANGED
@@ -28,6 +28,7 @@ jQuery(document).ready(function() {
28
  var extension = jQuery(this).attr('extension');
29
 
30
  jQuery(this).bind('click', function() {
 
31
  //show the dialog
32
  jQuery('#install_extension').dialog({
33
  resizable: false,
@@ -61,7 +62,7 @@ jQuery(document).ready(function() {
61
  dataType: 'json',
62
  data: {
63
  action: 'aam',
64
- sub_action: 'install_extension',
65
  extension: extension,
66
  license: license,
67
  _ajax_nonce: aamLocal.nonce
@@ -70,10 +71,20 @@ jQuery(document).ready(function() {
70
  if (response.status === 'success') {
71
  location.reload();
72
  } else {
 
 
 
 
73
  jQuery('#license_key').effect('highlight', 2000);
74
  }
75
  },
76
  error: function() {
 
 
 
 
 
 
77
  jQuery('#license_key').effect('highlight', 2000);
78
  },
79
  complete: function(){
@@ -103,6 +114,8 @@ jQuery(document).ready(function() {
103
  var dialog = this;
104
 
105
  jQuery('#installed_license_key').html(license);
 
 
106
  //show the dialog
107
  jQuery('#update_extension').dialog({
108
  resizable: false,
@@ -119,7 +132,7 @@ jQuery(document).ready(function() {
119
  dataType: 'json',
120
  data: {
121
  action: 'aam',
122
- sub_action: 'remove_extension',
123
  extension: extension,
124
  license: license,
125
  _ajax_nonce: aamLocal.nonce
@@ -128,6 +141,10 @@ jQuery(document).ready(function() {
128
  if (response.status === 'success') {
129
  location.reload();
130
  } else {
 
 
 
 
131
  jQuery(dialog).dialog('close');
132
  }
133
  },
@@ -182,4 +199,19 @@ function initTooltip(selector) {
182
  left: e.pageX + 15 //Get X coordinates
183
  });
184
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
28
  var extension = jQuery(this).attr('extension');
29
 
30
  jQuery(this).bind('click', function() {
31
+ jQuery('.extension-error-list').hide();
32
  //show the dialog
33
  jQuery('#install_extension').dialog({
34
  resizable: false,
62
  dataType: 'json',
63
  data: {
64
  action: 'aam',
65
+ sub_action: 'installExtension',
66
  extension: extension,
67
  license: license,
68
  _ajax_nonce: aamLocal.nonce
71
  if (response.status === 'success') {
72
  location.reload();
73
  } else {
74
+ showErrorMessage(
75
+ response.reasons,
76
+ '#install_extension .extension-error-list'
77
+ );
78
  jQuery('#license_key').effect('highlight', 2000);
79
  }
80
  },
81
  error: function() {
82
+ var reasons = new Array();
83
+ reasons.push('Unexpected Application Error');
84
+ showErrorMessage(
85
+ reasons,
86
+ '#install_extension .extension-error-list'
87
+ );
88
  jQuery('#license_key').effect('highlight', 2000);
89
  },
90
  complete: function(){
114
  var dialog = this;
115
 
116
  jQuery('#installed_license_key').html(license);
117
+ jQuery('.extension-error-list').hide();
118
+
119
  //show the dialog
120
  jQuery('#update_extension').dialog({
121
  resizable: false,
132
  dataType: 'json',
133
  data: {
134
  action: 'aam',
135
+ sub_action: 'removeExtension',
136
  extension: extension,
137
  license: license,
138
  _ajax_nonce: aamLocal.nonce
141
  if (response.status === 'success') {
142
  location.reload();
143
  } else {
144
+ showErrorMessage(
145
+ response.reasons,
146
+ '#update_extension .extension-error-list'
147
+ );
148
  jQuery(dialog).dialog('close');
149
  }
150
  },
199
  left: e.pageX + 15 //Get X coordinates
200
  });
201
  });
202
+ }
203
+
204
+ /**
205
+ * Display error list
206
+ *
207
+ * @param {Array} reasons
208
+ *
209
+ * @returns void
210
+ */
211
+ function showErrorMessage(reasons, container){
212
+ jQuery(container).empty();
213
+ for(var i in reasons){
214
+ jQuery(container).append(jQuery('<li/>').html(reasons[i]));
215
+ }
216
+ jQuery(container).show();
217
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: vasyl_m
3
  Tags: access manager, access, access control, comments, capability, widget, filter menu, role manager, user access, user control, user
4
  Requires at least: 3.4.2
5
  Tested up to: 3.8.1
6
- Stable tag: 2.4
7
 
8
  Graphic interface to manage Access control to your Front-end and Back-end
9
 
@@ -96,10 +96,32 @@ the list of additional metaboxes can be picked by AAM.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  = 2.4 =
100
  * Added Norwegian language Norwegian (by Christer Berg Johannesen)
101
  * Localize the default Roles
102
- * Regenerated .pod file
103
  * Added AAM Media Manager Extension
104
  * Added AAM Content Manager Extension
105
  * Standardized Extension Modules
@@ -108,7 +130,7 @@ the list of additional metaboxes can be picked by AAM.
108
  = 2.3 =
109
  * Added Persian translation by Ghaem Omidi
110
  * Added Inherit Capabilities From Role drop-down on Add New Role Dialog
111
- * Small Cosmetic CSS changes
112
 
113
  = 2.2.3 =
114
  * Improved Admin Menu access control
3
  Tags: access manager, access, access control, comments, capability, widget, filter menu, role manager, user access, user control, user
4
  Requires at least: 3.4.2
5
  Tested up to: 3.8.1
6
+ Stable tag: 2.5
7
 
8
  Graphic interface to manage Access control to your Front-end and Back-end
9
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.5 =
100
+ * Fixed issue with AAM Plus Package and Multisite
101
+ * Introduced Development License
102
+ * Minor internal adjustment for AAM Development Community
103
+
104
+ = 2.5 Beta =
105
+ * Refactored Post & Pages Access List
106
+ * Extended ConfigPress with Post & Pages Access List Options
107
+ * Refactored internal UI hander
108
+ * Fixed issue with Restore Default flag and AAM Plus Package
109
+ * Added LIST Restriction for AAM Plus Package
110
+ * Added ADD Restriction for AAM Plus Package
111
+ * Filter list of editable roles based on current user level
112
+ * Gives ability for non-admin users manage AAM if admin granted access
113
+ * Removed Backup object. Replaces with Restore Default
114
+ * Merged ajax handler with UI manager
115
+ * Implemented Clear All Settings feature (one step closer to Import/Export)
116
+ * Added Error notification for Extension page
117
+ * Fixed bug with Multisite and AAM Plus Package ajax call
118
+ * Regenerated language file
119
+ * Fixed bug with non-existing term
120
+
121
  = 2.4 =
122
  * Added Norwegian language Norwegian (by Christer Berg Johannesen)
123
  * Localize the default Roles
124
+ * Regenerated .pod file
125
  * Added AAM Media Manager Extension
126
  * Added AAM Content Manager Extension
127
  * Standardized Extension Modules
130
  = 2.3 =
131
  * Added Persian translation by Ghaem Omidi
132
  * Added Inherit Capabilities From Role drop-down on Add New Role Dialog
133
+ * Small Cosmetic CSS changes
134
 
135
  = 2.2.3 =
136
  * Improved Admin Menu access control