/** * Initialize the CTA widget */ function initialize() { if (!class_exists('SiteOrigin_Widget_Button_Widget')) { include plugin_dir_path(__FILE__) . '../so-button-widget/so-button-widget.php'; siteorigin_widget_register('button', realpath(plugin_dir_path(__FILE__) . '../so-button-widget/so-button-widget.php')); } }
/** * Initialize the CTA widget */ function initialize() { if (!class_exists('SiteOrigin_Widget_Button_Widget')) { include plugin_dir_path(__FILE__) . '../so-button-widget/so-button-widget.php'; siteorigin_widget_register('button', realpath(plugin_dir_path(__FILE__) . '../so-button-widget/so-button-widget.php')); } $this->register_frontend_styles(array(array('sow-cta-main', siteorigin_widget_get_plugin_dir_url('cta') . 'css/style.css', array(), SOW_BUNDLE_VERSION))); $this->register_frontend_scripts(array(array('sow-cta-main', siteorigin_widget_get_plugin_dir_url('cta') . 'js/cta' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery'), SOW_BUNDLE_VERSION))); }
function initialize() { if (!class_exists('SiteOrigin_Widget_Button_Widget')) { // We need to include the button include plugin_dir_path(SOW_BUNDLE_BASE_FILE) . 'widgets/so-button-widget/so-button-widget.php'; siteorigin_widget_register('button', plugin_dir_path(SOW_BUNDLE_BASE_FILE) . 'widgets/so-button-widget/so-button-widget.php'); } // Let the slider base class do its initialization parent::initialize(); }
<?php /* Widget Name: Post widget Description: Gives you a widget to display your posts. Author: Rafin/Sudip */ class SiteOrigin_Widget_Post_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('sow-post', __('Kreativa:Posts', 'siteorigin-widgets'), array('description' => __('Display your posts .', 'siteorigin-widgets')), array(), array('posts' => array('type' => 'posts', 'label' => __('Posts query', 'siteorigin-widgets'))), plugin_dir_path(__FILE__) . '../'); } function initialize() { $this->register_frontend_scripts(array(array('touch-swipe', plugin_dir_url(SOW_BUNDLE_BASE_FILE) . 'js/jquery.touchSwipe' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery'), '1.6.6'), array('sow-carousel-basic', siteorigin_widget_get_plugin_dir_url('post') . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery', 'touch-swipe'), SOW_BUNDLE_VERSION, true))); $this->register_frontend_styles(array(array('sow-carousel-basic', siteorigin_widget_get_plugin_dir_url('post') . 'css/style.css', array(), SOW_BUNDLE_VERSION))); } function get_template_name($instance) { return 'base'; } function get_style_name($instance) { return false; } } siteorigin_widget_register('post', __FILE__);
<?php /* Widget Name: Livemesh Stats Bars Description: Display multiple stats bars that talk about skills or other percentage stats. Author: LiveMesh Author URI: http://portfoliotheme.org */ class LSOW_Stats_Bars_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('lsow-stats-bars', __('Livemesh Stats Bars', 'livemesh-so-widgets'), array('description' => __('Display statistics or skills as a percentage stats bar.', 'livemesh-so-widgets'), 'panels_icon' => 'dashicons dashicons-minus', 'help' => 'http://portfoliotheme.org/widgets-bundle/stats-bar-widget-documentation/'), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'livemesh-so-widgets')), 'stats-bars' => array('type' => 'repeater', 'label' => __('Stats Bars', 'livemesh-so-widgets'), 'item_name' => __('Stats Bar', 'livemesh-so-widgets'), 'item_label' => array('selector' => "[id*='stats-bars-title']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('title' => array('type' => 'text', 'label' => __('Stats Title', 'livemesh-so-widgets'), 'description' => __('The title for the stats bar', 'livemesh-so-widgets')), 'value' => array('type' => 'text', 'label' => __('Percentage Value', 'livemesh-so-widgets'), 'description' => __('The percentage value for the stats.', 'livemesh-so-widgets')), 'color' => array('type' => 'color', 'label' => __('Bar color', 'livemesh-so-widgets')))))); } function initialize() { $this->register_frontend_scripts(array(array('lsow-waypoints', LSOW_PLUGIN_URL . 'assets/js/jquery.waypoints' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery'), LSOW_VERSION))); $this->register_frontend_scripts(array(array('lsow-stats-bar', plugin_dir_url(__FILE__) . 'js/stats-bar' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery')))); $this->register_frontend_styles(array(array('lsow-stats-bar', plugin_dir_url(__FILE__) . 'css/style.css'))); } function get_template_variables($instance, $args) { return array('stats_bars' => !empty($instance['stats-bars']) ? $instance['stats-bars'] : array()); } } siteorigin_widget_register('lsow-stats-bars', __FILE__, 'LSOW_Stats_Bars_Widget');
Widget Name: Features widget Description: Displays a block of features with icons. Author: Greg Priday Author URI: http://siteorigin.com */ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('sow-features', __('SiteOrigin Features', 'siteorigin-widgets'), array('description' => __('Displays a list of features.', 'siteorigin-widgets'), 'help' => 'http://siteorigin.com/widgets-bundle/features-widget-documentation/'), array(), array('features' => array('type' => 'repeater', 'label' => __('Features', 'siteorigin-widgets'), 'item_name' => __('Feature', 'siteorigin-widgets'), 'item_label' => array('selector' => "[id*='features-title']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('container_color' => array('type' => 'color', 'label' => __('Container color', 'siteorigin-widgets'), 'default' => '#404040'), 'icon' => array('type' => 'icon', 'label' => __('Icon', 'siteorigin-widgets')), 'icon_color' => array('type' => 'color', 'label' => __('Icon color', 'siteorigin-widgets'), 'default' => '#FFFFFF'), 'icon_image' => array('type' => 'media', 'library' => 'image', 'label' => __('Icon image', 'siteorigin-widgets'), 'description' => __('Use your own icon image.', 'siteorigin-widgets')), 'title' => array('type' => 'text', 'label' => __('Title text', 'siteorigin-widgets')), 'text' => array('type' => 'text', 'label' => __('Text', 'siteorigin-widgets')), 'more_text' => array('type' => 'text', 'label' => __('More link text', 'siteorigin-widgets')), 'more_url' => array('type' => 'link', 'label' => __('More link URL', 'siteorigin-widgets')))), 'container_shape' => array('type' => 'select', 'label' => __('Container shape', 'siteorigin-widgets'), 'options' => array()), 'container_size' => array('type' => 'number', 'label' => __('Container size', 'siteorigin-widgets'), 'default' => 84), 'icon_size' => array('type' => 'number', 'label' => __('Icon size', 'siteorigin-widgets'), 'default' => 24), 'per_row' => array('type' => 'number', 'label' => __('Features per row', 'siteorigin-widgets'), 'default' => 3), 'responsive' => array('type' => 'checkbox', 'label' => __('Responsive layout', 'siteorigin-widgets'), 'default' => true), 'title_link' => array('type' => 'checkbox', 'label' => __('Link feature title to more URL', 'siteorigin-widgets'), 'default' => false), 'icon_link' => array('type' => 'checkbox', 'label' => __('Link icon to more URL', 'siteorigin-widgets'), 'default' => false), 'new_window' => array('type' => 'checkbox', 'label' => __('Open more URL in a new window', 'siteorigin-widgets'), 'default' => false)), plugin_dir_path(__FILE__) . '../'); } function initialize() { $this->register_frontend_styles(array(array('siteorigin-widgets', siteorigin_widget_get_plugin_dir_url('features') . 'css/style.css', array(), SOW_BUNDLE_VERSION))); } function get_style_name($instance) { return false; } function get_template_name($instance) { return 'base'; } function modify_form($form) { $form['container_shape']['options'] = (include dirname(__FILE__) . '/inc/containers.php'); return $form; } } siteorigin_widget_register('features', __FILE__);
} /** * * Update older versions of widget to use multiple sources. * * @param $instance * * @return mixed */ function modify_instance($instance) { $video_src = array(); if (isset($instance['video']['self_video']) && !empty($instance['video']['self_video'])) { $video_src['self_video'] = $instance['video']['self_video']; unset($instance['video']['self_video']); } if (isset($instance['video']['self_video_fallback']) && !empty($instance['video']['self_video_fallback'])) { $video_src['self_video_fallback'] = $instance['video']['self_video_fallback']; unset($instance['video']['self_video_fallback']); } if (!empty($video_src)) { if (!isset($instance['video']['self_sources'])) { $instance['video']['self_sources'] = array(); } $instance['video']['self_sources'][] = $video_src; } return $instance; } } siteorigin_widget_register('video', __FILE__, 'SiteOrigin_Widget_Video_Widget');
} if (isset($instance['font_size'])) { $instance['design']['font_size'] = $instance['font_size']; } if (isset($instance['rounding'])) { $instance['design']['rounding'] = $instance['rounding']; } if (isset($instance['padding'])) { $instance['design']['padding'] = $instance['padding']; } unset($instance['align']); unset($instance['theme']); unset($instance['button_color']); unset($instance['text_color']); unset($instance['hover']); unset($instance['font_size']); unset($instance['rounding']); unset($instance['padding']); } if (empty($instance['attributes'])) { $instance['attributes'] = array(); if (isset($instance['id'])) { $instance['attributes']['id'] = $instance['id']; } unset($instance['id']); } return $instance; } } siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
ob_start(); include 'tpl/carousel-post-loop.php'; $result = array('html' => ob_get_clean()); header('content-type: application/json'); echo json_encode($result); exit; } add_action('wp_ajax_sow_carousel_load', 'sow_carousel_get_next_posts_page'); add_action('wp_ajax_nopriv_sow_carousel_load', 'sow_carousel_get_next_posts_page'); class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('sow-post-carousel', __('SiteOrigin Post Carousel', 'so-widgets-bundle'), array('description' => __('Display your posts as a carousel.', 'so-widgets-bundle'), 'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'so-widgets-bundle')), 'posts' => array('type' => 'posts', 'label' => __('Posts query', 'so-widgets-bundle'))), plugin_dir_path(__FILE__) . '../'); } function initialize() { $this->register_frontend_scripts(array(array('touch-swipe', plugin_dir_url(SOW_BUNDLE_BASE_FILE) . 'js/jquery.touchSwipe' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery'), '1.6.6'), array('sow-carousel-basic', plugin_dir_url(__FILE__) . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js', array('jquery', 'touch-swipe'), SOW_BUNDLE_VERSION, true))); $this->register_frontend_styles(array(array('sow-carousel-basic', SOW_BUNDLE_URI . 'widgets/post-carousel/' . 'css/style.css', array(), SOW_BUNDLE_VERSION))); } function get_template_name($instance) { return 'base'; } function get_style_name($instance) { return false; } } siteorigin_widget_register('sow-post-carousel', __FILE__, 'SiteOrigin_Widget_PostCarousel_Widget');
Author URI: https://wpinked.com */ class Inked_Media_Box_SO_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('ink-media-box', __('Inked Media Box', 'wpinked-widgets'), array('description' => __('Highlight important bits of information.', 'wpinked-widgets'), 'help' => 'http://docs.wpinked.com/widgets-for-siteorigin/media-box-widget'), array(), array('admin' => array('type' => 'text', 'label' => __('Admin Label', 'wpinked-widgets'), 'default' => ''), 'box' => array('type' => 'section', 'label' => __('Box Settings', 'wpinked-widgets'), 'hide' => true, 'fields' => array('media' => array('type' => 'select', 'label' => __('Media Type', 'wpinked-widgets'), 'default' => 'image', 'options' => array('image' => __('Image', 'wpinked-widgets'), 'icon' => __('Icon', 'wpinked-widgets')), 'state_emitter' => array('callback' => 'select', 'args' => array('media_type'))), 'image' => array('type' => 'media', 'fallback' => false, 'label' => __('Image', 'wpinked-widgets'), 'default' => '', 'library' => 'image', 'state_handler' => array('media_type[image]' => array('show'), 'media_type[icon]' => array('hide'))), 'icon' => array('type' => 'icon', 'label' => __('Icon', 'wpinked-widgets'), 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'title' => array('type' => 'text', 'label' => __('Title', 'wpinked-widgets'), 'default' => ''), 'content' => array('type' => 'textarea', 'label' => __('Content', 'wpinked-widgets'), 'rows' => 5), 'btn' => array('type' => 'text', 'label' => __('Button text', 'wpinked-widgets')), 'btn-url' => array('type' => 'link', 'label' => __('Destination URL', 'wpinked-widgets')), 'btn-window' => array('type' => 'checkbox', 'default' => false, 'label' => __('Open in a new window', 'wpinked-widgets')), 'btn-id' => array('type' => 'text', 'label' => __('Button ID', 'wpinked-widgets'), 'description' => __('An ID attribute allows you to target this button in Javascript.', 'wpinked-widgets')), 'btn-title' => array('type' => 'text', 'label' => __('Button Title attribute', 'wpinked-widgets'), 'description' => __('Adds a title attribute to the button link.', 'wpinked-widgets')), 'btn-onclick' => array('type' => 'text', 'label' => __('Button Onclick', 'wpinked-widgets'), 'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'wpinked-widgets')))), 'styling' => array('type' => 'section', 'label' => __('Styling', 'wpinked-widgets'), 'hide' => true, 'fields' => array('padding-top' => array('type' => 'text', 'label' => __('Padding Top', 'wpinked-widgets'), 'default' => '30px', 'description' => __('Enter the units, eg: px, em, rem, ...', 'wpinked-widgets')), 'padding-bottom' => array('type' => 'text', 'label' => __('Padding Bottom', 'wpinked-widgets'), 'default' => '30px', 'description' => __('Enter the units, eg: px, em, rem, ...', 'wpinked-widgets')), 'img-shape' => array('type' => 'select', 'label' => __('Image Shape', 'wpinked-widgets'), 'default' => '0', 'options' => array('0' => __('Sharp', 'wpinked-widgets'), '3px' => __('Slight Curve', 'wpinked-widgets'), '10px' => __('High Curve', 'wpinked-widgets'), '50%' => __('Round', 'wpinked-widgets')), 'state_handler' => array('media_type[image]' => array('show'), 'media_type[icon]' => array('hide'))), 'icon-clr' => array('type' => 'color', 'label' => __('Icon Color', 'wpinked-widgets'), 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'icon-size' => array('type' => 'text', 'label' => __('Icon Size', 'wpinked-widgets'), 'default' => '', 'description' => __('Enter the units, eg: px, em, rem, ...', 'wpinked-widgets'), 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'icon-border' => array('type' => 'checkbox', 'label' => __('Show Icon Border ?', 'wpinked-widgets'), 'default' => false, 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'icon-border-clr' => array('type' => 'color', 'label' => __('Icon Border Color', 'wpinked-widgets'), 'default' => '', 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'icon-shape' => array('type' => 'select', 'label' => __('Icon Border Shape', 'wpinked-widgets'), 'default' => '0', 'options' => array('0' => __('Sharp', 'wpinked-widgets'), '3px' => __('Slight Curve', 'wpinked-widgets'), '10px' => __('High Curve', 'wpinked-widgets'), '50%' => __('Round', 'wpinked-widgets')), 'state_handler' => array('media_type[image]' => array('hide'), 'media_type[icon]' => array('show'))), 'title' => array('type' => 'color', 'label' => __('Title Color', 'wpinked-widgets'), 'default' => ''), 'content' => array('type' => 'color', 'label' => __('Content Color', 'wpinked-widgets'), 'default' => ''), 'btn-size' => array('type' => 'select', 'label' => __('Button Size', 'wpinked-widgets'), 'default' => 'default', 'options' => array('default' => __('Default', 'wpinked-widgets'), 'full' => __('Fullwidth', 'wpinked-widgets'))), 'btn-theme' => array('type' => 'select', 'label' => __('Button Theme', 'wpinked-widgets'), 'default' => 'classic', 'options' => array('classic' => __('Classic', 'wpinked-widgets'), 'flat' => __('Flat', 'wpinked-widgets'), 'outline' => __('Outline', 'wpinked-widgets'), 'threed' => __('3D', 'wpinked-widgets'), 'shadow' => __('Shadow', 'wpinked-widgets'), 'deline' => __('Deline', 'wpinked-widgets'))), 'btn-clr' => array('type' => 'color', 'label' => __('Button Highlight Color', 'wpinked-widgets'), 'description' => __('Typically used as button background.', 'wpinked-widgets')), 'btn-base' => array('type' => 'color', 'label' => __('Button Base Color', 'wpinked-widgets'), 'description' => __('Typically used as text color.', 'wpinked-widgets')), 'btn-hover' => array('type' => 'checkbox', 'default' => true, 'label' => __('Use button hover effect ?', 'wpinked-widgets')), 'btn-click' => array('type' => 'checkbox', 'default' => true, 'label' => __('Use button click effect ?', 'wpinked-widgets')), 'btn-corners' => array('type' => 'select', 'label' => __('Button Corners', 'wpinked-widgets'), 'default' => '0.25em', 'options' => array('0em' => __('Sharp', 'wpinked-widgets'), '0.25em' => __('Slightly curved', 'wpinked-widgets'), '0.75em' => __('Highly curved', 'wpinked-widgets'), '1.5em' => __('Round', 'wpinked-widgets'))), 'background' => array('type' => 'color', 'label' => __('Media Box Background Color', 'wpinked-widgets'), 'default' => '')))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'media-box'; } function get_style_name($instance) { return 'media-box'; } function enqueue_frontend_scripts($instance) { wp_enqueue_style('iw-imgbox', siteorigin_widget_get_plugin_dir_url('ink-media-box') . 'styles/media-box.css', array(), INKED_SO_WIDGETS); parent::enqueue_frontend_scripts($instance); } function get_less_variables($instance) { if (empty($instance)) { return array(); } return array('img-shape' => $instance['styling']['img-shape'], 'icon-bdr' => $instance['styling']['icon-border'], 'icon-bdr-clr' => $instance['styling']['icon-border-clr'], 'icon-shape' => $instance['styling']['icon-shape'], 'btn-size' => $instance['styling']['btn-size'], 'btn-theme' => $instance['styling']['btn-theme'], 'btn-clr' => $instance['styling']['btn-clr'], 'btn-base' => $instance['styling']['btn-base'], 'btn-crnr' => $instance['styling']['btn-corners'], 'pad-top' => $instance['styling']['padding-top'], 'pad-btm' => $instance['styling']['padding-bottom'], 'title' => $instance['styling']['title'], 'content' => $instance['styling']['content'], 'bg' => $instance['styling']['background']); } } siteorigin_widget_register('ink-media-box', __FILE__, 'Inked_Media_Box_SO_Widget');
} if (!empty($instance['featured_button_color'])) { $color = new SiteOrigin_Widgets_Color_Object($instance['featured_button_color']); $color->lum += $color->lum > 0.75 ? -0.5 : 0.8; $colors['featured_button_text_color'] = $color->hex; } return $colors; } /** * Modify the instance to use the new icon. */ function modify_instance($instance) { if (empty($instance['columns']) || !is_array($instance['columns'])) { return $instance; } foreach ($instance['columns'] as &$column) { if (empty($column['features']) || !is_array($column['features'])) { continue; } foreach ($column['features'] as &$feature) { if (empty($feature['icon_new']) && !empty($feature['icon'])) { $feature['icon_new'] = 'fontawesome-' . $feature['icon']; } } } return $instance; } } siteorigin_widget_register('price-table', __FILE__);
/* Widget Name: Toggle Widget Description: A widget to add Toggle/Accordion to your pages. Author: imithemes Author URI: http://imithemes.com */ class Toggle_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('toggle-widget', __('Toggle Widget', 'imic-framework'), array('description' => __('A widget to add Toggle/Accordion to your pages.', 'imic-framework'), 'panels_icon' => 'dashicons dashicons-list-view', 'panels_groups' => array('framework')), array(), array('tab_id' => array('type' => 'text', 'label' => __('Toggle Name', 'imic-framework'), 'description' => __('Keep it unique if adding multiple tabs in a single page.(No spaces in name)', 'imic-framework')), 'tabs' => array('type' => 'repeater', 'label' => __('Toggles', 'imic-framework'), 'item_name' => __('Toggle', 'imic-framework'), 'item_label' => array('selector' => "[id*='tab-title']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('tab_nav_title' => array('type' => 'text', 'label' => __('Toggle title', 'imic-framework')), 'tab_nav_content' => array('type' => 'tinymce', 'label' => __('Toggle Content', 'imic-framework')))), 'display_type' => array('type' => 'select', 'state_name' => 'togglize', 'label' => __('Choose Type', 'imic-framework'), 'prompt' => __('Choose Type', 'framework'), 'options' => array('togglize' => __('Toggles', 'framework'), 'accordionize' => __('Accordions', 'framework')))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return $instance['display_type'] == 'togglize' ? 'toggles' : 'accordions'; } function get_style_name($instance) { return false; } function get_less_variables($instance) { return array(); } function modify_instance($instance) { return $instance; } } siteorigin_widget_register('toggle-widget', __FILE__, 'Toggle_Widget');
Author URI: https://siteorigin.com */ class SiteOrigin_Widget_Icon_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('sow-icon', __('SiteOrigin Icon', 'so-widgets-bundle'), array('description' => __('An icon widget.', 'so-widgets-bundle')), array(), false, plugin_dir_path(__FILE__)); } function get_widget_form() { return array('icon' => array('type' => 'icon', 'label' => __('Icon', 'so-widgets-bundle')), 'color' => array('type' => 'color', 'label' => __('Color', 'so-widgets-bundle')), 'size' => array('type' => 'measurement', 'label' => __('Size', 'so-widgets-bundle')), 'alignment' => array('type' => 'select', 'label' => __('Alignment', 'so-widgets-bundle'), 'options' => array('center' => __('Center', 'so-widgets-bundle'), 'left' => __('Left', 'so-widgets-bundle'), 'right' => __('Right', 'so-widgets-bundle')), 'default' => 'center'), 'url' => array('type' => 'link', 'label' => __('Destination URL', 'so-widgets-bundle')), 'new_window' => array('type' => 'checkbox', 'default' => false, 'label' => __('Open in a new window', 'so-widgets-bundle'))); } function get_less_variables($instance) { return array('color' => $instance['color'], 'alignment' => $instance['alignment'], 'size' => $instance['size'], 'has_size' => empty($instance['size']) ? 'false' : 'true'); } /** * Get the template variables for the headline * * @param $instance * @param $args * * @return array */ function get_template_variables($instance, $args) { return array('icon' => $instance['icon'], 'url' => $instance['url'], 'new_window' => $instance['new_window']); } } siteorigin_widget_register('sow-icon', __FILE__, 'SiteOrigin_Widget_Icon_Widget');
return implode("\n", $import_strings); } /** * Get the template for the headline widget * * @param $instance * * @return mixed|string */ function get_template_name($instance) { return 'headline'; } /** * Get the template variables for the headline * * @param $instance * @param $args * * @return array */ function get_template_variables($instance, $args) { if (empty($instance)) { return array(); } return array('headline' => $instance['headline']['text'], 'headline_tag' => $instance['headline']['tag'], 'sub_headline' => $instance['sub_headline']['text'], 'sub_headline_tag' => $instance['sub_headline']['tag'], 'has_divider' => !empty($instance['divider']) && $instance['divider']['style'] != 'none'); } } siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
<?php /* Widget Name: Client's Image widget Description: A very simple widget to list client's images. Author: Rafin/Sudip */ class SiteOrigin_Widget_ClientLogo_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('sow-clientlogo', __('Kreativa:Client\'s Image', 'siteorigin-widgets'), array('description' => __('A list of images of client\'s.', 'siteorigin-widgets')), array(), array('image' => array('type' => 'media', 'label' => __('Image file', 'siteorigin-widgets')), 'desc' => array('type' => 'text', 'label' => __('Text', 'siteorigin-widgets'))), plugin_dir_path(__FILE__) . '../'); } function get_template_name($instance) { return 'base'; } function get_style_name($instance) { return false; } } siteorigin_widget_register('clientlogo', __FILE__);
class Inked_Alert_SO_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('ink-alert', __('Inked Alert', 'wpinked-widgets'), array('description' => __('Communicate success, warnings, failure or just information.', 'wpinked-widgets'), 'help' => 'http://docs.wpinked.com/widgets-for-siteorigin/alert-widget'), array(), array('message' => array('type' => 'text', 'label' => __('Message', 'wpinked-widgets'), 'default' => 'This is an Alert Message'), 'close' => array('type' => 'checkbox', 'label' => __('Show Close Button ?', 'wpinked-widgets'), 'default' => true), 'icon' => array('type' => 'section', 'label' => __('Icon', 'wpinked-widgets'), 'hide' => true, 'fields' => array('select' => array('type' => 'icon', 'label' => __('Icon', 'wpinked-widgets')), 'color' => array('type' => 'color', 'label' => __('Icon Color', 'wpinked-widgets'), 'default' => ''))), 'styling' => array('type' => 'section', 'label' => __('Styling', 'wpinked-widgets'), 'hide' => true, 'fields' => array('theme' => array('type' => 'select', 'label' => __('Theme', 'wpinked-widgets'), 'default' => 'classic', 'options' => array('classic' => __('Classic', 'wpinked-widgets'), 'flat' => __('Flat', 'wpinked-widgets'), 'outline' => __('Outline', 'wpinked-widgets'), 'threed' => __('3D', 'wpinked-widgets'), 'shadow' => __('Shadow', 'wpinked-widgets'), 'modern' => __('Modern', 'wpinked-widgets'))), 'background' => array('type' => 'color', 'label' => __('Background Color', 'wpinked-widgets'), 'default' => ''), 'text' => array('type' => 'color', 'label' => __('Text Color', 'wpinked-widgets'), 'default' => ''), 'close' => array('type' => 'color', 'label' => __('Close Color', 'wpinked-widgets'), 'default' => ''), 'corners' => array('type' => 'select', 'label' => __('Corners', 'wpinked-widgets'), 'default' => '0.25em', 'options' => array('0em' => __('Sharp', 'wpinked-widgets'), '0.25em' => __('Slightly curved', 'wpinked-widgets'), '0.75em' => __('Highly curved', 'wpinked-widgets'))), 'size' => array('type' => 'select', 'label' => __('Size', 'wpinked-widgets'), 'default' => 'standard', 'options' => array('small' => __('Small', 'wpinked-widgets'), 'standard' => __('Standard', 'wpinked-widgets'), 'large' => __('Large', 'wpinked-widgets')))))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'alert'; } function get_style_name($instance) { return 'alert'; } function enqueue_frontend_scripts($instance) { wp_register_script('iw-alert-js', siteorigin_widget_get_plugin_dir_url('ink-alert') . 'scripts/alert.js', array('iw-foundation-js'), INKED_SO_WIDGETS, true); wp_enqueue_script('iw-alert-init', siteorigin_widget_get_plugin_dir_url('ink-alert') . 'scripts/alert.init.js', array('iw-alert-js'), INKED_SO_WIDGETS, true); wp_enqueue_style('iw-alert', siteorigin_widget_get_plugin_dir_url('ink-alert') . 'styles/alert.css', array(), INKED_SO_WIDGETS); parent::enqueue_frontend_scripts($instance); } function get_less_variables($instance) { if (empty($instance)) { return array(); } return array('radius' => $instance['styling']['corners'], 'size' => $instance['styling']['size'], 'text' => $instance['styling']['text'], 'bg' => $instance['styling']['background'], 'theme' => $instance['styling']['theme'], 'close' => $instance['styling']['close']); } } siteorigin_widget_register('ink-alert', __FILE__, 'Inked_Alert_SO_Widget');
<?php /* Widget Name: Livemesh Pricing Table Description: Display pricing plans in a multi-column grid. Author: LiveMesh Author URI: http://portfoliotheme.org */ class LSOW_Pricing_Table_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('lsow-pricing-plans', __('Livemesh Pricing Table', 'livemesh-so-widgets'), array('description' => __('Display pricing table in a multi-column grid.', 'livemesh-so-widgets'), 'panels_icon' => 'dashicons dashicons-minus', 'help' => LSOW_PLUGIN_HELP_URL . '#pricing-table'), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'livemesh-so-widgets')), 'pricing-plans' => array('type' => 'repeater', 'label' => __('Pricing Table', 'livemesh-so-widgets'), 'item_name' => __('Pricing Plan', 'livemesh-so-widgets'), 'item_label' => array('selector' => "[id*='pricing-plans-title']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('pricing_title' => array('type' => 'text', 'label' => __('Pricing Plan Title', 'livemesh-so-widgets'), 'description' => __('The title for the pricing plan', 'livemesh-so-widgets')), 'tagline' => array('type' => 'text', 'label' => __('Tagline Text', 'livemesh-so-widgets'), 'description' => __('Provide any subtitle or taglines like "Most Popular", "Best Value", "Best Selling", "Most Flexible" etc. that you would like to use for this pricing plan.', 'livemesh-so-widgets')), 'image' => array('type' => 'media', 'label' => __('Image', 'livemesh-so-widgets')), 'price_tag' => array('type' => 'text', 'label' => __('Price Tag', 'livemesh-so-widgets'), 'description' => __('Enter the price tag for the pricing plan. HTML is accepted.', 'livemesh-so-widgets')), 'button_text' => array('type' => 'text', 'label' => __('Text for Pricing Link/Button', 'livemesh-so-widgets'), 'description' => __('Provide the text for the link or the button shown for this pricing plan.', 'livemesh-so-widgets')), 'url' => array('type' => 'link', 'label' => __('URL for the Pricing link/button', 'livemesh-so-widgets'), 'description' => __('Provide the target URL for the link or the button shown for this pricing plan.', 'livemesh-so-widgets')), 'button_new_window' => array('type' => 'checkbox', 'label' => __('Open Button URL in a new window', 'livemesh-so-widgets')), 'highlight' => array('type' => 'checkbox', 'label' => __('Highlight Pricing Plan', 'livemesh-so-widgets'), 'description' => __('Specify if you want to highlight the pricing plan.', 'livemesh-so-widgets')), 'items' => array('type' => 'repeater', 'label' => __('Pricing Plan Details', 'livemesh-so-widgets'), 'item_name' => __('Pricing Item', 'livemesh-so-widgets'), 'item_label' => array('selector' => "[id*='pricing-plans-items-text']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('title' => array('type' => 'text', 'label' => __('Title', 'livemesh-so-widgets')), 'value' => array('type' => 'text', 'label' => __('Value', 'livemesh-so-widgets')), 'icon_new' => array('type' => 'icon', 'label' => __('Icon', 'livemesh-so-widgets')))))), 'settings' => array('type' => 'section', 'label' => __('Settings', 'livemesh-so-widgets'), 'fields' => array('per_line' => array('type' => 'slider', 'label' => __('Pricing Columns per row', 'livemesh-so-widgets'), 'min' => 1, 'max' => 5, 'integer' => true, 'default' => 4))))); } function initialize() { $this->register_frontend_styles(array(array('lsow-pricing-plans', plugin_dir_url(__FILE__) . 'css/style.css'))); } function get_template_variables($instance, $args) { return array('pricing_plans' => !empty($instance['pricing-plans']) ? $instance['pricing-plans'] : array(), 'settings' => $instance['settings']); } } siteorigin_widget_register('lsow-pricing-plans', __FILE__, 'LSOW_Pricing_Table_Widget');
* @return mixed|void */ function modify_instance($instance) { if (empty($instance['controls'])) { if (!empty($instance['speed'])) { $instance['controls']['speed'] = $instance['speed']; } if (!empty($instance['timeout'])) { $instance['controls']['timeout'] = $instance['timeout']; } if (!empty($instance['nav_color_hex'])) { $instance['controls']['nav_color_hex'] = $instance['nav_color_hex']; } if (!empty($instance['nav_style'])) { $instance['controls']['nav_style'] = $instance['nav_style']; } if (!empty($instance['nav_size'])) { $instance['controls']['nav_size'] = $instance['nav_size']; } unset($instance['speed']); unset($instance['timeout']); unset($instance['nav_color_hex']); unset($instance['nav_style']); unset($instance['nav_size']); } return $instance; } } siteorigin_widget_register('slider', __FILE__);
return $val; } /** * Less function for importing Google web fonts. * * @param $instance * @param $args * * @return string */ function less_import_google_font($instance, $args) { if (empty($instance)) { return; } $font_import = siteorigin_widget_get_font($instance['design']['heading_font']); if (!empty($font_import['css_import'])) { return $font_import['css_import']; } } function wrapper_class_filter($classes, $instance) { if ($instance['design']['fittext']) { $classes[] = 'so-widget-fittext-wrapper'; wp_enqueue_script('sow-fittext'); } return $classes; } } siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
if (!empty($instance['markers'])) { $markers = $instance['markers']; $markers_st = ''; if (!empty($markers['marker_icon'])) { $mrkr_src = wp_get_attachment_image_src($markers['marker_icon']); if (!empty($mrkr_src)) { $markers_st .= 'icon:' . $mrkr_src[0]; } } if (!empty($markers['marker_at_center'])) { if (!empty($markers_st)) { $markers_st .= "|"; } $markers_st .= $instance['map_center']; } if (!empty($markers['marker_positions'])) { foreach ($markers['marker_positions'] as $marker) { if (!empty($markers_st)) { $markers_st .= "|"; } $markers_st .= urlencode($marker['place']); } } $markers_st = '&markers=' . $markers_st; $src_url .= $markers_st; } return $src_url; } } siteorigin_widget_register('sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget');
/* Widget Name: Image Carousel Widget Description: A widget to show a carousel or list of images/logos. Author: imithemes Author URI: http://imithemes.com */ class Carousel_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('carousel-widget', __('Carousel Widget', 'imic-framework'), array('description' => __('A widget to show a carousel or list of images/logos.', 'imic-framework'), 'panels_icon' => 'dashicons dashicons-list-view', 'panels_groups' => array('framework')), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'siteorigin-widgets')), 'allpostsbtn' => array('type' => 'text', 'label' => __('Button Text', 'imic-framework'), 'default' => __('Button', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'allpostsurl' => array('type' => 'link', 'label' => __('Button URL', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'images' => array('type' => 'repeater', 'label' => __('Images', 'imic-framework'), 'item_name' => __('Image', 'imic-framework'), 'item_label' => array('selector' => "[id*='image-title']", 'update_event' => 'change', 'value_method' => 'val'), 'fields' => array('icon_image' => array('type' => 'media', 'library' => 'image', 'label' => __('Upload image', 'imic-framework')), 'icon_title' => array('type' => 'text', 'label' => __('Title text to show under the image', 'imic-framework')), 'more_url' => array('type' => 'link', 'label' => __('Image URL', 'siteorigin-widgets')), 'new_window' => array('type' => 'checkbox', 'label' => __('Open URL in a new window', 'siteorigin-widgets'), 'default' => false))), 'number_of_posts' => array('type' => 'slider', 'label' => __('Number of images/logos to show in a row', 'imic-framework'), 'default' => 4, 'min' => 1, 'max' => 5, 'integer' => true), 'autoplay' => array('type' => 'select', 'state_name' => 'list', 'label' => __('Autoplay Carousel', 'imic-framework'), 'prompt' => __('Autoplay Carousel', 'framework'), 'options' => array('yes' => __('Yes', 'framework'), 'no' => __('No', 'framework'))), 'navigation' => array('type' => 'select', 'state_name' => 'list', 'label' => __('Carousel Navigation', 'imic-framework'), 'prompt' => __('Show Carousel Navigation', 'framework'), 'options' => array('yes' => __('Yes', 'framework'), 'no' => __('No', 'framework'))), 'pagination' => array('type' => 'select', 'state_name' => 'list', 'label' => __('Carousel Pagination', 'imic-framework'), 'prompt' => __('Show Carousel Pagination', 'framework'), 'options' => array('yes' => __('Yes', 'framework'), 'no' => __('No', 'framework')))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'carousel-view'; } function get_style_name($instance) { return false; } function get_less_variables($instance) { return array(); } function modify_instance($instance) { return $instance; } } siteorigin_widget_register('carousel-widget', __FILE__, 'Carousel_Widget');
if (!is_active_widget(false, false, $this->id_base)) { return; } $custom_css = ''; $instances = $this->get_settings(); if (array_key_exists($this->number, $instances)) { $instance = $instances[$this->number]; if (!empty($instance)) { $header_type = $instance['header_type']; if ($header_type == 'custom') { $custom_css = $instance['custom_header']['custom_css']; } } } if ($custom_css != '') { $custom_css = $custom_css . "\n"; wp_add_inline_style('lsow-hero-image', $custom_css); // after custom.css file } } function get_less_variables($instance) { return array('top_padding' => intval($instance['settings']['top_padding']) . 'px', 'bottom_padding' => intval($instance['settings']['bottom_padding']) . 'px', 'tablet_width' => intval($instance['settings']['responsive']['tablet']['width']) . 'px', 'mobile_width' => intval($instance['settings']['responsive']['mobile']['width']) . 'px', 'tablet_top_padding' => intval($instance['settings']['responsive']['tablet']['top_padding']) . 'px', 'tablet_bottom_padding' => intval($instance['settings']['responsive']['tablet']['bottom_padding']) . 'px', 'mobile_top_padding' => intval($instance['settings']['responsive']['mobile']['top_padding']) . 'px', 'mobile_bottom_padding' => intval($instance['settings']['responsive']['mobile']['bottom_padding']) . 'px'); } function get_template_variables($instance, $args) { return array('header_type' => $instance['header_type'], 'custom_header' => $instance['custom_header'], 'standard_header' => $instance['standard_header'], 'pointer_down_url' => $instance['pointer_down_url'], 'background' => $instance['background'], 'settings' => $instance['settings']); } } siteorigin_widget_register('lsow-hero-image', __FILE__, 'LSOW_Hero_Image_Widget');
} } return $html; } /** * Get the video host from the URL * * @param $video_url * * @return string */ private function get_host_from_url($video_url) { preg_match('/https?:\\/\\/(www.)?([A-Za-z0-9\\-]+)\\./', $video_url, $matches); return !empty($matches) && count($matches) > 2 ? $matches[2] : ''; } /** * Check if the current host is skinnable * * @param $video_host * * @return bool */ private function is_skinnable_video_host($video_host) { global $wp_version; return $video_host == 'self' || ($video_host == 'youtube' || $video_host == 'vimeo') && $wp_version >= 4.2; } } siteorigin_widget_register('video', __FILE__);
} } if (!empty($instance['label_design'])) { $label_design = $instance['label_design']; if (!empty($label_design['lb_color'])) { $less_vars['lb_color'] = $label_design['lb_color']; } if (!empty($label_design['lb_fontweight'])) { $less_vars['lb_fontweight'] = 'bold'; } else { $less_vars['lb_fontweight'] = 'normal'; } if (!empty($label_design['lb_align'])) { $less_vars['lb_align'] = $label_design['lb_align']; } if (!empty($label_design['lb_margin_top'])) { $less_vars['lb_margin_top'] = $label_design['lb_margin_top']; } if (!empty($label_design['lb_margin_bottom'])) { $less_vars['lb_margin_bottom'] = $label_design['lb_margin_bottom']; } } return $less_vars; } function get_template_variables($instance, $args) { return array('trigger' => $instance['trigger'], 'label' => $instance['settings']['label'], 'value' => $instance['settings']['value'], 'unit' => $instance['settings']['unit'], 'vl_type' => $instance['value_design']['vl_type'], 'vl_fontsize' => $instance['value_design']['vl_fontsize'], 'vl_lineheight' => $instance['value_design']['vl_lineheight'], 'vl_fontweight' => $instance['value_design']['vl_fontweight'], 'lb_type' => $instance['label_design']['lb_type'], 'lb_fontsize' => $instance['label_design']['lb_fontsize'], 'lb_lineheight' => $instance['label_design']['lb_lineheight'], 'lb_fontweight' => $instance['label_design']['lb_fontweight']); } } siteorigin_widget_register('lrw-progress-bar-vert', __FILE__, 'LRW_Widget_Progress_Bar_Vertical');
<?php /* Widget Name: Blog Grid Description: Display posts as grid layout. Author: Ingenious Solutions Author URI: http://ingenious-web.com/ */ class Blog_Style_Two extends SiteOrigin_Widget { function __construct() { parent::__construct('blog-style-two', __('Blog Grid', 'addon-so-widgets-bundle'), array('description' => __('Display posts as grid layout.', 'addon-so-widgets-bundle'), 'panels_icon' => 'dashicons dashicons-welcome-write-blog', 'panels_groups' => array('addonso')), array(), array('widget_title' => array('type' => 'text', 'label' => __('Widget Title', 'addon-so-widgets-bundle'), 'default' => ''), 'posts' => array('type' => 'posts', 'label' => __('Select Posts', 'addon-so-widgets-bundle')), 'layout' => array('type' => 'radio', 'label' => __('Choose a Layout', 'addon-so-widgets-bundle'), 'default' => 'col-md-6', 'options' => array('six columns' => __('2 Column Layout', 'addon-so-widgets-bundle'), 'one-third column' => __('3 Column Layout', 'addon-so-widgets-bundle'), 'three columns' => __('4 Column Layout', 'addon-so-widgets-bundle'))), 'excerpt_lenght' => array('type' => 'number', 'label' => __('Excerpt length (words)', 'addon-so-widgets-bundle'), 'default' => '10'), 'read_more_text' => array('type' => 'text', 'label' => __('Read more text', 'addon-so-widgets-bundle'), 'default' => 'Read More'), 'title_linkable' => array('type' => 'checkbox', 'label' => __('Title Linkable', 'addon-so-widgets-bundle'), 'default' => true), 'image_linkable' => array('type' => 'checkbox', 'label' => __('Image Linkable', 'addon-so-widgets-bundle'), 'default' => true), 'blog_two_styling' => array('type' => 'section', 'label' => __('Widget styling', 'addon-so-widgets-bundle'), 'hide' => true, 'fields' => array('title_color' => array('type' => 'color', 'label' => __('Title color', 'addon-so-widgets-bundle'), 'default' => ''), 'content_color' => array('type' => 'color', 'label' => __('Content color', 'addon-so-widgets-bundle'), 'default' => ''), 'meta_color' => array('type' => 'color', 'label' => __('Meta color', 'addon-so-widgets-bundle'), 'default' => '')))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'blog-style-two-template'; } function get_style_name($instance) { return 'blog-style-two-style'; } function get_less_variables($instance) { return array('title_color' => $instance['blog_two_styling']['title_color'], 'content_color' => $instance['blog_two_styling']['content_color'], 'meta_color' => $instance['blog_two_styling']['meta_color']); } } siteorigin_widget_register('blog-style-two', __FILE__, 'Blog_Style_Two');
*/ class Posts_List_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('posts-list-widget', __('Posts List Widget', 'imic-framework'), array('description' => __('A widget to show posts list/grid view.', 'imic-framework'), 'panels_icon' => 'dashicons dashicons-list-view', 'panels_groups' => array('framework')), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'siteorigin-widgets')), 'allpostsbtn' => array('type' => 'text', 'label' => __('All posts button text', 'imic-framework'), 'default' => __('All Posts', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'allpostsurl' => array('type' => 'link', 'label' => __('All posts button URL', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'categories' => array('type' => 'text', 'label' => __('Categories (Enter comma separated post category slugs)', 'imic-framework')), 'number_of_posts' => array('type' => 'slider', 'label' => __('Number of Posts to show', 'imic-framework'), 'default' => 4, 'min' => 1, 'max' => 25, 'integer' => true), 'show_post_meta' => array('type' => 'checkbox', 'default' => true, 'label' => __('Show post meta like post date, author, categories, comments?', 'imic-framework')), 'excerpt_length' => array('type' => 'text', 'default' => 50, 'label' => __('Length of excerpt(Enter the number of words to show)? Leave blank to hide - Default is: 50', 'imic-framework')), 'read_more_text' => array('type' => 'text', 'default' => 'Continue reading', 'label' => __('Continue reading button text, Leave blank to hide button - Default is Continue Reading', 'imic-framework')), 'listing_layout' => array('type' => 'section', 'label' => __('Layout', 'siteorigin-widgets'), 'hide' => false, 'description' => __('Choose listing layout.', 'siteorigin-widgets'), 'fields' => array('layout_type' => array('type' => 'radio', 'default' => 'list', 'label' => __('Layout Type', 'siteorigin-widgets'), 'options' => array('list' => __('List View', 'siteorigin-widgets'), 'grid' => __('Grid View', 'siteorigin-widgets'))), 'grid_column' => array('type' => 'select', 'state_name' => 'grid', 'prompt' => __('Choose Grid Column', 'framework'), 'options' => array('6' => __('Two', 'framework'), '4' => __('Three', 'framework'), '3' => __('Four', 'framework')))))), plugin_dir_path(__FILE__)); } function get_template_variables($instance, $args) { $layout = $instance['listing_layout']; return array('layout_type' => array('column' => !empty($layout['grid_column']) ? $layout['grid_column'] : 4)); } function get_template_name($instance) { return $instance['listing_layout']['layout_type'] == 'list' ? 'list-view' : 'grid-view'; } function get_style_name($instance) { return false; } function get_less_variables($instance) { return array(); } function modify_instance($instance) { return $instance; } } siteorigin_widget_register('posts-list-widget', __FILE__, 'Posts_List_Widget');
/* Widget Name: Events List Widget Description: A widget to show upcoming events list. Author: imithemes Author URI: http://imithemes.com */ class Events_List_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('events-list-widget', __('Events List Widget', 'imic-framework'), array('description' => __('A widget to show upcoming events list.', 'imic-framework'), 'panels_icon' => 'dashicons dashicons-list-view', 'panels_groups' => array('framework')), array(), array('title' => array('type' => 'text', 'label' => __('Title', 'siteorigin-widgets')), 'allpostsbtn' => array('type' => 'text', 'label' => __('All events button text', 'imic-framework'), 'default' => __('All Events', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'allpostsurl' => array('type' => 'link', 'label' => __('All events button URL', 'imic-framework'), 'description' => __('This button will be displayed only if the widget has title.', 'imic-framework')), 'categories' => array('type' => 'text', 'label' => __('Event Category slug (Enter only a single category slug)', 'imic-framework')), 'event_type' => array('type' => 'select', 'state_name' => 'future', 'prompt' => __('Choose Events Type', 'framework'), 'options' => array('future' => __('Future', 'framework'), 'past' => __('Past', 'framework'))), 'number_of_posts' => array('type' => 'slider', 'label' => __('Number of Upcoming Events to show', 'imic-framework'), 'default' => 4, 'min' => 1, 'max' => 25, 'integer' => true), 'show_post_meta' => array('type' => 'checkbox', 'default' => true, 'label' => __('Show post action icons like Share, Location, Register?', 'imic-framework'))), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'list-view'; } function get_style_name($instance) { return false; } function get_less_variables($instance) { return array(); } function modify_instance($instance) { return $instance; } } siteorigin_widget_register('events-list-widget', __FILE__, 'Events_List_Widget');
$string = str_replace(array("<br />", "<br>", "<br/>"), "\n", $string); $string = str_replace("</p>", "\n\n", $string); return $string; } public function get_template_variables($instance, $args) { $instance = wp_parse_args($instance, array('text' => '')); $instance['text'] = $this->unwpautop($instance['text']); $instance['text'] = wp_kses_post($instance['text']); $instance['text'] = apply_filters('widget_text', $instance['text']); // Run some known stuff if (!empty($GLOBALS['wp_embed'])) { $instance['text'] = $GLOBALS['wp_embed']->autoembed($instance['text']); } if ($instance['autop']) { $instance['text'] = wpautop($instance['text']); } $instance['text'] = do_shortcode($instance['text']); return array('text' => $instance['text']); } function get_template_name($instance) { return 'editor'; } function get_style_name($instance) { return ''; } } siteorigin_widget_register('editor', __FILE__);
<?php /* Widget Name: Hello world widget Description: An example widget which displays 'Hello world!'. Author: Me Author URI: http://example.com */ class Hello_World_Widget extends SiteOrigin_Widget { function __construct() { parent::__construct('hello-world-widget', __('Hello World Widget', 'hello-world-widget-text-domain'), array('description' => __('A hello world widget.', 'hello-world-widget-text-domain')), array(), array('text' => array('type' => 'text', 'label' => __('Hello world! goes here.', 'siteorigin-widgets'), 'default' => 'Hello world!')), plugin_dir_path(__FILE__)); } function get_template_name($instance) { return 'hello-world-widget-template'; } function get_style_name($instance) { return 'hello-world-widget-style'; } } siteorigin_widget_register('hello-world-widget', __FILE__, 'Hello_World_Widget');
{ parent::__construct('sow-taxonomy', __('SiteOrigin Taxonomy', 'so-widgets-bundle'), array('description' => __('A taxonomy widget.', 'so-widgets-bundle')), array(), false, plugin_dir_path(__FILE__)); } function get_widget_form() { // Gets taxonomy objects and extracts the 'label' field from each one. $taxonomies = wp_list_pluck(get_taxonomies(array(), 'objects'), 'label'); return array('title' => array('type' => 'text', 'label' => __('Title', 'so-widgets-bundle')), 'taxonomy' => array('type' => 'select', 'label' => __('Taxonomies', 'so-widgets-bundle'), 'options' => $taxonomies), 'label' => array('type' => 'text', 'label' => __('Label', 'so-widgets-bundle')), 'display_format' => array('type' => 'select', 'label' => __('Display as', 'so-widgets-bundle'), 'options' => array('link' => __('Links', 'so-widgets-bundle'), 'button' => __('Buttons', 'so-widgets-bundle'))), 'color' => array('type' => 'color', 'label' => __('Color', 'so-widgets-bundle')), 'hover_color' => array('type' => 'color', 'label' => __('Hover color', 'so-widgets-bundle'))); } function get_less_variables($instance) { return array('color' => $instance['color'], 'has_color' => empty($instance['color']) ? 'false' : 'true', 'hover_color' => $instance['hover_color'], 'has_hover_color' => empty($instance['hover_color']) ? 'false' : 'true'); } /** * Get the template variables for the taxonomy * * @param $instance * @param $args * * @return array */ function get_template_variables($instance, $args) { if (empty($instance)) { return array(); } return array('title' => $instance['title'], 'taxonomy_name' => $instance['taxonomy'], 'label' => $instance['label'], 'display_format' => $instance['display_format']); } } siteorigin_widget_register('sow-taxonomy', __FILE__, 'SiteOrigin_Widget_Taxonomy_Widget');