$tax_name, 'hide_empty' => $hide_empty, ) ); if ( is_array( $terms ) && count( $terms ) > 0 ) { foreach ( $terms as $term ) { $term_name = ! empty( $term->name ) ? $term->name : false; $term_id = ! empty( $term->term_id ) ? $term->term_id : ''; if ( $term_name ) { $items[ $term_id ] = $term_name; } } } return $items; } } if ( ! function_exists( 'business_class_get_page_options_for_customizer' ) ) { /** * Returns the formatted array for the customer dropdown for pages options. */ function business_class_get_page_options_for_customizer() { $items = array(); $all_pages = get_pages(); if ( is_array( $all_pages ) && count( $all_pages ) > 0 ) { foreach ( $all_pages as $page ) { $title = ! empty( $page->post_title ) ? $page->post_title : false; $id = ! empty( $page->ID ) ? $page->ID : ''; if ( $title ) { $items[ $id ] = $title; } } } return $items; } } if ( ! function_exists( 'business_class_recursively_get_files_path' ) ) { /** * Returns the path of all the files and sub-files for given directory. * * @param string $directory_path Relative path for the directory. * @return array $paths Returns the relative path to all the files. */ function business_class_recursively_get_files_path( $directory_path ) { if ( empty( $directory_path ) ) { return; } $paths = array(); $files_and_folders = scandir( $directory_path ); if ( is_array( $files_and_folders ) && count( $files_and_folders ) > 0 ) { foreach ( $files_and_folders as $file_and_folder ) { if ( '.' === $file_and_folder || '..' === $file_and_folder ) { continue; } if ( is_file( "{$directory_path}/{$file_and_folder}" ) ) { $paths[] = wp_normalize_path( "{$directory_path}/{$file_and_folder}" ); continue; } foreach ( business_class_recursively_get_files_path( "{$directory_path}/{$file_and_folder}" ) as $file_and_folder ) { $paths[] = wp_normalize_path( $file_and_folder ); } } } return $paths; } }