PHP code example of alleyinteractive / wp-block-audit-command

1. Go to this page and download the library: Download alleyinteractive/wp-block-audit-command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alleyinteractive / wp-block-audit-command example snippets


add_filter(
	'alley_block_audit_block_type_details',
	function ( $details, $block_name, $attrs, $inner_html, $block, $post ) {
		if ( isset( $attrs['fontSize'] ) && is_string( $attrs['fontSize'] ) ) {
			$details['fontSize'][ $attrs['fontSize'] ] ??= 0;
			$details['fontSize'][ $attrs['fontSize'] ]++;
		}

		return $details;
	},
	10,
	6,
);

add_filter(
	'alley_block_audit_core/image_block_type_details',
	function ( $details, $block_name, $attrs, $inner_html, $block, $post ) {
		if ( isset( $attrs['aspectRatio'] ) && is_string( $attrs['aspectRatio'] ) ) {
			$details['aspectRatio'][ $attrs['aspectRatio'] ] ??= 0;
			$details['aspectRatio'][ $attrs['aspectRatio'] ]++;
		}

		return $details;
	},
	10,
	6,
);