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


PHP Set::Filter方法代码示例

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


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

示例1: array

 $itArray = array();
 foreach ($it as $file) {
     $itArray[] = $file;
 }
 if (isset($argv) && $argc > 0) {
     $bi = new BusyIndicator(count($itArray), 0, sprintf('%1$2d/%2$2d %3$s', $i + 1, count($Models), $Model->GetShortName()));
 }
 /* @var $FileInfo SplFileInfo */
 foreach ($itArray as $FileInfo) {
     if (isset($argv) && $argc > 0) {
         $bi->Next();
     }
     if ($FileInfo->isFile() && $FileInfo->isReadable()) {
         $setnamematch = preg_match('/(?P<Prefix>[A-Z]+[_ -])?(?P<Name>[A-Z0-9]+)(?P<Number>\\d\\d)(?P<Suffix>[a-z])?\\.(?P<Extension>[^.]+)$/i', $FileInfo->getFilename(), $matches);
         if (isset($matches) && count($matches) > 0) {
             $Set = Set::Filter($Sets, $Model->getID(), NULL, $matches['Name'] . $matches['Number'], $matches['Prefix']);
             if (!$Set) {
                 continue;
             } else {
                 $Set = $Set[0];
             }
             /* @var $VideoInDB Video */
             $VideosInDB = Video::Filter($Videos, $ModelID, $Set->getID(), $matches['Name'] . $matches['Number'] . $matches['Suffix']);
             if ($VideosInDB) {
                 $VideoInDB = $VideosInDB[0];
                 $cis = CacheImage::Filter($CacheImages, NULL, NULL, NULL, NULL, NULL, $VideoInDB->getID());
                 CacheImage::DeleteMulti($cis, $CurrentUser);
             } else {
                 $VideoInDB = new Video();
                 $VideoInDB->setSet($Set);
             }
开发者ID:laiello,项目名称:candydolldb,代码行数:31,代码来源:import_video.php

示例2: sprintf

$outfile = 'CandyDollDB.csv';
if ($ModelID && count($Models) > 0) {
    $Model = $Models[0];
    $outfile = sprintf('CandyDollDB %1$s.csv', $Model->GetFullName());
}
header(sprintf('Content-type: %1$s', Utils::GetMime('csv')));
header(sprintf('Content-Disposition: attachment; filename="%1$s"', $outfile));
$commentarray = array(sprintf("Generated by CandyDollDB v%1\$s on %2\$s at %3\$s", CANDYDOLLDB_VERSION, date('Y-m-d'), date('H:i;s')), sprintf("Author: %1\$s", $CurrentUser->getUserName()), "Project website: https://code.google.com/p/candydolldb/");
$commentcount = count($commentarray);
$x = 0;
/* @var $Model Model */
foreach ($Models as $Model) {
    if ($ModelID && $Model->getID() !== $ModelID) {
        continue;
    }
    $SetsThisModel = Set::Filter($Sets, $Model->getID());
    if ($SetsThisModel) {
        /* @var $Set Set */
        foreach ($SetsThisModel as $Set) {
            $ImagesThisSet = Image::GetImages(new ImageSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
            if ($ImagesThisSet) {
                /* @var $Image Image */
                foreach ($ImagesThisSet as $Image) {
                    if (Utils::_empty($Image->getFileCRC32())) {
                        continue;
                    }
                    printf("%1\$s,%2\$s,%3\$s,\\%4\$s\\,%5\$s%6\$s", $Image->getExportFilename(), $Image->getFileSize(), $Image->getFileCRC32(), str_replace(CANDYPATH . DIRECTORY_SEPARATOR, '', dirname($Image->getFilenameOnDisk())), $x <= $commentcount - 1 ? $commentarray[$x] . "," : NULL, PHP_EOL);
                    $x++;
                }
            }
            $VideosThisSet = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
开发者ID:laiello,项目名称:candydolldb,代码行数:31,代码来源:download_csv.php

示例3: foreach

 }
 if ($Model2Process->getID()) {
     Model::Update($Model2Process, $CurrentUser);
 } else {
     Model::Insert($Model2Process, $CurrentUser);
 }
 $modeltags = Tag::GetTagArray((string) $Model->attributes()->tags);
 $Tag2AllThisModel = Tag2All::Filter($Tag2AllsInDB, NULL, $Model2Process->getID(), FALSE, FALSE, FALSE);
 $Tag2AllThisModelOnly = Tag2All::Filter($Tag2AllThisModel, NULL, $Model2Process->getID(), NULL, NULL, NULL);
 Tag2All::HandleTags($modeltags, $Tag2AllThisModelOnly, $TagsInDB, $CurrentUser, $Model2Process->getID(), NULL, NULL, NULL, FALSE);
 if (!$Model->Sets) {
     continue;
 }
 $DatesThisModel = Date::FilterDates($DatesInDb, NULL, $Model2Process->getID(), NULL, NULL, NULL);
 foreach ($Model->Sets->Set as $Set) {
     $SetInDb = Set::Filter($SetsInDb, $Model2Process->getID(), NULL, preg_replace('/^SP_/i', '', (string) $Set->attributes()->name));
     if ($SetInDb) {
         $SetInDb = $SetInDb[0];
     }
     /* @var $Set2Process Set */
     $Set2Process = $SetInDb ? $SetInDb : new Set();
     $Set2Process->setModel($Model2Process);
     if ($Set2Process->getModel()->getFirstName() == 'VIP') {
         $Set2Process->setPrefix('SP_');
         $Set2Process->setName(preg_replace('/^SP_/i', '', (string) $Set->attributes()->name));
     } else {
         if ($Set2Process->getModel()->getFirstName() == 'Interviews') {
             $Set2Process->setPrefix('In_');
             $Set2Process->setName((string) $Set->attributes()->name);
         } else {
             if ($Set2Process->getModel()->getFirstName() == 'Promotions') {
开发者ID:laiello,项目名称:candydolldb,代码行数:31,代码来源:setup_data.php

示例4: DateSearchParameters

 $SetVidCount = 0;
 $DirtySetCount = 0;
 $DirtySetPicCount = 0;
 $DirtySetVidCount = 0;
 $Dates = Date::GetDates(new DateSearchParameters(FALSE, FALSE, FALSE, FALSE, $Model->getID()));
 if ($Dates) {
     $datestart = Date::SmallestDate($Dates);
     $datestartshow = date($CurrentUser->getDateFormat(), $datestart->getTimeStamp());
     $dateend = Date::LargestDate($Dates);
     $dateendshow = date($CurrentUser->getDateFormat(), $dateend->getTimeStamp());
 } else {
     $datestartshow = NULL;
     $dateendshow = NULL;
 }
 /* @var $Set Set */
 foreach (Set::Filter($Sets, $Model->getID()) as $Set) {
     $SetCount++;
     if ($Set->getSetIsDirty()) {
         if ($Set->getSetIsDirtyPic()) {
             $DirtySetPicCount++;
         }
         if ($Set->getSetIsDirtyVid()) {
             $DirtySetVidCount++;
         }
         $DirtySetCount++;
     }
     if (($Set->getContainsWhat() & SET_CONTENT_IMAGE) > 0) {
         $SetPicCount++;
     }
     if (($Set->getContainsWhat() & SET_CONTENT_VIDEO) > 0) {
         $SetVidCount++;
开发者ID:laiello,项目名称:candydolldb,代码行数:31,代码来源:index.php

示例5: XmlOutputModel

function XmlOutputModel($Model, $TaggedOnly)
{
    global $xmlw, $Sets, $Dates, $Tag2Alls, $IncludeImages, $IncludeVideos;
    $xmlw->startElement('Model');
    $xmlw->writeAttribute('firstname', $Model->getFirstName());
    $xmlw->writeAttribute('lastname', $Model->getLastName());
    $xmlw->writeAttribute('birthdate', $Model->getBirthdate() > 0 ? date('Y-m-d', $Model->getBirthdate()) : NULL);
    $TagsThisModel = Tag2All::Filter($Tag2Alls, NULL, $Model->getID(), FALSE, FALSE, FALSE);
    $TagsThisModelOnly = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), NULL, NULL, NULL);
    $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisModelOnly));
    $SetsThisModel = Set::Filter($Sets, $Model->getID());
    if ($SetsThisModel) {
        $xmlw->startElement('Sets');
        $DatesThisModel = Date::FilterDates($Dates, NULL, $Model->getID());
        if ($Model->getFirstName() == 'VIP') {
            usort($SetsThisModel, array('Set', 'CompareASC'));
        }
        foreach ($SetsThisModel as $Set) {
            $PicDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_IMAGE);
            $VidDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_VIDEO);
            $TagsThisSet = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), NULL, NULL);
            $xmlw->startElement('Set');
            if ($Model->getFirstName() == 'VIP' && !is_numeric($Set->getName())) {
                $xmlw->writeAttribute('name', sprintf('SP_%1$s', $Set->getName()));
            } else {
                $xmlw->writeAttribute('name', $Set->getName());
            }
            $xmlw->writeAttribute('date_pic', Date::FormatDates($PicDatesThisSet, 'Y-m-d', FALSE, ' '));
            $xmlw->writeAttribute('date_vid', Date::FormatDates($VidDatesThisSet, 'Y-m-d', FALSE, ' '));
            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisSet));
            if ($IncludeImages) {
                $ImagesThisSet = Image::GetImages(new ImageSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
                if ($ImagesThisSet) {
                    $xmlw->startElement('Images');
                    /* @var $Image Image */
                    foreach ($ImagesThisSet as $Image) {
                        $TagsThisImage = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), $Image->getID(), NULL);
                        if ($TaggedOnly === TRUE && $TagsThisImage || $TaggedOnly === FALSE) {
                            $xmlw->startElement('Image');
                            $xmlw->writeAttribute('name', $Image->getFileName());
                            $xmlw->writeAttribute('extension', $Image->getFileExtension());
                            $xmlw->writeAttribute('filesize', $Image->getFileSize());
                            $xmlw->writeAttribute('height', $Image->getImageHeight());
                            $xmlw->writeAttribute('width', $Image->getImageWidth());
                            $xmlw->writeAttribute('checksum', $Image->getFileCheckSum());
                            $xmlw->writeAttribute('crc32', $Image->getFileCRC32());
                            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisImage));
                            $xmlw->endElement();
                        }
                    }
                    $xmlw->endElement();
                    $xmlw->flush();
                    ob_flush();
                    flush();
                    unset($ImagesThisSet);
                }
            }
            if ($IncludeVideos) {
                $VideosThisSet = Video::GetVideos(new VideoSearchParameters(FALSE, FALSE, $Set->getID(), FALSE, $Model->getID()));
                if ($VideosThisSet) {
                    $xmlw->startElement('Videos');
                    /* @var $Video Video */
                    foreach ($VideosThisSet as $Video) {
                        $TagsThisVideo = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), NULL, $Video->getID());
                        if ($TaggedOnly === TRUE && $TagsThisVideo || $TaggedOnly === FALSE) {
                            $xmlw->startElement('Video');
                            $xmlw->writeAttribute('name', $Video->getFileName());
                            $xmlw->writeAttribute('extension', $Video->getFileExtension());
                            $xmlw->writeAttribute('filesize', $Video->getFileSize());
                            $xmlw->writeAttribute('checksum', $Video->getFileCheckSum());
                            $xmlw->writeAttribute('crc32', $Video->getFileCRC32());
                            $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisVideo));
                            $xmlw->endElement();
                        }
                    }
                    $xmlw->endElement();
                    $xmlw->flush();
                    ob_flush();
                    flush();
                    unset($VideosThisSet);
                }
            }
            $xmlw->endElement();
        }
        $xmlw->endElement();
        $xmlw->flush();
        ob_flush();
        flush();
        if ($Model->getRemarks()) {
            $xmlw->startElement('Remarks');
            $xmlw->text($Model->getRemarks());
            $xmlw->endElement();
        }
    }
    $xmlw->endElement();
    $xmlw->flush();
    ob_flush();
    flush();
}
开发者ID:laiello,项目名称:candydolldb,代码行数:99,代码来源:download_xml.php

示例6: XmlOutputModel

 function XmlOutputModel($Model)
 {
     global $xmlw, $Sets, $Dates, $Tag2Alls, $IncludeImages, $IncludeVideos;
     $xmlw->startElement('Model');
     $xmlw->writeAttribute('firstname', $Model->getFirstName());
     $xmlw->writeAttribute('lastname', $Model->getLastName());
     $xmlw->writeAttribute('birthdate', $Model->getBirthdate() > 0 ? date('Y-m-d', $Model->getBirthdate()) : NULL);
     $TagsThisModel = Tag2All::Filter($Tag2Alls, NULL, $Model->getID(), FALSE, FALSE, FALSE);
     $TagsThisModelOnly = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), NULL, NULL, NULL);
     $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisModelOnly));
     $SetsThisModel = Set::Filter($Sets, $Model->getID());
     if ($SetsThisModel) {
         $xmlw->startElement('Sets');
         $DatesThisModel = Date::FilterDates($Dates, NULL, $Model->getID());
         if ($Model->getFirstName() == 'VIP') {
             usort($SetsThisModel, array('Set', 'CompareASC'));
         }
         foreach ($SetsThisModel as $Set) {
             $PicDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_IMAGE);
             $VidDatesThisSet = Date::FilterDates($DatesThisModel, NULL, NULL, $Set->getID(), DATE_KIND_VIDEO);
             $TagsThisSet = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), $Set->getID(), NULL, NULL);
             $xmlw->startElement('Set');
             if ($Model->getFirstName() == 'VIP' && !is_numeric($Set->getName())) {
                 $xmlw->writeAttribute('name', sprintf('SP_%1$s', $Set->getName()));
             } else {
                 $xmlw->writeAttribute('name', $Set->getName());
             }
             $xmlw->writeAttribute('date_pic', Date::FormatDates($PicDatesThisSet, 'Y-m-d', FALSE, ' '));
             $xmlw->writeAttribute('date_vid', Date::FormatDates($VidDatesThisSet, 'Y-m-d', FALSE, ' '));
             $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisSet));
             $xmlw->endElement();
         }
         $xmlw->endElement();
         $xmlw->flush();
         ob_flush();
         flush();
         if ($Model->getRemarks()) {
             $xmlw->startElement('Remarks');
             $xmlw->text($Model->getRemarks());
             $xmlw->endElement();
         }
     }
     $xmlw->endElement();
     $xmlw->flush();
     ob_flush();
     flush();
 }
开发者ID:laiello,项目名称:candydolldb,代码行数:47,代码来源:compose_xml.php


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