Esempio n. 1
0
                </tr>
                <?php 
if ($list) {
    ?>
                <?php 
    foreach ($list as $k => $v) {
        ?>
                <tr>
                    <td valign="top"><input type="checkbox" value="<?php 
        echo $v->aid;
        ?>
" name="aid[]" class="action-aid-item select-multi-item" /></td>
                    <td>
                        <div class="image fl">
                            <img src="<?php 
        echo get_article_image($v->aid, 48);
        ?>
" id="article-image-<?php 
        echo $v->aid;
        ?>
"/>
                            <input type="file" id="attach" name="attach" onChange="uploadImageAction(this, <?php 
        echo $v->aid;
        ?>
)" title="单击上传头图" />
                        </div>
                        <div class="article fl">
                            <p class="title">
                                <a href="<?php 
        echo site_url('article/' . $v->aid);
        ?>
Esempio n. 2
0
function display_news($header = 'h2')
{
    ?>
	<?php 
    $options = get_option(THEME_OPTIONS_NAME);
    ?>
	<?php 
    $count = $options['news_max_items'];
    ?>
	<?php 
    $news = get_news(0, $count ? $count : 2);
    ?>
	<?php 
    if (count($news)) {
        ?>
		<<?php 
        echo $header;
        ?>
><a href="<?php 
        echo $news[0]->get_feed()->get_link();
        ?>
"><?php 
        echo $news[0]->get_feed()->get_title();
        ?>
</a></<?php 
        echo $header;
        ?>
>
		<ul class="news">
			<?php 
        foreach ($news as $key => $item) {
            $image = get_article_image($item);
            $first = $key == 0;
            ?>
			<li class="item<?php 
            if ($first) {
                ?>
 first<?php 
            } else {
                ?>
 not-first<?php 
            }
            ?>
">
				<h3 class="title"><a href="<?php 
            echo $item->get_link();
            ?>
" class="ignore-external title"><?php 
            echo $item->get_title();
            ?>
</a></h3>
				<p>
					<a class="image ignore-external" href="<?php 
            echo $item->get_link();
            ?>
">
						<?php 
            if ($image) {
                ?>
						<img src="<?php 
                echo $image;
                ?>
" alt="Feed image for <?php 
                echo $item->get_title();
                ?>
" />
						<?php 
            }
            ?>
					</a>
					<a class="description ignore-external"  href="<?php 
            echo $item->get_link();
            ?>
">
						<?php 
            echo $item->get_description();
            ?>
					</a>
				</p>
				<div class="end"><!-- --></div>
			</li>
			<?php 
        }
        ?>
		</ul>
		<div class="end"><!-- --></div>
	<?php 
    } else {
        ?>
		<p>Unable to fetch news.</p>
	<?php 
    }
}
Esempio n. 3
0
        <?php 
if (empty($list)) {
    ?>
        <p>这个分类暂时没有文章。</p>
        <?php 
} else {
    foreach ($list as $one_page) {
        ?>
        <li class="article-item-89 clearfix">
            <div class="pic fl">
                <a href="<?php 
        echo site_url('article/' . $one_page->aid);
        ?>
">
                <img src="<?php 
        echo get_article_image($one_page->aid);
        ?>
" title="<?php 
        echo $one_page->title;
        ?>
">
                </a>
            </div>
            <div class="article fr">
            <h1 class="title">
            <a href="<?php 
        echo site_url('article/' . $one_page->aid);
        ?>
" title="<?php 
        echo $one_page->title;
        ?>
Esempio n. 4
0
function display_footer_news()
{
    $max_news = get_theme_mod_or_default('news_max_items');
    $items = get_news(0, $max_news);
    $placeholder = get_theme_mod_or_default('news_placeholder_image');
    ob_start();
    ?>
	<div class="footer-news">
	<?php 
    foreach ($items as $key => $item) {
        $image = get_article_image($item);
        ?>
		<a href="<?php 
        echo $item->get_link();
        ?>
">
			<div class="row news-item">
				<div class="col-xs-2 col-sm-4 col-md-3">
					<div class="news-thumbnail">
					<?php 
        if ($image) {
            ?>
						<img class="img-responsive" src="<?php 
            echo $image;
            ?>
" alt="Feed image for <?php 
            echo $item->get_title();
            ?>
">
					<?php 
        } else {
            ?>
						<img class="img-responsive" src="<?php 
            echo $placeholder;
            ?>
" alt="UCF Today">
					<?php 
        }
        ?>
					</div>
				</div>
				<div class="col-xs-10 col-sm-8 col-md-9">
					<div class="news-details">
						<h3><?php 
        echo $item->get_title();
        ?>
</h3>
					</div>
				</div>
			</div>
		</a>
	<?php 
    }
    ?>
	</div>
<?php 
    echo ob_get_clean();
}
Esempio n. 5
0
 public function crop_image_action()
 {
     $x = (int) $this->input->get('x');
     $y = (int) $this->input->get('y');
     $w = (int) $this->input->get('w');
     $h = (int) $this->input->get('h');
     if ($w < 160 or $h < 120) {
         JSON('error', '请选择一个合适的图像区域!');
     }
     $aid = (int) $this->input->get('aid');
     $imagepath = $this->input->get('path', true);
     $imagepath = FCPATH . str_replace(base_url(), '', $imagepath);
     if (empty($imagepath) or @is_file($imagepath) === false) {
         JSON('error', '找不到需要裁切的图片!');
     }
     $imageinfo = pathinfo($imagepath);
     switch ($imageinfo['extension']) {
         case 'jpg':
         case 'jpeg':
             $image = imagecreatefromjpeg($imagepath);
             break;
         case 'png':
             $image = imagecreatefrompng($imagepath);
             break;
         case 'gif':
             $image = imagecreatefromgif($imagepath);
             break;
         default:
             JSON('error', '您上传的文件格式不正确!');
     }
     $copy = $this->_image_crop($image, $x, $y, $w, $h);
     if ($copy === false) {
         JSON('error', '未知错误,请重试!');
     }
     $temppath = FCPATH . $this->_attach_dir . 'article' . DIRECTORY_SEPARATOR . build_dir($aid);
     if (@is_dir($temppath) === false) {
         create_dir($temppath);
     }
     if (@is_writable($temppath) === false) {
         @chmod($temppath, 0777);
     }
     $savepath = $temppath . $aid . '.png';
     imagepng($copy, $savepath);
     imagedestroy($copy);
     $this->load->library('image_lib');
     list($width, $height, $type, $attr) = getimagesize($savepath);
     $array = array(array('w' => 160, 'h' => 120), array('w' => 48, 'h' => 36));
     foreach ($array as $size) {
         if ($width > $size['w'] or $height > $size['h']) {
             $setwidth = $size['w'];
             $setheight = $size['h'];
         } else {
             $setwidth = $width;
             $setheight = $height;
         }
         $config['source_image'] = $savepath;
         $config['new_image'] = $aid . '_' . $size['w'] . '.png';
         $config['height'] = $setheight;
         $config['width'] = $setwidth;
         $this->image_lib->initialize($config);
         $this->image_lib->resize();
     }
     unlink($imagepath);
     unlink($savepath);
     JSON('success', '头图已保存成功!', get_article_image($aid, 48));
 }
Esempio n. 6
0
    <?php 
$this->load->view('site_sidebar');
?>
        <?php 
if ($list) {
    ?>
		<?php 
    foreach ($list as $k => $v) {
        ?>
            <div class="funx-list">
                    <a class="funx-list-item" href="<?php 
        echo site_url('article/' . $v->aid);
        ?>
">
                        <div class="funx-list-item-image" style="background-image: url(<?php 
        echo get_article_image($v->aid);
        ?>
)"></div>
                        <div class="funx-list-item-line">
                            <div class="funx-list-item-title"><?php 
        $title = substring($v->title, 100);
        echo $title;
        ?>
</div>
                            <div class="funx-list-item-summary">被 <?php 
        echo $v->views;
        ?>
 人阅读, 于 <?php 
        echo float_time($v->created);
        ?>
发表</div>
Esempio n. 7
0
function display_news($header = 'h2')
{
    $count = get_theme_mod_or_default('news_max_items');
    $news = get_news(0, $count ? $count : 2);
    ?>
	<?php 
    if (count($news)) {
        ?>
		<<?php 
        echo $header;
        ?>
><a href="<?php 
        echo $news[0]->get_feed()->get_link();
        ?>
"><?php 
        echo $news[0]->get_feed()->get_title();
        ?>
</a></<?php 
        echo $header;
        ?>
>
		<ul class="news">
			<?php 
        foreach ($news as $key => $item) {
            $image = get_article_image($item);
            $first = $key == 0;
            ?>
			<li class="item<?php 
            if ($first) {
                ?>
 first<?php 
            } else {
                ?>
 not-first<?php 
            }
            ?>
">
				<h3 class="title"><a href="<?php 
            echo $item->get_link();
            ?>
" class="ignore-external title"><?php 
            echo $item->get_title();
            ?>
</a></h3>
				<p>
					<a class="image ignore-external" href="<?php 
            echo $item->get_link();
            ?>
">
						<?php 
            if ($image) {
                ?>
						<img src="<?php 
                echo $image;
                ?>
" alt="Feed image for <?php 
                echo $item->get_title();
                ?>
">
						<?php 
            }
            ?>
					</a>
					<a class="description ignore-external"  href="<?php 
            echo $item->get_link();
            ?>
">
						<?php 
            echo $item->get_description();
            ?>
					</a>
				</p>
			</li>
			<?php 
        }
        ?>
		</ul>
	<?php 
    } else {
        ?>
		<p>No news stories found.</p>
	<?php 
    }
}