Skip to content

Commit 1156b7f

Browse files
committed
Merge branch 'release/2.0.0'
2 parents 0c37767 + e24ff97 commit 1156b7f

92 files changed

Lines changed: 7587 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
/vendor
3+
.log

.travis.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
language: php
2+
3+
notifications:
4+
email:
5+
on_success: never
6+
on_failure: change
7+
8+
branches:
9+
only:
10+
- master
11+
- develop
12+
13+
php:
14+
- 5.3
15+
- 5.4
16+
- 5.5
17+
- 5.6
18+
- 7.0
19+
- 7.1
20+
21+
before_script:
22+
- composer update
23+
- composer global require wp-coding-standards/wpcs
24+
- phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
25+
26+
script:
27+
- phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php')
28+
- phpunit

advanced-cron-manager.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Plugin Name: Advanced Cron Manager
4+
* Description: View, pause, remove, edit and add WP Cron events.
5+
* Version: 2.0.0
6+
* Author: underDEV
7+
* Author URI: https://underdev.it
8+
* License: GPL3
9+
* Text Domain: advanced-cron-manager
10+
*/
11+
12+
/**
13+
* Fire up Composer's autoloader
14+
*/
15+
require_once( 'vendor/autoload.php' );
16+
17+
/**
18+
* Check minimum requirements of the plugin
19+
* @param string $php_ver The minimum PHP version.
20+
* @param string $wp_ver The minimum WP version.
21+
* @param string $name The name of the theme/plugin to check.
22+
* @param array $plugins Required plugins format plugin_path/plugin_name.
23+
*/
24+
$requirements = new Minimum_Requirements( '5.3.9', '3.6', __( 'Advanced Cron Manager', 'advanced-cron-manager' ), array() );
25+
26+
/**
27+
* Check compatibility on activation
28+
*/
29+
register_activation_hook( __FILE__, array( $requirements, 'check_compatibility_on_install' ) );
30+
31+
/**
32+
* If it is already installed and activated check if example new version is compatible,
33+
* if is not don't load plugin code and print admin_notice
34+
*/
35+
if ( ! $requirements->is_compatible_version() ) {
36+
add_action( 'admin_notices', array( $requirements, 'load_plugin_admin_notices' ) );
37+
return;
38+
}
39+
40+
$acm_pro_version = @get_file_data( WP_PLUGIN_DIR . '/advanced-cron-manager-pro/acm-pro.php', array( 'Version' ) )[0];
41+
42+
if ( ! empty( $acm_pro_version ) && version_compare( $acm_pro_version, '2', '<' ) ) {
43+
add_action( 'admin_notices', function() {
44+
echo '<div class="error"><p>' . __( 'Advanced Cron Manager in version 2 needs Advanced Cron Manager PRO also in version 2. Please upgrade.', 'advanced-cron-manager' ) . '</p></div>';
45+
} );
46+
}
47+
48+
/**
49+
* Fire up dependency injection container
50+
*/
51+
$container = new tad_DI52_Container();
52+
53+
$container->setVar( 'plugin_file', __FILE__ );
54+
$container->setVar( 'plugin_version', '2.0' );
55+
56+
// Registers all classes and their dependencies
57+
$container->register( 'underDEV\AdvancedCronManager\RuntimeProvider' );

assets/dist/css/style.css

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/dist/js/scripts.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/src/js/bulk-actions.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
( function( $ ) {
2+
3+
////////////
4+
// Action //
5+
////////////
6+
7+
$( '.tools_page_advanced-cron-manager' ).on( 'click', '.tablenav .action', function( event ) {
8+
9+
event.preventDefault();
10+
11+
var $apply_button = $( this );
12+
var $select_input = $( this ).prev( 'select' );
13+
var action = $select_input.val();
14+
15+
if ( action != '-1' ) {
16+
17+
$apply_button.attr( 'disabled', true );
18+
19+
get_all_checkboxes( true ).each( function() {
20+
21+
var $checkbox = $( this );
22+
var $action_button = $checkbox.parents( '.single-event.row' ).first().find( 'a.' + action + '-event' );
23+
24+
if ( $action_button ) {
25+
$action_button.trigger( 'click' );
26+
}
27+
28+
$checkbox.attr( 'checked', false );
29+
30+
} );
31+
32+
$apply_button.attr( 'disabled', false );
33+
$select_input.val( '-1' );
34+
35+
}
36+
37+
} );
38+
39+
////////////////
40+
// Checkboxes //
41+
////////////////
42+
43+
var $cb_all = $( '.single-event.header .select-all' ),
44+
cb_checked = [];
45+
46+
function get_all_checkboxes( checked ) {
47+
48+
checked = typeof checked !== 'undefined' ? checked : false;
49+
50+
if ( checked ) {
51+
var appendix = ':checked';
52+
} else {
53+
var appendix = '';
54+
}
55+
56+
return $( '#events .events .single-event.row:visible .cb input:checkbox' + appendix );
57+
58+
}
59+
60+
function clear_all_checkboxes() {
61+
get_all_checkboxes().prop( 'checked', false );
62+
$cb_all.prop( 'checked', false );
63+
}
64+
65+
// change all rows if parent checkboxes has been changed
66+
$cb_all.on( 'change', function() {
67+
get_all_checkboxes().prop( 'checked', this.checked );
68+
$cb_all.prop( 'checked', this.checked );
69+
});
70+
71+
// check if parent checkboxes should be changed when changing row checkboxes
72+
get_all_checkboxes().on( 'change', function() {
73+
$cb_all.prop( 'checked', ( get_all_checkboxes( true ).length == get_all_checkboxes().length ) );
74+
} );
75+
76+
// clear all checkboxes on search
77+
wp.hooks.addAction( 'advanced-cron-manager/events/search/triggered', clear_all_checkboxes );
78+
79+
// clear all checkboxes on filter
80+
wp.hooks.addAction( 'advanced-cron-manager/events/filter/schedule', clear_all_checkboxes );
81+
82+
} )( jQuery );

assets/src/js/common.js

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
advanced_cron_manager.notify = function( notification, icon ) {
2+
3+
if ( typeof icon == 'undefined' ) {
4+
icon = '';
5+
} else {
6+
icon = '<span class="dashicons dashicons-' + icon + '"></span>';
7+
}
8+
9+
Materialize.toast( icon + notification, 4000 );
10+
11+
};
12+
13+
advanced_cron_manager.ajax_messages = function( response ) {
14+
15+
if ( response.success == true ) {
16+
advanced_cron_manager.notify( response.data, 'yes' );
17+
} else {
18+
jQuery.each( response.data, function( number, error ) {
19+
advanced_cron_manager.notify( error, 'warning' );
20+
} );
21+
}
22+
23+
};
24+
25+
function ACM_Slidebar() {
26+
this.container = jQuery( '.slidebar' );
27+
this.overlay = jQuery( '.slidebar-overlay' );
28+
this.close_button = jQuery( '.slidebar .close' );
29+
30+
this.close_button.click( { slidebar: this }, function( event ) {
31+
event.data.slidebar.close();
32+
} );
33+
34+
this.overlay.click( { slidebar: this }, function( event ) {
35+
event.data.slidebar.close();
36+
} );
37+
38+
this.open = function() {
39+
40+
this.container.animate( {
41+
'margin-right': 0
42+
}, 400, 'easeInOutSine' );
43+
44+
this.overlay.fadeIn( 400 );
45+
46+
};
47+
48+
this.close = function() {
49+
50+
var $form = this.container.find( '.content .form' );
51+
52+
this.container.animate( {
53+
'margin-right': '-' + ( this.container.outerWidth() + 5 )
54+
}, 400, 'easeInOutSine', function () {
55+
$form.html( '' );
56+
} );
57+
58+
this.overlay.fadeOut( 400 );
59+
60+
};
61+
62+
this.wait = function() {
63+
this.container.find( '.content' ).addClass( 'loading' );
64+
};
65+
66+
this.fulfill = function( html ) {
67+
this.container.find( '.content .form' ).html( html );
68+
this.container.find( '.content' ).removeClass( 'loading' );
69+
};
70+
71+
this.form_process_start = function( html ) {
72+
this.container.find( '.content .send-form' ).attr( 'disabled', true );
73+
this.container.find( '.content .spinner' ).css( 'visibility', 'visible' );
74+
};
75+
76+
this.form_process_stop = function( html ) {
77+
this.container.find( '.content .send-form' ).attr( 'disabled', false );
78+
this.container.find( '.content .spinner' ).css( 'visibility', 'hidden' );
79+
};
80+
81+
};
82+
83+
advanced_cron_manager.slidebar = new ACM_Slidebar;

assets/src/js/counter.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
( function( $ ) {
2+
3+
function count_events() {
4+
var number_of_events = $( '#events .events .single-event.row:visible' ).length;
5+
$( '#events .tablenav .tablenav-pages .displaying-num' ).text( number_of_events + ' ' + advanced_cron_manager.i18n.events );
6+
}
7+
8+
wp.hooks.addAction( 'advanced-cron-manager/events/filter/schedule', count_events, 100 );
9+
wp.hooks.addAction( 'advanced-cron-manager/events/search/triggered', count_events, 100 );
10+
11+
} )( jQuery );

assets/src/js/details.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
( function( $ ) {
2+
3+
var toggle_row_fold = function( event ) {
4+
5+
event.preventDefault();
6+
7+
$link = $( this );
8+
$row = $link.parents( '.single-event' ).first();
9+
10+
$row.toggleClass( 'unfolded' );
11+
12+
if ( $row.hasClass( 'unfolded' ) ) {
13+
wp.hooks.doAction( 'advanced-cron-manager/event/details/unfolded', $row );
14+
}
15+
16+
};
17+
18+
$( '.tools_page_advanced-cron-manager' ).on( 'click', '#events .columns .event .row-actions .details a', toggle_row_fold );
19+
$( '.tools_page_advanced-cron-manager' ).on( 'click', '#events .columns .event .event-name', toggle_row_fold );
20+
21+
} )( jQuery );

0 commit comments

Comments
 (0)