form_template( $content );
// for customizing/overriding form
$form = apply_filters( 'anyipsum-form', $form );
$output = $this->add_generated_output();
return do_shortcode( $output . $form );
}
private function add_generated_output() {
$output = '';
$type = WPAnyIpsumCore::get_request( 'type' );
if ( ! empty( $type ) ) {
$args = apply_filters( 'anyipsum-parse-request-args', $_SERVER['QUERY_STRING'] );
$paragraphs = apply_filters( 'anyipsum-generate-filler', $args );
$output = '
';
foreach ( $paragraphs as $paragraph ) {
$output .= '
' . $paragraph . '
';
}
$output .= '
';
// customize/override output
$output = apply_filters( 'anyipsum-form-output', $output, $paragraphs );
// send notification for anything else that's hooked in
$args['source'] = 'web';
$args['format'] = 'html';
$args['output'] = $output;
do_action( 'anyipsum-filler-generated', $args );
}
return $output;
}
private function form_template( $content ) {
$settings = $this->get_settings();
$type = WPAnyIpsumCore::get_request( 'type' , $settings['all_custom'] );
if ( empty( $settings['ipsum_name'] ) ) {
$settings['ipsum_name'] = 'Lorem';
}
if ( empty( $settings['start_with'] ) ) {
$settings['start_with'] = 'Lorem ipsum dolor amet';
}
return $this->form_template_html( $content, $type, $settings );
}
private function form_template_html( $content, $type, $settings ) {
$permalink_structure = get_option( 'permalink_structure' );
ob_start();
if ( ! empty( $content ) && ! empty( $type ) ) { ?>
apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'custom-and-filler-text' ),
'custom_and_filler' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'querystring-custom-and-filler' ),
'all_custom_text' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'all-custom-text' ),
'all_custom' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'querystring-all-custom' ),
'button_text' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'button-text' ),
'start_with' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'start-with' ),
'ipsum_name' => apply_filters( 'anyipsum-setting-get', '', 'anyipsum-settings-general', 'name' ),
);
return $settings;
}
}
}