Skip to content

Commit d691f24

Browse files
author
gitlost
committed
Move all .php files bar main to includes subdir. Remove unused ajax.
1 parent 338de35 commit d691f24

13 files changed

+30834
-243
lines changed

Gruntfile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ module.exports = function( grunt ) { //The wrapper function
7878
files: [
7979
{
8080
src: [
81-
'../unfc-normalize/class-unfc-db_check-list-table.php',
82-
'../unfc-normalize/class-unfc-list-table.php',
83-
'../unfc-normalize/class-unfc-normalize.php',
84-
'../unfc-normalize/debug.php',
8581
'../unfc-normalize/readme.txt',
8682
'../unfc-normalize/unfc-normalize.php',
83+
'../unfc-normalize/includes/class-unfc-db_check-list-table.php',
84+
'../unfc-normalize/includes/class-unfc-list-table.php',
85+
'../unfc-normalize/includes/class-unfc-normalize.php',
86+
'../unfc-normalize/includes/debug.php',
8787
'../unfc-normalize/js/ie8.js',
8888
'../unfc-normalize/js/ie8.min.js',
8989
'../unfc-normalize/js/unfc-normalize.js',
File renamed without changes.
Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
define( 'UNFC_DB_CHECK_ITEM_BATCH_LIMIT', 4096 ); // Database batch size - number of database requests to do in one go when scanning.
99
define( 'UNFC_DB_CHECK_NORMALIZE_BATCH_LIMIT', 4096 ); // Database batch size - number of database requests to do in one go when normalizing.
1010
define( 'UNFC_DB_CHECK_LIST_LIMIT', 1000 ); // Initial default number of items to display in listing.
11-
define( 'UNFC_DB_CHECK_TITLE_MAX_LEN', 100 ); // Truncate titles if greater than this length (in UTF-8 chars).
11+
define( 'UNFC_DB_CHECK_TITLE_MAX_LEN', 100 ); // Truncate displaying of titles if greater than this length (in UTF-8 chars).
1212
define( 'UNFC_DB_CHECK_ITEMS_LIST_SEL', '#unfc_db_check_items_list' ); // Selector for items listing.
1313
define( 'UNFC_DB_CHECK_SLUGS_LIST_SEL', '#unfc_db_check_slugs_list' ); // Selector for percent-encoded slugs listing.
1414

@@ -23,8 +23,8 @@
2323
class UNFC_Normalize {
2424

2525
// Handy in themselves and to have for testing (can switch on/off). Set in __construct().
26-
static $dirname = null; // dirname( __FILE__ ).
27-
static $plugin_basename = null; // plugin_basename( __FILE__ ).
26+
static $dirname = null; // dirname( UNFC_FILE ).
27+
static $plugin_basename = null; // plugin_basename( UNFC_FILE ).
2828
static $doing_ajax = null; // defined( 'DOING_AJAX' ) && DOING_AJAX.
2929
static $have_set_group_concat_max_len = false; // Whether have set the MySQL group_concat_max_len variable for the session.
3030

@@ -185,10 +185,10 @@ class UNFC_Normalize {
185185
function __construct() {
186186

187187
if ( null === self::$dirname ) {
188-
self::$dirname = dirname( __FILE__ );
188+
self::$dirname = dirname( UNFC_FILE );
189189
}
190190
if ( null === self::$plugin_basename ) {
191-
self::$plugin_basename = plugin_basename( __FILE__ );
191+
self::$plugin_basename = plugin_basename( UNFC_FILE );
192192
}
193193
if ( null === self::$doing_ajax ) {
194194
self::$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
@@ -235,14 +235,7 @@ function is_blog_utf8() {
235235
* Called on 'admin_init' action.
236236
*/
237237
function admin_init() {
238-
if ( $this->check_version() && $this->is_blog_utf8() ) {
239-
if ( self::$doing_ajax ) {
240-
add_action( 'wp_ajax_unfc_db_check_list_bulk', array( $this, 'wp_ajax_unfc_db_check_list_bulk' ) );
241-
add_action( 'wp_ajax_unfc_db_check_list_page', array( $this, 'wp_ajax_unfc_db_check_list_page' ) );
242-
add_action( 'wp_ajax_unfc_db_check_list_sort', array( $this, 'wp_ajax_unfc_db_check_list_sort' ) );
243-
add_action( 'wp_ajax_unfc_db_check_list_screen_options', array( $this, 'wp_ajax_unfc_db_check_list_screen_options' ) );
244-
}
245-
}
238+
$this->check_version();
246239
}
247240

248241
/**
@@ -801,19 +794,19 @@ function enqueue_scripts() {
801794
$rangyinputs_suffix = defined( "SCRIPT_DEBUG" ) && SCRIPT_DEBUG ? '-src' : '';
802795

803796
// Load IE8 Array.prototype.reduceRight polyfill for unorm.
804-
wp_enqueue_script( 'unfc-ie8', plugins_url( "js/ie8{$suffix}.js", __FILE__ ), array(), UNFC_VERSION );
797+
wp_enqueue_script( 'unfc-ie8', plugins_url( "js/ie8{$suffix}.js", UNFC_FILE ), array(), UNFC_VERSION );
805798

806799
global $wp_scripts; // For < 4.2 compat, don't use wp_script_add_data().
807800
$wp_scripts->add_data( 'unfc-ie8', 'conditional', 'lt IE 9' );
808801

809802
// Load the javascript normalize polyfill https://github.com/walling/unorm
810-
wp_enqueue_script( 'unfc-unorm', plugins_url( "unorm/lib/unorm.js", __FILE__ ), array( 'unfc-ie8' ), '1.4.1' ); // Note unorm doesn't come with minified so don't use.
803+
wp_enqueue_script( 'unfc-unorm', plugins_url( "unorm/lib/unorm.js", UNFC_FILE ), array( 'unfc-ie8' ), '1.4.1' ); // Note unorm doesn't come with minified so don't use.
811804

812805
// Load the getSelection/setSelection jquery plugin https://github.com/timdown/rangyinputs
813-
wp_enqueue_script( 'unfc-rangyinputs', plugins_url( "rangyinputs/rangyinputs-jquery{$rangyinputs_suffix}.js", __FILE__ ), array( 'jquery' ), '1.2.0' );
806+
wp_enqueue_script( 'unfc-rangyinputs', plugins_url( "rangyinputs/rangyinputs-jquery{$rangyinputs_suffix}.js", UNFC_FILE ), array( 'jquery' ), '1.2.0' );
814807

815808
// Our script. Normalizes on paste in tinymce and in admin input/textareas and in some media stuff and in front-end input/textareas.
816-
wp_enqueue_script( 'unfc-normalize', plugins_url( "js/unfc-normalize{$suffix}.js", __FILE__ ), array( 'jquery', 'unfc-rangyinputs', 'unfc-unorm' ), UNFC_VERSION );
809+
wp_enqueue_script( 'unfc-normalize', plugins_url( "js/unfc-normalize{$suffix}.js", UNFC_FILE ), array( 'jquery', 'unfc-rangyinputs', 'unfc-unorm' ), UNFC_VERSION );
817810

818811
// Our parameters.
819812
$params = array(
@@ -1281,7 +1274,7 @@ function db_check_print_normalize_form() {
12811274
*/
12821275
function db_check_print_items_list() {
12831276
if ( ! class_exists( 'UNFC_DB_Check_Items_List_Table' ) ) {
1284-
require self::$dirname . '/class-unfc-db_check-list-table.php';
1277+
require self::$dirname . '/includes/class-unfc-db_check-list-table.php';
12851278
}
12861279
if ( $this->db_check_num_items > count( $this->db_check_items ) ) {
12871280
$h2 = sprintf(
@@ -1345,7 +1338,7 @@ function db_check_print_slug_form( $rescan = false ) {
13451338
*/
13461339
function db_check_print_slugs_list() {
13471340
if ( ! class_exists( 'UNFC_DB_Check_Slugs_List_Table' ) ) {
1348-
require self::$dirname . '/class-unfc-db_check-list-table.php';
1341+
require self::$dirname . '/includes/class-unfc-db_check-list-table.php';
13491342
}
13501343
if ( $this->db_check_num_slugs > count( $this->db_check_slugs ) ) {
13511344
$h2 = sprintf(
@@ -1389,10 +1382,10 @@ function db_check_button() {
13891382
if ( isset( $_REQUEST['unfc_db_check_slugs'] ) ) {
13901383
return 'unfc_db_check_slugs';
13911384
}
1392-
if ( isset( $_REQUEST['action'] ) && 'unfc_db_check_normalize_slugs' === $_REQUEST['action'] ) {
1385+
if ( isset( $_REQUEST['action'] ) && is_string( $_REQUEST['action'] ) && 'unfc_db_check_normalize_slugs' === $_REQUEST['action'] ) {
13931386
return 'unfc_db_check_normalize_slugs';
13941387
}
1395-
if ( isset( $_REQUEST['action2'] ) && 'unfc_db_check_normalize_slugs' === $_REQUEST['action2'] ) {
1388+
if ( isset( $_REQUEST['action2'] ) && is_string( $_REQUEST['action2'] ) && 'unfc_db_check_normalize_slugs' === $_REQUEST['action2'] ) {
13961389
return 'unfc_db_check_normalize_slugs';
13971390
}
13981391
if ( isset( $_REQUEST['screen-options-apply'] ) && isset( $_REQUEST['wp_screen_options'] ) && is_array( $_REQUEST['wp_screen_options'] ) ) {
@@ -1604,7 +1597,7 @@ function db_check_items( &$admin_notices ) {
16041597
if ( $have_field ) {
16051598
if ( $ret['num_items'] < $list_limit ) {
16061599
$title = $obj->{$this->db_title_cols[ $type ]};
1607-
if ( mb_strlen( $title ) > UNFC_DB_CHECK_TITLE_MAX_LEN ) {
1600+
if ( mb_strlen( $title, 'UTF-8' ) > UNFC_DB_CHECK_TITLE_MAX_LEN ) {
16081601
$title = mb_substr( $title, 0, UNFC_DB_CHECK_TITLE_MAX_LEN, 'UTF-8' ) . __( '...', 'unfc-normalize' );
16091602
}
16101603
$ret['items'][] = array(
@@ -2040,7 +2033,7 @@ function db_check_slugs( &$admin_notices ) {
20402033
if ( ! ( $this->no_normalizer ? unfc_normalizer_is_normalized( $decoded ) : normalizer_is_normalized( $decoded ) ) ) {
20412034
if ( $ret['num_slugs'] < $list_limit ) {
20422035
$title = $obj->title;
2043-
if ( mb_strlen( $title ) > UNFC_DB_CHECK_TITLE_MAX_LEN ) {
2036+
if ( mb_strlen( $title, 'UTF-8' ) > UNFC_DB_CHECK_TITLE_MAX_LEN ) {
20442037
$title = mb_substr( $title, 0, UNFC_DB_CHECK_TITLE_MAX_LEN, 'UTF-8' ) . __( '...', 'unfc-normalize' );
20452038
}
20462039
$ret['slugs'][] = array(
File renamed without changes.

js/ie8.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

js/unfc-normalize.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)