本文整理汇总了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;
}
示例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');
}
}