: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
public function setTitle($id, $title) {
if (Str::strlen($title) > $this->sliderTitleLength) {
$title = Str::substr($title, 0, $this->sliderTitleLength);
$this->table->update(array(
public function setThumbnail($id, $thumbnail) {
$this->table->update(array(
'thumbnail' => $thumbnail
public function changeSliderType($sliderID, $targetSliderType) {
$this->table->update(array(
'type' => $targetSliderType
$this->markChanged($sliderID);
public function trash($sliderID, $groupID) {
$relatedGroups = $this->xref->getGroups($sliderID);
if (count($relatedGroups) > 1) {
* Delete the connection between the slider and the group
$this->xref->deleteXref($groupID, $sliderID);
$this->table->update(array(
'slider_status' => 'trash'
$helper = new HelperSliderChanged($this);
$helper->setSliderChanged($sliderID, 1);
$helper->setSliderChanged($groupID, 1);
$slider = $this->get($sliderID);
if ($slider['type'] == 'group') {
$subSliders = $this->xref->getSliders($sliderID, 'published');
foreach ($subSliders as $subSlider) {
if (!$this->xref->isSliderAvailableInAnyGroups($subSlider['slider_id'])) {
$helper->setSliderChanged($subSlider['slider_id'], 1);
public function restore($id) {
$changedSliders = array();
$helper = new HelperSliderChanged($this);
$slider = $this->get($id);
if ($slider['type'] == 'group') {
$subSliders = $this->xref->getSliders($id, 'published');
foreach ($subSliders as $subSlider) {
if (!$this->xref->isSliderAvailableInAnyGroups($subSlider['slider_id'])) {
$changedSliders[] = $subSlider['slider_id'];
$relatedGroups = $this->xref->getGroups($id);
if ($relatedGroups && isset($relatedGroups[0]['group_id']) && $relatedGroups[0]['group_id'] > 0) {
//if a slider was trashed, then it can only be restored to one group
$helper->setSliderChanged($relatedGroups[0]['group_id'], 1);
$this->table->update(array(
'slider_status' => 'published'
if (!empty($changedSliders)) {
foreach ($changedSliders as $sliderID) {
$helper->setSliderChanged($sliderID, 1);
* @return array the IDs of the deleted sliders.
public function deletePermanently($id) {
$slidesModel = new ModelSlides($this);
$slidesModel->deleteBySlider($id);
$deletedSliders = $this->xref->deleteGroup($id);
$this->xref->deleteSlider($id);
$this->table->deleteByPk($id);
AbstractCache::clearGroup(Slider::getCacheId($id));
AbstractCache::clearGroup(AdminSlider::getCacheId($id));
$this->reindexOrdering();
SmartSlider3Info::sliderChanged();
public function trashOrDelete($id, $groupID) {
$relatedGroups = $this->xref->getGroups($id);
if (count($relatedGroups) > 1) {
* Delete the connection between the slider and the group
$this->xref->deleteXref($groupID, $id);
$this->deletePermanently($id);
public function deleteSlides($id) {
$slidesModel = new ModelSlides($this);
$slidesModel->deleteBySlider($id);
public function duplicate($id, $withGroup = true) {
$slider = $this->get($id);
$slider['title'] .= ' - ' . n2_('Copy');
if (Str::strlen($slider['title']) > $this->sliderTitleLength) {
$slider['title'] = Str::substr($slider['title'], 0, $this->sliderTitleLength);
$slider['time'] = date('Y-m-d H:i:s', Platform::getTimestamp());
* Remove alias to prevent override
$this->table->insert($slider);
$newSliderId = $this->table->insertId();
throw new Exception($e->getMessage());
if ($slider['type'] == 'group') {
$subSliders = $this->xref->getSliders($id, 'published');
foreach ($subSliders as $subSlider) {
$newSubSliderID = $this->duplicate($subSlider['slider_id'], false);
$this->xref->add($newSliderId, $newSubSliderID);
$slidesModel = new ModelSlides($this);
foreach ($slidesModel->getAll($id) as $slide) {
$slidesModel->copyTo($slide['id'], true, $newSliderId);
$groups = $this->xref->getGroups($id);
foreach ($groups as $group) {
$this->xref->add($group['group_id'], $newSliderId);
$this->reindexOrdering();
SmartSlider3Info::sliderChanged();
public function markChanged($sliderid) {
$helper = new HelperSliderChanged($this);
$helper->setSliderChanged($sliderid, 1);
public function order($groupID, $ids, $isReverse = false, $orders = array()) {
if (is_array($ids) && count($ids) > 0) {
$ids = array_reverse($ids);
$groupID = intval($groupID);
$orders = array_values($orders);
$order = intval($orders[$i]);
$this->table->update(array(
$this->xref->table->update(array(
public function reindexOrdering() {
$sliders = $this->getAll(0);
foreach ($sliders as $idx => $slider) {
$this->table->update(array(
protected function getMaximalOrderValue() {
$query = "SELECT MAX(ordering) AS ordering FROM " . $this->getTableName() . "";
$result = Database::queryRow($query);
if (isset($result['ordering'])) return $result['ordering'] + 1;