Ejemplo n.º 1
0
    } else {
        if ($t->tntUpdateVideoType() == false) {
            $location = add_query_arg(array('m' => 0));
        }
    }
    Header("Location: {$location}");
}
/**
 * Process: Delete Video Category (Click Yes)
 */
if (isset($_POST['tntDelVideoCat_Yes'])) {
    $location = admin_url() . "/admin.php?page=tnt_video_cat_manager_page";
    $c = new TNT_VideoCat();
    $c->videoCatID = $_POST["catID"];
    $args = array('catID' => $c->videoCatID);
    $videos = TNT_Video::tntGetVideos($args);
    if ($videos != null) {
        wp_die("This cat is having videos");
    } else {
        //Delete video cat
        $c->tntDeleteVideoCat();
    }
    Header("Location: {$location}");
}
/**
 * Process: Delete Video Category (Click No)
 */
if (isset($_POST['tntDelVideoCat_No'])) {
    $location = admin_url() . "/admin.php?page=tnt_video_cat_manager_page";
    Header("Location: {$location}");
}
Ejemplo n.º 2
0
/**
 * Callback function for shortcode [tnt_video]
 */
function tntSCVideo($attr)
{
    $tntOptions = get_option('tntVideoManageOptions');
    //Get video ID
    $videoID = (int) $attr['id'];
    //Get width
    $videoWidthOption = $tntOptions['videoWidth'];
    $videoWidth = isset($attr['width']) ? $attr['width'] : $videoWidthOption;
    //Get height
    $videoHeightOption = $tntOptions['videoHeight'];
    $videoHeight = isset($attr['height']) ? $attr['height'] : $videoHeightOption;
    //Get video by videoID
    $args = array('videoID' => $videoID, 'isPublish' => 1);
    $video = TNT_Video::tntGetVideos($args);
    if ($video) {
        //Show template
        $vShow = "";
        foreach ($video as $vid) {
            $vShow['videoTitle'] = $vid->video_title;
            switch ($vid->video_link_type) {
                case "1":
                    $linkEmbed = tntGetYoutubeEmbedLink($vid->video_link);
                    $vShow['videoFrame'] = '<iframe width="' . $videoWidth . '" height="' . $videoHeight . '" src="' . $linkEmbed . '" frameborder="0" allowfullscreen></iframe>';
                    break;
                case "2":
                    $linkEmbed = tntGetVimeoEmbedLink($vid->video_link);
                    $vShow['videoFrame'] = '<iframe width="' . $videoWidth . '" height="' . $videoHeight . '" src="' . $linkEmbed . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
                    break;
            }
        }
        $view = tntTemplateVideoItem($vShow);
    } else {
        $view = "No Video ID found";
    }
    return $view;
}
Ejemplo n.º 3
0
/**
 * Function to display the "video category manage" page
 */
function tnt_video_cat_manager()
{
    ?>
		<div class="wrap">
			<?php 
    screen_icon('upload');
    ?>
			<h2>Video Category Manage</h2>
			<hr />
			<table class="tntTable widefat">

				<thead>
					<tr>
						<th>ID</th>
						<th>Title</th>
						<th>Amount of Videos</th>
						<th>Parent</th>
						<th>Shortcode</th>
						<th>Action</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<th>ID</th>
						<th>Title</th>
						<th>Amount of Videos</th>
						<th>Parent</th>
						<th>Shortcode</th>
						<th>Action</th>
					</tr>
				</tfoot>
				<tbody>
					<?php 
    $tntVideoCats = TNT_VideoCat::tntGetCats();
    foreach ($tntVideoCats as $tntC) {
        ?>
							<tr>
								<td><?php 
        echo $tntC->video_cat_id;
        ?>
</td>
								<td><b><a href="<?php 
        echo admin_url();
        ?>
admin.php?page=tnt_video_cat_edit_page&catID=<?php 
        echo $tntC->video_cat_id;
        ?>
"><?php 
        echo $tntC->video_cat_title;
        ?>
</a></b></td>
								<td>
									<?php 
        $videos = TNT_Video::tntGetVideos(array('catID' => $tntC->video_cat_id));
        $videosCount = count($videos);
        ?>
									<b><a href="<?php 
        echo admin_url();
        ?>
admin.php?page=tnt_video_manage_page&vCat=<?php 
        echo $tntC->video_cat_id;
        ?>
"><?php 
        echo $videosCount;
        ?>
</a></b>
								</td>
								<td><?php 
        echo $tntC->video_cat_parent_id;
        ?>
</td>
								<td><?php 
        echo '[tnt_video_list id=' . $tntC->video_cat_id . ']';
        ?>
</td>
								<td>
									<a href="<?php 
        echo admin_url();
        ?>
admin.php?page=tnt_video_cat_edit_page&catID=<?php 
        echo $tntC->video_cat_id;
        ?>
" class="button-secondary">Edit</a> 
									<a href="<?php 
        echo admin_url();
        ?>
admin.php?page=tnt_video_cat_del_page&catID=<?php 
        echo $tntC->video_cat_id;
        ?>
" class="button-secondary">Delete</a>
								</td>
							</tr>
					 <?php 
    }
    ?>
				</tbody>
			</table>
		</div>
	<?php 
}