Esempio n. 1
0
$slider->setInitializationDelay(@$_POST['opt-init-delay']);
$slider->setPauseOnMouseOver(@$_POST['opt-pause-mouseover']);
$slider->setShowNextPrev(@$_POST['opt-show-next-prev']);
$slider->setShowNavigation(@$_POST['opt-show-nav']);
$slider->setShowInterval(@$_POST['opt-show-interval']);
$slider->setRestart(@$_POST['opt-restart']);
$slider->setMaxWidth(@$_POST['opt-max-width']);
$slider->setMaxHeight(@$_POST['opt-max-height']);
$slider->setAspectRatio(@$_POST['opt-aspect-ratio']);
$slider->setInitialItem(@$_POST['opt-initial-item']);
/**
 * Here we remove from the DB the items that the client removed from the slider.
 */
if (is_array($_POST['remove'])) {
    foreach ($_POST['remove'] as $id) {
        \CEOS\Slider\SliderItem::removeFromDatabase($id);
    }
}
/**
 * Here we insert the slider items provided by the user, if any, into the slider
 * object. Below we also check if the upload of the slider image has succeed.
 */
if (is_array($_POST['items'])) {
    /**
     * Reorder the items sent by the client so no array boundary violations
     * occur. 
     */
    $newOrder = array();
    foreach ($_POST['items'] as $item) {
        array_push($newOrder, $item);
    }
Esempio n. 2
0
 static function removeFromDatabase($id)
 {
     global $wpdb;
     $itemsDelete = true;
     $slider = new Slider();
     $slider->loadFromDatabase($id);
     foreach ($slider->items as $item) {
         $itemsDelete = $itemsDelete && \CEOS\Slider\SliderItem::removeFromDatabase($item->getID());
     }
     $sql = "DELETE FROM " . \CEOS\Slider\PLUGIN_PREFIX . "sliders WHERE slid_id = %d LIMIT 1";
     return $itemsDelete && $wpdb->query($wpdb->prepare($sql, $id));
 }