src/php/utils.php
Showing 111 of 111 total issues
Method register_script
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function register_script( string $relpath, array $extra_deps = [] ) { $handle = 'abt-' . $relpath; $script_suffix = "/bundle/$relpath.js"; $style_suffix = "/bundle/$relpath.css";
Expected 0 spaces between opening bracket and argument "$registered_styles"; 1 found Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Expected 0 spaces between argument "$data" and closing bracket; 1 found Open
Open
function add_json_script( string $id, $data ) {
- Exclude checks
Expected 0 spaces between argument "$extra_deps" and closing bracket; 1 found Open
Open
function register_script( string $relpath, array $extra_deps = [] ) {
- Exclude checks
Expected 0 spaces between argument "$registered_styles" and closing bracket; 1 found Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) {
- Exclude checks
Expected 1 space after FUNCTION keyword; 0 found Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Expected 0 spaces between opening bracket and argument "$id"; 1 found Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Expected 0 spaces between opening bracket and type hint "string"; 1 found Open
Open
function register_script( string $relpath, array $extra_deps = [] ) {
- Exclude checks
Expected 0 spaces between argument "$data" and closing bracket; 1 found Open
Open
function () use ( $id, $data ) {
- Exclude checks
Expected 0 spaces between argument "$id" and closing bracket; 1 found Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Expected 0 spaces between opening bracket and argument "$id"; 1 found Open
Open
function () use ( $id, $data ) {
- Exclude checks
Expected 0 spaces between opening bracket and type hint "string"; 1 found Open
Open
function add_json_script( string $id, $data ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( did_action( $action ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( in_array( 'wp-i18n', $script_asset['dependencies'], true ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
throw new \RuntimeException( 'Action already fired for JSON data with ID ' . $id );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$style_suffix = "/bundle/$relpath.css";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
array_values(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$action,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
add_action(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
type="application/json"
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
wp_set_script_translations(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
true
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$prefix = is_admin() ? 'admin_' : 'wp_';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return json_decode(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset = file_exists( $script_asset_path ) ? require $script_asset_path : [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
function () use ( $id, $data ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ( in_array( 'wp-i18n', $script_asset['dependencies'], true ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
id="<?php echo esc_attr( $id ); ?>"
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
ABT_ROOT_PATH . '/citation-styles.json'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'dependencies' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'version' => filemtime( ABT_ROOT_PATH . $script_suffix ),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$registered_styles = wp_styles()->registered;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
ABT_ROOT_URI . $style_suffix,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
<?php
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
basename( ABT_ROOT_PATH ) . '/languages'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
array_filter(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
<script
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'academic-bloggers-toolkit',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$handle,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
filemtime( ABT_ROOT_PATH . $style_suffix )
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
><?php echo wp_json_encode( $data ); ?></script>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset['dependencies'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$handle,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
function( $id ) use ( $registered_styles ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
wp_register_script(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset['version'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ( did_action( $action ) ) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset_path = ABT_ROOT_PATH . "/bundle/$relpath.asset.php";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset['dependencies'] = array_merge( $script_asset['dependencies'], $extra_deps );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$handle,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
file_get_contents( // phpcs:ignore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_suffix = "/bundle/$relpath.js";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
ABT_ROOT_URI . $script_suffix,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
wp_register_style(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$script_asset['dependencies'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return array_key_exists( $id, $registered_styles );
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$action = $prefix . 'footer';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
?>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$handle = 'abt-' . $relpath;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Opening brace should be on a new line Open
Open
function add_json_script( string $id, $data ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
id="<?php echo esc_attr( $id ); ?>"
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
throw new \RuntimeException( 'Action already fired for JSON data with ID ' . $id );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
filemtime( ABT_ROOT_PATH . $style_suffix )
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
$script_asset = file_exists( $script_asset_path ) ? require $script_asset_path : [
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( did_action( $action ) ) {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
if ( in_array( 'wp-i18n', $script_asset['dependencies'], true ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
><?php echo wp_json_encode( $data ); ?></script>
- Exclude checks
Opening brace should be on a new line Open
Open
function get_citation_styles() {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
return array_key_exists( $id, $registered_styles );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
$script_asset['dependencies'] = array_merge( $script_asset['dependencies'], $extra_deps );
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
Open
if ( in_array( 'wp-i18n', $script_asset['dependencies'], true ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
if ( in_array( 'wp-i18n', $script_asset['dependencies'], true ) ) {
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
Open
if ( did_action( $action ) ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
><?php echo wp_json_encode( $data ); ?></script>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
$script_asset['dependencies'] = array_merge( $script_asset['dependencies'], $extra_deps );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
'version' => filemtime( ABT_ROOT_PATH . $script_suffix ),
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
throw new \RuntimeException( 'Action already fired for JSON data with ID ' . $id );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
id="<?php echo esc_attr( $id ); ?>"
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
$script_asset = file_exists( $script_asset_path ) ? require $script_asset_path : [
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
'version' => filemtime( ABT_ROOT_PATH . $script_suffix ),
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
basename( ABT_ROOT_PATH ) . '/languages'
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
Open
basename( ABT_ROOT_PATH ) . '/languages'
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
if ( did_action( $action ) ) {
- Exclude checks
Opening brace should be on a new line Open
Open
function register_script( string $relpath, array $extra_deps = [] ) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
return array_key_exists( $id, $registered_styles );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
Open
filemtime( ABT_ROOT_PATH . $style_suffix )
- Exclude checks