-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
226 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
core/basic/zaso-youtube-lightbox-widgets/styles/style.css.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
core/basic/zaso-youtube-lightbox-widgets/styles/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.zaso-youtube-lightbox { | ||
margin: 0; | ||
padding: 0; | ||
position: relative; | ||
|
||
a { | ||
position: relative; | ||
} | ||
|
||
&__playbutton { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
-ms-transform: translate(-50%, -50%); | ||
transform: translate(-50%, -50%); | ||
} | ||
} | ||
|
||
.lity { | ||
z-index: 999999; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* [ZASO] YouTube Lightbox Template | ||
* | ||
* @package Zen Addons for SiteOrigin Page Builder | ||
* @since 1.0.6 | ||
*/ | ||
$build_url = esc_url( $instance['video_url'] ); | ||
if( $instance['video_rel'] ) { | ||
$build_url .= '&rel=' . sanitize_text_field( $instance['video_rel'] ); | ||
} | ||
|
||
if( $instance['video_showinfo'] ) { | ||
$build_url .= '&showinfo=' . sanitize_text_field( $instance['video_showinfo'] ); | ||
} | ||
|
||
$video_thumb = wp_get_attachment_image_src( $instance['video_thumb'], 'full' )[0]; | ||
$video_play_button = wp_get_attachment_image_src( $instance['video_play_button'], 'full' ); | ||
?> | ||
|
||
<div <?php echo zaso_format_field_extra_id( $instance['extra_id'] ); ?> class="zaso-youtube-lightbox <?php echo $instance['extra_class']; ?>"> | ||
<div class="zaso-youtube-lightbox__inner"> | ||
<a href="<?php echo $build_url; ?>" data-lity> | ||
<?php if ( $video_thumb ) : ?> | ||
<img src="<?php echo $video_thumb; ?>" alt="<?php echo $instance['video_url']; ?>" /> | ||
<?php else : ?> | ||
<?php echo $instance['video_url']; ?> | ||
<?php endif; ?> | ||
|
||
<?php if ( $video_play_button && $video_thumb ) : ?> | ||
<div class="zaso-youtube-lightbox__playbutton" style="background: url(<?php echo $video_play_button[0]; ?>) no-repeat center center; display: inline-block; width: <?php echo $video_play_button[1]; ?>px; height: <?php echo $video_play_button[2]; ?>px;"></div> | ||
<?php endif; ?> | ||
</a> | ||
</div> | ||
</div> |
132 changes: 132 additions & 0 deletions
132
core/basic/zaso-youtube-lightbox-widgets/zaso-youtube-lightbox-widgets.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
/** | ||
* Widget Name: ZASO - YouTube Lightbox | ||
* Widget ID: zen-addons-siteorigin-youtube-lightbox | ||
* Description: Pop-up lightbox for YouTube videos. | ||
* Author: DopeThemes | ||
* Author URI: https://www.dopethemes.com/ | ||
*/ | ||
|
||
if( ! class_exists( 'Zen_Addons_SiteOrigin_Youtube_Lightbox_Widget' ) ) : | ||
|
||
|
||
class Zen_Addons_SiteOrigin_Youtube_Lightbox_Widget extends SiteOrigin_Widget { | ||
|
||
function __construct() { | ||
|
||
// ZASO field array | ||
$zaso_youtube_lightbox_field_array = array( | ||
'video_url' => array( | ||
'type' => 'text', | ||
'label' => __( 'YouTube Video URL' , 'zaso' ), | ||
'description' => __( 'Insert URL, example: https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'zaso' ), | ||
), | ||
'video_rel' => array( | ||
'type' => 'select', | ||
'label' => __( 'Show Related Videos', 'zaso' ), | ||
'options' => array( | ||
'0' => __( 'No', 'zaso' ), | ||
'1' => __( 'Yes', 'zaso' ) | ||
) | ||
), | ||
'video_showinfo' => array( | ||
'type' => 'select', | ||
'label' => __( 'Show Info', 'zaso' ), | ||
'options' => array( | ||
'0' => __( 'No', 'zaso' ), | ||
'1' => __( 'Yes', 'zaso' ) | ||
) | ||
), | ||
'video_play_button' => array( | ||
'type' => 'media', | ||
'label' => __( 'Video Play Button Image', 'zaso' ), | ||
'library' => 'image', | ||
'fallback' => true | ||
), | ||
'video_thumb' => array( | ||
'type' => 'media', | ||
'label' => __( 'Video Thumbnail', 'zaso' ), | ||
'library' => 'image', | ||
'fallback' => true | ||
), | ||
'extra_id' => array( | ||
'type' => 'text', | ||
'label' => __( 'Extra ID', 'zaso' ), | ||
'description' => __( 'Add an extra ID.', 'zaso' ), | ||
), | ||
'extra_class' => array( | ||
'type' => 'text', | ||
'label' => __( 'Extra Class', 'zaso' ), | ||
'description' => __( 'Add an extra class for styling overrides.', 'zaso' ), | ||
), | ||
); | ||
|
||
// add filter | ||
$zaso_youtube_lightbox_fields = apply_filters( 'zaso_youtube_lightbox_fields', $zaso_youtube_lightbox_field_array ); | ||
|
||
parent::__construct( | ||
'zen-addons-siteorigin-youtube-lightbox', | ||
__( 'ZASO - YouTube Lightbox', 'zaso' ), | ||
array( | ||
'description' => __( 'Pop-up lightbox for YouTube videos.', 'zaso' ), | ||
'help' => 'https://www.dopethemes.com/', | ||
'panels_groups' => array( 'zaso-plugin-widgets' ) | ||
), | ||
array(), | ||
$zaso_youtube_lightbox_fields, | ||
ZASO_WIDGET_BASIC_DIR | ||
); | ||
|
||
} | ||
|
||
function get_less_variables( $instance ) { | ||
|
||
return apply_filters( 'zaso_youtube_lightbox_less_variables', array( | ||
//'video_width' => $instance['video_width'], | ||
//'video_height' => $instance['video_height'] | ||
)); | ||
|
||
} | ||
|
||
function initialize() { | ||
|
||
$this->register_frontend_styles( | ||
array( | ||
array( | ||
'lity', | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/lity.min.css', | ||
array(), | ||
ZASO_VERSION | ||
) | ||
) | ||
); | ||
|
||
$this->register_frontend_styles( | ||
array( | ||
array( | ||
'zen-addons-siteorigin-youtube-lightbox', | ||
ZASO_WIDGET_BASIC_DIR . basename( dirname( __FILE__ ) ) . '/styles/style.css', | ||
array( 'lity' ), | ||
ZASO_VERSION | ||
) | ||
) | ||
); | ||
|
||
$this->register_frontend_scripts( | ||
array( | ||
array( | ||
'lity', | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/lity.min.js', | ||
array( 'jquery' ), | ||
ZASO_VERSION | ||
) | ||
) | ||
); | ||
|
||
} | ||
|
||
} | ||
siteorigin_widget_register( 'zen-addons-siteorigin-youtube-lightbox', __FILE__, 'Zen_Addons_SiteOrigin_Youtube_Lightbox_Widget' ); | ||
|
||
|
||
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters