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.../Applicat.../Model
File: ModelSlides.php
<?php
[0] Fix | Delete
[1] Fix | Delete
[2] Fix | Delete
namespace Nextend\SmartSlider3\Application\Model;
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
use Nextend\Framework\Data\Data;
[6] Fix | Delete
use Nextend\Framework\Database\Database;
[7] Fix | Delete
use Nextend\Framework\Misc\Base64;
[8] Fix | Delete
use Nextend\Framework\Misc\Str;
[9] Fix | Delete
use Nextend\Framework\Model\AbstractModelTable;
[10] Fix | Delete
use Nextend\Framework\Request\Request;
[11] Fix | Delete
use Nextend\SmartSlider3\Application\Helper\HelperSliderChanged;
[12] Fix | Delete
use Nextend\SmartSlider3\Renderable\Component\AbstractComponent;
[13] Fix | Delete
use Nextend\SmartSlider3\Renderable\Component\ComponentCol;
[14] Fix | Delete
use Nextend\SmartSlider3\Renderable\Component\ComponentContent;
[15] Fix | Delete
use Nextend\SmartSlider3\Renderable\Component\ComponentLayer;
[16] Fix | Delete
use Nextend\SmartSlider3\Renderable\Component\ComponentRow;
[17] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentLayer;
[18] Fix | Delete
use Nextend\SmartSlider3\SlideBuilder\BuilderComponentSlide;
[19] Fix | Delete
use Nextend\SmartSlider3\Slider\Slide;
[20] Fix | Delete
use Nextend\SmartSlider3\Slider\Slider;
[21] Fix | Delete
use Nextend\SmartSlider3\SmartSlider3Info;
[22] Fix | Delete
use Nextend\SmartSlider3Pro\Renderable\Component\ComponentGroup;
[23] Fix | Delete
[24] Fix | Delete
class ModelSlides extends AbstractModelTable {
[25] Fix | Delete
[26] Fix | Delete
protected function createConnectorTable() {
[27] Fix | Delete
[28] Fix | Delete
return Database::getTable('nextend2_smartslider3_slides');
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
public function get($id) {
[32] Fix | Delete
return $this->table->findByPk($id);
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
public function getAll($sliderid = 0, $where = '') {
[36] Fix | Delete
return Database::queryAll('SELECT * FROM ' . $this->getTableName() . ' WHERE slider = ' . $sliderid . ' ' . $where . ' ORDER BY ordering', false, "assoc", null);
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
public function createQuickImage($image, $sliderId) {
[40] Fix | Delete
[41] Fix | Delete
$parameters = array(
[42] Fix | Delete
'background-type' => 'image',
[43] Fix | Delete
'backgroundImage' => $image['image']
[44] Fix | Delete
);
[45] Fix | Delete
[46] Fix | Delete
if (!empty($image['alt'])) {
[47] Fix | Delete
$parameters['backgroundAlt'] = $image['alt'];
[48] Fix | Delete
}
[49] Fix | Delete
[50] Fix | Delete
$slideID = $this->create($sliderId, $image['title'], array(), $image['image'], $parameters, array(
[51] Fix | Delete
'description' => $image['description']
[52] Fix | Delete
));
[53] Fix | Delete
$this->markChanged($sliderId);
[54] Fix | Delete
[55] Fix | Delete
return $slideID;
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
public function createQuickEmptySlide($sliderId) {
[59] Fix | Delete
[60] Fix | Delete
$parameters = array(
[61] Fix | Delete
'background-type' => 'color'
[62] Fix | Delete
);
[63] Fix | Delete
[64] Fix | Delete
$slideID = $this->create($sliderId, 'Slide', array(), '', $parameters);
[65] Fix | Delete
$this->markChanged($sliderId);
[66] Fix | Delete
[67] Fix | Delete
return $slideID;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
public function createQuickStaticOverlay($sliderId) {
[71] Fix | Delete
[72] Fix | Delete
$parameters = array(
[73] Fix | Delete
'static-slide' => 1
[74] Fix | Delete
);
[75] Fix | Delete
[76] Fix | Delete
$slideID = $this->create($sliderId, n2_('Static overlay'), array(), '', $parameters);
[77] Fix | Delete
$this->markChanged($sliderId);
[78] Fix | Delete
[79] Fix | Delete
return $slideID;
[80] Fix | Delete
}
[81] Fix | Delete
[82] Fix | Delete
public function createQuickPost($post, $sliderId) {
[83] Fix | Delete
[84] Fix | Delete
$data = new Data($post);
[85] Fix | Delete
[86] Fix | Delete
$title = $this->removeFourByteChars($data->get('title'));
[87] Fix | Delete
$description = $this->removeFourByteChars($data->get('description'));
[88] Fix | Delete
[89] Fix | Delete
$slideBuilder = new BuilderComponentSlide(array(
[90] Fix | Delete
'title' => $title,
[91] Fix | Delete
'description' => $description,
[92] Fix | Delete
'thumbnail' => $data->get('image'),
[93] Fix | Delete
'background-type' => 'image',
[94] Fix | Delete
'backgroundImage' => $data->get('image'),
[95] Fix | Delete
'backgroundImageOpacity' => 20,
[96] Fix | Delete
'backgroundColor' => '000000FF'
[97] Fix | Delete
));
[98] Fix | Delete
[99] Fix | Delete
$slideBuilder->content->set(array(
[100] Fix | Delete
'desktopportraitpadding' => '10|*|100|*|10|*|100|*|px',
[101] Fix | Delete
'mobileportraitpadding' => '10|*|10|*|10|*|10|*|px'
[102] Fix | Delete
));
[103] Fix | Delete
[104] Fix | Delete
if ($title) {
[105] Fix | Delete
$heading = new BuilderComponentLayer($slideBuilder->content, 'heading');
[106] Fix | Delete
$heading->item->set(array(
[107] Fix | Delete
'heading' => '{name/slide}',
[108] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"48||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[109] Fix | Delete
));
[110] Fix | Delete
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
if ($description) {
[114] Fix | Delete
$text = new BuilderComponentLayer($slideBuilder->content, 'text');
[115] Fix | Delete
$text->set(array(
[116] Fix | Delete
'desktopportraitmargin' => '0|*|0|*|20|*|0|*|px',
[117] Fix | Delete
));
[118] Fix | Delete
$text->item->set(array(
[119] Fix | Delete
'content' => '{description/slide}',
[120] Fix | Delete
'font' => Base64::encode('{"data":[{"extra":"","color":"ffffffff","size":"18||px","tshadow":"0|*|0|*|0|*|000000ff","afont":"Roboto,Arial","lineheight":"1.5","bold":0,"italic":0,"underline":0,"align":"inherit","letterspacing":"normal","wordspacing":"normal","texttransform":"none"},{"extra":""}]}'),
[121] Fix | Delete
));
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
$link = $data->get('link');
[125] Fix | Delete
if (!empty($link)) {
[126] Fix | Delete
$buttonLayer = new BuilderComponentLayer($slideBuilder->content, 'button');
[127] Fix | Delete
$buttonLayer->item->set(array(
[128] Fix | Delete
'content' => n2_('Read more'),
[129] Fix | Delete
'link' => $link . '|*|_self'
[130] Fix | Delete
));
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
$row = $this->convertSlideDataToDatabaseRow($slideBuilder->getData(), $sliderId);
[134] Fix | Delete
[135] Fix | Delete
$slideID = $this->create($row['slider'], $row['title'], $row['slide'], $row['thumbnail'], $row['params'], array(
[136] Fix | Delete
'description' => $row['description'],
[137] Fix | Delete
'published' => $row['published'],
[138] Fix | Delete
'publish_up' => $row['publish_up'],
[139] Fix | Delete
'publish_down' => $row['publish_down']
[140] Fix | Delete
));
[141] Fix | Delete
[142] Fix | Delete
$this->markChanged($sliderId);
[143] Fix | Delete
[144] Fix | Delete
return $slideID;
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
public function createSimpleEditAdd($postData, $sliderId) {
[148] Fix | Delete
[149] Fix | Delete
$data = new Data($postData);
[150] Fix | Delete
[151] Fix | Delete
$title = $data->get('title', '');
[152] Fix | Delete
$description = $data->get('description', '');
[153] Fix | Delete
[154] Fix | Delete
$slideBuilder = new BuilderComponentSlide(array(
[155] Fix | Delete
'title' => $title,
[156] Fix | Delete
'description' => $description,
[157] Fix | Delete
'thumbnailType' => $data->get('thumbnailType', ''),
[158] Fix | Delete
'thumbnail' => $data->get('backgroundImage', ''),
[159] Fix | Delete
'background-type' => 'image',
[160] Fix | Delete
'backgroundImage' => $data->get('backgroundImage', ''),
[161] Fix | Delete
'backgroundImageOpacity' => 100,
[162] Fix | Delete
'backgroundColor' => '000000FF',
[163] Fix | Delete
'href' => $data->get('href', ''),
[164] Fix | Delete
'href-target' => $data->get('href-target', '')
[165] Fix | Delete
));
[166] Fix | Delete
[167] Fix | Delete
$slideBuilder->content->set(array(
[168] Fix | Delete
'desktopportraitpadding' => '10|*|100|*|10|*|100|*|px',
[169] Fix | Delete
'mobileportraitpadding' => '10|*|10|*|10|*|10|*|px'
[170] Fix | Delete
));
[171] Fix | Delete
[172] Fix | Delete
$videoUrl = $data->get('video', '');
[173] Fix | Delete
[174] Fix | Delete
if (!empty($videoUrl)) {
[175] Fix | Delete
preg_match('/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/', $videoUrl, $matches);
[176] Fix | Delete
[177] Fix | Delete
if (!empty($matches)) {
[178] Fix | Delete
/**
[179] Fix | Delete
* YouTube
[180] Fix | Delete
*/
[181] Fix | Delete
$thumbnail = 'https://i.ytimg.com/vi/' . $matches[2] . '/hqdefault.jpg';
[182] Fix | Delete
$slideBuilder->set('thumbnail', $thumbnail);
[183] Fix | Delete
[184] Fix | Delete
[185] Fix | Delete
$youtubeLayer = new BuilderComponentLayer($slideBuilder->content, 'youtube');
[186] Fix | Delete
$youtubeLayer->item->set(array(
[187] Fix | Delete
'code' => $matches[2],
[188] Fix | Delete
'youtubeurl' => $videoUrl,
[189] Fix | Delete
'image' => $thumbnail
[190] Fix | Delete
));
[191] Fix | Delete
} else {
[192] Fix | Delete
[193] Fix | Delete
preg_match('/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/', $videoUrl, $matches);
[194] Fix | Delete
if (!empty($matches)) {
[195] Fix | Delete
/**
[196] Fix | Delete
* Vimeo
[197] Fix | Delete
*/
[198] Fix | Delete
[199] Fix | Delete
$vimeoLayer = new BuilderComponentLayer($slideBuilder->content, 'vimeo');
[200] Fix | Delete
$vimeoLayer->item->set(array(
[201] Fix | Delete
'vimeourl' => $videoUrl
[202] Fix | Delete
));
[203] Fix | Delete
} else {
[204] Fix | Delete
/**
[205] Fix | Delete
* MP4
[206] Fix | Delete
*/
[207] Fix | Delete
[208] Fix | Delete
$mp4Layer = new BuilderComponentLayer($slideBuilder->content, 'video');
[209] Fix | Delete
$mp4Layer->item->set(array(
[210] Fix | Delete
'video_mp4' => $videoUrl
[211] Fix | Delete
));
[212] Fix | Delete
}
[213] Fix | Delete
}
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
/*
[217] Fix | Delete
if ($title) {
[218] Fix | Delete
$heading = new BuilderComponentLayer($slideBuilder->content, 'heading');
[219] Fix | Delete
$heading->item->set(array(
[220] Fix | Delete
'heading' => '{name/slide}'
[221] Fix | Delete
));
[222] Fix | Delete
}
[223] Fix | Delete
*/
[224] Fix | Delete
[225] Fix | Delete
$row = $this->convertSlideDataToDatabaseRow($slideBuilder->getData(), $sliderId);
[226] Fix | Delete
[227] Fix | Delete
$slideID = $this->create($row['slider'], $row['title'], $row['slide'], $row['thumbnail'], $row['params'], array(
[228] Fix | Delete
'description' => $row['description'],
[229] Fix | Delete
'published' => $row['published'],
[230] Fix | Delete
'publish_up' => $row['publish_up'],
[231] Fix | Delete
'publish_down' => $row['publish_down']
[232] Fix | Delete
));
[233] Fix | Delete
[234] Fix | Delete
$this->markChanged($sliderId);
[235] Fix | Delete
[236] Fix | Delete
return $slideID;
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
public function import($row, $sliderId) {
[240] Fix | Delete
[241] Fix | Delete
if (!$row['params']->has('version')) {
[242] Fix | Delete
/**
[243] Fix | Delete
* We must set the missing empty version to allow upgrade of the old slides
[244] Fix | Delete
*/
[245] Fix | Delete
$row['params']->set('version', '');
[246] Fix | Delete
}
[247] Fix | Delete
[248] Fix | Delete
return $this->create($sliderId, $row['title'], $row['slide'], $row['thumbnail'], $row['params']->toArray(), array(
[249] Fix | Delete
'description' => $row['description'],
[250] Fix | Delete
'published' => $row['published'],
[251] Fix | Delete
'publish_up' => $row['publish_up'],
[252] Fix | Delete
'publish_down' => $row['publish_down'],
[253] Fix | Delete
'first' => $row['first'],
[254] Fix | Delete
'ordering' => $row['ordering'],
[255] Fix | Delete
'generator_id' => $row['generator_id']
[256] Fix | Delete
));
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
private function create($sliderID, $title, $layers, $thumbnail, $params = array(), $optional = array()) {
[260] Fix | Delete
[261] Fix | Delete
if (!isset($optional['ordering'])) {
[262] Fix | Delete
$optional['ordering'] = $this->getNextOrdering($sliderID);
[263] Fix | Delete
}
[264] Fix | Delete
[265] Fix | Delete
if (!isset($params['version'])) {
[266] Fix | Delete
$params['version'] = SmartSlider3Info::$version;
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
$data = array_merge(array(
[270] Fix | Delete
'description' => '',
[271] Fix | Delete
'first' => 0,
[272] Fix | Delete
'published' => 1,
[273] Fix | Delete
'publish_up' => '1970-01-01 00:00:00',
[274] Fix | Delete
'publish_down' => '1970-01-01 00:00:00',
[275] Fix | Delete
'generator_id' => 0
[276] Fix | Delete
), $optional, array(
[277] Fix | Delete
'title' => $title,
[278] Fix | Delete
'slide' => json_encode($layers, JSON_UNESCAPED_SLASHES),
[279] Fix | Delete
'thumbnail' => $thumbnail,
[280] Fix | Delete
'params' => json_encode($params, JSON_UNESCAPED_SLASHES),
[281] Fix | Delete
'slider' => $sliderID
[282] Fix | Delete
));
[283] Fix | Delete
[284] Fix | Delete
$this->table->insert($data);
[285] Fix | Delete
[286] Fix | Delete
return $this->table->insertId();
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
/**
[290] Fix | Delete
* @param $sliderId
[291] Fix | Delete
* @param int $generatorID
[292] Fix | Delete
* @param $slide
[293] Fix | Delete
*
[294] Fix | Delete
* @return bool
[295] Fix | Delete
*/
[296] Fix | Delete
public function createSlideWithGenerator($sliderId, $generatorID, $slide) {
[297] Fix | Delete
[298] Fix | Delete
$row = $this->convertSlideDataToDatabaseRow($slide, $sliderId);
[299] Fix | Delete
[300] Fix | Delete
$slideId = $this->create($row['slider'], $row['title'], $row['slide'], $row['thumbnail'], $row['params'], array(
[301] Fix | Delete
'description' => $row['description'],
[302] Fix | Delete
'published' => $row['published'],
[303] Fix | Delete
'publish_up' => $row['publish_up'],
[304] Fix | Delete
'publish_down' => $row['publish_down'],
[305] Fix | Delete
'generator_id' => $generatorID
[306] Fix | Delete
));
[307] Fix | Delete
[308] Fix | Delete
$this->markChanged($sliderId);
[309] Fix | Delete
[310] Fix | Delete
return $slideId;
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* @param int $slideID
[315] Fix | Delete
* @param string $slide
[316] Fix | Delete
* @param string $guides
[317] Fix | Delete
*
[318] Fix | Delete
* @return bool
[319] Fix | Delete
*/
[320] Fix | Delete
public function save($slideID, $slide, $guides) {
[321] Fix | Delete
[322] Fix | Delete
$slideData = json_decode(Base64::decode($slide), true);
[323] Fix | Delete
$slideData['guides'] = $guides;
[324] Fix | Delete
[325] Fix | Delete
$row = $this->convertSlideDataToDatabaseRow($slideData);
[326] Fix | Delete
[327] Fix | Delete
$this->table->update(array(
[328] Fix | Delete
'title' => $row['title'],
[329] Fix | Delete
'slide' => json_encode($row['slide'], JSON_UNESCAPED_SLASHES),
[330] Fix | Delete
'description' => $row['description'],
[331] Fix | Delete
'thumbnail' => $row['thumbnail'],
[332] Fix | Delete
'published' => $row['published'],
[333] Fix | Delete
'publish_up' => $row['publish_up'],
[334] Fix | Delete
'publish_down' => $row['publish_down'],
[335] Fix | Delete
'params' => json_encode($row['params'], JSON_UNESCAPED_SLASHES)
[336] Fix | Delete
), array('id' => $slideID));
[337] Fix | Delete
[338] Fix | Delete
$this->markChanged(Request::$REQUEST->getInt('sliderid'));
[339] Fix | Delete
[340] Fix | Delete
return true;
[341] Fix | Delete
}
[342] Fix | Delete
[343] Fix | Delete
public function saveSimple($slideID, $title, $description, $params) {
[344] Fix | Delete
[345] Fix | Delete
$this->table->update(array(
[346] Fix | Delete
'title' => $title,
[347] Fix | Delete
'description' => $description,
[348] Fix | Delete
'params' => json_encode($params, JSON_UNESCAPED_SLASHES)
[349] Fix | Delete
), array('id' => $slideID));
[350] Fix | Delete
}
[351] Fix | Delete
[352] Fix | Delete
/**
[353] Fix | Delete
* Updates the params field of the slide;
[354] Fix | Delete
*
[355] Fix | Delete
* @param $id
[356] Fix | Delete
* @param $params
[357] Fix | Delete
*/
[358] Fix | Delete
public function updateSlideParams($id, $params) {
[359] Fix | Delete
[360] Fix | Delete
$this->table->update(array(
[361] Fix | Delete
'params' => json_encode($params)
[362] Fix | Delete
), array('id' => $id));
[363] Fix | Delete
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
public function delete($id) {
[367] Fix | Delete
[368] Fix | Delete
$slide = $this->get($id);
[369] Fix | Delete
[370] Fix | Delete
if ($slide['generator_id'] > 0) {
[371] Fix | Delete
$slidesWithSameGenerator = $this->getAll($slide['slider'], 'AND generator_id = ' . intval($slide['generator_id']));
[372] Fix | Delete
if (count($slidesWithSameGenerator) == 1) {
[373] Fix | Delete
$generatorModel = new ModelGenerator($this);
[374] Fix | Delete
$generatorModel->delete($slide['generator_id']);
[375] Fix | Delete
}
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
$this->table->deleteByAttributes(array(
[379] Fix | Delete
"id" => intval($id)
[380] Fix | Delete
));
[381] Fix | Delete
[382] Fix | Delete
$this->markChanged($slide['slider']);
[383] Fix | Delete
[384] Fix | Delete
}
[385] Fix | Delete
[386] Fix | Delete
/**
[387] Fix | Delete
* @param int $id
[388] Fix | Delete
* @param bool $maintainOrdering
[389] Fix | Delete
* @param bool|int $targetSliderId
[390] Fix | Delete
*
[391] Fix | Delete
* @return int The new slide ID;
[392] Fix | Delete
*/
[393] Fix | Delete
public function copyTo($id, $maintainOrdering = false, $targetSliderId = false) {
[394] Fix | Delete
$row = $this->get($id);
[395] Fix | Delete
unset($row['id']);
[396] Fix | Delete
[397] Fix | Delete
$row['first'] = 0;
[398] Fix | Delete
[399] Fix | Delete
if ($targetSliderId === false || $row['slider'] == $targetSliderId) {
[400] Fix | Delete
/**
[401] Fix | Delete
* Copy the slide to the same slider
[402] Fix | Delete
*/
[403] Fix | Delete
[404] Fix | Delete
$this->shiftSlideOrdering($row['slider'], $row['ordering']);
[405] Fix | Delete
} else {
[406] Fix | Delete
/**
[407] Fix | Delete
* Copy the slide to another slider
[408] Fix | Delete
*/
[409] Fix | Delete
$row['slider'] = $targetSliderId;
[410] Fix | Delete
[411] Fix | Delete
if (!$maintainOrdering) {
[412] Fix | Delete
$row['ordering'] = 0;
[413] Fix | Delete
}
[414] Fix | Delete
}
[415] Fix | Delete
[416] Fix | Delete
if (!empty($row['generator_id'])) {
[417] Fix | Delete
$generatorModel = new ModelGenerator($this);
[418] Fix | Delete
$row['generator_id'] = $generatorModel->duplicate($row['generator_id']);
[419] Fix | Delete
}
[420] Fix | Delete
[421] Fix | Delete
$row['slide'] = json_encode(AbstractComponent::translateUniqueIdentifier(json_decode($row['slide'], true)), JSON_UNESCAPED_SLASHES);
[422] Fix | Delete
[423] Fix | Delete
$this->table->insert($row);
[424] Fix | Delete
[425] Fix | Delete
$id = $this->table->insertId();
[426] Fix | Delete
[427] Fix | Delete
$this->markChanged($row['slider']);
[428] Fix | Delete
[429] Fix | Delete
return $id;
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
public function setTitle($id, $title) {
[433] Fix | Delete
$slide = $this->get($id);
[434] Fix | Delete
[435] Fix | Delete
$this->table->update(array(
[436] Fix | Delete
"title" => $title
[437] Fix | Delete
), array(
[438] Fix | Delete
"id" => $id
[439] Fix | Delete
));
[440] Fix | Delete
[441] Fix | Delete
$this->markChanged($slide['slider']);
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
public function first($id) {
[445] Fix | Delete
$slide = $this->get($id);
[446] Fix | Delete
[447] Fix | Delete
$this->table->update(array(
[448] Fix | Delete
"first" => 0
[449] Fix | Delete
), array(
[450] Fix | Delete
"slider" => $slide['slider']
[451] Fix | Delete
));
[452] Fix | Delete
[453] Fix | Delete
$this->table->update(array(
[454] Fix | Delete
"first" => 1
[455] Fix | Delete
), array(
[456] Fix | Delete
"id" => $id
[457] Fix | Delete
));
[458] Fix | Delete
[459] Fix | Delete
$this->markChanged($slide['slider']);
[460] Fix | Delete
}
[461] Fix | Delete
[462] Fix | Delete
public function publish($id) {
[463] Fix | Delete
[464] Fix | Delete
$this->markChanged(Request::$REQUEST->getInt('sliderid'));
[465] Fix | Delete
[466] Fix | Delete
return $this->table->update(array(
[467] Fix | Delete
"published" => 1
[468] Fix | Delete
), array("id" => intval($id)));
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
public function unPublish($id) {
[472] Fix | Delete
$this->table->update(array(
[473] Fix | Delete
"published" => 0
[474] Fix | Delete
), array(
[475] Fix | Delete
"id" => intval($id)
[476] Fix | Delete
));
[477] Fix | Delete
[478] Fix | Delete
$this->markChanged(Request::$REQUEST->getInt('sliderid'));
[479] Fix | Delete
[480] Fix | Delete
}
[481] Fix | Delete
[482] Fix | Delete
public function convertToSlide($id) {
[483] Fix | Delete
$slide = $this->get($id);
[484] Fix | Delete
[485] Fix | Delete
$data = new Data($slide['params'], true);
[486] Fix | Delete
$data->set('static-slide', 0);
[487] Fix | Delete
[488] Fix | Delete
$this->table->update(array(
[489] Fix | Delete
"params" => $data->toJSON()
[490] Fix | Delete
), array(
[491] Fix | Delete
"id" => intval($id)
[492] Fix | Delete
));
[493] Fix | Delete
[494] Fix | Delete
$this->markChanged($slide['slider']);
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
public function deleteBySlider($sliderid) {
[498] Fix | Delete
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function