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


PHP Shineisp_Commons_Utilities::truncate方法代码示例

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


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

示例1: listAction

 public function listAction()
 {
     $NS = new Zend_Session_Namespace('Default');
     $arrSort = array();
     $params = array();
     $page = $this->getRequest()->getParam('page');
     $sort = $this->getRequest()->getParam('sort');
     if (!empty($sort)) {
         $arrSort[] = $this->SortingData($sort);
         $arrSort[] = $sort;
     }
     $page = !empty($page) && is_numeric($page) ? $page : 1;
     $params['search'][] = array('method' => 'andWhere', 'criteria' => "(c.customer_id = ? OR c.parent_id = ?)", 'value' => array($NS->customer['customer_id'], $NS->customer['customer_id']));
     // 		$params['search'][] = array ('method' => 'whereIn', 'criteria' => "o.status_id", 'value' => array(Statuses::id('paid', 'orders'), Statuses::id('complete', 'orders')));
     $data = $this->services->findAll("d.order_id, oid.relationship_id, d.description, CONCAT(dm.domain, '.', ws.tld) as domain, s.status as Status, DATE_FORMAT(d.date_start, '" . settings::getMySQLDateFormat() . "') as Creation_Date, DATEDIFF(d.date_end, CURRENT_DATE) as daysleft, DATE_FORMAT(d.date_end, '" . settings::getMySQLDateFormat() . "') as Expiring_Date, d.product_id", $page, $NS->recordsperpage, $arrSort, $params);
     $data['currentpage'] = $page;
     for ($i = 0; $i < count($data['records']); $i++) {
         $data['records'][$i]['description'] = Shineisp_Commons_Utilities::truncate($data['records'][$i]['description'], 40);
         $data['records'][$i]['daysleft'] = $data['records'][$i]['daysleft'] < 30 ? "<span class='label label-danger'>" . $data['records'][$i]['daysleft'] . "</span>" : "<span class='label label-success'>" . $data['records'][$i]['daysleft'] . "</span>";
     }
     $data['columns'][] = $this->translator->translate('Description');
     $data['columns'][] = $this->translator->translate('Domain');
     $data['columns'][] = $this->translator->translate('Status');
     $data['columns'][] = $this->translator->translate('Creation Date');
     $data['columns'][] = $this->translator->translate('Days left');
     $data['columns'][] = $this->translator->translate('Expiry Date');
     $this->view->mex = $this->getRequest()->getParam('mex');
     $this->view->mexstatus = $this->getRequest()->getParam('status');
     $this->view->title = $this->translator->translate("Services List");
     $this->view->description = $this->translator->translate("List of all your own services subscribed");
     $this->view->service = $data;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:32,代码来源:ServicesController.php

示例2: listAction

 public function listAction()
 {
     $ns = new Zend_Session_Namespace();
     $products = array();
     // get the category uri
     $uri = $this->getRequest()->getParam('q');
     if (!empty($uri)) {
         // Save the path of the user
         $ns->lastcategory = $uri;
         // Get the category information
         $category = $this->categories->getAllInfobyURI($uri);
         if (!empty($category[0])) {
             $this->view->category = $category[0];
             // Get the subcategories
             $this->view->subcategory = ProductsCategories::getbyParentId($category[0]['category_id'], 1, true);
             // Set the Metatag information
             $this->view->headTitle()->prepend($category[0]['name']);
             if (!empty($category[0]['keywords'])) {
                 $this->view->headMeta()->setName('keywords', $category[0]['keywords']);
             }
             if (!empty($category[0]['description'])) {
                 $this->view->headMeta()->setName('description', $category[0]['description'] ? Shineisp_Commons_Utilities::truncate(strip_tags($category[0]['description'])) : '-');
             }
             $this->view->headertitle = $category[0]['name'];
             // Get the products information
             $fields = "pd.productdata_id as productdata_id, \n\t\t\t\t           pd.name as name, \n\t\t\t\t           pd.shortdescription as shortdescription, \n\t\t\t\t           pd.metakeywords as metakeywords, \n\t\t\t\t           pd.metadescription as metadescription, \n\t\t\t\t           p.*, pag.code as groupcode";
             $data = $this->categories->getProductListbyCatUri($uri, $fields, $ns->langid);
             if (!empty($data['records'])) {
                 // Get the media information for each product
                 foreach ($data['records'] as $product) {
                     $product['reviews'] = Reviews::countItems($product['product_id']);
                     $product['attributes'] = ProductsAttributes::getAttributebyProductID($product['product_id'], $ns->langid, true);
                     $products[] = $product;
                 }
                 $this->view->products = $products;
                 $this->view->pager = $data['pager'];
             }
             $this->view->layoutmode = !empty($ns->layoutmode) ? $ns->layoutmode : "list";
             $this->_helper->viewRenderer($ns->layoutmode);
         } else {
             $this->_helper->redirector('index', 'index', 'default');
         }
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:44,代码来源:CategoriesController.php

示例3: pageAction

 public function pageAction()
 {
     $var = $this->getRequest()->getParam('url');
     $ns = new Zend_Session_Namespace();
     $locale = $ns->lang;
     if (!empty($var)) {
         $page = CmsPages::findbyvar($var, $locale);
         if ($page['active'] == false) {
             return $this->_helper->redirector('index', 'index', 'default');
         }
         // Set the Metatag information
         $this->view->headTitle(" | " . $page['title']);
         if (!empty($page['keywords'])) {
             $this->view->headMeta()->setName('keywords', $page['keywords']);
         }
         if (!empty($page['body'])) {
             $this->view->headMeta()->setName('description', $page['body'] ? Shineisp_Commons_Utilities::truncate(strip_tags($page['body'])) : '-');
         }
         $this->view->headertitle = $page['title'];
         // Set the page content
         $this->view->data = $page;
         // Set the subheader
         $this->view->headerdata = $this->CreateSubHeader($page);
     }
     if (!empty($page['xmllayout'])) {
         Shineisp_Commons_Layout::updateLayout($this->view, $page['xmllayout']);
     }
     if (!empty($page['pagelayout'])) {
         $this->getHelper('layout')->setLayout("cms/" . $page['pagelayout']);
     }
     if (!empty($page['layout'])) {
         return $this->_helper->viewRenderer($page['layout']);
     } else {
         return $this->_helper->viewRenderer('1column');
     }
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:36,代码来源:CmsController.php

示例4: Last

 /**
  * List of the last messages attached within the orders, domains, customers detail page
  * 
  * 
  * @param string $attachedto [orders, domains]
  * @param integer $limit
  * @return ArrayObject
  */
 public static function Last($attachedto = "orders", $limit = 5, $delIspReplies = true)
 {
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     $dq = Doctrine_Query::create()->from('Messages m');
     // Adding first the main ID index field
     if ($attachedto == "orders") {
         $dq->select("order_id as id");
         $dq->where("order_id IS NOT NULL");
     } elseif ($attachedto == "domains") {
         $dq->select("domain_id as id");
         $dq->where("domain_id IS NOT NULL");
     }
     // now we can add more fields
     $dq->addSelect("DATE_FORMAT(m.dateposted, '" . Settings::getMySQLDateFormat('dateformat') . " %H:%i:%s') as date, m.message as message");
     if ($delIspReplies) {
         $dq->andWhere("customer_id IS NOT NULL");
     }
     // Sort the items
     $dq->orderBy('m.dateposted desc')->limit($limit);
     $records['data'] = $dq->execute(null, Doctrine::HYDRATE_ARRAY);
     // Strip the html and trucate the message
     for ($i = 0; $i < count($records['data']); $i++) {
         $records['data'][$i]['message'] = Shineisp_Commons_Utilities::truncate(strip_tags($records['data'][$i]['message']), 50, "...", false, true);
     }
     // adding the index reference
     $records['index'] = "id";
     // Create the header table columns
     $records['fields'] = array('date' => array('label' => $translator->translate('Date')), 'message' => array('label' => $translator->translate('Message')));
     return $records;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:38,代码来源:Messages.php

示例5: createTldMenu

 /**
  * Create the tld list
  */
 private function createTldMenu()
 {
     $ns = new Zend_Session_Namespace();
     $items = DomainsTlds::getHighlighted($ns->langid);
     $currency = Shineisp_Registry::get('Zend_Currency');
     $html = "";
     if (!empty($items)) {
         $html = "<li class=\"dropdown\">";
         $html .= '<a class="dropdown-toggle" data-toggle="dropdown" href="#">' . $this->translator->translate('Domains') . '</a>';
         $html .= "<ul class=\"dropdown-menu\">";
         foreach ($items as $item) {
             if (!empty($item['DomainsTldsData'][0]['name'])) {
                 $item['registration_price'] = $currency->toCurrency($item['registration_price'], array('currency' => Settings::findbyParam('currency')));
                 $html .= '<li class="dropdown"><a title="' . Shineisp_Commons_Utilities::truncate(strip_tags($item['DomainsTldsData'][0]['description']), 150, "...", false, true) . '" href="/tlds/' . $item['DomainsTldsData'][0]['name'] . '.html">.<b>' . strtoupper($item['DomainsTldsData'][0]['name']) . "</b> - " . $item['registration_price'] . " (" . $this->translator->translate('Tax excluded') . ")</a></li>";
             }
         }
         $html .= "</ul>";
         $html .= "</li>";
     }
     return $html;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:24,代码来源:Webmenu.php

示例6: fill_content

 /**
  * Prepare the newsletter content
  */
 private static function fill_content()
 {
     $ns = new Zend_Session_Namespace();
     $contents = array();
     // Get all the products
     $contents['products'] = "<ul>";
     $records = Products::getAllHighlighted($ns->idlang);
     foreach ($records as $record) {
         $contents['products'] .= "<b><a href='http://" . $_SERVER['HTTP_HOST'] . "/" . $record['uri'] . ".html'>" . $record['ProductsData'][0]['name'] . "</a></b><p>" . $record['ProductsData'][0]['shortdescription'] . "</p>";
     }
     $contents['products'] .= "</ul>";
     // Get all the cms pages
     $contents['pages'] = "";
     $records = CmsPages::getRssPages($ns->lang);
     foreach ($records as $record) {
         $link = 'http://' . $_SERVER['HTTP_HOST'] . '/cms/' . $record['var'] . '.html';
         $contents['pages'] .= "<p><b><a href='" . $link . "'>" . $record['title'] . "</a></b></p>";
         $contents['pages'] .= Shineisp_Commons_Utilities::truncate($record['body'], 200, "...", false, true);
     }
     $contents['pages'] = str_replace("src=\"/", "src=\"http://" . $_SERVER['HTTP_HOST'] . "/", $contents['pages']);
     return $contents;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:25,代码来源:Newsletters.php

示例7: getListbyCustomerId

 /**
  * getListbyCustomerId
  * Get a list ready for the html select object
  * @return array
  */
 public static function getListbyCustomerId($customer_id, $empty = false, $abbreviation = false)
 {
     $items = array();
     $translations = Shineisp_Registry::getInstance()->Zend_Translate;
     $records = Doctrine_Query::create()->select("ticket_id, DATE_FORMAT(date_open, '" . Settings::getMySQLDateFormat('dateformat') . "') as date_open, subject, s.status as status")->from('Tickets t')->leftJoin('t.Statuses s')->leftJoin('t.Customers c')->where('t.customer_id = ?', $customer_id)->addWhere("c.isp_id = ?", Isp::getCurrentId())->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     if ($empty) {
         $items[] = $translations->translate('Select ...');
     }
     foreach ($records as $c) {
         if ($abbreviation) {
             $subject = Shineisp_Commons_Utilities::truncate($c['subject'], 25);
         } else {
             $subject = $c['subject'];
         }
         $items[$c['ticket_id']] = $c['ticket_id'] . " - " . $c['status'] . " - " . $subject;
     }
     return $items;
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:23,代码来源:Tickets.php


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