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/smart-sl.../Nextend/SmartSli.../Widget/Group
File: Autoplay.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Nextend\SmartSlider3\Widget\Group;
[2] Fix | Delete
[3] Fix | Delete
use Nextend\Framework\Data\Data;
[4] Fix | Delete
use Nextend\Framework\Form\Container\ContainerTable;
[5] Fix | Delete
use Nextend\Framework\Form\Element\OnOff;
[6] Fix | Delete
use Nextend\Framework\Form\Element\Text;
[7] Fix | Delete
use Nextend\Framework\Parser\Common;
[8] Fix | Delete
use Nextend\Framework\Pattern\PluggableTrait;
[9] Fix | Delete
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
[10] Fix | Delete
use Nextend\SmartSlider3\Widget\Autoplay\AutoplayImage\AutoplayImage;
[11] Fix | Delete
[12] Fix | Delete
class Autoplay extends AbstractWidgetGroup {
[13] Fix | Delete
[14] Fix | Delete
use PluggableTrait;
[15] Fix | Delete
[16] Fix | Delete
public $ordering = 3;
[17] Fix | Delete
[18] Fix | Delete
protected $showOnMobileDefault = 1;
[19] Fix | Delete
[20] Fix | Delete
public function __construct() {
[21] Fix | Delete
parent::__construct();
[22] Fix | Delete
[23] Fix | Delete
new AutoplayImage($this, 'image');
[24] Fix | Delete
[25] Fix | Delete
$this->makePluggable('SliderWidgetAutoplay');
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
public function getName() {
[29] Fix | Delete
return 'autoplay';
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
public function getLabel() {
[33] Fix | Delete
return n2_('Autoplay');
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
public function renderFields($container) {
[37] Fix | Delete
[38] Fix | Delete
$form = $container->getForm();
[39] Fix | Delete
[40] Fix | Delete
$this->compatibility($form);
[41] Fix | Delete
[42] Fix | Delete
$autoplayFinish = $form->get('autoplayfinish');
[43] Fix | Delete
if (!$form->has('autoplayLoop') && !empty($autoplayFinish)) {
[44] Fix | Delete
$this->upgradeData($form);
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
$table = new ContainerTable($container, 'widget-autoplay', n2_('Button'));
[48] Fix | Delete
[49] Fix | Delete
new OnOff($table->getFieldsetLabel(), 'widget-autoplay-enabled', false, 0, array(
[50] Fix | Delete
'relatedFieldsOn' => array(
[51] Fix | Delete
'table-rows-widget-autoplay'
[52] Fix | Delete
)
[53] Fix | Delete
));
[54] Fix | Delete
[55] Fix | Delete
$row1 = $table->createRow('widget-bullet-1');
[56] Fix | Delete
[57] Fix | Delete
$url = $form->createAjaxUrl(array("slider/renderwidgetautoplay"));
[58] Fix | Delete
new ControlTypePicker($row1, 'widgetautoplay', $table, $url, $this, 'image');
[59] Fix | Delete
[60] Fix | Delete
[61] Fix | Delete
$row2 = $table->createRow('widget-bullet-2');
[62] Fix | Delete
[63] Fix | Delete
new OnOff($row2, 'widget-autoplay-display-hover', n2_('Shows on hover'), 0);
[64] Fix | Delete
[65] Fix | Delete
$this->addHideOnFeature('widget-autoplay-display-', $row2);
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
[69] Fix | Delete
/**
[70] Fix | Delete
* For compatibility with legacy autoplay values.
[71] Fix | Delete
*
[72] Fix | Delete
* @param Data $data
[73] Fix | Delete
*/
[74] Fix | Delete
protected function upgradeData($data) {
[75] Fix | Delete
if (!$data->has('autoplayLoop')) {
[76] Fix | Delete
list($interval, $intervalModifier, $intervalSlide) = (array)Common::parse($data->get('autoplayfinish', '1|*|loop|*|current'));
[77] Fix | Delete
if ($interval <= 0) {
[78] Fix | Delete
// 0|*|slide|*|current -> In old versions it brought to the Next slide.
[79] Fix | Delete
if ($interval <= 0 && $intervalModifier === 'slide' && $intervalSlide === 'next') {
[80] Fix | Delete
$data->set('autoplayfinish', '1|*|slide|*|current');
[81] Fix | Delete
$data->set('autoplayLoop', 0);
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
// 0|*|loop/slide/slideindex|*|current -> Infinite loop
[85] Fix | Delete
// 0|*|loop|*|next -> Infinite loop
[86] Fix | Delete
if ($intervalSlide === 'current' || ($intervalModifier === 'loop' && $intervalSlide === 'next')) {
[87] Fix | Delete
$data->set('autoplayfinish', '1|*|loop|*|current');
[88] Fix | Delete
$data->set('autoplayLoop', 1);
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
// 0|*|slideindex|*|next -> In old versions it always brought to the 2nd slide.
[92] Fix | Delete
if ($intervalModifier === 'slideindex' && $intervalSlide === 'next') {
[93] Fix | Delete
$data->set('autoplayfinish', '2|*|slideindex|*|current');
[94] Fix | Delete
$data->set('autoplayLoop', '0');
[95] Fix | Delete
}
[96] Fix | Delete
} else {
[97] Fix | Delete
//next is not allowed for "slide" and "slideindex" interval modifiers
[98] Fix | Delete
if ($intervalModifier === 'slide' || $intervalModifier === 'slideindex') {
[99] Fix | Delete
$data->set('autoplayfinish', $interval . '|*|' . $intervalModifier . '|*|current');
[100] Fix | Delete
}
[101] Fix | Delete
// turn off Loop, and work with the original settings
[102] Fix | Delete
$data->set('autoplayLoop', '0');
[103] Fix | Delete
}
[104] Fix | Delete
}
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function