public static function cText($text, $limit, $type = 0) { //function to cut text $text = preg_replace('/<img[^>]+\\>/i', "", $text); if ($limit == 0) { //no limit $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>'; $text = strip_tags($text, $allowed_tags); $text = $text; } else { if ($type == 1) { //character lmit $text = JFilterOutput::cleanText($text); $sep = strlen($text) > $limit ? '...' : ''; $text = utf8_substr($text, 0, $limit) . $sep; } else { //word limit $text = JFilterOutput::cleanText($text); $text = explode(' ', $text); $sep = count($text) > $limit ? '...' : ''; $text = implode(' ', array_slice($text, 0, $limit)) . $sep; } } return $text; }
function stripText($text) { $text = str_replace(array("\r\n", "\n", "\r", "\t"), "", $text); $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8'); $text = JFilterOutput::cleanText($text); $text = trim($text); return $text; }
/** * Display the view * * */ public function display($tpl = null) { $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); // What Access Permissions does this user have? What can (s)he do? $this->canDo = jdownloadsHelper::getActions(); // get filename when selected in files list $session = JFactory::getSession(); $filename = $session->get('jd_filename'); if ($filename) { $this->selected_filename = JFilterOutput::cleanText($filename); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); }
/** * Constructor * */ function __construct() { parent::__construct(); // Register Extra task $this->registerTask('apply', 'save'); $this->registerTask('add', 'edit'); $this->registerTask('download', 'download'); $this->registerTask('delete', 'delete'); $this->registerTask('deletepreview', 'deletepreview'); $this->registerTask('create', 'add'); // store filename in session when is selected in files list $jinput = JFactory::getApplication()->input; $filename = $jinput->get('file', '', 'string'); $filename = JFilterOutput::cleanText($filename); $session = JFactory::getSession(); if ($filename != '') { $session->set('jd_filename', $filename); } else { $session->set('jd_filename', ''); } }
if ($relDay > 0) { $eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " +{$relDay} days"); } else { $eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $eventDate) . " {$relDay} days"); } $targetid = $this->modparams->get("target_itemid", 0); $link = $row->viewDetailLink(date("Y", $eventDate), date("m", $eventDate), date("d", $eventDate), false, $targetid); $link = str_replace("&tmpl=component", "", $link); $item_link = JRoute::_($link . $this->jeventCalObject->datamodel->getCatidsOutLink()); // removes all formating from the intro text for the description text $item_description = $row->content(); // remove dodgy border e.g. "diamond/question mark" $item_description = preg_replace('#border=[\\"\'][^0-9]*[\\"\']#i', '', $item_description); if ($this->info['limit_text']) { if ($this->info['text_length']) { $item_description = JFilterOutput::cleanText($item_description); // limits description text to x words $item_description_array = explode(' ', $item_description); $count = count($item_description_array); if ($count > $this->info['text_length']) { $item_description = ''; for ($a = 0; $a < $this->info['text_length']; $a++) { $item_description .= $item_description_array[$a] . ' '; } $item_description = trim($item_description); $item_description .= '...'; } } else { // do not include description when text_length = 0 $item_description = NULL; }
<?php echo $row->title; ?> </a> <?php } ?> </td> <td align="center"><?php echo $row->username; ?> </td> <td align="left"><?php $row->content = JFilterOutput::cleanText(strip_tags($row->content)); echo PhocaguestbookHelper::wordDelete($row->content, 60, '...'); ?> </td> <td align="center"><?php echo $row->ip; ?> </td> <td align="center"><?php echo $published; ?> </td> <td class="order"> <span><?php
private function prepareData( $type = 'new', $options ) { Komento::import( 'helper', 'date' ); $data = array(); if( $type === 'confirm' ) { $subscribeTable = Komento::getTable( 'subscription' ); $subscribeTable->load( $options['subscribeId'] ); $profile = Komento::getProfile( $subscribeTable->userid ); } else { $profile = Komento::getProfile( $options['comment']->created_by ); $data['contentTitle'] = $options['comment']->contenttitle; $data['contentPermalink'] = $options['comment']->pagelink; $data['commentAuthorName'] = $options['comment']->name; $data['commentAuthorAvatar'] = $profile->getAvatar(); } $config = Komento::getConfig(); switch( $type ) { case 'confirm': $data['confirmLink'] = rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=confirmSubscription&id=' . $options['subscribeId']; break; case 'pending': case 'moderate': $hashkeys = Komento::getTable( 'hashkeys' ); $hashkeys->uid = $options['comment']->id; $hashkeys->type = 'comment'; $hashkeys->store(); $key = $hashkeys->key; $data['approveLink'] = rtrim( JURI::root() , '/' ) . '/index.php?option=com_komento&task=approveComment&token=' . $key; $data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment); $date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate ); $date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) ); $data['commentDate'] = $date; break; case 'report': $action = Komento::getTable( 'actions' ); $action->load( $options['actionId'] ); $actionUser = $action->action_by; $data['actionUser'] = Komento::getProfile( $actionUser ); $data['commentPermalink'] = $data['contentPermalink'] . '#kmt-' . $options['comment']->id; $data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment); $date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate ); $date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) ); $data['commentDate'] = $date; break; case 'reply': case 'comment': case 'new': default: $data['commentPermalink'] = $data['contentPermalink'] . '#kmt-' . $options['comment']->id; $data['commentContent'] = JFilterOutput::cleanText($options['comment']->comment); $date = KomentoDateHelper::dateWithOffSet( $options['comment']->unformattedDate ); $date = KomentoDateHelper::toFormat( $date , $config->get( 'date_format' , '%A, %B %e, %Y' ) ); $data['commentDate'] = $date; $data['unsubscribe'] = rtrim( JURI::root(), '/' ) . '/index.php?option=com_komento&task=unsubscribe&id='; break; } return $data; }
/** * Execute a cleanText test case. * * @param string $data The original output * @param string $expect The expected result for this test. * * @return void * * @dataProvider casesCleanText */ function testCleanText($data, $expect) { $this->markTestSkipped('Why are we calling JFilterOutput in JFilterInputTest?'); $this->assertThat($expect, $this->equalTo(JFilterOutput::cleanText($data))); }
function getLayoutOutput(&$items) { $layout = ''; $layout_path = dirname(__FILE__) . DS . 'layouts' . DS; $layout_file = @fopen($layout_path . $this->_params->layout . '.ini', 'r'); if ($layout_file) { while (!feof($layout_file)) { $layout .= fread($layout_file, 1024); } } if (!$layout) { $layout_file = @fopen($layout_path . 'default.ini', 'r'); if ($layout_file) { while (!feof($layout_file)) { $layout .= fread($layout_file, 1024); } } } if (!$layout) { return '<!-- CustoMenu: No layout file found: /modules/mod_customenu/customenu/layouts/' . $this->_params->layout . '.ini' . '--->'; } $html = $layout; // remove comments $html = preg_replace('#\\s*/\\*.*?\\*/\\s*#s', '', $html); // remove redundant whitespace (space between html tags and dynamic tags) $html = preg_replace('#>\\s+<#s', '><', $html); $html = preg_replace('#>\\s+{#s', '>{', $html); $html = preg_replace('#}\\s+<#s', '}<', $html); // remove leading / trailing whitespace $html = trim($html); // match the menu items part preg_match('#{items}(.*?){/items}#s', $html, $layout_item); $html_items = ''; foreach ($items as $item_nr => $item) { $html_item = $layout_item['1']; $html_item = str_replace('{item_nr}', $item_nr, $html_item); $link = JFilterOutput::ampReplace($item->link); $link_href = 'href="' . $link . '"'; if ($item->target) { $target = '_blank'; $link_href .= ' target="_blank"'; $link_onclick = 'onclick="window.open(\'' . $link . '\');"'; } else { $target = ''; $link_onclick = 'onclick="location.href=\'' . $link . '\';"'; } $html_item = str_replace('{item_link}', $link, $html_item); $html_item = str_replace('{item_link_href}', $link_href, $html_item); $html_item = str_replace('{item_link_onclick}', $link_onclick, $html_item); $html_item = str_replace('{item_target}', $target, $html_item); $html_item = str_replace('{item_target_bool}', $item->target, $html_item); $text = $item->text; if ($item->hide_text) { $text = '<p style="text-indent: -9000px;">' . $text . '</p>'; } $html_item = str_replace('{item_text}', $text, $html_item); $html_item = str_replace('{item_title}', JFilterOutput::cleanText($item->text), $html_item); $html_item = str_replace('{item_class}', $item->class, $html_item); $html_item = str_replace('{item_active}', $item->active ? 'active' : 'inactive', $html_item); $html_item = str_replace('{item_active_bool}', $item->active, $html_item); $html_items .= $html_item; } $html = str_replace($layout_item['0'], $html_items, $html); // replace the overal dynamic tags $suffix = $this->_params->suffix; $html = str_replace('{suffix}', $suffix, $html); $html = str_replace('{style}', $suffix, $html); // for backward compatibility $hover = 'onmouseover="changeClassName(this,\'link_normal\',\'link_hover\');" onmouseout="changeClassName(this,\'link_hover\',\'link_normal\');"'; $html = str_replace('{hover}', $hover, $html); return $html; }
public function __construct($objectid, $parent = NULL, $fileName = NULL, $title = NULL, $description = NULL, $type = NULL, $ordering = NULL) { $this->objectid = $objectid; if ($parent) { $this->parent = $parent; } if ($fileName) { $this->fileName = $fileName; } if ($title) { $this->title = JFilterOutput::cleanText($title); } if ($description) { $this->description = JFilterOutput::cleanText($description); } if ($type) { $this->type = $type; } if ($ordering) { $this->ordering = $ordering; } }
public function edit() { $this->id = JRequest::getInt('mesid', 0); $message = KunenaForumMessageHelper::get($this->id); $topic = $message->getTopic(); $fields = array ( 'name' => JRequest::getString ( 'authorname', $message->name ), 'email' => JRequest::getString ( 'email', $message->email ), 'subject' => JRequest::getVar('subject', $message->subject, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input 'message' => JRequest::getVar('message', $message->message, 'POST', 'string', JREQUEST_ALLOWRAW), // RAW input 'modified_reason' => JRequest::getString ( 'modified_reason', $message->modified_reason ), 'icon_id' => JRequest::getInt ( 'topic_emoticon', $topic->icon_id ), 'anonymous' => JRequest::getInt ( 'anonymous', 0 ), 'poll_title' => JRequest::getString ( 'poll_title', null ), 'poll_options' => JRequest::getVar('polloptionsID', array (), 'post', 'array'), // Array of key => string 'poll_time_to_live' => JRequest::getString ( 'poll_time_to_live', 0 ), 'tags' => JRequest::getString ( 'tags', null ), 'mytags' => JRequest::getString ( 'mytags', null ) ); if (! JSession::checkToken('post')) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); $this->redirectBack (); } if (!$message->authorise('edit')) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( $message->getError(), 'notice' ); $this->redirectBack (); } // Update message contents $message->edit ( $fields ); // If requested: Make message to be anonymous if ($fields['anonymous'] && $message->getCategory()->allow_anonymous) { $message->makeAnonymous(); } // Mark attachments to be deleted $attachments = JRequest::getVar('attachments', array(), 'post', 'array'); // Array of integer keys $attachkeeplist = JRequest::getVar('attachment', array(), 'post', 'array'); // Array of integer keys $removeList = array_keys(array_diff_key($attachments, $attachkeeplist)); JArrayHelper::toInteger($removeList); $message->removeAttachment($removeList); // Upload new attachments foreach ($_FILES as $key=>$file) { $intkey = 0; if (preg_match('/\D*(\d+)/', $key, $matches)) $intkey = (int)$matches[1]; if ($file['error'] != UPLOAD_ERR_NO_FILE) $message->uploadAttachment($intkey, $key, $this->catid); } // Set topic icon if permitted if ($this->config->topicicons && isset($fields['icon_id']) && $topic->authorise('edit', null, false)) { $topic->icon_id = $fields['icon_id']; } // Check if we are editing first post and update topic if we are! if ($topic->first_post_id == $message->id) { $topic->subject = $fields['subject']; } // If user removed all the text and message doesn't contain images or objects, delete the message instead. $text = KunenaHtmlParser::parseBBCode($message->message); if (!preg_match('!(<img |<object )!', $text)) { $text = trim(JFilterOutput::cleanText($text)); } if (!$text) { // Reload message (we don't want to change it). $message->load(); if ($message->publish(KunenaForum::DELETED)) { $this->app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_DELETE')); } else { $this->app->enqueueMessage($message->getError(), 'notice'); } $this->app->redirect($message->getUrl($this->return, false)); } // Activity integration $activity = KunenaFactory::getActivityIntegration(); $activity->onBeforeEdit($message); // Save message $success = $message->save (); if (! $success) { $this->app->setUserState('com_kunena.postfields', $fields); $this->app->enqueueMessage ( $message->getError (), 'error' ); $this->redirectBack (); } // Display possible warnings (upload failed etc) foreach ( $message->getErrors () as $warning ) { $this->app->enqueueMessage ( $warning, 'notice' ); } $poll_title = $fields['poll_title']; if ($poll_title !== null && $message->id == $topic->first_post_id) { // Save changes into poll $poll_options = $fields['poll_options']; $poll = $topic->getPoll(); if (! empty ( $poll_options ) && ! empty ( $poll_title )) { $poll->title = $poll_title; $poll->polltimetolive = $fields['poll_time_to_live']; $poll->setOptions($poll_options); if (!$topic->poll_id) { // Create a new poll if (!$topic->authorise('poll.create')) { $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->save()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $topic->poll_id = $poll->id; $topic->save(); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_CREATED' ) ); } } else { // Edit existing poll if (!$topic->authorise('poll.edit')) { $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->save()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_EDITED' ) ); } } } elseif ($poll->exists() && $topic->authorise('poll.edit')) { // Delete poll if (!$topic->authorise('poll.delete')) { // Error: No permissions to delete poll $this->app->enqueueMessage ( $topic->getError(), 'notice' ); } elseif (!$poll->delete()) { $this->app->enqueueMessage ( $poll->getError(), 'notice' ); } else { $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POLL_DELETED' ) ); } } } // Update Tags $this->updateTags($message->thread, $fields['tags'], $fields['mytags']); $activity->onAfterEdit($message); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_SUCCESS_EDIT' ) ); if ($message->hold == 1) { // If user cannot approve message by himself, send email to moderators. if (!$topic->authorise('approve')) $message->sendNotification(); $this->app->enqueueMessage ( JText::_ ( 'COM_KUNENA_GEN_MODERATED' ) ); } $this->app->redirect ( $message->getUrl($this->return, false ) ); }
public static function getText($text, $limit, $type) { $text = JFilterOutput::cleanText($text); switch ($type) { case 0: $text = explode(' ', $text); $text = implode(' ', array_slice($text, 0, $limit)); break; case 1: $text = utf8_substr($text, 0, $limit); break; case 2: $text = $text; break; default: $text = explode(' ', $text); $text = implode(' ', array_slice($text, 0, $limit)); break; } return $text; }
/** * String show limitation * * @param string $text * @param int $limit * @param string $type, default: no others: no, char, word * @return string */ public function textLimit($text, $limit, $type = 'no') { //function to cut text $text = preg_replace('/<img[^>]+\\>/i', "", $text); if ($limit == 'no') { //no limit $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>'; //$text = strip_tags( $text, $allowed_tags ); $text = $text; } else { if ($type == 'char') { // character lmit $text = JFilterOutput::cleanText($text); $sep = utf8_strlen($text) > $limit ? '' : ''; // core function of joomla. link: http://api.joomla.org/elementindex_utf8.html $text = utf8_substr($text, 0, $limit) . $sep; } else { // word limit $text = JFilterOutput::cleanText($text); $text = explode(' ', $text); $sep = count($text) > $limit ? '' : ''; $text = implode(' ', array_slice($text, 0, $limit)) . $sep; } } return $text; }
/** * Creates the output for the details view * * @since 0.9 */ function display($tpl = null) { $mainframe =& JFactory::getApplication(); $uri =& JFactory::getUri(); /* Set which page to show */ $tpl = JRequest::getVar('page', null); $params =& $mainframe->getParams('com_redevent'); $document = JFactory::getDocument(); $user = JFactory::getUser(); $dispatcher = JDispatcher::getInstance(); $elsettings = redEVENTHelper::config(); $acl = UserAcl::getInstance(); if ($params->get('gplusone', 1)) { $document->addScript('https://apis.google.com/js/plusone.js'); } if ($params->get('tweet', 1)) { $document->addScript('http://platform.twitter.com/widgets.js'); } $row = $this->get('Details'); $registers = $this->get('Registers'); $roles = $this->get('Roles'); $prices = $this->get('Prices'); $register_fields = $this->get('FormFields'); $regcheck = $this->get('Usercheck'); /* Get the venues information */ $this->_venues = $this->get('Venues'); /* This loads the tags replacer */ JView::loadHelper('tags'); $tags = new redEVENT_tags(); $tags->setEventId(JRequest::getInt('id')); $tags->setXref(JRequest::getInt('xref')); $this->assignRef('tags', $tags); //get menu information $menu =& JSite::getMenu(); $item = $menu->getActive(); if (!$item) { $item = $menu->getDefault(); } //Check if the id exists if ($row->did == 0) { return JError::raiseError(404, JText::sprintf('COM_REDEVENT_Event_d_not_found', $row->did)); } //Check if user has access to the details if ($params->get('showdetails', 1) == 0) { $mainframe->redirect('index.php', JText::_('COM_REDEVENT_EVENT_DETAILS_NOT_AVAILABLE'), 'error'); } //add css file if (!$params->get('custom_css')) { $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css'); } else { $document->addStyleSheet($params->get('custom_css')); } $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->'); //Print $pop = JRequest::getBool('pop'); $params->def('page_title', $row->full_title); if ($pop) { $params->set('popup', 1); } $print_link = JRoute::_('index.php?option=com_redevent&view=details&id=' . $row->slug . '&xref=' . JRequest::getInt('xref') . '&pop=1&tmpl=component'); //pathway $pathway =& $mainframe->getPathWay(); $pathway->addItem($row->full_title, JRoute::_('index.php?option=com_redevent&view=details&id=' . $row->slug)); //Check user if he can edit $allowedtoeditevent = $acl->canEditEvent($row->did); //Timecheck for registration $jetzt = date("Y-m-d"); $now = strtotime($jetzt); $date = strtotime($row->dates); $timecheck = $now - $date; //is the user allready registered at the event if ($regcheck) { // add javascript code for cancel button on attendees layout. JHTML::_('behavior.mootools'); $js = " window.addEvent('domready', function(){\n\t\t \$\$('.unreglink').addEvent('click', function(event){\n\t\t if (confirm('" . JText::_('COM_REDEVENT_CONFIRM_CANCEL_REGISTRATION') . "')) {\n \treturn true;\n\t }\n\t else {\n\t \tif (event.preventDefault) {\n\t \t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tevent.returnValue = false;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\treturn false;\n \t}\n\t\t });\t\t \n\t\t }); "; $document->addScriptDeclaration($js); } //Generate Eventdescription if ($row->datdescription == '' || $row->datdescription == '<br />') { $row->datdescription = JText::_('COM_REDEVENT_NO_DESCRIPTION'); } else { //Execute Plugins $row->datdescription = JHTML::_('content.prepare', $row->datdescription); } // generate Metatags $meta_keywords_content = ""; if (!empty($row->meta_keywords)) { $keywords = explode(",", $row->meta_keywords); foreach ($keywords as $keyword) { if ($meta_keywords_content != "") { $meta_keywords_content .= ", "; } if (preg_match("/[\\/[\\/]/", $keyword)) { $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword))); $buffer = $this->keyword_switcher($keyword, $row, $elsettings->get('formattime', '%H:%M'), $elsettings->get('formatdate', '%d.%m.%Y')); if ($buffer != "") { $meta_keywords_content .= $buffer; } else { $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2); // remove the comma and the white space } } else { $meta_keywords_content .= $keyword; } } } if (!empty($row->meta_description)) { $description = explode("[", $row->meta_description); $description_content = ""; foreach ($description as $desc) { $keyword = substr($desc, 0, strpos($desc, "]", 0)); if ($keyword != "") { $description_content .= $this->keyword_switcher($keyword, $row, $elsettings->get('formattime', '%H:%M'), $elsettings->get('formatdate', '%d.%m.%Y')); $description_content .= substr($desc, strpos($desc, "]", 0) + 1); } else { $description_content .= $desc; } } } else { $description_content = ""; } //set page title and meta stuff $document->setTitle($row->full_title); $document->setMetadata('keywords', $meta_keywords_content); $document->setDescription(strip_tags($description_content)); // more metadata $document->addCustomTag('<meta property="og:title" content="' . $row->full_title . '"/>'); $document->addCustomTag('<meta property="og:type" content="event"/>'); $document->addCustomTag('<meta property="og:url" content="' . htmlspecialchars($uri->toString()) . '"/>'); if ($row->datimage) { $document->addCustomTag('<meta property="og:image" content="' . JURI::base() . 'images/redevent/events/' . $row->datimage . '"/>'); } $document->addCustomTag('<meta property="og:site_name" content="' . $mainframe->getCfg('sitename') . '"/>'); $document->addCustomTag('<meta property="og:description" content="' . JFilterOutput::cleanText($row->summary) . '"/>'); //build the url if (!empty($row->url) && strtolower(substr($row->url, 0, 7)) != "http://") { $row->url = 'http://' . $row->url; } /* Get the Venue Dates */ $venuedates = $this->get('VenueDates'); //add alternate feed link $link = 'index.php?option=com_redevent&view=details&format=feed'; if (!empty($row->slug)) { $link .= '&id=' . $row->slug; } $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); // check unregistration rights $unreg_check = redEVENTHelper::canUnregister($row->xref); //manages attendees $manage_attendees = $this->get('ManageAttendees') || $this->get('ViewFullAttendees'); $candeleteattendees = $this->get('ManageAttendees'); $view_attendees_list = $row->show_names && in_array($params->get('frontend_view_attendees_access'), JFactory::getUser()->getAuthorisedViewLevels()); //assign vars to jview $this->assignRef('row', $row); $this->assignRef('params', $params); $this->assignRef('user', $user); $this->assignRef('allowedtoeditevent', $allowedtoeditevent); $this->assignRef('manage_attendees', $manage_attendees); $this->assignRef('view_attendees_list', $view_attendees_list); $this->assignRef('candeleteattendees', $candeleteattendees); $this->assignRef('print_link', $print_link); $this->assignRef('registers', $registers); $this->assignRef('registersfields', $register_fields); $this->assignRef('elsettings', $elsettings); $this->assignRef('item', $item); $this->assignRef('messages', $messages); $this->assignRef('venuedates', $venuedates); $this->assignRef('unreg_check', $unreg_check); $this->assignRef('roles', $roles); $this->assignRef('prices', $prices); $this->assignRef('uri', $uri); $this->assignRef('lang', JFactory::getLanguage()); if ($params->get('fbopengraph', 1)) { $this->_opengraph(); } $tpl = JRequest::getVar('tpl', $tpl); if ($tpl == '') { switch ($row->details_layout) { case 2: $this->setLayout('fixed'); break; case 1: $this->setLayout('default'); break; case 0: $this->setLayout($params->get('details_layout', 'fixed')); break; } } parent::display($tpl); }
defined('_JEXEC') or die; // Output filter jimport('joomla.filter.filteroutput'); // Feed title echo '<a href="http://feeds.feedburner.com/JoomlaLinkr" target="_blank">Linkr RSS</a>'; // Feed items echo '<div style="padding:4px;">'; $items = $this->feed->get_items(); $total = count($items); for ($n = 0; $n < $total, $n < 3; $n++) { echo '<div>'; $i =& $items[$n]; // Item link $link = $i->get_link(); $link = $link ? $link : 'http://j.l33p.com/linkr'; $link = JHTML::link($link, $i->get_title(), array('target' => '_blank')); // Title echo '<strong>' . $link . '</strong>'; // Description $desc = preg_replace('/<a\\s+.*?href="[^"]+"[^>]*>([^<]+)<\\/a>/is', '\\1', $i->get_description()); $desc = JFilterOutput::cleanText($desc); //$desc = html_entity_decode($desc, ENT_COMPAT, 'UTF-8'); $desc = html_entity_decode($desc, ENT_COMPAT); // PHP4 compatibility if (strlen($desc) > 140) { $desc = substr($desc, 0, 140) . '...'; } echo ': ' . htmlspecialchars($desc, ENT_COMPAT, 'UTF-8'); echo '</div>'; } echo '</div>';
"> <?php if ($commenter->userImage) { ?> <a class="k2Avatar tcAvatar" rel="author" href="<?php echo $commenter->link; ?> "> <?php if (isset($commenter->userImage)) { $src = $commenter->userImage; } if (!empty($src)) { $thumb_img = '<img style="width:' . $tcAvatarWidth . 'px;height:auto;" src="' . $src . '" alt="' . JFilterOutput::cleanText($commenter->userName) . '" />'; } else { if ($is_placehold) { $thumb_img = yt_placehold($placehold_size['k2_content_avatar'], $commenter->userName, $commenter->userName); } } echo $thumb_img; ?> </a> <?php } ?> <?php if ($params->get('commenterLink')) { ?>
public function setLangAdmin() { // add final list of needed lang strings $componentName = JFilterOutput::cleanText($this->componentData->name); $this->langContent['adminsys'][$this->langPrefix] = $componentName; $this->langContent['adminsys'][$this->langPrefix . '_CONFIGURATION'] = $componentName . ' Configuration'; $this->langContent[$this->lang][$this->langPrefix] = $componentName; $this->langContent['admin'][$this->langPrefix . '_BACK'] = 'Back'; $this->langContent['admin'][$this->langPrefix . '_DASH'] = 'Dashboard'; $this->langContent['admin'][$this->langPrefix . '_VERSION'] = 'Version'; $this->langContent['admin'][$this->langPrefix . '_DATE'] = 'Date'; $this->langContent['admin'][$this->langPrefix . '_AUTHOR'] = 'Author'; $this->langContent['admin'][$this->langPrefix . '_WEBSITE'] = 'Website'; $this->langContent['admin'][$this->langPrefix . '_LICENSE'] = 'License'; $this->langContent['admin'][$this->langPrefix . '_CONTRIBUTORS'] = 'Contributors'; $this->langContent['admin'][$this->langPrefix . '_CONTRIBUTOR'] = 'Contributor'; $this->langContent['admin'][$this->langPrefix . '_DASHBOARD'] = $componentName . ' Dashboard'; $this->langContent['admin'][$this->langPrefix . '_SAVE_SUCCESS'] = "Great! Item successfully saved."; $this->langContent['admin'][$this->langPrefix . '_SAVE_WARNING'] = "The value already existed so please select another."; $this->langContent['admin'][$this->langPrefix . '_HELP_MANAGER'] = "Help"; $this->langContent['admin'][$this->langPrefix . '_NEW'] = "New"; $this->langContent['admin'][$this->langPrefix . '_CREATE_NEW_S'] = "Create New %s"; $this->langContent['admin'][$this->langPrefix . '_EDIT_S'] = "Edit %s"; $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_STATE'] = "- Keep Original State -"; $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_ACCESS'] = "- Keep Original Access -"; $this->langContent['admin'][$this->langPrefix . '_KEEP_ORIGINAL_CATEGORY'] = "- Keep Original Category -"; if ($this->componentData->add_license && $this->componentData->license_type == 3) { $this->langContent['admin']['NIE_REG_NIE'] = "<br /><br /><center><h1>Lincense not set for " . $componentName . ".</h1><p>Notify your administrator!<br />The lincense can be obtained from " . $this->componentData->companyname . ".</p></center>"; } // add the langug files needed to import and export data if ($this->addEximport) { $this->langContent['admin'][$this->langPrefix . '_EXPORT_FAILED'] = "Export Failed"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FAILED'] = "Import Failed"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_TITLE'] = "Data Importer"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_NO_IMPORT_TYPE_FOUND'] = "Import type not found."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE'] = "Package to import not found."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_ERROR'] = "Import error."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_SUCCESS'] = "Great! Import successful."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_WARNIMPORTFILE'] = "Warning, import file error."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_NO_FILE_SELECTED'] = "No import file selected."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_A_FILE'] = "Please select a file to import."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_ALL_COLUMNS'] = "Please link all columns."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_SELECT_A_DIRECTORY'] = "Please enter the file directory."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_WARNIMPORTUPLOADERROR'] = "Warning, import upload error."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PLEASE_ENTER_A_PACKAGE_DIRECTORY'] = "Please enter the file directory."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'] = "Path does not have a valid file."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'] = "Does not have a valid file type."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_ENTER_A_URL'] = "Please enter a url."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_MSG_INVALID_URL'] = "Invalid url."; $this->langContent['admin'][$this->langPrefix . '_IMPORT_CONTINUE'] = "Continue"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_UPLOAD'] = "Upload"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE'] = "Select File"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_UPLOAD_BOTTON'] = "Upload File"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_DIRECTORY'] = "Directory"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE_DIRECTORY'] = "Set the path to file"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_GET_BOTTON'] = "Get File"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FROM_URL'] = "URL"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_SELECT_FILE_URL'] = "Enter file URL"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_UPDATE_DATA'] = "Import Data"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FORMATS_ACCEPTED'] = "formats accepted"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'] = "Link File to Table Columns"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_TABLE_COLUMNS'] = "Table Columns"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_FILE_COLUMNS'] = "File Columns"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_PLEASE_SELECT_COLUMN'] = "-- Please Select Column --"; $this->langContent['admin'][$this->langPrefix . '_IMPORT_IGNORE_COLUMN'] = "-- Ignore This Column --"; $this->langContent['admin'][$this->langPrefix . '_NO_ACCESS_GRANTED'] = "No Access Granted!"; } // check if the both array is set if (isset($this->langContent['both']) && ComponentbuilderHelper::checkArray($this->langContent['both'])) { foreach ($this->langContent['both'] as $keylang => $langval) { $this->langContent['admin'][$keylang] = $langval; } } if (isset($this->langContent['admin']) && ComponentbuilderHelper::checkArray($this->langContent['admin'])) { ksort($this->langContent['admin']); foreach ($this->langContent['admin'] as $key => $value) { if (strlen($key) > 0) { if (!isset($lang)) { $lang = ''; } $lang .= $key . '="' . $value . '"' . "\n"; } } return $lang; } return ''; }
private static function cText($text, $limit, $limitas) { switch ($limitas) { case 0: $text = JFilterOutput::cleanText($text); $text = explode(' ', $text); $sep = count($text) > $limit ? '...' : ''; $text = implode(' ', array_slice($text, 0, $limit)) . $sep; break; case 1: $text = JFilterOutput::cleanText($text); $sep = strlen($text) > $limit ? '...' : ''; $text = utf8_substr($text, 0, $limit) . $sep; break; case 2: $allowed_tags = '<b><i><a><small><h1><h2><h3><h4><h5><h6><sup><sub><em><strong><u><br>'; $text = strip_tags($text, $allowed_tags); $text = $text; break; default: $text = JFilterOutput::cleanText($text); $text = explode(' ', $text); $sep = count($text) > $limit ? '...' : ''; $text = implode(' ', array_slice($text, 0, $limit)) . $sep; break; } return $text; }
<span class="categoryLevel"><?php echo $categoryLevel; ?> </span> <a href="<?php echo $editlink; ?> "><?php echo $cat->category_name; ?> </a> </td> <td align="left"> <?php echo shopFunctionsF::limitStringByWord(JFilterOutput::cleanText($cat->category_description), 200); ?> </td> <td> <?php echo $this->catmodel->countProducts($cat->virtuemart_category_id); //ShopFunctions::countProductsByCategory($row->virtuemart_category_id); ?> <a href="<?php echo $showProductsLink; ?> ">[ <?php echo vmText::_('COM_VIRTUEMART_SHOW'); ?> ]</a> </td>
</h3> <ul class="itemCommentsList"> <?php foreach ($this->item->comments as $key=>$comment): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; echo (!$this->item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; echo($comment->published) ? '':' unpublishedComment'; ?>"> <?php if($comment->userImage): ?> <img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" class="comment_image" /> <?php endif; ?> <span class="commentAuthorName"> <?php if(!empty($comment->userLink)): ?> <a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow"> <?php echo $comment->userName; ?> </a> <?php else: ?> <?php echo $comment->userName; ?> <?php endif; ?> </span> <span class="commentDate"> <?php echo JHTML::_('date', $comment->commentDate, JText::_('d F, Y')); ?> </span> <p><?php echo $comment->commentText; ?></p> <?php if($this->inlineCommentsModeration || ($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest)))): ?> <span class="commentToolbar">
/** * This method handles any mailings triggered by an venue store action * * @access public * @param int $venue_id Integer Venue identifier * @param int $edited Integer Venue new or edited * @return boolean * @since 1.0 */ public function onVenueEdited($venue_id, $edited) { //simple, skip if processing not needed if (!$this->params->get('newvenue_mail_user', '1') && !$this->params->get('newvenue_mail_admin', '0') && !$this->params->get('editvenue_mail_user', '1') && !$this->params->get('editvenue_mail_admin', '0')) { return true; } $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $query = ' SELECT v.id, v.published, v.venue, v.city, v.street, v.plz, v.url, v.country, v.locdescription, v.created, v.modified,' . ' CASE WHEN CHAR_LENGTH(v.alias) THEN CONCAT_WS(\':\', v.id, v.alias) ELSE v.id END as slug' . ' FROM #__eventlist_venues AS v' . ' WHERE v.id = ' . (int) $venue_id; $db->setQuery($query); if (!($venue = $db->loadObject())) { if ($db->getErrorNum()) { JError::raiseWarning('0', $db->getErrorMsg()); } return false; } //link for event $link = JRoute::_(JURI::base() . 'index.php?option=com_eventlist&view=venueevents&id=' . $venue->slug, false); //strip description from tags / scripts, etc... $text_description = JFilterOutput::cleanText($venue->locdescription); $modified_ip = getenv('REMOTE_ADDR'); $edited = JHTML::Date($venue->modified, JText::_('DATE_FORMAT_LC2')); $state = $venue->published ? JText::sprintf('MAIL VENUE PUBLISHED', $link) : JText::_('MAIL VENUE UNPUBLISHED'); if (edited) { if ($this->params->get('editvenue_mail_admin', '0')) { $data = new stdClass(); $edited = JHTML::Date($venue->modified, JText::_('DATE_FORMAT_LC2')); $data->subject = JText::sprintf('EDIT VENUE MAIL', $this->_SiteName); $data->body = JText::sprintf('MAIL EDIT VENUE', $user->name, $user->username, $user->email, $modified_ip, $edited, $venue->venue, $venue->url, $venue->street, $venue->plz, $venue->city, $venue->country, $text_description, $state); $data->receivers = $this->_receivers; $this->_mailer($data); } } else { if ($this->params->get('newvenue_mail_admin', '0')) { $data = new stdClass(); $created = JHTML::Date($venue->created, JText::_('DATE_FORMAT_LC2')); $data->subject = JText::sprintf('NEW VENUE MAIL', $this->_SiteName); $data->body = JText::sprintf('MAIL NEW VENUE', $user->name, $user->username, $user->email, $venue->author_ip, $created, $venue->venue, $venue->url, $venue->street, $venue->plz, $venue->city, $venue->country, $text_description, $state); $data->receivers = $this->_receivers; $this->_mailer($data); } } //overwrite $state with usermail text $state = $venue->published ? JText::sprintf('USER MAIL VENUE PUBLISHED', $link) : JText::_('USER MAIL VENUE UNPUBLISHED'); if (edited) { if ($this->params->get('editvenue_mail_user', '1')) { $data = new stdClass(); $edited = JHTML::Date($venue->modified, JText::_('DATE_FORMAT_LC2')); $data->body = JText::sprintf('USER MAIL EDIT VENUE', $user->name, $user->username, $isNew, $venue->venue, $venue->url, $venue->street, $venue->plz, $venue->city, $venue->country, $text_description, $state); $data->subject = JText::sprintf('EDIT USER VENUE MAIL', $this->_SiteName); $data->receivers = $user->email; $this->_mailer($data); } } else { if ($this->params->get('newvenue_mail_user', '1')) { $data = new stdClass(); $created = JHTML::Date($venue->created, JText::_('DATE_FORMAT_LC2')); $data->body = JText::sprintf('USER MAIL NEW VENUE', $user->name, $user->username, $created, $venue->venue, $venue->url, $venue->street, $venue->plz, $venue->city, $venue->country, $text_description, $state); $data->subject = JText::sprintf('NEW USER VENUE MAIL', $this->_SiteName); $data->receivers = $user->email; $this->_mailer($data); } } return true; }
?> </h2> <div class="description event_desc"> <?php $review_txt = trim(strip_tags($this->row->review_message)); echo $this->tags->ReplaceTags($this->row->datdescription, array('hasreview' => !empty($review_txt))); ?> </div> <?php } ?> <?php $strip_details = $this->row->details; $strip_details = JFilterOutput::cleanText($strip_details); $strip_details = trim($strip_details); if ($strip_details) { ?> <h2 class="description"><?php echo JText::_('COM_REDEVENT_SESSION_DETAILS'); ?> </h2> <div class="description event_desc"> <?php echo $this->tags->ReplaceTags($this->row->details); ?> </div> <?php
?> <?php echo $row->userName; ?> <?php } ?> </td> <td> <?php echo $row->commentEmail; ?> </td> <td> <a target="_blank" href="<?php echo JFilterOutput::cleanText($row->commentURL); ?> "><?php echo $row->commentURL; ?> </a> </td> <td> <a class="modal" rel="{handler: 'iframe', size: {x: 1000, y: 600}}" href="<?php echo JURI::root() . K2HelperRoute::getItemRoute($row->itemID . ':' . urlencode($row->itemAlias), $row->catid . ':' . urlencode($row->catAlias)); ?> "><?php echo $row->title; ?> </a> </td>
function rss() { $database = JFactory::getDBO(); $cfg = BidsHelperTools::getConfig(); ob_end_clean(); $feed = $cfg->bid_opt_RSS_feedtype; $cat = JRequest::getInt('cat', ''); $user = JRequest::getInt('user', ''); $limit = $cfg->bid_opt_RSS_description ? intval($cfg->bid_opt_RSS_nritems) : intval($cfg->bid_opt_nr_items_per_page); if (!$limit) $limit = 10; require_once (JPATH_COMPONENT_SITE.DS.'libraries'.DS.'feedcreator'.DS.'feedcreator.php'); $rss = new UniversalFeedCreator(); $rss->title = $cfg->bid_opt_RSS_title; $rss->description = $cfg->bid_opt_RSS_description; $rss->link = htmlspecialchars(JURI::root()); $rss->syndicationURL = htmlspecialchars(JURI::root()); $rss->cssStyleSheet = null; $rss->encoding = 'UTF-8'; $where = " where a.published=1 and a.close_offer=0 and a.close_by_admin=0 "; if ($cat) { if (!$cfg->bid_opt_inner_categories) { $where .= " and a.cat = '" . $cat . "' "; } else { $catOb = BidsHelperTools::getCategoryModel(); $cTree = $catOb->getCategoryTree($cat,true); $cat_ids = array(); if ($cTree) { foreach ($cTree as $cc) { if (!empty($cc->id)) { $cat_ids[] = $cc->id; } } } if (count($cat_ids)) $cat_ids = implode(",", $cat_ids); $where .= " and ( a.cat IN (" . $cat_ids . ") )"; } } if ($user) { $where .= " AND userid=".$database->quote($user); } $database->setQuery("select a.* from #__bid_auctions a left join #__categories c on c.id=a.cat ".$where." order by id desc", 0, $limit); $rows = $database->loadObjectList(); for ($i = 0; $i < count($rows); $i++) { $auction = $rows[$i]; $item_link = JHtml::_('auctiondetails.auctionDetailsURL',$auction, false); // removes all formating from the intro text for the description text $item_description = $auction->description; $item_description = JFilterOutput::cleanText($item_description); $item_description = html_entity_decode($item_description); // load individual item creator class $item = new FeedItem(); // item info $item->title = $auction->title; $item->link = $item_link; $item->description = $item_description; $item->source = $rss->link; $item->date = date('r', strtotime($auction->start_date)); $database->setQuery( "select title from #__categories where id=".$database->quote($auction->cat) ); $item->category = $database->loadResult(); $rss->addItem($item); } echo $rss->createFeed($feed); }
/** * Execute a cleanText test case. * * The test framework calls this function once for each element in the array * returned by the named data provider. * * @param string $data The original output * @param string $expect The expected result for this test. * * @dataProvider dataSet * @return void */ public function testCleanText($data, $expect) { $this->assertEquals($expect, JFilterOutput::cleanText($data)); }
<?php } ?> </ul> </div> <?php } ?> <div class="wrapper changelog"> <?php $text = file_get_contents($this->app->path->path('component.admin:README.markdown')); ?> <textarea disabled="disabled" rows="20" cols="75" name="changelog"><?php echo JFilterOutput::cleanText($text); ?> </textarea> </div> </div> <?php } else { $title = JText::_('No further Update required') . '!'; $message = null; echo $this->partial('message', compact('title', 'message')); } ?> </div>
/** * Legacy function, use {@link JFilterOutput::cleanText()} instead * * @deprecated As of version 1.5 */ function cleanText(&$text) { return JFilterOutput::cleanText($text); }
function importProducts() { $session = JFactory::getSession(); $user = JFactory::getUser(); $date = JFactory::getDate(); $db = JFactory::getDBO(); $id = JRequest::getInt('id'); $lang = JRequest::getString('vmlang', '*'); // Set the response object $response = new JObject(); $response->task = 'importProducts'; //Get K2 default item params $xml = new JXMLElement(JFile::read(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'item.xml')); $itemParams = new JParameter(''); foreach ($xml->params as $paramGroup) { foreach ($paramGroup->param as $param) { if ($param->getAttribute('type') != 'spacer' && $param->getAttribute('name')) { $itemParams->set($param->getAttribute('name'), $param->getAttribute('default')); } } } $itemParams = $itemParams->toString(); $params = $session->get('k2martImageParams'); // Get the product $query = "SELECT product.*, productData.* FROM #__virtuemart_products AS product LEFT JOIN #__virtuemart_products_" . VMLANG . " AS productData ON product.virtuemart_product_id = productData.virtuemart_product_id WHERE product.virtuemart_product_id > {$id} "; if (JRequest::getBool('ignoreUnpublished')) { $query .= " AND product.published = 1"; } $query .= " ORDER BY product.virtuemart_product_id ASC"; $db->setQuery($query, 0, 1); $product = $db->loadObject(); // If we have finished with the products then stop if (is_null($product)) { $response->id = 0; $response->message = JText::_('K2MART_IMPORT_COMPLETED'); $response->status = 1; } elseif (is_null($product->virtuemart_product_id)) { $id++; $response->id = $id; } else { $db->setQuery("SELECT virtuemart_category_id FROM #__virtuemart_product_categories WHERE virtuemart_product_id = " . (int) $product->virtuemart_product_id); $categories = $db->loadObjectList(); $mapping = $session->get('k2martImportMapping', array()); $K2Item = JTable::getInstance('K2Item', 'Table'); $K2Item->title = $product->product_name; $K2Item->alias = $product->product_name; if (count($categories) && isset($mapping['categories'][$categories[0]->virtuemart_category_id])) { $K2Item->catid = $mapping['categories'][$categories[0]->virtuemart_category_id]; } else { $K2Item->catid = $session->get('k2martImportParent'); } $K2Item->trash = 0; $K2Item->published = $product->published; $K2Item->introtext = $product->product_s_desc; $K2Item->fulltext = $product->product_desc; $K2Item->created = $date->toMySQL(); $K2Item->created_by = $user->id; $K2Item->access = 1; $K2Item->ordering = $K2Item->getNextOrder("catid = " . $K2Item->catid); $K2Item->hits = $product->hits; $K2Item->metadesc = $product->metadesc; $K2Item->metakey = $product->metakey; $K2Item->params = $itemParams; $K2Item->language = $lang; $K2Item->check(); $K2Item->store(); $vmMediaModel = JModel::getInstance('Media', 'VirtuemartModel'); $media = $vmMediaModel->getFiles(true, false, $product->virtuemart_product_id, null); if (count($media) && JRequest::getBool('proccessImages')) { $image = realpath(JPATH_SITE . DS . $media[0]->file_url); if (JFile::exists($image)) { JLoader::register('Upload', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2' . DS . 'lib' . DS . 'class.upload.php'); $handle = new Upload($image); $handle->allowed = array('image/*'); //Original image $savepath = JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'src'; $handle->image_convert = 'jpg'; $handle->jpeg_quality = 100; $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = md5("Image" . $K2Item->id); $handle->Process($savepath); $filename = $handle->file_dst_name_body; $savepath = JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'items' . DS . 'cache'; //XLarge image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_XL'; $handle->image_x = $params->get('itemImageXL', '800'); $handle->Process($savepath); //Large image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_L'; $handle->image_x = $params->get('itemImageL', '600'); $handle->Process($savepath); //Medium image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_M'; $handle->image_x = $params->get('itemImageM', '400'); $handle->Process($savepath); //Small image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_S'; $handle->image_x = $params->get('itemImageS', '200'); $handle->Process($savepath); //XSmall image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_XS'; $handle->image_x = $params->get('itemImageXS', '100'); $handle->Process($savepath); //Generic image $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_convert = 'jpg'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename . '_Generic'; $imageWidth = $params->get('itemImageGeneric', '300'); $handle->image_x = $imageWidth; $handle->Process($savepath); } } // Tag the item foreach ($categories as $category) { if (isset($mapping['tags'][$category->virtuemart_category_id])) { $db->setQuery("INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$mapping['tags'][$category->virtuemart_category_id]}, {$K2Item->id})"); $db->query(); } } //Insert K2mart reference $query = "INSERT IGNORE INTO #__k2mart (`baseID`, `referenceID`) VALUES ({$K2Item->id}, {$product->virtuemart_product_id})"; $db->setQuery($query); $db->query(); // Update the response object $response->id = $product->virtuemart_product_id; $response->message = JText::_('K2MART_IMPORTED_PRODUCT') . ': ' . JFilterOutput::cleanText($product->product_name); } return $response; }
} ?> "> <?php if ($commenter->userImage) { ?> <a class="k2Avatar tcAvatar" rel="author" href="<?php echo $commenter->link; ?> "> <img src="<?php echo $commenter->userImage; ?> " alt="<?php echo JFilterOutput::cleanText($commenter->userName); ?> " style="width:<?php echo $tcAvatarWidth; ?> px;height:auto;" /> </a> <?php } ?> <?php if ($params->get('commenterLink')) { ?> <a class="tcLink" rel="author" href="<?php echo $commenter->link;
/** * Execute a cleanText test case. * * @param string $data The original output * @param string $expect The expected result for this test. * * @return void * * @dataProvider casesCleanText */ function testCleanText($data, $expect) { $this->assertThat($expect, $this->equalTo(JFilterOutput::cleanText($data))); }