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


PHP text_summary函数代码示例

本文整理汇总了PHP中text_summary函数的典型用法代码示例。如果您正苦于以下问题:PHP text_summary函数的具体用法?PHP text_summary怎么用?PHP text_summary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: handleDocumentInfo

 function handleDocumentInfo($DocInfo)
 {
     $this->urls_processed[$DocInfo->http_status_code][] = $DocInfo->url;
     if (200 != $DocInfo->http_status_code) {
         return;
     }
     $nid = db_select('field_data_field_sitecrawler_url', 'fdfsu')->fields('fdfsu', array('entity_id'))->condition('fdfsu.field_sitecrawler_url_url', $DocInfo->url)->execute()->fetchField();
     if (!!$nid) {
         $node = node_load($nid);
         $this->nodes_updated++;
     } else {
         $node = new stdClass();
         $node->type = 'sitecrawler_page';
         node_object_prepare($node);
         $this->nodes_created++;
     }
     $node->title = preg_match('#<head.*?<title>(.*?)</title>.*?</head>#is', $DocInfo->source, $matches) ? $matches[1] : $DocInfo->url;
     $node->language = LANGUAGE_NONE;
     $node->field_sitecrawler_url[$node->language][0]['title'] = $node->title;
     $node->field_sitecrawler_url[$node->language][0]['url'] = $DocInfo->url;
     //     $node->field_sitecrawler_summary[$node->language][0]['value'] =
     // drupal_set_message('<pre style="border: 1px solid red;">body_xpaths: ' . print_r($this->body_xpaths,1) . '</pre>');
     $doc = new DOMDocument();
     $doc->loadHTML($DocInfo->source);
     foreach ($this->body_xpaths as $body_xpath) {
         $xpath = new DOMXpath($doc);
         // $body = $xpath->query('/html/body');
         // $body = $xpath->query('//div[@id="layout"]');
         $body = $xpath->query($body_xpath);
         if (!is_null($body)) {
             foreach ($body as $i => $element) {
                 $node_body = $element->nodeValue;
                 if (!empty($node_body)) {
                     break 2;
                 }
             }
         }
     }
     if (empty($node_body)) {
         $node_body = preg_match('#<body.*?>(.*?)</body>#is', $DocInfo->source, $matches) && !empty($matches[1]) ? $matches[1] : $DocInfo->source;
     }
     $node_body = mb_check_encoding($node_body, 'UTF-8') ? $node_body : utf8_encode($node_body);
     $node->body[$node->language][0]['value'] = $node_body;
     $node->body[$node->language][0]['summary'] = text_summary($node_body);
     $node->body[$node->language][0]['format'] = filter_default_format();
     // store the Drupal crawler ID from the opensanmateo_sitecrawler_sites table
     $node->field_sitecrawler_id[$node->language][0]['value'] = $this->crawler_id;
     // store the PHPCrawler ID for this pull of the site
     $node->field_sitecrawler_instance_id[$node->language][0]['value'] = $this->getCrawlerId();
     node_save($node);
     $this->{'nodes_' . (!!$nid ? 'updated' : 'created')}[$node->nid] = $node->title . ' :: ' . $DocInfo->url;
 }
开发者ID:anselmbradford,项目名称:OpenSanMateo,代码行数:52,代码来源:SiteCrawler.class.php

示例2: adopted_preprocess_page

function adopted_preprocess_page(&$vars)
{
    if (isset($vars['main_menu'])) {
        $vars['main_menu'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['main_menu'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['secondary_menu'] = FALSE;
    }
    if (!empty($vars['node'])) {
        $node = $vars['node'];
        $og_title = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $node->title));
        $keyword = array('#tag' => 'meta', '#attributes' => array('name' => 'keywords', 'content' => $node->title));
        drupal_add_html_head($og_title, 'og_title');
        drupal_add_html_head($keyword, 'keyword');
        if ($node->type == 'article' || $node->type == 'article') {
            $img = field_get_items('node', $vars['node'], 'field_image');
            $img_url = file_create_url($img[0]['uri']);
            $og_image = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => $img_url));
            drupal_add_html_head($og_image, 'og_image');
        }
        if ($node->type == 'product') {
            $img = $node->field_product_images['und'][0]['uri'];
            $img_url = file_create_url($img);
            $og_image = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => $img_url));
            drupal_add_html_head($og_image, 'og_image');
        }
        $body_field = field_view_field('node', $vars['node'], 'body', array('type' => 'full_html'));
        $body_field_stripped = strip_tags($body_field[0]['#markup']);
        // remove html element, so facebook post clear.
        $og_description = array('#tag' => 'meta', '#attributes' => array('property' => 'og:description', 'content' => text_summary($body_field_stripped)));
        drupal_add_html_head($og_description, 'og_description');
    }
}
开发者ID:akhmad-sa,项目名称:adopted,代码行数:37,代码来源:template.php

示例3: build_new_node

 private function build_new_node($CTname, $elem)
 {
     $node = new stdClass();
     $node->type = $CTname;
     node_object_prepare($node);
     $node->title = $CTname;
     $node->language = 'it';
     $node->uid = $elem['uid'];
     $body_text = '';
     $node->body[$node->language][0]['value'] = '';
     $node->body[$node->language][0]['summary'] = text_summary($body_text);
     $node->body[$node->language][0]['format'] = 'filtered_html';
     $path = 'content/programmatically_created_node_' . date('YmdHis');
     $node->path = array('alias' => $path);
     $node->title = 'pagamento cliente';
     /**
      * custom  
      */
     $node = $this->set_CT_data($node, $elem);
     /**/
     node_save($node);
     $result = $node->nid;
     return $result;
 }
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:24,代码来源:pagamenti_cliente.php

示例4: organisation

<p><strong>Any data you enter on this demo site is "publicly available" due to the open login. Please do not enter real email addresses or other personal information.</strong> The demo database is reset periodically.</p>

<h3>New to CiviHR?</h3>
 CiviHR will be developed in multiple phases. So far it comprises of the following functionality:
<ul>
<li>Directory - a listing of the people who work for an organisation (paid and unpaid)
 <li>Staff Contact Details</li>
 <li>Identification</li>
 <li>Medical & Disability</li>
 <li>Visas & Work Permits</li>
 <li>Emergency Contacts</li>
 <li>Job Positions & Job Roles</li>
 <li>Skills & Qualifications</li>
 <li>Education & Employment History</li>
 <li>Simple Remuneration Recording</li>
 <li>Recording of Leave and Absences</li>
 <li>Workflows to manage Joining, Probation and Exiting</li>
 <li>Recruitment with an online job application process</li>
</ul>

For more information, please post your queries on the <strong><a href="http://forum.civicrm.org/index.php/board,87.0.html" target="_blank">CiviHR forum board</a></strong>. To stay updated about new developments in CiviHR, please subscribe to the <strong><a href="https://civicrm.org/civicrm-blog-categories/civihr" target="_blank" title="CiviHR Blog - opens in a new window">CiviHR blog</a></strong>.

Want to install your own copy of CiviHR? <a href="https://civicrm.org/extensions/civihr" target="_blank">Information about downloading and installation can be found here</a>.
';
// <h3>This is the development sandbox</h3>
// This sandbox represents the upcoming release - a work-in-progress. Unless you are interested in tracking development real-time, you might prefer to <a href="http://civihr.demo.civicrm.org/">explore CiviHR\'s current capabilities using the stable demo</a>.</p>
$node->body[$node->language][0]['summary'] = text_summary($node->body[$node->language][0]['value']);
$node->body[$node->language][0]['format'] = 'filtered_html';
$node->path = array('alias' => 'welcome');
node_save($node);
开发者ID:jaapjansma,项目名称:civicrm-buildkit,代码行数:30,代码来源:install-welcome.php

示例5: preRenderSummary

 /**
  * Pre-render callback: Renders a processed text element's #markup as a summary.
  *
  * @param array $element
  *   A structured array with the following key-value pairs:
  *   - #markup: the filtered text (as filtered by filter_pre_render_text())
  *   - #format: containing the machine name of the filter format to be used to
  *     filter the text. Defaults to the fallback format. See
  *     filter_fallback_format().
  *   - #text_summary_trim_length: the desired character length of the summary
  *     (used by text_summary())
  *
  * @return array
  *   The passed-in element with the filtered text in '#markup' trimmed.
  *
  * @see filter_pre_render_text()
  * @see text_summary()
  */
 public static function preRenderSummary(array $element)
 {
     $element['#markup'] = text_summary($element['#markup'], $element['#format'], $element['#text_summary_trim_length']);
     return $element;
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:23,代码来源:TextTrimmedFormatter.php

示例6: base_path

        echo base_path() . 'sites/default/files/styles/large/public/field/image/' . $node->field_image['und'][0]['filename'];
    } else {
        echo base_path() . 'sites/all/themes/aae_theme/img/journal_bg.png';
    }
    ?>
');"></div>
     <div class="jEntryContent large-8 small-9 right columns">
      <h3><a href="<?php 
    echo $url;
    ?>
"><?php 
    echo $node->title;
    ?>
</a></h3>
      <div class="summary"><?php 
    echo preg_replace('/<h[1-6]>(.*?)<\\/h[1-6]>/', '<p>$1</p>', text_summary($node->body['und'][0]['value'], 'filtered_html', 200));
    ?>
      <p><a href="<?php 
    echo $url;
    ?>
" title="<?php 
    echo t('Weiterlesen');
    ?>
"><?php 
    echo t('Weiterlesen');
    ?>
...</a></p></div>
     </div>
    </div><!-- /.article -->

    <div class="jFooter large-12 columns">
开发者ID:JuliAne,项目名称:easteasteast,代码行数:31,代码来源:journal_latest_posts.tpl.php

示例7: format_date

print $user_picture;
?>

        <div class="node-date-author">
        <?php 
print format_date($created, 'short') . ' / ' . $name . ' / &nbsp;';
?>
        </div>
        <?php 
if ($content['field_comunicado_etiquetas']) {
    print render($content['field_comunicado_etiquetas']);
}
?>
        <div class="full-view-node-teaser">
        <?php 
print render(text_summary($node->body['und'][0]['safe_value'], NULL, 300));
?>
        </div>

    <div class="node-content"<?php 
print $content_attributes;
?>
>
      <?php 
// Hide comments and links and render them later.
hide($content['comments']);
hide($content['links']);
print render($content);
?>
    </div>
开发者ID:satpdius,项目名称:websat,代码行数:30,代码来源:node--comunicado.tpl.php

示例8: createDrupalCT

 protected function createDrupalCT($CTname)
 {
     $body_text = 'nodo parkauto';
     $node = new stdClass();
     $node->type = $CTname;
     node_object_prepare($node);
     $node->title = "{$this->rs_parkauto['rc_cognome_cliente']}  {$this->rs_parkauto['rc_nome_cliente']}";
     $node->language = 'it';
     $node->uid = $this->user->uid;
     // Da modificare
     $node->body[$node->language][0]['value'] = $body_text;
     $node->body[$node->language][0]['summary'] = text_summary($body_text);
     $node->body[$node->language][0]['format'] = 'filtered_html';
     $path = 'content/programmatically_created_node_' . date('YmdHis');
     $node->path = array('alias' => $path);
     /**
      * custom  
      */
     $node = $this->set_CT_data($node);
     /**/
     node_save($node);
     $result = $node->nid;
     if ($result) {
         $this->save_servizi_opzionali($node->nid);
         $this->ar_pagamenti_effettuati['nid_parkaauto'] = $node->nid;
         $this->pagamenti_cliente->save($this->ar_pagamenti_effettuati);
     }
     return $result;
 }
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:29,代码来源:parkauto.php

示例9: save

 /**
  * Saves the current node object. Creates a new Drupal node in the database if 
  * one does not already exist.
  * 
  * @access public
  * @return void
  */
 public function save()
 {
     ##
     ## Create or retrieve raw node object to edit
     $editNode = $this->nid && $this->raw_node ? $this->raw_node : new stdClass();
     if (!isset($editNode->type) || $editNode->type != $this->machine_name) {
         $editNode->type = $this->machine_name;
     }
     ##
     ## Set all annotated properties
     foreach (array_keys(get_object_vars($this)) as $property) {
         $reflectedProperty = new ReflectionAnnotatedProperty(get_class($this), $property);
         if ($reflectedProperty->hasAnnotation('NodeProperties')) {
             $nodeProperties = $reflectedProperty->getAnnotation('NodeProperties');
             self::set($editNode->{$nodeProperties->name}, $nodeProperties->property_type, $nodeProperties->cardinality, $this->{$property});
         }
     }
     ##
     ## Set node defaults
     $editNode->title = $this->title;
     $editNode->language = isset($editNode->language) && strlen($editNode->language) ? $editNode->language : 'und';
     ##
     ## Set node body
     $editNode->body['und'][0]['value'] = $this->body;
     $editNode->body['und'][0]['summary'] = text_summary($this->body, NULL, 100);
     $editNode->body['und'][0]['format'] = 'full_html';
     ##
     ## Save to DB
     node_object_prepare($editNode);
     node_save($editNode);
     ##
     ## Set nid and raw node, in the event that this is a newly created node
     $this->nid = $editNode->nid;
     $this->raw_node = node_load($this->nid);
     $this->uri = '/' . drupal_get_path_alias("node/{$this->nid}");
 }
开发者ID:rybosome,项目名称:doodal,代码行数:43,代码来源:class.Node.php

示例10: fhd_core_type_pluralizer

<div class="block">
  <h2><?php 
print fhd_core_type_pluralizer($nodes[0]->type);
?>
</h2>
<?php 
$count = 1;
$length = count($nodes);
foreach ($nodes as $node) {
    print "<article class='tagged-content'>";
    print "<h1>" . l($node->title, 'node/' . $node->nid) . "</h1>";
    print text_summary($node->body['und'][0]['safe_value'], NULL, 1200);
    print "<span class='read-more'>" . l(t('Read more') . " &#8594;", 'node/' . $node->nid, array('html' => TRUE)) . "</span>";
    print "</article>";
    // Add a dividing line between rows unless we're at the end.
    if ($count % 2 === 0 && $length - $count !== 0) {
        print "<div class='clear-both'></div>";
    }
    $count++;
}
?>
</div>
开发者ID:KyleAMathews,项目名称:Family-History-Distro-features,代码行数:22,代码来源:fhd_person_mapping_tagged_block.tpl.php

示例11: entity_get_field_formatted_text_trim

 public static function entity_get_field_formatted_text_trim($entity, $fieldname, $index = 0)
 {
     $text = self::entity_get_field_value($entity, $fieldname, $index);
     $format = self::entity_get_field_value($entity, $fieldname, $index, 'format');
     $r = strip_tags(text_summary($text, $format));
     return $r;
 }
开发者ID:318io,项目名称:318-io,代码行数:7,代码来源:WG.php

示例12: summary

 /**
  * Gets a summary of the contents to a specified length.
  *
  * @param int $length The length to use. Defaults to null (Drupal default).
  *
  * @return string
  */
 public function summary($length = null)
 {
     return text_summary($this->safe_value, $this->format, $length);
 }
开发者ID:ryne-andal,项目名称:ablecore,代码行数:11,代码来源:LongTextFieldValue.php

示例13: setPurchaseItems

 /**
  * Perform a Purchase Items query call to Amazon API.
  *
  * @param commerce_order $order
  * @internal param $action
  * @return bool|object
  */
 public function setPurchaseItems($order)
 {
     $params = $this->constructParams('SetPurchaseItems');
     $i = 0;
     // Set the expected delivery method for the order.
     $delivery_method = '#default';
     if (isset($order->data['commerce_cba'])) {
         if (isset($order->data['commerce_cba']['express-checkout'])) {
             $delivery_method = '#default';
         } elseif (!empty($order->data['commerce_cba']['shipping'])) {
             $delivery_method = 'shipping';
         } elseif (!empty($order->data['commerce_cba']['billing'])) {
             $delivery_method = 'billing';
         } elseif (!empty($order->data['commerce_cba']['amazon-delivery-address'])) {
             $delivery_method = 'amazon-delivery-address';
         }
     }
     $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
     foreach ($order_wrapper->commerce_line_items as $line_item_wrapper) {
         if (in_array($line_item_wrapper->type->value(), commerce_product_line_item_types())) {
             $product_wrapper = $line_item_wrapper->commerce_product;
             $i++;
             $line_item = $line_item_wrapper->value();
             if (isset($line_item->data['context']) && isset($line_item->data['context']['entity'])) {
                 $entity = entity_load_single($line_item->data['context']['entity']['entity_type'], $line_item->data['context']['entity']['entity_id']);
                 $uri = entity_uri($line_item->data['context']['entity']['entity_type'], $entity);
                 $url = isset($uri['path']) ? url($uri['path'], array('absolute' => 'TRUE')) : '';
                 $wrapper = entity_metadata_wrapper($line_item->data['context']['entity']['entity_type'], $entity);
             }
             $price = commerce_price_wrapper_value($line_item_wrapper, 'commerce_unit_price');
             $unit_amount = commerce_currency_amount_to_decimal($price['amount'], $price['currency_code']);
             $unit_currency_code = $price['currency_code'];
             $base = 'PurchaseItems.PurchaseItem.' . $i . '.';
             $params[$base . 'MerchantItemId'] = $product_wrapper->sku->value();
             $params[$base . 'SKU'] = $product_wrapper->sku->value();
             $params[$base . 'MerchantId'] = $this->merchant_id;
             $params[$base . 'Title'] = substr($product_wrapper->title->value(), 0, 80);
             $params[$base . 'Description'] = !empty($entity->body) ? text_summary($wrapper->body->value->value(), $wrapper->body->format->value(), '1000') : '';
             $params[$base . 'UnitPrice.Amount'] = number_format($unit_amount, 2);
             $params[$base . 'UnitPrice.CurrencyCode'] = $unit_currency_code;
             $params[$base . 'Quantity'] = (int) $line_item_wrapper->quantity->value();
             $params[$base . 'URL'] = isset($url) ? $url : '';
             $params[$base . 'FulfillmentNetwork'] = 'MERCHANT';
             $params[$base . 'ProductType'] = 'PHYSICAL';
             // Add the right delivery method address.
             $params[$base . 'PhysicalProductAttributes.DeliveryMethod.DestinationName'] = $delivery_method;
         }
     }
     // Allow other modules to alter the params on demand.
     drupal_alter('commerce_cba_purchase_items', $params, $order);
     $query = $this->prepareQuery($params);
     return $this->query($query);
 }
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:60,代码来源:amazonAPI.php

示例14: findAndReplaceText

 /**
  * Replacing value for text/text-long/text-plain/text-and-summary
  * 
  * @param $crawler, $field, $field_display
  *   crawler object
  *   field array
  *   field display
  *
  * @return
  *   render crawler object/render markup after replacing value with correct format
  */
 public function findAndReplaceText($crawler, $field, $field_display)
 {
     switch ($field_display['type']) {
         case 'text_default':
         case 'string':
         case 'basic_string':
             $content = $field['content']['value'];
             break;
         case 'text_trimmed':
             $content = text_summary($field['content']['value'], $format = NULL, $field_display['settings']['trim_length']);
             break;
     }
     return $crawler->setInnerHtml($content);
 }
开发者ID:poetic,项目名称:clutch,代码行数:25,代码来源:ClutchBuilder.php

示例15: assertTextSummary

 /**
  * Calls text_summary() and asserts that the expected teaser is returned.
  */
 function assertTextSummary($text, $expected, $format = NULL, $size = NULL)
 {
     $summary = text_summary($text, $format, $size);
     $this->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', array('@actual' => $summary, '@expected' => $expected)));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:8,代码来源:TextSummaryTest.php


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