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,257 @@
<?php
class DSM_Text_Badges extends ET_Builder_Module {
public $slug = 'dsm_text_badges';
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 Text Badges', '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__( 'Text', 'dsm-supreme-modules-for-divi' ),
),
),
'advanced' => array(
'toggles' => array(),
),
);
}
public function get_advanced_fields_config() {
return array(
'fonts' => array(
'header' => array(
'label' => esc_html__( 'Main', 'dsm-supreme-modules-for-divi' ),
'css' => array(
'main' => '%%order_class%% h1.et_pb_module_header, %%order_class%% h2.et_pb_module_header, %%order_class%% h3.et_pb_module_header, %%order_class%% h4.et_pb_module_header, %%order_class%% h5.et_pb_module_header, %%order_class%% h6.et_pb_module_header',
),
'font_size' => array(
'default' => '18px',
),
'line_height' => array(
'default' => '1em',
),
'letter_spacing' => array(
'default' => '0px',
),
'header_level' => array(
'default' => 'h4',
),
'hide_text_align' => true,
),
'badges' => array(
'label' => esc_html__( 'Badges', 'dsm-supreme-modules-for-divi' ),
'css' => array(
'main' => '%%order_class%% .dsm-badges',
),
'text_color' => array(
'default' => '#fff',
),
'hide_font_size' => true,
'hide_line_height' => true,
'hide_text_align' => true,
'letter_spacing' => array(
'default' => '0px',
),
),
),
'text' => array(
'use_text_orientation' => true,
'use_background_layout' => true,
'css' => array(
'text_shadow' => '%%order_class%% .dsm-text-badge',
),
'options' => array(
'background_layout' => array(
'default' => 'light',
),
),
),
'background' => array(
'css' => array(
'main' => '%%order_class%% .dsm-text-badges',
),
'options' => array(
'parallax_method' => array(
'default' => 'off',
),
),
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% .dsm-text-badges',
),
),
'borders' => array(
'default' => array(
'css' => array(
'main' => array(
'border_radii' => '%%order_class%%',
'border_styles' => '%%order_class%%',
),
),
),
'image' => array(
'css' => array(
'main' => array(
'border_radii' => '%%order_class%% .dsm-badges',
'border_styles' => '%%order_class%% .dsm-badges',
),
),
'label_prefix' => esc_html__( 'Badge', 'dsm-supreme-modules-for-divi' ),
'tab_slug' => 'advanced',
'toggle_slug' => 'badges',
),
),
'box_shadow' => array(
'default' => array(
'css' => array(
'main' => '%%order_class%% .dsm-text-badges',
),
),
),
);
}
public function get_fields() {
$et_accent_color = et_builder_accent_color();
return array(
'main_text' => array(
'label' => esc_html__( 'Main Text', 'dsm-supreme-modules-for-divi' ),
'type' => 'text',
'option_category' => 'basic_option',
'toggle_slug' => 'main_content',
'default_on_front' => 'Badges',
),
'badges_text' => array(
'label' => esc_html__( 'Badges Text', 'dsm-supreme-modules-for-divi' ),
'type' => 'text',
'option_category' => 'basic_option',
'toggle_slug' => 'main_content',
'default_on_front' => 'New',
),
'badges_placement' => array(
'label' => esc_html__( 'Badges Placement', 'dsm-supreme-modules-for-divi' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'before' => esc_html__( 'Before', 'dsm-supreme-modules-for-divi' ),
'after' => esc_html__( 'After', 'dsm-supreme-modules-for-divi' ),
),
'default' => 'after',
'description' => esc_html__( 'Here you can choose the placement of the badges to be before or after the Main Text.', 'dsm-supreme-modules-for-divi' ),
'toggle_slug' => 'main_content',
),
'badges_background_color' => array(
'label' => esc_html__( 'Background Color', 'dsm-supreme-modules-for-divi' ),
'type' => 'color-alpha',
'custom_color' => true,
'default' => $et_accent_color,
'tab_slug' => 'advanced',
'toggle_slug' => 'badges',
'description' => esc_html__( 'Here you can define a custom background color for the badge', 'dsm-supreme-modules-for-divi' ),
),
'badges_gap' => array(
'label' => esc_html__( 'Gap', 'dsm-supreme-modules-for-divi' ),
'type' => 'range',
'option_category' => 'layout',
'tab_slug' => 'advanced',
'toggle_slug' => 'badges',
'mobile_options' => true,
'validate_unit' => true,
'default' => '7px',
'default_unit' => 'px',
'default_on_front' => '',
'allow_empty' => true,
'responsive' => true,
'description' => esc_html__( 'Here you can define a gap between the text and the badge', 'dsm-supreme-modules-for-divi' ),
),
);
}
public function render( $attrs, $content = null, $render_slug ) {
$main_text = $this->props['main_text'];
$badges_text = $this->props['badges_text'];
$badges_placement = $this->props['badges_placement'];
$badges_background_color = $this->props['badges_background_color'];
$badges_gap = $this->props['badges_gap'];
$badges_gap_tablet = $this->props['badges_gap_tablet'];
$badges_gap_phone = $this->props['badges_gap_phone'];
$badges_gap_last_edited = $this->props['badges_gap_last_edited'];
$background_layout = $this->props['background_layout'];
$header_level = $this->props['header_level'];
if ( '' !== $badges_text ) {
$badges_text = sprintf(
'<span class="dsm-badges dsm-badges-%2$s">%1$s</span>',
$badges_text,
esc_attr( $badges_placement )
);
}
if ( '' !== $main_text ) {
$main_text = sprintf(
'<%1$s class="dsm-text-badges et_pb_module_header">%3$s%2$s%4$s</%1$s>',
et_pb_process_header_level( $header_level, 'h4' ),
$main_text,
( 'before' === $badges_placement ? $badges_text : '' ),
( 'after' === $badges_placement ? $badges_text : '' )
);
}
if ( '' !== $badges_background_color ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => '%%order_class%% .dsm-badges',
'declaration' => sprintf(
'background-color: %1$s;',
esc_html( $badges_background_color )
),
)
);
}
if ( '' !== $badges_gap_tablet || '' !== $badges_gap_phone || '7px' !== $badges_gap ) {
$badges_gap_responsive_active = et_pb_get_responsive_status( $badges_gap_last_edited );
$badges_gap_values = array(
'desktop' => $badges_gap,
'tablet' => $badges_gap_responsive_active ? $badges_gap_tablet : '',
'phone' => $badges_gap_responsive_active ? $badges_gap_phone : '',
);
if ( 'after' === $badges_placement ) {
et_pb_generate_responsive_css( $badges_gap_values, '%%order_class%% .dsm-badges-after', 'margin-left', $render_slug );
} else {
et_pb_generate_responsive_css( $badges_gap_values, '%%order_class%% .dsm-badges-before', 'margin-right', $render_slug );
}
}
$this->add_classname(
array(
$this->get_text_orientation_classname(),
"et_pb_bg_layout_{$background_layout}",
)
);
// Render module content
$output = sprintf(
'%1$s',
$main_text
);
return $output;
}
}
new DSM_Text_Badges;

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 28 28" style="enable-background:new 0 0 28 28;" xml:space="preserve">
<style type="text/css">
.st0{display:none;}
.st1{display:inline;opacity:0.31;}
.st2{display:inline;fill:#6200EE;}
.st3{fill:#FFFFFF;}
.st4{fill:#03DAC6;}
.st5{fill:#FFFFFF;stroke:#221F1F;stroke-width:0.4754;stroke-miterlimit:10;}
</style>
<g id="Layer_1" class="st0">
<g class="st1">
<path d="M7.77,6.66c-0.79,0-1.44-0.65-1.44-1.44c0-0.8,0.65-1.44,1.44-1.44c0.8,0,1.44,0.65,1.44,1.44
C9.21,6.01,8.57,6.66,7.77,6.66z M7.77,4.58c-0.35,0-0.64,0.29-0.64,0.64s0.29,0.64,0.64,0.64s0.64-0.29,0.64-0.64
S8.13,4.58,7.77,4.58z"/>
<path d="M20.33,19.1c-0.79,0-1.44-0.65-1.44-1.44c0-0.79,0.65-1.44,1.44-1.44c0.8,0,1.44,0.65,1.44,1.44
C21.77,18.45,21.13,19.1,20.33,19.1z M20.33,17.02c-0.35,0-0.64,0.29-0.64,0.64c0,0.35,0.29,0.64,0.64,0.64
c0.35,0,0.64-0.29,0.64-0.64C20.97,17.3,20.69,17.02,20.33,17.02z"/>
<path d="M18.05,23.14l-4.87-4.87l-4.59,4.59V9.45c0-1.59,0.6-2.48,1.1-2.94c0.55-0.51,1.1-0.63,1.16-0.65l0.08-0.01h9.87v0.8
c-0.92,0-1.62,0.25-2.08,0.75c-0.75,0.81-0.67,2-0.67,2.01l0,0.03V23.14z M13.17,17.14l4.07,4.07V9.47
c-0.01-0.18-0.06-1.58,0.88-2.6c0.07-0.07,0.14-0.14,0.22-0.21h-7.37C10.74,6.73,9.39,7.2,9.39,9.45v11.47L13.17,17.14z"/>
<rect x="10.93" y="12.11" width="4.75" height="0.8"/>
</g>
</g>
<g id="Layer_3" class="st0">
<rect x="-789.59" y="-581.63" class="st2" width="1600" height="1200"/>
</g>
<g id="Layer_2">
<g>
<path class="st4" d="M7.98,7.49C7.22,7.49,6.6,6.87,6.6,6.1c0-0.76,0.62-1.38,1.38-1.38c0.76,0,1.38,0.62,1.38,1.38
C9.36,6.87,8.74,7.49,7.98,7.49z M7.98,5.49c-0.34,0-0.62,0.28-0.62,0.62s0.28,0.62,0.62,0.62c0.34,0,0.62-0.28,0.62-0.62
S8.32,5.49,7.98,5.49z"/>
<path class="st4" d="M20.02,19.4c-0.76,0-1.38-0.62-1.38-1.38c0-0.76,0.62-1.38,1.38-1.38c0.76,0,1.38,0.62,1.38,1.38
C21.4,18.78,20.78,19.4,20.02,19.4z M20.02,17.41c-0.34,0-0.62,0.28-0.62,0.62s0.28,0.62,0.62,0.62s0.62-0.28,0.62-0.62
S20.36,17.41,20.02,17.41z"/>
<path class="st3" d="M17.83,23.28l-4.67-4.67l-4.4,4.4V10.16c0-1.52,0.57-2.37,1.05-2.82c0.53-0.49,1.05-0.61,1.11-0.62l0.08-0.01
h9.46v0.77c-0.88,0-1.55,0.24-1.99,0.72c-0.72,0.77-0.64,1.91-0.64,1.93l0,0.03V23.28z M13.16,17.53l3.9,3.9V10.17
c-0.01-0.17-0.05-1.52,0.85-2.49c0.07-0.07,0.13-0.14,0.21-0.2h-7.06C10.83,7.55,9.53,8,9.53,10.16v10.99L13.16,17.53z"/>
<rect x="11.01" y="12.71" class="st4" width="4.55" height="0.77"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB