delete dev files
Этот коммит содержится в:
родитель
69f64d6718
Коммит
b98c04294b
2
.gitignore
поставляемый
2
.gitignore
поставляемый
@ -1,4 +1,4 @@
|
||||
css/ShortCSS
|
||||
css/ShortCSS/*
|
||||
.gitmodules
|
||||
batch_test.php
|
||||
Gruntfile.js
|
||||
|
3
.gitmodules
поставляемый
3
.gitmodules
поставляемый
@ -1,3 +0,0 @@
|
||||
[submodule "css/ShortCSS"]
|
||||
path = css/ShortCSS
|
||||
url = https://github.com/IgorVBelousov/ShortCSS.git
|
53
Gruntfile.js
53
Gruntfile.js
@ -1,53 +0,0 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
uglify: {
|
||||
batch: {
|
||||
src: 'js/batch.js',
|
||||
dest: 'js/batch.min.js'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stylus: {
|
||||
compile: {
|
||||
|
||||
files: {
|
||||
'css/batch.css':'css/batch.styl',
|
||||
'css/notice.css':'css/notice.styl'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
csso: {
|
||||
dist: {
|
||||
files: {
|
||||
'css/batch.css':'css/batch.css',
|
||||
'css/notice.css':'css/notice.css'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Load the plugin that provides the "uglify" task.
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-internal');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-csso');
|
||||
grunt.loadNpmTasks('grunt-contrib-stylus');
|
||||
|
||||
grunt.registerTask('js',['uglify']);
|
||||
grunt.registerTask('css',['stylus','csso']);
|
||||
|
||||
// Default task(s).
|
||||
grunt.registerTask('default', ['css','js']);
|
||||
|
||||
};
|
193
batch_test.php
193
batch_test.php
@ -1,193 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Batch operations TEST
|
||||
* Description: DEV TEST
|
||||
* Version: 0.1.0
|
||||
* Author: Igor V Belousov
|
||||
* Author URI: http://belousovv.ru/
|
||||
*/
|
||||
|
||||
add_action( 'admin_menu', 'batch_operations_test_add_page' );
|
||||
|
||||
function batch_operations_test_add_page() {
|
||||
add_management_page( 'Batch operations TEST', 'Batch TEST', 'edit_posts', 'batch-operations-test', 'batch_operations_test_page_view' );
|
||||
}
|
||||
|
||||
function batch_operations_test_page_view() {
|
||||
|
||||
$test = ( empty ($_REQUEST["test"] ) )? 0 : $_REQUEST["test"];
|
||||
|
||||
switch ($test) {
|
||||
case 2:
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$batch['title']="Custom Title";
|
||||
$batch['init_message']="Custom Init Message";
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$batch['progress_message']='Current=%current%. Total=%total%.';
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$batch['operations'][]=array('test_batch_operation_context_finished',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
$batch['operations'][]=array('test_batch_operation',array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
$batch['operations'][]=array('test_batch_operation_params',array('a',1));
|
||||
$batch['operations'][]=array('test_batch_operation_params',array('b',2));
|
||||
$batch['operations'][]=array('test_batch_operation_params',array('c',3));
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$batch['operations'][]=array(array('TestBatch','Operations'),array());
|
||||
$batch['operations'][]=array(array('TestBatch','Operations'),array());
|
||||
batch_operations_start($batch);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
$batch['operations'][]=array('test_batch_operation_params',array('c',3));
|
||||
batch_operations_start($batch,get_admin_url( null, 'tools.php' ) . "?page=batch-operations-test");
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$batch['operations'][]=array('test_batch_operation_messages',array());
|
||||
batch_operations_start($batch,get_admin_url( null, 'tools.php' ) . "?page=batch-operations-test");
|
||||
break;
|
||||
|
||||
case 11:
|
||||
$batch = array(
|
||||
'title' => "Test finished_callback without errors",
|
||||
'init_message' => 'Custom Init Message',
|
||||
'progress_message' => 'Step %current% of %total%.',
|
||||
'operations' => array(
|
||||
array('test_batch_operation_params',array('a',1)),
|
||||
array(array('TestBatch','Operations'),array()),
|
||||
array('test_batch_operation_context_finished',array()),
|
||||
array('test_batch_operation',array()),
|
||||
),
|
||||
'finished' => 'test_batch_operations_callback'
|
||||
);
|
||||
|
||||
batch_operations_start($batch,get_admin_url( null, 'tools.php' ) . "?page=batch-operations-test");
|
||||
break;
|
||||
|
||||
case 12:
|
||||
$batch = array(
|
||||
'title' => "Test finished_callback with errors",
|
||||
'init_message' => 'Custom Init Message',
|
||||
'progress_message' => 'Step %current% of %total%.',
|
||||
'operations' => array(
|
||||
array('test_batch_operation_params',array('a')),
|
||||
array('test_batch_operation_params',array('Hello','World')),
|
||||
array(array('TestBatch','Operations'),array()),
|
||||
array('test_batch_operationh',array()),
|
||||
),
|
||||
'finished' => 'test_batch_operations_callback'
|
||||
);
|
||||
batch_operations_start($batch,get_admin_url( null, 'tools.php' ) . "?page=batch-operations-test");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2><?php echo get_admin_page_title() ?></h2>
|
||||
<ol>
|
||||
<li><a href="tools.php?page=batch-operations&id=0">$current_array is empty</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=2">Default <strong>title</strong> & <strong>init_message</strong></a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=3">Set <strong>custom title</strong> & <strong>custom init_message</strong></a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=4">5 operations default <strong>progress_message</strong></a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=5">5 operations custom <strong>progress_message</strong></a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=6">Test <strong>$context['finished']</strong></a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=7">Test params</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=8">Test operations in class</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=9">Test redirect</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=10">Test messages</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=11">Test finished_callback without errors</a>
|
||||
<li><a href="tools.php?page=batch-operations-test&test=12">Test finished_callback with errors</a>
|
||||
</ol>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function test_batch_operation_messages( &$context ) {
|
||||
batch_operations_notice('default');
|
||||
batch_operations_notice('info','info');
|
||||
batch_operations_notice('success','success');
|
||||
batch_operations_notice('warning','warning');
|
||||
batch_operations_notice('error','error');
|
||||
$context['message'] = "Messages test";
|
||||
}
|
||||
|
||||
function test_batch_operation( &$context ) {
|
||||
sleep(1);
|
||||
$context['message'] = 'Yeap! Work!';
|
||||
}
|
||||
|
||||
function test_batch_operation_context_finished( &$context ) {
|
||||
if ( empty( $context['sandbox'] ) ) {
|
||||
// First run
|
||||
$context['sandbox']['current_id'] = 0;
|
||||
$context['sandbox']['max'] = 5 ;
|
||||
}
|
||||
sleep(2);
|
||||
$context['message'] = 'Test $context[\'finished\']. current_id = ' . $context['sandbox']['current_id'];
|
||||
$context['sandbox']['current_id']++;
|
||||
if ( $context['sandbox']['current_id'] < $context['sandbox']['max'] ) {
|
||||
$context['finished'] = false;
|
||||
} else {
|
||||
$context['finished'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function test_batch_operation_params( $a, $b, &$context ) {
|
||||
sleep(2);
|
||||
$context['message'] = '$a=' . $a . ' $b=' . $b ;
|
||||
$context['results'][] = $a . ', ' . $b . '!';return true;
|
||||
}
|
||||
|
||||
function test_batch_operations_callback( $success, $results, $errors ){
|
||||
if ( $success ) {
|
||||
batch_operations_notice('Test finished_callback without errors success.');
|
||||
} else {
|
||||
batch_operations_notice('Test finished_callback with errors success.');
|
||||
batch_operations_notice('<h3>results</h3><pre>' . print_r( $results, true ) . '</pre><h3>errors</h3><pre>' .
|
||||
print_r( $errors, true ) . '</pre>', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
class TestBatch {
|
||||
|
||||
public function Operations(&$context){
|
||||
sleep(2);
|
||||
$context['message'] = 'class TestBatch';
|
||||
}
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit c5ac1d81265c4a6c0614fc095bcf563f8d84c84a
|
14
package.json
14
package.json
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "Batch_operations",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.5",
|
||||
"grunt-contrib-internal": "~0.4.5",
|
||||
"grunt-contrib-jshint": "~0.10.0",
|
||||
"grunt-contrib-nodeunit": "~0.4.1",
|
||||
"grunt-contrib-uglify": "~0.5.0",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-csso": "~0.5.0",
|
||||
"grunt-contrib-stylus": "~0.10.0"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче
Block a user