Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined( 'ABSPATH' ) ) { die( 'Tranquility - the highest manifestation of power!' ); }
- class Fw_Theme_Widget_OurFriends extends WP_Widget {
- private
- $options;
- /**
- * Widget constructor.
- */
- function __construct() {
- $widget_ops = array( 'description' => __( 'Display your friendly websites.', 'unyson' ) );
- parent::__construct( false, __( 'Kronos / Our friends', 'unyson' ), $widget_ops );
- $this->options = array(
- 'widget-title' => array(
- 'type' => 'text',
- 'label' => __('Title', 'unyson'),
- 'placeholder' => ''
- ),
- 'widget-text' => array(
- 'type' => 'textarea',
- 'label' => __('Title', 'unyson'),
- 'help' => __('Widget title', 'unyson'),
- 'placeholder' => ''
- ),
- 'widget-check' => array(
- 'type' => 'checkbox',
- 'label' => __('Title', 'unyson'),
- 'help' => __('Widget title', 'unyson')
- ),
- 'widget-repeatable' => array(
- 'type' => 'repeatable',
- 'label' => __('REPEATABLE', 'unyson'),
- 'help' => __('Testing? :)', 'unyson'),
- 'values' => array(
- array(
- 'type' => 'text',
- 'label' => __('test', 'unyson'),
- 'help' => 'yey!'
- ),
- array(
- 'type' => 'textarea',
- 'label' => __('test 2', 'unyson'),
- 'help' => 'yey!'
- ),
- array(
- 'type' => 'checkbox',
- 'label' => __('test 3', 'unyson'),
- 'help' => 'yey!'
- )
- )
- ),
- );
- }
- function widget( $args, $instance ) {
- extract( $args );
- $params = array();
- foreach ( $instance as $key => $value ) {
- $params[ $key ] = $value;
- }
- $title = $before_title . $params['widget-title'] . $after_title;
- unset( $params['widget-title'] );
- $filepath = dirname( __FILE__ ) . '/views/widget.php';
- $instance = $params;
- $before_widget = str_replace( 'class="', 'class="windy-wrapper ', $before_widget );
- if ( file_exists( $filepath ) ) {
- include( $filepath );
- }
- }
- function update( $new_instance, $old_instance ) {
- $builder = new PrilerWidgetOptionsFramework($this->options);
- $values = $builder->get_values();
- $instance = wp_parse_args( (array) $new_instance, $old_instance );
- $instance = array_merge($instance, $values);
- return $instance;
- }
- function form( $instance ) {
- $builder = new PrilerWidgetOptionsFramework($this->options, $instance);
- $builder->render_options();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement