PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.3.1
Presto Player v4.3.1
4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Models / AudioPreset.php
presto-player / inc / Models Last commit date
AudioPreset.php 1 month ago Block.php 10 months ago CurrentUser.php 1 year ago EmailCollection.php 1 year ago Model.php 3 weeks ago ModelInterface.php 1 year ago Player.php 3 weeks ago Post.php 1 year ago Preset.php 1 month ago ReusableVideo.php 1 month ago Setting.php 1 year ago Video.php 1 month ago Webhook.php 1 year ago
AudioPreset.php
198 lines
1 <?php
2 /**
3 * AudioPreset model.
4 *
5 * @package PrestoPlayer\Models
6 */
7
8 namespace PrestoPlayer\Models;
9
10 /**
11 * AudioPreset model for audio presets stored in the presto_player_audio_presets table.
12 *
13 * @property int $id
14 * @property string $name
15 * @property string $slug
16 */
17 class AudioPreset extends Model {
18
19 /**
20 * Table used to access db
21 *
22 * @var string
23 */
24 protected $table = 'presto_player_audio_presets';
25
26 /**
27 * Model Schema
28 *
29 * @var array
30 */
31 public function schema() {
32 return array(
33 'id' => array(
34 'type' => 'integer',
35 ),
36 'name' => array(
37 'type' => 'string',
38 'sanitize_callback' => 'wp_kses_post',
39 ),
40 'slug' => array(
41 'type' => 'string',
42 'sanitize_callback' => 'sanitize_title',
43 ),
44 'icon' => array(
45 'type' => 'string',
46 'sanitize_callback' => 'sanitize_text_field',
47 ),
48 'skin' => array(
49 'type' => 'string',
50 'sanitize_callback' => 'sanitize_text_field',
51 ),
52 'background_color' => array(
53 'type' => 'string',
54 'sanitize_callback' => 'sanitize_hex_color',
55 ),
56 'control_color' => array(
57 'type' => 'string',
58 'sanitize_callback' => 'sanitize_hex_color',
59 ),
60 'play' => array(
61 'type' => 'boolean',
62 'default' => false,
63 ),
64 'play-large' => array(
65 'type' => 'boolean',
66 'default' => false,
67 ),
68 'rewind' => array(
69 'type' => 'boolean',
70 'default' => false,
71 ),
72 'fast-forward' => array(
73 'type' => 'boolean',
74 'default' => false,
75 ),
76 'progress' => array(
77 'type' => 'boolean',
78 'default' => false,
79 ),
80 'current-time' => array(
81 'type' => 'boolean',
82 'default' => false,
83 ),
84 'mute' => array(
85 'type' => 'boolean',
86 'default' => false,
87 ),
88 'volume' => array(
89 'type' => 'boolean',
90 'default' => false,
91 ),
92 'speed' => array(
93 'type' => 'boolean',
94 'default' => false,
95 ),
96 'pip' => array(
97 'type' => 'boolean',
98 'default' => false,
99 ),
100 'reset_on_end' => array(
101 'type' => 'boolean',
102 'default' => false,
103 ),
104 'sticky_scroll' => array(
105 'type' => 'boolean',
106 'default' => false,
107 ),
108 'sticky_scroll_position' => array(
109 'type' => 'string',
110 'default' => 'bottom right',
111 ),
112 'on_video_end' => array(
113 'type' => 'string',
114 'default' => 'select',
115 ),
116 'play_video_viewport' => array(
117 'type' => 'boolean',
118 'default' => false,
119 ),
120 'show_time_elapsed' => array(
121 'type' => 'boolean',
122 'default' => false,
123 ),
124 'save_player_position' => array(
125 'type' => 'boolean',
126 'default' => false,
127 ),
128 'border_radius' => array(
129 'type' => 'integer',
130 'default' => 0,
131 ),
132 'cta' => array(
133 'type' => 'array',
134 ),
135 'email_collection' => array(
136 'type' => 'array',
137 ),
138 'action_bar' => array(
139 'type' => 'array',
140 ),
141 'is_locked' => array(
142 'type' => 'boolean',
143 'default' => false,
144 ),
145 'created_by' => array(
146 'type' => 'integer',
147 'default' => get_current_user_id(),
148 ),
149 'created_at' => array(
150 'type' => 'string',
151 ),
152 'updated_at' => array(
153 'type' => 'string',
154 'default' => current_time( 'mysql' ),
155 ),
156 'deleted_at' => array(
157 'type' => 'string',
158 ),
159 );
160 }
161
162 /**
163 * These attributes are queryable
164 *
165 * @var array
166 */
167 protected $queryable = array( 'slug' );
168
169 /**
170 * Get the preset name.
171 *
172 * @return string
173 */
174 public function getName() {
175 $name = $this->name;
176 return ! empty( $name ) ? (string) $name : '';
177 }
178
179 /**
180 * Create a preset in the db.
181 *
182 * @param array $args Preset data.
183 * @return integer
184 */
185 public function create( $args = array() ) {
186 // Name is required.
187 if ( empty( $args['name'] ) ) {
188 return new \WP_Error( 'missing_parameter', __( 'You must enter a name for the preset.', 'presto-player' ) );
189 }
190
191 // Generate slug on the fly.
192 $args['slug'] = ! empty( $args['slug'] ) ? $args['slug'] : sanitize_title( $args['name'] );
193
194 // Create.
195 return parent::create( $args );
196 }
197 }
198