| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/www/wp-content/themes/trackstore/framework/modules/widgets/button-widget/ |
Upload File : |
<?php
class TrackStoreElatedButtonWidget extends TrackStoreElatedWidget {
public function __construct() {
parent::__construct(
'eltd_button_widget',
esc_html__( 'Elated Button Widget', 'trackstore' ),
array( 'description' => esc_html__( 'Add button element to widget areas', 'trackstore' ) )
);
$this->setParams();
}
protected function setParams() {
$this->params = array_merge(
array(
array(
'type' => 'dropdown',
'name' => 'type',
'title' => esc_html__( 'Type', 'trackstore' ),
'options' => array(
'solid' => esc_html__( 'Solid', 'trackstore' ),
'outline' => esc_html__( 'Outline', 'trackstore' ),
'simple' => esc_html__( 'Simple', 'trackstore' )
)
),
array(
'type' => 'dropdown',
'name' => 'size',
'title' => esc_html__( 'Size', 'trackstore' ),
'options' => array(
'small' => esc_html__( 'Small', 'trackstore' ),
'medium' => esc_html__( 'Medium', 'trackstore' ),
'large' => esc_html__( 'Large', 'trackstore' ),
'huge' => esc_html__( 'Huge', 'trackstore' )
),
'description' => esc_html__( 'This option is only available for solid and outline button type', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'text',
'title' => esc_html__( 'Text', 'trackstore' ),
'default' => esc_html__( 'Button Text', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'link',
'title' => esc_html__( 'Link', 'trackstore' )
),
array(
'type' => 'dropdown',
'name' => 'target',
'title' => esc_html__( 'Link Target', 'trackstore' ),
'options' => trackstore_elated_get_link_target_array()
),
array(
'type' => 'textfield',
'name' => 'color',
'title' => esc_html__( 'Color', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'hover_color',
'title' => esc_html__( 'Hover Color', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'background_color',
'title' => esc_html__( 'Background Color', 'trackstore' ),
'description' => esc_html__( 'This option is only available for solid button type', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'hover_background_color',
'title' => esc_html__( 'Hover Background Color', 'trackstore' ),
'description' => esc_html__( 'This option is only available for solid button type', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'border_color',
'title' => esc_html__( 'Border Color', 'trackstore' ),
'description' => esc_html__( 'This option is only available for solid and outline button type', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'hover_border_color',
'title' => esc_html__( 'Hover Border Color', 'trackstore' ),
'description' => esc_html__( 'This option is only available for solid and outline button type', 'trackstore' )
),
array(
'type' => 'textfield',
'name' => 'margin',
'title' => esc_html__( 'Margin', 'trackstore' ),
'description' => esc_html__( 'Insert margin in format: top right bottom left (e.g. 10px 5px 10px 5px)', 'trackstore' )
),
array(
'type' => 'dropdown',
'name' => 'icon_position',
'title' => esc_html__( 'Icon position', 'trackstore' ),
'options' => array(
'' => esc_html__( 'Default', 'trackstore' ),
'left' => esc_html__( 'Left', 'trackstore' ),
'right' => esc_html__( 'Right', 'trackstore' )
)
),
array(
'type' => 'textfield',
'name' => 'icon_size',
'title' => esc_html__( 'Icon Size (px)', 'trackstore' )
)
) ,
trackstore_elated_icon_collections()->getIconWidgetParamsArray()
);
}
public function widget( $args, $instance ) {
$params = '';
if ( ! is_array( $instance ) ) {
$instance = array();
}
// Filter out all empty params
$instance = array_filter( $instance, function ( $array_value ) {
return trim( $array_value ) != '';
} );
// Default values
if ( ! isset( $instance['text'] ) ) {
$instance['text'] = 'Button Text';
}
// Generate shortcode params
foreach ( $instance as $key => $value ) {
$params .= " $key='$value' ";
}
echo '<div class="widget eltd-button-widget">';
echo do_shortcode( "[eltd_button $params]" ); // XSS OK
echo '</div>';
}
}