/**
  * Enqueue styles & scripts for the Customizer.
  *
  * @action customize_controls_enqueue_scripts
  * @global \WP_Customize_Manager $wp_customize
  */
 public function enqueue_controls_scripts()
 {
     // Prevent loading the Snapshot interface if the theme is not active.
     if (!$this->is_theme_active()) {
         return;
     }
     wp_enqueue_style('customize-snapshots');
     wp_enqueue_script('customize-snapshots');
     if ($this->snapshot) {
         $post = $this->snapshot->post();
         $this->override_post_date_default_data($post);
     }
     // Script data array.
     $exports = apply_filters('customize_snapshots_export_data', array('action' => self::AJAX_ACTION, 'uuid' => $this->snapshot ? $this->snapshot->uuid() : self::generate_uuid(), 'editLink' => isset($post) ? get_edit_post_link($post, 'raw') : '', 'publishDate' => isset($post->post_date) ? $post->post_date : '', 'postStatus' => isset($post->post_status) ? $post->post_status : '', 'currentUserCanPublish' => current_user_can('customize_publish'), 'initialServerDate' => current_time('mysql', false), 'initialServerTimestamp' => floor(microtime(true) * 1000), 'i18n' => array('saveButton' => __('Save', 'customize-snapshots'), 'updateButton' => __('Update', 'customize-snapshots'), 'scheduleButton' => __('Schedule', 'customize-snapshots'), 'submit' => __('Submit', 'customize-snapshots'), 'submitted' => __('Submitted', 'customize-snapshots'), 'publish' => __('Publish', 'customize-snapshots'), 'published' => __('Published', 'customize-snapshots'), 'permsMsg' => array('save' => __('You do not have permission to publish changes, but you can create a snapshot by clicking the "Save" button.', 'customize-snapshots'), 'update' => __('You do not have permission to publish changes, but you can modify this snapshot by clicking the "Update" button.', 'customize-snapshots')), 'errorMsg' => __('The snapshot could not be saved.', 'customize-snapshots'), 'errorTitle' => __('Error', 'customize-snapshots'), 'collapseSnapshotScheduling' => __('Collapse snapshot scheduling', 'customize-snapshots'), 'expandSnapshotScheduling' => __('Expand snapshot scheduling', 'customize-snapshots')), 'snapshotExists' => $this->snapshot && $this->snapshot->saved()));
     // Export data to JS.
     wp_scripts()->add_data($this->plugin->slug, 'data', sprintf('var _customizeSnapshots = %s;', wp_json_encode($exports)));
 }
 /**
  * Test saved.
  *
  * @see Customize_Snapshot::saved()
  */
 function test_saved()
 {
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     $snapshot = new Customize_Snapshot($manager, self::UUID);
     $this->assertFalse($snapshot->saved());
     $manager->post_type->save(array('uuid' => self::UUID, 'data' => array('foo' => array('value' => 'bar'))));
 }