css
8 years ago
js
6 years ago
class.jetpack-videopress.php
6 years ago
class.videopress-ajax.php
6 years ago
class.videopress-cli.php
7 years ago
class.videopress-edit-attachment.php
6 years ago
class.videopress-gutenberg.php
6 years ago
class.videopress-options.php
7 years ago
class.videopress-player.php
6 years ago
class.videopress-scheduler.php
7 years ago
class.videopress-video.php
6 years ago
class.videopress-xmlrpc.php
7 years ago
editor-media-view.php
6 years ago
shortcode.php
6 years ago
utility-functions.php
6 years ago
videopress-admin-rtl.css
7 years ago
videopress-admin-rtl.min.css
7 years ago
videopress-admin.css
9 years ago
videopress-admin.min.css
7 years ago
class.videopress-options.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | class VideoPress_Options { |
| 4 | |
| 5 | /** @var string */ |
| 6 | public static $option_name = 'videopress'; |
| 7 | |
| 8 | /** @var array */ |
| 9 | protected static $options = array(); |
| 10 | |
| 11 | /** |
| 12 | * Get VideoPress options |
| 13 | */ |
| 14 | public static function get_options() { |
| 15 | // Make sure we only get options from the database and services once per connection. |
| 16 | if ( count( self::$options ) > 0 ) { |
| 17 | return self::$options; |
| 18 | } |
| 19 | |
| 20 | $defaults = array( |
| 21 | 'meta' => array( |
| 22 | 'max_upload_size' => 0, |
| 23 | ), |
| 24 | ); |
| 25 | |
| 26 | self::$options = Jetpack_Options::get_option( self::$option_name, array() ); |
| 27 | self::$options = array_merge( $defaults, self::$options ); |
| 28 | |
| 29 | // Make sure that the shadow blog id never comes from the options, but instead uses the |
| 30 | // associated shadow blog id, if videopress is enabled. |
| 31 | self::$options['shadow_blog_id'] = 0; |
| 32 | |
| 33 | // Use the Jetpack ID for the shadow blog ID if we have a plan that supports VideoPress |
| 34 | if ( Jetpack_Plan::supports( 'videopress' ) ) { |
| 35 | self::$options['shadow_blog_id'] = Jetpack_Options::get_option( 'id' ); |
| 36 | } |
| 37 | |
| 38 | return self::$options; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Update VideoPress options |
| 43 | */ |
| 44 | public static function update_options( $options ) { |
| 45 | Jetpack_Options::update_option( self::$option_name, $options ); |
| 46 | |
| 47 | self::$options = $options; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Runs when the VideoPress module is deactivated. |
| 52 | */ |
| 53 | public static function delete_options() { |
| 54 | Jetpack_Options::delete_option( self::$option_name ); |
| 55 | |
| 56 | self::$options = array(); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 |