Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/supreme-.../includes/modules/Lottie
File: Lottie.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class DSM_Lottie extends ET_Builder_Module {
[2] Fix | Delete
[3] Fix | Delete
public $slug = 'dsm_lottie';
[4] Fix | Delete
public $vb_support = 'on';
[5] Fix | Delete
public $icon_path;
[6] Fix | Delete
[7] Fix | Delete
protected $module_credits = array(
[8] Fix | Delete
'module_uri' => 'https://divisupreme.com/',
[9] Fix | Delete
'author' => 'Divi Supreme',
[10] Fix | Delete
'author_uri' => 'https://divisupreme.com/',
[11] Fix | Delete
);
[12] Fix | Delete
[13] Fix | Delete
public function init() {
[14] Fix | Delete
$this->name = esc_html__( 'Supreme Lottie', 'dsm-supreme-modules-for-divi' );
[15] Fix | Delete
$this->icon_path = plugin_dir_path( __FILE__ ) . 'icon.svg';
[16] Fix | Delete
// Toggle settings
[17] Fix | Delete
$this->settings_modal_toggles = array(
[18] Fix | Delete
'general' => array(
[19] Fix | Delete
'toggles' => array(
[20] Fix | Delete
'main_content' => esc_html__( 'Lottie', 'dsm-supreme-modules-for-divi' ),
[21] Fix | Delete
),
[22] Fix | Delete
),
[23] Fix | Delete
'advanced' => array(
[24] Fix | Delete
'toggles' => array(),
[25] Fix | Delete
),
[26] Fix | Delete
);
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
public function get_advanced_fields_config() {
[30] Fix | Delete
return array(
[31] Fix | Delete
'text' => false,
[32] Fix | Delete
'fonts' => false,
[33] Fix | Delete
'background' => array(
[34] Fix | Delete
'css' => array(
[35] Fix | Delete
'main' => '%%order_class%%',
[36] Fix | Delete
),
[37] Fix | Delete
'options' => array(
[38] Fix | Delete
'parallax_method' => array(
[39] Fix | Delete
'default' => 'off',
[40] Fix | Delete
),
[41] Fix | Delete
),
[42] Fix | Delete
),
[43] Fix | Delete
'max_width' => array(
[44] Fix | Delete
'css' => array(
[45] Fix | Delete
'main' => '%%order_class%%',
[46] Fix | Delete
),
[47] Fix | Delete
),
[48] Fix | Delete
'borders' => array(
[49] Fix | Delete
'default' => array(
[50] Fix | Delete
'css' => array(
[51] Fix | Delete
'main' => array(
[52] Fix | Delete
'border_radii' => '%%order_class%%',
[53] Fix | Delete
'border_styles' => '%%order_class%%',
[54] Fix | Delete
),
[55] Fix | Delete
),
[56] Fix | Delete
),
[57] Fix | Delete
),
[58] Fix | Delete
'box_shadow' => array(
[59] Fix | Delete
'default' => array(
[60] Fix | Delete
'css' => array(
[61] Fix | Delete
'main' => '%%order_class%%',
[62] Fix | Delete
),
[63] Fix | Delete
),
[64] Fix | Delete
),
[65] Fix | Delete
'filters' => false,
[66] Fix | Delete
);
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
public function get_fields() {
[70] Fix | Delete
return array(
[71] Fix | Delete
'lottie_url' => array(
[72] Fix | Delete
'label' => esc_html__( 'Lottie JSON File', 'dsm-supreme-modules-for-divi' ),
[73] Fix | Delete
'type' => 'upload',
[74] Fix | Delete
'option_category' => 'basic_option',
[75] Fix | Delete
'data_type' => 'json',
[76] Fix | Delete
'upload_button_text' => esc_attr__( 'Upload a json file', 'dsm-supreme-modules-for-divi' ),
[77] Fix | Delete
'choose_text' => esc_attr__( 'Choose a JSON file', 'dsm-supreme-modules-for-divi' ),
[78] Fix | Delete
'update_text' => esc_attr__( 'Set As JSON for the module', 'dsm-supreme-modules-for-divi' ),
[79] Fix | Delete
'computed_affects' => array(
[80] Fix | Delete
'__lottie',
[81] Fix | Delete
),
[82] Fix | Delete
),
[83] Fix | Delete
'lottie_loop' => array(
[84] Fix | Delete
'label' => esc_html__( 'Loop', 'dsm-supreme-modules-for-divi' ),
[85] Fix | Delete
'type' => 'yes_no_button',
[86] Fix | Delete
'option_category' => 'configuration',
[87] Fix | Delete
'options' => array(
[88] Fix | Delete
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
[89] Fix | Delete
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
[90] Fix | Delete
),
[91] Fix | Delete
'default_on_front' => 'on',
[92] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your Lottie will animate in loop.', 'dsm-supreme-modules-for-divi' ),
[93] Fix | Delete
'computed_affects' => array(
[94] Fix | Delete
'__lottie',
[95] Fix | Delete
),
[96] Fix | Delete
'show_if_not' => array(
[97] Fix | Delete
'lottie_play_on_hover' => 'on',
[98] Fix | Delete
),
[99] Fix | Delete
[100] Fix | Delete
),
[101] Fix | Delete
'loop_no_times' => array(
[102] Fix | Delete
'label' => esc_html__( 'Number of times', 'dsm-supreme-modules-for-divi' ),
[103] Fix | Delete
'type' => 'range',
[104] Fix | Delete
'option_category' => 'configuration',
[105] Fix | Delete
'validate_unit' => false,
[106] Fix | Delete
'unitless' => true,
[107] Fix | Delete
'description' => esc_html__( 'This option is only available if Yes is selected for Loop. Enter the number of times you wish to have the animation loop before stopping.', 'dsm-supreme-modules-for-divi' ),
[108] Fix | Delete
'range_settings' => array(
[109] Fix | Delete
'min' => '0',
[110] Fix | Delete
'max' => '10',
[111] Fix | Delete
'step' => '1',
[112] Fix | Delete
),
[113] Fix | Delete
'show_if' => array(
[114] Fix | Delete
'lottie_loop' => 'on',
[115] Fix | Delete
),
[116] Fix | Delete
'show_if_not' => array(
[117] Fix | Delete
'lottie_play_on_hover' => 'on',
[118] Fix | Delete
),
[119] Fix | Delete
'computed_affects' => array(
[120] Fix | Delete
'__lottie',
[121] Fix | Delete
),
[122] Fix | Delete
),
[123] Fix | Delete
/*
[124] Fix | Delete
'lottie_autoplay' => array(
[125] Fix | Delete
'label' => esc_html__( 'Autoplay', 'dsm-supreme-modules-for-divi' ),
[126] Fix | Delete
'type' => 'yes_no_button',
[127] Fix | Delete
'option_category' => 'configuration',
[128] Fix | Delete
'options' => array(
[129] Fix | Delete
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
[130] Fix | Delete
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
[131] Fix | Delete
),
[132] Fix | Delete
'default_on_front' => 'on',
[133] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your Lottie will autoplay on load.', 'dsm-supreme-modules-for-divi' ),
[134] Fix | Delete
'computed_affects' => array(
[135] Fix | Delete
'__lottie',
[136] Fix | Delete
),
[137] Fix | Delete
),*/
[138] Fix | Delete
'lottie_delay' => array(
[139] Fix | Delete
'label' => esc_html__( 'Delay', 'dsm-supreme-modules-for-divi' ),
[140] Fix | Delete
'type' => 'range',
[141] Fix | Delete
'option_category' => 'configuration',
[142] Fix | Delete
'default_on_front' => '0ms',
[143] Fix | Delete
'validate_unit' => true,
[144] Fix | Delete
'allowed_units' => array( 'ms' ),
[145] Fix | Delete
'description' => esc_html__( 'Delay the lottie animation (in ms).', 'dsm-supreme-modules-for-divi' ),
[146] Fix | Delete
'range_settings' => array(
[147] Fix | Delete
'min' => '0',
[148] Fix | Delete
'max' => '8000',
[149] Fix | Delete
'step' => '1',
[150] Fix | Delete
),
[151] Fix | Delete
'computed_affects' => array(
[152] Fix | Delete
'__lottie',
[153] Fix | Delete
),
[154] Fix | Delete
),
[155] Fix | Delete
'lottie_direction' => array(
[156] Fix | Delete
'label' => esc_html__( 'Direction', 'dsm-supreme-modules-for-divi' ),
[157] Fix | Delete
'type' => 'select',
[158] Fix | Delete
'option_category' => 'layout',
[159] Fix | Delete
'options' => array(
[160] Fix | Delete
'1' => esc_html__( 'Normal', 'dsm-supreme-modules-for-divi' ),
[161] Fix | Delete
'-1' => esc_html__( 'Reverse', 'dsm-supreme-modules-for-divi' ),
[162] Fix | Delete
),
[163] Fix | Delete
'default_on_front' => '1',
[164] Fix | Delete
'computed_affects' => array(
[165] Fix | Delete
'__lottie',
[166] Fix | Delete
),
[167] Fix | Delete
),
[168] Fix | Delete
'lottie_speed' => array(
[169] Fix | Delete
'label' => esc_html__( 'Speed (More is faster)', 'dsm-supreme-modules-for-divi' ),
[170] Fix | Delete
'type' => 'range',
[171] Fix | Delete
'option_category' => 'configuration',
[172] Fix | Delete
'default_on_front' => '1',
[173] Fix | Delete
'validate_unit' => false,
[174] Fix | Delete
'unitless' => true,
[175] Fix | Delete
'description' => esc_html__( 'The speed of the animation.', 'dsm-supreme-modules-for-divi' ),
[176] Fix | Delete
'range_settings' => array(
[177] Fix | Delete
'min' => '0.1',
[178] Fix | Delete
'max' => '2.5',
[179] Fix | Delete
'step' => '0.1',
[180] Fix | Delete
),
[181] Fix | Delete
'computed_affects' => array(
[182] Fix | Delete
'__lottie',
[183] Fix | Delete
),
[184] Fix | Delete
),
[185] Fix | Delete
'lottie_play_on_hover' => array(
[186] Fix | Delete
'label' => esc_html__( 'Trigger', 'dsm-supreme-modules-for-divi' ),
[187] Fix | Delete
'type' => 'yes_no_button',
[188] Fix | Delete
'option_category' => 'configuration',
[189] Fix | Delete
'options' => array(
[190] Fix | Delete
'off' => esc_html__( 'No', 'dsm-supreme-modules-for-divi' ),
[191] Fix | Delete
'on' => esc_html__( 'Yes', 'dsm-supreme-modules-for-divi' ),
[192] Fix | Delete
),
[193] Fix | Delete
'default_on_front' => 'off',
[194] Fix | Delete
'description' => esc_html__( 'Here you can choose whether or not your Lottie will animate on hover.', 'dsm-supreme-modules-for-divi' ),
[195] Fix | Delete
'computed_affects' => array(
[196] Fix | Delete
'__lottie',
[197] Fix | Delete
),
[198] Fix | Delete
),
[199] Fix | Delete
'lottie_trigger_method' => array(
[200] Fix | Delete
'label' => esc_html__( 'Trigger Method', 'dsm-supreme-modules-for-divi' ),
[201] Fix | Delete
'type' => 'select',
[202] Fix | Delete
'option_category' => 'layout',
[203] Fix | Delete
'options' => array(
[204] Fix | Delete
'on_hover' => esc_html__( 'Play Animation On Hover/Mouse Over', 'dsm-supreme-modules-for-divi' ),
[205] Fix | Delete
'on_click' => esc_html__( 'Play Animation On Click', 'dsm-supreme-modules-for-divi' ),
[206] Fix | Delete
'on_scroll' => esc_html__( 'Play Animation On Scroll', 'dsm-supreme-modules-for-divi' ),
[207] Fix | Delete
),
[208] Fix | Delete
'default_on_front' => 'on_hover',
[209] Fix | Delete
'show_if' => array(
[210] Fix | Delete
'lottie_play_on_hover' => 'on',
[211] Fix | Delete
),
[212] Fix | Delete
'computed_affects' => array(
[213] Fix | Delete
'__lottie',
[214] Fix | Delete
),
[215] Fix | Delete
),
[216] Fix | Delete
'lottie_scroll' => array(
[217] Fix | Delete
'label' => esc_html__( 'Relative To', 'dsm-supreme-modules-for-divi' ),
[218] Fix | Delete
'type' => 'select',
[219] Fix | Delete
'option_category' => 'layout',
[220] Fix | Delete
'options' => array(
[221] Fix | Delete
'page' => esc_html__( 'Entire Page', 'dsm-supreme-modules-for-divi' ),
[222] Fix | Delete
'row' => esc_html__( 'Within This Section/Row', 'dsm-supreme-modules-for-divi' ),
[223] Fix | Delete
),
[224] Fix | Delete
'default_on_front' => 'on_hover',
[225] Fix | Delete
'show_if' => array(
[226] Fix | Delete
'lottie_play_on_hover' => 'on',
[227] Fix | Delete
'lottie_trigger_method' => 'on_scroll',
[228] Fix | Delete
),
[229] Fix | Delete
'computed_affects' => array(
[230] Fix | Delete
'__lottie',
[231] Fix | Delete
),
[232] Fix | Delete
),
[233] Fix | Delete
'lottie_mouseout_action' => array(
[234] Fix | Delete
'label' => esc_html__( 'On Mouseout Action', 'dsm-supreme-modules-for-divi' ),
[235] Fix | Delete
'type' => 'select',
[236] Fix | Delete
'option_category' => 'layout',
[237] Fix | Delete
'options' => array(
[238] Fix | Delete
'no_action' => esc_html__( 'No Action', 'dsm-supreme-modules-for-divi' ),
[239] Fix | Delete
'stop' => esc_html__( 'Stop', 'dsm-supreme-modules-for-divi' ),
[240] Fix | Delete
'pause' => esc_html__( 'Pause', 'dsm-supreme-modules-for-divi' ),
[241] Fix | Delete
'reverse' => esc_html__( 'Reverse', 'dsm-supreme-modules-for-divi' ),
[242] Fix | Delete
),
[243] Fix | Delete
'default_on_front' => 'no_action',
[244] Fix | Delete
'show_if' => array(
[245] Fix | Delete
'lottie_play_on_hover' => 'on',
[246] Fix | Delete
'lottie_trigger_method' => 'on_hover',
[247] Fix | Delete
),
[248] Fix | Delete
'computed_affects' => array(
[249] Fix | Delete
'__lottie',
[250] Fix | Delete
),
[251] Fix | Delete
),
[252] Fix | Delete
'lottie_animation_viewport' => array(
[253] Fix | Delete
'label' => esc_html__( 'Animate in Viewport', 'dsm-supreme-modules-for-divi' ),
[254] Fix | Delete
'description' => esc_html__( 'Animation when the element is in viewport.', 'dsm-supreme-modules-for-divi' ),
[255] Fix | Delete
'type' => 'range',
[256] Fix | Delete
'option_category' => 'layout',
[257] Fix | Delete
'default' => '80%',
[258] Fix | Delete
'default_on_front' => '80%',
[259] Fix | Delete
'unitless' => false,
[260] Fix | Delete
'allow_empty' => false,
[261] Fix | Delete
'range_settings' => array(
[262] Fix | Delete
'min' => '0',
[263] Fix | Delete
'max' => '100',
[264] Fix | Delete
'step' => '1',
[265] Fix | Delete
),
[266] Fix | Delete
'responsive' => false,
[267] Fix | Delete
'mobile_options' => false,
[268] Fix | Delete
'computed_affects' => array(
[269] Fix | Delete
'__lottie',
[270] Fix | Delete
),
[271] Fix | Delete
'show_if' => array(
[272] Fix | Delete
'lottie_play_on_hover' => 'off',
[273] Fix | Delete
),
[274] Fix | Delete
),
[275] Fix | Delete
'__lottie' => array(
[276] Fix | Delete
'type' => 'computed',
[277] Fix | Delete
'computed_callback' => array( 'DSM_Lottie', 'getLottie' ),
[278] Fix | Delete
'computed_depends_on' => array(
[279] Fix | Delete
'lottie_url',
[280] Fix | Delete
'lottie_loop',
[281] Fix | Delete
'loop_no_times',
[282] Fix | Delete
'lottie_delay',
[283] Fix | Delete
'lottie_direction',
[284] Fix | Delete
'lottie_speed',
[285] Fix | Delete
'lottie_play_on_hover',
[286] Fix | Delete
'lottie_trigger_method',
[287] Fix | Delete
'lottie_scroll',
[288] Fix | Delete
'lottie_mouseout_action',
[289] Fix | Delete
'lottie_animation_viewport',
[290] Fix | Delete
),
[291] Fix | Delete
),
[292] Fix | Delete
);
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[296] Fix | Delete
$lottie_url = $this->props['lottie_url'];
[297] Fix | Delete
$lottie_loop = $this->props['lottie_loop'];
[298] Fix | Delete
$loop_no_times = $this->props['loop_no_times'];
[299] Fix | Delete
// $lottie_autoplay = $this->props['lottie_autoplay'];
[300] Fix | Delete
$lottie_delay = $this->props['lottie_delay'];
[301] Fix | Delete
$lottie_direction = $this->props['lottie_direction'];
[302] Fix | Delete
$lottie_speed = $this->props['lottie_speed'];
[303] Fix | Delete
$lottie_play_on_hover = $this->props['lottie_play_on_hover'];
[304] Fix | Delete
$lottie_trigger_method = $this->props['lottie_trigger_method'];
[305] Fix | Delete
$lottie_scroll = $this->props['lottie_scroll'];
[306] Fix | Delete
$lottie_mouseout_action = $this->props['lottie_mouseout_action'];
[307] Fix | Delete
$lottie_animation_viewport = $this->props['lottie_animation_viewport'];
[308] Fix | Delete
[309] Fix | Delete
wp_enqueue_script( 'dsm-lottie-module' );
[310] Fix | Delete
[311] Fix | Delete
$data_attrs = array(
[312] Fix | Delete
'path' => $lottie_url,
[313] Fix | Delete
'loop' => 'off' !== $lottie_loop ? true : false,
[314] Fix | Delete
'loop_no' => $loop_no_times,
[315] Fix | Delete
'delay' => $lottie_delay,
[316] Fix | Delete
'direction' => $lottie_direction,
[317] Fix | Delete
'speed' => $lottie_speed,
[318] Fix | Delete
'hover' => 'off' !== $lottie_play_on_hover ? true : false,
[319] Fix | Delete
'trigger' => $lottie_trigger_method,
[320] Fix | Delete
'scroll' => $lottie_scroll,
[321] Fix | Delete
'mouseout' => $lottie_mouseout_action,
[322] Fix | Delete
'viewport' => $lottie_animation_viewport,
[323] Fix | Delete
);
[324] Fix | Delete
[325] Fix | Delete
// Render module content.
[326] Fix | Delete
$output = sprintf(
[327] Fix | Delete
'<div class="dsm_lottie_wrapper" data-percent-viewport="" data-params=%1$s>
[328] Fix | Delete
</div>',
[329] Fix | Delete
htmlspecialchars( wp_json_encode( $data_attrs ), ENT_QUOTES, 'UTF-8' )
[330] Fix | Delete
);
[331] Fix | Delete
[332] Fix | Delete
if ( isset( get_option( 'dsm_settings_misc' )['dsm_dynamic_assets'] ) && ! empty( get_option( 'dsm_settings_misc' )['dsm_dynamic_assets'] ) && 'on' === get_option( 'dsm_settings_misc' )['dsm_dynamic_assets'] ) {
[333] Fix | Delete
if ( isset( get_option( 'dsm_settings_misc' )['dsm_dynamic_assets_compatibility'] ) && ! empty( get_option( 'dsm_settings_misc' )['dsm_dynamic_assets'] ) && 'on' === get_option( 'dsm_settings_misc' )['dsm_dynamic_assets_compatibility'] ) {
[334] Fix | Delete
wp_enqueue_style( 'dsm-lottie', plugin_dir_url( __DIR__ ) . 'Lottie/style.css', array(), DSM_VERSION, 'all' );
[335] Fix | Delete
} else {
[336] Fix | Delete
add_filter( 'et_global_assets_list', array( $this, 'dsm_load_required_divi_assets' ), 10, 3 );
[337] Fix | Delete
add_filter( 'et_late_global_assets_list', array( $this, 'dsm_load_required_divi_assets' ), 10, 3 );
[338] Fix | Delete
}
[339] Fix | Delete
}
[340] Fix | Delete
[341] Fix | Delete
return $output;
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
/**
[345] Fix | Delete
* Force load global styles.
[346] Fix | Delete
*
[347] Fix | Delete
* @param array $assets_list Current global assets on the list.
[348] Fix | Delete
*
[349] Fix | Delete
* @return array
[350] Fix | Delete
*/
[351] Fix | Delete
public function dsm_load_required_divi_assets( $assets_list, $assets_args, $instance ) {
[352] Fix | Delete
$assets_prefix = et_get_dynamic_assets_path();
[353] Fix | Delete
$all_shortcodes = $instance->get_saved_page_shortcodes();
[354] Fix | Delete
$this->_cpt_suffix = et_builder_should_wrap_styles() && ! et_is_builder_plugin_active() ? '_cpt' : '';
[355] Fix | Delete
[356] Fix | Delete
if ( ! isset( $assets_list['et_jquery_magnific_popup'] ) ) {
[357] Fix | Delete
$assets_list['et_jquery_magnific_popup'] = array(
[358] Fix | Delete
'css' => "{$assets_prefix}/css/magnific_popup.css",
[359] Fix | Delete
);
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
if ( ! isset( $assets_list['et_pb_overlay'] ) ) {
[363] Fix | Delete
$assets_list['et_pb_overlay'] = array(
[364] Fix | Delete
'css' => "{$assets_prefix}/css/overlay{$this->_cpt_suffix}.css",
[365] Fix | Delete
);
[366] Fix | Delete
}
[367] Fix | Delete
[368] Fix | Delete
// Lottie.
[369] Fix | Delete
if ( ! isset( $assets_list['dsm_lottie'] ) ) {
[370] Fix | Delete
$assets_list['dsm_lottie'] = array(
[371] Fix | Delete
'css' => plugin_dir_url( __DIR__ ) . 'Lottie/style.css',
[372] Fix | Delete
);
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
return $assets_list;
[376] Fix | Delete
}
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
new DSM_Lottie();
[380] Fix | Delete
[381] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function