function getVimeoThumbnailCallback() { mpslVerifyNonce(); if (isset($_GET['src'])) { $vimeoOEmbedApi = MPSLVimeoOEmbedApi::getInstance(); $thumbnail = $vimeoOEmbedApi->getThumbnail($_GET['src']); if (false === $thumbnail) { $thumbnail = ''; } wp_send_json(array('result' => $thumbnail)); } else { mpslSetError(__('Vimeo video source not setted.', MPSL_TEXTDOMAIN)); } }
public function duplicateSlide($slideId) { global $wpdb; $wpdb->hide_errors(); $db = new MPSliderDB(); $slide = $db->getSlide($slideId, array('slider_id', 'slide_order', 'options', 'layers')); if (is_null($slide)) { mpslSetError(__('Slide ID is not set.', MPSL_TEXTDOMAIN)); } $order = $wpdb->get_var(sprintf("SELECT MAX(slide_order) FROM %s WHERE slider_id=%d", $wpdb->prefix . parent::SLIDES_TABLE, $this->sliderId)); $order = is_null($order) ? 0 : $order + 1; $slide['slide_order'] = $order; $options = json_decode($slide['options'], true); if ($options !== false && isset($options['title'])) { $options['title'] = __('Duplicate of ', MPSL_TEXTDOMAIN) . $options['title']; $slide['options'] = json_encode($options); } $result = $wpdb->insert($wpdb->prefix . parent::SLIDES_TABLE, $slide); if ($result === 'false') { mpslSetError(__('Slide is not duplicated. Error: ', MPSL_TEXTDOMAIN) . $wpdb->last_error); } wp_send_json(array('result' => $result, 'id' => $wpdb->insert_id)); }