Пример #1
0
 public function store(ArticleRequest $request)
 {
     $requests = $request->all();
     $requests['excerpt'] = $requests['excerpt'] ? $requests['excerpt'] : make_excerpt($requests['body']);
     $article = Auth::user()->articles()->create($requests);
     $this->articles->syncTags($article, $request->tag_list);
     Auth::user()->histories()->create(['type' => 'article', 'content' => '发布文章《<a href="/article/' . $article->id . '" target="_blank">' . $article->title . '</a>》']);
     flash()->message('文章发布成功!');
     return redirect('article/' . $article->id);
 }
Пример #2
0
    foreach ($feed->channel->item as $item) {
        if ($n < $max_news) {
            ?>
								<li>
									<span class="date"><?php 
            echo date(TIMEFORMAT_USE, strtotime($item->pubDate));
            ?>
</span>
									<a href="<?php 
            echo html_output($item->link);
            ?>
" target="_blank">
										<h5><?php 
            echo html_output($item->title);
            ?>
</h5>
									</a>
									<p><?php 
            echo make_excerpt(html_output(strip_tags($item->description, '<br />')), 200);
            ?>
								</li>
						<?php 
            $n++;
        }
    }
    ?>
				</ul>
			</div>
		</div>
<?php 
}
          * Upload types values:
          * 0 - File was uploaded by a client	-> notify admin
          * 1 - File was uploaded by a user		-> notify client/s
          */
         foreach ($found_notifications as $notification) {
             if ($notification['client_id'] == $client['id']) {
                 if ($notification['upload_type'] == '0') {
                     /** Add the file to the account's creator email */
                     $use_id = $notification['file_id'];
                     $notes_to_admin[$client['created_by']][$client['name']][] = array('notif_id' => $notification['id'], 'file_name' => $file_data[$use_id]['filename'], 'description' => make_excerpt($file_data[$use_id]['description'], 200));
                 } elseif ($notification['upload_type'] == '1') {
                     if ($client['notify'] == '1') {
                         if ($client['active'] == '1') {
                             /** If file is uploaded by user, add to client's email body */
                             $use_id = $notification['file_id'];
                             $notes_to_clients[$client['user']][] = array('notif_id' => $notification['id'], 'file_name' => $file_data[$use_id]['filename'], 'description' => make_excerpt($file_data[$use_id]['description'], 200));
                         } else {
                             $notifications_inactive[] = $notification['id'];
                         }
                     }
                 }
             }
         }
     }
 }
 /** Prepare the emails for CLIENTS */
 if (!empty($notes_to_clients)) {
     foreach ($notes_to_clients as $mail_username => $mail_files) {
         /** Reset the files list UL contents */
         $files_list = '';
         foreach ($mail_files as $mail_file) {
Пример #4
0
<?php

return ['title' => lang('Post'), 'single' => lang('Post'), 'model' => 'Post', 'columns' => ['id' => ['title' => 'ID'], 'title' => ['title' => lang('Title')], 'body' => ['title' => lang('Content'), 'sortable' => false, 'output' => function ($value) {
    return make_excerpt($value);
}], 'user_name' => ['title' => lang("Author"), 'relationship' => 'user', 'select' => "(:table).username"], 'category_name' => ['title' => lang("Category"), 'relationship' => 'category', 'select' => "(:table).name"], 'comments_count' => ['title' => 'Comments Count'], 'created_at'], 'edit_fields' => ['title' => ['title' => lang('Title'), 'type' => 'text'], 'category' => array('type' => 'relationship', 'title' => lang('Category'), 'name_field' => 'name')], 'filters' => ['title' => ['title' => lang('Title')]], 'link' => function ($model) {
    return URL::route('posts.edit', $model->id);
}];
$n = 0;
foreach ($feed->channel->item as $item) {
    if ($n < $max_news) {
        ?>
						<li>
							<span class="date"><?php 
        echo date(TIMEFORMAT_USE, strtotime($item->pubDate));
        ?>
</span>
							<a href="<?php 
        echo $item->link;
        ?>
" target="_blank">
								<h5><?php 
        echo $item->title;
        ?>
</h5>
							</a>
							<p><?php 
        echo make_excerpt(strip_tags($item->description, '<br />'), 200);
        ?>
						</li>
				<?php 
        $n++;
    }
}
?>
		</ul>
	</div>
</div>