PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-videopress / src / class-options.php

class-options.php in Jetpack – WP Security, Backup, Speed, & Growth 16.2, at jetpack_vendor/automattic/jetpack-videopress/src/class-options.php

84 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * VideoPress Options
4 *
5 * @package automattic/jetpack-videopress
6 */
7
8 namespace Automattic\Jetpack\VideoPress;
9
10 use Automattic\Jetpack\Current_Plan;
11 use Jetpack_Options;
12
13 /**
14 * VideoPress Options class.
15 */
16 class Options {
17
18 /**
19 * Option name.
20 *
21 * @var string $option_name The 'videopress' option name
22 */
23 public static $option_name = 'videopress';
24
25 /**
26 * VideoPress Options.
27 *
28 * @var array $options An array of associated VideoPress options (default empty)
29 */
30 protected static $options = array();
31
32 /**
33 * Get VideoPress options
34 *
35 * @return array An array of VideoPress options.
36 */
37 public static function get_options() {
38 // Make sure we only get options from the database and services once per connection.
39 if ( array() !== self::$options ) {
40 return self::$options;
41 }
42
43 $defaults = array(
44 'meta' => array(
45 'max_upload_size' => 0,
46 ),
47 );
48
49 self::$options = Jetpack_Options::get_option( self::$option_name, array() );
50 self::$options = array_merge( $defaults, self::$options );
51
52 // Make sure that the shadow blog id never comes from the options, but instead uses the
53 // associated shadow blog id, if videopress is enabled.
54 self::$options['shadow_blog_id'] = 0;
55
56 // Use the Jetpack ID for the shadow blog ID if we have a plan that supports VideoPress.
57 if ( Current_Plan::supports( 'videopress' ) ) {
58 self::$options['shadow_blog_id'] = Jetpack_Options::get_option( 'id' );
59 }
60
61 return self::$options;
62 }
63
64 /**
65 * Update VideoPress options
66 *
67 * @param mixed $options VideoPress options.
68 */
69 public static function update_options( $options ) {
70 Jetpack_Options::update_option( self::$option_name, $options );
71
72 self::$options = $options;
73 }
74
75 /**
76 * Runs when the VideoPress module is deactivated.
77 */
78 public static function delete_options() {
79 Jetpack_Options::delete_option( self::$option_name );
80
81 self::$options = array();
82 }
83 }
84