PATH:
home
/
lab2454c
/
fcxpro.com
/
wp-content
/
plugins
/
webon-core
/
inc
/
shortcodes
/
parallax-images
<?php if ( ! function_exists( 'webon_core_add_parallax_images_shortcode' ) ) { /** * Function that add shortcode into shortcodes list for registration * * @param $shortcodes array * * @return array */ function webon_core_add_parallax_images_shortcode( $shortcodes ) { $shortcodes[] = 'WebonCoreParallaxImagesShortcode'; return $shortcodes; } add_filter( 'webon_core_filter_register_shortcodes', 'webon_core_add_parallax_images_shortcode' ); } if ( class_exists( 'WebonCoreShortcode' ) ) { class WebonCoreParallaxImagesShortcode extends WebonCoreShortcode { public function __construct() { $this->set_layouts( apply_filters( 'webon_core_filter_parallax_images_layouts', array() ) ); $this->set_extra_options( apply_filters( 'webon_core_filter_parallax_images_extra_options', array() ) ); parent::__construct(); } public function map_shortcode() { $this->set_shortcode_path( WEBON_CORE_SHORTCODES_URL_PATH . '/parallax-images' ); $this->set_base( 'webon_core_parallax_images' ); $this->set_name( esc_html__( 'Parallax Images', 'webon-core' ) ); $this->set_description( esc_html__( 'Shortcode that adds image with text element', 'webon-core' ) ); $this->set_category( esc_html__( 'Webon Core', 'webon-core' ) ); $this->set_option( array( 'field_type' => 'text', 'name' => 'custom_class', 'title' => esc_html__( 'Custom Class', 'webon-core' ), ) ); $options_map = webon_core_get_variations_options_map( $this->get_layouts() ); $this->set_option( array( 'field_type' => 'select', 'name' => 'layout', 'title' => esc_html__( 'Layout', 'webon-core' ), 'options' => $this->get_layouts(), 'default_value' => $options_map['default_value'], 'visibility' => array( 'map_for_page_builder' => $options_map['visibility'] ) ) ); $this->set_option( array( 'field_type' => 'image', 'name' => 'main_image', 'title' => esc_html__( 'Center Image', 'webon-core' ), ) ); $this->set_option( array( 'field_type' => 'image', 'name' => 'back_image', 'title' => esc_html__( 'Back Image', 'webon-core' ), ) ); $this->set_option( array( 'field_type' => 'image', 'name' => 'front_image', 'title' => esc_html__( 'Front Image', 'webon-core' ), ) ); $this->map_extra_options(); } public static function call_shortcode( $params ) { $html = qode_framework_call_shortcode( 'webon_core_parallax_images', $params ); $html = str_replace( "\n", '', $html ); return $html; } public function render( $options, $content = null ) { parent::render( $options ); $atts = $this->get_atts(); $atts['holder_classes'] = $this->get_holder_classes( $atts ); $atts['image_params'] = $this->generate_image_params( $atts ); return webon_core_get_template_part( 'shortcodes/parallax-images', 'variations/' . $atts['layout'] . '/templates/' . $atts['layout'], '', $atts ); } public function load_assets() { wp_enqueue_script( 'parallax-images', WEBON_CORE_INC_URL_PATH . '/shortcodes/parallax-images/assets/js/plugins/jquery.parallax-scroll.js', array( 'jquery' ), true ); } private function get_holder_classes( $atts ) { $holder_classes = $this->init_holder_classes(); $holder_classes[] = 'qodef-parallax-images'; $holder_classes[] = ! empty ( $atts['layout'] ) ? 'qodef-layout--' . $atts['layout'] : ''; // $holder_classes[] = ! empty( $atts['stack_image_position'] ) ? 'qodef-stack--' . $atts['stack_image_position'] : 'qodef-stack--' . $atts['stack_image_position']; return implode( ' ', $holder_classes ); } private function generate_image_params( $atts ) { $image = array(); if ( ! empty( $atts['image'] ) ) { $id = $atts['image']; $image['image_id'] = intval( $id ); $image_original = wp_get_attachment_image_src( $id, 'full' ); $image['url'] = $image_original[0]; $image['alt'] = get_post_meta( $id, '_wp_attachment_image_alt', true ); $image_size = trim( $atts['image_size'] ); preg_match_all( '/\d+/', $image_size, $matches ); /* check if numeral width and height are entered */ if ( in_array( $image_size, array( 'thumbnail', 'thumb', 'medium', 'large', 'full' ) ) ) { $image['image_size'] = $image_size; } elseif ( ! empty( $matches[0] ) ) { $image['image_size'] = array( $matches[0][0], $matches[0][1] ); } else { $image['image_size'] = 'full'; } } return $image; } } }
[+]
..
[-] parallax-images.php
[edit]
[-] parallax-images-elementor.php
[edit]
[+]
variations
[-] include.php
[edit]
[+]
assets