File: /home/hzaluminio/www/wp-content/plugins/Ebor-Framework-master/vc_blocks/pillar/functions.php
<?php
if(!( function_exists('ebor_icons_settings_field') )){
function ebor_icons_settings_field( $settings, $value ) {
$icons = $settings['value'];
$output = '<a href="#" id="ebor-icon-toggle" class="button button-primary button-large">Show/Hide Icons</a><div class="ebor-icons"><div class="ebor-icons-wrapper">';
foreach( $icons as $icon ){
$active = ( $value == $icon) ? ' active' : '';
$output .= '<i class="icon '. $icon . $active .'" data-icon-class="'. $icon .'"></i>';
}
$output .= '</div><input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-textinput ebor-icon-value ' .
esc_attr( $settings['param_name'] ) . ' ' .
esc_attr( $settings['type'] ) . '_field" type="text" value="' . esc_attr( $value ) . '" />' . '</div>';
return $output;
}
vc_add_shortcode_param( 'ebor_icons', 'ebor_icons_settings_field' );
}
/*-----------------------------------------------------------------------------------*/
/* TWITTER WIDGET
/*-----------------------------------------------------------------------------------*/
if(!( class_exists('ebor_Twitter_Widget') )){
class ebor_Twitter_Widget extends WP_Widget {
/**
* Sets up the widgets name etc
*/
public function __construct(){
parent::__construct(
'ebor-twitter-widget', // Base ID
esc_html__('Pillar: Twitter Widget', 'pillar'), // Name
array( 'description' => esc_html__( 'Add a simple Twitter feed widget', 'pillar' ), ) // Args
);
}
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
$defaults = array(
'username' => '',
'user_name' => '',
);
$instance = wp_parse_args((array) $instance, $defaults);
extract($instance);
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) )
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title'];
if ( isset( $instance['username'] ) || isset( $instance['user_name'] ) )
echo '<div class="twitter-feed"><div class="tweets-feed" data-amount="2" data-widget-id="'. $instance['username'] .'" data-user-name="'. $instance['user_name'] .'"></div></div>';
echo $args['after_widget'];
}
/**
* Outputs the options form on admin
*
* @param array $instance The widget options
*/
public function form( $instance ) {
$defaults = array(
'title' => 'Twitter Feed',
'username' => '',
'user_name' => '',
);
$instance = wp_parse_args((array) $instance, $defaults);
extract($instance);
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'pillar' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
</p>
<p>
<label for="<?php echo $this->get_field_id( 'user_name' ); ?>">Twitter Username <code>e.g: tommusrhodus</code>
<p class="description">Do not use @, plain text username only!</p></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'user_name' ); ?>" name="<?php echo $this->get_field_name( 'user_name' ); ?>" type="text" value="<?php echo esc_attr( $user_name ); ?>">
</p>
<p>
<label for="<?php echo $this->get_field_id( 'username' ); ?>">Twitter Widget ID <code>e.g: 492085717044981760</code>
<p class="description">
<strong>Note!</strong> DEPRECATED: Will continue to work for existing users, new users please use the username field above.</p></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'username' ); ?>" name="<?php echo $this->get_field_name( 'username' ); ?>" type="text" value="<?php echo esc_attr( $username ); ?>">
</p>
<?php
}
/**
* Processing widget options on save
*
* @param array $new_instance The new options
* @param array $old_instance The previous options
*/
public function update( $new_instance, $old_instance ) {
return $new_instance;
}
}
function ebor_framework_register_ebor_twitter(){
register_widget( 'ebor_Twitter_Widget' );
}
add_action( 'widgets_init', 'ebor_framework_register_ebor_twitter');
}