PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/files/jetpack/2.3.3/carousel/jetpack-carousel.php

https://gitlab.com/Mirros/jsdelivr
PHP | 489 lines | 360 code | 85 blank | 44 comment | 70 complexity | 7f38c381cf7596b1f415b7cd4528e8aa MD5 | raw file
  1. <?php
  2. /*
  3. Plugin Name: Jetpack Carousel
  4. Plugin URL: http://wordpress.com/
  5. Description: Transform your standard image galleries into an immersive full-screen experience.
  6. Version: 0.1
  7. Author: Automattic
  8. Released under the GPL v.2 license.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. */
  14. class Jetpack_Carousel {
  15. var $prebuilt_widths = array( 370, 700, 1000, 1200, 1400, 2000 );
  16. var $first_run = true;
  17. var $in_jetpack = true;
  18. function __construct() {
  19. add_action( 'init', array( $this, 'init' ) );
  20. }
  21. function init() {
  22. if ( $this->maybe_disable_jp_carousel() )
  23. return;
  24. $this->in_jetpack = ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'enable_module_configurable' ) ) ? true : false;
  25. if ( is_admin() ) {
  26. // Register the Carousel-related related settings
  27. add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
  28. if ( ! $this->in_jetpack ) {
  29. if ( 0 == $this->test_1or0_option( get_option( 'carousel_enable_it' ), true ) )
  30. return; // Carousel disabled, abort early, but still register setting so user can switch it back on
  31. }
  32. // If in admin, register the ajax endpoints.
  33. add_action( 'wp_ajax_get_attachment_comments', array( $this, 'get_attachment_comments' ) );
  34. add_action( 'wp_ajax_nopriv_get_attachment_comments', array( $this, 'get_attachment_comments' ) );
  35. add_action( 'wp_ajax_post_attachment_comment', array( $this, 'post_attachment_comment' ) );
  36. add_action( 'wp_ajax_nopriv_post_attachment_comment', array( $this, 'post_attachment_comment' ) );
  37. } else {
  38. if ( ! $this->in_jetpack ) {
  39. if ( 0 == $this->test_1or0_option( get_option( 'carousel_enable_it' ), true ) )
  40. return; // Carousel disabled, abort early
  41. }
  42. // If on front-end, do the Carousel thang.
  43. $this->prebuilt_widths = apply_filters( 'jp_carousel_widths', $this->prebuilt_widths );
  44. add_filter( 'post_gallery', array( $this, 'enqueue_assets' ), 1000, 2 ); // load later than other callbacks hooked it
  45. add_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
  46. add_filter( 'wp_get_attachment_link', array( $this, 'add_data_to_images' ), 10, 2 );
  47. }
  48. if ( $this->in_jetpack && method_exists( 'Jetpack', 'module_configuration_load' ) ) {
  49. Jetpack::enable_module_configurable( dirname( dirname( __FILE__ ) ) . '/carousel.php' );
  50. Jetpack::module_configuration_load( dirname( dirname( __FILE__ ) ) . '/carousel.php', array( $this, 'jetpack_configuration_load' ) );
  51. }
  52. }
  53. function maybe_disable_jp_carousel() {
  54. return apply_filters( 'jp_carousel_maybe_disable', false );
  55. }
  56. function jetpack_configuration_load() {
  57. wp_safe_redirect( admin_url( 'options-media.php#carousel_background_color' ) );
  58. exit;
  59. }
  60. function asset_version( $version ) {
  61. return apply_filters( 'jp_carousel_asset_version', $version );
  62. }
  63. function enqueue_assets( $output ) {
  64. if ( ! empty( $output ) && ! apply_filters( 'jp_carousel_force_enable', false ) ) {
  65. // Bail because someone is overriding the [gallery] shortcode.
  66. remove_filter( 'gallery_style', array( $this, 'add_data_to_container' ) );
  67. remove_filter( 'wp_get_attachment_link', array( $this, 'add_data_to_images' ) );
  68. return $output;
  69. }
  70. do_action( 'jp_carousel_thumbnails_shown' );
  71. if ( $this->first_run ) {
  72. wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20130109' ), true );
  73. // Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
  74. // Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
  75. $is_logged_in = is_user_logged_in();
  76. $current_user = wp_get_current_user();
  77. $comment_registration = intval( get_option( 'comment_registration' ) );
  78. $require_name_email = intval( get_option( 'require_name_email' ) );
  79. $localize_strings = array(
  80. 'widths' => $this->prebuilt_widths,
  81. 'is_logged_in' => $is_logged_in,
  82. 'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
  83. 'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'https' : 'http' ),
  84. 'nonce' => wp_create_nonce( 'carousel_nonce' ),
  85. 'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
  86. 'display_geo' => $this->test_1or0_option( get_option( 'carousel_display_geo' ), true ),
  87. 'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
  88. 'comment' => __( 'Comment', 'jetpack' ),
  89. 'post_comment' => __( 'Post Comment', 'jetpack' ),
  90. 'loading_comments' => __( 'Loading Comments...', 'jetpack' ),
  91. 'download_original' => sprintf( __( 'View full size <span class="photo-size">%1$s<span class="photo-size-times">&times;</span>%2$s</span>', 'jetpack' ), '{0}', '{1}' ),
  92. 'no_comment_text' => __( 'Please be sure to submit some text with your comment.', 'jetpack' ),
  93. 'no_comment_email' => __( 'Please provide an email address to comment.', 'jetpack' ),
  94. 'no_comment_author' => __( 'Please provide your name to comment.', 'jetpack' ),
  95. 'comment_post_error' => __( 'Sorry, but there was an error posting your comment. Please try again later.', 'jetpack' ),
  96. 'comment_approved' => __( 'Your comment was approved.', 'jetpack' ),
  97. 'comment_unapproved' => __( 'Your comment is in moderation.', 'jetpack' ),
  98. 'camera' => __( 'Camera', 'jetpack' ),
  99. 'aperture' => __( 'Aperture', 'jetpack' ),
  100. 'shutter_speed' => __( 'Shutter Speed', 'jetpack' ),
  101. 'focal_length' => __( 'Focal Length', 'jetpack' ),
  102. 'comment_registration' => $comment_registration,
  103. 'require_name_email' => $require_name_email,
  104. 'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ),
  105. );
  106. if ( ! isset( $localize_strings['jetpack_comments_iframe_src'] ) || empty( $localize_strings['jetpack_comments_iframe_src'] ) ) {
  107. // We're not using Jetpack comments after all, so fallback to standard local comments.
  108. if ( $is_logged_in ) {
  109. $localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf( __( 'Commenting as %s', 'jetpack' ), $current_user->data->display_name ) . '</p>';
  110. } else {
  111. if ( $comment_registration ) {
  112. $localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __( 'You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', 'jetpack' ) . '</p>';
  113. } else {
  114. $required = ( $require_name_email ) ? __( '%s (Required)', 'jetpack' ) : '%s';
  115. $localize_strings['local_comments_commenting_as'] = ''
  116. . '<fieldset><label for="email">' . sprintf( $required, __( 'Email', 'jetpack' ) ) . '</label> '
  117. . '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>'
  118. . '<fieldset><label for="author">' . sprintf( $required, __( 'Name', 'jetpack' ) ) . '</label> '
  119. . '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>'
  120. . '<fieldset><label for="url">' . __( 'Website', 'jetpack' ) . '</label> '
  121. . '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
  122. }
  123. }
  124. }
  125. $localize_strings = apply_filters( 'jp_carousel_localize_strings', $localize_strings );
  126. wp_localize_script( 'jetpack-carousel', 'jetpackCarouselStrings', $localize_strings );
  127. wp_enqueue_style( 'jetpack-carousel', plugins_url( 'jetpack-carousel.css', __FILE__ ), array(), $this->asset_version( '20120629' ) );
  128. global $is_IE;
  129. if( $is_IE )
  130. {
  131. $msie = strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) + 4;
  132. $version = (float) substr( $_SERVER['HTTP_USER_AGENT'], $msie, strpos( $_SERVER['HTTP_USER_AGENT'], ';', $msie ) - $msie );
  133. if( $version < 9 )
  134. wp_enqueue_style( 'jetpack-carousel-ie8fix', plugins_url( 'jetpack-carousel-ie8fix.css', __FILE__ ), array(), $this->asset_version( '20121024' ) );
  135. }
  136. do_action( 'jp_carousel_enqueue_assets', $this->first_run, $localize_strings );
  137. $this->first_run = false;
  138. }
  139. return $output;
  140. }
  141. function add_data_to_images( $html, $attachment_id ) {
  142. if ( $this->first_run ) // not in a gallery
  143. return $html;
  144. $attachment_id = intval( $attachment_id );
  145. $orig_file = wp_get_attachment_image_src( $attachment_id, 'full' );
  146. $orig_file = isset( $orig_file[0] ) ? $orig_file[0] : wp_get_attachment_url( $attachment_id );
  147. $meta = wp_get_attachment_metadata( $attachment_id );
  148. $size = isset( $meta['width'] ) ? intval( $meta['width'] ) . ',' . intval( $meta['height'] ) : '';
  149. $img_meta = ( ! empty( $meta['image_meta'] ) ) ? (array) $meta['image_meta'] : array();
  150. $comments_opened = intval( comments_open( $attachment_id ) );
  151. /*
  152. * Note: Cannot generate a filename from the width and height wp_get_attachment_image_src() returns because
  153. * it takes the $content_width global variable themes can set in consideration, therefore returning sizes
  154. * which when used to generate a filename will likely result in a 404 on the image.
  155. * $content_width has no filter we could temporarily de-register, run wp_get_attachment_image_src(), then
  156. * re-register. So using returned file URL instead, which we can define the sizes from through filename
  157. * parsing in the JS, as this is a failsafe file reference.
  158. *
  159. * EG with Twenty Eleven activated:
  160. * array(4) { [0]=> string(82) "http://vanillawpinstall.blah/wp-content/uploads/2012/06/IMG_3534-1024x764.jpg" [1]=> int(584) [2]=> int(435) [3]=> bool(true) }
  161. *
  162. * EG with Twenty Ten activated:
  163. * array(4) { [0]=> string(82) "http://vanillawpinstall.blah/wp-content/uploads/2012/06/IMG_3534-1024x764.jpg" [1]=> int(640) [2]=> int(477) [3]=> bool(true) }
  164. */
  165. $medium_file_info = wp_get_attachment_image_src( $attachment_id, 'medium' );
  166. $medium_file = isset( $medium_file_info[0] ) ? $medium_file_info[0] : '';
  167. $large_file_info = wp_get_attachment_image_src( $attachment_id, 'large' );
  168. $large_file = isset( $large_file_info[0] ) ? $large_file_info[0] : '';
  169. $attachment = get_post( $attachment_id );
  170. $attachment_title = wptexturize( $attachment->post_title );
  171. $attachment_desc = wpautop( wptexturize( $attachment->post_content ) );
  172. // Not yet providing geo-data, need to "fuzzify" for privacy
  173. if ( ! empty( $img_meta ) ) {
  174. foreach ( $img_meta as $k => $v ) {
  175. if ( 'latitude' == $k || 'longitude' == $k )
  176. unset( $img_meta[$k] );
  177. }
  178. }
  179. $img_meta = json_encode( array_map( 'strval', $img_meta ) );
  180. $html = str_replace(
  181. '<img ',
  182. sprintf(
  183. '<img data-attachment-id="%1$d" data-orig-file="%2$s" data-orig-size="%3$s" data-comments-opened="%4$s" data-image-meta="%5$s" data-image-title="%6$s" data-image-description="%7$s" data-medium-file="%8$s" data-large-file="%9$s" ',
  184. $attachment_id,
  185. esc_attr( $orig_file ),
  186. $size,
  187. $comments_opened,
  188. esc_attr( $img_meta ),
  189. esc_attr( $attachment_title ),
  190. esc_attr( $attachment_desc ),
  191. esc_attr( $medium_file ),
  192. esc_attr( $large_file )
  193. ),
  194. $html
  195. );
  196. $html = apply_filters( 'jp_carousel_add_data_to_images', $html, $attachment_id );
  197. return $html;
  198. }
  199. function add_data_to_container( $html ) {
  200. global $post;
  201. if ( isset( $post ) ) {
  202. $blog_id = (int) get_current_blog_id();
  203. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
  204. $likes_blog_id = $blog_id;
  205. } else {
  206. $jetpack = Jetpack::init();
  207. $likes_blog_id = $jetpack->get_option( 'id' );
  208. }
  209. $extra_data = array(
  210. 'data-carousel-extra' => array(
  211. 'blog_id' => $blog_id,
  212. 'permalink' => get_permalink( $post->ID ),
  213. 'likes_blog_id' => $likes_blog_id
  214. )
  215. );
  216. $extra_data = apply_filters( 'jp_carousel_add_data_to_container', $extra_data );
  217. foreach ( (array) $extra_data as $data_key => $data_values ) {
  218. $html = str_replace( '<div ', '<div ' . esc_attr( $data_key ) . "='" . json_encode( $data_values ) . "' ", $html );
  219. }
  220. }
  221. return $html;
  222. }
  223. function get_attachment_comments() {
  224. if ( ! headers_sent() )
  225. header('Content-type: text/javascript');
  226. do_action('jp_carousel_check_blog_user_privileges');
  227. $attachment_id = ( isset( $_REQUEST['id'] ) ) ? (int) $_REQUEST['id'] : 0;
  228. $offset = ( isset( $_REQUEST['offset'] ) ) ? (int) $_REQUEST['offset'] : 0;
  229. if ( ! $attachment_id ) {
  230. echo json_encode( __( 'Missing attachment ID.', 'jetpack' ) );
  231. die();
  232. }
  233. if ( $offset < 1 )
  234. $offset = 0;
  235. $comments = get_comments( array(
  236. 'status' => 'approve',
  237. 'order' => ( 'asc' == get_option('comment_order') ) ? 'ASC' : 'DESC',
  238. 'number' => 10,
  239. 'offset' => $offset,
  240. 'post_id' => $attachment_id,
  241. ) );
  242. $out = array();
  243. // Can't just send the results, they contain the commenter's email address.
  244. foreach ( $comments as $comment ) {
  245. $out[] = array(
  246. 'id' => $comment->comment_ID,
  247. 'parent_id' => $comment->comment_parent,
  248. 'author_markup' => get_comment_author_link( $comment->comment_ID ),
  249. 'gravatar_markup' => get_avatar( $comment->comment_author_email, 64 ),
  250. 'date_gmt' => $comment->comment_date_gmt,
  251. 'content' => wpautop($comment->comment_content),
  252. );
  253. }
  254. die( json_encode( $out ) );
  255. }
  256. function post_attachment_comment() {
  257. if ( ! headers_sent() )
  258. header('Content-type: text/javascript');
  259. if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce($_POST['nonce'], 'carousel_nonce') )
  260. die( json_encode( array( 'error' => __( 'Nonce verification failed.', 'jetpack' ) ) ) );
  261. $_blog_id = (int) $_POST['blog_id'];
  262. $_post_id = (int) $_POST['id'];
  263. $comment = $_POST['comment'];
  264. if ( empty( $_blog_id ) )
  265. die( json_encode( array( 'error' => __( 'Missing target blog ID.', 'jetpack' ) ) ) );
  266. if ( empty( $_post_id ) )
  267. die( json_encode( array( 'error' => __( 'Missing target post ID.', 'jetpack' ) ) ) );
  268. if ( empty( $comment ) )
  269. die( json_encode( array( 'error' => __( 'No comment text was submitted.', 'jetpack' ) ) ) );
  270. // Used in context like NewDash
  271. $switched = false;
  272. if ( is_multisite() && $_blog_id != get_current_blog_id() ) {
  273. switch_to_blog( $_blog_id );
  274. $switched = true;
  275. }
  276. do_action('jp_carousel_check_blog_user_privileges');
  277. if ( ! comments_open( $_post_id ) )
  278. die( json_encode( array( 'error' => __( 'Comments on this post are closed.', 'jetpack' ) ) ) );
  279. if ( is_user_logged_in() ) {
  280. $user = wp_get_current_user();
  281. $user_id = $user->ID;
  282. $display_name = $user->display_name;
  283. $email = $user->user_email;
  284. $url = $user->user_url;
  285. if ( empty( $user_id ) )
  286. die( json_encode( array( 'error' => __( 'Sorry, but we could not authenticate your request.', 'jetpack' ) ) ) );
  287. } else {
  288. $user_id = 0;
  289. $display_name = $_POST['author'];
  290. $email = $_POST['email'];
  291. $url = $_POST['url'];
  292. if ( get_option( 'require_name_email' ) ) {
  293. if ( empty( $display_name ) )
  294. die( json_encode( array( 'error' => __( 'Please provide your name.', 'jetpack' ) ) ) );
  295. if ( empty( $email ) )
  296. die( json_encode( array( 'error' => __( 'Please provide an email address.', 'jetpack' ) ) ) );
  297. if ( ! is_email( $email ) )
  298. die( json_encode( array( 'error' => __( 'Please provide a valid email address.', 'jetpack' ) ) ) );
  299. }
  300. }
  301. $comment_data = array(
  302. 'comment_content' => $comment,
  303. 'comment_post_ID' => $_post_id,
  304. 'comment_author' => $display_name,
  305. 'comment_author_email' => $email,
  306. 'comment_author_url' => $url,
  307. 'comment_approved' => 0,
  308. 'comment_type' => '',
  309. );
  310. if ( ! empty( $user_id ) )
  311. $comment_data['user_id'] = $user_id;
  312. // Note: wp_new_comment() sanitizes and validates the values (too).
  313. $comment_id = wp_new_comment( $comment_data );
  314. do_action( 'jp_carousel_post_attachment_comment' );
  315. $comment_status = wp_get_comment_status( $comment_id );
  316. if ( true == $switched )
  317. restore_current_blog();
  318. die( json_encode( array( 'comment_id' => $comment_id, 'comment_status' => $comment_status ) ) );
  319. }
  320. function register_settings() {
  321. add_settings_section('carousel_section', __( 'Image Gallery Carousel', 'jetpack' ), array( $this, 'carousel_section_callback' ), 'media');
  322. if ( ! $this->in_jetpack ) {
  323. add_settings_field('carousel_enable_it', __( 'Enable carousel', 'jetpack' ), array( $this, 'carousel_enable_it_callback' ), 'media', 'carousel_section' );
  324. register_setting( 'media', 'carousel_enable_it', array( $this, 'carousel_enable_it_sanitize' ) );
  325. }
  326. add_settings_field('carousel_background_color', __( 'Background color', 'jetpack' ), array( $this, 'carousel_background_color_callback' ), 'media', 'carousel_section' );
  327. register_setting( 'media', 'carousel_background_color', array( $this, 'carousel_background_color_sanitize' ) );
  328. add_settings_field('carousel_display_exif', __( 'Metadata', 'jetpack'), array( $this, 'carousel_display_exif_callback' ), 'media', 'carousel_section' );
  329. register_setting( 'media', 'carousel_display_exif', array( $this, 'carousel_display_exif_sanitize' ) );
  330. // No geo setting yet, need to "fuzzify" data first, for privacy
  331. // add_settings_field('carousel_display_geo', __( 'Geolocation', 'jetpack' ), array( $this, 'carousel_display_geo_callback' ), 'media', 'carousel_section' );
  332. // register_setting( 'media', 'carousel_display_geo', array( $this, 'carousel_display_geo_sanitize' ) );
  333. }
  334. // Fulfill the settings section callback requirement by returning nothing
  335. function carousel_section_callback() {
  336. return;
  337. }
  338. function test_1or0_option( $value, $default_to_1 = true ) {
  339. if ( true == $default_to_1 ) {
  340. // Binary false (===) of $value means it has not yet been set, in which case we do want to default sites to 1
  341. if ( false === $value )
  342. $value = 1;
  343. }
  344. return ( 1 == $value ) ? 1 : 0;
  345. }
  346. function sanitize_1or0_option( $value ) {
  347. return ( 1 == $value ) ? 1 : 0;
  348. }
  349. function settings_checkbox($name, $label_text, $extra_text = '', $default_to_checked = true) {
  350. if ( empty( $name ) )
  351. return;
  352. $option = $this->test_1or0_option( get_option( $name ), $default_to_checked );
  353. echo '<fieldset>';
  354. echo '<input type="checkbox" name="'.esc_attr($name).'" id="'.esc_attr($name).'" value="1" ';
  355. checked( '1', $option );
  356. echo '/> <label for="'.esc_attr($name).'">'.$label_text.'</label>';
  357. if ( ! empty( $extra_text ) )
  358. echo '<p class="description">'.$extra_text.'</p>';
  359. echo '</fieldset>';
  360. }
  361. function settings_select($name, $values, $extra_text = '') {
  362. if ( empty( $name ) || ! is_array( $values ) || empty( $values ) )
  363. return;
  364. $option = get_option( $name );
  365. echo '<fieldset>';
  366. echo '<select name="'.esc_attr($name).'" id="'.esc_attr($name).'">';
  367. foreach( $values as $key => $value ) {
  368. echo '<option value="'.esc_attr($key).'" ';
  369. selected( $key, $option );
  370. echo '>'.esc_html($value).'</option>';
  371. }
  372. echo '</select>';
  373. if ( ! empty( $extra_text ) )
  374. echo '<p class="description">'.$extra_text.'</p>';
  375. echo '</fieldset>';
  376. }
  377. function carousel_display_exif_callback() {
  378. $this->settings_checkbox( 'carousel_display_exif', __( 'Show photo metadata (<a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format" target="_blank">Exif</a>) in carousel, when available.', 'jetpack' ) );
  379. }
  380. function carousel_display_exif_sanitize( $value ) {
  381. return $this->sanitize_1or0_option( $value );
  382. }
  383. function carousel_display_geo_callback() {
  384. $this->settings_checkbox( 'carousel_display_geo', __( 'Show map of photo location in carousel, when available.', 'jetpack' ) );
  385. }
  386. function carousel_display_geo_sanitize( $value ) {
  387. return $this->sanitize_1or0_option( $value );
  388. }
  389. function carousel_background_color_callback() {
  390. $this->settings_select( 'carousel_background_color', array( 'black' => __( 'Black', 'jetpack' ), 'white' => __( 'White', 'jetpack', 'jetpack' ) ) );
  391. }
  392. function carousel_background_color_sanitize( $value ) {
  393. return ( 'white' == $value ) ? 'white' : 'black';
  394. }
  395. function carousel_enable_it_callback() {
  396. $this->settings_checkbox( 'carousel_enable_it', __( 'Display images in full-size carousel slideshow.', 'jetpack' ) );
  397. }
  398. function carousel_enable_it_sanitize( $value ) {
  399. return $this->sanitize_1or0_option( $value );
  400. }
  401. }
  402. new Jetpack_Carousel;