本文整理汇总了PHP中flexicontent_html::striptagsandcut方法的典型用法代码示例。如果您正苦于以下问题:PHP flexicontent_html::striptagsandcut方法的具体用法?PHP flexicontent_html::striptagsandcut怎么用?PHP flexicontent_html::striptagsandcut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexicontent_html
的用法示例。
在下文中一共展示了flexicontent_html::striptagsandcut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: if
<?php if ($this->params->get('intro_use_image', 1) && $src) : ?>
<figure class="image<?php echo $this->params->get('intro_position') ? ' right' : ' left'; ?>">
<?php if ($this->params->get('intro_link_image', 1)) : ?>
<a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, 0, $item)); ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . '::' . htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>">
<img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" />
</a>
<?php else : ?>
<img src="<?php echo $thumb; ?>" alt="<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
</figure>
<?php endif; ?>
<p>
<?php
FlexicontentFields::getFieldDisplay($item, 'text', $values=null, $method='display');
if ($this->params->get('intro_strip_html', 1)) :
echo flexicontent_html::striptagsandcut( $item->fields['text']->display, $this->params->get('intro_cut_text', 200) );
else :
echo $item->fields['text']->display;
endif;
?>
</p>
</div>
<!-- BOF under-description-line1 block -->
<?php if (isset($item->positions['under-description-line1'])) : ?>
<div class="lineinfo line3">
<?php foreach ($item->positions['under-description-line1'] as $field) : ?>
<span class="element">
<?php if ($field->label) : ?>
<span class="flexi label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>
<?php endif; ?>
示例2: onDisplayFieldValue
//.........这里部分代码省略.........
// DO NOT terminate yet if value is empty since a default value on empty may have been defined
// Handle default value loading, instead of empty value
$default_value_use = $field->parameters->get('default_value_use', 0);
$default_value = $default_value_use == 2 ? $field->parameters->get('default_value', '') : '';
if (empty($values) && !strlen($default_value)) {
$field->{$prop} = '';
return;
} else {
if (empty($values) && strlen($default_value)) {
$values = array($default_value);
}
}
// Value handling parameters
$multiple = $field->parameters->get('allow_multiple', 1);
// Language filter the values
$lang_filter_values = $field->parameters->get('lang_filter_values', 1);
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
default:
$separatorf = ' ';
break;
}
// initialise property
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (!strlen($value)) {
continue;
}
$field->{$prop}[$n] = $pretext . ($lang_filter_values ? JText::_($value) : $value) . $posttext;
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
// Apply separator and open/close tags
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
// Add OGP Data
$useogp = $field->parameters->get('useogp', 0);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
if ($useogp && $field->{$prop}) {
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
if (in_array($view, $ogpinview)) {
switch ($ogpusage) {
case 1:
$usagetype = 'title';
break;
case 2:
$usagetype = 'description';
break;
default:
$usagetype = '';
break;
}
if ($usagetype) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:' . $usagetype . '" content="' . $content_val . '" />');
}
}
}
}
示例3: display
/**
* Creates the RSS for the View
*
* @since 1.0
*/
function display($tpl = null)
{
$db = JFactory::getDBO();
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$params = $this->get('Params');
$doc->link = JRoute::_(FlexicontentHelperRoute::getCategoryRoute(JRequest::getVar('cid', null, '', 'int')));
$category = $this->get('Category');
// Prepare query to match feed data
JRequest::setVar('limit', $params->get('feed_limit'));
// Force a specific limit, this will be moved to the model
$params->set('orderby', $params->get('feed_orderby', 'rdate'));
$params->set('orderbycustomfield', $params->get('feed_orderbycustomfield', 1));
$params->set('orderbycustomfieldid', $params->get('feed_orderbycustomfieldid', 0));
$params->set('orderbycustomfielddir', $params->get('feed_orderbycustomfielddir', 'ASC'));
$params->set('orderbycustomfieldint', $params->get('feed_orderbycustomfieldint', 0));
$params->set('orderby_2nd', $params->get('feed_orderby', 'alpha'));
$params->set('orderbycustomfield_2nd', $params->get('feed_orderbycustomfield_2nd', 1));
$params->set('orderbycustomfieldid_2nd', $params->get('feed_orderbycustomfieldid_2nd', 0));
$params->set('orderbycustomfielddir_2nd', $params->get('feed_orderbycustomfielddir_2nd', 'ASC'));
$params->set('orderbycustomfieldint_2nd', $params->get('feed_orderbycustomfieldint_2nd', 0));
$model = $this->getModel();
$model->setState('limit', $params->get('feed_limit', $model->getState('limit')));
$rows = $this->get('Data');
$feed_summary = $params->get('feed_summary', 0);
$feed_summary_cut = $params->get('feed_summary_cut', 200);
$feed_use_image = $params->get('feed_use_image', 1);
$feed_link_image = $params->get('feed_link_image', 1);
$feed_image_source = $params->get('feed_image_source', '');
$feed_image_size = $params->get('feed_image_size', '');
$feed_image_method = $params->get('feed_image_method', 1);
$feed_image_width = $params->get('feed_image_width', 100);
$feed_image_height = $params->get('feed_image_height', 80);
// Retrieve default image for the image field
if ($feed_use_image && $feed_image_source) {
$query = 'SELECT attribs, name FROM #__flexicontent_fields WHERE id = ' . (int) $feed_image_source;
$db->setQuery($query);
$image_dbdata = $db->loadObject();
//$image_dbdata->params = FLEXI_J16GE ? new JRegistry($image_dbdata->params) : new JParameter($image_dbdata->params);
$img_size_map = array('l' => 'large', 'm' => 'medium', 's' => 'small', '' => '');
$img_field_size = $img_size_map[$feed_image_size];
$img_field_name = $image_dbdata->name;
}
// TODO render and add extra fields here ... maybe via special display function for feeds view
$extra_fields = $params->get('feed_extra_fields', '');
$extra_fields = array_unique(preg_split("/\\s*,\\s*/u", $extra_fields));
if ($extra_fields) {
foreach ($extra_fields as $fieldname) {
// Render given field for ALL ITEMS
FlexicontentFields::getFieldDisplay($rows, $fieldname, $values = null, $method = 'display');
}
}
foreach ($rows as $row) {
// strip html from feed item title
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// url link to article
// & used instead of & as this is converted by feed creator
$link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $category->slug, 0, $row));
// strip html from feed item description text
$description = $feed_summary ? $row->introtext . $row->fulltext : $row->introtext;
$description = flexicontent_html::striptagsandcut($description, $feed_summary_cut);
if ($feed_use_image) {
// feed image is enabled
$src = '';
$thumb = '';
if ($feed_image_source) {
// case 1 use an image field
FlexicontentFields::getFieldDisplay($row, $img_field_name, null, 'display', 'module');
$img_field = $row->fields[$img_field_name];
if (!$img_field_size) {
$src = str_replace(JURI::root(), '', $img_field->thumbs_src['large'][0]);
} else {
$src = '';
$thumb = $img_field->thumbs_src[$img_field_size][0];
}
} else {
// case 2 extract from item
$src = flexicontent_html::extractimagesrc($row);
}
$RESIZE_FLAG = !$feed_image_source || !$img_field_size;
if ($src && $RESIZE_FLAG) {
// Resize image when src path is set and RESIZE_FLAG: (a) using image extracted from item main text OR (b) not using image field's already created thumbnails
$h = '&h=' . $feed_image_height;
$w = '&w=' . $feed_image_width;
$aoe = '&aoe=1';
$q = '&q=95';
$zc = $feed_image_method ? '&zc=' . $feed_image_method : '';
$ext = pathinfo($src, PATHINFO_EXTENSION);
$f = in_array($ext, array('png', 'ico', 'gif')) ? '&f=' . $ext : '';
$conf = $w . $h . $aoe . $q . $zc . $f;
$base_url = !preg_match("#^http|^https|^ftp|^/#i", $src) ? JURI::base(true) . '/' : '';
$thumb = JURI::base(true) . '/components/com_flexicontent/librairies/phpthumb/phpThumb.php?src=' . $base_url . $src . $conf;
} else {
// Do not resize image when (a) image src path not set or (b) using image field's already created thumbnails
//.........这里部分代码省略.........
示例4: htmlspecialchars
if ((int) $version->nr > 0) {
?>
<tr<?php
echo $class;
?>
>
<td class="versions"><span style="padding: 0 5px 0 0;"><?php
echo '#' . $version->nr;
?>
</span></td>
<td class="versions"><span style="padding: 0 5px 0 0;"><?php
echo JHTML::_('date', $version->nr == 1 ? $this->row->created : $version->date, $date_format);
?>
</span></td>
<td class="versions"><span style="padding: 0 5px 0 0;"><?php
echo $version->nr == 1 ? flexicontent_html::striptagsandcut($this->row->creator, 25) : flexicontent_html::striptagsandcut($version->modifier, 25);
?>
</span></td>
<td class="versions"><a href="javascript:;" class="hasTip" title="Comment::<?php
echo htmlspecialchars($version->comment, ENT_COMPAT, 'UTF-8');
?>
"><?php
echo $commentimage;
?>
</a><?php
if ((int) $version->nr == (int) $this->row->current_version) {
?>
<a onclick="javascript:return clickRestore('index.php?option=com_flexicontent&view=item&<?php
echo $task_items;
?>
edit&cid=<?php
示例5:
<td headers="fc_title">
<a href="<?php
echo $item_link;
?>
">
<?php
echo $this->escape($item->title);
?>
</a>
<?php
echo $markup_tags;
?>
</td>
<td headers="fc_intro">
<?php
echo flexicontent_html::striptagsandcut($item->introtext, 150);
?>
</td>
<?php
if ($use_date) {
?>
<td headers="fc_modified">
<?php
echo JHTML::_('date', $item->modified ? $item->modified : $item->created, JText::_($dateformat));
?>
</td>
<?php
}
?>
示例6: onDisplayCoreFieldValue
//.........这里部分代码省略.........
$field->{$prop} = $pretext . ($field->parameters->get('name_username', 1) == 2 ? $item->cuname : $item->creator) . $posttext;
break;
case 'modified':
// modified
$field->value = array($item->modified);
// Get date format
$customdate = $field->parameters->get('custom_date', 'Y-m-d');
$dateformat = $field->parameters->get('date_format', '');
$dateformat = $dateformat ? JText::_($dateformat) : ($field->parameters->get('lang_filter_format', 0) ? JText::_($customdate) : $customdate);
// Add prefix / suffix
$field->{$prop} = $pretext . JHTML::_('date', $item->modified, $dateformat) . $posttext;
// Add microdata property
$itemprop = $field->parameters->get('microdata_itemprop', 'dateModified');
if ($itemprop) {
$field->{$prop} = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop} . '</div>';
}
break;
case 'modifiedby':
// modified by
$field->value[] = $item->modified_by;
$field->{$prop} = $pretext . ($field->parameters->get('name_username', 1) == 2 ? $item->muname : $item->modifier) . $posttext;
break;
case 'title':
// title
$field->value[] = $item->title;
$field->{$prop} = $pretext . $item->title . $posttext;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 1);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
if ($useogp && $field->{$prop}) {
if (in_array($view, $ogpinview)) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:title" content="' . $content_val . '" />');
}
}
// Add microdata property (currently no parameter in XML for this field)
$itemprop = $field->parameters->get('microdata_itemprop', 'name');
if ($itemprop) {
$field->{$prop} = '<div style="display:inline" itemprop="' . $itemprop . '" >' . $field->{$prop} . '</div>';
}
break;
case 'hits':
// hits
$field->value[] = $item->hits;
$field->{$prop} = $pretext . $item->hits . $posttext;
break;
case 'type':
// document type
$field->value[] = $item->type_id;
$field->{$prop} = $pretext . JText::_($item->typename) . $posttext;
break;
case 'version':
// version
$field->value[] = $item->version;
$field->{$prop} = $pretext . $item->version . $posttext;
break;
case 'state':
// state
$field->value[] = $item->state;
$field->{$prop} = $pretext . flexicontent_html::stateicon($item->state, $field->parameters) . $posttext;
break;
case 'voting':
// voting button
if ($_vote === false) {
示例7:
if ($infocount_str) {
$infocount_str = ' (' . $infocount_str . ')';
}
?>
<!-- EOF subcategory assigned/subcats_count -->
<?php
}
?>
<?php
if ($this->params->get($catid != $currcatid ? 'show_description_subcat' : 'show_description', 1)) {
?>
<!-- BOF subcategory description -->
<div class="catdescription group">
<?php
echo flexicontent_html::striptagsandcut($sub->description, $this->params->get($catid != $currcatid ? 'description_cut_text_subcat' : 'description_cut_text', 120));
?>
</div>
<!-- EOF subcategory description -->
<?php
}
?>
</div>
<?php
if ($items) {
?>
<!-- BOF subcategory items -->
<div class="group">
示例8: onDisplayFieldValue
//.........这里部分代码省略.........
if (!$use_html) {
$value = nl2br(preg_replace("/(\r\n|\r|\n){3,}/", "\n\n", $value));
}
}
unset($value);
// Unset this or you are looking for trouble !!!, because it is a reference and reusing it will overwrite the pointed variable !!!
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
default:
$separatorf = ' ';
break;
}
// Create field's HTML
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (!strlen($value) && !$is_ingroup) {
continue;
}
// Skip empty if not in field group
if (!strlen($value)) {
$field->{$prop}[$n++] = '';
continue;
}
// Add prefix / suffix
$field->{$prop}[$n] = $pretext . $value . $posttext;
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
if (!$is_ingroup) {
// Apply separator and open/close tags
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
}
// ************
// Add OGP tags
// ************
if ($field->parameters->get('useogp', 0) && !empty($field->{$prop})) {
// Get ogp configuration
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
if (in_array($view, $ogpinview)) {
switch ($ogpusage) {
case 1:
$usagetype = 'title';
break;
case 2:
$usagetype = 'description';
break;
default:
$usagetype = '';
break;
}
if ($usagetype) {
$content_val = !$is_ingroup ? flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen) : flexicontent_html::striptagsandcut($opentag . implode($separatorf, $field->{$prop}) . $closetag, $ogpmaxlen);
JFactory::getDocument()->addCustomTag('<meta property="og:' . $usagetype . '" content="' . $content_val . '" />');
}
}
}
}
示例9: onDisplayFieldValue
//.........这里部分代码省略.........
if ($image_source == -1) {
// intro-full image values, these are relative paths up to the site root, must be calculated later !!
$orig_urlpath = str_replace('\\', '/', dirname($image_by_params['image_path']));
} else {
if ($image_source > 0) {
// various folder-mode(s)
$orig_urlpath = $thumb_urlpath . '/original';
} else {
// db-mode
$cparams = JComponentHelper::getParams('com_flexicontent');
$orig_urlpath = str_replace('\\', '/', JPath::clean($cparams->get('file_path', 'components/com_flexicontent/uploads')));
}
}
}
$i = -1;
$field->{$prop} = array();
$field->thumbs_src['backend'] = array();
$field->thumbs_src['small'] = array();
$field->thumbs_src['medium'] = array();
$field->thumbs_src['large'] = array();
$field->thumbs_src['original'] = array();
foreach ($values as $val) {
// Unserialize value's properties and check for empty original name property
$value = unserialize($val);
$image_name = trim(@$value['originalname']);
if (!strlen($image_name)) {
continue;
}
$i++;
// Create thumbnails urls, note thumbnails have already been verified above
$wl = $field->parameters->get('w_l', 800);
$hl = $field->parameters->get('h_l', 600);
$title = @$value['title'] ? $value['title'] : '';
$alt = @$value['alt'] ? $value['alt'] : flexicontent_html::striptagsandcut($item->title, 60);
$alt = flexicontent_html::escapeJsText($alt, 's');
$desc = @$value['desc'] ? $value['desc'] : '';
$srcb = $thumb_urlpath . '/b_' . $extra_prefix . $image_name;
// backend
$srcs = $thumb_urlpath . '/s_' . $extra_prefix . $image_name;
// small
$srcm = $thumb_urlpath . '/m_' . $extra_prefix . $image_name;
// medium
$srcl = $thumb_urlpath . '/l_' . $extra_prefix . $image_name;
// large
$srco = $orig_urlpath . '/' . $image_name;
// original image
// Create a popup url link
$urllink = @$value['urllink'] ? $value['urllink'] : '';
if ($urllink && false === strpos($urllink, '://')) {
$urllink = 'http://' . $urllink;
}
// Create a popup tooltip (legend)
$tip = $title . '::' . $desc;
$tip = flexicontent_html::escapeJsText($tip, 's');
$legend = $uselegend && (!empty($title) || !empty($desc)) ? ' class="hasTip" title="' . $tip . '"' : '';
// Create a unique id for the link tags, and a class name for image tags
$uniqueid = $field->item_id . '_' . $field->id . '_' . $i;
$class_img_field = 'fc_field_image';
// Decide thumbnail to use
$thumb_size = 0;
if ($isItemsManager) {
$thumb_size = -1;
} else {
if ($view == 'category') {
$thumb_size = $field->parameters->get('thumbincatview', 1);
} else {
示例10: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values=null, $prop='display')
{
// execute the code only if the field type match the plugin type
if ( !in_array($field->field_type, self::$field_types) ) return;
$field->label = JText::_($field->label);
// Some variables
$document = JFactory::getDocument();
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
// Get field values
$values = $values ? $values : $field->value;
// DO NOT terminate yet if value is empty since a default value on empty may have been defined
// Handle default value loading, instead of empty value
$default_value_use= $field->parameters->get( 'default_value_use', 0 ) ;
$default_value = ($default_value_use == 2) ? $field->parameters->get( 'default_value', '' ) : '';
if ( empty($values) && !strlen($default_value) ) {
$field->{$prop} = '';
return;
} else if ( empty($values) && strlen($default_value) ) {
$values = array($default_value);
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$opentag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'opentag', '' ), 'opentag' );
$closetag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'closetag', '' ), 'closetag' );
// some parameter shortcuts
$use_html = $field->parameters->get( 'use_html', 0 ) ;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 0);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
// Apply seperator and open/close tags
if ($values) {
$field->{$prop} = $use_html ? $values[0] : nl2br($values[0]);
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
if ($useogp && $field->{$prop}) {
if ( in_array($view, $ogpinview) ) {
switch ($ogpusage)
{
case 1: $usagetype = 'title'; break;
case 2: $usagetype = 'description'; break;
default: $usagetype = ''; break;
}
if ($usagetype) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
$document->addCustomTag('<meta property="og:'.$usagetype.'" content="'.$content_val.'" />');
}
}
}
//view
if ( !$field->{$prop} ) {
} else {
$tmp_val = unserialize($field->{$prop});
//var_dump($tmp_val);
$header_html = '<table class="flexitable">'
.'<thead>'
.'<tr>'
.'<th style="font-size:80%;">'.JText::_("Страна").'</th>'
.'<th style="font-size:80%;">'.JText::_("Наименование").'</th>'
.'<th style="font-size:80%;">'.JText::_("Форма выпуска").'</th>'
.'<th style="font-size:80%;">'.JText::_("Регистрационный №").'</th>'
.'<th style="font-size:80%;">'.JText::_("Дата окончания регистрации").'</th>'
.'</tr>'
.'</thead>'
.'<tbody>';
for($intA = 0; $intA < count($tmp_val['country']); $intA++){
$header_html .= '<tr>';
$header_html .= '<td>' . $tmp_val['country'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['naimen'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['vypusk'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['reg'][$intA] . '</td>';
$header_html .= '<td>' . $tmp_val['date'][$intA] . '</td>';
$header_html .= '<tr>';
}
$header_html .= '</tbody>';
$header_html .= '</table>';
$field->{$prop} = $header_html;
//var_dump($field->{$prop});
//var_dump($field->value[0]);
}
}
示例11: download
//.........这里部分代码省略.........
$attachment = null;
$replyto = null;
$replytoname = null;
$send_result = FLEXI_J16GE ? JFactory::getMailer()->sendMail($from, $fromname, $recipient, $subject, $_message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname) : JUtility::sendMail($from, $fromname, $recipient, $subject, $_message, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
}
ob_end_clean();
}
// * Required for IE, otherwise Content-disposition is ignored
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
if ($task == 'download_tree') {
// Create target (top level) folder
JFolder::create($targetpath, 0755);
// Copy Files
foreach ($valid_files as $file) {
JFile::copy($file->abspath, $file->node->targetpath);
}
// Create text/html file with ITEM title / descriptions
// TODO replace this with a TEMPLATE file ...
$desc_filename = $targetpath . DS . "_descriptions";
$handle_txt = fopen($desc_filename . ".txt", "w");
$handle_htm = fopen($desc_filename . ".htm", "w");
fprintf($handle_htm, '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
');
foreach ($valid_files as $file) {
fprintf($handle_txt, "%s", $file->item_title . "\n\n");
fprintf($handle_txt, "%s", flexicontent_html::striptagsandcut($file->item_introtext) . "\n\n");
if (strlen($file->item_fulltext)) {
fprintf($handle_txt, "%s", flexicontent_html::striptagsandcut($file->item_fulltext) . "\n\n");
}
fprintf($handle_htm, "%s", "<h2>" . $file->item_title . "</h2>");
fprintf($handle_htm, "%s", "<blockquote>" . $file->item_introtext . "</blockquote><br/>");
if (strlen($file->item_fulltext)) {
fprintf($handle_htm, "%s", "<blockquote>" . $file->item_fulltext . "</blockquote><br/>");
}
fprintf($handle_htm, "<hr/><br/>");
}
fclose($handle_txt);
fclose($handle_htm);
// Get file list recursively, and calculate archive filename
$fileslist = JFolder::files($targetpath, '.', $recurse = true, $fullpath = true);
$archivename = $tmp_ffname . '.zip';
$archivepath = JPath::clean($app->getCfg('tmp_path') . DS . $archivename);
// ******************
// Create the archive
// ******************
/*$app = JFactory::getApplication('administrator');
$files = array();
foreach ($fileslist as $i => $filename) {
$files[$i]=array();
$files[$i]['name'] = preg_replace("%^(\\\|/)%", "", str_replace($targetpath, "", $filename) ); // STRIP PATH for filename inside zip
$files[$i]['data'] = implode('', file($filename)); // READ contents into string, here we use full path
$files[$i]['time'] = time();
}
$packager = JArchive::getAdapter('zip');
if (!$packager->create($archivepath, $files)) {
$msg = JText::_('FLEXI_OPERATION_FAILED'). ": compressed archive could not be created";
$app->enqueueMessage($msg, 'notice');
示例12: onDisplayFieldValue
function onDisplayFieldValue(&$field, $item, $values=null, $prop='display')
{
// execute the code only if the field type match the plugin type
if ( !in_array($field->field_type, self::$field_types) ) return;
$field->label = JText::_($field->label);
// Some variables
$document = JFactory::getDocument();
$view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW));
// Get field values
$values = $values ? $values : $field->value;
// DO NOT terminate yet if value is empty since a default value on empty may have been defined
// Handle default value loading, instead of empty value
$default_value_use= $field->parameters->get( 'default_value_use', 0 ) ;
$default_value = ($default_value_use == 2) ? $field->parameters->get( 'default_value', '' ) : '';
if ( empty($values) && !strlen($default_value) ) {
$field->{$prop} = '';
return;
} else if ( empty($values) && strlen($default_value) ) {
$values = array($default_value);
}
// Prefix - Suffix - Separator parameters, replacing other field values if found
$opentag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'opentag', '' ), 'opentag' );
$closetag = FlexicontentFields::replaceFieldValue( $field, $item, $field->parameters->get( 'closetag', '' ), 'closetag' );
// some parameter shortcuts
$use_html = $field->parameters->get( 'use_html', 0 ) ;
// Get ogp configuration
$useogp = $field->parameters->get('useogp', 0);
$ogpinview = $field->parameters->get('ogpinview', array());
$ogpinview = FLEXIUtilities::paramToArray($ogpinview);
$ogpmaxlen = $field->parameters->get('ogpmaxlen', 300);
$ogpusage = $field->parameters->get('ogpusage', 0);
// Apply seperator and open/close tags
if ($values) {
$field->{$prop} = $use_html ? $values[0] : nl2br($values[0]);
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
if ($useogp && $field->{$prop}) {
if ( in_array($view, $ogpinview) ) {
switch ($ogpusage)
{
case 1: $usagetype = 'title'; break;
case 2: $usagetype = 'description'; break;
default: $usagetype = ''; break;
}
if ($usagetype) {
$content_val = flexicontent_html::striptagsandcut($field->{$prop}, $ogpmaxlen);
$document->addCustomTag('<meta property="og:'.$usagetype.'" content="'.$content_val.'" />');
}
}
}
}
示例13: bindExtData
/**
* Method to add flexi extended datas to standard content
*
* @params object the unassociated items rows
* @params boolean add the records from the items_ext table
* @return boolean
* @since 1.5
*/
function bindExtData($rows)
{
if (!$rows || !count($rows)) {
return;
}
$default_lang = flexicontent_html::getSiteDefaultLang();
$typeid = JRequest::getVar('typeid', 1);
$default_cat = (int) JRequest::getVar('default_cat', '');
// Get invalid cats, to avoid using them during binding, this is only done once
$session = JFactory::getSession();
$badcats_fixed = $session->get('badcats', null, 'flexicontent');
if ($badcats_fixed === null) {
// Correct non-existent main category in content table
$query = 'UPDATE #__content as c ' . ' LEFT JOIN #__categories as cat ON c.catid=cat.id' . ' SET c.catid=' . $default_cat . ' WHERE cat.id IS NULL';
$this->_db->setQuery($query);
$this->_db->query();
$session->set('badcats_fixed', 1, 'flexicontent');
}
// Calculate item data to be used for current bind STEP
$catrel = array();
foreach ($rows as $row) {
$row_catid = (int) $row->catid;
$catrel[] = '(' . $row_catid . ', ' . (int) $row->id . ')';
// append the text property to the object
if (JString::strlen($row->fulltext) > 1) {
$row->text_stripped = $row->introtext . '<hr id="system-readmore" />' . $row->fulltext;
} else {
$row->text_stripped = flexicontent_html::striptagsandcut($row->introtext);
}
}
// Insert main category-item relation via single query
$catrel = implode(', ', $catrel);
$query = "INSERT INTO #__flexicontent_cats_item_relations (`catid`, `itemid`) " . " VALUES " . $catrel . " ON DUPLICATE KEY UPDATE ordering=ordering";
$this->_db->setQuery($query);
$this->_db->query();
// Insert items_ext datas,
// NOTE: we will not use a single query for creating multiple records, instead we will create only e.g. 100 at once,
// because of the column search_index which can be quite long
$itemext = array();
$id_arr = array();
$row_count = count($rows);
$n = 0;
foreach ($rows as $row) {
if (FLEXI_J16GE) {
$ilang = $row->language ? $row->language : $default_lang;
} else {
$ilang = $default_lang;
}
// J1.5 has no language setting
$itemext[] = '(' . (int) $row->id . ', ' . $typeid . ', ' . $this->_db->Quote($ilang) . ', ' . $this->_db->Quote($row->title . ' | ' . $row->text_stripped) . ', ' . (int) $row->id . ')';
$id_arr[] = (int) $row->id;
$n++;
if ($n % 101 == 0 || $n == $row_count) {
$itemext_list = implode(', ', $itemext);
$query = "INSERT INTO #__flexicontent_items_ext (`item_id`, `type_id`, `language`, `search_index`, `lang_parent_id`)" . " VALUES " . $itemext_list . " ON DUPLICATE KEY UPDATE type_id=VALUES(type_id), language=VALUES(language), search_index=VALUES(search_index)";
$this->_db->setQuery($query);
$this->_db->query();
$itemext = array();
$query = "UPDATE #__flexicontent_items_tmp" . " SET type_id=" . $typeid . " WHERE id IN(" . implode(',', $id_arr) . ")";
$this->_db->setQuery($query);
$this->_db->query();
}
}
// Update temporary item data
$this->updateItemCountingData($rows);
}
示例14: foreach
" alt="<?php
echo $title_encoded;
?>
" />
<?php
}
?>
</div>
<?php
}
?>
<p>
<?php
//FlexicontentFields::getFieldDisplay($item, 'text', $values=null, $method='display');
if ($this->params->get('intro_strip_html', 1)) {
echo flexicontent_html::striptagsandcut($item->fields['text']->display, $intro_cut_text, $uncut_length);
} else {
echo $item->fields['text']->display;
}
?>
</p>
</div>
<!-- BOF under-description-line1 block -->
<?php
if (isset($item->positions['under-description-line1'])) {
?>
<div class="lineinfo line3">
<?php
foreach ($item->positions['under-description-line1'] as $field) {
?>
示例15: sendNotificationEmails
//.........这里部分代码省略.........
}
$body .= "<br/>\r\n";
// ADD INFO about category assignments
$body .= '<u>' . JText::_('FLEXI_NF_CATEGORIES_ASSIGNMENTS') . '</u>';
if (!$isnew) {
$body .= " [ " . JText::_($cats_altered ? 'FLEXI_NF_MODIFIED' : 'FLEXI_NF_UNCHANGED') . " ] : <br/>\r\n";
} else {
$body .= " : <br/>\r\n";
}
foreach ($cats_titles as $i => $cats_title) {
$body .= " " . ($i + 1) . ". " . $cats_title . "<br/>\r\n";
}
// ADD INFO for category assignments added or removed
if (!empty($cats_added_titles) && count($cats_added_titles)) {
$body .= '<u>' . JText::_('FLEXI_NF_ITEM_CATEGORIES_ADDED') . "</u> : <br/>\r\n";
foreach ($cats_added_titles as $i => $cats_title) {
$body .= " " . ($i + 1) . ". " . $cats_title . "<br/>\r\n";
}
}
if (!empty($cats_removed_titles) && count($cats_removed_titles)) {
$body .= '<u>' . JText::_('FLEXI_NF_ITEM_CATEGORIES_REMOVED') . "</u> : <br/>\r\n";
foreach ($cats_removed_titles as $i => $cats_title) {
$body .= " " . ($i + 1) . ". " . $cats_title . "<br/>\r\n";
}
}
$body .= "<br/>\r\n<br/>\r\n";
$lang = '&lang=' . substr($this->get('language'), 0, 2);
// ADD INFO for custom notify text
$subject .= ' ' . JText::_($notify_text);
// ADD INFO for view/edit link
if (in_array('viewlink', $nf_extra_properties)) {
$body .= '<u>' . JText::_('FLEXI_NF_VIEW_IN_FRONTEND') . "</u> : <br/>\r\n ";
$link = JRoute::_(JURI::root(false) . FlexicontentHelperRoute::getItemRoute($this->get('id'), $this->get('catid')) . $lang);
$body .= '<a href="' . $link . '" target="_blank">' . $link . "</a><br/>\r\n<br/>\r\n";
// THIS IS BOGUS *** for unicode menu aliases
//$body .= $link . "<br/>\r\n<br/>\r\n";
}
if (in_array('editlinkfe', $nf_extra_properties)) {
$body .= '<u>' . JText::_('FLEXI_NF_EDIT_IN_FRONTEND') . "</u> : <br/>\r\n ";
$link = JRoute::_(JURI::root(false) . 'index.php?option=com_flexicontent&view=' . FLEXI_ITEMVIEW . '&cid=' . $this->get('catid') . '&id=' . $this->get('id') . '&task=edit');
$body .= '<a href="' . $link . '" target="_blank">' . $link . "</a><br/>\r\n<br/>\r\n";
// THIS IS BOGUS *** for unicode menu aliases
//$body .= $link . "<br/>\r\n<br/>\r\n";
}
if (in_array('editlinkbe', $nf_extra_properties)) {
$body .= '<u>' . JText::_('FLEXI_NF_EDIT_IN_BACKEND') . "</u> : <br/>\r\n ";
$fc_ctrl_task = FLEXI_J16GE ? 'task=items.edit' : 'controller=items&task=edit';
$link = JRoute::_(JURI::root(false) . 'administrator/index.php?option=com_flexicontent&' . $fc_ctrl_task . '&cid=' . $this->get('id'));
$body .= '<a href="' . $link . '" target="_blank">' . $link . "</a><br/>\r\n<br/>\r\n";
// THIS IS BOGUS *** for unicode menu aliases
//$body .= $link . "<br/>\r\n<br/>\r\n";
}
// ADD INFO for introtext/fulltext
if ($params->get('nf_add_introtext')) {
//echo "<pre>"; print_r($this->_item); exit;
$body .= "<br/><br/>\r\n";
$body .= "*************************************************************** <br/>\r\n";
$body .= JText::_('FLEXI_NF_INTROTEXT_LONG') . "<br/>\r\n";
$body .= "*************************************************************** <br/>\r\n";
$body .= flexicontent_html::striptagsandcut($this->get('introtext'), 200);
}
if ($params->get('nf_add_fulltext')) {
$body .= "<br/><br/>\r\n";
$body .= "*************************************************************** <br/>\r\n";
$body .= JText::_('FLEXI_NF_FULLTEXT_LONG') . "<br/>\r\n";
$body .= "*************************************************************** <br/>\r\n";
$body .= flexicontent_html::striptagsandcut($this->get('fulltext'), 200);
}
// **********
// Send email
// **********
$from = $app->getCfg('mailfrom');
$fromname = $app->getCfg('fromname');
$recipient = $params->get('nf_send_as_bcc', 0) ? array($from) : $notify_emails;
$html_mode = true;
$cc = null;
$bcc = $params->get('nf_send_as_bcc', 0) ? $notify_emails : null;
$attachment = null;
$replyto = null;
$replytoname = null;
if (!FLEXI_J16GE) {
jimport('joomla.utilities.utility');
}
$send_result = FLEXI_J16GE ? JFactory::getMailer()->sendMail($from, $fromname, $recipient, $subject, $body, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname) : JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $html_mode, $cc, $bcc, $attachment, $replyto, $replytoname);
$debug_str = "" . "<br/>FROM: {$from}" . "<br/>FROMNAME: {$fromname} <br/>" . "<br/>RECIPIENTS: " . implode(",", $recipient) . "<br/>BCC: " . ($bcc ? implode(",", $bcc) : '') . "<br/>" . "<br/>SUBJECT: {$subject} <br/>" . "<br/><br/>**********<br/>BODY<br/>**********<br/> {$body} <br/>";
if ($send_result) {
// OK
if ($params->get('nf_enable_debug', 0)) {
$app->enqueueMessage("Sending WORKFLOW notification emails SUCCESS", 'message');
$app->enqueueMessage($debug_str, 'message');
}
} else {
// NOT OK
if ($params->get('nf_enable_debug', 0)) {
$app->enqueueMessage("Sending WORKFLOW notification emails FAILED", 'warning');
$app->enqueueMessage($debug_str, 'message');
}
}
return $send_result;
}