Skip to content

Commit

Permalink
Remove redundant code #2
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Jan 25, 2022
1 parent dff7018 commit 51914c2
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions libs/class-oik-patterns-from-htm.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class OIK_Patterns_From_Htm {
private $files = [];

function __construct() {


}

/**
Expand Down Expand Up @@ -66,15 +64,13 @@ function register_patterns() {
$this->register_pattern();
}
}

}

function list_files() {
$theme_dir_root = dirname( get_stylesheet_directory() );
$mask = $theme_dir_root . '/' . $this->theme .'/patterns/*.html';
$this->files = glob( $mask );
bw_trace2( $this->files, $mask );

//bw_trace2( $this->files, $mask );
}

/**
Expand Down Expand Up @@ -124,7 +120,6 @@ function get_label( $part ) {
/**
* Registers the pattern category for the theme.
*
* @TODO Get the proper theme name using wp_get_theme();
*/
function register_block_pattern_category() {
$category_name = $this->theme;
Expand All @@ -135,17 +130,13 @@ function register_block_pattern_category() {
/**
* Registers categories for each subfolder under patterns.
*
*
*/

function register_categories() {
$this->categories = [];
//echo $this->file;
$parts = explode( '/', $this->file );
array_pop( $parts );
$patterns_found = false;
foreach ( $parts as $part ) {
//echo $part;
if ( $part === 'patterns') {
$patterns_found = true;
continue;
Expand All @@ -156,32 +147,13 @@ function register_categories() {
register_block_pattern_category( $part, $category_properties );
}
}
//print_r( $this->categories );

}

function register_pattern() {
$this->load_pattern();
register_block_pattern( $this->pattern_name, $this->pattern_properties );
}

/*
function get_file_list($dir, $mask) {
$files = glob($dir .'/' . $mask);
return $files;
}
function get_subdir_file_list( $theme_dir, $mask ) {
$files2 = [];
$subdirs = glob( $theme_dir . '/*', GLOB_ONLYDIR );
foreach ( $subdirs as $subdir ) {
$files = $this->get_file_list( $subdir, $mask );
$files2 = array_merge( $files2, $files );
}
return $files2;
}
*/

function get_all_patterns( $slug ) {
$theme_dir = get_theme_root();
$theme_dir .= '/';
Expand All @@ -196,7 +168,6 @@ function get_all_patterns( $slug ) {
return $files;
}


function get_file_list($dir, $mask) {
$files = glob($dir .'/' . $mask);
return $files;
Expand All @@ -218,6 +189,4 @@ function get_subdir_file_list( $dir, $masks ) {
//print_r( $files );
return $files;
}


}

0 comments on commit 51914c2

Please sign in to comment.