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


PHP Video::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created video in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Video::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $image = $data['image'];
     if (!empty($image)) {
         $data['image'] = ImageHandler::uploadImage($data['image'], 'images');
     } else {
         $data['image'] = 'placeholder.jpg';
     }
     $tags = $data['tags'];
     unset($data['tags']);
     if (empty($data['active'])) {
         $data['active'] = 0;
     }
     if (empty($data['featured'])) {
         $data['featured'] = 0;
     }
     if (isset($data['duration'])) {
         //$str_time = $data
         $str_time = preg_replace("/^([\\d]{1,2})\\:([\\d]{2})\$/", "00:\$1:\$2", $data['duration']);
         sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);
         $time_seconds = $hours * 3600 + $minutes * 60 + $seconds;
         $data['duration'] = $time_seconds;
     }
     $video = Video::create($data);
     $this->addUpdateVideoTags($video, $tags);
     return Redirect::to('admin/videos')->with(array('note' => 'New Video Successfully Added!', 'note_type' => 'success'));
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:36,代码来源:AdminVideosController.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         Video::create(array('title' => $faker->sentence($nbwords = 5), 'slug' => $faker->slug, 'content' => $faker->text, 'excerpt' => $faker->sentence, 'image' => $faker->imageUrl($width = 640, $height = 480), 'file' => 'uploads/videos/1.mp4', 'video_category_id' => $faker->numberBetween(1, 8)));
     }
 }
开发者ID:arbuuuud,项目名称:gnt-aops,代码行数:7,代码来源:VideosTableSeeder.php

示例3: createTemp

 public static function createTemp($id, $channelId, $videoPath, $thumbnailPath, $duration)
 {
     Video::create(array('id' => $id, 'poster_id' => $channelId, 'title' => '[no_info_provided]', 'description' => '[no_info_provided]', 'tags' => '[no_info_provided]', 'tumbnail' => $thumbnailPath, 'duration' => $duration, 'url' => $videoPath, 'views' => 0, 'likes' => 0, 'dislikes' => 0, 'timestamp' => Utils::tps(), 'visibility' => 0, 'flagged' => 0, 'published_once' => 0));
 }
开发者ID:agiza,项目名称:DreamVids,代码行数:4,代码来源:video.php

示例4: showFriendlyMatches

    private function showFriendlyMatches() {
        $csrf = $_SESSION['csrf'];
        $opponents = Model::indexBy($this->season->getTeams(), 'teamid');

        $postCsrf = HTMLResponse::fromPOST('friendlycsrf', '');

        if ($postCsrf == $csrf && $this->team->isManager()) {
            $url = HTMLResponse::fromPOST('friendlyurl');
            $opponentsId = HTMLResponse::fromPOST('friendlyopponentsid');
            $publishDate = HTMLResponse::fromPOST('friendlydate');
            $publishTime = HTMLResponse::fromPOST('friendlytime');

            if (!strlen($publishDate)) $publishDate = date('Y-m-d');
            if (!strlen($publishTime)) $publishTime = date('H').':00';

            $possibleOpponents = Model::pluck($this->season->getTeams(), 'teamid');

            $regex = '/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/';
            $timeRegex = "'^[0-9]{2}:[0-9]{2}$'";
            $dateRegex = "'^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$'";

            $removeId = HTMLResponse::fromPOST('removeid');
            if ($removeId) {
                /** @var Video $video */
                if ($video = Video::findOne('seasonid = ? and type = ? and videoid = ? and teamid = ?',
                    [$this->season->seasonid, 3, $removeId, $this->team->teamid])) {
                    $video->delete();
                    HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
                }
            }

            if (!strlen($opponentsId) || !strlen($publishTime) || !strlen($publishDate) || !strlen($url)) {
                $this->design->addJavaScript("
                    $(function() { alert(\"No has rellenado todos los datos\"); })
                ", false);
            } else {
                if ($opponentsId != $this->team->teamid && in_array($opponentsId, $possibleOpponents)) {
                    if (!preg_match($regex, $url)) {
                        $this->design->addJavaScript("
                    $(function() { alert(\"El enlace que has puesto no es un enlace de YouTube válido\"); })
                ", false);
                    } else {
                        if (!preg_match($timeRegex, $publishTime)) {
                            $this->design->addJavaScript("
                    $(function() { alert(\"La hora que has puesto tiene un formato inválido (ha de ser 08:06)\"); })
                ", false);
                        } else {
                            if (!preg_match($dateRegex, $publishDate)) {
                                $this->design->addJavaScript("
                    $(function() { alert(\"La fecha que has puesto tiene un formato inválido (ha de ser 2099-12-31)\"); })
                ", false);
                            } else {
                                $video = Video::create();
                                $video->dateline = time();
                                $video->publishdate = $publishDate;
                                $video->publishtime = $publishTime;
                                $video->link = $url;
                                $video->opponentid = $opponentsId * 1;
                                $video->teamid = $this->team->teamid;
                                $video->type = 3;
                                $video->seasonid = $this->season->seasonid;
                                $video->save();
                                HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
                            }
                        }
                    }
                }
            }
        }

        $videos = Video::find('seasonid = ? and teamid = ? and type = ? order by publishdate asc, publishtime asc',
            [$this->season->seasonid, $this->team->teamid, 3]);

        if ($videos || $this->team->isManager()) {
            ?>
            <h2>Combates amistosos</h2>
            <? if ($this->team->isManager()) { ?>
                <form action="<?=HTMLResponse::getRoute()?>" method="post">
            <? } ?>
            <table>
                <thead>
                <tr>
                    <td>Fecha</td>
                    <td>Hora</td>
                    <td>Oponentes</td>
                    <td>Vídeo</td>
                </tr>
                </thead>
                <? foreach($videos as $video) {
                    if (!$this->team->isManager() &&
                        ($video->publishdate > date('Y-m-d') ||
                            ($video->publishdate == date('Y-m-d') && $video->publishtime > date('H:i')))) {
                        continue;
                    }
                    ?>
                    <tr>
                        <td><?= $video->publishdate ?></td>
                        <td><?= $video->publishtime ?></td>
                        <td>
                            <a href="/<?=$this->season->getLink()?>/equipos/<?=$opponents[$video->opponentid]->getLink()?>/">
//.........这里部分代码省略.........
开发者ID:xJakub,项目名称:LCE,代码行数:101,代码来源:Team_Index.php

示例5: youtube_id_from_url

}
if (strlen($data['title']) < 3 || strlen($data['title']) > 20) {
    $errors[] = 'Videon nimen tulee olla 3-20 merkkiä pitkä.';
}
if (empty($data['url']) || !youtube_id_from_url($data['url'])) {
    $errors[] = 'Videon URL on pakollinen ja videon tulee olla YouTubesta';
}
if (!empty($errors)) {
    include '../controllers/showDVD.php';
} else {
    $video = new Video();
    $video->suggestedBy = htmlspecialchars($data['suggestedBy']);
    $video->title = htmlspecialchars($data['title']);
    $video->url = youtube_id_from_url($data['url']);
    $video->dvd = $dvd;
    $video->create();
    header('Location: ' . SITE_URL . '/' . $dvd . '/' . urlencode($URL[1]));
}
/**
 * Get youtube video ID from URL
 *
 * @param string $url
 * @return mixed Youtube video id or false if none found. 
 */
function youtube_id_from_url($url)
{
    $pattern = '%^# Match any youtube URL
		(?:https?://)?  # Optional scheme. Either http or https
		(?:www\\.)?      # Optional www subdomain
		(?:             # Group host alternatives
		  youtu\\.be/    # Either youtu.be,
开发者ID:jtiala,项目名称:xqdvd,代码行数:31,代码来源:suggestVideo.php

示例6: testRenderWithFeedCover

 public function testRenderWithFeedCover()
 {
     $video = Video::create()->withURL('http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4')->enableFeedCover();
     $expected = '<figure class="fb-feed-cover">' . '<video>' . '<source src="http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4"/>' . '</video>' . '</figure>';
     $rendered = $video->render();
     $this->assertEquals($expected, $rendered);
 }
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:7,代码来源:VideoTest.php

示例7: loadRelated

 /**
  * @param array $attributes
  */
 public function loadRelated(array $attributes)
 {
     parent::loadRelated($attributes);
     if (isset($attributes['from'])) {
         $this->from = User::create($attributes['from']);
     }
     if (isset($attributes['chat'])) {
         $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']);
     }
     if (isset($attributes['forward_from'])) {
         $this->forward_from = User::create($attributes['forward_from']);
     }
     if (isset($attributes['forward_from_chat'])) {
         $this->forward_from_chat = Chat::create($attributes['forward_from_chat']);
     }
     if (isset($attributes['reply_to_message'])) {
         $this->reply_to_message = Message::create($attributes['reply_to_message']);
     }
     if (isset($attributes['entities'])) {
         $this->entities = array_map(function ($entity) {
             return MessageEntity::create($entity);
         }, $attributes['entities']);
     }
     if (isset($attributes['audio'])) {
         $this->audio = Audio::create($attributes['audio']);
     }
     if (isset($attributes['document'])) {
         $this->document = Document::create($attributes['document']);
     }
     if (isset($attributes['photo'])) {
         $this->photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['photo']);
     }
     if (isset($attributes['sticker'])) {
         $this->sticker = Sticker::create($attributes['sticker']);
     }
     if (isset($attributes['video'])) {
         $this->video = Video::create($attributes['video']);
     }
     if (isset($attributes['voice'])) {
         $this->voice = Voice::create($attributes['voice']);
     }
     if (isset($attributes['contact'])) {
         $this->contact = Contact::create($attributes['contact']);
     }
     if (isset($attributes['location'])) {
         $this->location = Location::create($attributes['location']);
     }
     if (isset($attributes['venue'])) {
         $this->venue = Venue::create($attributes['venue']);
     }
     if (isset($attributes['new_chat_member'])) {
         $this->new_chat_member = User::create($attributes['new_chat_member']);
     }
     if (isset($attributes['left_chat_member'])) {
         $this->left_chat_member = new User($attributes['left_chat_member']);
     }
     if (isset($attributes['new_chat_photo'])) {
         $this->new_chat_photo = array_map(function ($photo) {
             return PhotoSize::create($photo);
         }, $attributes['new_chat_photo']);
     }
 }
开发者ID:zelenin,项目名称:telegram-bot-api,代码行数:67,代码来源:Message.php

示例8: run

 public function run()
 {
     DB::table('videos')->truncate();
     DB::table('videos')->delete();
     Video::create(array('user_id' => '1', 'title' => 'Первое видео', 'link' => 'best', 'active' => 1, 'meta_title' => 'Первое видео мета заголовок', 'meta_description' => 'Первое видео мета описание', 'meta_keywords' => 'Первое видео ключевые слова'));
 }
开发者ID:Rotron,项目名称:shop,代码行数:6,代码来源:VideoTableSeeder.php

示例9: DateTime

                $date_week_operand = new DateTime($date_input_query);
                //assign variable
                //that corresponds to a string
                //with a particular date format
                $string_date_pub = $date_week_operand->format('F j, Y');
                //get the difference of days
                //between the two dates using
                //the diff() DateTime object method
                $interval = $date_week_start->diff($date_week_operand);
                // Output the difference in days, and convert to int
                $days = (int) $interval->format('%a');
                // Get number of full weeks by dividing days by seven,
                // rounding it up with ceil function
                $weeks = ceil($days / 7);
                try {
                    $video->create(['date_published' => $date_input_query, 'string_date_pub' => $string_date_pub, 'week_number' => $weeks, 'video_id' => Input::get('video_id'), 'video_title' => Input::get('video_title'), 'video_desc' => Input::get('video_desc'), 'video_uploader' => Input::get('video_uploader'), 'tag' => Input::get('tag')]);
                    Session::flash('add_video', 'You have added a new video entry!');
                } catch (Exception $e) {
                    die($e->getMessage());
                }
            }
        }
    }
}
?>

<!--include reg_user_header.php-->
<?php 
include '../includes/layout/reg_user_header.php';
?>
		
开发者ID:reggiegulle,项目名称:StoryOfMH370,代码行数:30,代码来源:new_video.php


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