Пример #1
0
function movie_links_content($post)
{
    wp_nonce_field(basename(__FILE__), 'movie_links_nonce');
    $post_id = $post->ID;
    $meta = get_post_meta($post_id);
    $trailer = get_post_meta($post_id, 'trailer', true);
    $website = get_post_meta($post_id, 'website', true);
    ?>

	<a href="https://www.youtube.com/results?search_query=<?php 
    echo urlencode($post->post_title);
    ?>
+trailer" target="_blank" class="button right">Search for Trailer</a>
	<h3>Trailer</h3>
	<p>Please enter the YouTube URL of an official movie trailer. </p>
	<p><input type="url" name="trailer" placeholder="Official trailer..." value="<?php 
    echo $trailer;
    ?>
" /></p>

	<label>
		<input type="checkbox" name="trailer_confirm" value="yes" <?php 
    echo echo_checkbox($meta['trailer_confirm'][0], 'yes');
    ?>
>
		Yes, this is the correct trailer for this movie.
	</label>

	<?php 
    if (!empty($trailer) && $trailer != ' ') {
        // If a trailer URL exists, show the trailer preview box
        // Grab the YouTube ID from the trailer URL
        $trailer = parse_url($trailer);
        parse_str($trailer['query'], $query);
        $trailer = $query['v'];
        ?>
	<div class="postbox-container">
		<div class="meta-box-sortables">
			<div class="postbox closed">
				<div class="handlediv" title="Click to toggle"><br /></div>
				<h3 class='hndle'><span>View Trailer</span></h3>
				<div class="inside">
	        <div class="js-lazyYT" id="trailer-frame" data-youtube-id="<?php 
        echo $trailer;
        ?>
" data-ratio="16:9"  data-parameters="rel=0&autohide=2&iv_load_policy=3&modestbranding=1&color=white"></div>
				</div>
			</div>
		</div>
	</div>
	<?php 
    }
    ?>

	<br><br>

	<a href="https://duckduckgo.com/?q=<?php 
    echo urlencode($post->post_title);
    ?>
+official+website" target="_blank" class="button right">Search for Website</a>
	<h3>Website</h3>
	<p>Please enter the URL of the official movie website.</p>
	<p><input type="url" name="website" placeholder="Official website..." value="<?php 
    echo $website;
    ?>
" /></p>

	<label>
		<input type="checkbox" name="website_confirm" value="yes"  <?php 
    echo echo_checkbox($meta['website_confirm'][0], 'yes');
    ?>
>
		Yes, this is the correct website for this movie.
	</label>

	<?php 
    if (!empty($website)) {
        // If a website URL exists, show the website preview box
        ?>
	<div id="website-postbox" class="postbox-container">
		<div class="meta-box-sortables">
			<div class="postbox closed">
				<div class="handlediv" title="Click to toggle"><br /></div>
				<h3 class='hndle'><span>View Website</span></h3>
				<div class="inside">
					<iframe src="" height="600" id="website-frame" frameborder="0" data-src="<?php 
        echo $website;
        ?>
"></iframe>
				</div>
			</div>
		</div>
	</div>
	<div class="clear"></div>
<?php 
    }
}
Пример #2
0
function movie_details_content($post)
{
    wp_nonce_field(basename(__FILE__), 'movie_details_nonce');
    $post_id = $post->ID;
    $meta = get_post_meta($post_id);
    $ratings_directory = get_stylesheet_directory_uri() . '/assets/images/ratings';
    ?>

	<h3>Run time</h3>
	<p><input type="number" name="runtime_minutes" value="<?php 
    echo echo_var($meta['runtime_minutes'][0]);
    ?>
" /> minutes</p>

	<h3>Rating</h3>
	<p>
		<label>
			<input type="radio" name="rating" value="G" <?php 
    echo echo_checkbox($meta['rating'][0], 'G');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/g.png" class="rating-icon" title="G">
		</label>
		<label>
			<input type="radio" name="rating" value="PG" <?php 
    echo echo_checkbox($meta['rating'][0], 'PG');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/pg.png" class="rating-icon" title="PG">
		</label>
		<label>
			<input type="radio" name="rating" value="14A" <?php 
    echo echo_checkbox($meta['rating'][0], '14A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/14a.png" class="rating-icon" title="14A">
		</label>
		<label>
			<input type="radio" name="rating" value="18A" <?php 
    echo echo_checkbox($meta['rating'][0], '18A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/18a.png" class="rating-icon" title="18A">
		</label>
		<label>
			<input type="radio" name="rating" value="R" <?php 
    echo echo_checkbox($meta['rating'][0], 'R');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/r.png" class="rating-icon" title="R">
		</label>
		<label>
			<input type="radio" name="rating" value="A" <?php 
    echo echo_checkbox($meta['rating'][0], 'A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/a.png" class="rating-icon" title="A">
		</label>
		<?php 
    if (isset($meta['json_response'])) {
        ?>
			<a class="button" id="rating-confirm">Confirm Film Rating</a><span id="rating-spinner" class="spinner"></span>
			<div id="rating-response" class="">
				<p>
					<span></span>
					<a href="http://www.consumerprotectionbc.ca/consumers-film-and-video-homepage/classification-search?submitted=1&featuretitle=<?php 
        echo urlencode(preg_replace("/[^a-zA-Z0-9\\s]+/", "", get_the_title()));
        ?>
" target="_blank">Open website to confirm</a>
				</p>
			</div>
		<?php 
    }
    ?>
	</p>

	<h3>Cast</h3>
	<p><textarea name="starring" rows="5" placeholder="Starring..."><?php 
    echo echo_var($meta['starring'][0]);
    ?>
</textarea></p>

	<h3>Description</h3>
	<p><textarea name="description" rows="5" placeholder="Description..."><?php 
    echo echo_var($meta['description'][0]);
    ?>
</textarea></p>
	<input type="hidden" name="genres">

<?php 
}