Activity Log - Version 2.1.0

Version Description

  • New! Personally-tailored notifications that can be triggered by various types of events, users and action type (currently only email notifications are supported)
  • Bug fixes, stability improvements
  • Fixed an error that occurred on PHP 5.5
Download this release

Release Info

Developer KingYes
Plugin Icon 128x128 Activity Log
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.7 to 2.1.0

aryo-activity-log.php CHANGED
@@ -1,106 +1,136 @@
1
- <?php
2
- /*
3
- Plugin Name: ARYO Activity Log
4
- Plugin URI: http://wordpress.org/plugins/aryo-activity-log/
5
- Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - its all these for you to see.
6
- Author: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
- Author URI: http://www.aryodigital.com
8
- Version: 2.0.7
9
- Text Domain: aryo-aal
10
- Domain Path: /languages/
11
- License: GPLv2 or later
12
-
13
-
14
- This program is free software; you can redistribute it and/or
15
- modify it under the terms of the GNU General Public License
16
- as published by the Free Software Foundation; either version 2
17
- of the License, or (at your option) any later version.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
- */
28
-
29
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
-
31
- define( 'ACTIVITY_LOG__FILE__', __FILE__ );
32
- define( 'ACTIVITY_LOG_BASE', plugin_basename( ACTIVITY_LOG__FILE__ ) );
33
-
34
- include( 'classes/class-aal-maintenance.php' );
35
- include( 'classes/class-aal-activity-log-list-table.php' );
36
- include( 'classes/class-aal-admin-ui.php' );
37
- include( 'classes/class-aal-settings.php' );
38
- include( 'classes/class-aal-api.php' );
39
- include( 'classes/class-aal-hooks.php' );
40
-
41
- // Integrations
42
- include( 'classes/class-aal-integration-woocommerce.php' );
43
-
44
- // Probably we should put this in a separate file
45
- class AAL_Main {
46
-
47
- /**
48
- * @var AAL_Main The one true AAL_Main
49
- * @since 2.0.5
50
- */
51
- private static $_instance = null;
52
-
53
- /**
54
- * @var AAL_Admin_Ui
55
- * @since 1.0.0
56
- */
57
- public $ui;
58
-
59
- /**
60
- * @var AAL_Hooks
61
- */
62
- public $hooks;
63
-
64
- /**
65
- * @var AAL_Settings
66
- * @since 1.0.0
67
- */
68
- public $settings;
69
-
70
- /**
71
- * @var AAL_API
72
- * @since 2.0.5
73
- */
74
- public $api;
75
-
76
- public function load_textdomain() {
77
- load_plugin_textdomain( 'aryo-aal', false, basename( dirname( __FILE__ ) ) . '/language' );
78
- }
79
-
80
- public function __construct() {
81
- global $wpdb;
82
-
83
- $this->ui = new AAL_Admin_Ui();
84
- $this->hooks = new AAL_Hooks();
85
- $this->settings = new AAL_Settings();
86
- $this->api = new AAL_API();
87
-
88
- // set up our DB name
89
- $wpdb->activity_log = $wpdb->prefix . 'aryo_activity_log';
90
-
91
- add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ) );
92
- }
93
-
94
- /**
95
- * @return AAL_Main
96
- */
97
- public static function instance() {
98
- if ( is_null( self::$_instance ) )
99
- self::$_instance = new AAL_Main();
100
- return self::$_instance;
101
- }
102
-
103
- }
104
- AAL_Main::instance();
105
-
106
- // EOF
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: ARYO Activity Log
4
+ Plugin URI: http://wordpress.org/plugins/aryo-activity-log/
5
+ Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
+ Author: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
+ Author URI: http://www.aryodigital.com
8
+ Version: 2.1.0
9
+ Text Domain: aryo-aal
10
+ Domain Path: /language/
11
+ License: GPLv2 or later
12
+
13
+
14
+ This program is free software; you can redistribute it and/or
15
+ modify it under the terms of the GNU General Public License
16
+ as published by the Free Software Foundation; either version 2
17
+ of the License, or (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
+ */
28
+
29
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
30
+
31
+ define( 'ACTIVITY_LOG__FILE__', __FILE__ );
32
+ define( 'ACTIVITY_LOG_BASE', plugin_basename( ACTIVITY_LOG__FILE__ ) );
33
+
34
+ include( 'classes/class-aal-maintenance.php' );
35
+ include( 'classes/class-aal-activity-log-list-table.php' );
36
+ include( 'classes/class-aal-admin-ui.php' );
37
+ include( 'classes/class-aal-settings.php' );
38
+ include( 'classes/class-aal-api.php' );
39
+ include( 'classes/class-aal-hooks.php' );
40
+ include( 'classes/class-aal-notifications.php' );
41
+ include( 'classes/class-aal-help.php' );
42
+
43
+ // Integrations
44
+ include( 'classes/class-aal-integration-woocommerce.php' );
45
+
46
+ // Probably we should put this in a separate file
47
+ final class AAL_Main {
48
+
49
+ /**
50
+ * @var AAL_Main The one true AAL_Main
51
+ * @since 2.0.5
52
+ */
53
+ private static $_instance = null;
54
+
55
+ /**
56
+ * @var AAL_Admin_Ui
57
+ * @since 1.0.0
58
+ */
59
+ public $ui;
60
+
61
+ /**
62
+ * @var AAL_Hooks
63
+ * @since 1.0.1
64
+ */
65
+ public $hooks;
66
+
67
+ /**
68
+ * @var AAL_Settings
69
+ * @since 1.0.0
70
+ */
71
+ public $settings;
72
+
73
+ /**
74
+ * @var AAL_API
75
+ * @since 2.0.5
76
+ */
77
+ public $api;
78
+
79
+ public function load_textdomain() {
80
+ load_plugin_textdomain( 'aryo-aal', false, basename( dirname( __FILE__ ) ) . '/language' );
81
+ }
82
+
83
+ protected function __construct() {
84
+ global $wpdb;
85
+
86
+ $this->ui = new AAL_Admin_Ui();
87
+ $this->hooks = new AAL_Hooks();
88
+ $this->settings = new AAL_Settings();
89
+ $this->api = new AAL_API();
90
+ $this->notifications = new AAL_Notifications();
91
+ $this->help = new AAL_Help();
92
+
93
+ // set up our DB name
94
+ $wpdb->activity_log = $wpdb->prefix . 'aryo_activity_log';
95
+
96
+ add_action( 'plugins_loaded', array( &$this, 'load_textdomain' ) );
97
+ }
98
+
99
+ /**
100
+ * Throw error on object clone
101
+ *
102
+ * The whole idea of the singleton design pattern is that there is a single
103
+ * object therefore, we don't want the object to be cloned.
104
+ *
105
+ * @since 2.0.7
106
+ * @return void
107
+ */
108
+ public function __clone() {
109
+ // Cloning instances of the class is forbidden
110
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'aryo-aal' ), '2.0.7' );
111
+ }
112
+
113
+ /**
114
+ * Disable unserializing of the class
115
+ *
116
+ * @since 2.0.7
117
+ * @return void
118
+ */
119
+ public function __wakeup() {
120
+ // Unserializing instances of the class is forbidden
121
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'aryo-aal' ), '2.0.7' );
122
+ }
123
+
124
+ /**
125
+ * @return AAL_Main
126
+ */
127
+ public static function instance() {
128
+ if ( is_null( self::$_instance ) )
129
+ self::$_instance = new AAL_Main();
130
+ return self::$_instance;
131
+ }
132
+
133
+ }
134
+ AAL_Main::instance();
135
+
136
+ // EOF
assets/css/settings.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ body.activity-log_page_activity-log-settings #wpbody h2.aal-page-title::before,
2
+ body.toplevel_page_activity_log_page #wpbody h2.aal-page-title::before {
3
+ content: "\f321";
4
+ font: 400 25px/1 dashicons !important;
5
+ speak: none; /* accessibility thing. do not read the contents of this icon */
6
+ color: #030303;
7
+ display: inline-block;
8
+ padding-right: .2em;
9
+ vertical-align: -18%;
10
+ }
assets/js/settings.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function ( $, undefined ) {
2
+ var AAL = {
3
+ $wrapper: {},
4
+ $container: {},
5
+ conter: 0,
6
+
7
+ init: function () {
8
+ var _this = this;
9
+
10
+ AAL.$wrapper = $( ".aal-notifier-settings" );
11
+ AAL.$container = $( "ul", this.$wrapper );
12
+
13
+ AAL.counter = AAL.$container.children().size();
14
+
15
+ // check if there's only one option
16
+ if ( 1 === AAL.counter ) {
17
+ var $temp_el = AAL.$container.children().first();
18
+ // check if the "value" select box has no options
19
+ if ( 0 === $temp_el.find( ".aal-value option" ).size() ) {
20
+ // click the button with a timeout. Note that this is a hack that will need
21
+ // to be solved server-side
22
+ setTimeout( function () {
23
+ $temp_el.find( ".aal-category" ).change();
24
+ }, 300 );
25
+ }
26
+ }
27
+
28
+ // when the "add" button is clicked
29
+ AAL.$container.on( 'click', '.aal-new-rule', function ( e ) {
30
+ e.preventDefault();
31
+ _this.addRule( $( this ).closest( 'li' ) );
32
+ });
33
+
34
+ AAL.$container.on( 'click', '.aal-delete-rule', function ( e ) {
35
+ e.preventDefault();
36
+
37
+ // do not delete item if it's the only one left in the list
38
+ if ( 1 === AAL.$container.children().size() ) {
39
+ return;
40
+ }
41
+
42
+ _this.deleteRule( $( this ).closest( 'li' ) );
43
+ });
44
+
45
+ // handle change on action category selectbox
46
+ AAL.$container.on( 'change', '.aal-category', function ( e ) {
47
+ e.preventDefault();
48
+
49
+ var $select = $( this ),
50
+ $siblings = $select.siblings( "select" );
51
+
52
+ // disable all selectboxes to prevent multiple calls
53
+ $siblings.filter( "select" ).prop( 'disabled', true );
54
+
55
+ // grab live data via AJAX
56
+ var data = _this.getData( $select.val(), function ( d ) {
57
+ var $target = $siblings.filter( '.aal-value' );
58
+ $target.empty(); // clear so we can insert fresh data
59
+
60
+ $.each( d.data, function ( k, v ) {
61
+ $target.append( $( "<option/>", {
62
+ text: v,
63
+ value: k
64
+ } ) );
65
+ });
66
+
67
+ // restore disabled selectboxes
68
+ $siblings.filter( "select" ).prop( 'disabled', false );
69
+ });
70
+ });
71
+
72
+ },
73
+ addRule: function ( $el ) {
74
+ this.counter++;
75
+ var $copy = $el.clone(),
76
+ curID = parseInt( $el.data( 'id' ) ),
77
+ newID = this.counter;
78
+
79
+ $copy.find( '[name]' ).each( function() {
80
+ $( this ).attr( 'name', $( this ).attr( 'name' ).replace( curID, newID ) );
81
+ // $( this ).attr( 'id', $( this ).attr( 'id' ).replace( curID, newID ) );
82
+ });
83
+
84
+ $copy.attr( 'data-id', newID );
85
+ $el.after( $copy );
86
+ },
87
+ deleteRule: function ( $el ) {
88
+ $el.remove();
89
+ },
90
+ getData: function ( type, cb ) {
91
+ var payload = {
92
+ action: 'aal_get_properties',
93
+ action_category: type
94
+ };
95
+ $.getJSON( window.ajaxurl, payload, cb );
96
+ }
97
+ };
98
+
99
+ $( function () {
100
+ AAL.init();
101
+ });
102
+
103
+ window.AAL = AAL;
104
+
105
+
106
+ /**
107
+ * Form serialization helper
108
+ */
109
+ $.fn.AALSerializeObject = function() {
110
+ var o = {};
111
+ var a = this.serializeArray();
112
+ $.each(a, function() {
113
+ if (o[this.name] !== undefined) {
114
+ if (!o[this.name].push) {
115
+ o[this.name] = [o[this.name]];
116
+ }
117
+ o[this.name].push(this.value || '');
118
+ } else {
119
+ o[this.name] = this.value || '';
120
+ }
121
+ });
122
+ return o;
123
+ };
124
+ })( jQuery );
classes/class-aal-admin-ui.php CHANGED
@@ -24,7 +24,7 @@ class AAL_Admin_Ui {
24
  $this->get_list_table()->prepare_items();
25
  ?>
26
  <div class="wrap">
27
- <h2><?php _e( 'Activity Log', 'aryo-aal' ); ?></h2>
28
 
29
  <form id="activity-filter" method="get">
30
  <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
24
  $this->get_list_table()->prepare_items();
25
  ?>
26
  <div class="wrap">
27
+ <h2 class="aal-page-title"><?php _e( 'Activity Log', 'aryo-aal' ); ?></h2>
28
 
29
  <form id="activity-filter" method="get">
30
  <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
classes/class-aal-api.php CHANGED
@@ -1,132 +1,132 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- class AAL_API {
6
-
7
- /**
8
- * @since 1.0.0
9
- *
10
- * @return void
11
- */
12
- protected function _delete_old_items() {
13
- global $wpdb;
14
-
15
- $logs_lifespan = absint( AAL_Main::instance()->settings->get_option( 'logs_lifespan' ) );
16
- if ( empty( $logs_lifespan ) )
17
- return;
18
-
19
- $wpdb->query( $wpdb->prepare(
20
- 'DELETE FROM `%1$s`
21
- WHERE `hist_time` < %2$d',
22
- $wpdb->activity_log,
23
- strtotime( '-' . $logs_lifespan . ' days', current_time( 'timestamp' ) )
24
- ) );
25
- }
26
-
27
- /**
28
- * @since 2.0.0
29
- * @return void
30
- */
31
- public function erase_all_items() {
32
- global $wpdb;
33
-
34
- $wpdb->query( $wpdb->prepare(
35
- 'TRUNCATE %1$s',
36
- $wpdb->activity_log
37
- ) );
38
- }
39
-
40
- /**
41
- * @since 1.0.0
42
- *
43
- * @param array $args
44
- * @return void
45
- */
46
- public function insert( $args ) {
47
- global $wpdb;
48
-
49
- $args = wp_parse_args( $args, array(
50
- 'action' => '',
51
- 'object_type' => '',
52
- 'object_subtype' => '',
53
- 'object_name' => '',
54
- 'object_id' => '',
55
- 'hist_ip' => $_SERVER['REMOTE_ADDR'],
56
- 'hist_time' => current_time( 'timestamp' ),
57
- ) );
58
-
59
- $user = get_user_by( 'id', get_current_user_id() );
60
- if ( $user ) {
61
- $args['user_caps'] = strtolower( key( $user->caps ) );
62
- if ( empty( $args['user_id'] ) )
63
- $args['user_id'] = $user->ID;
64
- } else {
65
- $args['user_caps'] = 'guest';
66
- if ( empty( $args['user_id'] ) )
67
- $args['user_id'] = 0;
68
- }
69
-
70
- // TODO: Find better way to Multisite compatibility.
71
- if ( empty( $args['user_caps'] ) )
72
- $args['user_caps'] = 'administrator';
73
-
74
- // Make sure for non duplicate.
75
- $check_duplicate = $wpdb->get_row( $wpdb->prepare(
76
- 'SELECT `histid` FROM %1$s
77
- WHERE `user_caps` = \'%2$s\'
78
- AND `action` = \'%3$s\'
79
- AND `object_type` = \'%4$s\'
80
- AND `object_subtype` = \'%5$s\'
81
- AND `object_name` = \'%6$s\'
82
- AND `user_id` = \'%7$s\'
83
- AND `hist_ip` = \'%8$s\'
84
- AND `hist_time` = \'%9$s\'
85
- ;',
86
- $wpdb->activity_log,
87
- $args['user_caps'],
88
- $args['action'],
89
- $args['object_type'],
90
- $args['object_subtype'],
91
- $args['object_name'],
92
- $args['user_id'],
93
- $args['hist_ip'],
94
- $args['hist_time']
95
- ) );
96
-
97
- if ( $check_duplicate )
98
- return;
99
-
100
- $wpdb->insert( $wpdb->activity_log,
101
- array(
102
- 'action' => $args['action'],
103
- 'object_type' => $args['object_type'],
104
- 'object_subtype' => $args['object_subtype'],
105
- 'object_name' => $args['object_name'],
106
- 'object_id' => $args['object_id'],
107
- 'user_id' => $args['user_id'],
108
- 'user_caps' => $args['user_caps'],
109
- 'hist_ip' => $args['hist_ip'],
110
- 'hist_time' => $args['hist_time'],
111
- ),
112
- array( "%s", "%s", "%s", "%s", "%d", "%d", "%s", "%s", "%d" )
113
- );
114
-
115
- // Remove old items.
116
- $this->_delete_old_items();
117
- do_action( 'aal_insert_log', $args );
118
- }
119
-
120
- }
121
-
122
- /**
123
- * @since 1.0.0
124
- *
125
- * @see AAL_API::insert
126
- *
127
- * @param array $args
128
- * @return void
129
- */
130
- function aal_insert_log( $args = array() ) {
131
- AAL_Main::instance()->api->insert( $args );
132
- }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class AAL_API {
6
+
7
+ /**
8
+ * @since 1.0.0
9
+ *
10
+ * @return void
11
+ */
12
+ protected function _delete_old_items() {
13
+ global $wpdb;
14
+
15
+ $logs_lifespan = absint( AAL_Main::instance()->settings->get_option( 'logs_lifespan' ) );
16
+ if ( empty( $logs_lifespan ) )
17
+ return;
18
+
19
+ $wpdb->query( $wpdb->prepare(
20
+ 'DELETE FROM `%1$s`
21
+ WHERE `hist_time` < %2$d',
22
+ $wpdb->activity_log,
23
+ strtotime( '-' . $logs_lifespan . ' days', current_time( 'timestamp' ) )
24
+ ) );
25
+ }
26
+
27
+ /**
28
+ * @since 2.0.0
29
+ * @return void
30
+ */
31
+ public function erase_all_items() {
32
+ global $wpdb;
33
+
34
+ $wpdb->query( $wpdb->prepare(
35
+ 'TRUNCATE %1$s',
36
+ $wpdb->activity_log
37
+ ) );
38
+ }
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ *
43
+ * @param array $args
44
+ * @return void
45
+ */
46
+ public function insert( $args ) {
47
+ global $wpdb;
48
+
49
+ $args = wp_parse_args( $args, array(
50
+ 'action' => '',
51
+ 'object_type' => '',
52
+ 'object_subtype' => '',
53
+ 'object_name' => '',
54
+ 'object_id' => '',
55
+ 'hist_ip' => $_SERVER['REMOTE_ADDR'],
56
+ 'hist_time' => current_time( 'timestamp' ),
57
+ ) );
58
+
59
+ $user = get_user_by( 'id', get_current_user_id() );
60
+ if ( $user ) {
61
+ $args['user_caps'] = strtolower( key( $user->caps ) );
62
+ if ( empty( $args['user_id'] ) )
63
+ $args['user_id'] = $user->ID;
64
+ } else {
65
+ $args['user_caps'] = 'guest';
66
+ if ( empty( $args['user_id'] ) )
67
+ $args['user_id'] = 0;
68
+ }
69
+
70
+ // TODO: Find better way to Multisite compatibility.
71
+ if ( empty( $args['user_caps'] ) )
72
+ $args['user_caps'] = 'administrator';
73
+
74
+ // Make sure for non duplicate.
75
+ $check_duplicate = $wpdb->get_row( $wpdb->prepare(
76
+ 'SELECT `histid` FROM %1$s
77
+ WHERE `user_caps` = \'%2$s\'
78
+ AND `action` = \'%3$s\'
79
+ AND `object_type` = \'%4$s\'
80
+ AND `object_subtype` = \'%5$s\'
81
+ AND `object_name` = \'%6$s\'
82
+ AND `user_id` = \'%7$s\'
83
+ AND `hist_ip` = \'%8$s\'
84
+ AND `hist_time` = \'%9$s\'
85
+ ;',
86
+ $wpdb->activity_log,
87
+ $args['user_caps'],
88
+ $args['action'],
89
+ $args['object_type'],
90
+ $args['object_subtype'],
91
+ $args['object_name'],
92
+ $args['user_id'],
93
+ $args['hist_ip'],
94
+ $args['hist_time']
95
+ ) );
96
+
97
+ if ( $check_duplicate )
98
+ return;
99
+
100
+ $wpdb->insert( $wpdb->activity_log,
101
+ array(
102
+ 'action' => $args['action'],
103
+ 'object_type' => $args['object_type'],
104
+ 'object_subtype' => $args['object_subtype'],
105
+ 'object_name' => $args['object_name'],
106
+ 'object_id' => $args['object_id'],
107
+ 'user_id' => $args['user_id'],
108
+ 'user_caps' => $args['user_caps'],
109
+ 'hist_ip' => $args['hist_ip'],
110
+ 'hist_time' => $args['hist_time'],
111
+ ),
112
+ array( "%s", "%s", "%s", "%s", "%d", "%d", "%s", "%s", "%d" )
113
+ );
114
+
115
+ // Remove old items.
116
+ $this->_delete_old_items();
117
+ do_action( 'aal_insert_log', $args );
118
+ }
119
+
120
+ }
121
+
122
+ /**
123
+ * @since 1.0.0
124
+ *
125
+ * @see AAL_API::insert
126
+ *
127
+ * @param array $args
128
+ * @return void
129
+ */
130
+ function aal_insert_log( $args = array() ) {
131
+ AAL_Main::instance()->api->insert( $args );
132
+ }
classes/class-aal-help.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ /**
6
+ * Contextual help texts
7
+ *
8
+ * Class AAL_Help
9
+ */
10
+ class AAL_Help {
11
+ public function __construct() {
12
+ add_action( 'in_admin_header', array( $this, 'contextual_help' ) );
13
+ }
14
+
15
+ public function contextual_help() {
16
+ $screen = get_current_screen();
17
+
18
+ switch ( $screen->id ) {
19
+ case 'activity-log_page_activity-log-settings':
20
+ $screen->add_help_tab( array(
21
+ 'title' => __( 'Overview', 'aryo-aal' ),
22
+ 'id' => 'aal-overview',
23
+ 'content' => '
24
+ <h3>' . __( 'Notifications', 'aryo-aal' ) . '</h3>
25
+ <p>' . __( 'This screen lets you control what will happen once a user on your site does something you define. For instance, let us assume that you have created a user on your site
26
+ for your content editor. Now, let\'s say that every time that user updates a post, you want to know about it. You can easily do it from this page.', 'aryo-aal' ) . '</p>',
27
+ ) );
28
+ break;
29
+ }
30
+ }
31
+ }
classes/class-aal-maintenance.php CHANGED
@@ -1,109 +1,109 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- class AAL_Maintenance {
6
-
7
- public static function activate( $network_wide ) {
8
- global $wpdb;
9
-
10
- if ( function_exists( 'is_multisite') && is_multisite() && $network_wide ) {
11
- $old_blog_id = $wpdb->blogid;
12
-
13
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
14
- foreach ( $blog_ids as $blog_id ) {
15
- switch_to_blog( $blog_id );
16
- self::_create_tables();
17
- }
18
-
19
- switch_to_blog( $old_blog_id );
20
- } else {
21
- self::_create_tables();
22
- }
23
- }
24
-
25
- public static function uninstall( $network_deactivating ) {
26
- global $wpdb;
27
-
28
- if ( function_exists( 'is_multisite') && is_multisite() && $network_deactivating ) {
29
- $old_blog_id = $wpdb->blogid;
30
-
31
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs};" );
32
- foreach ( $blog_ids as $blog_id ) {
33
- switch_to_blog( $blog_id );
34
- self::_remove_tables();
35
- }
36
-
37
- switch_to_blog( $old_blog_id );
38
- } else {
39
- self::_remove_tables();
40
- }
41
- }
42
-
43
- public static function mu_new_blog_installer( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
44
- global $wpdb;
45
-
46
- if ( is_plugin_active_for_network( ACTIVITY_LOG_BASE ) ) {
47
- $old_blog_id = $wpdb->blogid;
48
- switch_to_blog( $blog_id );
49
- self::_create_tables();
50
- switch_to_blog( $old_blog_id );
51
- }
52
- }
53
-
54
- public static function mu_delete_blog( $blog_id, $drop ) {
55
- global $wpdb;
56
-
57
- $old_blog_id = $wpdb->blogid;
58
- switch_to_blog( $blog_id );
59
- self::_remove_tables();
60
- switch_to_blog( $old_blog_id );
61
- }
62
-
63
- protected static function _create_tables() {
64
- global $wpdb;
65
-
66
- $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}aryo_activity_log` (
67
- `histid` int(11) NOT NULL AUTO_INCREMENT,
68
- `user_caps` varchar(70) NOT NULL DEFAULT 'guest',
69
- `action` varchar(255) NOT NULL,
70
- `object_type` varchar(255) NOT NULL,
71
- `object_subtype` varchar(255) NOT NULL DEFAULT '',
72
- `object_name` varchar(255) NOT NULL,
73
- `object_id` int(11) NOT NULL DEFAULT '0',
74
- `user_id` int(11) NOT NULL DEFAULT '0',
75
- `hist_ip` varchar(55) NOT NULL DEFAULT '127.0.0.1',
76
- `hist_time` int(11) NOT NULL DEFAULT '0',
77
- PRIMARY KEY (`histid`)
78
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
79
-
80
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
81
- dbDelta( $sql );
82
-
83
- $admin_role = get_role( 'administrator' );
84
- if ( ! $admin_role->has_cap( 'view_all_aryo_activity_log' ) )
85
- $admin_role->add_cap( 'view_all_aryo_activity_log' );
86
-
87
- update_option( 'activity_log_db_version', '1.0' );
88
- }
89
-
90
- protected static function _remove_tables() {
91
- global $wpdb;
92
-
93
- $wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}aryo_activity_log`;" );
94
-
95
- $admin_role = get_role( 'administrator' );
96
- if ( $admin_role->has_cap( 'view_all_aryo_activity_log' ) )
97
- $admin_role->remove_cap( 'view_all_aryo_activity_log' );
98
-
99
- delete_option( 'activity_log_db_version' );
100
- }
101
- }
102
-
103
- register_activation_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'activate' ) );
104
- register_uninstall_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'uninstall' ) );
105
-
106
- // MU installer for new blog.
107
- add_action( 'wpmu_new_blog', array( 'AAL_Maintenance', 'mu_new_blog_installer' ), 10, 6 );
108
- // MU Uninstall for delete blog.
109
  add_action( 'delete_blog', array( 'AAL_Maintenance', 'mu_delete_blog' ), 10, 2 );
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ class AAL_Maintenance {
6
+
7
+ public static function activate( $network_wide ) {
8
+ global $wpdb;
9
+
10
+ if ( function_exists( 'is_multisite') && is_multisite() && $network_wide ) {
11
+ $old_blog_id = $wpdb->blogid;
12
+
13
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
14
+ foreach ( $blog_ids as $blog_id ) {
15
+ switch_to_blog( $blog_id );
16
+ self::_create_tables();
17
+ }
18
+
19
+ switch_to_blog( $old_blog_id );
20
+ } else {
21
+ self::_create_tables();
22
+ }
23
+ }
24
+
25
+ public static function uninstall( $network_deactivating ) {
26
+ global $wpdb;
27
+
28
+ if ( function_exists( 'is_multisite') && is_multisite() && $network_deactivating ) {
29
+ $old_blog_id = $wpdb->blogid;
30
+
31
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs};" );
32
+ foreach ( $blog_ids as $blog_id ) {
33
+ switch_to_blog( $blog_id );
34
+ self::_remove_tables();
35
+ }
36
+
37
+ switch_to_blog( $old_blog_id );
38
+ } else {
39
+ self::_remove_tables();
40
+ }
41
+ }
42
+
43
+ public static function mu_new_blog_installer( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
44
+ global $wpdb;
45
+
46
+ if ( is_plugin_active_for_network( ACTIVITY_LOG_BASE ) ) {
47
+ $old_blog_id = $wpdb->blogid;
48
+ switch_to_blog( $blog_id );
49
+ self::_create_tables();
50
+ switch_to_blog( $old_blog_id );
51
+ }
52
+ }
53
+
54
+ public static function mu_delete_blog( $blog_id, $drop ) {
55
+ global $wpdb;
56
+
57
+ $old_blog_id = $wpdb->blogid;
58
+ switch_to_blog( $blog_id );
59
+ self::_remove_tables();
60
+ switch_to_blog( $old_blog_id );
61
+ }
62
+
63
+ protected static function _create_tables() {
64
+ global $wpdb;
65
+
66
+ $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}aryo_activity_log` (
67
+ `histid` int(11) NOT NULL AUTO_INCREMENT,
68
+ `user_caps` varchar(70) NOT NULL DEFAULT 'guest',
69
+ `action` varchar(255) NOT NULL,
70
+ `object_type` varchar(255) NOT NULL,
71
+ `object_subtype` varchar(255) NOT NULL DEFAULT '',
72
+ `object_name` varchar(255) NOT NULL,
73
+ `object_id` int(11) NOT NULL DEFAULT '0',
74
+ `user_id` int(11) NOT NULL DEFAULT '0',
75
+ `hist_ip` varchar(55) NOT NULL DEFAULT '127.0.0.1',
76
+ `hist_time` int(11) NOT NULL DEFAULT '0',
77
+ PRIMARY KEY (`histid`)
78
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
79
+
80
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
81
+ dbDelta( $sql );
82
+
83
+ $admin_role = get_role( 'administrator' );
84
+ if ( ! $admin_role->has_cap( 'view_all_aryo_activity_log' ) )
85
+ $admin_role->add_cap( 'view_all_aryo_activity_log' );
86
+
87
+ update_option( 'activity_log_db_version', '1.0' );
88
+ }
89
+
90
+ protected static function _remove_tables() {
91
+ global $wpdb;
92
+
93
+ $wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}aryo_activity_log`;" );
94
+
95
+ $admin_role = get_role( 'administrator' );
96
+ if ( $admin_role->has_cap( 'view_all_aryo_activity_log' ) )
97
+ $admin_role->remove_cap( 'view_all_aryo_activity_log' );
98
+
99
+ delete_option( 'activity_log_db_version' );
100
+ }
101
+ }
102
+
103
+ register_activation_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'activate' ) );
104
+ register_uninstall_hook( ACTIVITY_LOG_BASE, array( 'AAL_Maintenance', 'uninstall' ) );
105
+
106
+ // MU installer for new blog.
107
+ add_action( 'wpmu_new_blog', array( 'AAL_Maintenance', 'mu_new_blog_installer' ), 10, 6 );
108
+ // MU Uninstall for delete blog.
109
  add_action( 'delete_blog', array( 'AAL_Maintenance', 'mu_delete_blog' ), 10, 2 );
classes/class-aal-notifications.php ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+
5
+ /**
6
+ * Notifications API main class
7
+ *
8
+ * @since 2.0.6
9
+ */
10
+ class AAL_Notifications {
11
+ /* @todo public for debugging now, change to private/protected l8r */
12
+ public $handlers = array();
13
+ public $handlers_loaded = array();
14
+
15
+ public function __construct() {
16
+ // Load abstract class.
17
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/notifications/abstract-class-aal-notification-base.php' );
18
+
19
+ // Run handlers loader
20
+ add_action( 'init', array( &$this, 'load_handlers' ), 20 );
21
+ add_action( 'aal_load_notification_handlers', array( &$this, 'load_default_handlers' ) );
22
+ add_action( 'aal_insert_log', array( &$this, 'process_notifications' ), 20 );
23
+ }
24
+
25
+ public function process_notifications( $args ) {
26
+ $enabled_handlers = $this->get_enabled_handlers();
27
+
28
+ // if we can't find any enabled event handlers, bail.
29
+ if ( empty( $enabled_handlers ) )
30
+ return;
31
+
32
+ // calculate if this type event is set in the rules
33
+ $options = AAL_Main::instance()->settings->get_options();
34
+
35
+ // if there are no rules set, bail.
36
+ if ( empty( $options['notification_rules'] ) || ! is_array( $options['notification_rules'] ) )
37
+ return;
38
+
39
+ $notification_matched_rules = array();
40
+
41
+ // loop through the set of rules, and figure out if this current action meets a set rule
42
+ foreach ( $options['notification_rules'] as $notification_rule ) {
43
+ list( $n_key, $n_condition, $n_value ) = array_values( $notification_rule );
44
+
45
+ switch ( $n_key ) {
46
+ case 'action-type':
47
+ if ( $n_value == $args['object_type'] )
48
+ $notification_matched_rules[] = $notification_rule;
49
+ break;
50
+ }
51
+ }
52
+
53
+ // did we find any matches? if not, let's pretend as if nothing has happened here ;)
54
+ if ( ! empty( $notification_matched_rules ) ) {
55
+ // cycle through enabled handlers and trigger them
56
+ foreach ( $enabled_handlers as $enabled_handler ) {
57
+ $enabled_handler->trigger( $args );
58
+ }
59
+ }
60
+ }
61
+
62
+ public function get_object_types() {
63
+ // TODO: include filter?
64
+ $opts = array(
65
+ 'Attachment',
66
+ 'Menu',
67
+ 'Options',
68
+ 'Plugin',
69
+ 'Post',
70
+ 'Taxonomy',
71
+ 'Theme',
72
+ 'User',
73
+ 'Widget',
74
+ );
75
+ return array_combine( $opts, $opts );
76
+ }
77
+
78
+ public function get_actions() {
79
+ $opts = array(
80
+ 'created',
81
+ 'deleted',
82
+ 'updated',
83
+ 'added',
84
+ 'activated',
85
+ 'deactivated',
86
+ 'accessed',
87
+ 'file_updated',
88
+ 'logged_in',
89
+ 'logged_out',
90
+ 'wrong_password',
91
+ );
92
+ $ready = array();
93
+
94
+ // make key => value pairs (where slug in key)
95
+ foreach ( $opts as $opt ) {
96
+ $ready[ $opt ] = ucwords( str_replace( '_', ' ', __( $opt, 'aryo-aal' ) ) );
97
+ }
98
+
99
+ return $ready;
100
+ }
101
+
102
+ /**
103
+ * Returns values for the dropdown in the settings page (the last dropdown in each conditions row)
104
+ *
105
+ * @param string $row_key type
106
+ * @return array
107
+ */
108
+ public function get_settings_dropdown_values( $row_key ) {
109
+ $results = array();
110
+
111
+ /**
112
+ * @todo allow this switch to be extensible by other plugins (see example)
113
+ */
114
+ switch ( $row_key ) {
115
+ case 'user':
116
+ // cache all data in case we need the same data twice on the same/upcoming pageloads
117
+ if ( false === ( $results = wp_cache_get( $cache_key = 'notifications-users', 'aal' ) ) ) {
118
+ // get all users
119
+ $all_users = get_users();
120
+ $preped_users = array();
121
+
122
+ // prepare users
123
+ foreach ( $all_users as $user ) {
124
+ $user_role = $user->roles;
125
+
126
+ // if user has no role (shouldn't happen, but just in case)
127
+ if ( empty( $user_role ) )
128
+ continue;
129
+
130
+ $user_role_obj = get_role( $user_role[0] );
131
+ $user_role_name = isset( $user_role_obj->name ) ? $user_role_obj->name : $user_role[0];
132
+
133
+ $preped_users[ $user->ID ] = apply_filters( 'aal_notifications_user_format', sprintf( '%s - %s (ID #%d)', $user->display_name, $user_role_name, $user->ID ), $user );
134
+ }
135
+
136
+ wp_cache_set( $cache_key, $results = $preped_users, 'aal' ); // no need for expiration time
137
+ }
138
+ break;
139
+
140
+ case 'action-type':
141
+ $results = $this->get_object_types();
142
+ break;
143
+
144
+ case 'action-value':
145
+ $results = $this->get_actions();
146
+ break;
147
+
148
+ default:
149
+ // @todo allow plugins to extend and handle custom field types
150
+ $results = apply_filters( 'aal_settings_dropdown_values', $results, $row_key );
151
+ break;
152
+ }
153
+
154
+ return $results;
155
+ }
156
+
157
+ /**
158
+ * Returns a list of handlers, in a key-value format.
159
+ * Key holds the classname, value holds the name of the transport.
160
+ */
161
+ public function get_handlers() {
162
+ if ( empty( $this->handlers ) || ! did_action( 'aal_load_notification_handlers' ) )
163
+ return array();
164
+
165
+ $handlers = array();
166
+
167
+ foreach ( $this->handlers as $handler ) {
168
+ $handler_obj = $this->handlers_loaded[ $handler ];
169
+
170
+ // if we got the name of the handler, use it. otherwise, use the classname.
171
+ $handler_name = isset( $handler_obj->name ) ? $handler_obj->name : $handler;
172
+
173
+ $handlers[ $handler_obj->id ] = $handler_name;
174
+ }
175
+
176
+ return $handlers;
177
+ }
178
+
179
+ /**
180
+ * Returns a handler object
181
+ *
182
+ * @param string $id
183
+ * @return AAL_Notification_Base|bool
184
+ */
185
+ public function get_handler_object( $id ) {
186
+ return isset( $this->handlers_loaded[ $id ] ) ? $this->handlers_loaded[ $id ] : false;
187
+ }
188
+
189
+ /**
190
+ * Returns all available handlers
191
+ * @return array
192
+ */
193
+ public function get_available_handlers() {
194
+ $handlers = array();
195
+
196
+ foreach ( $this->handlers_loaded as $handler_classname => $handler_obj ) {
197
+ $handlers[ $handler_obj->id ] = $handler_obj;
198
+ }
199
+
200
+ return apply_filters( 'aal_available_handlers', $handlers );
201
+ }
202
+
203
+ /**
204
+ * Returns the active handlers that were activated through the settings page
205
+ *
206
+ * @return array
207
+ */
208
+ public function get_enabled_handlers() {
209
+ $enabled = array();
210
+ $options = AAL_Main::instance()->settings->get_options();
211
+
212
+ foreach ( $this->get_available_handlers() as $id => $handler_obj ) {
213
+ // make sure handler is active
214
+ if ( isset( $options['notification_handlers'][ $id ] ) && 1 == $options['notification_handlers'][ $id ] ) {
215
+ $enabled[ $id ] = $handler_obj;
216
+ }
217
+ }
218
+
219
+ return $enabled;
220
+ }
221
+
222
+ /**
223
+ * Runs during aal_load_notification_handlers,
224
+ * includes the necessary files to register default notification handlers.
225
+ */
226
+ public function load_default_handlers() {
227
+ $default_handlers = apply_filters( 'aal_default_addons', array(
228
+ 'email' => $this->get_default_handler_path( 'class-aal-notification-email.php' ),
229
+ ) );
230
+
231
+ foreach ( $default_handlers as $filename )
232
+ include_once $filename;
233
+ }
234
+
235
+ /**
236
+ * Returns path to notification handler file
237
+ *
238
+ * @param string $filename
239
+ * @return string
240
+ */
241
+ public function get_default_handler_path( $filename ) {
242
+ return plugin_dir_path( ACTIVITY_LOG__FILE__ ) . "notifications/$filename";
243
+ }
244
+
245
+ /**
246
+ * Fired before $this->init()
247
+ *
248
+ * @todo maybe check $classname's inheritance tree and signal if it's not a AAL_Notification_Base
249
+ */
250
+ public function load_handlers() {
251
+ do_action( 'aal_load_notification_handlers' );
252
+
253
+ foreach ( $this->handlers as $handler_classname ) {
254
+ if ( class_exists( $handler_classname ) ) {
255
+ $obj = new $handler_classname;
256
+
257
+ // is this handler extending AAL_Notification_Base?
258
+ if ( ! is_a( $obj, 'AAL_Notification_Base' ) )
259
+ continue;
260
+
261
+ $this->handlers_loaded[ $handler_classname ] = $obj;
262
+ }
263
+ }
264
+ }
265
+
266
+ /**
267
+ * Registers a handler class, which is then loaded in $this->load_handlers
268
+ *
269
+ * @param string $classname The name of the class to create an instance for
270
+ * @return bool
271
+ */
272
+ public function register_handler( $classname ) {
273
+ if ( ! class_exists( $classname ) ) {
274
+ trigger_error( __( 'The AAL notification handler you are trying to register does not exist.', 'aryo-aal' ) );
275
+ return false;
276
+ }
277
+
278
+ $this->handlers[] = $classname;
279
+ return true;
280
+ }
281
+ }
classes/class-aal-settings.php CHANGED
@@ -3,11 +3,12 @@
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  class AAL_Settings {
6
-
7
  private $hook;
8
- private $slug;
 
9
 
10
  public function __construct() {
 
11
  add_action( 'admin_menu', array( &$this, 'action_admin_menu' ), 30 );
12
  add_action( 'admin_init', array( &$this, 'register_settings' ) );
13
  add_action( 'admin_notices', array( &$this, 'admin_notices' ) );
@@ -15,6 +16,11 @@ class AAL_Settings {
15
  add_filter( 'plugin_action_links_' . ACTIVITY_LOG_BASE, array( &$this, 'plugin_action_links' ) );
16
 
17
  add_action( 'wp_ajax_aal_reset_items', array( &$this, 'ajax_aal_reset_items' ) );
 
 
 
 
 
18
  }
19
 
20
  public function plugin_action_links( $links ) {
@@ -38,13 +44,26 @@ class AAL_Settings {
38
  __( 'Activity Log Settings', 'aryo-aal' ), // <title> tag
39
  __( 'Settings', 'aryo-aal' ), // menu label
40
  'manage_options', // required cap to view this page
41
- $this->slug = 'activity-log-settings', // page slug
42
  array( &$this, 'display_settings_page' ) // callback
43
  );
 
 
 
44
  // this callback will initialize the settings for AAL
45
  // add_action( "load-$this->hook", array( $this, 'register_settings' ) );
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
48
  public function register_settings() {
49
  // If no options exist, create them.
50
  if ( ! get_option( $this->slug ) ) {
@@ -53,48 +72,151 @@ class AAL_Settings {
53
  ) ) );
54
  }
55
 
56
- // First, we register a section. This is necessary since all future options must belong to a
57
- add_settings_section(
58
- 'general_settings_section', // ID used to identify this section and with which to register options
59
- __( 'Display Options', 'aryo-aal' ), // Title to be displayed on the administration page
60
- array( 'AAL_Settings_Fields', 'description' ), // Callback used to render the description of the section
61
- $this->slug // Page on which to add this section of options
62
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- add_settings_field(
65
- 'logs_lifespan',
66
- __( 'Keep logs for', 'aryo-aal' ),
67
- array( 'AAL_Settings_Fields', 'number_field' ),
68
- $this->slug,
69
- 'general_settings_section',
70
- array(
71
- 'id' => 'logs_lifespan',
72
- 'page' => $this->slug,
73
- 'classes' => array( 'small-text' ),
74
- 'type' => 'number',
75
- 'sub_desc' => __( 'days.', 'aryo-aal' ),
76
- 'desc' => __( 'Maximum number of days to keep activity log. Leave blank to keep activity log forever (not recommended).', 'aryo-aal' ),
77
- )
78
  );
79
-
80
- if ( apply_filters( 'aal_allow_option_erase_logs', true ) ) {
81
- add_settings_field(
82
- 'raw_delete_log_activities',
83
- __( 'Delete Log Activities', 'aryo-aal' ),
84
- array( 'AAL_Settings_Fields', 'raw_html' ),
85
- $this->slug,
86
- 'general_settings_section',
87
- array(
88
- 'html' => sprintf( __( '<a href="%s" id="%s">Reset Database</a>', 'aryo-aal' ), add_query_arg( array(
89
- 'action' => 'aal_reset_items',
90
- '_nonce' => wp_create_nonce( 'aal_reset_items' ),
91
- ), admin_url( 'admin-ajax.php' ) ), 'aal-delete-log-activities' ),
92
- 'desc' => __( 'Warning: Clicking this will delete all activities from the database.', 'aryo-aal' ),
93
- )
94
- );
95
  }
 
 
 
 
 
 
 
 
 
 
96
 
97
- register_setting( 'aal-options', $this->slug );
98
  }
99
 
100
  public function display_settings_page() {
@@ -103,13 +225,14 @@ class AAL_Settings {
103
  <div class="wrap">
104
 
105
  <div id="icon-themes" class="icon32"></div>
106
- <h2><?php _e( 'Activity Log Settings', 'aryo-aal' ); ?></h2>
 
 
107
 
108
  <form method="post" action="options.php">
109
  <?php
110
  settings_fields( 'aal-options' );
111
  do_settings_sections( $this->slug );
112
-
113
  submit_button();
114
  ?>
115
  </form>
@@ -143,7 +266,7 @@ class AAL_Settings {
143
 
144
  public function ajax_aal_reset_items() {
145
  if ( ! check_ajax_referer( 'aal_reset_items', '_nonce', false ) || ! current_user_can( 'manage_options' ) ) {
146
- wp_die( 'You do not have sufficient permissions to access this page.', 'aryo-aal' );
147
  }
148
 
149
  AAL_Main::instance()->api->erase_all_items();
@@ -155,21 +278,56 @@ class AAL_Settings {
155
  die();
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  public function get_option( $key = '' ) {
159
- $settings = get_option( 'activity-log-settings' );
160
  return ! empty( $settings[ $key ] ) ? $settings[ $key ] : false;
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  }
164
 
165
  // TODO: Need rewrite this class to useful tool.
166
  final class AAL_Settings_Fields {
167
 
168
- public static function description() {
169
  ?>
170
  <p><?php _e( 'These are some basic settings for Activity Log.', 'aryo-aal' ); ?></p>
171
  <?php
172
  }
 
 
 
 
 
 
173
 
174
  public static function raw_html( $args ) {
175
  if ( empty( $args['html'] ) )
@@ -182,6 +340,9 @@ final class AAL_Settings_Fields {
182
  }
183
 
184
  public static function text_field( $args ) {
 
 
 
185
  $args = wp_parse_args( $args, array(
186
  'classes' => array(),
187
  ) );
@@ -189,11 +350,37 @@ final class AAL_Settings_Fields {
189
  return;
190
 
191
  ?>
192
- <input type="text" id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php printf( '%s[%s]', esc_attr( $args['page'] ), esc_attr( $args['id'] ) ); ?>" value="<?php echo AAL_Main::instance()->settings->get_option( $args['id'] ); ?>" class="<?php echo implode( ' ', $args['classes'] ); ?>" />
193
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
195
 
196
  public static function number_field( $args ) {
 
 
 
197
  $args = wp_parse_args( $args, array(
198
  'classes' => array(),
199
  'min' => '1',
@@ -204,7 +391,7 @@ final class AAL_Settings_Fields {
204
  return;
205
 
206
  ?>
207
- <input type="number" id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php printf( '%s[%s]', esc_attr( $args['page'] ), esc_attr( $args['id'] ) ); ?>" value="<?php echo AAL_Main::instance()->settings->get_option( $args['id'] ); ?>" class="<?php echo implode( ' ', $args['classes'] ); ?>" min="<?php echo $args['min']; ?>" step="<?php echo $args['step']; ?>" />
208
  <?php if ( ! empty( $args['sub_desc'] ) ) echo $args['sub_desc']; ?>
209
  <?php if ( ! empty( $args['desc'] ) ) : ?>
210
  <p class="description"><?php echo $args['desc']; ?></p>
@@ -212,6 +399,7 @@ final class AAL_Settings_Fields {
212
  }
213
 
214
  public static function select_field( $args ) {
 
215
  extract( $args, EXTR_SKIP );
216
 
217
  if ( empty( $options ) || empty( $id ) || empty( $page ) )
@@ -220,12 +408,98 @@ final class AAL_Settings_Fields {
220
  ?>
221
  <select id="<?php echo esc_attr( $id ); ?>" name="<?php printf( '%s[%s]', esc_attr( $page ), esc_attr( $id ) ); ?>">
222
  <?php foreach ( $options as $name => $label ) : ?>
223
- <option value="<?php echo esc_attr( $name ); ?>" <?php selected( $name, (string) AAL_Main::instance()->settings->get_option( $id ) ); ?>>
224
  <?php echo esc_html( $label ); ?>
225
  </option>
226
  <?php endforeach; ?>
227
  </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  <?php
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  class AAL_Settings {
 
6
  private $hook;
7
+ public $slug = 'activity-log-settings';
8
+ protected $options;
9
 
10
  public function __construct() {
11
+ add_action( 'init', array( &$this, 'init' ) );
12
  add_action( 'admin_menu', array( &$this, 'action_admin_menu' ), 30 );
13
  add_action( 'admin_init', array( &$this, 'register_settings' ) );
14
  add_action( 'admin_notices', array( &$this, 'admin_notices' ) );
16
  add_filter( 'plugin_action_links_' . ACTIVITY_LOG_BASE, array( &$this, 'plugin_action_links' ) );
17
 
18
  add_action( 'wp_ajax_aal_reset_items', array( &$this, 'ajax_aal_reset_items' ) );
19
+ add_action( 'wp_ajax_aal_get_properties', array( &$this, 'ajax_aal_get_properties' ) );
20
+ }
21
+
22
+ public function init() {
23
+ $this->options = $this->get_options();
24
  }
25
 
26
  public function plugin_action_links( $links ) {
44
  __( 'Activity Log Settings', 'aryo-aal' ), // <title> tag
45
  __( 'Settings', 'aryo-aal' ), // menu label
46
  'manage_options', // required cap to view this page
47
+ $this->slug, // page slug
48
  array( &$this, 'display_settings_page' ) // callback
49
  );
50
+
51
+ // register scripts & styles, specific for the settings page
52
+ add_action( "admin_print_scripts-{$this->hook}", array( &$this, 'scripts_n_styles' ) );
53
  // this callback will initialize the settings for AAL
54
  // add_action( "load-$this->hook", array( $this, 'register_settings' ) );
55
  }
56
 
57
+ /**
58
+ * Register scripts & styles
59
+ *
60
+ * @since 1.0
61
+ */
62
+ public function scripts_n_styles() {
63
+ wp_enqueue_script( 'aal-settings', plugins_url( 'assets/js/settings.js', ACTIVITY_LOG__FILE__ ), array( 'jquery' ) );
64
+ wp_enqueue_style( 'aal-settings', plugins_url( 'assets/css/settings.css', ACTIVITY_LOG__FILE__ ) );
65
+ }
66
+
67
  public function register_settings() {
68
  // If no options exist, create them.
69
  if ( ! get_option( $this->slug ) ) {
72
  ) ) );
73
  }
74
 
75
+ register_setting( 'aal-options', $this->slug, array( $this, 'validate_options' ) );
76
+ $section = $this->get_setup_section();
77
+
78
+ switch ( $section ) {
79
+ case 'general':
80
+ // First, we register a section. This is necessary since all future options must belong to a
81
+ add_settings_section(
82
+ 'general_settings_section', // ID used to identify this section and with which to register options
83
+ __( 'Display Options', 'aryo-aal' ), // Title to be displayed on the administration page
84
+ array( 'AAL_Settings_Fields', 'general_settings_section_header' ), // Callback used to render the description of the section
85
+ $this->slug // Page on which to add this section of options
86
+ );
87
+
88
+ add_settings_field(
89
+ 'logs_lifespan',
90
+ __( 'Keep logs for', 'aryo-aal' ),
91
+ array( 'AAL_Settings_Fields', 'number_field' ),
92
+ $this->slug,
93
+ 'general_settings_section',
94
+ array(
95
+ 'id' => 'logs_lifespan',
96
+ 'page' => $this->slug,
97
+ 'classes' => array( 'small-text' ),
98
+ 'type' => 'number',
99
+ 'sub_desc' => __( 'days.', 'aryo-aal' ),
100
+ 'desc' => __( 'Maximum number of days to keep activity log. Leave blank to keep activity log forever (not recommended).', 'aryo-aal' ),
101
+ )
102
+ );
103
+
104
+ if ( apply_filters( 'aal_allow_option_erase_logs', true ) ) {
105
+ add_settings_field(
106
+ 'raw_delete_log_activities',
107
+ __( 'Delete Log Activities', 'aryo-aal' ),
108
+ array( 'AAL_Settings_Fields', 'raw_html' ),
109
+ $this->slug,
110
+ 'general_settings_section',
111
+ array(
112
+ 'html' => sprintf( __( '<a href="%s" id="%s">Reset Database</a>', 'aryo-aal' ), add_query_arg( array(
113
+ 'action' => 'aal_reset_items',
114
+ '_nonce' => wp_create_nonce( 'aal_reset_items' ),
115
+ ), admin_url( 'admin-ajax.php' ) ), 'aal-delete-log-activities' ),
116
+ 'desc' => __( 'Warning: Clicking this will delete all activities from the database.', 'aryo-aal' ),
117
+ )
118
+ );
119
+ }
120
+ break;
121
+
122
+ case 'notifications':
123
+ // Email Notifications Settings
124
+ add_settings_section(
125
+ 'email_notifications', // ID used to identify this section and with which to register options
126
+ __( 'Notifications', 'aryo-aal' ), // Title to be displayed on the administration page
127
+ array( 'AAL_Settings_Fields', 'email_notifications_section_header' ), // Callback used to render the description of the section
128
+ $this->slug // Page on which to add this section of options
129
+ );
130
+
131
+ add_settings_field(
132
+ 'notification_rules',
133
+ __( 'Notification Events', 'aryo-aal' ),
134
+ array( 'AAL_Settings_Fields', 'email_notification_buffer_field' ),
135
+ $this->slug,
136
+ 'email_notifications',
137
+ array(
138
+ 'id' => 'notification_rules',
139
+ 'page' => $this->slug,
140
+ 'desc' => __( 'Maximum number of days to keep activity log. Leave blank to keep activity log forever (not recommended).', 'aryo-aal' ),
141
+ )
142
+ );
143
+
144
+ $notification_handlers = AAL_Main::instance()->notifications->get_available_handlers();
145
+ $enabled_notification_handlers = AAL_Main::instance()->settings->get_option( 'notification_handlers' );
146
+
147
+ // Loop through custom notification handlers
148
+ foreach ( $notification_handlers as $handler_id => $handler_obj ) {
149
+ if ( ! is_object( $handler_obj ) )
150
+ continue;
151
+
152
+ add_settings_section(
153
+ "notification_$handler_id",
154
+ $handler_obj->name,
155
+ array( $handler_obj, '_settings_section_callback' ),
156
+ $this->slug
157
+ );
158
+
159
+ add_settings_field(
160
+ "notification_handler_{$handler_id}_enabled",
161
+ __( 'Enable?', 'aryo-aal' ),
162
+ array( $handler_obj, '_settings_enabled_field_callback' ),
163
+ $this->slug,
164
+ "notification_$handler_id",
165
+ array(
166
+ 'id' => 'notification_transport',
167
+ 'page' => $this->slug,
168
+ 'name' => "{$this->slug}[notification_handlers][{$handler_id}]",
169
+ 'value' => (bool) ( 1 == $enabled_notification_handlers[ $handler_id ] ),
170
+ )
171
+ );
172
+
173
+ $handler_obj->settings_fields();
174
+ }
175
+ break;
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Returns the current section within AAL's setting pages
181
+ *
182
+ * @return string
183
+ */
184
+ public function get_setup_section() {
185
+ if ( isset( $_REQUEST['aal_section'] ) )
186
+ return strtolower( $_REQUEST['aal_section'] );
187
 
188
+ return 'general';
189
+ }
190
+
191
+ /**
192
+ * Prints section tabs within the settings area
193
+ */
194
+ private function menu_print_tabs() {
195
+ $current_section = $this->get_setup_section();
196
+ $sections = array(
197
+ 'general' => __( 'General', 'aryo-aal' ),
198
+ 'notifications' => __( 'Notifications', 'aryo-aal' ),
 
 
 
199
  );
200
+
201
+ $sections = apply_filters( 'aal_setup_sections', $sections );
202
+
203
+ foreach ( $sections as $section_key => $section_caption ) {
204
+ $active = $current_section === $section_key ? 'nav-tab-active' : '';
205
+ $url = add_query_arg( 'aal_section', $section_key );
206
+ echo '<a class="nav-tab ' . $active . '" href="' . esc_url( $url ) . '">' . esc_html( $section_caption ) . '</a>';
 
 
 
 
 
 
 
 
 
207
  }
208
+ }
209
+
210
+ public function validate_options( $input ) {
211
+ $options = $this->options; // CTX,L1504
212
+
213
+ // @todo some data validation/sanitization should go here
214
+ $output = apply_filters( 'aal_validate_options', $input, $options );
215
+
216
+ // merge with current settings
217
+ $output = array_merge( $options, $output );
218
 
219
+ return $output;
220
  }
221
 
222
  public function display_settings_page() {
225
  <div class="wrap">
226
 
227
  <div id="icon-themes" class="icon32"></div>
228
+ <h2 class="aal-page-title"><?php _e( 'Activity Log Settings', 'aryo-aal' ); ?></h2>
229
+ <?php settings_errors(); ?>
230
+ <h2 class="nav-tab-wrapper"><?php $this->menu_print_tabs(); ?></h2>
231
 
232
  <form method="post" action="options.php">
233
  <?php
234
  settings_fields( 'aal-options' );
235
  do_settings_sections( $this->slug );
 
236
  submit_button();
237
  ?>
238
  </form>
266
 
267
  public function ajax_aal_reset_items() {
268
  if ( ! check_ajax_referer( 'aal_reset_items', '_nonce', false ) || ! current_user_can( 'manage_options' ) ) {
269
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'aryo-aal' ) );
270
  }
271
 
272
  AAL_Main::instance()->api->erase_all_items();
278
  die();
279
  }
280
 
281
+ public function ajax_aal_get_properties() {
282
+ $action_category = isset( $_REQUEST['action_category'] ) ? $_REQUEST['action_category'] : false;
283
+
284
+ $options = AAL_Main::instance()->notifications->get_settings_dropdown_values( $action_category );
285
+
286
+ if ( ! empty( $options ) ) {
287
+ wp_send_json_success( $options );
288
+ }
289
+
290
+ wp_send_json_error();
291
+ }
292
+
293
  public function get_option( $key = '' ) {
294
+ $settings = $this->get_options();
295
  return ! empty( $settings[ $key ] ) ? $settings[ $key ] : false;
296
  }
297
 
298
+ /**
299
+ * Returns all options
300
+ *
301
+ * @since 2.0.7
302
+ * @return array
303
+ */
304
+ public function get_options() {
305
+ // Allow other plugins to get AAL's options.
306
+ if ( isset( $this->options ) && is_array( $this->options ) && ! empty( $this->options ) )
307
+ return $this->options;
308
+
309
+ return apply_filters( 'aal_options', get_option( $this->slug, array() ) );
310
+ }
311
+
312
+ public function slug() {
313
+ return $this->slug;
314
+ }
315
  }
316
 
317
  // TODO: Need rewrite this class to useful tool.
318
  final class AAL_Settings_Fields {
319
 
320
+ public static function general_settings_section_header() {
321
  ?>
322
  <p><?php _e( 'These are some basic settings for Activity Log.', 'aryo-aal' ); ?></p>
323
  <?php
324
  }
325
+
326
+ public static function email_notifications_section_header() {
327
+ ?>
328
+ <p><?php _e( 'Serve yourself with custom-tailored notifications. First, define your conditions. Then, choose how the notifications will be sent.', 'aryo-aal' ); ?></p>
329
+ <?php
330
+ }
331
 
332
  public static function raw_html( $args ) {
333
  if ( empty( $args['html'] ) )
340
  }
341
 
342
  public static function text_field( $args ) {
343
+ self::_set_name_and_value( $args );
344
+ extract( $args, EXTR_SKIP );
345
+
346
  $args = wp_parse_args( $args, array(
347
  'classes' => array(),
348
  ) );
350
  return;
351
 
352
  ?>
353
+ <input type="text" id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $value ); ?>" class="<?php echo implode( ' ', $args['classes'] ); ?>" />
354
+ <?php if ( ! empty( $desc ) ) : ?>
355
+ <p class="description"><?php echo $desc; ?></p>
356
+ <?php endif;
357
+ }
358
+
359
+ public static function textarea_field( $args ) {
360
+ self::_set_name_and_value( $args );
361
+ extract( $args, EXTR_SKIP );
362
+
363
+ $args = wp_parse_args( $args, array(
364
+ 'classes' => array(),
365
+ 'rows' => 5,
366
+ 'cols' => 50,
367
+ ) );
368
+
369
+ if ( empty( $args['id'] ) || empty( $args['page'] ) )
370
+ return;
371
+
372
+ ?>
373
+ <textarea id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $name ); ?>" class="<?php echo implode( ' ', $args['classes'] ); ?>" rows="<?php echo absint( $args['rows'] ); ?>" cols="<?php echo absint( $args['cols'] ); ?>"><?php echo esc_textarea( $value ); ?></textarea>
374
+
375
+ <?php if ( ! empty( $desc ) ) : ?>
376
+ <p class="description"><?php echo $desc; ?></p>
377
+ <?php endif;
378
  }
379
 
380
  public static function number_field( $args ) {
381
+ self::_set_name_and_value( $args );
382
+ extract( $args, EXTR_SKIP );
383
+
384
  $args = wp_parse_args( $args, array(
385
  'classes' => array(),
386
  'min' => '1',
391
  return;
392
 
393
  ?>
394
+ <input type="number" id="<?php echo esc_attr( $args['id'] ); ?>" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $value ); ?>" class="<?php echo implode( ' ', $args['classes'] ); ?>" min="<?php echo $args['min']; ?>" step="<?php echo $args['step']; ?>" />
395
  <?php if ( ! empty( $args['sub_desc'] ) ) echo $args['sub_desc']; ?>
396
  <?php if ( ! empty( $args['desc'] ) ) : ?>
397
  <p class="description"><?php echo $args['desc']; ?></p>
399
  }
400
 
401
  public static function select_field( $args ) {
402
+ self::_set_name_and_value( $args );
403
  extract( $args, EXTR_SKIP );
404
 
405
  if ( empty( $options ) || empty( $id ) || empty( $page ) )
408
  ?>
409
  <select id="<?php echo esc_attr( $id ); ?>" name="<?php printf( '%s[%s]', esc_attr( $page ), esc_attr( $id ) ); ?>">
410
  <?php foreach ( $options as $name => $label ) : ?>
411
+ <option value="<?php echo esc_attr( $name ); ?>" <?php selected( $name, (string) $value ); ?>>
412
  <?php echo esc_html( $label ); ?>
413
  </option>
414
  <?php endforeach; ?>
415
  </select>
416
+ <?php if ( ! empty( $desc ) ) : ?>
417
+ <p class="description"><?php echo $desc; ?></p>
418
+ <?php endif; ?>
419
+ <?php
420
+ }
421
+
422
+ public static function yesno_field( $args ) {
423
+ self::_set_name_and_value( $args );
424
+ extract( $args, EXTR_SKIP );
425
+
426
+ ?>
427
+ <label class="tix-yes-no description"><input type="radio" name="<?php echo esc_attr( $name ); ?>" value="1" <?php checked( $value, true ); ?>> <?php _e( 'Yes', 'aryo-aal' ); ?></label>
428
+ <label class="tix-yes-no description"><input type="radio" name="<?php echo esc_attr( $name ); ?>" value="0" <?php checked( $value, false ); ?>> <?php _e( 'No', 'aryo-aal' ); ?></label>
429
+
430
+ <?php if ( isset( $args['description'] ) ) : ?>
431
+ <p class="description"><?php echo $args['description']; ?></p>
432
+ <?php endif; ?>
433
  <?php
434
  }
435
 
436
+ public static function email_notification_buffer_field( $args ) {
437
+ $args = wp_parse_args( $args, array(
438
+ 'classes' => array(),
439
+ ) );
440
+ if ( empty( $args['id'] ) || empty( $args['page'] ) )
441
+ return;
442
+
443
+ // available action categories
444
+ $keys = array(
445
+ 'user' => __( 'User', 'aryo-aal' ),
446
+ 'action-type' => __( 'Action Type', 'aryo-aal' ),
447
+ 'action-value' => __( 'Action Performed', 'aryo-aal' ),
448
+ );
449
+ // available condition types
450
+ $conditions = array(
451
+ 'equals' => __( 'equals to', 'aryo-aal' ),
452
+ 'not_equals' => __( 'not equals to', 'aryo-aal' ),
453
+ );
454
+
455
+ $common_name = sprintf( '%s[%s]', esc_attr( $args['page'] ), esc_attr( $args['id'] ) );
456
+
457
+ // get all rows
458
+ $rows = AAL_Main::instance()->settings->get_option( $args['id'] );
459
+ // if empty, reset to one element with the key of 1
460
+ $rows = empty( $rows ) ? array( array( 'key' => 1 ) ) : $rows;
461
+ ?>
462
+ <p class="description"><?php _e( 'A notification will be sent upon a successful match with the following conditions:', 'aryo-aal' ); ?></p>
463
+ <div class="aal-notifier-settings">
464
+ <ul>
465
+ <?php foreach ( $rows as $rid => $row ) :
466
+ $row_key = $row['key'];
467
+ $row_condition = isset( $row['condition'] ) ? $row['condition'] : '';
468
+ $row_value = isset( $row['value'] ) ? $row['value'] : '';
469
+ ?>
470
+ <li data-id="<?php echo $rid; ?>">
471
+ <select name="<?php echo $common_name; ?>[<?php echo $rid; ?>][key]" class="aal-category">
472
+ <?php foreach ( $keys as $k => $v ) : ?>
473
+ <option value="<?php echo $k; ?>" <?php selected( $row_key, $k ); ?>><?php echo $v; ?></option>
474
+ <?php endforeach; ?>
475
+ </select>
476
+ <select name="<?php echo $common_name; ?>[<?php echo $rid; ?>][condition]" class="aal-condition">
477
+ <?php foreach ( $conditions as $k => $v ) : ?>
478
+ <option value="<?php echo $k; ?>" <?php selected( $row_condition, $k ); ?>><?php echo $v; ?></option>
479
+ <?php endforeach; ?>
480
+ </select>
481
+ <?php $value_options = AAL_Main::instance()->notifications->get_settings_dropdown_values( $row_key ); ?>
482
+ <select name="<?php echo $common_name; ?>[<?php echo $rid; ?>][value]" class="aal-value">
483
+ <?php foreach ( $value_options as $option_key => $option_value ) : ?>
484
+ <option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $option_key, $row_value ); ?>><?php echo esc_html( $option_value ); ?></option>
485
+ <?php endforeach; ?>
486
+ </select>
487
+ <a href="#" class="aal-new-rule button"><small>+</small> and</a>
488
+ <a href="#" class="aal-delete-rule button">&times;</a>
489
+ </li>
490
+ <?php endforeach; ?>
491
+ </ul>
492
+ </div>
493
+ <?php
494
+ }
495
+
496
+ private static function _set_name_and_value( &$args ) {
497
+ if ( ! isset( $args['name'] ) ) {
498
+ $args['name'] = sprintf( '%s[%s]', esc_attr( $args['page'] ), esc_attr( $args['id'] ) );
499
+ }
500
+
501
+ if ( ! isset( $args['value'] ) ) {
502
+ $args['value'] = AAL_Main::instance()->settings->get_option( $args['id'] );
503
+ }
504
+ }
505
  }
hooks/class-aal-hook-plugins.php CHANGED
@@ -7,7 +7,8 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
7
  // Get plugin name if is a path
8
  if ( false !== strpos( $plugin_name, '/' ) ) {
9
  $plugin_dir = explode( '/', $plugin_name );
10
- $plugin_data = array_shift( array_values( get_plugins( '/' . $plugin_dir[0] ) ) );
 
11
  $plugin_name = $plugin_data['Name'];
12
  }
13
 
7
  // Get plugin name if is a path
8
  if ( false !== strpos( $plugin_name, '/' ) ) {
9
  $plugin_dir = explode( '/', $plugin_name );
10
+ $plugin_data = array_values( get_plugins( '/' . $plugin_dir[0] ) );
11
+ $plugin_data = array_shift( $plugin_data );
12
  $plugin_name = $plugin_data['Name'];
13
  }
14
 
language/aryo-aal.pot CHANGED
@@ -1,487 +1,635 @@
1
- # Copyright (C) 2013
2
- # This file is distributed under the same license as the package.
 
 
 
 
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: ARYO Activity Log\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/activity-log\n"
7
- "POT-Creation-Date: 2014-02-17 19:21-0000\n"
8
- "PO-Revision-Date: 2014-02-17 19:22-0000\n"
9
- "Last-Translator: Yakir Sitbon <kingyes1@gmail.com>\n"
10
  "Language-Team: LANGUAGE <LL@li.org>\n"
 
11
  "MIME-Version: 1.0\n"
12
- "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
- "X-Generator: Poedit 1.6.4\n"
16
- "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e;_x;_n:1,2;_c,_nc:4c,1,2\n"
18
- "X-Poedit-Basepath: .\n"
19
- "X-Poedit-SearchPath-0: ..\n"
20
-
21
- #: ../classes/class-aal-activity-log-list-table.php:82
22
  msgid "Activities"
23
  msgstr ""
24
 
25
- #: ../classes/class-aal-activity-log-list-table.php:92
26
  msgid "Date"
27
  msgstr ""
28
 
29
- #: ../classes/class-aal-activity-log-list-table.php:93
30
  msgid "Author"
31
  msgstr ""
32
 
33
- #: ../classes/class-aal-activity-log-list-table.php:94
34
  msgid "IP"
35
  msgstr ""
36
 
37
- #: ../classes/class-aal-activity-log-list-table.php:95
38
  msgid "Type"
39
  msgstr ""
40
 
41
- #: ../classes/class-aal-activity-log-list-table.php:96
42
  msgid "Label"
43
  msgstr ""
44
 
45
- #: ../classes/class-aal-activity-log-list-table.php:97
46
  msgid "Action"
47
  msgstr ""
48
 
49
- #: ../classes/class-aal-activity-log-list-table.php:98
50
  msgid "Description"
51
  msgstr ""
52
 
53
- #: ../classes/class-aal-activity-log-list-table.php:118
54
  #, php-format
55
  msgid "%s ago"
56
  msgstr ""
57
 
58
- #: ../classes/class-aal-activity-log-list-table.php:145
59
  msgid "Unknown"
60
  msgstr ""
61
 
62
- #: ../classes/class-aal-activity-log-list-table.php:151
63
- #: ../classes/class-aal-activity-log-list-table.php:229
64
  msgid "Guest"
65
  msgstr ""
66
 
67
- #: ../classes/class-aal-activity-log-list-table.php:240
68
  msgid "All Users"
69
  msgstr ""
70
 
71
- #: ../classes/class-aal-activity-log-list-table.php:267
72
  msgid "All Types"
73
  msgstr ""
74
 
75
- #: ../classes/class-aal-activity-log-list-table.php:278
76
  msgid "All Time"
77
  msgstr ""
78
 
79
- #: ../classes/class-aal-activity-log-list-table.php:279
80
  msgid "Today"
81
  msgstr ""
82
 
83
- #: ../classes/class-aal-activity-log-list-table.php:280
84
  msgid "Yesterday"
85
  msgstr ""
86
 
87
- #: ../classes/class-aal-activity-log-list-table.php:281
88
  msgid "Week"
89
  msgstr ""
90
 
91
- #: ../classes/class-aal-activity-log-list-table.php:282
92
  msgid "Month"
93
  msgstr ""
94
 
95
- #: ../classes/class-aal-activity-log-list-table.php:289
96
  msgid "Filter"
97
  msgstr ""
98
 
99
- #: ../classes/class-aal-admin-ui.php:17 ../classes/class-aal-admin-ui.php:27
100
  msgid "Activity Log"
101
  msgstr ""
102
 
103
- #: ../classes/class-aal-settings.php:21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  msgid "GitHub"
105
  msgstr ""
106
 
107
- #: ../classes/class-aal-settings.php:24 ../classes/class-aal-settings.php:39
108
  msgid "Settings"
109
  msgstr ""
110
 
111
- #: ../classes/class-aal-settings.php:38 ../classes/class-aal-settings.php:106
112
  msgid "Activity Log Settings"
113
  msgstr ""
114
 
115
- #: ../classes/class-aal-settings.php:59
116
  msgid "Display Options"
117
  msgstr ""
118
 
119
- #: ../classes/class-aal-settings.php:66
120
  msgid "Keep logs for"
121
  msgstr ""
122
 
123
- #: ../classes/class-aal-settings.php:75
124
  msgid "days."
125
  msgstr ""
126
 
127
- #: ../classes/class-aal-settings.php:76
128
  msgid ""
129
  "Maximum number of days to keep activity log. Leave blank to keep activity "
130
  "log forever (not recommended)."
131
  msgstr ""
132
 
133
- #: ../classes/class-aal-settings.php:83
134
  msgid "Delete Log Activities"
135
  msgstr ""
136
 
137
- #: ../classes/class-aal-settings.php:88
138
  #, php-format
139
  msgid "<a href=\"%s\" id=\"%s\">Reset Database</a>"
140
  msgstr ""
141
 
142
- #: ../classes/class-aal-settings.php:92
143
  msgid "Warning: Clicking this will delete all activities from the database."
144
  msgstr ""
145
 
146
- #: ../classes/class-aal-settings.php:124
 
 
 
 
 
 
 
 
 
 
 
 
147
  msgid "All activities have been successfully deleted."
148
  msgstr ""
149
 
150
- #: ../classes/class-aal-settings.php:135
151
  msgid "Are you sure you want to do this action?"
152
  msgstr ""
153
 
154
- #: ../classes/class-aal-settings.php:169
 
 
 
 
155
  msgid "These are some basic settings for Activity Log."
156
  msgstr ""
157
 
158
- #: ../language/strings.php:2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  msgid "ARYO Activity Log"
160
  msgstr ""
161
 
162
- #: ../language/strings.php:3
163
  msgid ""
164
  "Get aware of any activities that are taking place on your dashboard! Imagine "
165
  "it like a black-box for your WordPress site. e.g. post was deleted, plugin "
166
- "was activated, user logged in or logged out - its all these for you to see."
167
  msgstr ""
168
 
169
- #: ../language/strings.php:6
170
  msgid "Post"
171
  msgstr ""
172
 
173
- #: ../language/strings.php:7
174
  msgid "created"
175
  msgstr ""
176
 
177
- #: ../language/strings.php:8
178
  msgid "updated"
179
  msgstr ""
180
 
181
- #: ../language/strings.php:9
182
  msgid "deleted"
183
  msgstr ""
184
 
185
- #: ../language/strings.php:12
186
  msgid "Attachment"
187
  msgstr ""
188
 
189
- #: ../language/strings.php:13
190
  msgid "added"
191
  msgstr ""
192
 
193
- #: ../language/strings.php:16
194
- msgid "User"
195
- msgstr ""
196
-
197
- #: ../language/strings.php:17
198
  msgid "logged_out"
199
  msgstr ""
200
 
201
- #: ../language/strings.php:18
202
  msgid "logged_in"
203
  msgstr ""
204
 
205
- #: ../language/strings.php:19
206
  msgid "wrong_password"
207
  msgstr ""
208
 
209
- #: ../language/strings.php:22
210
  msgid "Plugin"
211
  msgstr ""
212
 
213
- #: ../language/strings.php:23
214
  msgid "activated"
215
  msgstr ""
216
 
217
- #: ../language/strings.php:24
218
  msgid "deactivated"
219
  msgstr ""
220
 
221
- #: ../language/strings.php:27
222
  msgid "Theme"
223
  msgstr ""
224
 
225
- #: ../language/strings.php:28
226
  msgid "Theme Customizer"
227
  msgstr ""
228
 
229
- #: ../language/strings.php:31
230
  msgid "Widget"
231
  msgstr ""
232
 
233
- #: ../language/strings.php:34
234
  msgid "Options"
235
  msgstr ""
236
 
237
- #: ../language/strings.php:37
238
  msgid "Menu"
239
  msgstr ""
240
 
241
- #: ../language/strings.php:40
242
  msgid "Taxonomy"
243
  msgstr ""
244
 
245
- #: ../language/strings.php:45
246
  msgid "blogname"
247
  msgstr ""
248
 
249
- #: ../language/strings.php:46
250
  msgid "blogdescription"
251
  msgstr ""
252
 
253
- #: ../language/strings.php:47
254
  msgid "siteurl"
255
  msgstr ""
256
 
257
- #: ../language/strings.php:48
258
  msgid "home"
259
  msgstr ""
260
 
261
- #: ../language/strings.php:49
262
  msgid "admin_email"
263
  msgstr ""
264
 
265
- #: ../language/strings.php:50
266
  msgid "users_can_register"
267
  msgstr ""
268
 
269
- #: ../language/strings.php:51
270
  msgid "default_role"
271
  msgstr ""
272
 
273
- #: ../language/strings.php:52
274
  msgid "timezone_string"
275
  msgstr ""
276
 
277
- #: ../language/strings.php:53
278
  msgid "date_format"
279
  msgstr ""
280
 
281
- #: ../language/strings.php:54
282
  msgid "time_format"
283
  msgstr ""
284
 
285
- #: ../language/strings.php:55
286
  msgid "start_of_week"
287
  msgstr ""
288
 
289
- #: ../language/strings.php:58
290
  msgid "use_smilies"
291
  msgstr ""
292
 
293
- #: ../language/strings.php:59
294
  msgid "use_balanceTags"
295
  msgstr ""
296
 
297
- #: ../language/strings.php:60
298
  msgid "default_category"
299
  msgstr ""
300
 
301
- #: ../language/strings.php:61
302
  msgid "default_post_format"
303
  msgstr ""
304
 
305
- #: ../language/strings.php:62
306
  msgid "mailserver_url"
307
  msgstr ""
308
 
309
- #: ../language/strings.php:63
310
  msgid "mailserver_login"
311
  msgstr ""
312
 
313
- #: ../language/strings.php:64
314
  msgid "mailserver_pass"
315
  msgstr ""
316
 
317
- #: ../language/strings.php:65
318
  msgid "default_email_category"
319
  msgstr ""
320
 
321
- #: ../language/strings.php:66
322
  msgid "ping_sites"
323
  msgstr ""
324
 
325
- #: ../language/strings.php:69
326
  msgid "show_on_front"
327
  msgstr ""
328
 
329
- #: ../language/strings.php:70
330
  msgid "page_on_front"
331
  msgstr ""
332
 
333
- #: ../language/strings.php:71
334
  msgid "page_for_posts"
335
  msgstr ""
336
 
337
- #: ../language/strings.php:72
338
  msgid "posts_per_page"
339
  msgstr ""
340
 
341
- #: ../language/strings.php:73
342
  msgid "posts_per_rss"
343
  msgstr ""
344
 
345
- #: ../language/strings.php:74
346
  msgid "rss_use_excerpt"
347
  msgstr ""
348
 
349
- #: ../language/strings.php:75
350
  msgid "blog_public"
351
  msgstr ""
352
 
353
- #: ../language/strings.php:78
354
  msgid "default_pingback_flag"
355
  msgstr ""
356
 
357
- #: ../language/strings.php:79
358
  msgid "default_ping_status"
359
  msgstr ""
360
 
361
- #: ../language/strings.php:80
362
  msgid "default_comment_status"
363
  msgstr ""
364
 
365
- #: ../language/strings.php:81
366
  msgid "require_name_email"
367
  msgstr ""
368
 
369
- #: ../language/strings.php:82
370
  msgid "comment_registration"
371
  msgstr ""
372
 
373
- #: ../language/strings.php:83
374
  msgid "close_comments_for_old_posts"
375
  msgstr ""
376
 
377
- #: ../language/strings.php:84
378
  msgid "close_comments_days_old"
379
  msgstr ""
380
 
381
- #: ../language/strings.php:85
382
  msgid "thread_comments"
383
  msgstr ""
384
 
385
- #: ../language/strings.php:86
386
  msgid "thread_comments_depth"
387
  msgstr ""
388
 
389
- #: ../language/strings.php:87
390
  msgid "page_comments"
391
  msgstr ""
392
 
393
- #: ../language/strings.php:88
394
  msgid "comments_per_page"
395
  msgstr ""
396
 
397
- #: ../language/strings.php:89
398
  msgid "default_comments_page"
399
  msgstr ""
400
 
401
- #: ../language/strings.php:90
402
  msgid "comment_order"
403
  msgstr ""
404
 
405
- #: ../language/strings.php:91
406
  msgid "comments_notify"
407
  msgstr ""
408
 
409
- #: ../language/strings.php:92
410
  msgid "moderation_notify"
411
  msgstr ""
412
 
413
- #: ../language/strings.php:93
414
  msgid "comment_moderation"
415
  msgstr ""
416
 
417
- #: ../language/strings.php:94
418
  msgid "comment_whitelist"
419
  msgstr ""
420
 
421
- #: ../language/strings.php:95
422
  msgid "comment_max_links"
423
  msgstr ""
424
 
425
- #: ../language/strings.php:96
426
  msgid "moderation_keys"
427
  msgstr ""
428
 
429
- #: ../language/strings.php:97
430
  msgid "blacklist_keys"
431
  msgstr ""
432
 
433
- #: ../language/strings.php:98
434
  msgid "show_avatars"
435
  msgstr ""
436
 
437
- #: ../language/strings.php:99
438
  msgid "avatar_rating"
439
  msgstr ""
440
 
441
- #: ../language/strings.php:100
442
  msgid "avatar_default"
443
  msgstr ""
444
 
445
- #: ../language/strings.php:103
446
  msgid "thumbnail_size_w"
447
  msgstr ""
448
 
449
- #: ../language/strings.php:104
450
  msgid "thumbnail_size_h"
451
  msgstr ""
452
 
453
- #: ../language/strings.php:105
454
  msgid "thumbnail_crop"
455
  msgstr ""
456
 
457
- #: ../language/strings.php:106
458
  msgid "medium_size_w"
459
  msgstr ""
460
 
461
- #: ../language/strings.php:107
462
  msgid "medium_size_h"
463
  msgstr ""
464
 
465
- #: ../language/strings.php:108
466
  msgid "large_size_w"
467
  msgstr ""
468
 
469
- #: ../language/strings.php:109
470
  msgid "large_size_h"
471
  msgstr ""
472
 
473
- #: ../language/strings.php:110
474
  msgid "uploads_use_yearmonth_folders"
475
  msgstr ""
476
 
477
- #: ../language/strings.php:113
478
  msgid "permalink_structure"
479
  msgstr ""
480
 
481
- #: ../language/strings.php:114
482
  msgid "category_base"
483
  msgstr ""
484
 
485
- #: ../language/strings.php:115
486
  msgid "tag_base"
487
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: aryo-activity-log 2.1.0\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2014-04-22 21:47+0000\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "Language: \n"
16
  "MIME-Version: 1.0\n"
17
+ "Content-Type: text/plain; charset=CHARSET\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
+
20
+ #: aryo-activity-log.php:110 aryo-activity-log.php:121
21
+ msgid "Cheatin&#8217; huh?"
22
+ msgstr ""
23
+
24
+ #: classes/class-aal-activity-log-list-table.php:82
 
 
25
  msgid "Activities"
26
  msgstr ""
27
 
28
+ #: classes/class-aal-activity-log-list-table.php:92
29
  msgid "Date"
30
  msgstr ""
31
 
32
+ #: classes/class-aal-activity-log-list-table.php:93
33
  msgid "Author"
34
  msgstr ""
35
 
36
+ #: classes/class-aal-activity-log-list-table.php:94
37
  msgid "IP"
38
  msgstr ""
39
 
40
+ #: classes/class-aal-activity-log-list-table.php:95
41
  msgid "Type"
42
  msgstr ""
43
 
44
+ #: classes/class-aal-activity-log-list-table.php:96
45
  msgid "Label"
46
  msgstr ""
47
 
48
+ #: classes/class-aal-activity-log-list-table.php:97
49
  msgid "Action"
50
  msgstr ""
51
 
52
+ #: classes/class-aal-activity-log-list-table.php:98
53
  msgid "Description"
54
  msgstr ""
55
 
56
+ #: classes/class-aal-activity-log-list-table.php:118
57
  #, php-format
58
  msgid "%s ago"
59
  msgstr ""
60
 
61
+ #: classes/class-aal-activity-log-list-table.php:145
62
  msgid "Unknown"
63
  msgstr ""
64
 
65
+ #: classes/class-aal-activity-log-list-table.php:151
66
+ #: classes/class-aal-activity-log-list-table.php:229
67
  msgid "Guest"
68
  msgstr ""
69
 
70
+ #: classes/class-aal-activity-log-list-table.php:240
71
  msgid "All Users"
72
  msgstr ""
73
 
74
+ #: classes/class-aal-activity-log-list-table.php:267
75
  msgid "All Types"
76
  msgstr ""
77
 
78
+ #: classes/class-aal-activity-log-list-table.php:278
79
  msgid "All Time"
80
  msgstr ""
81
 
82
+ #: classes/class-aal-activity-log-list-table.php:279
83
  msgid "Today"
84
  msgstr ""
85
 
86
+ #: classes/class-aal-activity-log-list-table.php:280
87
  msgid "Yesterday"
88
  msgstr ""
89
 
90
+ #: classes/class-aal-activity-log-list-table.php:281
91
  msgid "Week"
92
  msgstr ""
93
 
94
+ #: classes/class-aal-activity-log-list-table.php:282
95
  msgid "Month"
96
  msgstr ""
97
 
98
+ #: classes/class-aal-activity-log-list-table.php:289
99
  msgid "Filter"
100
  msgstr ""
101
 
102
+ #: classes/class-aal-admin-ui.php:17 classes/class-aal-admin-ui.php:27
103
  msgid "Activity Log"
104
  msgstr ""
105
 
106
+ #: classes/class-aal-help.php:21
107
+ msgid "Overview"
108
+ msgstr ""
109
+
110
+ #: classes/class-aal-help.php:24 classes/class-aal-settings.php:126
111
+ #: classes/class-aal-settings.php:198
112
+ msgid "Notifications"
113
+ msgstr ""
114
+
115
+ #: classes/class-aal-help.php:25
116
+ msgid ""
117
+ "This screen lets you control what will happen once a user on your site does "
118
+ "something you define. For instance, let us assume that you have created a "
119
+ "user on your site\n"
120
+ " for your content editor. Now, let's say that every time "
121
+ "that user updates a post, you want to know about it. You can easily do it "
122
+ "from this page."
123
+ msgstr ""
124
+
125
+ #: classes/class-aal-notifications.php:274
126
+ msgid "The AAL notification handler you are trying to register does not exist."
127
+ msgstr ""
128
+
129
+ #: classes/class-aal-settings.php:27
130
  msgid "GitHub"
131
  msgstr ""
132
 
133
+ #: classes/class-aal-settings.php:30 classes/class-aal-settings.php:45
134
  msgid "Settings"
135
  msgstr ""
136
 
137
+ #: classes/class-aal-settings.php:44 classes/class-aal-settings.php:228
138
  msgid "Activity Log Settings"
139
  msgstr ""
140
 
141
+ #: classes/class-aal-settings.php:83
142
  msgid "Display Options"
143
  msgstr ""
144
 
145
+ #: classes/class-aal-settings.php:90
146
  msgid "Keep logs for"
147
  msgstr ""
148
 
149
+ #: classes/class-aal-settings.php:99
150
  msgid "days."
151
  msgstr ""
152
 
153
+ #: classes/class-aal-settings.php:100 classes/class-aal-settings.php:140
154
  msgid ""
155
  "Maximum number of days to keep activity log. Leave blank to keep activity "
156
  "log forever (not recommended)."
157
  msgstr ""
158
 
159
+ #: classes/class-aal-settings.php:107
160
  msgid "Delete Log Activities"
161
  msgstr ""
162
 
163
+ #: classes/class-aal-settings.php:112
164
  #, php-format
165
  msgid "<a href=\"%s\" id=\"%s\">Reset Database</a>"
166
  msgstr ""
167
 
168
+ #: classes/class-aal-settings.php:116
169
  msgid "Warning: Clicking this will delete all activities from the database."
170
  msgstr ""
171
 
172
+ #: classes/class-aal-settings.php:133
173
+ msgid "Notification Events"
174
+ msgstr ""
175
+
176
+ #: classes/class-aal-settings.php:161
177
+ msgid "Enable?"
178
+ msgstr ""
179
+
180
+ #: classes/class-aal-settings.php:197
181
+ msgid "General"
182
+ msgstr ""
183
+
184
+ #: classes/class-aal-settings.php:247
185
  msgid "All activities have been successfully deleted."
186
  msgstr ""
187
 
188
+ #: classes/class-aal-settings.php:258
189
  msgid "Are you sure you want to do this action?"
190
  msgstr ""
191
 
192
+ #: classes/class-aal-settings.php:269
193
+ msgid "You do not have sufficient permissions to access this page."
194
+ msgstr ""
195
+
196
+ #: classes/class-aal-settings.php:322
197
  msgid "These are some basic settings for Activity Log."
198
  msgstr ""
199
 
200
+ #: classes/class-aal-settings.php:328
201
+ msgid ""
202
+ "Serve yourself with custom-tailored notifications. First, define your "
203
+ "conditions. Then, choose how the notifications will be sent."
204
+ msgstr ""
205
+
206
+ #: classes/class-aal-settings.php:427
207
+ msgid "Yes"
208
+ msgstr ""
209
+
210
+ #: classes/class-aal-settings.php:428
211
+ msgid "No"
212
+ msgstr ""
213
+
214
+ #: classes/class-aal-settings.php:445 language/strings.php:19
215
+ #: notifications/abstract-class-aal-notification-base.php:98
216
+ msgid "User"
217
+ msgstr ""
218
+
219
+ #: classes/class-aal-settings.php:446
220
+ #: notifications/abstract-class-aal-notification-base.php:101
221
+ msgid "Action Type"
222
+ msgstr ""
223
+
224
+ #: classes/class-aal-settings.php:447
225
+ msgid "Action Performed"
226
+ msgstr ""
227
+
228
+ #: classes/class-aal-settings.php:451
229
+ msgid "equals to"
230
+ msgstr ""
231
+
232
+ #: classes/class-aal-settings.php:452
233
+ msgid "not equals to"
234
+ msgstr ""
235
+
236
+ #: classes/class-aal-settings.php:462
237
+ msgid ""
238
+ "A notification will be sent upon a successful match with the following "
239
+ "conditions:"
240
+ msgstr ""
241
+
242
+ #: hooks/class-aal-hook-posts.php:9
243
+ msgid "(no title)"
244
+ msgstr ""
245
+
246
+ #: language/strings.php:5
247
  msgid "ARYO Activity Log"
248
  msgstr ""
249
 
250
+ #: language/strings.php:6
251
  msgid ""
252
  "Get aware of any activities that are taking place on your dashboard! Imagine "
253
  "it like a black-box for your WordPress site. e.g. post was deleted, plugin "
254
+ "was activated, user logged in or logged out - it's all these for you to see."
255
  msgstr ""
256
 
257
+ #: language/strings.php:9
258
  msgid "Post"
259
  msgstr ""
260
 
261
+ #: language/strings.php:10
262
  msgid "created"
263
  msgstr ""
264
 
265
+ #: language/strings.php:11
266
  msgid "updated"
267
  msgstr ""
268
 
269
+ #: language/strings.php:12
270
  msgid "deleted"
271
  msgstr ""
272
 
273
+ #: language/strings.php:15
274
  msgid "Attachment"
275
  msgstr ""
276
 
277
+ #: language/strings.php:16
278
  msgid "added"
279
  msgstr ""
280
 
281
+ #: language/strings.php:20
 
 
 
 
282
  msgid "logged_out"
283
  msgstr ""
284
 
285
+ #: language/strings.php:21
286
  msgid "logged_in"
287
  msgstr ""
288
 
289
+ #: language/strings.php:22
290
  msgid "wrong_password"
291
  msgstr ""
292
 
293
+ #: language/strings.php:25
294
  msgid "Plugin"
295
  msgstr ""
296
 
297
+ #: language/strings.php:26
298
  msgid "activated"
299
  msgstr ""
300
 
301
+ #: language/strings.php:27
302
  msgid "deactivated"
303
  msgstr ""
304
 
305
+ #: language/strings.php:30
306
  msgid "Theme"
307
  msgstr ""
308
 
309
+ #: language/strings.php:31
310
  msgid "Theme Customizer"
311
  msgstr ""
312
 
313
+ #: language/strings.php:34
314
  msgid "Widget"
315
  msgstr ""
316
 
317
+ #: language/strings.php:37
318
  msgid "Options"
319
  msgstr ""
320
 
321
+ #: language/strings.php:40
322
  msgid "Menu"
323
  msgstr ""
324
 
325
+ #: language/strings.php:43
326
  msgid "Taxonomy"
327
  msgstr ""
328
 
329
+ #: language/strings.php:48
330
  msgid "blogname"
331
  msgstr ""
332
 
333
+ #: language/strings.php:49
334
  msgid "blogdescription"
335
  msgstr ""
336
 
337
+ #: language/strings.php:50
338
  msgid "siteurl"
339
  msgstr ""
340
 
341
+ #: language/strings.php:51
342
  msgid "home"
343
  msgstr ""
344
 
345
+ #: language/strings.php:52
346
  msgid "admin_email"
347
  msgstr ""
348
 
349
+ #: language/strings.php:53
350
  msgid "users_can_register"
351
  msgstr ""
352
 
353
+ #: language/strings.php:54
354
  msgid "default_role"
355
  msgstr ""
356
 
357
+ #: language/strings.php:55
358
  msgid "timezone_string"
359
  msgstr ""
360
 
361
+ #: language/strings.php:56
362
  msgid "date_format"
363
  msgstr ""
364
 
365
+ #: language/strings.php:57
366
  msgid "time_format"
367
  msgstr ""
368
 
369
+ #: language/strings.php:58
370
  msgid "start_of_week"
371
  msgstr ""
372
 
373
+ #: language/strings.php:61
374
  msgid "use_smilies"
375
  msgstr ""
376
 
377
+ #: language/strings.php:62
378
  msgid "use_balanceTags"
379
  msgstr ""
380
 
381
+ #: language/strings.php:63
382
  msgid "default_category"
383
  msgstr ""
384
 
385
+ #: language/strings.php:64
386
  msgid "default_post_format"
387
  msgstr ""
388
 
389
+ #: language/strings.php:65
390
  msgid "mailserver_url"
391
  msgstr ""
392
 
393
+ #: language/strings.php:66
394
  msgid "mailserver_login"
395
  msgstr ""
396
 
397
+ #: language/strings.php:67
398
  msgid "mailserver_pass"
399
  msgstr ""
400
 
401
+ #: language/strings.php:68
402
  msgid "default_email_category"
403
  msgstr ""
404
 
405
+ #: language/strings.php:69
406
  msgid "ping_sites"
407
  msgstr ""
408
 
409
+ #: language/strings.php:72
410
  msgid "show_on_front"
411
  msgstr ""
412
 
413
+ #: language/strings.php:73
414
  msgid "page_on_front"
415
  msgstr ""
416
 
417
+ #: language/strings.php:74
418
  msgid "page_for_posts"
419
  msgstr ""
420
 
421
+ #: language/strings.php:75
422
  msgid "posts_per_page"
423
  msgstr ""
424
 
425
+ #: language/strings.php:76
426
  msgid "posts_per_rss"
427
  msgstr ""
428
 
429
+ #: language/strings.php:77
430
  msgid "rss_use_excerpt"
431
  msgstr ""
432
 
433
+ #: language/strings.php:78
434
  msgid "blog_public"
435
  msgstr ""
436
 
437
+ #: language/strings.php:81
438
  msgid "default_pingback_flag"
439
  msgstr ""
440
 
441
+ #: language/strings.php:82
442
  msgid "default_ping_status"
443
  msgstr ""
444
 
445
+ #: language/strings.php:83
446
  msgid "default_comment_status"
447
  msgstr ""
448
 
449
+ #: language/strings.php:84
450
  msgid "require_name_email"
451
  msgstr ""
452
 
453
+ #: language/strings.php:85
454
  msgid "comment_registration"
455
  msgstr ""
456
 
457
+ #: language/strings.php:86
458
  msgid "close_comments_for_old_posts"
459
  msgstr ""
460
 
461
+ #: language/strings.php:87
462
  msgid "close_comments_days_old"
463
  msgstr ""
464
 
465
+ #: language/strings.php:88
466
  msgid "thread_comments"
467
  msgstr ""
468
 
469
+ #: language/strings.php:89
470
  msgid "thread_comments_depth"
471
  msgstr ""
472
 
473
+ #: language/strings.php:90
474
  msgid "page_comments"
475
  msgstr ""
476
 
477
+ #: language/strings.php:91
478
  msgid "comments_per_page"
479
  msgstr ""
480
 
481
+ #: language/strings.php:92
482
  msgid "default_comments_page"
483
  msgstr ""
484
 
485
+ #: language/strings.php:93
486
  msgid "comment_order"
487
  msgstr ""
488
 
489
+ #: language/strings.php:94
490
  msgid "comments_notify"
491
  msgstr ""
492
 
493
+ #: language/strings.php:95
494
  msgid "moderation_notify"
495
  msgstr ""
496
 
497
+ #: language/strings.php:96
498
  msgid "comment_moderation"
499
  msgstr ""
500
 
501
+ #: language/strings.php:97
502
  msgid "comment_whitelist"
503
  msgstr ""
504
 
505
+ #: language/strings.php:98
506
  msgid "comment_max_links"
507
  msgstr ""
508
 
509
+ #: language/strings.php:99
510
  msgid "moderation_keys"
511
  msgstr ""
512
 
513
+ #: language/strings.php:100
514
  msgid "blacklist_keys"
515
  msgstr ""
516
 
517
+ #: language/strings.php:101
518
  msgid "show_avatars"
519
  msgstr ""
520
 
521
+ #: language/strings.php:102
522
  msgid "avatar_rating"
523
  msgstr ""
524
 
525
+ #: language/strings.php:103
526
  msgid "avatar_default"
527
  msgstr ""
528
 
529
+ #: language/strings.php:106
530
  msgid "thumbnail_size_w"
531
  msgstr ""
532
 
533
+ #: language/strings.php:107
534
  msgid "thumbnail_size_h"
535
  msgstr ""
536
 
537
+ #: language/strings.php:108
538
  msgid "thumbnail_crop"
539
  msgstr ""
540
 
541
+ #: language/strings.php:109
542
  msgid "medium_size_w"
543
  msgstr ""
544
 
545
+ #: language/strings.php:110
546
  msgid "medium_size_h"
547
  msgstr ""
548
 
549
+ #: language/strings.php:111
550
  msgid "large_size_w"
551
  msgstr ""
552
 
553
+ #: language/strings.php:112
554
  msgid "large_size_h"
555
  msgstr ""
556
 
557
+ #: language/strings.php:113
558
  msgid "uploads_use_yearmonth_folders"
559
  msgstr ""
560
 
561
+ #: language/strings.php:116
562
  msgid "permalink_structure"
563
  msgstr ""
564
 
565
+ #: language/strings.php:117
566
  msgid "category_base"
567
  msgstr ""
568
 
569
+ #: language/strings.php:118
570
  msgid "tag_base"
571
  msgstr ""
572
+
573
+ #: notifications/abstract-class-aal-notification-base.php:99
574
+ msgid "Object Type"
575
+ msgstr ""
576
+
577
+ #: notifications/abstract-class-aal-notification-base.php:100
578
+ msgid "Object Name"
579
+ msgstr ""
580
+
581
+ #: notifications/abstract-class-aal-notification-base.php:102
582
+ msgid "IP Address"
583
+ msgstr ""
584
+
585
+ #: notifications/abstract-class-aal-notification-base.php:121
586
+ msgid "N/A"
587
+ msgstr ""
588
+
589
+ #: notifications/class-aal-notification-email.php:15
590
+ msgid "Email"
591
+ msgstr ""
592
+
593
+ #: notifications/class-aal-notification-email.php:16
594
+ msgid "Get notified by Email."
595
+ msgstr ""
596
+
597
+ #: notifications/class-aal-notification-email.php:49
598
+ msgid "New notification from Activity Log"
599
+ msgstr ""
600
+
601
+ #: notifications/class-aal-notification-email.php:65
602
+ msgid ""
603
+ "Hi there!\n"
604
+ "\n"
605
+ "A notification condition on [sitename] was matched. Here are the details:\n"
606
+ "\n"
607
+ "[action-details]\n"
608
+ "\n"
609
+ "Sent by ARYO Activity Log"
610
+ msgstr ""
611
+
612
+ #: notifications/class-aal-notification-email.php:67
613
+ msgid "From Email"
614
+ msgstr ""
615
+
616
+ #: notifications/class-aal-notification-email.php:67
617
+ msgid "The source Email address"
618
+ msgstr ""
619
+
620
+ #: notifications/class-aal-notification-email.php:68
621
+ msgid "To Email"
622
+ msgstr ""
623
+
624
+ #: notifications/class-aal-notification-email.php:68
625
+ msgid "The Email address notifications will be sent to"
626
+ msgstr ""
627
+
628
+ #: notifications/class-aal-notification-email.php:69
629
+ msgid "Message"
630
+ msgstr ""
631
+
632
+ #: notifications/class-aal-notification-email.php:69
633
+ #, php-format
634
+ msgid "Customize the message using the following placeholders: %s"
635
+ msgstr ""
language/strings.php CHANGED
@@ -3,7 +3,7 @@
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  __( 'ARYO Activity Log', 'aryo-aal' );
6
- __( 'Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - its all these for you to see.', 'aryo-aal' );
7
 
8
  // Post
9
  __( 'Post', 'aryo-aal' );
3
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
 
5
  __( 'ARYO Activity Log', 'aryo-aal' );
6
+ __( 'Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it\'s all these for you to see.', 'aryo-aal' );
7
 
8
  // Post
9
  __( 'Post', 'aryo-aal' );
notifications/abstract-class-aal-notification-base.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ /**
5
+ * Base class, handles notifications
6
+ *
7
+ * Class AAL_Notification_Base
8
+ */
9
+ abstract class AAL_Notification_Base {
10
+ /**
11
+ * The following variables have to be defined for each payment method.
12
+ */
13
+ public $id = '';
14
+ public $name = '';
15
+ public $description = '';
16
+
17
+ public $aal_options;
18
+
19
+ public function __construct() {
20
+ $this->aal_options = AAL_Main::instance()->settings->get_options();
21
+
22
+ add_action( 'init', array( &$this, 'init' ), 30 );
23
+ add_action( 'aal_validate_options', array( &$this, '_validate_options' ), 10, 2 );
24
+ }
25
+
26
+ public function init() {}
27
+
28
+ /**
29
+ * Registers the settings for this individual extension
30
+ */
31
+ public function settings_fields() {}
32
+
33
+ /**
34
+ * Exectutes when notification is due
35
+ */
36
+ public function trigger( $args ) {}
37
+
38
+ public function _settings_section_callback() {
39
+ echo '<p>' . $this->description . '</p>';
40
+ }
41
+
42
+ public function _settings_enabled_field_callback( $args = array() ) {
43
+ AAL_Settings_Fields::yesno_field( $args );
44
+ }
45
+
46
+ public function add_settings_field_helper( $option_name, $title, $callback, $description = '', $default_value = '' ) {
47
+ $settings_page_slug = AAL_Main::instance()->settings->slug();
48
+ $handler_options = isset( $this->aal_options["handler_options_{$this->id}"] )
49
+ ? $this->aal_options["handler_options_{$this->id}"] : array();
50
+
51
+ add_settings_field(
52
+ "notification_handler_{$this->id}_{$option_name}",
53
+ $title,
54
+ $callback,
55
+ $settings_page_slug,
56
+ "notification_{$this->id}",
57
+ array(
58
+ 'name' => $this->settings_field_name_attr( $option_name ),
59
+ 'value' => isset( $handler_options[ $option_name ] ) ? $handler_options[ $option_name ] : $default_value,
60
+ 'desc' => $description,
61
+ 'id' => $option_name,
62
+ 'page' => $settings_page_slug,
63
+ )
64
+ );
65
+ }
66
+
67
+ public function _validate_options( $form_data, $aal_options ) {
68
+ $post_key = "notification_handler_options_{$this->id}";
69
+ $option_key = "handler_options_{$this->id}";
70
+
71
+ if ( ! isset( $_POST[ $post_key ] ) )
72
+ return $form_data;
73
+
74
+ $input = $_POST[ $post_key ];
75
+ $output = ( method_exists( $this, 'validate_options' ) ) ? $this->validate_options( $input ) : array();
76
+ $form_data[ $option_key ] = $output;
77
+
78
+ return $form_data;
79
+ }
80
+
81
+ private function settings_field_name_attr( $name ) {
82
+ return esc_attr( "notification_handler_options_{$this->id}[{$name}]" );
83
+ }
84
+
85
+ public function get_handler_options() {
86
+ $handler_options = array();
87
+ $option_key = "handler_options_{$this->id}";
88
+
89
+ if ( isset( $this->aal_options[ $option_key ] ) ) {
90
+ $handler_options = (array) $this->aal_options[ $option_key ];
91
+ }
92
+
93
+ return $handler_options;
94
+ }
95
+
96
+ public function prep_notification_body( $args ) {
97
+ $details_to_provide = array(
98
+ 'user_id' => __( 'User', 'aryo-aal' ),
99
+ 'object_type' => __( 'Object Type', 'aryo-aal' ),
100
+ 'object_name' => __( 'Object Name', 'aryo-aal' ),
101
+ 'action' => __( 'Action Type', 'aryo-aal' ),
102
+ 'hist_ip' => __( 'IP Address', 'aryo-aal' ),
103
+ );
104
+ $message = '';
105
+
106
+ foreach ( $details_to_provide as $detail_key => $detail_title ) {
107
+ $detail_val = '';
108
+
109
+ switch ( $detail_key ) {
110
+ case 'user_id':
111
+ if ( is_numeric( $args[ $detail_key ] ) ) {
112
+ // this is a user ID
113
+ $user = new WP_User( $args[ $detail_key ] );
114
+
115
+ if ( ! is_wp_error( $user ) ) {
116
+ $detail_val = sprintf( '<a href="%s">%s</a>', esc_url( get_edit_user_link( $user->ID ) ), esc_html( $user->display_name ) );
117
+ }
118
+ }
119
+ break;
120
+ default:
121
+ $detail_val = isset( $args[ $detail_key ] ) ? $args[ $detail_key ] : __( 'N/A', 'aryo-aal' );
122
+ break;
123
+ }
124
+
125
+ $message .= sprintf( "<strong>%s</strong> - %s<br>\n", $detail_title, $detail_val );
126
+ }
127
+
128
+ return $message;
129
+ }
130
+ }
131
+
132
+ function aal_register_notification_handler( $classname = '' ) {
133
+ return AAL_Main::instance()->notifications->register_handler( $classname );
134
+ }
notifications/class-aal-notification-email.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ class AAL_Notification_Email extends AAL_Notification_Base {
5
+
6
+ /**
7
+ * Store options in a class locally
8
+ */
9
+ protected $options = array();
10
+
11
+ public function __construct() {
12
+ parent::__construct();
13
+
14
+ $this->id = 'email';
15
+ $this->name = __( 'Email', 'aryo-aal' );
16
+ $this->description = __( 'Get notified by Email.', 'aryo-aal' );
17
+ }
18
+
19
+ public function init() {
20
+ $this->options = array_merge( array(
21
+ 'from_email' => get_option( 'admin_email' ),
22
+ // 'message_format' => __( "Hi there!\n\nA notification condition on [sitename] was matched. Here are the details:\n\n[action-details]\n\nSent by ARYO Activity Log", 'aryo-aal' )
23
+ ), $this->get_handler_options() );
24
+ }
25
+
26
+ public function trigger( $args ) {
27
+ $from_email = isset( $this->options['from_email'] ) && is_email( $this->options['from_email'] ) ? $this->options['from_email'] : '';
28
+ $to_email = isset( $this->options['to_email'] ) && is_email( $this->options['to_email'] ) ? $this->options['to_email'] : '';
29
+
30
+ // if no from email or to email provided, quit.
31
+ if ( ! ( $from_email || $to_email ) )
32
+ return;
33
+
34
+ $format = isset( $this->options['message_format'] ) ? $this->options['message_format'] : '';
35
+ $body = $this->prep_notification_body( $args );
36
+ $site_name = get_bloginfo( 'name' );
37
+ $site_name_link = sprintf( '<a href="%s">%s</a>', home_url(), $site_name );
38
+
39
+ $email_contents = strtr( $format, array(
40
+ '[sitename]' => $site_name_link,
41
+ '[action-details]' => $body,
42
+ ) );
43
+
44
+ // set the content type
45
+ add_filter( 'wp_mail_content_type', array( &$this, 'email_content_type' ) );
46
+
47
+ wp_mail(
48
+ $to_email,
49
+ __( 'New notification from Activity Log', 'aryo-aal' ),
50
+ $email_contents,
51
+ array(
52
+ "From: Activity Log @ $site_name <$from_email>"
53
+ )
54
+ );
55
+
56
+ // reset back to how it was before
57
+ remove_filter( 'wp_mail_content_type', array( &$this, 'email_content_type' ) );
58
+ }
59
+
60
+ public function email_content_type() {
61
+ return apply_filters( 'aal_notification_email_content_type', 'text/html' );
62
+ }
63
+
64
+ public function settings_fields() {
65
+ $default_email_message = __( "Hi there!\n\nA notification condition on [sitename] was matched. Here are the details:\n\n[action-details]\n\nSent by ARYO Activity Log", 'aryo-aal' );
66
+
67
+ $this->add_settings_field_helper( 'from_email', __( 'From Email', 'aryo-aal' ), array( 'AAL_Settings_Fields', 'text_field' ), __( 'The source Email address', 'aryo-aal' ) );
68
+ $this->add_settings_field_helper( 'to_email', __( 'To Email', 'aryo-aal' ), array( 'AAL_Settings_Fields', 'text_field' ), __( 'The Email address notifications will be sent to', 'aryo-aal' ) );
69
+ $this->add_settings_field_helper( 'message_format', __( 'Message', 'aryo-aal' ), array( 'AAL_Settings_Fields', 'textarea_field' ), sprintf( __( 'Customize the message using the following placeholders: %s', 'aryo-aal' ), '[sitename], [action-details]' ), $default_email_message );
70
+ }
71
+
72
+ public function validate_options( $input ) {
73
+ $output = array();
74
+ $email_fields = array( 'to_email', 'from_email' );
75
+
76
+ foreach ( $email_fields as $email_field ) {
77
+ if ( isset( $input[ $email_field ] ) && is_email( $input[ $email_field ] ) )
78
+ $output[ $email_field ] = $input[ $email_field ];
79
+ }
80
+
81
+ // email template message
82
+ if ( ! empty( $input['message_format'] ) ) {
83
+ $output['message_format'] = $input['message_format'];
84
+ }
85
+
86
+ return $output;
87
+ }
88
+ }
89
+
90
+ // Register this handler, creates an instance of this class when necessary.
91
+ aal_register_notification_handler( 'AAL_Notification_Email' );
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === ARYO Activity Log ===
2
  Contributors: KingYes, ariel.k, maor
3
- Tags: access, administration, activity, community, event, monitor, multisite, multi-users, log, logger, login, network, stats, security, tracking, madeinisrael, woocommerce
4
  Requires at least: 3.5
5
  Tested up to: 3.9
6
- Stable tag: 2.0.7
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
@@ -35,6 +35,7 @@ If you have tens of users or more, you really can’t know who did it. This plug
35
  * and much more..
36
 
37
  <h4>What people are saying</h4>
 
38
  * <em>“Optimized code - The plugin itself is blazing fast and leaves almost no footprint on the server.”</em> - [freshtechtips.com](http://www.freshtechtips.com/2014/01/best-audit-trail-plugins-for-wordpress.html)
39
  * <em>“The plugin successful for activity log for wordpress.”</em> - [wp-tricks.co.il](http://www.wp-tricks.co.il/2013/08/%D7%99%D7%95%D7%9E%D7%9F-%D7%A4%D7%A2%D7%99%D7%9C%D7%95%D7%AA-%D7%9C%D7%95%D7%95%D7%A8%D7%93%D7%A4%D7%A8%D7%A1-aryo-activity-log/)
40
  * <em>“This is a pretty simple yet quite effective plugin for keeping track of what your admins and users do on your sites.”</em> - [shadowdragonunlimited.com](http://shadowdragonunlimited.com/plugin-of-the-week-9302013-aryo-activity-log/plugin-of-the-week/)
@@ -44,7 +45,7 @@ If you have tens of users or more, you really can’t know who did it. This plug
44
  * German (de_DE) - [Robert Harm](http://www.mapsmarker.com/)
45
  * Serbo-Croatian (sr_RS) - [Borisa Djuraskovic](http://www.webhostinghub.com/)
46
  * Danish (da_DK) - [Morten Dalgaard Johansen](http://www.iosoftgame.com/)
47
- * Hebrew (he_IL) + RTL Support - [ARYO Digital](http://www.aryodigital.com/)
48
  * Armenia (hy_AM) - Hayk Jomardyan
49
 
50
  The plugin does not require any kind of setup. It works out of the box (and that’s why we love it too).
@@ -53,7 +54,7 @@ We’re planning to add a lot more features in the upcoming releases. If you thi
53
 
54
  <strong>Contributions:</strong><br />
55
 
56
- Would you like to like to cotribute to Activity Log? You are more than welcome to submit your pull requests on the [GitHub repo](https://github.com/KingYes/wordpress-aryo-activity-log). Also, if you have any notes about the code, please open a ticket on ths issue tracker.
57
 
58
 
59
  == Installation ==
@@ -80,9 +81,13 @@ Would you like to like to cotribute to Activity Log? You are more than welcome t
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
83
  = 2.0.7 =
84
- * Tested up to WordPress 3.9
85
- * More really nice things will be goin later
86
 
87
  = 2.0.6 =
88
  * Fixed! Random fatal error ([topic](https://github.com/KingYes/wordpress-aryo-activity-log/issues/32))
1
  === ARYO Activity Log ===
2
  Contributors: KingYes, ariel.k, maor
3
+ Tags: access, administration, activity, community, event, monitor, multisite, multi-users, log, logger, audit log, login, network, stats, security, tracking, madeinisrael, woocommerce
4
  Requires at least: 3.5
5
  Tested up to: 3.9
6
+ Stable tag: 2.1.0
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
35
  * and much more..
36
 
37
  <h4>What people are saying</h4>
38
+ * <em>“Thanks to this step, we’ve discovered that our site was undergoing a brute force attack”</em> - [artdriver.com](http://www.artdriver.com/wordpress-site-hacked-solution-time/)
39
  * <em>“Optimized code - The plugin itself is blazing fast and leaves almost no footprint on the server.”</em> - [freshtechtips.com](http://www.freshtechtips.com/2014/01/best-audit-trail-plugins-for-wordpress.html)
40
  * <em>“The plugin successful for activity log for wordpress.”</em> - [wp-tricks.co.il](http://www.wp-tricks.co.il/2013/08/%D7%99%D7%95%D7%9E%D7%9F-%D7%A4%D7%A2%D7%99%D7%9C%D7%95%D7%AA-%D7%9C%D7%95%D7%95%D7%A8%D7%93%D7%A4%D7%A8%D7%A1-aryo-activity-log/)
41
  * <em>“This is a pretty simple yet quite effective plugin for keeping track of what your admins and users do on your sites.”</em> - [shadowdragonunlimited.com](http://shadowdragonunlimited.com/plugin-of-the-week-9302013-aryo-activity-log/plugin-of-the-week/)
45
  * German (de_DE) - [Robert Harm](http://www.mapsmarker.com/)
46
  * Serbo-Croatian (sr_RS) - [Borisa Djuraskovic](http://www.webhostinghub.com/)
47
  * Danish (da_DK) - [Morten Dalgaard Johansen](http://www.iosoftgame.com/)
48
+ * Hebrew (he_IL) + RTL Support - [Aryo Digital](http://www.aryodigital.com/)
49
  * Armenia (hy_AM) - Hayk Jomardyan
50
 
51
  The plugin does not require any kind of setup. It works out of the box (and that’s why we love it too).
54
 
55
  <strong>Contributions:</strong><br />
56
 
57
+ Would you like to like to contribute to Activity Log? You are more than welcome to submit your pull requests on the [GitHub repo](https://github.com/KingYes/wordpress-aryo-activity-log). Also, if you have any notes about the code, please open a ticket on ths issue tracker.
58
 
59
 
60
  == Installation ==
81
 
82
  == Changelog ==
83
 
84
+ = 2.1.0 =
85
+ * New! Personally-tailored notifications that can be triggered by various types of events, users and action type (currently only email notifications are supported)
86
+ * Bug fixes, stability improvements
87
+ * Fixed an error that occurred on PHP 5.5
88
+
89
  = 2.0.7 =
90
+ * Tested up to WordPress v3.9.
 
91
 
92
  = 2.0.6 =
93
  * Fixed! Random fatal error ([topic](https://github.com/KingYes/wordpress-aryo-activity-log/issues/32))