/** * 分类列表 */ public function index() { //* 权限验证 */ $site_id = site::id(); Myseo_manage::instance()->update_seo_manage_by_site_id($site_id); if ($site_id == 0) { remind::set('请首先进入所要操作的站点', request::referrer(), 'error'); } $site_id_list = role::check('seo_manage', 0, 0); if (empty($site_id_list)) { remind::set('access denied', request::referrer(), 'error'); } $query_struct = array(); $query_struct = array('where' => array('site_id' => $site_id)); $list_columns = array(array('name' => 'ID', 'column' => 'id', 'class_num' => '1'), array('name' => '分类', 'column' => 'parent_id', 'class_num' => '4'), array('name' => '包含子分类', 'column' => 'is_contain_child', 'class_num' => '3'), array('name' => 'Meta Title', 'column' => 'meta_title', 'class_num' => '5'), array('name' => 'Meta Keywords', 'column' => 'meta_keywords', 'class_num' => '5'), array('name' => 'Meta Description', 'column' => 'meta_description', 'class_num' => '6'), array('name' => '发布时间', 'column' => 'create_timestamp', 'class_num' => '5'), array('name' => '更新时间', 'column' => 'update_timestamp', 'class_num' => '5')); $this->template->content = new View("product/seo_manage_list"); $this->template->content->list_columns = $list_columns; /** * 搜索 */ /* $search_arr = array('site_domain','site_id'); $search_type = $this->input->get('search_type'); $search_value = $this->input->get('search_value'); if($search_value&&$search_type) { if(in_array($search_type,$search_arr)) { $query_struct['like'][$search_type] = $search_value; } }*/ //调用分页 $per_page = controller_tool::per_page(); $this->pagination = new Pagination(array('total_items' => Myseo_manage::instance()->count($query_struct), 'items_per_page' => $per_page)); $orderby = array('update_timestamp' => 'DESC'); $seo_manages = Myseo_manage::instance()->seo_manages($query_struct, $orderby, $per_page, $this->pagination->sql_offset); $request_category = array('where' => array('site_id' => $site_id), 'like' => array(), 'orderby' => array()); $category = Mycategory::instance()->lists($request_category); foreach ($category as $val) { $category_list[$val['id']] = $val; } foreach ($seo_manages as $seo_manages_key => $seo_manages_value) { $seo_manages[$seo_manages_key]['is_contain_child'] = view_tool::get_active_img($seo_manages_value['is_contain_child']); $seo_manages[$seo_manages_key]['meta_description'] = strip_tags(text::limit_words($seo_manages_value['meta_description'], 50)); $seo_manages[$seo_manages_key]['create_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['create_timestamp']); $seo_manages[$seo_manages_key]['update_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['update_timestamp']); if ($seo_manages_value['parent_id'] && array_key_exists($seo_manages_value['parent_id'], $category_list)) { $seo_manages[$seo_manages_key]['parent_id'] = $category_list[$seo_manages_value['parent_id']]['name']; } else { $seo_manages[$seo_manages_key]['parent_id'] = ''; } foreach ($seo_manages_value as $key => $value) { if (!is_numeric($value) && empty($value)) { $seo_manages[$seo_manages_key][$key] = "NULL"; } } } $this->template->content->seo_manages = $seo_manages; }
/** * 列表 */ public function index() { $query_struct = array(); /** * 搜索 */ $search_value = $this->input->get('search_value'); if ($search_value) { $query_struct['where']['mail_category_id'] = $search_value; } //调用分页 $per_page = controller_tool::per_page(); $this->pagination = new Pagination(array('total_items' => Mymail_template::instance()->count($query_struct), 'items_per_page' => $per_page)); $mail_templates = Mymail_template::instance()->mail_templates($query_struct, array('id' => 'DESC'), $per_page, $this->pagination->sql_offset); foreach ($mail_templates as $k => $v) { foreach ($v as $key => $value) { if (!is_numeric($value) && empty($value)) { $mail_templates[$k][$key] = 'NULL'; } } $mail_templates[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $mail_templates[$k]['active_img'] = view_tool::get_active_img($v['active']); } $mail_categories = Mymail_category::instance()->mail_categories(); $this->template->content = new View("manage/mail_template_list"); $this->template->content->mail_templates = $mail_templates; $this->template->content->mail_categories = $mail_categories; }
/** * 列表 */ public function index() { //查询条件 $query_struct = array('orderby' => array('id' => 'DESC')); /* 搜索 */ $search_arr = array('title', 'content'); $search_type = $this->input->get('search_type'); $search_value = $this->input->get('search_value'); if (!empty($search_value) && in_array($search_type, $search_arr)) { $query_struct['like'][$search_type] = $search_value; } $where_view['search_value'] = $search_value; //调用分页 $per_page = controller_tool::per_page(); $query_struct['per_page'] = $per_page; $this->pagination = new Pagination(array('total_items' => Mynotice::instance()->count($query_struct), 'items_per_page' => $per_page)); $query_struct['per_page'] = $this->pagination->sql_offset; $notice = Mynotice::instance()->lists($query_struct); foreach ($notice as $k => $v) { $notice[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $notice[$k]['manager_id'] = Mymanager::instance($v['manager_id'])->get('name'); } //VIEW $this->template->content = new View("manage/notice_list"); $this->template->content->notice = $notice; $this->template->content->where = $where_view; }
/** * 列表 */ public function index() { $mails = Mymail::instance()->mails(); foreach ($mails as $k => $v) { $mails[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30)); $mails[$k]['active_img'] = view_tool::get_active_img($v['active']); } $this->template->content = new View("site/mail_list"); $this->template->content->mails = $mails; }
public function full() { $posts = ORM::factory('feedpost')->{$feed}->where(array('status_id' => 2))->find_all(); $items = array(); foreach ($posts as $item) { $items[] = array("pubDate" => $item->get_date('r'), "title" => $item->title, "description" => text::limit_words($item->text, 200), "item_is_complete" => 1, "link" => "http://" . $_SERVER['HTTP_HOST'] . $item->get_url()); } $channel = array("title" => ORM::factory('setting', 'COMPANY_NAME')->value . " - " . $feed->title, "description" => $feed->description, "link" => "http://" . $_SERVER['HTTP_HOST'] . url::base(), "items" => $items); $rss = new RSS_Writer($channel); echo $rss->get_feed(); }
public function get_snips_public($sql_limit, $sql_offset) { $results = ''; $db = Database::instance(); $query = $db->from('snips')->where(array('private =' => '0'))->limit($sql_limit * 10)->offset($sql_offset)->orderby('date_added', 'DESC')->get(); if ($query) { if ($sql_limit == 1) { $results .= "<ol start='" . $sql_limit . "' class='snipList'>\n"; } else { $results .= "<ol start='" . $sql_limit * 10 . "' class='snipList'>\n"; } foreach ($query as $row) { $results .= "<li>\n"; $timeago = date::timespan(strtotime($row->date_added), time(), "days"); if ($timeago == 0) { $timeago = date::timespan(strtotime($row->date_added), time(), "hours"); $timeago .= " hours"; } else { $timeago .= " days"; } $results .= "<h2>"; $username = $this->db->query("SELECT username FROM users WHERE id = " . $row->user_id . ""); foreach ($username as $row2) { $username = $row2->username; } $results .= "<a href='/home/snip/" . $row->snip_id . "'>" . $row->title . "</a></h2><span class='favLink'><a href=\"#\">Favorite</a></span>" . "submitted " . $timeago . " ago by " . $username . " "; $results .= "<p>"; $results .= "<pre>" . text::limit_words($row->snippet, 10, "...<a href='/home/snip/" . $row->snip_id . "'>see whole snippet</a>") . "</pre>"; if (strlen($row->description) > 1) { $results .= "Description: " . strip_tags(text::limit_words($row->description, 25)); } $results .= "</p>\n"; $results .= "</li>\n"; } $results .= "</ol>\n"; } return $results; }
// Get the first category that this placemarker is assigned to foreach ($item->category as $item_category) { if (!$item_category->category_visible) { continue; } echo "<styleUrl>#category_" . $item_category->id . "</styleUrl>"; break; } ?> <name><![CDATA[<?php echo $item->incident_title; ?> ]]></name> <description> <![CDATA[<?php echo text::limit_words($item->incident_description, 50, "..."); echo "<br /><a href=\"" . url::base() . 'reports/view/' . $item->id . "\">More...</a>"; ?> ]]> </description> <address><![CDATA[<?php echo $item->location->location_name; ?> ]]></address> <Point> <coordinates> <?php echo $item->location->longitude . "," . $item->location->latitude; ?> </coordinates> </Point>
foreach ($products as $v) { ?> <tr id="product_<?php echo !empty($v->id) ? $v->id : uniqid(); ?> "> <td> <a class="product_name" title="Szczegóły" href="<?php echo url::site('products/details.' . $v->id); ?> "><b><?php echo $v->name; ?> </b></a> <p class="description"><?php echo text::limit_words($v->description, 10); ?> </p> </td> <td ><p class="product_name"> <?php echo form::input('product[' . $v->id . ']', $v->unit->type == 'integer' ? (int) $quantity[$v->id] : number_format($quantity[$v->id], 2), array('class' => 'input_width')); ?> <?php echo $v->unit->name; ?> </p></td> <td><p class="product_name"><?php echo number_format($v->price->value * $quantity[$v->id], 2); ?>
<ul> <?php foreach ($comments as $i => $comment) { ?> <li class="<?php echo $i % 2 == 0 ? "gEvenRow" : "gOddRow"; ?> "> <img src="<?php echo $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)); ?> " class="gAvatar" alt="<?php echo $comment->author_name(); ?> " width="32" height="32" /> <?php echo date("Y-M-d H:i:s", $comment->created); ?> <?php echo t("<a href=#>%author_name</a> said <em>%comment_text</em>", array("author_name" => $comment->author_name(), "comment_text" => text::limit_words($comment->text, 50))); ?> </li> <?php } ?> </ul>
?> <Placemark> <?php // Get the first category that this placemarker is assigned to foreach ($item->category as $item_category) { echo "<styleUrl>#category_" . $item_category->id . "</styleUrl>"; break; } ?> <name><?php echo htmlspecialchars($item->incident_title); ?> </name> <description> <?php echo htmlspecialchars(text::limit_words($item->incident_description, 50, "...")); echo "<BR /><a href=\"" . url::base() . 'reports/view/' . $item->id . "\">More...</a>"; ?> </description> <Point> <coordinates><?php echo $item->location->longitude . "," . $item->location->latitude; ?> </coordinates> </Point> </Placemark> <?php } ?> </Document> </kml>
/** * Import a single comment. */ static function import_comment(&$queue) { $g2_comment_id = array_shift($queue); try { $g2_comment = g2(GalleryCoreApi::loadEntitiesById($g2_comment_id)); } catch (Exception $e) { return t("Failed to import Gallery 2 comment with id: %id\\%exception", array("id" => $g2_comment_id, "exception" => $e->__toString())); } $text = $g2_comment->getSubject(); if ($text) { $text .= " "; } $text .= $g2_comment->getComment(); // Just import the fields we know about. Do this outside of the comment API for now so that // we don't trigger spam filtering events $comment = ORM::factory("comment"); $comment->author_id = self::map($g2_comment->getCommenterId()); $comment->guest_name = $g2_comment->getAuthor(); $comment->item_id = self::map($g2_comment->getParentId()); $comment->text = self::_transform_bbcode($text); $comment->state = "published"; $comment->server_http_host = $g2_comment->getHost(); $comment->created = $g2_comment->getDate(); $comment->save(); self::map($g2_comment->getId(), $comment->id); return t("Imported comment '%comment' for item with id: %id", array("id" => $comment->item_id, "comment" => text::limit_words(nl2br(p::purify($comment->text)), 50))); }
<?php defined("SYSPATH") or die("No direct script access."); ?> <ul> <?php foreach ($feed as $entry) { ?> <li> <a href="<?php echo $entry["link"]; ?> "><?php echo $entry["title"]; ?> </a> <p> <?php echo text::limit_words(strip_tags($entry["description"]), 25); ?> </p> </li> <?php } ?> </ul>
echo url::base(); ?> /media/img/x_btn.png" alt="X" align="absmiddle" style="border:0" width="18" /> </a> <?php } else { ?> <?php } ?> </DIV> <?php if (!empty($form[$cat . 'feed_url' . $i])) { $tempfeedurl = text::limit_chars($form[$cat . 'feed_url' . $i], 40, '...', False); $tempfeedurl = text::limit_words($tempfeedurl, 1, '...', True); echo $tempfeedurl; } else { ?> <?php print form::input($cat . 'feed_url' . $i, $form[$cat . 'feed_url' . $i], ' class="text long3" '); ?> <!-- <?php print form::checkbox($cat . 'weight' . $i, $form[$cat . 'weight' . $i], $form[$cat . 'weight' . $i] >= 100 ? TRUE : FALSE, ' class="check-box"'); ?> --> <?php } ?> <input type="hidden" name="<?php echo $cat . "weight_hf" . $i;
public function render($options = null) { if (!$options) { $config = Kohana::config_load('zest'); $options = $config['feedpost.full']; } $array = array("date_format" => 'D jS M Y', "image" => array(250, 250), "image_class" => "", "html" => '<h1>{TITLE}</h1><h2>{DATE}</h2><h3>by {AUTHOR}</h3>{IMAGE}{TEXT}<div class="spacer"> </div>', "template" => '', "word_limit" => 0); $array = arr::overwrite($array, $options); if (isset($array['template']) && $array['template'] != "") { $html = zest::template_to_html('snippets/' . $array['template']); } else { $html = $array['html']; } $html = str_replace('{TITLE}', $this->title, $html); $html = str_replace('{DATE}', date($array['date_format'], strtotime($this->date)), $html); if ($this->media_id > 0) { $html = str_replace('{IMAGE}', $this->media->render_cropped($array['image'][0], $array['image'][1], $array['image_class']), $html); } else { $html = str_replace('{IMAGE}', '', $html); } if (isset($array['word_limit']) && $array['word_limit'] > 0) { $html = str_replace('{TEXT}', text::limit_words(strip_tags($this->text), $array['word_limit']), $html); } else { $html = str_replace('{TEXT}', $this->text, $html); $html = str_replace('{ADD_THIS}', zest::add_this($this->get_url(), $this->title), $html); } $html = str_replace('{LINK}', $this->get_url(), $html); $html = str_replace('{FEED_LINK}', $this->feed->get_url(), $html); $html = str_replace('{FEED_TITLE}', $this->feed->title, $html); $html = str_replace('{AUTHOR}', $this->user->username, $html); if ($this->feed->has_comments()) { $html = str_replace('{COMMENT_FORM}', $this->comment_form(), $html); $comments = $this->get_comments(); $comments_html = "<a name='comments'></a>"; foreach ($comments as $c) { $comments_html .= $c->render(); } if ($comments_html == "") { $comments_html = "<p>No comments have yet been posted. Be the first!</p>"; } $html = str_replace('{COMMENTS}', $comments_html, $html); $com_count = count($comments); switch ($com_count) { case 0: $str = '0 comments'; break; case 1: $str = '1 comment'; break; default: $str = $com_count . ' comments'; break; } $html = str_replace('{COMMENT_COUNT}', $str, $html); } else { $html = str_replace('{COMMENT_FORM}', '', $html); $html = str_replace('{COMMENTS}', '', $html); $html = str_replace('{COMMENT_COUNT}', '', $html); } return $html; }
public function snip($id) { $db = Database::instance(); $id = mysql_real_escape_string($id); $sql = 'SELECT `snip_id`, `user_id`, `language`, `snippet`, `title`, `date_added`, `private`, `description` FROM `snips` WHERE `snip_id` = ' . $id . ' LIMIT 0, 30 '; $result = $db->query($sql); if ($result and $result->count() > 0) { foreach ($result as $row) { $user_id = $row->user_id; $language = $row->language; $snippet = $row->snippet; $title = $row->title; $date_added = $row->date_added; $private = $row->private; $description = $row->description; } if ($private == '1') { // Redirect if no one is logged in and tries to view private snippet if (!is_object($this->user)) { url::redirect('/home/login?loginRequired=1&return_to=home~snip~' . $id); } // Redirect User if they are not the owner of the snippet if ($this->user->id != $user_id) { url::redirect('/home/?forbiddenSnip=1¤tUser='******' <script type="text/javascript" src="/files/syntax/scripts/shCore.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushBash.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushCpp.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushCSharp.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushCss.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushDelphi.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushDiff.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushGroovy.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushJava.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushJScript.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushPhp.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushPlain.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushPowerShell.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushPython.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushRuby.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushScala.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushSql.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushVb.js"></script> <script type="text/javascript" src="/files/syntax/scripts/shBrushXml.js"></script> <link type="text/css" rel="stylesheet" href="/files/syntax/styles/shCore.css"/> <link type="text/css" rel="stylesheet" href="/files/syntax/styles/shThemeDefault.css"/> <script type="text/javascript"> SyntaxHighlighter.config.clipboardSwf = "/files/syntax/scripts/clipboard.swf"; SyntaxHighlighter.all(); jQuery(function($) { $("#dialog").hide(); }); </script>'; $home_nav = new view('home_nav'); $home_nav->highlight = 'none'; $this->template->page_nav = $home_nav; $result = $db->query("SELECT username FROM users WHERE id = " . $user_id . " LIMIT 0, 1"); foreach ($result as $row) { $username = $row->username; } $content = View::factory('snip/snip'); if (is_object($this->user)) { if ($this->user->id != $user_id) { $is_logged_in = "0"; } else { $is_logged_in = "1"; } } else { $is_logged_in = "0"; } $snips_model = new Snip_Model(); $content->username = $username; $content->snipID = $id; $content->is_logged_in = $is_logged_in; $content->user_id = $user_id; $content->brush = $snips_model->lang_to_brush($language); $content->language = $language; $content->title = $title; $content->snippet = $snippet; $content->date_added = $date_added; $content->private = $private; $content->description = $description; $this->template->page_content = $content; } else { throw new Kohana_404_Exception('home/snip/' . $id); } }
<?php defined("SYSPATH") or die("No direct script access."); ?> <ul> <? foreach ($comments as $comment): ?> <li class="<?php echo text::alternate("g-even", "g-odd"); ?> "> <img src="<?php echo $comment->author()->avatar_url(32, $theme->url("images/avatar.jpg", true)); ?> " class="g-avatar" alt="<?php echo html::clean_attribute($comment->author_name()); ?> " width="32" height="32" /> <?php echo gallery::date_time($comment->created); ?> <?php echo t('<a href="#">%author_name</a> said <em>%comment_text</em>', array("author_name" => html::clean($comment->author_name()), "comment_text" => text::limit_words(nl2br(html::purify($comment->text)), 50))); ?> </li> <? endforeach ?> </ul>
$headers = array('Número', 'Orgão', 'Cliente', 'P. Oposta', 'Proceds.', 'Últ. Pcd. Realizado', 'Gaveta', 'Ações'); $headers['sizes'] = array(100); $footers = FALSE; $lines = array(); foreach ($processos as $processo) { $col = array(); $col[] = html::anchor('processos/formulario/' . $processo->id, $processo->numero, array('title' => 'Ver processo: ' . $processo->numero)); $orgao = text::limit_words($processo->orgao->nome, 5, '...'); $attr = array('title' => 'Ver iformações de: ' . $processo->orgao->nome, 'class' => ''); $orgao = html::anchor('orgaos/formulario/' . $processo->orgao->id, $orgao, $attr); $col[] = $orgao; $cliente = text::limit_words($processo->cliente->nome, 3, '...'); $attr = array('title' => 'Ver iformações de: ' . $processo->cliente->nome, 'class' => ''); $cliente = html::anchor('pessoas/formulario/' . $processo->cliente->id, $cliente, $attr); $col[] = $cliente; $p_oposta = text::limit_words($processo->parte_oposta->nome, 3, '...'); $attr = array('title' => 'Ver informações de: ' . $processo->parte_oposta->nome, 'class' => ''); $p_oposta = html::anchor('pessoas/formulario/' . $processo->parte_oposta->id, $p_oposta, $attr); $col[] = $p_oposta; $col[] = $processo->procedimentos->count(); $col[] = date::us2br($processo->ultimo_procedimento_realizado()->data); $armario = html::anchor('#', $processo->gaveta->nome, array('title' => $processo->gaveta->armario->nome . ' >' . $processo->gaveta->nome, 'class' => 'false')); $col[] = $armario; $action_links = html::anchor('processos/formulario/' . $processo->id, 'Ver', array('class' => 'view', 'title' => 'Vizualizar Processo: ' . $processo->numero)); $col[] = $action_links; $lines[] = $col; } echo html::grid($headers, $lines, $footers, $caption); echo $paginacao; } else { $texto = 'Não existem processos com esses parametros.';
/** * Tests the text::limit_words() function. * @dataProvider limit_words_provider * @group core.helpers.text.limit_words * @test */ public function limit_words($str, $limit, $end_char, $expected_result) { $result = text::limit_words($str, $limit, $end_char); $this->assertEquals($expected_result, $result); }
//procedimentos dos processos if ($processo->id) { echo '<h2>Procedimentos do processo ' . html::anchor('procedimentos/formulario/0/' . $processo->id, '[ Adicionar Novo ]') . '</h2>'; if ($processo->procedimentos->count()) { $caption = $processo->procedimentos->count() . ' Procedimento(s) encontrado(s)'; $headers = array('Data', 'Hora', 'Tipo', 'Advogado', 'Observações', 'Realizado', 'Ações'); $headers['sizes'] = array(90, 70, 150, 150, FALSE, 80, 80); $footers = FALSE; $lines = array(); foreach ($processo->procedimentos as $procedimento) { $col = array(); $col[] = date::us2br($procedimento->data); $col[] = $procedimento->hora; $col[] = $procedimento->tipo_procedimento->nome; $col[] = $procedimento->advogado->nome; $col[] = html::anchor('#', text::limit_words($procedimento->observacoes, 6, '...'), array('title' => $procedimento->observacoes, 'class' => 'false')); $col[] = html::image('static/images/icons/flag_' . $procedimento->status . '.gif'); $action_links = html::anchor('procedimentos/formulario/' . $procedimento->id . '/' . $processo->id, 'Ver', array('class' => 'view')); $excluir_title = 'Tem certeza que deseja excluir o procedimento: '; $excluir_title .= $procedimento->tipo_procedimento->nome; $excluir_title .= ' em ' . date::us2br($procedimento->data); $action_links .= html::anchor('procedimentos/excluir/' . $procedimento->id, 'Excluir', array('class' => 'delete', 'title' => $excluir_title)); $col[] = $action_links; $lines[] = $col; } echo html::grid($headers, $lines, $footers, $caption); } else { $texto = 'Não existem procedimentos cadastrados para este processo.'; echo html::message($texto, FALSE); } }