first commit
This commit is contained in:
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
class DSM_TwitterEmbeddedTimeline extends ET_Builder_Module {
|
||||
|
||||
public $slug = 'dsm_embed_twitter_timeline';
|
||||
public $vb_support = 'on';
|
||||
|
||||
protected $module_credits = array(
|
||||
'module_uri' => 'https://divisupreme.com/',
|
||||
'author' => 'Divi Supreme',
|
||||
'author_uri' => 'https://divisupreme.com/',
|
||||
);
|
||||
|
||||
public function init() {
|
||||
$this->name = esc_html__( 'Supreme Embed Twitter Timeline ', 'dsm-supreme-modules-for-divi' );
|
||||
$this->icon_path = plugin_dir_path( __FILE__ ) . 'icon.svg';
|
||||
// Toggle settings
|
||||
$this->settings_modal_toggles = array(
|
||||
'general' => array(
|
||||
'toggles' => array(
|
||||
'main_content' => esc_html__( 'Twitter Timeline Settings', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function get_advanced_fields_config() {
|
||||
return array(
|
||||
'text' => false,
|
||||
'fonts' => false,
|
||||
'background' => array(
|
||||
'css' => array(
|
||||
'main' => '%%order_class%%',
|
||||
),
|
||||
'options' => array(
|
||||
'parallax_method' => array(
|
||||
'default' => 'off',
|
||||
),
|
||||
),
|
||||
),
|
||||
'max_width' => array(
|
||||
'css' => array(
|
||||
'main' => '%%order_class%%',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function get_fields() {
|
||||
return array(
|
||||
'twitter_username' => array(
|
||||
'label' => esc_html__( 'Twitter Username', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'text',
|
||||
'option_category' => 'basic_option',
|
||||
'toggle_slug' => 'main_content',
|
||||
'default_on_front' => 'TwitterDev',
|
||||
'description' => esc_html__( 'Enter the Twitter Username without the hashtag @', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'limit_tweet' => array(
|
||||
'label' => esc_html__( 'Limit Tweets', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Limiting the number of Tweets displayed.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'off',
|
||||
),
|
||||
'tweet_number' => array(
|
||||
'label' => esc_html__( 'Number of Tweets', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'range',
|
||||
'option_category' => 'layout',
|
||||
'toggle_slug' => 'main_content',
|
||||
'validate_unit' => false,
|
||||
'unitless' => true,
|
||||
'default' => '3',
|
||||
'range_settings' => array(
|
||||
'min' => '1',
|
||||
'max' => '20',
|
||||
'step' => '1',
|
||||
),
|
||||
'show_if' => array(
|
||||
'limit_tweet' => 'on',
|
||||
),
|
||||
),
|
||||
'theme' => array(
|
||||
'label' => esc_html__( 'Theme', 'et_builder' ),
|
||||
'type' => 'select',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'light' => esc_html__( 'Light', 'et_builder' ),
|
||||
'dark' => esc_html__( 'Dark', 'et_builder' ),
|
||||
),
|
||||
'default_on_front' => 'Dark',
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Here you can choose whether the Twitter Widget will appear in light or dark theme.', 'et_builder' ),
|
||||
),
|
||||
/*
|
||||
'link_color' => array(
|
||||
'label' => esc_html__( 'Link Color', 'et_builder' ),
|
||||
'type' => 'color',
|
||||
'custom_color' => true,
|
||||
'toggle_slug' => 'main_content',
|
||||
'default_on_front' => '#1b95e0',
|
||||
),
|
||||
*/
|
||||
'header' => array(
|
||||
'label' => esc_html__( 'Show Header', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Hides the timeline header. Implementing sites must add their own Twitter attribution, link to the source timeline, and comply with other Twitter display requirements.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'on',
|
||||
),
|
||||
'footer' => array(
|
||||
'label' => esc_html__( 'Show Footer', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Hides the timeline footer and Tweet composer link, if included in the timeline widget type.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'on',
|
||||
),
|
||||
'borders' => array(
|
||||
'label' => esc_html__( 'Show Border', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Removes all borders within the widget including borders surrounding the widget area and separating Tweets.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'on',
|
||||
),
|
||||
'scrollbar' => array(
|
||||
'label' => esc_html__( 'Show Scrollbar', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Crops and hides the main timeline scrollbar, if visible. Please consider that hiding standard user interface components can affect the accessibility of your website.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'on',
|
||||
),
|
||||
'remove_background' => array(
|
||||
'label' => esc_html__( "Remove Widget's Background color", 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'yes_no_button',
|
||||
'option_category' => 'configuration',
|
||||
'options' => array(
|
||||
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
|
||||
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
|
||||
),
|
||||
'toggle_slug' => 'main_content',
|
||||
'description' => esc_html__( 'Removes the widget’s background color.', 'dsm-supreme-modules-for-divi' ),
|
||||
'default_on_front' => 'off',
|
||||
),
|
||||
'height' => array(
|
||||
'label' => esc_html__( 'Height', 'dsm-supreme-modules-for-divi' ),
|
||||
'type' => 'range',
|
||||
'option_category' => 'layout',
|
||||
'tab_slug' => 'advanced',
|
||||
'toggle_slug' => 'width',
|
||||
'default_unit' => '',
|
||||
'default' => '800px',
|
||||
'range_settings' => array(
|
||||
'min' => '200',
|
||||
'max' => '1000',
|
||||
'step' => '1',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function render( $attrs, $content = null, $render_slug ) {
|
||||
$twitter_username = $this->props['twitter_username'];
|
||||
$limit_tweet = $this->props['limit_tweet'];
|
||||
$tweet_number = floatval( $this->props['tweet_number'] );
|
||||
$theme = $this->props['theme'];
|
||||
$header = $this->props['header'];
|
||||
$footer = $this->props['footer'];
|
||||
$borders = $this->props['borders'];
|
||||
$scrollbar = $this->props['scrollbar'];
|
||||
$height = floatval( $this->props['height'] );
|
||||
//$link_color = $this->props['link_color'];
|
||||
$remove_background = $this->props['remove_background'];
|
||||
|
||||
wp_enqueue_script( 'dsm-twitter-embed' );
|
||||
|
||||
// Render module content
|
||||
$output = sprintf(
|
||||
'<div class="dsm-twitter-timeline">
|
||||
<a class="twitter-timeline" data-height="%9$s" data-theme="%8$s" href="https://twitter.com/%1$s" data-chrome="%2$s%3$s%4$s%5$s%6$s"%7$s>Tweets by @%1$s</a>
|
||||
</div>',
|
||||
esc_attr( $twitter_username ),
|
||||
'on' !== $header ? 'noheader' : '',
|
||||
'on' !== $footer ? ' nofooter' : '',
|
||||
'on' !== $borders ? ' noborders' : '',
|
||||
'on' !== $scrollbar ? ' noscrollbar' : '',
|
||||
'off' !== $remove_background ? ' transparent' : '',
|
||||
'off' !== $limit_tweet ? esc_attr( " data-tweet-limit={$tweet_number}" ) : '',
|
||||
esc_attr( $theme ),
|
||||
esc_attr( $height )
|
||||
);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new DSM_TwitterEmbeddedTimeline;
|
||||
@@ -0,0 +1 @@
|
||||
<svg enable-background="new 0 0 28 28" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="m2.38 19.03c-.76 0-1.38-.62-1.38-1.38s.62-1.38 1.38-1.38 1.38.62 1.38 1.38-.62 1.38-1.38 1.38zm0-1.99c-.34 0-.62.28-.62.62s.28.62.62.62.62-.28.62-.62-.28-.62-.62-.62z" fill="#03dac6"/><path d="m25.62 5.12c-.76 0-1.38-.62-1.38-1.38s.62-1.38 1.38-1.38 1.38.62 1.38 1.38-.62 1.38-1.38 1.38zm0-2c-.34 0-.62.28-.62.62s.28.62.62.62.62-.28.62-.62-.28-.62-.62-.62z" fill="#03dac6"/><path d="m21.4 25.64h-14.22c-1.13 0-2.04-.92-2.04-2.04v-18.21c0-1.13.92-2.04 2.04-2.04h14.22c1.13 0 2.04.92 2.04 2.04v18.21c0 1.13-.92 2.04-2.04 2.04zm-14.22-21.52c-.7 0-1.27.57-1.27 1.27v18.21c0 .7.57 1.27 1.27 1.27h14.22c.7 0 1.27-.57 1.27-1.27v-18.21c0-.7-.57-1.27-1.27-1.27z" fill="#fff"/><path d="m8.01 14.58h12.87v.51h-12.87z" fill="#fff"/><path d="m13.05 7.91c-.03-.03-.08-.04-.12-.02s-.08.03-.12.04c.07-.08.11-.18.15-.28.01-.05-.02-.1-.07-.12-.03-.01-.06 0-.08.01-.15.08-.3.14-.46.18-.33-.31-.83-.35-1.21-.09-.29.2-.45.53-.41.88-.63-.05-1.2-.36-1.59-.86-.03-.02-.06-.03-.09-.03s-.06.02-.08.05c-.13.22-.17.48-.1.72.03.13.09.24.16.35-.03-.02-.06-.04-.09-.06-.04-.04-.1-.03-.14.01-.01.02-.02.04-.02.06.01.35.2.68.51.85-.04 0-.08-.01-.12-.02-.05-.02-.1.01-.12.06-.01.02-.01.05 0 .07.13.3.4.52.73.59-.31.17-.66.25-1.01.21-.05-.01-.09.02-.1.07-.01.04 0 .09.04.11.43.26.92.39 1.42.4.48 0 .95-.14 1.34-.41.76-.5 1.23-1.41 1.17-2.22.16-.12.3-.27.42-.43.02-.04.01-.09-.01-.12z" fill="#fff"/><path d="m13.02 12.7h-4.31c-.7 0-1.26-.57-1.26-1.26v-4.32c0-.7.57-1.26 1.26-1.26h4.31c.7 0 1.26.57 1.26 1.26v4.31c0 .7-.56 1.27-1.26 1.27zm-4.31-6.33c-.41 0-.75.34-.75.75v4.31c0 .41.34.75.75.75h4.31c.41 0 .75-.34.75-.75v-4.31c0-.41-.34-.75-.75-.75z" fill="#03dac6"/><path d="m8.01 17.96h12.87v.51h-12.87z" fill="#03dac6"/><path d="m8.01 21.07h12.87v.51h-12.87z" fill="#fff"/><path d="m8.01 22.88h12.87v.51h-12.87z" fill="#03dac6"/><g fill="#fff"><path d="m15.58 6.41h5.21v.51h-5.21z"/><path d="m15.58 8.39h5.21v.51h-5.21z"/><path d="m15.58 10.24h5.21v.51h-5.21z"/><path d="m15.58 12.15h5.21v.51h-5.21z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user