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


PHP Tags::RemoveFromFrequency方法代码示例

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


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

示例1: tbxVideoEdit

function tbxVideoEdit()
{
    Privileges::Check(Privileges::VIDEOS);
    $DB = GetDB();
    $schema = GetDBSchema();
    $v = Validator::Create();
    $v->RegisterFromXml($schema->el('//table[name="tbx_video"]'));
    $v->RegisterFromXml($schema->el('//table[name="tbx_video_custom"]'));
    if (!String::IsEmpty($_REQUEST['username'])) {
        $v->Register($DB->QueryCount('SELECT COUNT(*) FROM `tbx_user` WHERE `username`=?', array($_REQUEST['username'])) > 0, Validator_Type::IS_TRUE, 'The Username entered does not exist');
    }
    if (!$v->Validate()) {
        return JSON::Failure(array('message' => 'Video could not be updated; please fix the following items', 'errors' => $v->GetErrors()));
    }
    $_REQUEST['display_thumbnail'] = empty($_REQUEST['display_thumbnail']) ? null : $_REQUEST['display_thumbnail'];
    $_REQUEST['date_recorded'] = String::Nullify($_REQUEST['date_recorded']);
    $_REQUEST['tags'] = Tags::Format($_REQUEST['tags']);
    $_REQUEST['username'] = String::Nullify(Request::Get('username'));
    $_REQUEST['duration'] = Format::DurationToSeconds($_REQUEST['duration']);
    $original = $DB->Row('SELECT * FROM `tbx_video` WHERE `video_id`=?', array($_REQUEST['video_id']));
    // Handle uploaded thumbs, if any
    $dir = new Video_Dir(Video_Dir::DirNameFromId($original['video_id']));
    $thumbs_added = 0;
    $thumb_ids = array();
    Request::FixFiles();
    if (isset($_FILES['thumb_uploads'])) {
        foreach ($_FILES['thumb_uploads'] as $upload) {
            if (File::Extension($upload['name']) == JPG_EXTENSION && ($imgsize = getimagesize($upload['tmp_name'])) !== false) {
                $temp_file = $dir->AddTempFromFile($upload['tmp_name'], JPG_EXTENSION);
                if (Video_Thumbnail::CanResize()) {
                    $temp_file = Video_Thumbnail::Resize($temp_file, Config::Get('thumb_size'), Config::Get('thumb_quality'), $dir->GetTempDir());
                }
                $thumb = $dir->AddThumbFromFile($temp_file);
                $thumbs_added++;
                $thumb = str_replace(Config::Get('document_root'), '', $thumb);
                $thumb_ids[] = array('uri' => $thumb, 'id' => DatabaseAdd('tbx_video_thumbnail', array('video_id' => $original['video_id'], 'thumbnail' => $thumb)));
            }
        }
        if ($thumbs_added > 0) {
            $dir->ClearTemp();
            $_REQUEST['num_thumbnails'] = $original['num_thumbnails'] + $thumbs_added;
        }
    }
    // Update base database tables
    $video = DatabaseUpdate('tbx_video', $_REQUEST);
    DatabaseUpdate('tbx_video_custom', $_REQUEST);
    // Handle changes to video clips
    foreach ($_REQUEST['clips'] as $clip_id => $clip) {
        DatabaseUpdate('tbx_video_clip', array('video_id' => $video['video_id'], 'clip_id' => $clip_id, 'clip' => $clip['clip']));
    }
    if ($_REQUEST['is_private'] && !$original['is_private']) {
        $_REQUEST['private_id'] = sha1(uniqid(mt_rand(), true));
        DatabaseAdd('tbx_video_private', $_REQUEST);
        if ($original['status'] == STATUS_ACTIVE) {
            Tags::RemoveFromFrequency($original['tags']);
        }
    } else {
        if (!$_REQUEST['is_private']) {
            if ($original['status'] == STATUS_ACTIVE) {
                if ($original['is_private']) {
                    Tags::AddToFrequency($_REQUEST['tags']);
                } else {
                    Tags::UpdateFrequency($original['tags'], $_REQUEST['tags']);
                }
            }
            $DB->Update('DELETE FROM `tbx_video_private` WHERE `video_id`=?', array($_REQUEST['video_id']));
        }
    }
    if ($original['status'] == STATUS_ACTIVE) {
        $t = new Template();
        $t->ClearCache('categories.tpl');
    }
    UpdateCategoryStats($original['category_id'], $video['category_id']);
    UpdateSponsorStats($original['sponsor_id'], $_REQUEST['sponsor_id']);
    $output = array('id' => $video['video_id'], 'message' => 'Video has been successfully updated', 'html' => SearchItemHtml('video', $video), 'thumbs' => $thumb_ids);
    JSON::Success($output);
}
开发者ID:hackingman,项目名称:TubeX,代码行数:77,代码来源:ajax.php

示例2: DeleteVideo

function DeleteVideo($video)
{
    $DB = GetDB();
    $DB->Update('DELETE FROM `tbx_video` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_clip` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_thumbnail` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_rating` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_flagged` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_featured` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_favorited` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_custom` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_stat` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_comment` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_video_private` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_user_favorite` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_conversion_queue` WHERE `video_id`=?', array($video['video_id']));
    $DB->Update('DELETE FROM `tbx_thumb_queue` WHERE `video_id`=?', array($video['video_id']));
    if ($video['status'] == STATUS_ACTIVE && !$video['is_private']) {
        Tags::RemoveFromFrequency($video['tags']);
    }
    $video_dir = new Video_Dir(Video_Dir::DirNameFromId($video['video_id']));
    $video_dir->Remove();
    UpdateCategoryStats($video['category_id']);
    UpdateSponsorStats($video['sponsor_id']);
    $t = new Template();
    $t->ClearCache('video-watch.tpl', $video['video_id']);
}
开发者ID:hackingman,项目名称:TubeX,代码行数:27,代码来源:global.php


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