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


PHP RSS::add方法代码示例

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


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

示例1: thumb

 public static function thumb($file)
 {
     require_once dirname(__FILE__) . '/../phpthumb/phpthumb.class.php';
     $path = File::r2a(File::a2r($file), Settings::$thumbs_dir);
     // We check that the thumb already exists, was created after the image, at the right size
     $goodThumb = false;
     if (file_exists($path) && filectime($file) < filectime($path)) {
         $dim = getimagesize($path);
         $goodThumb = $dim[0] == Settings::$thumbs_size && $dim[1] == Settings::$thumbs_size;
     }
     /// If we need to create a thumb, then this is a new picture
     if (!$goodThumb) {
         if (Judge::is_public($file)) {
             $r = new RSS(Settings::$conf_dir . "/photos_feed.txt");
             $webpath = Settings::$site_address . "?f=" . urlencode(File::a2r($file));
             $r->add(basename($file), $webpath, "<img src='{$webpath}&t=Thb' />");
         }
         /// Create directories
         if (!file_exists(dirname($path))) {
             @mkdir(dirname($path), 0750, true);
         }
         /// Create thumbnail
         $thumb = new phpthumb();
         if (!empty(Settings::$imagemagick_path)) {
             $thumb->config_imagemagick_path = Settings::$imagemagick_path;
         }
         $thumb->setSourceData(file_get_contents($file));
         $thumb->CalculateThumbnailDimensions();
         $thumb->w = Settings::$thumbs_size;
         $thumb->h = Settings::$thumbs_size;
         $thumb->zc = Settings::$thumbs_size;
         $thumb->q = Settings::$quality_mini;
         if (File::Type($file) == 'Image' && Provider::get_orientation_degrees($file) != 0) {
             $thumb->SourceImageToGD();
             //$thumb->ra = Provider::get_orientation_degrees($file);
             $thumb->Rotate();
         }
         $thumb->GenerateThumbnail();
         $thumb->RenderToFile($path);
         chmod($path, 0775);
     }
     /* Implementation of webp... for later.
        $webp = $path.".webp";
        if(!file_exists($webp) ||  filectime($webp) < filectime($path) ){
            imagewebp(imagecreatefromjpeg($path),$webp);
        } */
     return $path;
 }
开发者ID:remyhonig,项目名称:PhotoShow,代码行数:48,代码来源:Provider.php

示例2: RSS

function RSS($id = null, PDO $db = null)
{
    if (!$db) {
        global $db;
    }
    $q = is_numeric($id) ? 'ID=' . $id : 'auto=1';
    $all = $db->query('SELECT ID,name,dsc,url,lang,num FROM ' . PRE . 'rss WHERE ' . $q)->fetchAll(3);
    foreach ($all as $x) {
        require_once './lib/rss.php';
        $rss = new RSS();
        $rss->title = $x[1];
        $rss->desc = $x[2];
        $rss->link = $x[3];
        $rss->base = URL;
        #Pobierz ostatnie nowości
        $q = $db->query('SELECT i.ID,i.name,i.date,i.txt,i.opt,c.name as cat FROM ' . PRE . 'news i JOIN ' . PRE . 'cats c ON i.cat=c.ID WHERE i.access=1 AND
		(c.access=1 OR c.access="' . $x[4] . '") ORDER BY i.ID DESC LIMIT ' . $x[5]);
        foreach ($q as $item) {
            $rss->add(array('ID' => $item['ID'], 'title' => $item['name'], 'text' => $item['opt'] & 1 ? nl2br($item['txt']) : $item['txt'], 'cat' => $item['cat'], 'date' => date('r', strtotime($item['date'] . ' UTC')), 'url' => URL . url('news/' . $item['ID'])));
        }
        $rss->save('rss/' . $x[0] . '.xml');
    }
}
开发者ID:BGCX067,项目名称:f3site-svn-to-git,代码行数:23,代码来源:categories.php


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