/** * Preprocessor for theme('page'). */ function jake_preprocess_page(&$vars) { // Help link if (!empty($vars['help'])) { $vars['help_link'] = l('?', $_GET['q'], array('fragment' => 'help', 'attributes' => array('class' => 'help-link'))); } // Admin link if (user_access('administer mn')) { $vars['admin_link'] = l(t('Admin'), 'admin/settings/site-information', array('attributes' => array('class' => 'admin-link'))); } // Add body class for layout. $vars['attr']['class'] .= !empty($vars['template_files']) ? ' ' . end($vars['template_files']) : ''; // Site name $vars['site_name'] = theme('site_name'); // Display mission in a block if (!empty($vars['mission']) && drupal_is_front_page()) { $mission_block = new stdClass(); $mission_block->content = $vars['mission']; $vars['mission_block'] = theme('block', $mission_block); } // Truncate the slogan so it doesn't break the header $vars['site_slogan'] = truncate_utf8($vars['site_slogan'], 35); // Determine stack height for fullscreen views. $class = array(); if ($stackclass = context_get('theme', 'stackclass')) { $class[] = $stackclass; } if (!empty($vars['tabs'])) { $class[] = 'tabs'; } if (!empty($class)) { $vars['attr']['class'] .= ' with-' . implode('-', $class); } }
/** * {@inheritdoc} */ public function viewElements(FieldItemListInterface $items) { $element = array(); $entity = $items->getEntity(); $settings = $this->getSettings(); foreach ($items as $delta => $item) { // By default use the full URL as the link text. $url = $this->buildUrl($item); $link_title = $url->toString(); // If the link text field value is available, use it for the text. if (empty($settings['url_only']) && !empty($item->title)) { // Unsanitized token replacement here because $options['html'] is FALSE // by default in l(). $link_title = \Drupal::token()->replace($item->title, array($entity->getEntityTypeId() => $entity), array('sanitize' => FALSE, 'clear' => TRUE)); } // The link_separate formatter has two titles; the link text (as in the // field values) and the URL itself. If there is no link text value, // $link_title defaults to the URL, so it needs to be unset. // The URL version may need to be trimmed as well. if (empty($item->title)) { $link_title = NULL; } $url_title = $url->toString(); if (!empty($settings['trim_length'])) { $link_title = truncate_utf8($link_title, $settings['trim_length'], FALSE, TRUE); $url_title = truncate_utf8($url_title, $settings['trim_length'], FALSE, TRUE); } $element[$delta] = array('#theme' => 'link_formatter_link_separate', '#title' => $link_title, '#url_title' => $url_title, '#url' => $url); } return $element; }
/** * Récupère les informations d'un fichier * * @param array $file Tableau du fichier * @return array Tableau avec 'type_orig' 'taille_orig' 'titre_format' */ function file_utils_human_fileinfos($file = '') { $return = false; if (isset($file) && !empty($file)) { $output_main = array(); $output_second = array(); // Nom du fichier if (isset($file['filename']) && $file['filename'] != '') { $output_main[] = isset($file['description']) && $file['description'] != '' ? truncate_utf8($file['description'], 45) : truncate_utf8($file['filename'], 45); } // Type de fichier if (isset($file['filemime']) && $file['filemime'] != '') { $return['type_orig'] = $file['filemime']; $type = ''; // Copie de code précédent -> TODO : à changer pour uniformiser sur tous les types de fichiers if (($i = strpos($file['filemime'], '/')) !== FALSE) { $type = substr($file['filemime'], $i + 1); if (!empty($type)) { $type = strtoupper($type); } } $output_second[] = $type; } // Taille du fichier if (isset($file['filesize']) && $file['filesize'] != '') { $return['taille_orig'] = $file['filesize']; $output_second[] = file_utils_human_filesize($file['filesize']); } if (!empty($output_second)) { $output_main[] = '(' . implode(', ', $output_second) . ')'; } $return['titre_format'] = implode(' ', $output_main); } return $return; }
function textReduce($text, $max_len = 255) { /* $dots = (strlen($text)>$max_len) ? '...' : ''; $desc = str_replace('.','. ',$text); $desc = str_replace(',',', ',$desc); $desc = str_replace('-',' - ',$desc); $desc = str_replace('. ,','.,',$desc); return substr($desc,0,$max_len).$dots; */ return truncate_utf8($text, $max_len, true, true); }
/** * Needed for this is Venue image / Event date / Venue name / Venue location / List of artists names * @param $results * @return array of event artist events */ public function render($results) { $elements = array(); foreach ($results as $event_delta => $event) { $artists = array(); foreach ($event->artists as $artist_delta => $artist) { $artists[$artist_delta] = array('name' => $artist->name, 'url' => $artist->url); } $variables = array('event' => array('title' => $event->title, 'date' => $event->date, 'event_url' => $event->url, 'venue_url' => $event->venue->url, 'venue' => truncate_utf8($event->venue->name, 55, TRUE, TRUE, FALSE), 'location' => $event->venue->location, 'image' => $this->renderImage($event->venue->image), 'artists' => $artists)); $elements[$event_delta] = theme('artists_event__item', $variables); } return $elements; }
/** * Return a themed breadcrumb trail. * * @param $breadcrumb * An array containing the breadcrumb links. * @return a string containing the breadcrumb output. */ function mentor_breadcrumb($variables) { $breadcrumb = $variables['breadcrumb']; $breadcrumb_separator = theme_get_setting('breadcrumb-separator', 'mentor'); if (!empty($breadcrumb) && theme_get_setting('breadcrumb-display')) { // Use CSS to hide titile .element-invisible. $output = '<h3 class="element-invisible">' . t('You are here') . '</h3>'; if (theme_get_setting('breadcrumb-title') == 1) { // show the title setting $breadcrumb[] = truncate_utf8(drupal_get_title(), theme_get_setting('breadcrumb-title-length'), $wordsafe = TRUE, $dots = TRUE); } $output .= '<div class="breadcrumb">' . implode(' <span class="breadcrumb-separator">' . $breadcrumb_separator . '</span> ', $breadcrumb) . '</div>'; return $output; } }
function zdigital_breadcrumb($variables) { $breadcrumb = $variables['breadcrumb']; if (!empty($breadcrumb)) { // Provide a navigational heading to give context for breadcrumb links to // screen-reader users. Make the heading invisible with .element-invisible. $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; if (arg(0) == 'node' && arg(1) && ($node = node_load(arg(1)))) { if ('blog' == $node->type) { $breadcrumb = array(l(t('Home'), '<front>'), l(t('Opinión'), 'blog')); } } $breadcrumb[] = truncate_utf8(drupal_get_title(), 40, true, true); $output .= '<div class="breadcrumb hidden-xs hidden-sm">' . implode(' » ', $breadcrumb) . '</div>'; return $output; } }
/** * Displays the path administration overview page. * * @param \Symfony\Component\HttpFoundation\Request $request * The request object. * * @return array * A render array as expected by drupal_render(). */ public function adminOverview(Request $request) { $keys = $request->query->get('search'); // Add the filter form above the overview table. $build['path_admin_filter_form'] = $this->formBuilder()->getForm('Drupal\\path\\Form\\PathFilterForm', $keys); // Enable language column if language.module is enabled or if we have any // alias with a language. $multilanguage = $this->moduleHandler()->moduleExists('language') || $this->aliasStorage->languageAliasExists(); $header = array(); $header[] = array('data' => $this->t('Alias'), 'field' => 'alias', 'sort' => 'asc'); $header[] = array('data' => $this->t('System'), 'field' => 'source'); if ($multilanguage) { $header[] = array('data' => $this->t('Language'), 'field' => 'langcode'); } $header[] = $this->t('Operations'); $rows = array(); $destination = drupal_get_destination(); foreach ($this->aliasStorage->getAliasesForAdminListing($header, $keys) as $data) { $row = array(); $row['data']['alias'] = _l(truncate_utf8($data->alias, 50, FALSE, TRUE), $data->source, array('attributes' => array('title' => $data->alias))); $row['data']['source'] = _l(truncate_utf8($data->source, 50, FALSE, TRUE), $data->source, array('alias' => TRUE, 'attributes' => array('title' => $data->source))); if ($multilanguage) { $row['data']['language_name'] = $this->languageManager()->getLanguageName($data->langcode); } $operations = array(); $operations['edit'] = array('title' => $this->t('Edit'), 'url' => Url::fromRoute('path.admin_edit', ['pid' => $data->pid], ['query' => $destination])); $operations['delete'] = array('title' => $this->t('Delete'), 'url' => Url::fromRoute('path.delete', ['pid' => $data->pid], ['query' => $destination])); $row['data']['operations'] = array('data' => array('#type' => 'operations', '#links' => $operations)); // If the system path maps to a different URL alias, highlight this table // row to let the user know of old aliases. if ($data->alias != $this->aliasManager->getAliasByPath($data->source, $data->langcode)) { $row['class'] = array('warning'); } $rows[] = $row; } $build['path_table'] = array('#type' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => $this->t('No URL aliases available. <a href="@link">Add URL alias</a>.', array('@link' => $this->url('path.admin_add')))); $build['path_pager'] = array('#theme' => 'pager'); return $build; }
<div id="js-error"> <?php if(!empty($errors)):?> <ul id="error-list"> <?php foreach($errors as $error):?> <li class="js-error"> <div class="row-count"> <?php echo $error['row_count'];?> occurrences </div> <h3> <?php echo l($error['message'], 'admin/reports/jserror/' . $error['mid'], array('attributes' => array('title' => $error['message'])));?> </h3> <p> On line <?php echo $error['line'] . ':' . $error['col']?> of <span class="url"><?php echo l(truncate_utf8($error['file'], 100, FALSE, TRUE), $error['file'], array('attributes' => array('target' => 'blank', 'title' => $error['file'])))?> </span> </p> <p class="details"> <span class="browser"></span> Last seen on <?php echo $error['browser'] . " " . $error['browser_version'] ?> for <?php echo $error['platform'] ?> , <?php echo format_interval(time() - $error['timestamp'], 1); ?> ago. Occurred <?php echo $error['row_count']; ?> times so far. Occurred <?php echo $error['pageload'] ? t("after page load") : t("before page load") ?> . </p> </li>
?> <a href="<?php print base_path() . drupal_get_path_alias('node/' . $post->nid); ?> "> <div class="date"> <span class="month"><?php print date('M', strtotime($post->field_post_date[LANGUAGE_NONE][0]['value'])); ?> </span> <span class="day"><?php print date('j', strtotime($post->field_post_date[LANGUAGE_NONE][0]['value'])); ?> </span> </div> <p class="title"><?php print $post->title; ?> </p> <p><?php print truncate_utf8(strip_tags($post->body[LANGUAGE_NONE][0]['value']), 60, TRUE, TRUE); ?> </p> </a> <?php } ?> </div> <!-- Recent Blog Posts | END --> <?php }
/** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL, $bundle = NULL) { parent::buildForm($form, $form_state, $entity_type_id, $bundle); // Gather bundle information. $instances = array_filter(\Drupal::entityManager()->getFieldDefinitions($this->entity_type, $this->bundle), function ($field_definition) { return $field_definition instanceof FieldInstanceConfigInterface; }); $field_types = $this->fieldTypeManager->getDefinitions(); // Field prefix. $field_prefix = \Drupal::config('field_ui.settings')->get('field_prefix'); $form += array('#entity_type' => $this->entity_type, '#bundle' => $this->bundle, '#fields' => array_keys($instances)); $table = array('#type' => 'field_ui_table', '#tree' => TRUE, '#header' => array($this->t('Label'), array('data' => $this->t('Machine name'), 'class' => array(RESPONSIVE_PRIORITY_MEDIUM)), $this->t('Field type'), $this->t('Operations')), '#regions' => $this->getRegions(), '#attributes' => array('class' => array('field-ui-overview'), 'id' => 'field-overview')); // Fields. foreach ($instances as $name => $instance) { $field_storage = $instance->getFieldStorageDefinition(); $route_parameters = array($this->bundleEntityType => $this->bundle, 'field_instance_config' => $instance->id()); $table[$name] = array('#attributes' => array('id' => drupal_html_class($name)), 'label' => array('#markup' => String::checkPlain($instance->getLabel())), 'field_name' => array('#markup' => $instance->getName()), 'type' => array('#type' => 'link', '#title' => $field_types[$field_storage->getType()]['label'], '#route_name' => 'field_ui.storage_edit_' . $this->entity_type, '#route_parameters' => $route_parameters, '#options' => array('attributes' => array('title' => $this->t('Edit field settings.'))))); $table[$name]['operations']['data'] = array('#type' => 'operations', '#links' => $this->entityManager->getListBuilder('field_instance_config')->getOperations($instance)); if (!empty($field_storage->locked)) { $table[$name]['operations'] = array('#markup' => $this->t('Locked')); $table[$name]['#attributes']['class'][] = 'menu-disabled'; } } // Gather valid field types. $field_type_options = array(); foreach ($field_types as $name => $field_type) { // Skip field types which should not be added via user interface. if (empty($field_type['no_ui'])) { $field_type_options[$name] = $field_type['label']; } } asort($field_type_options); // Additional row: add new field. if ($field_type_options) { $name = '_add_new_field'; $table[$name] = array('#attributes' => array('class' => array('add-new')), 'label' => array('#type' => 'textfield', '#title' => $this->t('New field label'), '#title_display' => 'invisible', '#size' => 15, '#description' => $this->t('Label'), '#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . $this->t('Add new field') . '</div>', '#suffix' => '</div>'), 'field_name' => array('#type' => 'machine_name', '#title' => $this->t('New field name'), '#title_display' => 'invisible', '#field_prefix' => '<span dir="ltr">' . $field_prefix, '#field_suffix' => '</span>‎', '#size' => 15, '#description' => $this->t('A unique machine-readable name containing letters, numbers, and underscores.'), '#maxlength' => FieldStorageConfig::NAME_MAX_LENGTH - strlen($field_prefix), '#prefix' => '<div class="add-new-placeholder"> </div>', '#machine_name' => array('source' => array('fields', $name, 'label'), 'exists' => array($this, 'fieldNameExists'), 'standalone' => TRUE, 'label' => ''), '#required' => FALSE), 'type' => array('#type' => 'select', '#title' => $this->t('Type of new field'), '#title_display' => 'invisible', '#options' => $field_type_options, '#empty_option' => $this->t('- Select a field type -'), '#description' => $this->t('Type of data to store.'), '#attributes' => array('class' => array('field-type-select')), '#cell_attributes' => array('colspan' => 2), '#prefix' => '<div class="add-new-placeholder"> </div>'), 'translatable' => array('#type' => 'value', '#value' => TRUE)); } // Additional row: re-use existing field. $existing_fields = $this->getExistingFieldOptions(); if ($existing_fields) { // Build list of options. $existing_field_options = array(); foreach ($existing_fields as $field_name => $info) { $text = $this->t('@type: @field (@label)', array('@type' => $info['type_label'], '@label' => $info['label'], '@field' => $info['field'])); $existing_field_options[$field_name] = truncate_utf8($text, 80, FALSE, TRUE); } asort($existing_field_options); $name = '_add_existing_field'; $table[$name] = array('#attributes' => array('class' => array('add-new')), '#row_type' => 'add_new_field', '#region_callback' => array($this, 'getRowRegion'), 'label' => array('#type' => 'textfield', '#title' => $this->t('Existing field label'), '#title_display' => 'invisible', '#size' => 15, '#description' => $this->t('Label'), '#attributes' => array('class' => array('label-textfield')), '#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . $this->t('Re-use existing field') . '</div>', '#suffix' => '</div>'), 'field_name' => array('#type' => 'select', '#title' => $this->t('Existing field to share'), '#title_display' => 'invisible', '#options' => $existing_field_options, '#empty_option' => $this->t('- Select an existing field -'), '#description' => $this->t('Field to share'), '#attributes' => array('class' => array('field-select')), '#cell_attributes' => array('colspan' => 3), '#prefix' => '<div class="add-new-placeholder"> </div>')); } // We can set the 'rows_order' element, needed by theme_field_ui_table(), // here instead of a #pre_render callback because this form doesn't have the // tabledrag behavior anymore. $table['#regions']['content']['rows_order'] = array(); foreach (Element::children($table) as $name) { $table['#regions']['content']['rows_order'][] = $name; } $form['fields'] = $table; $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#button_type' => 'primary', '#value' => $this->t('Save')); return $form; }
// Match Column numbers to Bootsrap class $columns_classes = array(1 => 12, 2 => 6, 3 => 4, 4 => 3, 6 => 2, 12 => 1); $bootsrap_class = isset($columns_classes[$view->style_plugin->options['columns']]) ? $columns_classes[$view->style_plugin->options['columns']] : 3; ?> <div class="work-element <?php print implode(' ', $categories); ?> col-sm-3 col-xs-12 col-md-<?php print $bootsrap_class; ?> "> <a href="<?php print $fields['path']->content; ?> " class="work"> <?php print $fields['field_images']->content; ?> <span class="shadow"></span> <div class="bg-hover"></div> <div class="work-title"> <?php print $fields['title']->content; ?> <div class="description"><?php print truncate_utf8(str_replace('/', ' / ', $fields['field_category']->content), 30, FALSE, TRUE); ?> </div> </div> </a> </div><!-- .work-element -->
/** * Implements template_preprocess_node(). * * The changes made in this function affect the variables for the * templates/node.tpl.php template file. In this theme we have not overridden * this template, so the core default, located in modules/block/block.tpl.php * is being used. This example is covered on pages 319-320. */ function dgd7_preprocess_node(&$vars) { // Give node titles decent classes. $vars['title_attributes_array']['class'][] = 'node-title'; // Remove the "Add new comment" link when the form is below it. if (!empty($vars['content']['comments']['comment_form'])) { unset($vars['content']['links']['#links']['comment-add']); } // Make some changes when in teaser mode. if ($vars['teaser']) { // Don't display author or date information. $vars['display_submitted'] = FALSE; // Trim the node title and append an ellipsis. $vars['title'] = truncate_utf8($vars['title'], 70, TRUE, TRUE); } }
/** * Generate a teaser for a node body. * * If the end of the teaser is not indicated using the <!--break--> delimiter * then we generate the teaser automatically, trying to end it at a sensible * place such as the end of a paragraph, a line break, or the end of a * sentence (in that order of preference). * * @param $body * The content for which a teaser will be generated. * @param $format * The format of the content. If the content contains PHP code, we do not * split it up to prevent parse errors. If the line break filter is present * then we treat newlines embedded in $body as line breaks. * @param $size * The desired character length of the teaser. If omitted, the default * value will be used. Ignored if the special delimiter is present * in $body. * @return * The generated teaser. */ function node_teaser($body, $format = NULL, $size = NULL) { /* if (!isset($size)) { $size = variable_get('teaser_length', 600); } */ // Find where the delimiter is in the body $delimiter = strpos($body, '<!--break-->'); // If the size is zero, and there is no delimiter, the entire body is the teaser. if ($size == 0 && $delimiter === FALSE) { return $body; } // If a valid delimiter has been specified, use it to chop off the teaser. if ($delimiter !== FALSE) { return substr($body, 0, $delimiter); } /* // We check for the presence of the PHP evaluator filter in the current // format. If the body contains PHP code, we do not split it up to prevent // parse errors. if (isset($format)) { $filters = filter_list_format($format); if (isset($filters['php/0']) && strpos($body, '<?') !== FALSE) { return $body; } } */ // If we have a short body, the entire body is the teaser. if (drupal_strlen($body) <= $size) { return $body; } // If the delimiter has not been specified, try to split at paragraph or // sentence boundaries. // The teaser may not be longer than maximum length specified. Initial slice. $teaser = truncate_utf8($body, $size); // Store the actual length of the UTF8 string -- which might not be the same // as $size. $max_rpos = strlen($teaser); // How much to cut off the end of the teaser so that it doesn't end in the // middle of a paragraph, sentence, or word. // Initialize it to maximum in order to find the minimum. $min_rpos = $max_rpos; // Store the reverse of the teaser. We use strpos on the reversed needle and // haystack for speed and convenience. $reversed = strrev($teaser); // Build an array of arrays of break points grouped by preference. $break_points = array(); // A paragraph near the end of sliced teaser is most preferable. $break_points[] = array('</p>' => 0); // If no complete paragraph then treat line breaks as paragraphs. $line_breaks = array('<br />' => 6, '<br>' => 4); // Newline only indicates a line break if line break converter // filter is present. if (isset($filters['filter/1'])) { $line_breaks["\n"] = 1; } $break_points[] = $line_breaks; // If the first paragraph is too long, split at the end of a sentence. $break_points[] = array('. ' => 1, '! ' => 1, '? ' => 1, '。' => 0, '؟ ' => 1); // Iterate over the groups of break points until a break point is found. foreach ($break_points as $points) { // Look for each break point, starting at the end of the teaser. foreach ($points as $point => $offset) { // The teaser is already reversed, but the break point isn't. $rpos = strpos($reversed, strrev($point)); if ($rpos !== FALSE) { $min_rpos = min($rpos + $offset, $min_rpos); } } // If a break point was found in this group, slice and return the teaser. if ($min_rpos !== $max_rpos) { // Don't slice with length 0. Length must be <0 to slice from RHS. return ($min_rpos === 0) ? $teaser : substr($teaser, 0, 0 - $min_rpos); } } // If a break point was not found, still return a teaser. return $teaser; }
/** * Tests the 'link_separate' formatter. * * This test is mostly the same as testLinkFormatter(), but they cannot be * merged, since they involve different configuration and output. */ function testLinkSeparateFormatter() { $field_name = drupal_strtolower($this->randomMachineName()); // Create a field with settings to validate. $this->fieldStorage = entity_create('field_storage_config', array('name' => $field_name, 'entity_type' => 'entity_test', 'type' => 'link', 'cardinality' => 2)); $this->fieldStorage->save(); entity_create('field_instance_config', array('field_storage' => $this->fieldStorage, 'bundle' => 'entity_test', 'settings' => array('title' => DRUPAL_OPTIONAL, 'link_type' => LinkItemInterface::LINK_GENERIC)))->save(); $display_options = array('type' => 'link_separate', 'label' => 'hidden'); entity_get_form_display('entity_test', 'entity_test', 'default')->setComponent($field_name, array('type' => 'link_default'))->save(); entity_get_display('entity_test', 'entity_test', 'full')->setComponent($field_name, $display_options)->save(); // Create an entity with two link field values: // - The first field item uses a URL only. // - The second field item uses a URL and link text. // For consistency in assertion code below, the URL is assigned to the title // variable for the first field. $this->drupalGet('entity_test/add'); $url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com'; $url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org'; // Intentionally contains an ampersand that needs sanitization on output. $title2 = 'A very long & strange example title that could break the nice layout of the site'; $edit = array('user_id' => 1, 'name' => $this->randomMachineName(), "{$field_name}[0][url]" => $url1, "{$field_name}[1][url]" => $url2, "{$field_name}[1][title]" => $title2); $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\\d+)|', $this->url, $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', array('@id' => $id))); // Verify that the link is output according to the formatter settings. $options = array('trim_length' => array(NULL, 6), 'rel' => array(NULL, 'nofollow'), 'target' => array(NULL, '_blank')); foreach ($options as $setting => $values) { foreach ($values as $new_value) { // Update the field formatter settings. $display_options['settings'] = array($setting => $new_value); entity_get_display('entity_test', 'entity_test', 'full')->setComponent($field_name, $display_options)->save(); $this->renderTestEntity($id); switch ($setting) { case 'trim_length': $url = $url1; $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url; $expected = '<div class="link-item">'; $expected .= '<div class="link-url"><a href="' . String::checkPlain($url) . '">' . String::checkPlain($url_title) . '</a></div>'; $expected .= '</div>'; $this->assertRaw($expected); $url = $url2; $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url; $title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2; $expected = '<div class="link-item">'; $expected .= '<div class="link-title">' . String::checkPlain($title) . '</div>'; $expected .= '<div class="link-url"><a href="' . String::checkPlain($url) . '">' . String::checkPlain($url_title) . '</a></div>'; $expected .= '</div>'; $this->assertRaw($expected); break; case 'rel': $rel = isset($new_value) ? ' rel="' . $new_value . '"' : ''; $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url1) . '"' . $rel . '>' . String::checkPlain($url1) . '</a></div>'); $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url2) . '"' . $rel . '>' . String::checkPlain($url2) . '</a></div>'); break; case 'target': $target = isset($new_value) ? ' target="' . $new_value . '"' : ''; $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url1) . '"' . $target . '>' . String::checkPlain($url1) . '</a></div>'); $this->assertRaw('<div class="link-url"><a href="' . String::checkPlain($url2) . '"' . $target . '>' . String::checkPlain($url2) . '</a></div>'); break; } } } }
/** * @file * Template File for the Testimonials Block. */ ?> <?php if (isset($testimonial)) { ?> <!-- Footer Testimonial | START --> <div class="footertestimonial hidden-xs"> <i class="fa fa-quote-left"></i> <p class="title"><?php print $testimonial->title; ?> </p> <p><?php print truncate_utf8($testimonial->body[LANGUAGE_NONE][0]['value'], 600, TRUE); ?> <p class="name">– <strong><?php print $testimonial->field_testimonial_author[LANGUAGE_NONE][0]['value']; ?> </strong> <span>(<?php print $testimonial->field_testimonial_location[LANGUAGE_NONE][0]['value']; ?> )</span></p> <a href="/testimonials" class="button"><span data-hover="Read Our Testimonials">Read Our Testimonials</span></a> </div> <!-- Footer Testimonial | END --> <?php }
/** * Override of theme('admin_drilldown_menu_item_link'). */ function rubik_admin_drilldown_menu_item_link($link) { $link['localized_options'] = empty($link['localized_options']) ? array() : $link['localized_options']; $link['localized_options']['html'] = TRUE; if (!isset($link['localized_options']['attributes']['class'])) { $link['localized_options']['attributes']['class'] = _rubik_icon_classes($link['href']); } else { $link['localized_options']['attributes']['class'] += _rubik_icon_classes($link['href']); } $link['description'] = check_plain(truncate_utf8(strip_tags($link['description']), 150, TRUE, TRUE)); $link['description'] = "<span class='icon'></span>" . $link['description']; $link['title'] .= !empty($link['description']) ? "<span class='menu-description'>{$link['description']}</span>" : ''; $link['title'] = filter_xss_admin($link['title']); return l($link['title'], $link['href'], $link['localized_options']); }
/** * Confirms that a log message appears on the database log overview screen. * * This function should only be used for the admin/reports/dblog page, because * it checks for the message link text truncated to 56 characters. Other log * pages have no detail links so they contain the full message text. * * @param string $log_message * The database log message to check. * @param string $message * The message to pass to simpletest. */ protected function assertLogMessage($log_message, $message) { $message_text = truncate_utf8(Xss::filter($log_message, array()), 56, TRUE, TRUE); // After \Drupal\Component\Utility\Xss::filter(), HTML entities should be // converted to their character equivalents because assertLink() uses this // string in xpath() to query the Document Object Model (DOM). $this->assertLink(html_entity_decode($message_text), 0, $message); }
<?php // $Id: views-view-field.tpl.php,v 1.1 2008/05/16 22:22:32 merlinofchaos Exp $ /** * This template is used to print a single field in a view. It is not * actually used in default Views, as this is registered as a theme * function which has better performance. For single overrides, the * template is perfectly okay. * * Variables available: * - $view: The view object * - $field: The field handler object that can process the input * - $row: The raw SQL result that can be used * - $output: The processed output that will normally be used. * * When fetching output from the $row, this construct should be used: * $data = $row->{$field->field_alias} * * The above will guarantee that you'll always get the correct data, * regardless of any changes in the aliasing that might happen if * the view is modified. */ print l(truncate_utf8(strip_tags($row->node_title), '60', TRUE, TRUE), 'node/' . $row->nid);
?> <!-- <span class="btn-play"><?php //echo $duration; ?> </span> --> </a> <?php } ?> </div> <div class="video-info"> <span class="author"> <?php if (!empty($display_name)) { echo $display_name; } ?> </span> <div class="title color"> <a href="<?php echo $url; ?> " class="title"><?php echo truncate_utf8($title, $title_max_length, true, true); ?> </a> </div> </div> </li>
/** * Tests the 'link_separate' formatter. * * This test is mostly the same as testLinkFormatter(), but they cannot be * merged, since they involve different configuration and output. */ function testLinkSeparateFormatter() { // Create a field with settings to validate. $this->field = array( 'field_name' => drupal_strtolower($this->randomName()), 'type' => 'link', 'cardinality' => 2, ); field_create_field($this->field); $this->instance = array( 'field_name' => $this->field['field_name'], 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', 'settings' => array( 'title' => DRUPAL_OPTIONAL, ), 'widget' => array( 'type' => 'link_default', ), 'display' => array( 'full' => array( 'type' => 'link_separate', 'label' => 'hidden', ), ), ); field_create_instance($this->instance); $langcode = LANGUAGE_NOT_SPECIFIED; // Create an entity with two link field values: // - The first field item uses a URL only. // - The second field item uses a URL and title. // For consistency in assertion code below, the URL is assigned to the title // variable for the first field. $this->drupalGet('test-entity/add/test_bundle'); $url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com'; $url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org'; // Intentionally contains an ampersand that needs sanitization on output. $title2 = 'A very long & strange example title that could break the nice layout of the site'; $edit = array( "{$this->field['field_name']}[$langcode][0][url]" => $url1, "{$this->field['field_name']}[$langcode][1][url]" => $url2, "{$this->field['field_name']}[$langcode][1][title]" => $title2, ); $this->drupalPost(NULL, $edit, t('Save')); preg_match('|test-entity/manage/(\d+)/edit|', $this->url, $match); $id = $match[1]; $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id))); // Verify that the link is output according to the formatter settings. $options = array( 'trim_length' => array(NULL, 6), 'rel' => array(NULL, 'nofollow'), 'target' => array(NULL, '_blank'), ); foreach ($options as $setting => $values) { foreach ($values as $new_value) { // Update the field formatter settings. $this->instance['display']['full']['settings'] = array($setting => $new_value); field_update_instance($this->instance); $this->renderTestEntity($id); switch ($setting) { case 'trim_length': $url = $url1; $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url; $expected = '<div class="link-item">'; $expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>'; $expected .= '</div>'; $this->assertRaw($expected); $url = $url2; $url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url; $title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2; $expected = '<div class="link-item">'; $expected .= '<div class="link-title">' . check_plain($title) . '</div>'; $expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>'; $expected .= '</div>'; $this->assertRaw($expected); break; case 'rel': $rel = isset($new_value) ? ' rel="' . $new_value . '"' : ''; $this->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $rel . '>' . check_plain($url1) . '</a></div>'); $this->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $rel . '>' . check_plain($url2) . '</a></div>'); break; case 'target': $target = isset($new_value) ? ' target="' . $new_value . '"' : ''; $this->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $target . '>' . check_plain($url1) . '</a></div>'); $this->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $target . '>' . check_plain($url2) . '</a></div>'); break; } } } }
/** * Breadcrumb. */ function marinelli_breadcrumb($variables) { $breadcrumb = $variables['breadcrumb']; if (!empty($breadcrumb)) { $output = '<' . OUTTAG . ' class="element-invisible">' . t('You are here') . '</' . OUTTAG . '>'; if (theme_get_setting('breadcrumb_title') == 1) { // show the title setting $breadcrumb[] = truncate_utf8(drupal_get_title(), theme_get_setting('breadcrumb_title_length'), $wordsafe = TRUE, $dots = TRUE); } $output .= '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>'; return $output; } }
public static function getFlatList2($where, $order, $direction, $per_page = 10, $current_page = 1, $action = 'sales', $user_id = NULL) { $start_pos = ($current_page - 1) * $per_page; $limit = " LIMIT {$start_pos},{$per_page}"; //$amount = Flat::getAmountInList($where); $sort = $order == '' ? "f.updated_on" : $order; $where_param = $where . " GROUP BY f.id ORDER BY " . $sort . " " . $direction . $limit; $params = ''; if (isset($_GET['rooms'])) { $params .= '&rooms=' . intval($_GET['rooms']); } if (isset($_REQUEST['f_rooms'])) { $params .= '&rooms=' . intval($_REQUEST['f_rooms']) . '&f_rooms=' . intval($_REQUEST['f_rooms']); } $price_min = 0; $price_max = 0; if (isset($_REQUEST['f_price'])) { $f_price = intval($_REQUEST['f_price']); $params .= '&f_price=' . $f_price; switch ($f_price) { case 1: $price_max = 1000000; break; case 2: $price_min = 1000000; $price_max = 1500000; break; case 3: $price_min = 1500000; $price_max = 2000000; break; case 4: $price_min = 2000000; $price_max = 3000000; break; case 5: $price_min = 3000000; break; } } else { if (isset($_REQUEST['price_min']) && $_REQUEST['price_min'] > 0) { $price_min = intval($_REQUEST['price_min']); } else { $price_min = 0; } if (isset($_REQUEST['price_max']) && $_REQUEST['price_max'] > 0) { $price_max = intval($_REQUEST['price_max']); } else { $price_max = 0; } if ($price_min > 0) { $params .= '&price_min=' . $price_min; } if ($price_max > 0) { $params .= '&price_max=' . $price_max; } } if (isset($_REQUEST['f_date'])) { $params .= '&f_date=' . clearTextData($_REQUEST['f_date']); } if (isset($_REQUEST['f_price_sq'])) { $params .= '&f_price_sq=' . intval($_REQUEST['f_price_sq']); } if (isset($_REQUEST['f_tenement'])) { $params .= '&f_tenement=' . intval($_REQUEST['f_tenement']); } if (isset($_REQUEST['f_kitchen'])) { $params .= '&f_kitchen=' . intval($_REQUEST['f_kitchen']); } if (isset($_REQUEST['f_total_area'])) { $params .= '&f_total_area=' . intval($_REQUEST['f_total_area']); } if (isset($_REQUEST['f_total_area'])) { $params .= '&f_total_area=' . intval($_REQUEST['f_total_area']); } if (isset($_REQUEST['f_balcon'])) { $params .= '&f_balcon=' . intval($_REQUEST['f_balcon']); } if (isset($_REQUEST['f_no_corner'])) { $params .= '&f_no_corner=' . intval($_REQUEST['f_no_corner']); } if (isset($_REQUEST['f_storey_no_first'])) { $params .= '&f_storey_no_first=' . intval($_REQUEST['f_storey_no_first']); } if (isset($_REQUEST['f_storey_no_last'])) { $params .= '&f_storey_no_last=' . intval($_REQUEST['f_storey_no_last']); } if (isset($_REQUEST['f_bath'])) { $params .= '&f_bath=' . intval($_REQUEST['f_bath']); } if (isset($_REQUEST['f_photo'])) { $params .= '&f_photo=' . intval($_REQUEST['f_photo']); } if (isset($_REQUEST['f_regions'])) { $params .= '&f_regions=' . intval($_REQUEST['f_regions']); } if (isset($_REQUEST['f_newt'])) { $params .= '&f_newt=' . intval($_REQUEST['f_newt']); } if (isset($_REQUEST['f_street']) && isset($_REQUEST['f_street_id'])) { $params .= '&f_street=' . clearTextData($_REQUEST['f_street']); $params .= '&f_street_id=' . intval($_REQUEST['f_street_id']); } if (isset($_REQUEST['f_heating'])) { $params .= '&f_heating=' . intval($_REQUEST['f_heating']); } if (isset($_REQUEST['f_is_owner'])) { $params .= '&f_is_owner=' . intval($_REQUEST['f_is_owner']); } if (isset($_SESSION['direction'])) { $direction = $_SESSION['direction'] == 'ASC' ? 'ASC' : 'DESC'; $arrow = $direction == 'ASC' ? '↓' : '↑'; $direction = 'direction=' . $direction; } else { $direction = ''; $arrow = ''; } $arrow_date = ''; $arrow_price = ''; if ($sort == 'updated_on') { $arrow_date = $arrow; } else { if ($sort == 'price') { $arrow_price = $arrow; } } $amount = Flat::getAmountInList($where . " GROUP BY f.id"); $paginator = self::paginator("flat.html?action={$action}" . $params, $amount, $per_page, $current_page); $html = "\n\t\tНайдено {$amount} объявлений:\n\t\t<br>\t\t\t\t\t\t\n\t\t<table class='table table-striped table-bordered table-condensed'>\n\t\t<thead>\n\t\t <tr>\t\t \n\t\t <th>Комнат</th>\n\t\t <th><a href='/flat.html?action={$action}&sort=price" . $params . "'><b>Цена(руб.)</b></a>{$arrow_price}<br>руб./м<sup>2</sup></th>\n\t\t <th>Этаж</th>\t\t \n\t\t <th>Адрес</th>\t\t \t\t \t\t \n\t\t <th>Общая/кухня м<sup>2</sup></th>\n\t\t <th>Балкон</th>\t\t \n\t\t <th>Описание</th>\n\t\t <th>Тел.</th>\n\t\t <th><a href='/flat.html?action={$action}&sort=updated_on" . $params . "'><b>Дата</b></a>{$arrow_date}</th>\n\t\t <th></th> \t\t \n\t\t </tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t"; $ids = array(); $db_res = Flat::getFullListLink($where_param); $tenement_icons = array('kirpich', 'panel', 'monolit', 'block', 'derevo'); while ($row = $db_res->fetchRow()) { $ids[] = $row['id']; $type_name = Tenement::$TYPE[$row['ttype']]; $type = $tenement_icons[$row['ttype']]; $type = "<img src='/images/icon_{$type}.png' title='{$type_name}'>"; $price = number_format($row['price'], 0); $price_m = number_format($row['price_m'], 0); $city = $row['city_id'] == 0 ? '' : $row['city'] . ','; $addr = "{$city} {$row['street']}"; if ($row['show_address']) { $addr .= ", {$row['tnum']}"; } $is_corner = $row['is_corner'] ? '<br><b>Угловая</b>' : ''; $bath = $row['type_bathroom'] ? '<br><b>С/у совмещен</b>' : ''; $is_new = $row['is_new'] ? '<br><b>Новостройка</b>' : ''; $is_owner = $row['is_owner'] ? '<br><b>Собственник</b>' : ''; $desc = Realty::prepareDescription($row['description']); $desc_all = truncate_utf8($desc, 300, true, true) . $is_corner . $bath; $description = $desc_all . $is_new . $is_owner; $tel = truncate_utf8($row['contacts'], 100, true, false); $flat_url = "/flat.html?action=view&id={$row['id']}"; $photo_html = $row['photo_tenement'] != '' ? "<a href='{$flat_url}' title='{$row['rooms']}-комнатная, {$price} руб.'><img src='/" . PHOTOS_WEBPATH . TENEMENT . "/" . $row['tenement_id'] . "/" . $row['photo_tenement'] . "_prev' class='border_const'></a>" : 'Нет фото'; $photo_html2 = $row['photo_flat'] != '' ? "<a href='{$flat_url}' title='{$row['rooms']}-комнатная, {$price} руб.'><img src='/" . PHOTOS_WEBPATH . FLAT . "/" . $row['id'] . "/" . $row['photo_flat'] . "_prev' class='border_const'></a>" : ''; if ($photo_html2 != '') { $photo_html = $photo_html2; } $date = explode(' ', $row['updated_on']); $dates = explode('-', $date[0]); $date = $dates[2] . '.' . $dates[1]; //.'.'.$dates[0] $url_del = !isset($_SESSION['admin']) ? '' : '<br><br><a href="javascript:delFlat(' . $row['id'] . ');">Удалить</a>'; if ($user_id) { $url_del .= ' <a href="javascript:update(' . $row['id'] . ');" title="Обновить дату на текущую"><img src="/images/icon_update.png" title="Обновить дату на сегодняшнюю"></a>'; $url_del .= ' <a href="flat.html?action=edit&id=' . $row['id'] . '"><img src="/images/icon_edit.png" title="Редактировать"></a>'; $url_del .= ' <a href="javascript:remove(' . $row['id'] . ');"><img src="/images/icon_delete.png" title="Снять"></a>'; $url_del .= ' <a href="javascript:sold(' . $row['id'] . ');"><img src="/images/icon_sold.png" title="Продано"></a>'; } if ($row['balcony'] > 0) { $balcon = 'балкон ' . $row['balcony'] . 'м<sup>2</sup>'; } elseif ($row['loggia'] > 0) { $balcon = 'лоджия ' . $row['loggia'] . 'м<sup>2</sup>'; } else { $balcon = 'балкона нет'; } $html .= "<tr>\t\t\t\n\t\t\t<td style='text-align:right;'><b>{$row['rooms']}-к.</b></td>\n\t\t\t<td><b>{$price}</b><br><br>{$price_m}</td>\n\t\t\t<td>{$row['storey']}/{$row['storeys']}<br><a href='/tenement.html?action=view&id={$row['tenement_id']}' target='_blank'>{$type}</a></td>\n\t\t\t<td><a href='{$flat_url}'>{$addr}</a></td>\t\t\t\t\t\t\n\t\t\t<td>{$row['total_area']}/{$row['kitchen_area']}</td>\n\t\t\t<td>{$balcon}</td>\t\t\t\n\t\t\t<td>{$description}</td>\n\t\t\t<td>{$tel}</td>\n\t\t\t<td>{$date}</td>\t\t\t\n\t\t\t<td><a href='{$flat_url}'><img src='/images/icon_view.png' title='Смотреть'></a>{$url_del}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t"; } $html .= "</tbody></table>\n\t\t<div>{$paginator}</div>\t\t\n\t\t"; return array('html' => $html, 'ids' => $ids); }
*/ $image = _get_node_field($row, 'field_field_images'); $path = isset($image[0]) ? $image[0]['raw']['uri'] : ''; ?> <div class="project-item row"> <div class="col-md-4 col-md-offset-1"> <div class="project-desc"> <h4 class="title"><a href="<?php print url($fields['nid']->content); ?> "><?php print $fields['title']->content; ?> </a></h4> <span class="desc"><?php print truncate_utf8($fields['field_categories']->content, 50, FALSE, TRUE); ?> </span> <div class="excerpt"> <?php print $fields['body']->content; ?> </div> <footer class="project-footer"> <?php if (isset($fields['field_timeline_details']->content)) { ?> <ul class="list-unstyled"> <?php foreach (explode("\n", $fields['field_timeline_details']->content) as $detail) { ?>
function _is_interested($nid) { global $user; $uid = $user->uid; $result = db_select('volunteer_task_list', 'vt')->extend('TableSort')->distinct()->fields('vt', array('taskid', 'uid', 'is_shown_interest', 'created_on', 'is_assigned'))->condition('uid', $uid, '=')->condition('taskid', $nid, '=')->execute()->fetchAll(); //die(); $i = 1; # build the table fields $rows = array(); if (!empty($result)) { foreach ($result as $row) { $node = node_load($row->taskid); $title = $node->field_task_title ? $node->field_task_title['und'][0]['value'] : ''; $title = truncate_utf8($title, 50, TRUE); //$show_in_interest_url = l('show in intrest', 'task/i-am-interest', array ('query' => array ('task_id' => $node->nid, 'uuid' => $uid))); if ($row->is_shown_interest) { $show_in_interest_url = t('I am interested'); } else { $show_in_interest_url = l('Interested ?', "task/i-am-interest/{$node->nid}/{$uid}"); } $i++; } } $link = $show_in_interest_url; return $link; }
if (!empty($event->field_event_poc_email) && !empty($event->field_event_poc_email['und'][0]['value'])) { $link = $event->field_event_poc_email['und'][0]['value']; print "<a href=\"mailto:{$link}\">{$link}</a>"; } ?> </div> <?php } ?> </div> </div> <div class="event-descr"> <?php print truncate_utf8(strip_tags(htmlspecialchars_decode($description)), 289, true, true); ?> <a href="javascript:void(0)" onclick="expanddesc(this)" class="viewmoreanc">Read more</a> </div> <div class="event-descr" style="display:none"> <?php print strip_tags(htmlspecialchars_decode($description)); ?> <a href="javascript:void(0)" onclick="expanddesc(this)" class="viewmoreanc">Read less</a> </div> </div> <div class='google-map'> <?php $variables = array('targetLatitude' => $targetLatitude, 'targetLongitude' => $targetLongitude, 'title' => $title, 'count' => $count, 'hideMap' => TRUE);
?> </div> <div class="event-calendarlinks"> <?php dsm($relatedNode); $nodeTitle = urlencode($relatedNode->title); $linkToNode = urlencode("http://business.usa.gov/node/{$relatedNode->nid}"); $address = ''; $address .= empty($relatedNode->field_event_address_1['und'][0]['value']) ? '' : $relatedNode->field_event_address_1['und'][0]['value'] . ', '; $address .= empty($relatedNode->field_event_address_2['und'][0]['value']) ? '' : $relatedNode->field_event_address_2['und'][0]['value'] . ', '; $address .= empty($relatedNode->field_event_city['und'][0]['value']) ? '' : $relatedNode->field_event_city['und'][0]['value'] . ', '; $address .= empty($relatedNode->field_event_state['und'][0]['value']) ? '' : $relatedNode->field_event_state['und'][0]['value'] . ', '; $address = urlencode($address); $snippet = strip_tags($relatedNode->field_event_detail_desc['und'][0]['value']); $snippet = trim(str_replace(array("\n", "\r", "\f", "\t"), "", $snippet)); $snippet = urlencode(truncate_utf8($snippet, 250, true, true)); $eventsStartDt = new DateTime($relatedNode->field_event_date['und'][0]['value'] . ' UTC'); $eventsEndDt = new DateTime($relatedNode->field_event_date['und'][1]['value'] . ' UTC'); $gDates = $eventsStartDt->format("Ymd\\This") . 'Z/' . $eventsStartDt->format("Ymd\\This") . 'Z'; $yDateStart = $eventsStartDt->format("Ymd\\This"); $yDateEnd = $eventsStartDt->format("Ymd\\This"); $googleCalLink = "https://www.google.com/calendar/render?action=TEMPLATE&text={$nodeTitle}&dates={$gDates}&sprop=website:{$linkToNode}&location={$address}&details={$snippet}"; $yahooCalLink = "http://calendar.yahoo.com/?v=60&TITLE={$nodeTitle}&ST={$yDateStart}&ET={$yDateEnd}&URL={$linkToNode}&in_loc={$address}&DESC={$snippet}"; ?> <a href="/ical/<?php print $relatedNode->nid; ?> /calendar.ics" title="Export event to your Outlook calendar"> <img class="ical" src="/sites/all/themes/bizusa/images/outlook_cal.png" /> </a> <a href="<?php
?> <div id="companion_300x250" class="bizutv-companion-banner"></div> <?php } ?> <div class= "bizutv-widget-full-player"> <div id="bizutv-player_top" class="bizutv-clearfix"> <a href="<?php print $playlist_nodes[0]->node_url; ?> " target="_blank" id="video-top-title-holder" rel="nofollow" onClick="goToBizu('<?php print $playlist_nodes[0]->node_url; ?> ');return false;"> <span id="video-top-title"><?php print truncate_utf8($playlist_nodes[0]->title, 35, true, true); ?> </span> <span id="bizutv-logo"><img src="<?php print $directory; ?> /jw/bizutv_player/custom/logo_video.png"/></span> </a> </div> <div class="player_outer_wrapper"> <?php if (!empty($use_mute_button)) { ?> <p id="bar" style=""> <a href="javascript:;" onclick="jq191.muteClicked();" id="mute" style="display: block;">Mute</a><a href="javascript:;" onclick="jq191.unmuteClicked();" id="unmute" style="display: none;">Unmute</a> </p>
/** * {@inheritdoc} */ public function process(FeedInterface $feed) { if (!is_array($feed->items)) { return; } foreach ($feed->items as $item) { // @todo: The default entity view builder always returns an empty // array, which is ignored in aggregator_save_item() currently. Should // probably be fixed. if (empty($item['title'])) { continue; } // Save this item. Try to avoid duplicate entries as much as possible. If // we find a duplicate entry, we resolve it and pass along its ID is such // that we can update it if needed. if (!empty($item['guid'])) { $values = array('fid' => $feed->id(), 'guid' => $item['guid']); } elseif ($item['link'] && $item['link'] != $feed->link && $item['link'] != $feed->url) { $values = array('fid' => $feed->id(), 'link' => $item['link']); } else { $values = array('fid' => $feed->id(), 'title' => $item['title']); } // Try to load an existing entry. if ($entry = entity_load_multiple_by_properties('aggregator_item', $values)) { $entry = reset($entry); } else { $entry = entity_create('aggregator_item', array('langcode' => $feed->language()->getId())); } if ($item['timestamp']) { $entry->setPostedTime($item['timestamp']); } // Make sure the item title and author fit in the 255 varchar column. $entry->setTitle(truncate_utf8($item['title'], 255, TRUE, TRUE)); $entry->setAuthor(truncate_utf8($item['author'], 255, TRUE, TRUE)); $entry->setFeedId($feed->id()); $entry->setLink($item['link']); $entry->setGuid($item['guid']); $description = ''; if (!empty($item['description'])) { $description = $item['description']; } $entry->setDescription($description); $entry->save(); } }
<?php /* Determin the content of the snippet */ $printSnippet = ''; /* Executive Summary for Programs and Services */ if ($printSnippet === '' && isset($variables['purpose'])) { $purpose = substr($variables['purpose'], 0, 200); $printSnippet = trim(strip_tags($purpose)); } /* Executive Summary for Tools */ if ($printSnippet === '' && isset($variables['fullNode']->field_tools_execsum) && isset($variables['fullNode']->field_tools_execsum['und']) && isset($variables['fullNode']->field_tools_execsum['und'][0]) && !empty($variables['fullNode']->field_tools_execsum['und'][0]['value'])) { $printSnippet = trim(strip_tags($variables['fullNode']->field_tools_execsum['und'][0]['value'])); } /* Snippet for Events */ if ($printSnippet === '' && isset($variables['fullNode']->field_event_detail_desc) && isset($variables['fullNode']->field_event_detail_desc['und']) && isset($variables['fullNode']->field_event_detail_desc['und'][0]) && !empty($variables['fullNode']->field_event_detail_desc['und'][0]['value'])) { //$printSnippet = trim(strip_tags($variables['fullNode']->field_event_detail_desc['und'][0]['value'])); print truncate_utf8(trim(strip_tags($variables['fullNode']->field_event_detail_desc['und'][0]['value'])), 253); } /* If this node's body has a summary field */ if ($printSnippet === '' && isset($variables['fullNode']->body['und'][0]['summary']) && !empty($variables['fullNode']->body['und'][0]['summary'])) { $summary = $variables['fullNode']->body['und'][0]['summary']; $printSnippet = trim(strip_tags(substr($summary, 0, 200))); } /* For content under the "License and Permits" content-type, create a snippet based on information supplied in the node */ if (!empty($variables['fullNode']) && $variables['fullNode']->type === 'licenses_and_permits') { if (!empty($variables['fullNode']->field_lap_county['und'][0]['value'])) { if ($printSnippet !== '') { $printSnippet .= ', '; } $printSnippet .= $variables['fullNode']->field_lap_county['und'][0]['value']; // Add the County to the snippet }