| Name | Size | Mode | Actions |
|---|---|---|---|
| img/ | - | 0755 | rm |
| js/ | - | 0755 | rm |
| less/ | - | 0755 | rm |
| lib/ | - | 0755 | rm |
| widgets/ | - | 0755 | rm |
| migration.php | 1668 | 0644 | editdlrm |
| widgets.php | 36463 | 0644 | editdlrm |
/home/vianto5/cititower.mx/wp-content/plugins/siteorigin-panels/widgets/widgets.php (36463B)
'; } switch ( $field_args['type'] ) { case 'text': ?> /> ' . esc_html( $field_args['description'] ) . ''; } ?>
widget_options['default_style'] ) ? $this->widget_options['default_style'] : false; } do_action( 'siteorigin_panels_widget_before_styles', $this, $instance ); // Now, lets add the style options. $styles = $this->get_styles(); if ( ! empty( $styles ) ) { ?>sub_widgets as $id => $sub ) { global $wp_widget_factory; $the_widget = $wp_widget_factory->widgets[$sub[1]]; if ( ! isset( $instance['origin_style_' . $id] ) ) { $instance['origin_style_' . $id] = ! empty( $this->widget_options['default_style_' . $id] ) ? $this->widget_options['default_style_' . $id] : false; } ?>
form_args as $field_id => $field_args ) { if ( isset( $field_args['default'] ) && ! isset( $instance[$field_id] ) ) { $instance[$field_id] = $field_args['default']; } if ( ! isset( $instance[ $field_id ] ) ) { $instance[ $field_id ] = false; } } // Filter the title if ( ! empty( $instance['title'] ) ) { $instance['title'] = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); } if ( ! empty( $instance['origin_style'] ) ) { list( $style, $preset ) = explode( ':', $instance['origin_style'] ); $style = sanitize_file_name( $style ); $preset = sanitize_file_name( $preset ); $data = $this->get_style_data( $style ); $template = $data['Template']; } else { $style = 'default'; $preset = 'default'; } if ( empty( $template ) ) { $template = 'default'; } $template_file = false; $paths = $this->get_widget_paths(); foreach ( $paths as $path ) { if ( file_exists( $path . '/' . $this->origin_id . '/tpl/' . $template . '.php' ) ) { $template_file = $path . '/' . $this->origin_id . '/tpl/' . $template . '.php'; break; } } if ( empty( $template_file ) ) { echo $args['before_widget']; esc_html_e( 'Template not found', 'siteorigin-panels' ); echo $args['after_widget']; return false; } // Dynamically generate the CSS global $origin_widgets_generated_css; if ( empty( $origin_widgets_generated_css ) ) { $origin_widgets_generated_css = array(); } if ( ! empty( $instance['origin_style'] ) ) { $filename = $this->origin_id . '-' . $style . '-' . $preset; if ( ! isset( $origin_widgets_generated_css[$filename] ) ) { $origin_widgets_generated_css[$filename] = origin_widgets_generate_css( get_class( $this ), $style, $preset ); } } if ( method_exists( $this, 'enqueue_scripts' ) ) { $this->enqueue_scripts(); } $widget_classes = apply_filters( 'siteorigin_widgets_classes', array( 'origin-widget', 'origin-widget-' . $this->origin_id, 'origin-widget-' . $this->origin_id . '-' . $style . '-' . $preset, ), $instance ); if ( method_exists( $this, 'widget_classes' ) ) { $widget_classes = $this->widget_classes( array( 'origin-widget', 'origin-widget-' . $this->origin_id, 'origin-widget-' . $this->origin_id . '-' . $style . '-' . $preset, ), $instance ); } echo $args['before_widget']; echo ''; echo $args['after_widget']; } // Extra functions specific to a SiteOrigin widget. /** * A sub widget is a widget that's style is required by this widget */ public function sub_widget( $id, $instance ) { $sub = $this->sub_widgets[$id]; global $wp_widget_factory; $the_widget = $wp_widget_factory->widgets[$sub[1]]; $the_widget->widget( array( 'before_widget' => '', 'after_widget' => '' ), $instance ); } /** * Get the CSS for the given style and preset * * @return string */ public function create_css( $style, $preset ) { $paths = $this->get_widget_paths(); $style_file = false; // Find the file - exit if it can't be found. foreach ( $paths as $path ) { if ( file_exists( $path . '/' . $this->origin_id . '/styles/' . $style . '.less' ) ) { $style_file = $path . '/' . $this->origin_id . '/styles/' . $style . '.less'; break; } } if ( empty( $style_file ) ) { return ''; } if ( ! class_exists( 'lessc' ) ) { include plugin_dir_path( __FILE__ ) . 'lib/lessc.inc.php'; } foreach ( $this->get_widget_folders() as $folder => $folder_url ) { $filename = rtrim( $folder, '/' ) . '/' . $this->origin_id . '/styles/' . $style . '.less'; if ( file_exists( $filename ) ) { $less = file_get_contents( $filename ); break; } } // Add in the mixins $less = str_replace( '@import "../../../less/mixins";', "\n\n" . file_get_contents( plugin_dir_path( __FILE__ ) . 'less/mixins.less' ), $less ); // Apply the preset variables to the LESS file $presets = $this->get_style_presets( $style ); if ( ! empty( $presets[$preset] ) && is_array( $presets[$preset] ) ) { foreach ( $presets[$preset] as $k => $v ) { $less = preg_replace( '/@' . preg_quote( $k ) . ':(.*);/', '@' . $k . ': ' . $v . ';', $less ); } } // Scope the CSS with the wrapper we'll be adding $less = '.origin-widget.origin-widget-' . $this->origin_id . '-' . $style . '-' . $preset . ' {' . $less . '}'; $lc = new lessc(); $lc->setPreserveComments( false ); $lc->registerFunction( 'lumlighten', 'origin_widgets_less_lumlighten' ); $lc->registerFunction( 'lumdarken', 'origin_widgets_less_lumdarken' ); $lc->registerFunction( 'texture', 'origin_widgets_less_texture' ); $lc->registerFunction( 'widgetimage', 'origin_widgets_less_widgetimage' ); // Create the CSS return $lc->compile( $less ); } /** * Removes a CSS file */ public function clear_css_cache( $style, $preset ) { $filename = $this->origin_id . '-' . $style . '-' . $preset; delete_site_transient( 'origin_widgets_css_cache:' . $filename ); } /** * Get all the paths where we'll look for widgets. * * @return array */ public function get_widget_paths() { static $paths = array(); if ( empty( $paths ) ) { $paths = array_keys( $this->get_widget_folders() ); } return $paths; } /** * Get all the folders where we'll look for widgets * * @return mixed|void */ public static function get_widget_folders() { static $folders = array(); if ( empty( $folders ) ) { $folders = array( get_stylesheet_directory() . '/widgets' => get_stylesheet_directory_uri() . '/widgets/widgets', get_template_directory() . '/widgets' => get_template_directory_uri() . '/widgets', plugin_dir_path( __FILE__ ) . 'widgets' => plugin_dir_url( __FILE__ ) . 'widgets', ); $folders = apply_filters( 'siteorigin_widget_folders', $folders ); } return $folders; } /** * Get all the folders where we'll look for widget images * * @return mixed|void */ public static function get_image_folders() { static $folders = array(); if ( empty( $folders ) ) { $folders = array( get_stylesheet_directory() . '/widgets/img' => get_stylesheet_directory_uri() . '/widgets/img', get_template_directory() . '/widgets/img' => get_template_directory_uri() . '/widgets/img', plugin_dir_path( __FILE__ ) . 'img' => plugin_dir_url( __FILE__ ) . 'img', ); $folders = apply_filters( 'siteorigin_widget_image_folders', $folders ); } return $folders; } /** * Get all the styles for this widget. * * @return array */ public function get_styles() { if ( empty( $this->styles ) ) { // We can add extra paths here foreach ( $this->get_widget_paths() as $path ) { if ( ! is_dir( $path ) ) { continue; } $files = glob( $path . '/' . $this->origin_id . '/styles/*.less' ); if ( ! empty( $files ) ) { foreach ( glob( $path . '/' . $this->origin_id . '/styles/*.less' ) as $file ) { $p = pathinfo( $file ); $this->styles[$p['filename']] = $this->get_style_data( $p['filename'] ); } } } } return $this->styles; } /** * Get the presets for a given style * * @return mixed|void */ public function get_style_presets( $style_id ) { $presets = array(); foreach ( $this->get_widget_folders() as $folder => $folder_uri ) { $filename = rtrim( $folder, '/' ) . '/' . $this->origin_id . '/presets/' . sanitize_file_name( $style_id ) . '.php'; if ( file_exists( $filename ) ) { // This file should register a filter that adds the presets $new_presets = include $filename; $presets = array_merge( $presets, $new_presets ); } } return apply_filters( 'origin_widget_presets_' . $this->origin_id . '_' . $style_id, $presets ); } /** * Get data for the style. * * @return array */ public function get_style_data( $name ) { $paths = $this->get_widget_paths(); foreach ( $paths as $path ) { $filename = $path . '/' . $this->origin_id . '/styles/' . sanitize_file_name( $name ) . '.less'; if ( ! file_exists( $filename ) ) { continue; } $data = get_file_data( $filename, array( 'Name' => 'Name', 'Template' => 'Template', 'Author' => 'Author', 'Author URI' => 'Author URI', ), 'origin_widget' ); return $data; } return false; } /** * Render a demo of the widget. * * @param array $args */ public function render_demo( $args = array() ) { $this->widget( $args, $this->demo ); } /** * Register a widget that we'll be using inside this widget. */ public function add_sub_widget( $id, $name, $class ) { $this->sub_widgets[$id] = array( $name, $class ); } /** * Add the fields required to query the posts. */ public function add_post_query_fields() { // Add the posts type field $post_types = get_post_types( array( 'public' => true ) ); $post_types = array_values( $post_types ); $this->form_args['query_post_type'] = array( 'type' => 'select', 'options' => $post_types, 'label' => __( 'Post Type', 'siteorigin-panels' ), ); // Add the posts per page field $this->form_args['query_posts_per_page'] = array( 'type' => 'number', 'default' => 10, 'label' => __( 'Posts Per Page', 'siteorigin-panels' ), ); $this->form_args['query_orderby'] = array( 'type' => 'select', 'label' => __( 'Order By', 'siteorigin-panels' ), 'options' => array( 'none' => __( 'None', 'siteorigin-panels' ), 'ID' => __( 'Post ID', 'siteorigin-panels' ), 'author' => __( 'Author', 'siteorigin-panels' ), 'name' => __( 'Name', 'siteorigin-panels' ), 'name' => __( 'Name', 'siteorigin-panels' ), 'date' => __( 'Date', 'siteorigin-panels' ), 'modified' => __( 'Modified', 'siteorigin-panels' ), 'parent' => __( 'Parent', 'siteorigin-panels' ), 'rand' => __( 'Random', 'siteorigin-panels' ), 'comment_count' => __( 'Comment Count', 'siteorigin-panels' ), 'menu_order' => __( 'Menu Order', 'siteorigin-panels' ), ), ); $this->form_args['query_order'] = array( 'type' => 'select', 'label' => __( 'Order', 'siteorigin-panels' ), 'options' => array( 'ASC' => __( 'Ascending', 'siteorigin-panels' ), 'DESC' => __( 'Descending', 'siteorigin-panels' ), ), ); $this->form_args['query_sticky'] = array( 'type' => 'select', 'label' => __( 'Sticky Posts', 'siteorigin-panels' ), 'options' => array( '' => __( 'Default', 'siteorigin-panels' ), 'ignore' => __( 'Ignore Sticky', 'siteorigin-panels' ), 'exclude' => __( 'Exclude Sticky', 'siteorigin-panels' ), 'only' => __( 'Only Sticky', 'siteorigin-panels' ), ), ); $this->form_args['query_additional'] = array( 'type' => 'text', 'label' => __( 'Additional Arguments', 'siteorigin-panels' ), 'description' => preg_replace( '/1\{ *(.*?) *\}/', '$1', __( 'Additional query arguments. See 1{query_posts}.', 'siteorigin-panels' ) ), ); } /** * Get all the posts for the current query * * @return WP_Query */ public static function get_query_posts( $instance ) { $query_args = array(); foreach ( $instance as $k => $v ) { if ( strpos( $k, 'query_' ) === 0 ) { $query_args[preg_replace( '/query_/', '', $k, 1 )] = $v; } } $query = $query_args; unset( $query['additional'] ); unset( $query['sticky'] ); // Add the additional arguments $query = wp_parse_args( $query_args['additional'], $query ); // Add the sticky posts if required switch ( $query_args['sticky'] ) { case 'ignore': $query['ignore_sticky_posts'] = 1; break; case 'only': $query['post__in'] = get_option( 'sticky_posts' ); break; case 'exclude': $query['post__not_in'] = get_option( 'sticky_posts' ); break; } // Add the current page global $wp_query; $query['paged'] = $wp_query->get( 'paged' ); return new WP_Query( $query ); } } // All the standard bundled widgets /** * A gallery widget * * Class SiteOrigin_Panels_Widgets_Gallery */ class SiteOrigin_Panels_Widgets_Gallery extends WP_Widget { public function __construct() { parent::__construct( 'siteorigin-panels-gallery', __( 'Gallery (PB)', 'siteorigin-panels' ), array( 'description' => __( 'Displays a gallery.', 'siteorigin-panels' ), ) ); } public function widget( $args, $instance ) { echo $args['before_widget']; $shortcode_attr = array(); foreach ( $instance as $k => $v ) { if ( empty( $v ) ) { continue; } $shortcode_attr[] = sanitize_key( $k ) . '="' . esc_attr( $v ) . '"'; } echo do_shortcode( '[gallery ' . implode( ' ', $shortcode_attr ) . ']' ); echo $args['after_widget']; } public function update( $new, $old ) { if ( empty( $new ) ) { return $new; } $saved_data = array(); if ( ! empty( $new['ids'] ) ) { // Are there multiple images? if ( strpos( $new['ids'], ',' ) !== false ) { $new['ids'] = explode( ',', $new['ids'] ); $new['ids'] = array_filter( $new['ids'], 'intval' ); $saved_data['ids'] = implode( ',', $new['ids'] ); } else { $saved_data['ids'] = intval( $new['ids'] ); } } if ( ! empty( $new['type'] ) ) { $saved_data['type'] = sanitize_text_field( $new['type'] ); } $saved_data['columns'] = (int) $new['columns']; if ( ! empty( $new['size'] ) ) { global $_wp_additional_image_sizes; $core_sizes = array( 'thumbnail' => true, 'medium' => true, 'large' => true, 'full' => true, ); $valid_sizes = array_merge( $core_sizes, $_wp_additional_image_sizes ); $saved_data['size'] = array_key_exists( $new['size'], $valid_sizes ) ? sanitize_text_field( $new['size'] ) : ''; } if ( ! empty( $new['link'] ) ) { $valid_link_types = array( 'file', 'none', ); $saved_data['link'] = in_array( $new['link'], $valid_link_types ) ? sanitize_text_field( $new['link'] ) : ''; } return $saved_data; } public function form( $instance ) { global $_wp_additional_image_sizes; $types = apply_filters( 'siteorigin_panels_gallery_types', array() ); $instance = wp_parse_args( $instance, array( 'ids' => '', 'size' => apply_filters( 'siteorigin_panels_gallery_default_size', '' ), 'type' => apply_filters( 'siteorigin_panels_gallery_default_type', '' ), 'columns' => 3, 'link' => '', ) ); ?>
__( 'Displays a simple image.', 'siteorigin-panels' ), ) ); } /** * @param array $args * @param array $instance */ public function widget( $args, $instance ) { echo $args['before_widget']; if ( ! empty( $instance['href'] ) ) { echo ''; } echo '
__( 'Embeds a video.', 'siteorigin-panels' ), ) ); } /** * Display the video using * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { $embed = new WP_Embed(); if ( ! wp_script_is( 'siteorigin-panels-embedded-video' ) ) { wp_enqueue_script( 'siteorigin-panels-embedded-video', plugin_dir_url( __FILE__ ) . 'js/embedded-video.js', array( 'jquery', 'fitvids' ), SITEORIGIN_PANELS_VERSION ); } echo $args['before_widget']; ?>
__( 'A self hosted video player.', 'siteorigin-panels' ), ) ); } public function widget( $args, $instance ) { if ( empty( $instance['url'] ) ) { return; } if ( ! function_exists( 'wp_video_shortcode' ) ) { return; } $instance = wp_parse_args( $instance, array( 'url' => '', 'poster' => '', 'autoplay' => false, ) ); echo $args['before_widget']; echo wp_video_shortcode( array( 'src' => esc_url( $instance['url'] ), 'poster' => esc_attr( $instance['poster'] ), 'autoplay' => esc_attr( $instance['autoplay'] ), ) ); echo $args['after_widget']; } public function update( $new, $old ) { $new['url'] = esc_url_raw( $new['url'] ); $new['poster'] = esc_url_raw( $new['poster'] ); $new['autoplay'] = ! empty( $new['autoplay'] ) ? 1 : 0; return $new; } public function form( $instance ) { $instance = wp_parse_args( $instance, array( 'url' => '', 'poster' => '', 'skin' => 'siteorigin', 'ratio' => 1.777, 'autoplay' => false, ) ); ?>
'', 'src' => '', 'poster' => '', 'skin' => 'siteorigin', 'ratio' => 1.777, 'autoplay' => 0, ), $atts ); if ( ! empty( $instance['src'] ) ) { $instance['url'] = $instance['src']; } if ( empty( $instance['url'] ) ) { return; } ob_start(); the_widget( 'SiteOrigin_Panels_Widgets_Video', $instance ); return ob_get_clean(); } add_shortcode( 'self_video', 'siteorigin_panels_video_shortcode' ); /** * Register the widgets. */ function siteorigin_panels_widgets_init() { register_widget( 'SiteOrigin_Panels_Widgets_Gallery' ); register_widget( 'SiteOrigin_Panels_Widgets_Image' ); register_widget( 'SiteOrigin_Panels_Widgets_EmbeddedVideo' ); register_widget( 'SiteOrigin_Panels_Widgets_Video' ); } add_action( 'widgets_init', 'siteorigin_panels_widgets_init' );