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


PHP JDocument::getInstance方法代码示例

本文整理汇总了PHP中JDocument::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JDocument::getInstance方法的具体用法?PHP JDocument::getInstance怎么用?PHP JDocument::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDocument的用法示例。


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

示例1: render

 /**
  * Render the error page based on an exception.
  *
  * @param   Exception  $error  The exception for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render(Exception $error)
 {
     try {
         $app = JFactory::getApplication();
         $document = JDocument::getInstance('error');
         if (!$document) {
             // We're probably in an CLI environment
             exit($error->getMessage());
             $app->close(0);
         }
         $config = JFactory::getConfig();
         // Get the current template from the application
         $template = $app->getTemplate();
         // Push the error object into the document
         $document->setError($error);
         if (ob_get_contents()) {
             ob_end_clean();
         }
         $document->setTitle(JText::_('Error') . ': ' . $error->getCode());
         $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => $config->get('debug')));
         // Failsafe to get the error displayed.
         if (empty($data)) {
             exit($error->getMessage());
         } else {
             // Do not allow cache
             $app->allowCache(false);
             $app->setBody($data);
             echo $app->toString();
         }
     } catch (Exception $e) {
         exit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
     }
 }
开发者ID:ziyou-liu,项目名称:1line,代码行数:42,代码来源:page.php

示例2: resetDocumentType

 /**
  * Resets the document type to format=raw 
  *
  * @return void
  * @since 0.1
  * @todo Figure out if there is a better way to do this
  */
 private function resetDocumentType()
 {
     $document =& JFactory::getDocument();
     $raw =& JDocument::getInstance('raw');
     $document = $raw;
     JResponse::clearHeaders();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:14,代码来源:http.php

示例3: testCalendar

 /**
  * Tests JHtml::calendar() method with and without 'readonly' attribute.
  */
 public function testCalendar()
 {
     // Create a world for the test
     jimport('joomla.session.session');
     jimport('joomla.application.application');
     jimport('joomla.document.document');
     $cfg = new JObject();
     JFactory::$session = $this->getMock('JSession', array('_start'));
     JFactory::$application = $this->getMock('ApplicationMock');
     JFactory::$config = $cfg;
     JFactory::$application->expects($this->any())->method('getTemplate')->will($this->returnValue('atomic'));
     $cfg->live_site = 'http://example.com';
     $cfg->offset = 'Europe/Kiev';
     $_SERVER['HTTP_USER_AGENT'] = 'Test Browser';
     // two sets of test data
     $test_data = array('date' => '2010-05-28 00:00:00', 'friendly_date' => 'Friday, 28 May 2010', 'name' => 'cal1_name', 'id' => 'cal1_id', 'format' => '%Y-%m-%d', 'attribs' => array());
     $test_data_ro = array_merge($test_data, array('attribs' => array('readonly' => 'readonly')));
     foreach (array($test_data, $test_data_ro) as $data) {
         // Reset the document
         JFactory::$document = JDocument::getInstance('html', array('unique_key' => serialize($data)));
         $input = JHtml::calendar($data['date'], $data['name'], $data['id'], $data['format'], $data['attribs']);
         $this->assertEquals((string) $xml->input['title'], $data['friendly_date'], 'Line:' . __LINE__ . ' The calendar input should have `title == "' . $data['friendly_date'] . '"`');
         $this->assertEquals((string) $xml->input['name'], $data['name'], 'Line:' . __LINE__ . ' The calendar input should have `name == "' . $data['name'] . '"`');
         $this->assertEquals((string) $xml->input['id'], $data['id'], 'Line:' . __LINE__ . ' The calendar input should have `id == "' . $data['id'] . '"`');
         $head_data = JFactory::getDocument()->getHeadData();
         if (!isset($data['attribs']['readonly']) || !$data['attribs']['readonly'] === 'readonly') {
             $this->assertArrayHasKey('/media/system/js/calendar.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar.js" should be loaded');
             $this->assertArrayHasKey('/media/system/js/calendar-setup.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar-setup.js" should be loaded');
         }
     }
 }
开发者ID:realityking,项目名称:oldunittests,代码行数:34,代码来源:JHtmlTest.php

示例4: register

 /**
  * Register the API server.
  *
  * @throws \Exception
  * @return  boolean
  */
 public function register()
 {
     $uri = \JURI::getInstance();
     if (!$this->isApi()) {
         return false;
     }
     $app = \JFactory::getApplication();
     $input = $app->input;
     // Restore Joomla handler and using our Json handler.
     JsonResponse::registerErrorHandler();
     // Authentication
     if (!$this->isUserOperation($uri) && $this->option['authorise']) {
         if (!Authentication::authenticate($input->get('session_key'))) {
             throw new \Exception(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     // Set Format to JSON
     $input->set('format', 'json');
     // Store JDocumentJson to Factory
     \JFactory::$document = \JDocument::getInstance('json');
     $router = $app::getRouter();
     // Attach a hook to Router
     $router->attachParseRule(array($this, 'parseRule'));
     return true;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:31,代码来源:ApiServer.php

示例5: render

 /**
  * Render the error page based on an exception.
  *
  * @param   Exception  $error  The exception for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render(Exception $error)
 {
     try {
         $app = JFactory::getApplication();
         $document = JDocument::getInstance('error');
         if (!$document) {
             // We're probably in an CLI environment
             jexit($error->getMessage());
         }
         // Get the current template from the application
         $template = $app->getTemplate();
         // Push the error object into the document
         $document->setError($error);
         if (ob_get_contents()) {
             ob_end_clean();
         }
         $document->setTitle(JText::_('Error') . ': ' . $error->getCode());
         $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG));
         // Do not allow cache
         $app->allowCache(false);
         // If nothing was rendered, just use the message from the Exception
         if (empty($data)) {
             $data = $error->getMessage();
         }
         $app->setBody($data);
         echo $app->toString();
     } catch (Exception $e) {
         // Try to set a 500 header if they haven't already been sent
         if (!headers_sent()) {
             header('HTTP/1.1 500 Internal Server Error');
         }
         jexit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:43,代码来源:page.php

示例6: display

 function display()
 {
     $doDisplay = true;
     // Set a default view if none exists
     if (!JRequest::getCmd('view')) {
         JRequest::setVar('view', 'tickets');
     }
     // Handle displaying an attachment
     if (JRequest::getCmd('view') == 'attachment') {
         $model = $this->getModel('attachment');
         $result = $model->download(JRequest::getVar('ArticleID', '', '', 'integer'), JRequest::getVar('AtmID', '', '', 'integer'));
         if (array_key_exists('data', $result)) {
             $document =& JFactory::getDocument();
             $doc =& JDocument::getInstance('raw');
             $document = $doc;
             JResponse::clearHeaders();
             $document->setMimeEncoding($result['data']->ContentType);
             JResponse::setHeader('Content-length', $result['data']->FilesizeRaw, true);
             $fn = preg_replace('/"/', '\\"', $result['data']->Filename);
             JResponse::setHeader('Content-disposition', sprintf('attachment;filename="%s"', $fn), true);
             $document->render();
             echo $result['data']->Content;
             $doDisplay = false;
         }
     }
     if ($doDisplay) {
         parent::display();
     }
 }
开发者ID:noamk,项目名称:OTRS-Joomla-Gateway,代码行数:29,代码来源:controller.php

示例7: sendBug

 /**
  * Submits a bug report to Dioscouri.
  * Thanks so much!  They really help improve the product!
  */
 function sendBug()
 {
     $mainframe = JFactory::getApplication();
     $body = JRequest::getVar('body');
     $name = JRequest::getVar('title');
     $body .= "\n\n Project: tienda";
     $body .= "\n Tracker: Bug";
     $body .= "\n Affected Version: " . Tienda::getVersion();
     $doc = JDocument::getInstance('raw');
     ob_start();
     $option = JRequest::getCmd('option');
     $db = JFactory::getDBO();
     $path = JPATH_ADMINISTRATOR . '/components/com_admin/';
     require_once $path . 'admin.admin.html.php';
     $path .= 'tmpl/';
     require_once $path . 'sysinfo_system.php';
     require_once $path . 'sysinfo_directory.php';
     require_once $path . 'sysinfo_phpinfo.php';
     require_once $path . 'sysinfo_phpsettings.php';
     require_once $path . 'sysinfo_config.php';
     jimport('joomla.filesystem.file');
     $contents = ob_get_contents();
     ob_end_clean();
     $doc->setBuffer($contents);
     $contents = $doc->render();
     $sitename = $config->get('sitename', $mainframe->getCfg('sitename'));
     // write file with info
     $config = JFactory::getConfig();
     $filename = 'system_info_' . $sitename . '.html';
     $file = JPATH_SITE . '/tmp/' . $filename;
     JFile::write($file, $contents);
     $mailer = JFactory::getMailer();
     $success = false;
     // For now, bug submission goes to info@dioscouri.com,
     // but in the future, it will go to projects@dioscouri.com
     // (once we get the Redmine auto-create working properly
     // and format the subject/body of the email properly)
     $mailer->addRecipient('projects@dioscouri.com');
     $mailer->setSubject($name);
     $mailfrom = $config->get('emails_defaultemail', $mainframe->getCfg('mailfrom'));
     $fromname = $config->get('emails_defaultname', $mainframe->getCfg('fromname'));
     // check user mail format type, default html
     $mailer->setBody($body);
     $mailer->addAttachment($file);
     $sender = array($mailfrom, $fromname);
     $mailer->setSender($sender);
     $sent = $mailer->send();
     if ($sent == '1') {
         $success = true;
     }
     JFile::delete($file);
     if ($success) {
         $msg = JText::_('COM_TIENDA_BUG_SUBMIT_OK');
         $msgtype = 'message';
     } else {
         $msg = JText::_('COM_TIENDA_BUG_SUBMIT_FAIL');
         $msgtype = 'notice';
     }
     $mainframe->redirect(JRoute::_('index.php?option=com_tienda&view=dashboard'), $msg, $msgtype);
 }
开发者ID:annggeel,项目名称:tienda,代码行数:64,代码来源:bug_report.php

示例8: testGetInstance

 /**
  * @todo Implement testGetInstance().
  */
 public function testGetInstance()
 {
     $this->object = JDocument::getInstance();
     $this->assertThat($this->object, $this->isInstanceOf('JDocumentHtml'));
     $this->object = JDocument::getInstance('custom');
     $this->assertThat($this->object, $this->isInstanceOf('JDocumentRaw'));
     $this->assertThat($this->object->getType(), $this->equalTo('custom'));
 }
开发者ID:nguyen1986vn,项目名称:atj25,代码行数:11,代码来源:JDocumentTest.php

示例9: render

 /**
  * Render the error page based on an exception.
  *
  * @param   Exception|Throwable  $error  An Exception or Throwable (PHP 7+) object for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render($error)
 {
     $expectedClass = PHP_MAJOR_VERSION >= 7 ? 'Throwable' : 'Exception';
     $isException = $error instanceof $expectedClass;
     // In PHP 5, the $error object should be an instance of Exception; PHP 7 should be a Throwable implementation
     if ($isException) {
         try {
             // If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404)
             if ($error->getCode() == '404' && JFactory::getConfig()->get('offline') == 1) {
                 JFactory::getApplication()->redirect('index.php');
             }
             $app = JFactory::getApplication();
             $document = JDocument::getInstance('error');
             if (!$document) {
                 // We're probably in an CLI environment
                 jexit($error->getMessage());
             }
             // Get the current template from the application
             $template = $app->getTemplate();
             // Push the error object into the document
             $document->setError($error);
             if (ob_get_contents()) {
                 ob_end_clean();
             }
             $document->setTitle(JText::_('Error') . ': ' . $error->getCode());
             $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG));
             // Do not allow cache
             $app->allowCache(false);
             // If nothing was rendered, just use the message from the Exception
             if (empty($data)) {
                 $data = $error->getMessage();
             }
             $app->setBody($data);
             echo $app->toString();
             $app->close(0);
             // This return is needed to ensure the test suite does not trigger the non-Exception handling below
             return;
         } catch (Throwable $e) {
             // Pass the error down
         } catch (Exception $e) {
             // Pass the error down
         }
     }
     // This isn't an Exception, we can't handle it.
     if (!headers_sent()) {
         header('HTTP/1.1 500 Internal Server Error');
     }
     $message = 'Error displaying the error page';
     if ($isException) {
         $message .= ': ';
         if (isset($e)) {
             $message .= $e->getMessage() . ': ';
         }
         $message .= $error->getMessage();
     }
     echo $message;
     jexit(1);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:67,代码来源:page.php

示例10: render

 /**
  * Render the error page based on an exception.
  *
  * @param   object  $error  An Exception or Throwable (PHP 7+) object for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render($error)
 {
     $expectedClass = PHP_MAJOR_VERSION >= 7 ? 'Throwable' : 'Exception';
     $isException = $error instanceof $expectedClass;
     // In PHP 5, the $error object should be an instance of Exception; PHP 7 should be a Throwable implementation
     if ($isException) {
         try {
             $app = JFactory::getApplication();
             $document = JDocument::getInstance('error');
             $code = $error->getCode();
             if (!isset(JHttpResponse::$status_messages[$code])) {
                 $code = '500';
             }
             if (ini_get('display_errors')) {
                 $message = $error->getMessage();
             } else {
                 $message = JHttpResponse::$status_messages[$code];
             }
             if (!$document || PHP_SAPI == 'cli') {
                 // We're probably in an CLI environment
                 jexit($message);
             }
             // Get the current template from the application
             $template = $app->getTemplate();
             // Push the error object into the document
             $document->setError($error);
             if (ob_get_contents()) {
                 ob_end_clean();
             }
             $document->setTitle(JText::_('Error') . ': ' . $code);
             $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JFactory::getConfig()->get('debug')));
             // Do not allow cache
             $app->allowCache(false);
             // If nothing was rendered, just use the message from the Exception
             if (empty($data)) {
                 $data = $message;
             }
             $app->setBody($data);
             echo $app->toString();
             return;
         } catch (Exception $e) {
             // Pass the error down
         }
     }
     // This isn't an Exception, we can't handle it.
     if (!headers_sent()) {
         header('HTTP/1.1 500 Internal Server Error');
     }
     $message = 'Error displaying the error page';
     if ($isException) {
         $message .= ': ' . $e->getMessage() . ': ' . $message;
     }
     echo $message;
     jexit(1);
 }
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:64,代码来源:page.php

示例11: ezStream

 function ezStream()
 {
     $options = array('margin-header' => 5, 'margin-footer' => 10, 'margin-top' => 20, 'margin-bottom' => 20, 'margin-left' => 15, 'margin-right' => 15);
     $pdfDoc =& JDocument::getInstance('pdf', $options);
     $pdfDoc->setTitle($this->_title);
     $pdfDoc->setHeader($this->_header);
     $pdfDoc->setBuffer($this->_text);
     header('Content-Type: application/pdf');
     header('Content-disposition: inline; filename="file.pdf"', true);
     echo $pdfDoc->render();
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:11,代码来源:kunena.pdf.php

示例12: display

 function display($tpl = null)
 {
     jimport('joomla.utilities.date');
     $option = 'com_jobboard';
     $document =& JFactory::getDocument();
     $doc =& JDocument::getInstance('json');
     // Set the MIME type for JSON output.
     if (version_compare(JVERSION, '2.5.0', 'ge')) {
     } else {
         $doc->setMimeEncoding('application/json');
         // Change the suggested filename.
         JResponse::setHeader('Content-Disposition', 'attachment; filename="results.json"');
     }
     // Output the JSON data.
     echo json_encode($this->data);
 }
开发者ID:Rayvid,项目名称:joomla-jobboard,代码行数:16,代码来源:view.json.php

示例13: testCalendar

 /**
  * Tests JHtml::calendar() method with and without 'readonly' attribute.
  */
 public function testCalendar()
 {
     // Create a world for the test
     jimport('joomla.session.session');
     jimport('joomla.application.application');
     jimport('joomla.document.document');
     $cfg = new JObject();
     JFactory::$session = $this->getMock('JSession', array('_start'));
     JFactory::$application = $this->getMock('ApplicationMock');
     JFactory::$config = $cfg;
     JFactory::$application->expects($this->any())->method('getTemplate')->will($this->returnValue('atomic'));
     $cfg->live_site = 'http://example.com';
     $cfg->offset = 'Europe/Kiev';
     $_SERVER['HTTP_USER_AGENT'] = 'Test Browser';
     // two sets of test data
     $test_data = array('date' => '2010-05-28', 'friendly_date' => 'Friday, 28 May 2010', 'name' => 'cal1_name', 'id' => 'cal1_id', 'format' => '%Y-%m-%d', 'attribs' => array());
     $test_data_ro = array_merge($test_data, array('attribs' => array('readonly' => 'readonly')));
     foreach (array($test_data, $test_data_ro) as $data) {
         // Reset the document
         JFactory::$document = JDocument::getInstance('html', array('unique_key' => serialize($data)));
         $input = JHtml::calendar($data['date'], $data['name'], $data['id'], $data['format'], $data['attribs']);
         $this->assertThat(strlen($input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The calendar method should return something without error.');
         $xml = new simpleXMLElement('<calendar>' . $input . '</calendar>');
         $this->assertEquals((string) $xml->input['type'], 'text', 'Line:' . __LINE__ . ' The calendar input should have `type == "text"`');
         $this->assertEquals((string) $xml->input['title'], $data['friendly_date'], 'Line:' . __LINE__ . ' The calendar input should have `title == "' . $data['friendly_date'] . '"`');
         $this->assertEquals((string) $xml->input['name'], $data['name'], 'Line:' . __LINE__ . ' The calendar input should have `name == "' . $data['name'] . '"`');
         $this->assertEquals((string) $xml->input['id'], $data['id'], 'Line:' . __LINE__ . ' The calendar input should have `id == "' . $data['id'] . '"`');
         $this->assertEquals((string) $xml->input['value'], $data['date'], 'Line:' . __LINE__ . ' The calendar input should have `value == "' . $data['date'] . '"`');
         $head_data = JFactory::getDocument()->getHeadData();
         if (isset($data['attribs']['readonly']) && $data['attribs']['readonly'] === 'readonly') {
             $this->assertEquals((string) $xml->input['readonly'], $data['attribs']['readonly'], 'Line:' . __LINE__ . ' The readonly calendar input should have `readonly == "' . $data['attribs']['readonly'] . '"`');
             $this->assertFalse(isset($xml->img), 'Line:' . __LINE__ . ' The readonly calendar input shouldn\'t have a calendar image');
             $this->assertArrayNotHasKey('/media/system/js/calendar.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar.js" shouldn\'t be loaded');
             $this->assertArrayNotHasKey('/media/system/js/calendar-setup.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar-setup.js" shouldn\'t be loaded');
             $this->assertArrayNotHasKey('text/javascript', $head_data['script'], 'Line:' . __LINE__ . ' Inline JS for the calendar shouldn\'t be loaded');
         } else {
             $this->assertFalse(isset($xml->input['readonly']), 'Line:' . __LINE__ . ' The calendar input shouldn\'t have readonly attribute');
             $this->assertTrue(isset($xml->img), 'Line:' . __LINE__ . ' The calendar input should have a calendar image');
             $this->assertEquals((string) $xml->img['id'], $data['id'] . '_img', 'Line:' . __LINE__ . ' The calendar image should have `id == "' . $data['id'] . '_img' . '"`');
             $this->assertEquals((string) $xml->img['class'], 'calendar', 'Line:' . __LINE__ . ' The calendar image should have `class == "calendar"`');
             $this->assertFileExists(JPATH_ROOT . $xml->img['src'], 'Line:' . __LINE__ . ' The calendar image source should point to an existent file');
             $this->assertArrayHasKey('/media/system/js/calendar.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar.js" should be loaded');
             $this->assertArrayHasKey('/media/system/js/calendar-setup.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar-setup.js" should be loaded');
             $this->assertContains('DHTML Date/Time Selector', $head_data['script']['text/javascript'], 'Line:' . __LINE__ . ' Inline JS for the calendar should be loaded');
         }
     }
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:50,代码来源:JHtmlTest.php

示例14: exception

 /**
  * The exception handler.
  *
  * @param \Exception $exception The exception object.
  *
  * @return  void
  */
 public static function exception(\Exception $exception)
 {
     try {
         $response = static::response($exception);
     } catch (\Exception $e) {
         $msg = "Infinity loop in exception handler. \n\nException:\n" . $e;
         exit($msg);
     }
     $response->code = $exception->getCode();
     if (JDEBUG) {
         $response->backtrace = $exception->getTrace();
     }
     $app = \JFactory::getApplication();
     $doc = \JDocument::getInstance('json');
     $app->setBody($doc->setBuffer($response)->render());
     $app->setHeader('Content-Type', $doc->getMimeEncoding() . '; charset=' . $doc->getCharset());
     echo $app->toString();
     die;
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:26,代码来源:AbstractResponse.php

示例15: replaceImage

 function replaceImage(&$row, $align, $autoresize, $maxchars, $showimage, $width = 0, $height = 0, $hiddenClasses = '')
 {
     global $database, $_MAMBOTS, $current_charset;
     $regex = '#<\\s*img [^\\>]*src\\s*=\\s*(["\'])(.*?)\\1#im';
     preg_match($regex, $row->introtext, $matches);
     if (!count($matches)) {
         preg_match($regex, $row->fulltext, $matches);
     }
     $images = count($matches) ? $matches : array();
     $image = '';
     if (count($images)) {
         $image = trim($images[2]);
     }
     $align = $align ? "align=\"{$align}\"" : "";
     if ($image && $showimage) {
         if ($autoresize && function_exists('imagecreatetruecolor') && ($image1 = modJANewsHelper::processImage($image, $width, $height))) {
             $image = "<img src=\"" . $image1 . "\" alt=\"{$row->title}\" {$align} />";
         } else {
             $width = $width ? "width=\"{$width}\"" : "";
             $height = $height ? "height=\"{$height}\"" : "";
             $image = "<img src=\"" . $image . "\" alt=\"{$row->title}\" {$width} {$height} {$align} />";
         }
     } else {
         $image = '';
     }
     $regex1 = "/\\<img[^\\>]*>/";
     $row->introtext = preg_replace($regex1, '', $row->introtext);
     $regex1 = "/<div class=\"mosimage\".*<\\/div>/";
     $row->introtext = preg_replace($regex1, '', $row->introtext);
     $row->introtext = trim($row->introtext);
     $row->introtext1 = $row->introtext;
     if ($maxchars && strlen($row->introtext) > $maxchars) {
         $doc = JDocument::getInstance();
         if (function_exists('mb_substr')) {
             $row->introtext1 = SmartTrim::mb_trim($row->introtext, 0, $maxchars, $doc->_charset);
         } else {
             $row->introtext1 = SmartTrim::trim($row->introtext, 0, $maxchars);
         }
     }
     // clean up globals
     return $image;
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:42,代码来源:helper.php


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