Пример #1
0
 /**
  * Fetch the slide collection for a given slideset
  *
  * @uses $_POST['slideset'] Identifies presentation based on slideset ID.
  */
 public function get_slides()
 {
     $slideset_id = intval($_POST['slideset']);
     // $response = array(
     //     'success' => true/false,
     //     'data'    => array(
     //         $child_array_1,
     //         $child_array_2
     //         ...
     //     )
     // }
     $response = array();
     if (0 === $slideset_id) {
         $response['success'] = false;
     } else {
         /** @var SEOSlides_Slideset $slideset */
         $slideset = SEOSlides_Module_Provider::get('SEOSlides Core')->get_slideset($slideset_id);
         $child_data = array();
         // Build an array containing each slide in a separate associative array
         /** @var SEOSlides_Slide $slide */
         foreach ($slideset->slides as $slide) {
             $bg_image = $slide->get_bg_image();
             $bg_id = SEOSlides_Util::get_attachment_id_from_url($bg_image);
             if (false !== $bg_id) {
                 $bg_arr = wp_get_attachment_image_src($bg_id, 'seoslides-thumb');
                 $bg_image = $bg_arr[0];
             }
             $data = array('id' => $slide->ID, 'title' => stripslashes($slide->title), 'content' => $slide->content, 'image' => stripslashes($slide->image), 'bg_image' => $bg_image, 'style' => $slide->style, 'position' => $slide->position, 'preview' => $slide->preview, 'fill_color' => $slide->fill_color, 'seo_title' => $slide->seo_title, 'seo_description' => $slide->seo_description, 'seo_keywords' => $slide->seo_keywords, 'presenter_notes' => wp_trim_words($slide->presenter_notes, 50, ' […]'), 'status' => $slide->status);
             if (isset($data['bg_image']) && function_exists('jetpack_photon_url')) {
                 $data['bg_image'] = jetpack_photon_url($data['bg_image'], array(), '//');
             }
             $oembed = SEOSlides_Slide::get_embed_url($slide->oembed);
             $oembed_thumb = SEOSlides_Slide::get_embed_thumbnail($slide->oembed);
             if (!is_wp_error($oembed) && !is_wp_error($oembed_thumb)) {
                 $data['oembed'] = $oembed;
                 $data['oembed_thumb'] = $oembed_thumb;
             }
             // Build out canvas objects
             $data['objects'] = array_map(array($this, 'sanitize_slide_object'), $slide->objects);
             // Add the object
             $child_data[] = $data;
         }
         $response['success'] = true;
         $response['data'] = $child_data;
     }
     wp_send_json($response);
 }
Пример #2
0
 /**
  * Build out old-style static content
  *
  * @return void
  */
 protected function legacy_content()
 {
     $slide_content = unserialize($this->post->post_content);
     $this->title = isset($slide_content['title']) ? $slide_content['title'] : '';
     $this->content = isset($slide_content['text']) ? $slide_content['text'] : '';
     $this->image = isset($slide_content['image']) ? $slide_content['image'] : '';
     $this->bg_image = isset($slide_content['bg-image']) ? $slide_content['bg-image'] : null;
     $image_id = SEOSlides_Util::get_attachment_id_from_url($this->bg_image);
     if (false !== $image_id) {
         $image_arr = wp_get_attachment_image_src($image_id, 'seoslides-thumb');
         $this->bg_thumb = $image_arr[0];
     }
 }
;">

		<?php 
$slide->render('deck-before', true);
?>

		<div class="extras">
			<a href="<?php 
echo esc_url(SEOSlides_Util::slide_nav_link('previous', $slide));
?>
" class="deck-prev-link" title="<?php 
_e('Previous', 'seoslides_translate');
?>
" rel="previous">&lsaquo;</a>
			<a href="<?php 
echo esc_url(SEOSlides_Util::slide_nav_link('next', $slide));
?>
" class="deck-next-link" title="<?php 
_e('Next', 'seoslides_translate');
?>
" rel="next">&rsaquo;</a>
		</div>

	</article>

	<section id="noprint">
		<p><?php 
printf(__('Presentations are not meant to be printed.<br />Please visit %s to view the slides.', 'seoslides_translate'), get_permalink($slide->slideset));
?>
</p>
	</section>
Пример #4
0
 /**
  * Insert the "Hello World" presentation when the plugin is first installed.
  */
 public function insert_default_presentation()
 {
     $presentation = wp_insert_post(array('post_type' => 'seoslides-slideset', 'post_status' => 'publish', 'post_title' => __('Hello World!', 'seoslides_translate')));
     // Slide notes
     $notes = __('<p>Even if all you are saying is "hello", notes are a great way to add additional SEO rich keywords.</p><p>Oh... and to cover details that are not on the slide.</p><p>Viewers of your presentation can see these notes by clicking the "+" in the lower right corner.</p>', 'seoslides_translate');
     $notes = apply_filters('seoslides_welcome_presentation_notes', $notes);
     // Set up slide defaults
     $defaults = array('fill_color' => '#cccccc', 'bg_image' => SEOSLIDES_URL . 'img/welcome-internal.jpg', 'font' => 'Arial', 'size' => '1.077em', 'color' => '#ffffff', 'header_font' => 'Arial', 'header_size' => '0.705em', 'header-color' => '#f36f21');
     add_post_meta($presentation, 'slide_defaults', $defaults, true);
     // Build out title slide
     $title_slide_title = __('Hello World!', 'seoslodes_translate');
     $title_slide_content = array('title' => $title_slide_title, 'content' => '', 'image' => '', 'bg-image' => SEOSLIDES_URL . 'img/welcome-title.jpg');
     $title_slide = wp_insert_post(array('post_title' => $title_slide_title, 'post_parent' => $presentation, 'post_type' => 'seoslides-slide', 'menu_order' => 0, 'post_status' => 'publish', 'post_content' => serialize($title_slide_content)));
     $title_seo = array('title' => $title_slide_title, 'description' => '', 'keywords' => '');
     update_post_meta($title_slide, 'seoslides_seo_settings', $title_seo);
     $title_headline = array('element_id' => SEOSlides_Util::generate_guid(), 'plugin_id' => '1798dfc0-8695-11e2-9e96-0800200c9a66', 'settings' => array('size' => array('w' => 1500, 'h' => 150), 'position' => array('top' => 295, 'left' => 50), 'content' => '<h1 style="text-align:center"><span style="color:#ffac46"><span style="font-size:1.846em">' . $title_slide_title . '</span></span></h1>'));
     $title_headline = new SEOSlides_CanvasObject($title_headline);
     add_post_meta($title_slide, 'seoslides_canvas_object', $title_headline);
     $title_sub_headline = array('element_id' => SEOSlides_Util::generate_guid(), 'plugin_id' => '1798dfc0-8695-11e2-9e96-0800200c9a66', 'settings' => array('size' => array('w' => 1000, 'h' => 150), 'position' => array('top' => 600, 'left' => 500), 'content' => '<h2 style="text-align:center"><em><span style="color:#ffffff;"><span style="font-size:1.077em">' . __('by the seoslides team', 'seoslides_translate') . '</span></span></em></h2>'));
     $title_sub_headline = new SEOSlides_CanvasObject($title_sub_headline);
     add_post_meta($title_slide, 'seoslides_canvas_object', $title_sub_headline);
     add_post_meta($title_slide, 'seoslides_notes', $notes, true);
     // Build out second slide
     $first_slide_title = __('Welcome to seoslides!');
     $first_slide_content = array('title' => $first_slide_title, 'content' => '', 'image' => '', 'bg-image' => SEOSLIDES_URL . 'img/welcome-internal.jpg');
     $first_slide = wp_insert_post(array('post_title' => $first_slide_title, 'post_parent' => $presentation, 'post_type' => 'seoslides-slide', 'menu_order' => 1, 'post_status' => 'publish', 'post_content' => serialize($first_slide_content)));
     $first_seo = array('title' => $first_slide_title, 'description' => '', 'keywords' => '');
     update_post_meta($first_slide, 'seoslides_seo_settings', $first_seo);
     $first_headline = array('element_id' => SEOSlides_Util::generate_guid(), 'plugin_id' => '1798dfc0-8695-11e2-9e96-0800200c9a66', 'settings' => array('size' => array('w' => 1500, 'h' => 150), 'position' => array('top' => 0, 'left' => 50), 'content' => '<h1 style="text-align:center"><span style="color:#ffac46"><span style="font-size:1em">' . $title_slide_title . '</span></span></h1>'));
     $first_headline = new SEOSlides_CanvasObject($first_headline);
     add_post_meta($first_slide, 'seoslides_canvas_object', $first_headline);
     $first_content_text = '<p><span style="color:#ffffff"><span style="font-size:2.769em">' . __('This is your first presentation.', 'seoslides_translate') . '</span></span></p>';
     $first_content_text .= '<p><span style="color:#ffffff"><span style="font-size:2.769em">' . __('Edit or delete it', 'seoslides_translate') . '</span></span></p>';
     $first_content_text .= '<p><span style="color:#ffffff"><span style="font-size:2.769em">' . __('Then start presenting!', 'seoslides_translate') . '</span></span></p>';
     $first_content = array('element_id' => SEOSlides_Util::generate_guid(), 'plugin_id' => '1798dfc0-8695-11e2-9e96-0800200c9a66', 'settings' => array('size' => array('w' => 1400, 'h' => 650), 'position' => array('top' => 200, 'left' => 150), 'content' => $first_content_text));
     $first_content = new SEOSlides_CanvasObject($first_content);
     add_post_meta($first_slide, 'seoslides_canvas_object', $first_content);
     add_post_meta($first_slide, 'seoslides_notes', $notes, true);
 }