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 / Preset.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
Preset.php
232 lines
1 <?php
2 /**
3 * Preset model.
4 *
5 * @package PrestoPlayer\Models
6 */
7
8 namespace PrestoPlayer\Models;
9
10 /**
11 * Preset model for video presets stored in the presto_player_presets table.
12 *
13 * @property int $id
14 * @property string $name
15 * @property string $slug
16 */
17 class Preset extends Model {
18
19 /**
20 * Table used to access db
21 *
22 * @var string
23 */
24 protected $table = 'presto_player_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 'caption_style' => array(
53 'type' => 'string',
54 'sanitize_callback' => 'sanitize_text_field',
55 ),
56 'caption_background' => 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 'fullscreen' => array(
101 'type' => 'boolean',
102 'default' => false,
103 ),
104 'captions' => array(
105 'type' => 'boolean',
106 'default' => false,
107 ),
108 'reset_on_end' => array(
109 'type' => 'boolean',
110 'default' => false,
111 ),
112 'auto_hide' => array(
113 'type' => 'boolean',
114 'default' => false,
115 ),
116 'show_time_elapsed' => array(
117 'type' => 'boolean',
118 'default' => false,
119 ),
120 'captions_enabled' => array(
121 'type' => 'boolean',
122 'default' => false,
123 ),
124 'sticky_scroll' => array(
125 'type' => 'boolean',
126 'default' => false,
127 ),
128 'sticky_scroll_position' => array(
129 'type' => 'string',
130 'default' => 'bottom right',
131 ),
132 'on_video_end' => array(
133 'type' => 'string',
134 'default' => 'select',
135 ),
136 'play_video_viewport' => array(
137 'type' => 'boolean',
138 'default' => false,
139 ),
140 'save_player_position' => array(
141 'type' => 'boolean',
142 'default' => false,
143 ),
144 'hide_youtube' => array(
145 'type' => 'boolean',
146 'default' => false,
147 ),
148 'lazy_load_youtube' => array(
149 'type' => 'boolean',
150 'default' => false,
151 ),
152 'hide_logo' => array(
153 'type' => 'boolean',
154 'default' => false,
155 ),
156 'border_radius' => array(
157 'type' => 'integer',
158 'default' => 0,
159 ),
160 'cta' => array(
161 'type' => 'array',
162 ),
163 'watermark' => array(
164 'type' => 'array',
165 ),
166 'search' => array(
167 'type' => 'array',
168 ),
169 'email_collection' => array(
170 'type' => 'array',
171 ),
172 'action_bar' => array(
173 'type' => 'array',
174 ),
175 'is_locked' => array(
176 'type' => 'boolean',
177 'default' => false,
178 ),
179 'created_by' => array(
180 'type' => 'integer',
181 'default' => get_current_user_id(),
182 ),
183 'created_at' => array(
184 'type' => 'string',
185 ),
186 'updated_at' => array(
187 'type' => 'string',
188 'default' => current_time( 'mysql' ),
189 ),
190 'deleted_at' => array(
191 'type' => 'string',
192 ),
193 );
194 }
195
196 /**
197 * These attributes are queryable
198 *
199 * @var array
200 */
201 protected $queryable = array( 'slug' );
202
203 /**
204 * Get the preset name.
205 *
206 * @return string
207 */
208 public function getName() {
209 $name = $this->name;
210 return ! empty( $name ) ? (string) $name : '';
211 }
212
213 /**
214 * Create a preset in the db.
215 *
216 * @param array $args Preset data.
217 * @return integer
218 */
219 public function create( $args = array() ) {
220 // Name is required.
221 if ( empty( $args['name'] ) ) {
222 return new \WP_Error( 'missing_parameter', __( 'You must enter a name for the preset.', 'presto-player' ) );
223 }
224
225 // Generate slug on the fly.
226 $args['slug'] = ! empty( $args['slug'] ) ? $args['slug'] : sanitize_title( $args['name'] );
227
228 // Create.
229 return parent::create( $args );
230 }
231 }
232