当前位置: 首页>>代码示例>>PHP>>正文


PHP Video::exists方法代码示例

本文整理汇总了PHP中Video::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::exists方法的具体用法?PHP Video::exists怎么用?PHP Video::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Video的用法示例。


在下文中一共展示了Video::exists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getVideo

 public function getVideo()
 {
     return Video::exists($this->video_id) ? Video::find($this->video_id) : false;
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:4,代码来源:comment.php

示例2: generateId

 public static function generateId($length)
 {
     $idExists = true;
     while ($idExists) {
         $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         $id = '';
         for ($i = 0; $i < $length; $i++) {
             $id .= $chars[rand(0, strlen($chars) - 1)];
         }
         $idExists = Video::exists(array('id' => $id));
     }
     return $id;
 }
开发者ID:agiza,项目名称:DreamVids,代码行数:13,代码来源:video.php

示例3: status

 /**
  * 
  * Return a Json Response. The most important index for js are data.sd.status and data.hd.status : 
  * values can be : 
  * 'ok' => everything is okay, 
  * 'doing' => a file is being converted, 
  * 'no' => There is no file availlable in this resolution
  */
 public function status($id, $request)
 {
     if (Video::exists($id)) {
         $video = Video::find($id);
         $data = [];
         $sizes = ['sd' => '640x360p', 'hd' => '1280x720p'];
         //Arrays of sizes and formats
         $formats = ['mp4', 'webm'];
         foreach ($sizes as $k => $size) {
             //For each size
             foreach ($formats as $format) {
                 //And each format
                 $file_name = $video->url . '_' . $size . '.' . $format;
                 //File name = <url of the video>_<size>.<format>
                 if (Utils::stringStartsWith($file_name, 'http')) {
                     //If stocked on an external server : absoulute path.
                     $data[$k][$format] = Utils::getHTTPStatusCodeFromURL($file_name);
                 } else {
                     $data[$k][$format] = Utils::getHTTPStatusCodeFromURL('http://' . $_SERVER['HTTP_HOST'] . '/' . $file_name);
                     //Ressource is directly on the same server with relative path
                 }
             }
         }
         foreach ($data as $k => $v) {
             if ($v['mp4'] < 400 && $v['webm'] < 400) {
                 $data[$k]['status'] = 'ok';
             } elseif ($v['mp4'] < 400 xor $v['webm'] < 400) {
                 $data[$k]['status'] = 'doing';
             } else {
                 $data[$k]['status'] = 'no';
             }
         }
         return new JsonResponse($data);
         //Return as JSON
     } else {
         return new JsonResponse([null]);
     }
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:46,代码来源:video_controller.php

示例4: foreach

if (!$user->exists()) {
    Redirect::to('../index.php');
} else {
    if (!$user->isLoggedIn() || !$user->hasPermission('admin')) {
        Redirect::to('../index.php');
    } else {
        foreach ($_GET as $key => $value) {
            if ($value == "") {
                Redirect::to('../index.php');
            }
        }
        if (Input::exists('get')) {
            $video_entry = new Video();
            $video_entry_id = $video_entry->safe_string(Input::get('id'));
            $video_entry->find($video_entry_id);
            if (!$video_entry->exists()) {
                Redirect::to('../index.php');
            } else {
                $video_entry_title = $video_entry->data()->video_title;
                try {
                    $video_entry->delete(['id', '=', Input::get('id')]);
                    Session::flash('delete', 'Video for entry "' . $video_entry_title . '" has been deleted from the database.');
                    Redirect::to('../index.php');
                } catch (Exception $e) {
                    die($e->getMessage());
                }
            }
        } else {
            Redirect::to('../index.php');
        }
    }
开发者ID:reggiegulle,项目名称:StoryOfMH370,代码行数:31,代码来源:delete_video.php

示例5: video

 public function video($id, $request)
 {
     $video = Video::exists($id) ? Video::find($id) : false;
     if (!$request->acceptsJson()) {
         return new RedirectResponse(WEBROOT . 'watch/' . $id);
     }
     if (is_object($video)) {
         $comments = $video->getComments();
         $commentsData = array();
         foreach ($comments as $comment) {
             $commentsData[] = array('id' => $comment->id, 'author' => UserChannel::find($comment->poster_id)->name, 'video_id' => $comment->video_id, 'comment' => $comment->comment, 'relativeTime' => Utils::relative_time($comment->timestamp), 'timestamp' => $comment->timestamp, 'likes' => $comment->likes, 'dislikes' => $comment->dislikes);
         }
         return new JsonResponse($commentsData);
     }
     return new Response(500);
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:16,代码来源:comment_controller.php

示例6:

                        ?>
">
										<div class="thumbnail bg-loader" data-background-load-in-view data-background="http://lorempicsum.com/up/350/200/6"></div>
										<p><?php 
                        echo $phrase;
                        ?>
</p>
									</a>
									<i><?php 
                        echo Utils::relative_time($action->timestamp);
                        ?>
</i>
								</div>
							<?php 
                    } else {
                        if ($action->type == 'comment' && Video::exists($action->target)) {
                            $comment = Comment::getByChannelAction($action);
                            $video = Utils::secureActiveRecordModel(Video::find($action->target));
                            ?>
								<div class="card<?php 
                            echo $supp_class;
                            ?>
 comment">
									<a href="<?php 
                            echo WEBROOT . 'watch/' . $action->target;
                            ?>
">
										<p><b><?php 
                            echo Utils::secure($channel_action->name);
                            ?>
</b> a commenté votre vidéo "<b><?php 
开发者ID:boulama,项目名称:DreamVids,代码行数:31,代码来源:feed.php


注:本文中的Video::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。