PHP Class Apple_Exporter\Exporter

NOTE: This class is designed to work outside of WordPress just fine, so it can be a dependency. It can be used to create other plugins, for example, a Joomla or Drupal plugin. Even though this is not a WordPress class it follows its coding conventions.
Since: 0.2.0
Author: Federico Ramirez
Exibir arquivo Open project: alleyinteractive/apple-news Class Usage Examples

Public Methods

Method Description
__construct ( apple_exporter\Exporter_Content $content, Workspace $workspace = null, Settings $settings = null ) Constructor.
export ( ) : string Based on the content this instance holds, create an Article Format bundle.
generate ( ) Generates JSON for the article.json file. By doing this, all attachments get added to the workspace/tmp directory automatically.
get_bundles ( ) : array Get the bundles from the workspace.
get_content ( ) : apple_exporter\Exporter_Content Get the Exporter_Content object
get_errors ( ) : array Get the errors from the workspace.
get_json ( ) : string Get the JSON output from the workspace.
initialize_builders ( array $builders = null ) An ordered hash of builders. They will be executed in order when building the JSON array.
workspace ( ) : Workspace Gets the instance of the current workspace.

Private Methods

Method Description
build_article_style ( ) : array Build the article style.
clean_workspace ( ) Clean up the current workspace.
content_id ( ) : integer Get the content ID.
content_title ( ) : string Get the content title.
generate_json ( ) : string Generate article.json contents. It does so by looping though all data, generating valid JSON and adding attachments to workspace/tmp directory.
get_builder ( string $name ) : Builder Get a builder.
register_builder ( string $name, Builder $builder ) Register a builder.
write_json ( $content ) Write the JSON output to the Workspace.

Method Details

__construct() public method

Constructor.
public __construct ( apple_exporter\Exporter_Content $content, Workspace $workspace = null, Settings $settings = null )
$content apple_exporter\Exporter_Content
$workspace Workspace
$settings Settings

export() public method

and return the path. This function builds the article and cleans up after.
public export ( ) : string
return string

generate() public method

When called, clean_workspace must always be called before and afterwards.
Since: 0.4.0
public generate ( )

get_bundles() public method

Get the bundles from the workspace.
public get_bundles ( ) : array
return array

get_content() public method

Get the Exporter_Content object
public get_content ( ) : apple_exporter\Exporter_Content
return apple_exporter\Exporter_Content

get_errors() public method

Get the errors from the workspace.
public get_errors ( ) : array
return array

get_json() public method

Get the JSON output from the workspace.
public get_json ( ) : string
return string

initialize_builders() public method

An ordered hash of builders. They will be executed in order when building the JSON array.
Since: 0.4.0
public initialize_builders ( array $builders = null )
$builders array

workspace() public method

Gets the instance of the current workspace.
Since: 0.4.0
public workspace ( ) : Workspace
return Workspace