Classic_Editor::post_video_settings_meta_box()

Video embed settings meta box displayed on custom post type post editing and regular post editing for videos imported as regular posts


Return

(null)


Source

File: includes/libs/admin/editor/classic-editor.class.php

	public function post_video_settings_meta_box(){
		$settings = Helper::get_video_post()->get_embed_options();
		$plugin_options = Helper::get_embed_options();
		?>
		<?php wp_nonce_field('cvm-save-video-settings', 'cvm-video-nonce');?>
		<?php if( $this->is_option_override() ): ?>
			<div style="background-color: rgba(252,255,22,0.1); padding:.5em 1em;">
				<p>
				<h3><?php _e('Options override is ON', 'codeflavors-vimeo-video-post-lite');?></h3>
				<?php
				printf(
					__( 'Individual video post options are not editable; to change video options globally, go to plugin %sSettings%s, tab Embed options.', 'codeflavors-vimeo-video-post-lite' ),
					'<a href="' . menu_page_url( 'cvm_settings', false ) . '#embed-options">',
					'</a>'
				);?>
				</p>
			</div>
		<?php endif;?>
		<table class="form-table cvm-player-settings-options">
			<tbody>
            <?php
                /**
                 * Run action that can be used to hook to and display additional options.
                 * @ignore
                 *
                 * @param string $where The position that is currently running (ie. before, after, etc). Must be used to check which position is displayed to avoid showing options twice
                 */
                do_action(
                    'vimeotheque\editor\classic-editor-options-output',
                    'before'
                );
            ?>
			<tr>
				<th><label for="cvm_aspect_ratio"><?php _e('Player size', 'codeflavors-vimeo-video-post-lite');?>:</label></th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'width', sprintf( __( '%s X %s px' ), $plugin_options['width'], Helper::calculate_player_height( $plugin_options['aspect_ratio'], $plugin_options['width'] ) ) );?>
						<?php $this->option_override( 'aspect_ratio', sprintf( __( '/ Aspect ratio: %s', 'codeflavors-vimeo-video-post-lite' ), $plugin_options['aspect_ratio'] ) );?>
					<?php else: // is not option override?>
						<label for="cvm_aspect_ratio"><?php _e('Aspect ratio');?> :</label>
						<?php
						$args = [
							'name' => 'aspect_ratio',
							'id' => 'cvm_aspect_ratio',
							'class' => 'cvm_aspect_ratio',
							'selected' => $settings[ 'aspect_ratio' ]
						];
						Helper_Admin::aspect_ratio_select( $args );
						?>
						<label for="cvm_width"><?php _e('Width', 'codeflavors-vimeo-video-post-lite');?> :</label>
						<input type="text" name="width" id="cvm_width" class="cvm_width" value="<?php echo $settings['width'];?>" size="2" />px
						| <?php _e('Height', 'codeflavors-vimeo-video-post-lite');?> : <span class="cvm_height" id="cvm_calc_height"><?php echo Helper::calculate_player_height( $settings['aspect_ratio'], $settings['width'] );?></span>px
					<?php endif;// end option override?>
				</td>
			</tr>

			<tr>
				<th><label for="cvm_video_position"><?php _e('Display video','codeflavors-vimeo-video-post-lite');?>:</label></th>
				<td>
					<?php if( $this->is_option_override() ):
						$video_positions = [
							'above-content' => __( 'Above post content', 'codeflavors-vimeo-video-post-lite' ),
							'below-content' => __( 'Below post content', 'codeflavors-vimeo-video-post-lite' ),
							'replace-featured-image' => __( 'Replace featured image', 'codeflavors-vimeo-video-post-lite' ),
						];
						?>
						<?php $this->option_override( 'video_position', $video_positions[ $plugin_options['video_position'] ] );?>
					<?php else: // is not option override?>
						<?php
						$args = [
							'options' => [
								'above-content' => __( 'Above post content', 'codeflavors-vimeo-video-post-lite' ),
								'below-content' => __( 'Below post content', 'codeflavors-vimeo-video-post-lite' ),
                                'replace-featured-image' => __( 'Replace featured image', 'codeflavors-vimeo-video-post-lite' )
							],
							'name' => 'video_position',
							'id' => 'cvm_video_position',
							'selected' => $settings[ 'video_position' ]
						];
						Helper_Admin::select( $args );
						?>
					<?php endif;// end option override?>
				</td>
			</tr>

            <tr>
                <th><label for="lazy_load"><?php _e('Lazy load', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
                <td>
		            <?php if( $this->is_option_override() ):?>
			            <?php $this->option_override( 'lazy_load', ( $plugin_options['lazy_load'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
		            <?php else: // is not option override?>
                        <input name="lazy_load" id="lazy_load" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['lazy_load'] );?> />
                        <label for="lazy_load"><span class="description">( <?php _e('when checked, video will be lazy loaded', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
		            <?php endif;// end option override?>
                </td>
            </tr>

			<tr class="toggled-background-mode toggled-muted-mode" style="<?php Helper_Admin::css_hide( ( $settings['background'] || $settings['muted'] ) ) ;?>">
				<th><label for="cvm_volume"><?php _e('Volume', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'volume', $plugin_options['volume'] );?>
					<?php else: // is not option override?>
						<input type="text" name="volume" id="cvm_volume" value="<?php echo $settings['volume'];?>" size="1" maxlength="3" />
					<?php endif;// end option override?>
					<label for="cvm_volume"><span class="description">( <?php _e('number between 0 (mute) and 100 (max)', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
				</td>
			</tr>
            <tr>
                <th><label for="cvm_background"><?php _e('Background video', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
                <td>
                    <input name="background" id="cvm_background" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['background'] );?> class="toggler-checkbox" data-hide_elements=".toggled-background-mode" />
                    <label for="cvm_background">
                        <span class="description">( <?php _e('the video will be loaded in background mode which hides the playback controls, enables autoplay, and loops the video', 'codeflavors-vimeo-video-post-lite');?> )</span>
                    </label>
                </td>
            </tr>
            <tr class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th><label for="cvm_muted"><?php _e('Mute video', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
                    <input name="muted" id="cvm_muted" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['muted'] );?> class="toggler-checkbox" data-hide_elements=".toggled-muted-mode" />
					<label for="cvm_muted"><span class="description">( <?php _e('will load video muted; needs to be checked for the autoplay behavior in some browsers', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
				</td>
			</tr>
			<tr class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th><label for="cvm_autoplay"><?php _e('Autoplay', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'autoplay', ( $plugin_options['autoplay'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
					<?php else: // is not option override?>
						<input name="autoplay" id="cvm_autoplay" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['autoplay'] );?> />
						<label for="cvm_autoplay"><span class="description">( <?php _e('when checked, video will start playing once page is loaded', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
					<?php endif;// end option override?>
					<p class="description"><?php _e( 'Autoplay may be blocked in some environments, such as IOS, Chrome 66+, and Safari 11+. In these cases, Vimeo player will revert to standard playback requiring viewers to initiate playback.', 'codeflavors-vimeo-video-post-lite' );?></p>
				</td>
			</tr>
			<tr class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th><label for="cvm_loop"><?php _e('Loop video', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'loop', ( $plugin_options['loop'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
					<?php else: // is not option override?>
						<input name="loop" id="cvm_loop" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['loop'] );?> /> <label for="cvm_loop">
							<span class="description">( <?php _e('when checked, the video will play again when it reaches the end', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
					<?php endif;// end option override?>
				</td>
			</tr>
			<tr class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th><label for="title"><?php _e('Show video title', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'title', ( $plugin_options['title'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
					<?php else: // is not option override?>
						<input name="title" id="cvm_title" class="cvm_title" type="checkbox" value="1" <?php Helper_Admin::check( (bool) $settings['title'] );?> />
						<label for="cvm_title"><span class="description">( <?php _e('when checked, player will display video title', 'codeflavors-vimeo-video-post-lite');?> )</span></label>
					<?php endif;// end option override?>
				</td>
			</tr>
			<tr class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th><label for="cvm_color"><?php _e('Player color', 'codeflavors-vimeo-video-post-lite');?></label>:</th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'color', ( empty( $plugin_options['color'] ) ? __( 'Default', 'codeflavors-vimeo-video-post-lite' ) : '#' . $plugin_options['color'] ) );?>
						<?php if( !empty( $plugin_options['color'] ) ):?>
							<div style="width: 20px; height: 20px; background-color: #<?php echo $plugin_options['color'];?>; float: left; margin-right:10px;">&nbsp;</div>
						<?php endif;?>
					<?php else: // is not option override?>
						<input type="text" name="color" id="cvm_color" value="<?php echo $settings['color'];?>" />
					<?php endif;// end option override?>
				</td>
			</tr>

			<tr valign="top" class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th scope="row"><label for="byline"><?php _e('Show video author', 'codeflavors-vimeo-video-post-lite')?>:</label></th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'byline', ( $plugin_options['byline'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
					<?php else: // is not option override?>
						<input type="checkbox" value="1" id="byline" name="byline" <?php Helper_Admin::check( (bool) $settings['byline'] );?> />
						<span class="description"><?php _e('When checked, player will display video uploader.', 'codeflavors-vimeo-video-post-lite');?></span>
					<?php endif;// end option override?>
				</td>
			</tr>

			<tr valign="top" class="toggled-background-mode" style="<?php Helper_Admin::css_hide( $settings['background'] ) ;?>">
				<th scope="row"><label for="portrait"><?php _e('Author portrait', 'codeflavors-vimeo-video-post-lite')?>:</label></th>
				<td>
					<?php if( $this->is_option_override() ):?>
						<?php $this->option_override( 'portrait', ( $plugin_options['portrait'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
					<?php else: // is not option override?>
						<input type="checkbox" value="1" id="portrait" name="portrait" <?php Helper_Admin::check( (bool) $settings['portrait'] );?> />
						<span class="description"><?php _e('When checked, player will display uploader image.', 'codeflavors-vimeo-video-post-lite');?></span>
					<?php endif;// end option override?>
				</td>
			</tr>

            <tr valign="top">
				<th scope="row"><label for="start_time"><?php _e('Start at', 'codeflavors-vimeo-video-post-lite')?>:</label></th>
				<td>
					<input name="start_time" id="start_time" type="number" value="<?php echo $settings['start_time'];?>" step="1" min="0" max="<?php echo Helper::get_video_post()->duration;?>" /> <abbr title="<?php esc_attr_e( 'Seconds', 'codeflavors-vimeo-video-post-lite' );?>"><?php _ex( 'sec.', 'Abbreviation for "seconds"', 'codeflavors-vimeo-video-post-lite' ) ;?></abbr>
					<p class="description">
                        <?php
                           printf(
                                __('Video will be embedded to start from the specified time. Value must not exceed the total video duration of %d seconds.', 'codeflavors-vimeo-video-post-lite'),
                                Helper::get_video_post()->duration
                           );
                        ?>
                    </p>
				</td>
			</tr>

            <tr valign="top">
                <th scope="row"><label for="transparent"><?php _e('Transparent background', 'codeflavors-vimeo-video-post-lite')?>:</label></th>
                <td>
		            <?php if( $this->is_option_override() ):?>
			            <?php $this->option_override( 'transparent', ( $plugin_options['transparent'] ? __( 'On', 'codeflavors-vimeo-video-post-lite' ) : __( 'Off', 'codeflavors-vimeo-video-post-lite' ) ) );?>
		            <?php else: // is not option override?>
                        <input type="checkbox" value="1" id="transparent" name="transparent" <?php Helper_Admin::check( (bool) $settings['transparent'] );?> />
                        <span class="description"><?php _e('When checked, the video will be embedded without a background.', 'codeflavors-vimeo-video-post-lite');?></span>
		            <?php endif;// end option override?>
                </td>
            </tr>

			</tbody>
		</table>
		<?php

		/**
		 * Run action that can be used to hook to and display additional options
		 * @ignore
		 * @param string $where The position that is currently running (ie. before, after, etc). Must be used to check which position is displayed to avoid showing options twice
		 */
		do_action(
			'vimeotheque\editor\classic-editor-options-output',
			'after'
		);
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!