mirror of
https://ghproxy.net/https://github.com/elementor/activity-log.git
synced 2025-10-04 01:30:46 +08:00
Tweak: Change to plural instead of singular naming according
This commit is contained in:
parent
6698ae09fe
commit
2c63868e61
11 changed files with 165 additions and 112 deletions
|
@ -6,13 +6,13 @@ if ( ! class_exists( 'WP_List_Table' ) )
|
|||
|
||||
|
||||
class AAL_Activity_Log_List_Table extends WP_List_Table {
|
||||
|
||||
|
||||
protected $_roles = array();
|
||||
|
||||
|
||||
protected $_caps = array();
|
||||
|
||||
|
||||
protected $_allow_caps = array();
|
||||
|
||||
|
||||
protected function _get_allow_caps() {
|
||||
if ( empty( $this->_allow_caps ) ) {
|
||||
$user = get_user_by( 'id', get_current_user_id() );
|
||||
|
@ -63,14 +63,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
$where = array();
|
||||
foreach ( $allow_modules as $type )
|
||||
$where[] .= '`object_type` = \'' . $type . '\'';
|
||||
|
||||
|
||||
$where_caps = array();
|
||||
foreach ( $this->_get_allow_caps() as $cap )
|
||||
$where_caps[] .= '`user_caps` = \'' . $cap . '\'';
|
||||
|
||||
return 'AND (' . implode( ' OR ', $where ) . ') AND (' . implode( ' OR ', $where_caps ) . ')';
|
||||
}
|
||||
|
||||
|
||||
public function get_action_label( $action ) {
|
||||
return ucwords( str_replace( '_', ' ', __( $action, 'aryo-activity-log' ) ) );
|
||||
}
|
||||
|
@ -82,18 +82,55 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->_roles = apply_filters(
|
||||
'aal_init_roles',
|
||||
array(
|
||||
// admin
|
||||
'manage_options' => array( 'Core', 'Export', 'Post', 'Taxonomy', 'User', 'Options', 'Attachment', 'Plugin', 'Widget', 'Theme', 'Menu', 'Comments' ),
|
||||
'manage_options' => array(
|
||||
'Core',
|
||||
'Export',
|
||||
'Posts',
|
||||
'Taxonomies',
|
||||
'Users',
|
||||
'Options',
|
||||
'Attachments',
|
||||
'Plugins',
|
||||
'Widgets',
|
||||
'Themes',
|
||||
'Menus',
|
||||
'Comments',
|
||||
|
||||
// BC
|
||||
'Post',
|
||||
'Taxonomy',
|
||||
'User',
|
||||
'Plugin',
|
||||
'Widget',
|
||||
'Theme',
|
||||
'Menu',
|
||||
),
|
||||
// editor
|
||||
'edit_pages' => array( 'Post', 'Taxonomy', 'Attachment', 'Comments' ),
|
||||
'edit_pages' => array(
|
||||
'Posts',
|
||||
'Taxonomies',
|
||||
'Attachments',
|
||||
'Comments',
|
||||
|
||||
// BC
|
||||
'Post',
|
||||
'Taxonomy',
|
||||
'Attachment',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$default_rules = array( 'administrator', 'editor', 'author', 'guest' );
|
||||
$default_rules = array(
|
||||
'administrator',
|
||||
'editor',
|
||||
'author',
|
||||
'guest',
|
||||
);
|
||||
|
||||
global $wp_roles;
|
||||
|
||||
|
@ -106,8 +143,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
'aal_init_caps',
|
||||
array(
|
||||
'administrator' => array_unique( array_merge( $default_rules, $all_roles ) ),
|
||||
'editor' => array( 'editor', 'author', 'guest' ),
|
||||
'author' => array( 'author', 'guest' ),
|
||||
'editor' => array( 'editor', 'author', 'guest' ),
|
||||
'author' => array( 'author', 'guest' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -137,7 +174,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
|
||||
public function get_sortable_columns() {
|
||||
return array(
|
||||
'ip' => 'hist_ip',
|
||||
|
@ -147,7 +184,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
public function column_default( $item, $column_name ) {
|
||||
$return = '';
|
||||
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'action' :
|
||||
$return = $this->get_action_label( $item->action );
|
||||
|
@ -166,13 +203,13 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
}
|
||||
|
||||
$return = apply_filters( 'aal_table_list_column_default', $return, $item, $column_name );
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public function column_author( $item ) {
|
||||
global $wp_roles;
|
||||
|
||||
|
||||
if ( ! empty( $item->user_id ) && 0 !== (int) $item->user_id ) {
|
||||
$user = get_user_by( 'id', $item->user_id );
|
||||
if ( $user instanceof WP_User && 0 !== $user->ID ) {
|
||||
|
@ -193,7 +230,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
public function column_type( $item ) {
|
||||
$return = __( $item->object_type, 'aryo-activity-log' );
|
||||
|
||||
|
||||
$return = apply_filters( 'aal_table_list_column_type', $return, $item );
|
||||
return $return;
|
||||
}
|
||||
|
@ -208,13 +245,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
$return = apply_filters( 'aal_table_list_column_label', $return, $item );
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public function column_description( $item ) {
|
||||
$return = esc_html( $item->object_name );
|
||||
$actions = [];
|
||||
|
||||
|
||||
switch ( $item->object_type ) {
|
||||
case 'Post' :
|
||||
case 'Post':
|
||||
case 'Posts':
|
||||
$actions = [
|
||||
'view' => sprintf( '<a href="%s">%s</a>', get_permalink( $item->object_id ), __( 'View', 'aryo-activity-log' ) ),
|
||||
'edit' => sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) ),
|
||||
|
@ -222,8 +260,9 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
$return = esc_html( $item->object_name );
|
||||
break;
|
||||
|
||||
case 'Taxonomy' :
|
||||
|
||||
case 'Taxonomy':
|
||||
case 'Taxonomies':
|
||||
if ( ! empty( $item->object_id ) ) {
|
||||
if ( is_taxonomy_viewable( $item->object_subtype ) ) {
|
||||
$term_view_link = get_term_link( absint( $item->object_id ), $item->object_subtype );
|
||||
|
@ -241,8 +280,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
$return = esc_html( $item->object_name );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Comments' :
|
||||
|
||||
case 'Comments':
|
||||
if ( ! empty( $item->object_id ) && $comment = get_comment( $item->object_id ) ) {
|
||||
$actions['edit'] = sprintf( '<a href="%s">%s</a>', get_edit_comment_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) );
|
||||
}
|
||||
|
@ -250,7 +289,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
$return = esc_html( "{$item->object_name} #{$item->object_id}" );
|
||||
break;
|
||||
|
||||
case 'User' :
|
||||
case 'User':
|
||||
case 'Users':
|
||||
$user_edit_link = get_edit_user_link( $item->object_id );
|
||||
if ( ! empty( $user_edit_link ) ) {
|
||||
$actions['edit'] = sprintf( '<a href="%s">%s</a>', $user_edit_link, __( 'Edit', 'aryo-activity-log' ) );
|
||||
|
@ -260,8 +300,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
$return = __( 'Username:', 'aryo-activity-log' ) . ' ' . $item->object_name;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Export' :
|
||||
|
||||
case 'Export':
|
||||
if ( 'all' === $item->object_name ) {
|
||||
$return = __( 'All', 'aryo-activity-log' );
|
||||
} else {
|
||||
|
@ -270,12 +310,12 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
}
|
||||
break;
|
||||
|
||||
case 'Options' :
|
||||
case 'Core' :
|
||||
case 'Options':
|
||||
case 'Core':
|
||||
$return = __( $item->object_name, 'aryo-activity-log' );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$return = apply_filters( 'aal_table_list_column_description', $return, $item );
|
||||
|
||||
if ( ! empty( $actions ) ) {
|
||||
|
@ -289,10 +329,10 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
}
|
||||
$return .= '</div>';
|
||||
}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
public function display_tablenav( $which ) {
|
||||
if ( 'top' == $which ) {
|
||||
$this->search_box( __( 'Search', 'aryo-activity-log' ), 'aal-search' );
|
||||
|
@ -307,7 +347,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
public function extra_tablenav_footer() {
|
||||
/**
|
||||
* Filter list of record actions
|
||||
|
@ -325,15 +365,15 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php else :
|
||||
<?php else :
|
||||
$action_title = reset( $actions );
|
||||
$action_key = key( $actions );
|
||||
?>
|
||||
<input type="hidden" name="aal-record-action" value="<?php echo esc_attr( $action_key ); ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<button type="submit" name="aal-record-actions-submit" id="record-actions-submit" class="button button-primary" value="1">
|
||||
<?php
|
||||
<?php
|
||||
// Is result filtering enabled?
|
||||
if ( array_key_exists( 'aal-filter', $_GET ) ) {
|
||||
echo sprintf( esc_html__( 'Export filtered records as %s', 'aryo-activity-log' ), $action_title );
|
||||
|
@ -342,14 +382,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
}
|
||||
?>
|
||||
</button>
|
||||
|
||||
|
||||
<?php wp_nonce_field( 'aal_actions_nonce', 'aal_actions_nonce' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function extra_tablenav( $which ) {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
if ( 'bottom' === $which ) {
|
||||
$this->extra_tablenav_footer();
|
||||
}
|
||||
|
@ -414,7 +454,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
||||
|
||||
if ( ! isset( $_REQUEST['usershow'] ) )
|
||||
$_REQUEST['usershow'] = '';
|
||||
|
||||
|
@ -480,10 +520,10 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
public function prepare_items() {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$items_per_page = $this->get_items_per_page( 'edit_aal_logs_per_page', 20 );
|
||||
$this->_column_headers = array( $this->get_columns(), get_hidden_columns( $this->screen ), $this->get_sortable_columns() );
|
||||
$where = ' WHERE 1 = 1';
|
||||
|
@ -494,7 +534,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
if ( ! isset( $_REQUEST['orderby'] ) || ! in_array( $_REQUEST['orderby'], array( 'hist_time', 'hist_ip' ) ) ) {
|
||||
$_REQUEST['orderby'] = 'hist_time';
|
||||
}
|
||||
|
||||
|
||||
if ( ! empty( $_REQUEST['typeshow'] ) ) {
|
||||
$where .= $wpdb->prepare( ' AND `object_type` = %s', $_REQUEST['typeshow'] );
|
||||
}
|
||||
|
@ -517,7 +557,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
// Today
|
||||
$start_time = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );;
|
||||
$end_time = mktime( 23, 59, 59, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
|
||||
|
||||
|
||||
if ( 'yesterday' === $_REQUEST['dateshow'] ) {
|
||||
$start_time = strtotime( 'yesterday', $start_time );
|
||||
$end_time = mktime( 23, 59, 59, date( 'm', $start_time ), date( 'd', $start_time ), date( 'Y', $start_time ) );
|
||||
|
@ -526,7 +566,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
} elseif ( 'month' === $_REQUEST['dateshow'] ) {
|
||||
$start_time = strtotime( '-1 month', $start_time );
|
||||
}
|
||||
|
||||
|
||||
$where .= $wpdb->prepare( ' AND `hist_time` > %d AND `hist_time` < %d', $start_time, $end_time );
|
||||
}
|
||||
|
||||
|
@ -537,7 +577,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
|
||||
$offset = ( $this->get_pagenum() - 1 ) * $items_per_page;
|
||||
|
||||
|
||||
|
||||
$total_items = $wpdb->get_var(
|
||||
'SELECT COUNT(`histid`) FROM `' . $wpdb->activity_log . '`
|
||||
' . $where . '
|
||||
|
@ -570,7 +610,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
|
|||
'total_pages' => ceil( $total_items / $items_per_page ),
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
public function set_screen_option( $status, $option, $value ) {
|
||||
if ( 'edit_aal_logs_per_page' === $option )
|
||||
return $value;
|
||||
|
|
|
@ -9,27 +9,27 @@ class AAL_Hooks {
|
|||
|
||||
// TODO: Maybe I will use with glob() function for this.
|
||||
// Load all our hooks.
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-user.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-attachment.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-menu.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-users.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-attachments.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-menus.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-options.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-plugins.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-posts.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-taxonomy.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-theme.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-taxonomies.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-themes.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-widgets.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-core.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-export.php' );
|
||||
include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-comments.php' );
|
||||
|
||||
new AAL_Hook_User();
|
||||
new AAL_Hook_Attachment();
|
||||
new AAL_Hook_Menu();
|
||||
new AAL_Hook_Users();
|
||||
new AAL_Hook_Attachments();
|
||||
new AAL_Hook_Menus();
|
||||
new AAL_Hook_Options();
|
||||
new AAL_Hook_Plugins();
|
||||
new AAL_Hook_Posts();
|
||||
new AAL_Hook_Taxonomy();
|
||||
new AAL_Hook_Theme();
|
||||
new AAL_Hook_Taxonomies();
|
||||
new AAL_Hook_Themes();
|
||||
new AAL_Hook_Widgets();
|
||||
new AAL_Hook_Core();
|
||||
new AAL_Hook_Export();
|
||||
|
|
|
@ -65,16 +65,25 @@ class AAL_Notifications {
|
|||
array(
|
||||
'Core',
|
||||
'Export',
|
||||
'Posts',
|
||||
'Taxonomies',
|
||||
'Users',
|
||||
'Options',
|
||||
'Attachments',
|
||||
'Plugins',
|
||||
'Widgets',
|
||||
'Themes',
|
||||
'Menus',
|
||||
'Comments',
|
||||
|
||||
// BC
|
||||
'Post',
|
||||
'Taxonomy',
|
||||
'User',
|
||||
'Options',
|
||||
'Attachment',
|
||||
'Plugin',
|
||||
'Widget',
|
||||
'Theme',
|
||||
'Menu',
|
||||
'Comments',
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class AAL_Hook_Attachment extends AAL_Hook_Base {
|
||||
class AAL_Hook_Attachments extends AAL_Hook_Base {
|
||||
|
||||
protected function _add_log_attachment( $action, $attachment_id ) {
|
||||
$post = get_post( $attachment_id );
|
||||
|
||||
aal_insert_log( array(
|
||||
'action' => $action,
|
||||
'object_type' => 'Attachment',
|
||||
'object_type' => 'Attachments',
|
||||
'object_subtype' => $post->post_type,
|
||||
'object_id' => $attachment_id,
|
||||
'object_name' => esc_html( get_the_title( $post->ID ) ),
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class AAL_Hook_Menu extends AAL_Hook_Base {
|
||||
class AAL_Hook_Menus extends AAL_Hook_Base {
|
||||
|
||||
public function hooks_menu_created_or_updated( $nav_menu_selected_id ) {
|
||||
if ( $menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ) ) {
|
||||
|
@ -13,7 +13,7 @@ class AAL_Hook_Menu extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => $action,
|
||||
'object_type' => 'Menu',
|
||||
'object_type' => 'Menus',
|
||||
'object_name' => $menu_object->name,
|
||||
) );
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class AAL_Hook_Menu extends AAL_Hook_Base {
|
|||
public function hooks_menu_deleted( $term, $tt_id, $deleted_term ) {
|
||||
aal_insert_log( array(
|
||||
'action' => 'deleted',
|
||||
'object_type' => 'Menu',
|
||||
'object_type' => 'Menus',
|
||||
'object_name' => $deleted_term->name,
|
||||
) );
|
||||
}
|
|
@ -15,7 +15,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => $action,
|
||||
'object_type' => 'Plugin',
|
||||
'object_type' => 'Plugins',
|
||||
'object_id' => 0,
|
||||
'object_name' => $plugin_name,
|
||||
)
|
||||
|
@ -35,7 +35,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
|
|||
if ( ( ! empty( $_POST ) && 'update' === $_REQUEST['action'] ) ) {
|
||||
$aal_args = array(
|
||||
'action' => 'file_updated',
|
||||
'object_type' => 'Plugin',
|
||||
'object_type' => 'Plugins',
|
||||
'object_subtype' => 'plugin_unknown',
|
||||
'object_id' => 0,
|
||||
'object_name' => 'file_unknown',
|
||||
|
@ -76,7 +76,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'installed',
|
||||
'object_type' => 'Plugin',
|
||||
'object_type' => 'Plugins',
|
||||
'object_name' => $data['Name'],
|
||||
'object_subtype' => $data['Version'],
|
||||
)
|
||||
|
@ -99,7 +99,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'updated',
|
||||
'object_type' => 'Plugin',
|
||||
'object_type' => 'Plugins',
|
||||
'object_name' => $data['Name'],
|
||||
'object_subtype' => $data['Version'],
|
||||
)
|
||||
|
|
|
@ -16,19 +16,15 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
|
|||
if ( 'auto-draft' === $old_status && ( 'auto-draft' !== $new_status && 'inherit' !== $new_status ) ) {
|
||||
// page created
|
||||
$action = 'created';
|
||||
}
|
||||
elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) {
|
||||
} elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) {
|
||||
// nvm.. ignore it.
|
||||
return;
|
||||
}
|
||||
elseif ( 'trash' === $new_status ) {
|
||||
} elseif ( 'trash' === $new_status ) {
|
||||
// page was deleted.
|
||||
$action = 'trashed';
|
||||
}
|
||||
elseif ( 'trash' === $old_status ) {
|
||||
} elseif ( 'trash' === $old_status ) {
|
||||
$action = 'restored';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// page updated. I guess.
|
||||
$action = 'updated';
|
||||
}
|
||||
|
@ -43,7 +39,7 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => $action,
|
||||
'object_type' => 'Post',
|
||||
'object_type' => 'Posts',
|
||||
'object_subtype' => $post->post_type,
|
||||
'object_id' => $post->ID,
|
||||
'object_name' => $this->_draft_or_post_title( $post->ID ),
|
||||
|
@ -71,7 +67,7 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'deleted',
|
||||
'object_type' => 'Post',
|
||||
'object_type' => 'Posts',
|
||||
'object_subtype' => $post->post_type,
|
||||
'object_id' => $post->ID,
|
||||
'object_name' => $this->_draft_or_post_title( $post->ID ),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class AAL_Hook_Taxonomy extends AAL_Hook_Base {
|
||||
class AAL_Hook_Taxonomies extends AAL_Hook_Base {
|
||||
|
||||
public function hooks_created_edited_deleted_term( $term_id, $tt_id, $taxonomy, $deleted_term = null ) {
|
||||
// Make sure do not action nav menu taxonomy.
|
||||
|
@ -25,7 +25,7 @@ class AAL_Hook_Taxonomy extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => $action,
|
||||
'object_type' => 'Taxonomy',
|
||||
'object_type' => 'Taxonomies',
|
||||
'object_subtype' => $taxonomy,
|
||||
'object_id' => $term_id,
|
||||
'object_name' => $term->name,
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class AAL_Hook_Theme extends AAL_Hook_Base {
|
||||
class AAL_Hook_Themes extends AAL_Hook_Base {
|
||||
|
||||
public function hooks_theme_modify( $location, $status ) {
|
||||
if ( false !== strpos( $location, 'theme-editor.php?file=' ) ) {
|
||||
if ( ! empty( $_POST ) && 'update' === $_POST['action'] ) {
|
||||
$aal_args = array(
|
||||
'action' => 'file_updated',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_subtype' => 'theme_unknown',
|
||||
'object_id' => 0,
|
||||
'object_name' => 'file_unknown',
|
||||
|
@ -32,7 +32,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'activated',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_subtype' => $new_theme->get_stylesheet(),
|
||||
'object_id' => 0,
|
||||
'object_name' => $new_name,
|
||||
|
@ -43,7 +43,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
|
|||
public function hooks_theme_customizer_modified( WP_Customize_Manager $obj ) {
|
||||
$aal_args = array(
|
||||
'action' => 'updated',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_subtype' => $obj->theme()->display( 'Name' ),
|
||||
'object_id' => 0,
|
||||
'object_name' => 'Theme Customizer',
|
||||
|
@ -74,7 +74,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'deleted',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_name' => $name,
|
||||
)
|
||||
);
|
||||
|
@ -101,7 +101,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'installed',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_name' => $name,
|
||||
'object_subtype' => $version,
|
||||
)
|
||||
|
@ -125,7 +125,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
|
|||
aal_insert_log(
|
||||
array(
|
||||
'action' => 'updated',
|
||||
'object_type' => 'Theme',
|
||||
'object_type' => 'Themes',
|
||||
'object_name' => $name,
|
||||
'object_subtype' => $version,
|
||||
)
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
class AAL_Hook_User extends AAL_Hook_Base {
|
||||
class AAL_Hook_Users extends AAL_Hook_Base {
|
||||
|
||||
public function hooks_user_register( $user_id ) {
|
||||
$user = get_user_by( 'id', $user_id );
|
||||
|
||||
aal_insert_log( array(
|
||||
'action' => 'registered',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Profile',
|
||||
'object_id' => $user->ID,
|
||||
'object_name' => $user->user_nicename,
|
||||
|
@ -19,7 +19,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => 'deleted',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Profile',
|
||||
'object_id' => $user->ID,
|
||||
'object_name' => $user->user_nicename,
|
||||
|
@ -29,7 +29,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
|
|||
public function hooks_wp_login( $user_login, $user ) {
|
||||
aal_insert_log( array(
|
||||
'action' => 'logged_in',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Session',
|
||||
'user_id' => $user->ID,
|
||||
'object_id' => $user->ID,
|
||||
|
@ -46,7 +46,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => 'logged_out',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Session',
|
||||
'user_id' => $user->ID,
|
||||
'object_id' => $user->ID,
|
||||
|
@ -59,7 +59,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => 'updated',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Profile',
|
||||
'object_id' => $user->ID,
|
||||
'object_name' => $user->user_nicename,
|
||||
|
@ -73,7 +73,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
|
|||
|
||||
aal_insert_log( array(
|
||||
'action' => 'failed_login',
|
||||
'object_type' => 'User',
|
||||
'object_type' => 'Users',
|
||||
'object_subtype' => 'Session',
|
||||
'user_id' => 0,
|
||||
'object_id' => 0,
|
|
@ -8,20 +8,20 @@ __( 'Get aware of any activities that are taking place on your dashboard! Imagin
|
|||
__( 'Administrator', 'aryo-activity-log' );
|
||||
__( 'Editor', 'aryo-activity-log' );
|
||||
|
||||
// Post
|
||||
__( 'Post', 'aryo-activity-log' );
|
||||
// Posts
|
||||
__( 'Posts', 'aryo-activity-log' );
|
||||
__( 'created', 'aryo-activity-log' );
|
||||
__( 'updated', 'aryo-activity-log' );
|
||||
__( 'deleted', 'aryo-activity-log' );
|
||||
__( 'trashed', 'aryo-activity-log' );
|
||||
__( 'restored', 'aryo-activity-log' );
|
||||
|
||||
// Attachment
|
||||
__( 'Attachment', 'aryo-activity-log' );
|
||||
// Attachments
|
||||
__( 'Attachments', 'aryo-activity-log' );
|
||||
__( 'uploaded', 'aryo-activity-log' );
|
||||
|
||||
// User
|
||||
__( 'User', 'aryo-activity-log' );
|
||||
// Users
|
||||
__( 'Users', 'aryo-activity-log' );
|
||||
__( 'logged_out', 'aryo-activity-log' );
|
||||
__( 'logged_in', 'aryo-activity-log' );
|
||||
__( 'failed_login', 'aryo-activity-log' );
|
||||
|
@ -29,27 +29,27 @@ __( 'registered', 'aryo-activity-log' );
|
|||
__( 'removed', 'aryo-activity-log' );
|
||||
|
||||
// Plugin
|
||||
__( 'Plugin', 'aryo-activity-log' );
|
||||
__( 'Plugins', 'aryo-activity-log' );
|
||||
__( 'activated', 'aryo-activity-log' );
|
||||
__( 'deactivated', 'aryo-activity-log' );
|
||||
__( 'installed', 'aryo-activity-log' );
|
||||
__( 'File Updated', 'aryo-activity-log' );
|
||||
|
||||
// Theme
|
||||
__( 'Theme', 'aryo-activity-log' );
|
||||
// Themes
|
||||
__( 'Themes', 'aryo-activity-log' );
|
||||
__( 'Theme Customizer', 'aryo-activity-log' );
|
||||
|
||||
// Widget
|
||||
__( 'Widget', 'aryo-activity-log' );
|
||||
// Widgets
|
||||
__( 'Widgets', 'aryo-activity-log' );
|
||||
|
||||
// Options
|
||||
__( 'Options', 'aryo-activity-log' );
|
||||
|
||||
// Menu
|
||||
__( 'Menu', 'aryo-activity-log' );
|
||||
// Menus
|
||||
__( 'Menus', 'aryo-activity-log' );
|
||||
|
||||
// Taxonomy
|
||||
__( 'Taxonomy', 'aryo-activity-log' );
|
||||
// Taxonomies
|
||||
__( 'Taxonomies', 'aryo-activity-log' );
|
||||
|
||||
// Core
|
||||
__( 'Core', 'aryo-activity-log' );
|
||||
|
@ -65,8 +65,6 @@ __( 'untrashed', 'aryo-activity-log' );
|
|||
__( 'spammed', 'aryo-activity-log' );
|
||||
__( 'unspammed', 'aryo-activity-log' );
|
||||
|
||||
|
||||
|
||||
// Translate Options?
|
||||
__( 'blogname', 'aryo-activity-log' );
|
||||
__( 'blogdescription', 'aryo-activity-log' );
|
||||
|
@ -143,3 +141,13 @@ __( 'tag_base', 'aryo-activity-log' );
|
|||
// Export
|
||||
__( 'Export', 'aryo-activity-log' );
|
||||
__( 'downloaded', 'aryo-activity-log' );
|
||||
|
||||
// BC:
|
||||
__( 'Post', 'aryo-activity-log' );
|
||||
__( 'Attachment', 'aryo-activity-log' );
|
||||
__( 'User', 'aryo-activity-log' );
|
||||
__( 'Plugin', 'aryo-activity-log' );
|
||||
__( 'Theme', 'aryo-activity-log' );
|
||||
__( 'Widget', 'aryo-activity-log' );
|
||||
__( 'Menu', 'aryo-activity-log' );
|
||||
__( 'Taxonomy', 'aryo-activity-log' );
|
Loading…
Add table
Add a link
Reference in a new issue