PHP Class Components_Generator_Plugin, components.underscores.me

Mostrar archivo Open project: Automattic/components.underscores.me Class Usage Examples

Public Properties

Property Type Description
$build_dir
$bypass_cache
$components_dir
$logging
$prototype_dir
$repo_file_name
$repo_url
$selected_theme

Public Methods

Method Description
__construct ( )
add_component_files ( $components, $target_dir, $replacements ) Adds component files needed for the build.
add_javascript ( $type, $files, $target_dir ) Removes component insertion comments from source.
add_replacement_files ( $type, $files, $target_dir ) Replaces files in the build from those specified by type.
add_sass_includes ( $type, $files, $target_dir ) Adds sass includes to the build and takes care of file overrides.
add_templates ( $files, $target_dir ) Adds templates to the build.
build_type ( $type ) Builds a given type from theme components.
copy_build_files ( $source_dir, $target_dir, $exclude = [] ) Copy files to temporary build directory.
copy_files ( $src_dir, $files, $target_dir ) Copies files to a given directory
create_zippity_zip ( ) Let's take the form input, generate and zip of the theme.
delete_directory ( $directory ) Delete a directory of files.
delete_file ( $URI ) This deletes a file.
do_tracking ( ) Track total downloads and type downloads.
download_file ( $URI, $file_name ) This downloads a file at a URL.
ensure_directory ( $directory, $delete_if_exists = false ) Checks if a directory exists, creates it otherwise.
gen_types_cache ( ) Creates an array and a JSON file from type configs to cache type data.
get_build_sources ( $dir ) Gets the build sources and associated file data.
get_stylesheet_paths ( $target_dir, $stylesheet, $basedir = null ) Gets list of stylesheets to include
get_theme_components ( $destination ) This gets our zip from the Github repo.
get_theme_components_init ( ) This is an init function to grab theme components so we can control when it's called by the generator.
get_types ( ) Returns an array with the available types.
handle_config ( $type, $config, $target_dir ) Handles the configuration and coordinates everything.
log_message ( $data ) Logs messages to debug.log in wp-content folder
read_base_dir ( $dir ) Read files to process from base. Stores files on array for processing.
read_dir ( $path, $fullpath = false ) Reads a directory excluding wildcards.
read_dir_recursive ( $path, $regex_filter = null ) Recursively reads a directory.
read_json ( $file ) Places data in JSON files in an array for later use.
render_types_form ( ) Renders the generator type form.
replace_theme_fields ( $contents, $filename ) Runs when looping through files contents, does the replacements fun stuff.
set_expiration_and_go ( ) Let's set an expiration on the last download and get current time.
unzip_file ( $zip_file ) This unzips our zip from the Github repo.

Method Details

__construct() public method

public __construct ( )

add_component_files() public method

Adds component files needed for the build.
public add_component_files ( $components, $target_dir, $replacements )

add_javascript() public method

Removes component insertion comments from source.
public add_javascript ( $type, $files, $target_dir )

add_replacement_files() public method

Replaces files in the build from those specified by type.
public add_replacement_files ( $type, $files, $target_dir )

add_sass_includes() public method

Adds sass includes to the build and takes care of file overrides.
public add_sass_includes ( $type, $files, $target_dir )

add_templates() public method

Adds templates to the build.
public add_templates ( $files, $target_dir )

build_type() public method

Builds a given type from theme components.
public build_type ( $type )

copy_build_files() public method

Copy files to temporary build directory.
public copy_build_files ( $source_dir, $target_dir, $exclude = [] )

copy_files() public method

Copies files to a given directory
public copy_files ( $src_dir, $files, $target_dir )

create_zippity_zip() public method

Let's take the form input, generate and zip of the theme.
public create_zippity_zip ( )

delete_directory() public method

Delete a directory of files.
public delete_directory ( $directory )

delete_file() public method

This deletes a file.
public delete_file ( $URI )

do_tracking() public method

Track total downloads and type downloads.
public do_tracking ( )

download_file() public method

This downloads a file at a URL.
public download_file ( $URI, $file_name )

ensure_directory() public method

Checks if a directory exists, creates it otherwise.
See also: http://php.net/mkdir
public ensure_directory ( $directory, $delete_if_exists = false )

gen_types_cache() public method

The generator form uses this to render type choices automatically.
public gen_types_cache ( )

get_build_sources() public method

Gets the build sources and associated file data.
public get_build_sources ( $dir )

get_stylesheet_paths() public method

Gets list of stylesheets to include
public get_stylesheet_paths ( $target_dir, $stylesheet, $basedir = null )

get_theme_components() public method

This gets our zip from the Github repo.
public get_theme_components ( $destination )

get_theme_components_init() public method

This is an init function to grab theme components so we can control when it's called by the generator.

get_types() public method

Returns an array with the available types.
public get_types ( )

handle_config() public method

Handles the configuration and coordinates everything.
public handle_config ( $type, $config, $target_dir )

log_message() public method

Logs messages to debug.log in wp-content folder
public log_message ( $data )

read_base_dir() public method

Read files to process from base. Stores files on array for processing.
public read_base_dir ( $dir )

read_dir() public method

Reads a directory excluding wildcards.
public read_dir ( $path, $fullpath = false )

read_dir_recursive() public method

Recursively reads a directory.
public read_dir_recursive ( $path, $regex_filter = null )

read_json() public method

Places data in JSON files in an array for later use.
public read_json ( $file )

render_types_form() public method

Renders the generator type form.
public render_types_form ( )

replace_theme_fields() public method

Runs when looping through files contents, does the replacements fun stuff.
public replace_theme_fields ( $contents, $filename )

set_expiration_and_go() public method

Let's set an expiration on the last download and get current time.

unzip_file() public method

This unzips our zip from the Github repo.
public unzip_file ( $zip_file )

Property Details

$build_dir public_oe property

public $build_dir

$bypass_cache public_oe property

public $bypass_cache

$components_dir public_oe property

public $components_dir

$logging public_oe property

public $logging

$prototype_dir public_oe property

public $prototype_dir

$repo_file_name public_oe property

public $repo_file_name

$repo_url public_oe property

public $repo_url

$selected_theme public_oe property

public $selected_theme