config = $config;
$this->add_hooks();
}
/**
* Render the wizard.
*
* @since 2.0.0
*/
public function render() {
$allowed_html = array(
'a' => array(
'href' => array(),
'id' => array(),
'target' => array(),
),
'br' => array(),
'div' => array(
'class' => array(),
'id' => array(),
),
'em' => array(),
'h3' => array(),
'input' => array(
'checked' => array(),
'class' => array(),
'data-choice' => array(),
'id' => array(),
'name' => array(),
'type' => array(),
'value' => array(),
),
'label' => array(
'for' => array(),
),
'p' => array(
'class' => array(),
'id' => array(),
),
'span' => array(
'class' => array(),
'id' => array(),
),
'strong' => array(),
'table' => array(
'class' => array(),
'id' => array(),
),
'tbody' => array(),
'td' => array(),
'th' => array(),
'thead' => array(),
'tr' => array(),
);
?>
config['slides'] as $number => $slide ) {
$number++;
$element_id = 'w3tc-wizard-slide-' . ( isset( $slide['id'] ) ? $slide['id'] : $number );
?>
config['actions'] ) && is_array( $this->config['actions'] ) ) {
foreach ( $this->config['actions'] as $action ) {
add_action(
$action['tag'],
$action['function'],
empty( $action['priority'] ) ? 10 : $action['priority'],
empty( $action['accepted_args'] ) ? 1 : $action['accepted_args']
);
}
}
if ( isset( $this->config['filters'] ) && is_array( $this->config['filters'] ) ) {
foreach ( $this->config['filters'] as $filter ) {
add_filter(
$filter['tag'],
$filter['function'],
empty( $filter['priority'] ) ? 10 : $filter['priority'],
empty( $filter['accepted_args'] ) ? 1 : $filter['accepted_args']
);
}
}
}
/**
* Rnqueue scripts.
*
* @since 2.0.0
*/
public function enqueue_scripts() {
wp_enqueue_script(
'w3tc_wizard',
esc_url( plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'pub/js/wizard.js' ),
array( 'jquery' ),
W3TC_VERSION,
false
);
wp_localize_script(
'w3tc_wizard',
'W3TC_Wizard',
array(
'beforeunloadText' => __( 'Are you sure that you want to leave this page?', 'w3-total-cache' ),
)
);
wp_enqueue_script( 'w3tc_wizard' );
if ( isset( $this->config['scripts'] ) && is_array( $this->config['scripts'] ) ) {
foreach ( $this->config['scripts'] as $script ) {
wp_register_script(
$script['handle'],
$script['src'],
is_array( $script['deps'] ) ? $script['deps'] : array(),
empty( $script['version'] ) ? gmdate( 'YmdHm' ) : $script['version'],
! empty( $script['in_footer'] )
);
if ( isset( $script['localize'] ) && is_array( $script['localize'] ) ) {
wp_localize_script(
$script['handle'],
$script['localize']['object_name'],
(array) $script['localize']['data']
);
}
wp_enqueue_script( $script['handle'] );
}
}
}
/**
* Enqueue styles.
*
* @since 2.0.0
*/
public function enqueue_styles() {
wp_enqueue_style(
'w3tc_wizard',
esc_url( plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'pub/css/wizard.css' ),
array(),
W3TC_VERSION
);
if ( isset( $this->config['styles'] ) && is_array( $this->config['styles'] ) ) {
foreach ( $this->config['styles'] as $style ) {
wp_enqueue_style(
$style['handle'],
$style['src'],
isset( $style['deps'] ) && is_array( $style['deps'] ) ?
$style['deps'] : array(),
! empty( $style['version'] ) ? $style['version'] : gmdate( 'YmdHm' ),
! empty( $style['media'] ) ? $style['media'] : 'all'
);
}
}
}
}