er_last_name' => esc_html__( 'User Last Name', 'wpforms-lite' ),
'user_email' => esc_html__( 'User Email', 'wpforms-lite' ),
'user_meta' => esc_html__( 'User Meta', 'wpforms-lite' ),
'author_id' => esc_html__( 'Author ID', 'wpforms-lite' ),
'author_display' => esc_html__( 'Author Name', 'wpforms-lite' ),
'author_email' => esc_html__( 'Author Email', 'wpforms-lite' ),
'url_referer' => esc_html__( 'Referrer URL', 'wpforms-lite' ),
'url_login' => esc_html__( 'Login URL', 'wpforms-lite' ),
'url_logout' => esc_html__( 'Logout URL', 'wpforms-lite' ),
'url_register' => esc_html__( 'Register URL', 'wpforms-lite' ),
'url_lost_password' => esc_html__( 'Lost Password URL', 'wpforms-lite' ),
'unique_value' => esc_html__( 'Unique Value', 'wpforms-lite' ),
'site_name' => esc_html__( 'Site Name', 'wpforms-lite' ),
'order_summary' => esc_html__( 'Order Summary', 'wpforms-lite' ),
];
}
/**
* Get all smart tags in the content.
*
* @since 1.6.7
*
* @param string $content Content.
*
* @return array
*/
private function get_all_smart_tags( $content ) {
/**
* A smart tag should start and end with a curly brace.
* ([a-z0-9_]+) a smart tag name and also the first capturing group. Lowercase letters, digits, and an underscore.
* (|[ =][^\n}]*) - second capturing group:
* | no characters at all or the following:
* [ =][^\n}]* space or equal sign and any number of any characters except new line and closing curly brace.
*/
preg_match_all( '~{([a-z0-9_]+)(|[ =][^\n}]*)}~', $content, $smart_tags );
return array_combine( $smart_tags[0], $smart_tags[1] );
}
/**
* Process smart tags.
*
* @since 1.6.7
* @since 1.8.7 Added `$context` parameter.
*
* @param string $content Content.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param string $entry_id Entry ID.
* @param string $context Context.
*
* @return string
*/
public function process( $content, $form_data, $fields = [], $entry_id = '', $context = '' ) {
// We shouldn't process smart tags in different WordPress editors
// since it produce unexpected results.
if ( wpforms_is_editor_page() ) {
return $content;
}
$smart_tags = $this->get_all_smart_tags( $content );
if ( empty( $smart_tags ) ) {
return $content;
}
foreach ( $smart_tags as $smart_tag => $tag_name ) {
$class_name = $this->get_smart_tag_class_name( $tag_name );
$smart_tag_object = new $class_name( $smart_tag, $context );
$value = $smart_tag_object->get_value( $form_data, $fields, $entry_id );
$field_id = $smart_tag_object->get_attributes()['field_id'] ?? 0;
$field_id = (int) explode( '|', $field_id )[0];
if (
$context === 'confirmation_redirect' &&
$field_id > 0 &&
in_array(
$fields[ $field_id ]['type'],
wpforms_get_multi_fields(),
true
)
) {
// Protect from the case where user already placed a pipe in the value.
$value = str_replace(
[ "\r\n", "\r", "\n", '|' ],
[ rawurlencode( '|' ), '|', '|', '|' ],
$value
);
}
/**
* Modify the smart tag value.
*
* @since 1.6.7
* @since 1.6.7.1 Added the 5th argument.
* @since 1.9.0 Added the 6th argument.
*
* @param scalar|null $value Smart Tag value.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
* @param string $context Context.
*/
$value = apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
"wpforms_smarttags_process_{$tag_name}_value",
$value,
$form_data,
$fields,
$entry_id,
$smart_tag_object,
$context
);
/**
* Modify a smart tag value.
*
* @since 1.6.7.1
*
* @param scalar|null $value Smart Tag value.
* @param string $tag_name Smart tag name.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
*/
$value = apply_filters(
'wpforms_smarttags_process_value',
$value,
$tag_name,
$form_data,
$fields,
$entry_id,
$smart_tag_object
);
if ( $value !== null ) {
$content = $this->replace( $smart_tag, $value, $content );
}
/**
* Modify content with smart tags.
*
* @since 1.4.0
* @since 1.6.7.1 Added 3rd, 4th, 5th, 6th arguments.
*
* @param string $content Content of the Smart Tag.
* @param string $tag_name Tag name of the Smart Tag.
* @param array $form_data Form data.
* @param string $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
*/
$content = (string) apply_filters(
'wpforms_smart_tag_process',
$content,
$tag_name,
$form_data,
$fields,
$entry_id,
$smart_tag_object
);
}
return $content;
}
/**
* Determine if the smart tag is registered.
*
* @since 1.6.7
*
* @param string $smart_tag_name Smart tag name.
*
* @return bool
*/
protected function has_smart_tag( $smart_tag_name ) {
return array_key_exists( $smart_tag_name, $this->get_smart_tags() );
}
/**
* Get smart tag class name.
*
* @since 1.6.7
*
* @param string $smart_tag_name Smart tag name.
*
* @return string
*/
protected function get_smart_tag_class_name( $smart_tag_name ) {
if ( ! $this->has_smart_tag( $smart_tag_name ) ) {
return Generic::class;
}
$class_name = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $smart_tag_name ) ) );
$full_class_name = '\\WPForms\\SmartTags\\SmartTag\\' . $class_name;
if ( class_exists( $full_class_name ) ) {
return $full_class_name;
}
/**
* Modify a smart tag class name that describes the smart tag logic.
*
* @since 1.6.7
*
* @param string $class_name The value.
* @param string $smart_tag_name Smart tag name.
*/
$full_class_name = apply_filters( 'wpforms_smarttags_get_smart_tag_class_name', '', $smart_tag_name );
return class_exists( $full_class_name ) ? $full_class_name : Generic::class;
}
/**
* Retrieve the builder's special tags.
*
* @since 1.6.7
*
* @return array
*/
protected function get_replacement_builder_tags() {
return [
'date' => 'date format="m/d/Y"',
'query_var' => 'query_var key=""',
'user_meta' => 'user_meta key=""',
];
}
/**
* Hide smart tags in the builder.
*
* @since 1.6.7
*
* @return array
*/
protected function get_hidden_builder_tags() {
return [
'field_id',
'field_html_id',
'field_value_id',
];
}
/**
* Builder tags.
*
* @since 1.6.7
*
* @return array
*/
public function builder() {
$smart_tags = $this->get_smart_tags();
$replacement_tags = $this->get_replacement_builder_tags();
$hidden_tags = $this->get_hidden_builder_tags();
foreach ( $replacement_tags as $tag => $replacement_tag ) {
$smart_tags = wpforms_array_insert( $smart_tags, [ $replacement_tag => $smart_tags[ $tag ] ], $tag );
unset( $smart_tags[ $tag ] );
}
foreach ( $hidden_tags as $hidden_tag ) {
unset( $smart_tags[ $hidden_tag ] );
}
return $smart_tags;
}
/**
* Replace a found smart tag with the final value.
*
* @since 1.6.7
*
* @param string $tag The tag.
* @param string $value The value.
* @param string $content Content.
*
* @return string
*/
private function replace( $tag, $value, $content ) {
return str_replace( $tag, strip_shortcodes( $value ), $content );
}
/**
* Replace a found smart tag with the final value.
*
* @codeCoverageIgnore
*
* @since 1.5.9
* @deprecated 1.6.7
*
* @param string $tag The tag.
* @param string $value The value.
* @param string $content Content.
*
* @return string
*/
public function parse( $tag, $value, $content ) {
_deprecated_function( __METHOD__, '1.6.7 of the WPForms plugin' );
return $this->replace( $tag, $value, $content );
}
/**
* Filter arguments passed to the async task.
*
* @since 1.9.4
*
* @param array|mixed $args Arguments passed to the async task.
*/
public function save_smart_tags_tasks_meta( $args ): array {
$args = (array) $args;
$process = wpforms()->obj( 'process' );
if ( ! $process || empty( $process->form_data['entry_meta'] ) ) {
return $args;
}
$args['entry_meta'] = $process->form_data['entry_meta'];
return $args;
}
/**
* Maybe add a fallback for entry meta for WPForms Action Scheduler tasks meta.
*
* @since 1.9.4
*
* @param int|mixed $action_id Action ID.
* @param ActionScheduler_Action $action Action Scheduler action object.
*
* @noinspection PhpUnusedParameterInspection
* @noinspection PhpMissingParamTypeInspection
*/
public function maybe_add_entry_meta_fallback_value( $action_id, $action ): void { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
$this->action_args = $action->get_args();
$this->fallback = function ( $value, $var_name ) {
if ( ! wpforms_is_empty_string( $value ) ) {
return $value;
}
return $this->action_args['entry_meta'][ $var_name ] ?? $value;
};
add_filter( 'wpforms_smart_tags_smart_tag_get_meta_value', $this->fallback, 10, 2 );
}
/**
* Maybe remove a fallback for entry meta for WPForms Action Scheduler tasks meta.
*
* @since 1.9.4
*/
public function maybe_remove_entry_meta_fallback_value(): void { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if ( ! $this->fallback ) {
return;
}
remove_filter( 'wpforms_smart_tags_smart_tag_get_meta_value', $this->fallback );
}
}
er_last_name' => esc_html__( 'User Last Name', 'wpforms-lite' ),
'user_email' => esc_html__( 'User Email', 'wpforms-lite' ),
'user_meta' => esc_html__( 'User Meta', 'wpforms-lite' ),
'author_id' => esc_html__( 'Author ID', 'wpforms-lite' ),
'author_display' => esc_html__( 'Author Name', 'wpforms-lite' ),
'author_email' => esc_html__( 'Author Email', 'wpforms-lite' ),
'url_referer' => esc_html__( 'Referrer URL', 'wpforms-lite' ),
'url_login' => esc_html__( 'Login URL', 'wpforms-lite' ),
'url_logout' => esc_html__( 'Logout URL', 'wpforms-lite' ),
'url_register' => esc_html__( 'Register URL', 'wpforms-lite' ),
'url_lost_password' => esc_html__( 'Lost Password URL', 'wpforms-lite' ),
'unique_value' => esc_html__( 'Unique Value', 'wpforms-lite' ),
'site_name' => esc_html__( 'Site Name', 'wpforms-lite' ),
'order_summary' => esc_html__( 'Order Summary', 'wpforms-lite' ),
];
}
/**
* Get all smart tags in the content.
*
* @since 1.6.7
*
* @param string $content Content.
*
* @return array
*/
private function get_all_smart_tags( $content ) {
/**
* A smart tag should start and end with a curly brace.
* ([a-z0-9_]+) a smart tag name and also the first capturing group. Lowercase letters, digits, and an underscore.
* (|[ =][^\n}]*) - second capturing group:
* | no characters at all or the following:
* [ =][^\n}]* space or equal sign and any number of any characters except new line and closing curly brace.
*/
preg_match_all( '~{([a-z0-9_]+)(|[ =][^\n}]*)}~', $content, $smart_tags );
return array_combine( $smart_tags[0], $smart_tags[1] );
}
/**
* Process smart tags.
*
* @since 1.6.7
* @since 1.8.7 Added `$context` parameter.
*
* @param string $content Content.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param string $entry_id Entry ID.
* @param string $context Context.
*
* @return string
*/
public function process( $content, $form_data, $fields = [], $entry_id = '', $context = '' ) {
// We shouldn't process smart tags in different WordPress editors
// since it produce unexpected results.
if ( wpforms_is_editor_page() ) {
return $content;
}
$smart_tags = $this->get_all_smart_tags( $content );
if ( empty( $smart_tags ) ) {
return $content;
}
foreach ( $smart_tags as $smart_tag => $tag_name ) {
$class_name = $this->get_smart_tag_class_name( $tag_name );
$smart_tag_object = new $class_name( $smart_tag, $context );
$value = $smart_tag_object->get_value( $form_data, $fields, $entry_id );
$field_id = $smart_tag_object->get_attributes()['field_id'] ?? 0;
$field_id = (int) explode( '|', $field_id )[0];
if (
$context === 'confirmation_redirect' &&
$field_id > 0 &&
in_array(
$fields[ $field_id ]['type'],
wpforms_get_multi_fields(),
true
)
) {
// Protect from the case where user already placed a pipe in the value.
$value = str_replace(
[ "\r\n", "\r", "\n", '|' ],
[ rawurlencode( '|' ), '|', '|', '|' ],
$value
);
}
/**
* Modify the smart tag value.
*
* @since 1.6.7
* @since 1.6.7.1 Added the 5th argument.
* @since 1.9.0 Added the 6th argument.
*
* @param scalar|null $value Smart Tag value.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
* @param string $context Context.
*/
$value = apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
"wpforms_smarttags_process_{$tag_name}_value",
$value,
$form_data,
$fields,
$entry_id,
$smart_tag_object,
$context
);
/**
* Modify a smart tag value.
*
* @since 1.6.7.1
*
* @param scalar|null $value Smart Tag value.
* @param string $tag_name Smart tag name.
* @param array $form_data Form data.
* @param array $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
*/
$value = apply_filters(
'wpforms_smarttags_process_value',
$value,
$tag_name,
$form_data,
$fields,
$entry_id,
$smart_tag_object
);
if ( $value !== null ) {
$content = $this->replace( $smart_tag, $value, $content );
}
/**
* Modify content with smart tags.
*
* @since 1.4.0
* @since 1.6.7.1 Added 3rd, 4th, 5th, 6th arguments.
*
* @param string $content Content of the Smart Tag.
* @param string $tag_name Tag name of the Smart Tag.
* @param array $form_data Form data.
* @param string $fields List of fields.
* @param int $entry_id Entry ID.
* @param SmartTag $smart_tag_object The smart tag object or the Generic object for those cases when class unregistered.
*/
$content = (string) apply_filters(
'wpforms_smart_tag_process',
$content,
$tag_name,
$form_data,
$fields,
$entry_id,
$smart_tag_object
);
}
return $content;
}
/**
* Determine if the smart tag is registered.
*
* @since 1.6.7
*
* @param string $smart_tag_name Smart tag name.
*
* @return bool
*/
protected function has_smart_tag( $smart_tag_name ) {
return array_key_exists( $smart_tag_name, $this->get_smart_tags() );
}
/**
* Get smart tag class name.
*
* @since 1.6.7
*
* @param string $smart_tag_name Smart tag name.
*
* @return string
*/
protected function get_smart_tag_class_name( $smart_tag_name ) {
if ( ! $this->has_smart_tag( $smart_tag_name ) ) {
return Generic::class;
}
$class_name = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $smart_tag_name ) ) );
$full_class_name = '\\WPForms\\SmartTags\\SmartTag\\' . $class_name;
if ( class_exists( $full_class_name ) ) {
return $full_class_name;
}
/**
* Modify a smart tag class name that describes the smart tag logic.
*
* @since 1.6.7
*
* @param string $class_name The value.
* @param string $smart_tag_name Smart tag name.
*/
$full_class_name = apply_filters( 'wpforms_smarttags_get_smart_tag_class_name', '', $smart_tag_name );
return class_exists( $full_class_name ) ? $full_class_name : Generic::class;
}
/**
* Retrieve the builder's special tags.
*
* @since 1.6.7
*
* @return array
*/
protected function get_replacement_builder_tags() {
return [
'date' => 'date format="m/d/Y"',
'query_var' => 'query_var key=""',
'user_meta' => 'user_meta key=""',
];
}
/**
* Hide smart tags in the builder.
*
* @since 1.6.7
*
* @return array
*/
protected function get_hidden_builder_tags() {
return [
'field_id',
'field_html_id',
'field_value_id',
];
}
/**
* Builder tags.
*
* @since 1.6.7
*
* @return array
*/
public function builder() {
$smart_tags = $this->get_smart_tags();
$replacement_tags = $this->get_replacement_builder_tags();
$hidden_tags = $this->get_hidden_builder_tags();
foreach ( $replacement_tags as $tag => $replacement_tag ) {
$smart_tags = wpforms_array_insert( $smart_tags, [ $replacement_tag => $smart_tags[ $tag ] ], $tag );
unset( $smart_tags[ $tag ] );
}
foreach ( $hidden_tags as $hidden_tag ) {
unset( $smart_tags[ $hidden_tag ] );
}
return $smart_tags;
}
/**
* Replace a found smart tag with the final value.
*
* @since 1.6.7
*
* @param string $tag The tag.
* @param string $value The value.
* @param string $content Content.
*
* @return string
*/
private function replace( $tag, $value, $content ) {
return str_replace( $tag, strip_shortcodes( $value ), $content );
}
/**
* Replace a found smart tag with the final value.
*
* @codeCoverageIgnore
*
* @since 1.5.9
* @deprecated 1.6.7
*
* @param string $tag The tag.
* @param string $value The value.
* @param string $content Content.
*
* @return string
*/
public function parse( $tag, $value, $content ) {
_deprecated_function( __METHOD__, '1.6.7 of the WPForms plugin' );
return $this->replace( $tag, $value, $content );
}
/**
* Filter arguments passed to the async task.
*
* @since 1.9.4
*
* @param array|mixed $args Arguments passed to the async task.
*/
public function save_smart_tags_tasks_meta( $args ): array {
$args = (array) $args;
$process = wpforms()->obj( 'process' );
if ( ! $process || empty( $process->form_data['entry_meta'] ) ) {
return $args;
}
$args['entry_meta'] = $process->form_data['entry_meta'];
return $args;
}
/**
* Maybe add a fallback for entry meta for WPForms Action Scheduler tasks meta.
*
* @since 1.9.4
*
* @param int|mixed $action_id Action ID.
* @param ActionScheduler_Action $action Action Scheduler action object.
*
* @noinspection PhpUnusedParameterInspection
* @noinspection PhpMissingParamTypeInspection
*/
public function maybe_add_entry_meta_fallback_value( $action_id, $action ): void { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
$this->action_args = $action->get_args();
$this->fallback = function ( $value, $var_name ) {
if ( ! wpforms_is_empty_string( $value ) ) {
return $value;
}
return $this->action_args['entry_meta'][ $var_name ] ?? $value;
};
add_filter( 'wpforms_smart_tags_smart_tag_get_meta_value', $this->fallback, 10, 2 );
}
/**
* Maybe remove a fallback for entry meta for WPForms Action Scheduler tasks meta.
*
* @since 1.9.4
*/
public function maybe_remove_entry_meta_fallback_value(): void { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if ( ! $this->fallback ) {
return;
}
remove_filter( 'wpforms_smart_tags_smart_tag_get_meta_value', $this->fallback );
}
}
Warning: Class "WPForms\SmartTags\SmartTags" not found in /htdocs/tapicarpro.com/wp-content/plugins/wpforms-lite/includes/deprecated.php on line 165
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypes\FeaturedProduct" not found in /htdocs/tapicarpro.com/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:115
Stack trace:
#0 /htdocs/tapicarpro.com/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('')
#1 /htdocs/tapicarpro.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#2 /htdocs/tapicarpro.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /htdocs/tapicarpro.com/wp-settings.php(727): do_action('init')
#4 /htdocs/tapicarpro.com/wp-config.php(98): require_once('/htdocs/tapicar...')
#5 /htdocs/tapicarpro.com/wp-load.php(50): require_once('/htdocs/tapicar...')
#6 /htdocs/tapicarpro.com/wp-blog-header.php(13): require_once('/htdocs/tapicar...')
#7 /htdocs/tapicarpro.com/index.php(17): require('/htdocs/tapicar...')
#8 {main}
thrown in /htdocs/tapicarpro.com/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 115