first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,157 @@
<?php
class DSM_FacebookSimpleComments extends ET_Builder_Module {
public $slug = 'dsm_facebook_comments';
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 Facebook Comments', '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__( 'Facebook Comments Settings', 'dsm-supreme-modules-for-divi' ),
),
),
'advanced' => array(
'toggles' => array(),
),
);
}
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%%',
),
),
'borders' => array(
'default' => array(
'css' => array(
'main' => array(
'border_radii' => '%%order_class%%',
'border_styles' => '%%order_class%%',
),
),
),
),
'box_shadow' => array(
'default' => array(
'css' => array(
'main' => '%%order_class%%',
),
),
),
'filters' => false,
);
}
public function get_fields() {
return array(
'fb_app_id_notice' => array(
'type' => 'warning',
'value' => isset( get_option( 'dsm_settings_social_media' )['dsm_facebook_app_id'] ) && '' !== get_option( 'dsm_settings_social_media' )['dsm_facebook_app_id'] ? true : false,
'display_if' => false,
'message' => et_get_safe_localization( sprintf( __( 'The Facebook APP ID is currently empty in the <a href="%s" target="_blank">Divi Supreme Plugin Page</a>. This module might not function properly without the Facebook APP ID.', 'dsm-supreme-modules-for-divi' ), admin_url( 'admin.php?page=divi_supreme_settings#dsm_settings_social_media' ) ) ),
'toggle_slug' => 'main_content',
),
'fb_app_id' => array(
'label' => esc_html__( 'Facebook APP ID', 'dsm-supreme-modules-for-divi' ),
'type' => 'text',
'option_category' => 'basic_option',
'attributes' => 'readonly',
'default_on_front' => isset( get_option( 'dsm_settings_social_media' )['dsm_facebook_app_id'] ) && '' !== get_option( 'dsm_settings_social_media' )['dsm_facebook_app_id'] ? get_option( 'dsm_settings_social_media' )['dsm_facebook_app_id'] : '',
'description' => et_get_safe_localization( sprintf( __( 'The Facebook module uses the Facebook APP ID and requires a Facebook APP ID to function. Before using all Facebook module, please make sure you have added your Facebook APP ID inside the Divi Supreme Plugin Page. You can go to <a href="%1$s">Facebook Developer</a> and click on Create New App to get one.', 'dsm-supreme-modules-for-divi' ), esc_url( 'https://developers.facebook.com/apps/' ) ) ),
'toggle_slug' => 'main_content',
),
'page_url' => array(
'label' => esc_html__( 'Page URL', 'dsm-supreme-modules-for-divi' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => esc_html__( 'Enter the Page URL.', 'dsm-supreme-modules-for-divi' ),
'toggle_slug' => 'main_content',
'default_on_front' => 'https://www.facebook.com/divisupreme/',
),
'num_posts' => array(
'label' => esc_html__( 'Number of Posts', 'dsm-supreme-modules-for-divi' ),
'type' => 'text',
'option_category' => 'basic_option',
'toggle_slug' => 'main_content',
'description' => esc_html__( 'The number of comments to show by default. The minimum value is 1.', 'dsm-supreme-modules-for-divi' ),
'default_on_front' => '10',
),
'color_scheme' => array(
'label' => esc_html__( 'Color Scheme', 'dsm-supreme-modules-for-divi' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'light' => esc_html__( 'Light', 'dsm-supreme-modules-for-divi' ),
'dark' => esc_html__( 'Dark', 'dsm-supreme-modules-for-divi' ),
),
'toggle_slug' => 'main_content',
'description' => esc_html__( 'The color scheme used by the comments plugin. Can be "light" or "dark".', 'dsm-supreme-modules-for-divi' ),
'default_on_front' => 'light',
),
'order_by' => array(
'label' => esc_html__( 'Order By', 'dsm-supreme-modules-for-divi' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'social' => esc_html__( 'Social', 'dsm-supreme-modules-for-divi' ),
'reverse_time' => esc_html__( 'Reverse Time', 'dsm-supreme-modules-for-divi' ),
'time' => esc_html__( 'Time', 'dsm-supreme-modules-for-divi' ),
),
'toggle_slug' => 'main_content',
'description' => sprintf( esc_html__( 'The order to use when displaying comments. Can be "social", "reverse_time", or "time". The different order types are explained <a href="%1$s">in the FAQ</a>' ), 'https://developers.facebook.com/docs/plugins/comments/#faqorder', 'dsm-supreme-modules-for-divi' ),
'default_on_front' => 'social',
),
);
}
public function render( $attrs, $content = null, $render_slug ) {
$fb_app_id = $this->props['fb_app_id'];
$page_url = $this->props['page_url'];
$num_posts = $this->props['num_posts'];
$color_scheme = $this->props['color_scheme'];
$order_by = $this->props['order_by'];
wp_enqueue_script( 'dsm-facebook' );
// Render module content
$output = sprintf(
'<div class="dsm-facebook-comments">
<div id="fb-root"></div>
<div class="fb-comments" data-href="%1$s" data-colorscheme="%3$s" data-numposts="%2$s" data-order-by="%4$s" width="100%%" data-lazy="true"></div>
</div>',
esc_url( $page_url ),
esc_attr( $num_posts ),
esc_attr( $color_scheme ),
esc_attr( $order_by )
);
return $output;
}
}
new DSM_FacebookSimpleComments();

View File

@@ -0,0 +1 @@
<svg clip-rule="evenodd" fill-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><g fill-rule="nonzero"><path d="m6.51 22.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="m11.43 22.25c-.1 0-.21-.02-.31-.05-.35-.13-.58-.46-.58-.83v-3.68h-1.7c-.94 0-1.71-.77-1.71-1.71v-8.51c0-.94.77-1.71 1.71-1.71h12.33c.94 0 1.71.77 1.71 1.71v8.51c0 .94-.77 1.71-1.71 1.71h-5.48l-3.58 4.25c-.18.19-.43.31-.68.31zm-2.59-15.73c-.52 0-.95.42-.95.95v8.51c0 .52.42.95.95.95h2.47v4.44c0 .07.04.1.08.11s.09.02.13-.04l3.8-4.52h5.84c.52 0 .95-.42.95-.95v-8.5c0-.52-.42-.95-.95-.95z" fill="#fff"/><path d="m12.48 14.86c-1.77 0-3.21-1.44-3.21-3.21s1.44-3.21 3.21-3.21 3.21 1.44 3.21 3.21-1.44 3.21-3.21 3.21zm0-5.65c-1.35 0-2.44 1.1-2.44 2.44 0 1.35 1.1 2.44 2.44 2.44 1.35 0 2.44-1.1 2.44-2.44.01-1.34-1.09-2.44-2.44-2.44z" fill="#03dac6"/><path d="m18.66 9.77h-.02l-1.06.5-.2-.97 1.46-.68h1.07v5.53h-1.25z" fill="#fff"/></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB