/**
  * Remove record in database
  * @return bool
  */
 protected function _delete()
 {
     $oFlexSliderSlider = new FlexSliderSlider($this->_iId);
     $mStatus = $oFlexSliderSlider->delete();
     //$this -> _removeSlides($this -> _iId);
     $this->_aRedirect['id'] = false;
     $this->_aRedirect['action'] = false;
     if (is_string($mStatus)) {
         $this->_aRedirect['message'] = $mStatus;
     } else {
         if ($mStatus === true) {
             $this->_aRedirect['message'] = 'removed';
         } else {
             $this->_aRedirect['message'] = 'error';
         }
     }
     return true;
 }
Esempio n. 2
0
function ts_flexslider_func($atts, $content = null)
{
    extract(shortcode_atts(array("id" => ""), $atts));
    if (!(int) $id) {
        return '';
    }
    require_once get_template_directory() . '/framework/class/FlexSliderSlider.class.php';
    require_once get_template_directory() . '/framework/class/FlexSliderSlide.class.php';
    $oSlider = new FlexSliderSlider($id);
    $oRecord = $oSlider->get();
    if ($oRecord === false) {
        return '';
    }
    $oSlides = new FlexSliderSlide();
    $aSlides = $oSlides->getSliderSlides($id);
    if (is_array($aSlides) && count($aSlides) > 0) {
        require_once get_template_directory() . '/framework/class/freshizer.php';
        foreach ($aSlides as $oSlide) {
            $image = ts_get_resized_image_by_size($oSlide->image, 'slider');
            $content .= '<li>' . $image . '</li>';
        }
    }
    $rand = $id . '-' . rand(1, 5000);
    $animation = 'slide';
    if (in_array($oRecord->animation, array('slide', 'fade'))) {
        $animation = $oRecord->animation;
    }
    $direction = 'horizontal';
    if (in_array($oRecord->direction, array('horizontal', 'vertical'))) {
        $direction = $oRecord->direction;
    }
    $slideshow_speed = 100;
    if ((int) $oRecord->slideshow_speed > 100) {
        $slideshow_speed = $oRecord->slideshow_speed;
    }
    $animation_speed = 100;
    if ((int) $oRecord->animation_speed > 100) {
        $animation_speed = $oRecord->animation_speed;
    }
    $reverse = false;
    if ((int) $oRecord->reverse == 1) {
        $reverse = true;
    }
    $randomize = false;
    if ((int) $oRecord->randomize == 1) {
        $randomize = true;
    }
    $controlNav = true;
    if ((int) $oRecord->control_nav == 0) {
        $controlNav = false;
    }
    $directionNav = true;
    if ((int) $oRecord->direction_nav == 0) {
        $directionNav = false;
    }
    $before = "";
    $after = "";
    if (!empty($oRecord->background)) {
        $before = "<div class='slider-background' style='background: url(" . $oRecord->background . ");'>";
        $after = "</div>";
    }
    $content = $before . "\n\t\t<div class='flexslider images-slider' id='flexslider-" . $rand . "'>\n\t\t\t<ul class='slides'>" . do_shortcode(shortcode_unautop($content)) . "</ul>\n\t\t</div>" . $after;
    $content .= "\n\t\t<script type='text/javascript'>\n\t\t\tjQuery(document).ready(function() {\n\t\t\t  jQuery('#flexslider-" . $rand . "').flexslider({\n\t\t\t\tanimation: '" . $animation . "',\n\t\t\t\tdirection: '" . $direction . "',\n\t\t\t\tslideshowSpeed: " . $slideshow_speed . ",\n\t\t\t\tanimationSpeed: " . $animation_speed . ",\n\t\t\t\tcontrolNav: " . (int) $controlNav . ",\n\t\t\t\tdirectionNav: " . (int) $directionNav . ",\n\t\t\t\treverse: " . (int) $reverse . ",\n\t\t\t\trandomize: " . (int) $randomize . ",\n\t\t\t\tprevText: \"" . ts_get_prev_slider_text() . "\",\n\t\t\t\tnextText: \"" . ts_get_next_slider_text() . "\"\n\t\t\t  });\n\t\t\t});\n\t\t</script>";
    // Restor original Query & Post Data
    wp_reset_query();
    wp_reset_postdata();
    return $content;
}