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;
 }
Exemplo n.º 2
0
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');
    }
}
Exemplo n.º 3
0
 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;
 }
<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);
Exemplo n.º 5
0
 /**
  * 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;
 }
        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">
Exemplo n.º 7
0
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>
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 /**
  * 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}");
 }
<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>
Exemplo n.º 11
0
Arquivo: WG.php Projeto: 318io/318-io
 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;
 }
Exemplo n.º 12
0
 /**
  * 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);
 }
 /**
  * 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);
 }
Exemplo n.º 14
0
 /**
  * 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);
 }
Exemplo n.º 15
0
 /**
  * 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)));
 }
list($field) = field_get_items('node', $node, 'field_post_date');
if (!empty($field['value'])) {
    $datetime = strtotime($field['value']);
    echo format_date($datetime, 'custom', 'F d, Y');
}
?>
			  		<b class="glyphicon glyphicon-time"></b>
			  		<?php 
list($field) = field_get_items('node', $node, 'field_video_time');
echo $field['value'];
?>
</div>
			  	<div style="margin-top:15px;min-height:40%;width:70%"><?php 
list($field) = field_get_items('node', $node, 'body');
// 			  		echo drupal_substr($field['safe_value'], 0, 500);
echo text_summary($field['safe_value'], 1, 500);
// 			  		$body = field_view_field('node', $node, 'body');
// 			  		echo render($body);
?>
</div>
			  	<div><a class="btn download" target="_blank" href="<?php 
echo url('zdigital/file', array('query' => array('file' => $all_fields[$download_key]['value'])));
?>
"><b class="glyphicon glyphicon-download-alt"></b><?php 
echo t('DOWNLOAD');
?>
</a>
			  	</div>
		  	</div>
	  	</div>
	  </div>
Exemplo n.º 17
0
 /**
  * Builds a renderable array when text processing is disabled.
  *
  * @param \Drupal\Core\Field\FieldItemListInterface $items
  *   The text field values to be rendered.
  *
  * @return array
  *   A renderable array for $items, as an array of child elements keyed by
  *   consecutive numeric indexes starting from 0.
  */
 protected function viewElementsWithoutTextProcessing(FieldItemListInterface $items)
 {
     $elements = array();
     foreach ($items as $delta => $item) {
         if ($this->getPluginId() == 'text_summary_or_trimmed' && !empty($item->summary)) {
             $output = $item->summary_processed;
         } else {
             $output = text_summary($item->processed, NULL, $this->getSetting('trim_length'));
         }
         $elements[$delta] = array('#markup' => $output);
     }
     return $elements;
 }
Exemplo n.º 18
0
                        <?php 
        $i++;
    }
}
?>
            </div>
        </div>
    </div>
    <!-- end -->

</div>
<?php 
$youtube = node_load_multiple(array(), array('type' => 'youtube_channel_videos'));
$i = 0;
foreach ($youtube as $video) {
    $title = text_summary($video->title, $format = NULL, $size = 50);
    $you_url = $video->field_youtube_url['und'][0]['value'];
    $likes = $video->field_likes['und'][0]['value'];
    $views = $video->field_views['und'][0]['value'];
    ?>
    <div class="thevideo" id="thevideo<?php 
    echo $i;
    ?>
"style="display:none;">
        <a href="#" class="videoclose">X</a>
        <iframe width="100%" height="100%" src="https://www.youtube.com/embed/<?php 
    echo $you_url;
    ?>
" frameborder="0" allowfullscreen></iframe>
    </div>
    <?php 
 /**
  * Return the summary or the trimmed body.
  */
 private function rssSummaryOrTrimmed($body, $summary)
 {
     if (!empty($summary)) {
         return drupal_html_to_text($summary);
     }
     return text_summary($body, 'plain_text');
 }