jetpack
Last commit date
3rd-party
9 years ago
_inc
1 year ago
bin
9 years ago
css
9 years ago
images
1 year ago
json-endpoints
9 years ago
languages
9 years ago
modules
1 year ago
sal
9 years ago
scss
9 years ago
sync
9 years ago
views
9 years ago
.svnignore
12 years ago
changelog.txt
9 years ago
class.frame-nonce-preview.php
9 years ago
class.jetpack-admin.php
9 years ago
class.jetpack-autoupdate.php
9 years ago
class.jetpack-bbpress-json-api-compat.php
9 years ago
class.jetpack-cli.php
9 years ago
class.jetpack-client-server.php
9 years ago
class.jetpack-client.php
9 years ago
class.jetpack-connection-banner.php
9 years ago
class.jetpack-constants.php
9 years ago
class.jetpack-data.php
9 years ago
class.jetpack-debugger.php
9 years ago
class.jetpack-error.php
10 years ago
class.jetpack-heartbeat.php
9 years ago
class.jetpack-idc.php
9 years ago
class.jetpack-ixr-client.php
10 years ago
class.jetpack-jitm.php
9 years ago
class.jetpack-modules-list-table.php
9 years ago
class.jetpack-network-sites-list-table.php
9 years ago
class.jetpack-network.php
9 years ago
class.jetpack-options.php
9 years ago
class.jetpack-post-images.php
9 years ago
class.jetpack-signature.php
9 years ago
class.jetpack-tracks.php
9 years ago
class.jetpack-twitter-cards.php
9 years ago
class.jetpack-user-agent.php
9 years ago
class.jetpack-xmlrpc-server.php
9 years ago
class.jetpack.php
9 years ago
class.json-api-endpoints.php
3 years ago
class.json-api.php
10 years ago
class.photon.php
9 years ago
composer.json
10 years ago
functions.compat.php
9 years ago
functions.gallery.php
10 years ago
functions.global.php
9 years ago
functions.opengraph.php
9 years ago
functions.photon.php
9 years ago
jetpack.php
1 year ago
json-api-config.php
10 years ago
json-endpoints.php
9 years ago
locales.php
9 years ago
readme.txt
1 year ago
require-lib.php
10 years ago
rest-api.md
9 years ago
uninstall.php
9 years ago
webpack.config.js
9 years ago
wpml-config.xml
10 years ago
functions.gallery.php
77 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Renders extra controls in the Gallery Settings section of the new media UI. |
| 5 | */ |
| 6 | class Jetpack_Gallery_Settings { |
| 7 | function __construct() { |
| 8 | add_action( 'admin_init', array( $this, 'admin_init' ) ); |
| 9 | } |
| 10 | |
| 11 | function admin_init() { |
| 12 | /** |
| 13 | * Filter the available gallery types. |
| 14 | * |
| 15 | * @module shortcodes, tiled-gallery |
| 16 | * |
| 17 | * @since 2.5.1 |
| 18 | * |
| 19 | * @param array $value Array of the default thumbnail grid gallery type. Default array contains one key, ‘default’. |
| 20 | * |
| 21 | */ |
| 22 | $this->gallery_types = apply_filters( 'jetpack_gallery_types', array( 'default' => __( 'Thumbnail Grid', 'jetpack' ) ) ); |
| 23 | |
| 24 | // Enqueue the media UI only if needed. |
| 25 | if ( count( $this->gallery_types ) > 1 ) { |
| 26 | add_action( 'wp_enqueue_media', array( $this, 'wp_enqueue_media' ) ); |
| 27 | add_action( 'print_media_templates', array( $this, 'print_media_templates' ) ); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Registers/enqueues the gallery settings admin js. |
| 33 | */ |
| 34 | function wp_enqueue_media() { |
| 35 | if ( ! wp_script_is( 'jetpack-gallery-settings', 'registered' ) ) { |
| 36 | /** |
| 37 | * This only happens if we're not in Jetpack, but on WPCOM instead. |
| 38 | * This is the correct path for WPCOM. |
| 39 | */ |
| 40 | wp_register_script( 'jetpack-gallery-settings', plugins_url( 'gallery-settings/gallery-settings.js', __FILE__ ), array( 'media-views' ), '20121225' ); |
| 41 | } |
| 42 | |
| 43 | wp_enqueue_script( 'jetpack-gallery-settings' ); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Outputs a view template which can be used with wp.media.template |
| 48 | */ |
| 49 | function print_media_templates() { |
| 50 | /** |
| 51 | * Filter the default gallery type. |
| 52 | * |
| 53 | * @module tiled-gallery |
| 54 | * |
| 55 | * @since 2.5.1 |
| 56 | * |
| 57 | * @param string $value A string of the gallery type. Default is ‘default’. |
| 58 | * |
| 59 | */ |
| 60 | $default_gallery_type = apply_filters( 'jetpack_default_gallery_type', 'default' ); |
| 61 | |
| 62 | ?> |
| 63 | <script type="text/html" id="tmpl-jetpack-gallery-settings"> |
| 64 | <label class="setting"> |
| 65 | <span><?php _e( 'Type', 'jetpack' ); ?></span> |
| 66 | <select class="type" name="type" data-setting="type"> |
| 67 | <?php foreach ( $this->gallery_types as $value => $caption ) : ?> |
| 68 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $default_gallery_type ); ?>><?php echo esc_html( $caption ); ?></option> |
| 69 | <?php endforeach; ?> |
| 70 | </select> |
| 71 | </label> |
| 72 | </script> |
| 73 | <?php |
| 74 | } |
| 75 | } |
| 76 | new Jetpack_Gallery_Settings; |
| 77 |