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


PHP JUtility::parseAttributes方法代码示例

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


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

示例1: testParseAttributes

	/**
	 * Test parseAttributes
	 *
	 * @param   string  $tag       tag to be parsed
	 * @param   array   $expected  resulting array of attribute values
	 *
	 * @return  void
	 *
	 * @dataProvider casesParseAttributes
	 * @covers  JUtility::parseAttributes
	 */
	public function testParseAttributes($tag, $expected)
	{
		$this->assertThat(
			JUtility::parseAttributes($tag),
			$this->equalTo($expected)
		);
	}
开发者ID:robschley,项目名称:joomla-platform,代码行数:18,代码来源:JUtilityTest.php

示例2: parseJdocTags

 public static function parseJdocTags($data)
 {
     $replace = array();
     $matches = array();
     if (preg_match_all('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data, $matches)) {
         $matches[0] = array_reverse($matches[0]);
         $matches[1] = array_reverse($matches[1]);
         $matches[2] = array_reverse($matches[2]);
         $count = count($matches[1]);
         for ($i = 0; $i < $count; $i++) {
             $attribs = JUtility::parseAttributes($matches[2][$i]);
             $type = $matches[1][$i];
             if ($type != 'modules') {
                 continue;
             }
             $name = isset($attribs['name']) ? $attribs['name'] : null;
             if (empty($name)) {
                 continue;
             }
             unset($attribs['name']);
             jimport('joomla.application.module.helper');
             $modules = JModuleHelper::getModules($name);
             $moduleHtml = null;
             if (!empty($modules)) {
                 foreach ($modules as $module) {
                     $moduleHtml .= JModuleHelper::renderModule($module, $attribs);
                 }
             }
             $data = str_replace($matches[0][$i], $moduleHtml, $data);
         }
     }
     return $data;
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:33,代码来源:block.php

示例3: onContentPrepare

 /**
  * Plugin that loads module positions within content
  *
  * @param   string $context The context of the content being passed to the plugin.
  * @param   object &$article The article object.  Note $article->text is also available
  * @param   mixed &$params The article params
  * @param   integer $page The 'page' number
  *
  * @return  mixed   true if there is an error. Void otherwise.
  *
  * @since   1.6
  */
 public function onContentPrepare($context, &$article, &$params, $page = 0)
 {
     // Don't run this plugin when the content is being indexed
     if ($context == 'com_finder.indexer') {
         return true;
     }
     // require_once( JURI::root(true).'/includes/domit/xml_saxy_lite_parser.php' );//xml_domit_lite_parser.php
     //$live_site = JURI::base();
     // Start IFRAME Replacement
     // define the regular expression for the bot
     $plugin = JPluginHelper::getPlugin('content', 'iframe');
     $pluginParams = new JRegistry($plugin->params);
     $regex = "#{iframe*(.*?)}(.*?){/iframe}#s";
     $plugin_enabled = $pluginParams->get('enabled', '1');
     if ($plugin_enabled == "0") {
         $article->text = preg_replace($regex, '', $article->text);
     } else {
         if (preg_match_all($regex, $article->text, $matches, PREG_SET_ORDER) > 0) {
             $db = JFactory::getDBO();
             //Ket noi CSDL
             $url = JRequest::getCmd('src');
             //JRequest::getCmd
             foreach ($matches as $match) {
                 $params0 = JUtility::parseAttributes($match[1]);
                 $params0['src'] = @$params0['src'] ? $params0['src'] : $pluginParams->get('src', 'http://www.luyenkim.net');
                 if ($url != '') {
                     if (strpos($url, 'http://') == false) {
                         $params0['src'] = 'http://' . $url;
                     }
                 }
                 //$params0['src'] = filter_var($params0['src'], FILTER_SANITIZE_URL);
                 $params0['height'] = @$params0['height'] ? $params0['height'] : $pluginParams->get('height', '400');
                 $params0['width'] = @$params0['width'] ? $params0['width'] : $pluginParams->get('width', '100%');
                 $params0['marginheight'] = @$params0['marginheight'] ? $params0['marginheight'] : $pluginParams->get('marginheight', '0');
                 $params0['marginwidth'] = @$params0['marginwidth'] ? $params0['marginwidth'] : $pluginParams->get('marginwidth', '0');
                 $params0['scrolling'] = @$params0['scrolling'] ? $params0['scrolling'] : $pluginParams->get('scrolling', '0');
                 $params0['frameborder'] = @$params0['frameborder'] ? $params0['frameborder'] : $pluginParams->get('frameborder', '0');
                 $params0['align'] = @$params0['align'] ? $params0['align'] : $pluginParams->get('align', 'bottom');
                 $params0['name'] = @$params0['name'] ? $params0['name'] : $pluginParams->get('name', '');
                 $params0['noframes'] = @$params0['noframes'] ? $params0['noframes'] : $pluginParams->get('noframes', '');
                 if (@$match[2]) {
                     $url = $match[2];
                 } else {
                     $url = $params0['src'];
                 }
                 $url = strip_tags(rtrim(ltrim($url)));
                 $name = $params0['name'];
                 $noframes = $params0['noframes'];
                 unset($params0['src']);
                 unset($params0['name']);
                 unset($params0['noframes']);
                 $article->text = preg_replace($regex, JHTML::iframe($url, $name, $params0, $noframes), $article->text, 1);
                 unset($params0);
             }
         }
         // End IFRAME Replacement
     }
     //end of else enable
 }
开发者ID:logic24,项目名称:plg_iframe,代码行数:71,代码来源:iframe.php

示例4: _parseParams

 private function _parseParams($_params)
 {
     $clone = clone $this->params;
     if (!empty($_params)) {
         $array = JUtility::parseAttributes($_params);
         count($array) && $clone->loadArray($array);
         // 			if (count($array)){
         // 				foreach ($array as $param => $value){
         // 					$clone->set($param, $value);
         // 				}
         // 			}
     }
     return $clone;
 }
开发者ID:educacionbe,项目名称:stabwall,代码行数:14,代码来源:relatednews.php

示例5: write

 /**
  * @TODO
  *
  * @param string Block of text to parse
  * @return ComInstallerTemplateFilterBuffer
  */
 public function write(&$text)
 {
     $matches = array();
     if (preg_match_all('#<buffer([^>]*)/>#siU', $text, $matches)) {
         foreach ($matches[0] as $key => $match) {
             //Create attributes array
             $attributes = array('type' => 'modules', 'name' => '', 'render' => '');
             $attributes = array_merge($attributes, JUtility::parseAttributes($matches[1][$key]));
             $document = JFactory::getDocument();
             if ($attributes['render']) {
                 $replace = $document->getBuffer($attributes['type'], $attributes['name']);
             } else {
                 $buffer = $document->getBuffer();
                 $replace = $buffer[$attributes['type']][$attributes['name']];
             }
             $text = str_replace($match, $replace, $text);
         }
     }
     return $this;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:26,代码来源:buffer.php

示例6: _replace

 /**
  * Replaces the matched tags.
  *
  * @param   array  An array of matches (see preg_match_all)
  * @return  string
  */
 protected function _replace(&$matches)
 {
     jimport('joomla.utilities.utility');
     require_once __DIR__ . '/geshi/geshi.php';
     $args = JUtility::parseAttributes($matches[1]);
     $text = $matches[2];
     $lang = JArrayHelper::getValue($args, 'lang', 'php');
     $lines = JArrayHelper::getValue($args, 'lines', 'false');
     $html_entities_match = array("|\\<br \\/\\>|", "#<#", "#>#", "|&#39;|", '#&quot;#', '#&nbsp;#');
     $html_entities_replace = array("\n", '&lt;', '&gt;', "'", '"', ' ');
     $text = preg_replace($html_entities_match, $html_entities_replace, $text);
     $text = str_replace('&lt;', '<', $text);
     $text = str_replace('&gt;', '>', $text);
     $text = str_replace("\t", '  ', $text);
     $geshi = new GeSHi($text, $lang);
     if ($lines == 'true') {
         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
     }
     $text = $geshi->parse_code();
     return $text;
 }
开发者ID:Tommar,项目名称:remate,代码行数:27,代码来源:geshi.php

示例7: _parseTemplate

 /**
  * Parse a document template
  *
  * @access public
  * @param string 	$data		The data too parse
  * @return The parsed contents of the template
  */
 function _parseTemplate($data)
 {
     $replace = array();
     $matches = array();
     if (preg_match_all('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data, $matches)) {
         $matches[0] = array_reverse($matches[0]);
         $matches[1] = array_reverse($matches[1]);
         $matches[2] = array_reverse($matches[2]);
         $count = count($matches[1]);
         for ($i = 0; $i < $count; $i++) {
             $attribs = JUtility::parseAttributes($matches[2][$i]);
             $type = $matches[1][$i];
             $name = isset($attribs['name']) ? $attribs['name'] : null;
             $replace[$i] = $this->getBuffer($type, $name, $attribs);
         }
         $data = str_replace($matches[0], $replace, $data);
     }
     return $data;
 }
开发者ID:jicheng17,项目名称:comanova,代码行数:26,代码来源:html.php

示例8: shAddPaginationInfo


//.........这里部分代码省略.........
        $shMultPageLength = $sefConfig->pagerep . (empty($limit) ? $listLimit : $limit);
    } else {
        $shMultPageLength = '';
    }
    // shumisha : modified to add # of items per page to URL, for table-category or section-category
    if (!empty($sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]) && false !== strpos($sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']], '%s')) {
        $page = str_replace('%s', $pagenum, $sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]) . $shMultPageLength;
    } else {
        $page = $sefConfig->pagerep . $pagenum . $shMultPageLength;
    }
    // V 1.2.4.t special processing to replace page number by headings
    $shPageNumberWasReplaced = false;
    if (strpos($url, 'option=com_content') !== false && strpos($url, 'view=article') !== false && !empty($limitstart)) {
        // this is multipage article - limitstart instead of limit in J1.5
        if ($sefConfig->shMultipagesTitle) {
            parse_str($url, $shParams);
            if (!empty($shParams['id'])) {
                $shPageTitle = '';
                $sql = 'SELECT c.id, c.fulltext, c.introtext  FROM #__content AS c WHERE id=\'' . $shParams['id'] . '\'';
                $database->setQuery($sql);
                $contentElement = $database->loadObject();
                if ($database->getErrorNum()) {
                    JError::RaiseError(500, $database->stderr());
                }
                $contentText = $contentElement->introtext . $contentElement->fulltext;
                if (!empty($contentElement) && strpos($contentText, 'class="system-pagebreak') !== false) {
                    // search for mospagebreak tags
                    // copied over from pagebreak plugin
                    // expression to search for
                    $regex = '#<hr([^>]*)class=(\\"|\')system-pagebreak(\\"|\')([^>]*)\\/>#iU';
                    // find all instances of mambot and put in $matches
                    $shMatches = array();
                    preg_match_all($regex, $contentText, $shMatches, PREG_SET_ORDER);
                    // adds heading or title to <site> Title
                    if (empty($limitstart)) {
                        // if first page use heading of first mospagebreak
                        /* if ( $shMatches[0][2] ) {
                           parse_str( html_entity_decode( $shMatches[0][2] ), $args );
                           if ( @$args['heading'] ) {
                           $shPageTitle = stripslashes( $args['heading'] );
                           }
                           }*/
                    } else {
                        // for other pages use title of mospagebreak
                        if ($limitstart > 0 && $shMatches[$limitstart - 1][1]) {
                            $args = JUtility::parseAttributes($shMatches[$limitstart - 1][0]);
                            if (@$args['title']) {
                                $shPageTitle = $args['title'];
                            } else {
                                if (@$args['alt']) {
                                    $shPageTitle = $args['alt'];
                                } else {
                                    // there is a page break, but no title. Use a page number
                                    $shPageTitle = str_replace('%s', $limitstart + 1, $sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]);
                                }
                            }
                        }
                    }
                }
                if (!empty($shPageTitle)) {
                    // found a heading, we should use that as a Title
                    $location .= $shSeparator . titleToLocation($shPageTitle);
                }
                $shPageNumberWasReplaced = true;
                // always set the flag, otherwise we'll a Page-1 added
            }
        } else {
            // mutiple pages article, but we don't want to use smart title.
            // directly use limitstart
            $page = str_replace('%s', $limitstart + 1, $sefConfig->pageTexts[$GLOBALS['shMosConfig_locale']]);
        }
    }
    // maybe this is a multipage with "showall=1"
    if (strpos($url, 'option=com_content') !== false && strpos($url, 'view=article') !== false && strpos($url, 'showall=1') !== false) {
        // this is multipage article with showall
        $tempTitle = JText::_('All Pages');
        $location .= $shSeparator . titleToLocation($tempTitle);
        $shPageNumberWasReplaced = true;
        // always set the flag, otherwise we'll a Page-1 added
    }
    // make sure we remove bad characters
    $takethese = str_replace('|', '', $sefConfig->friendlytrim);
    $location = JString::trim($location, $takethese);
    // add page number
    if (!$shPageNumberWasReplaced && (!isset($limitstart) && (isset($limit) && $limit != $listLimit && $limit != $defaultListLimit) || isset($limitstart) && ($limitstart != 0 || $limitstart == 0 && (strpos($url, 'option=com_virtuemart') && $sefConfig->shVmUsingItemsPerPage && (isset($limit) && $limit != $listLimit))))) {
        $location .= $shSeparator . $page;
    }
    // add suffix
    if (!empty($shSuffix) && $location != '/' && JString::substr($location, -1) != '/') {
        $location = $shSuffix == '/' ? $location . $shSuffix : str_replace($shSuffix, '', $location) . $shSuffix;
    }
    // add default index file
    if ($sefConfig->addFile) {
        // V 1.2.4.t
        if (empty($shSuffix) || !empty($shSuffix) && JString::subStr($location, -$suffixLength) != $shSuffix) {
            $location .= (JString::substr($location, -1) == '/' ? '' : '/') . $sefConfig->addFile;
        }
    }
    return JString::ltrim($location, '/');
}
开发者ID:sangkasi,项目名称:joomla,代码行数:101,代码来源:sh404sef.class.php

示例9: _parseTemplate

 /**
  * Parse a document template
  *
  * @return  JDocumentHTML  instance of $this to allow chaining
  *
  * @since   11.1
  */
 protected function _parseTemplate()
 {
     $matches = array();
     if (preg_match_all('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $this->_template, $matches)) {
         $template_tags_first = array();
         $template_tags_last = array();
         // Step through the jdocs in reverse order.
         for ($i = count($matches[0]) - 1; $i >= 0; $i--) {
             $type = $matches[1][$i];
             $attribs = empty($matches[2][$i]) ? array() : JUtility::parseAttributes($matches[2][$i]);
             $name = isset($attribs['name']) ? $attribs['name'] : null;
             // Separate buffers to be executed first and last
             if ($type == 'module' || $type == 'modules') {
                 $template_tags_first[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'attribs' => $attribs);
             } else {
                 $template_tags_last[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'attribs' => $attribs);
             }
         }
         // Reverse the last array so the jdocs are in forward order.
         $template_tags_last = array_reverse($template_tags_last);
         $this->_template_tags = $template_tags_first + $template_tags_last;
     }
     return $this;
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:31,代码来源:html.php

示例10: _generateToc

 function _generateToc(&$row, $index)
 {
     $display_method = $this->params->get('display_method', 1);
     $limitstart = JRequest::getInt('limitstart', 0);
     $result = new stdClass();
     if (0 == $index && $this->texts[$index] != "") {
         //$result->title	= $this->params->get('intro_text') != "" ? $this->params->get('intro_text') : $this->article->title ;
         $result->title = ' - ' . JText::_($this->params->get('custom_introtext', 'FLEXIBREAK_INTRO_TEXT')) . ' - ';
         $result->name = $result->id = 'start';
         $result->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->catid, 0, $row) . '&showall=&limitstart=');
         $this->pagescount++;
     } else {
         if ($this->texts[0] == "") {
             $attrs = JUtility::parseAttributes($this->pages[$index][0]);
         } else {
             $attrs = JUtility::parseAttributes($this->pages[$index - 1][0]);
         }
         $result->title = isset($attrs['title']) ? $attrs['title'] : 'unknown';
         $result->name = isset($attrs['name']) ? $attrs['name'] : preg_replace('/[ \\t]+/u', '', $result->title);
         $result->link = JRoute::_(FlexicontentHelperRoute::getItemRoute($row->slug, $row->catid, 0, $row) . '&showall=&limitstart=' . $index);
         $result->id = $result->name ? $result->name : 'start';
     }
     $curr_index = $this->texts[0] == "" ? $index + 1 : $index;
     if (!isset($this->_text)) {
         $this->_text = '';
     }
     switch ($display_method) {
         case 0:
             $this->_text .= '<a id="' . $result->id . '_toc_page"></a>' . $this->texts[$curr_index];
             // add an anchor link for scrolling
             break;
         case 1:
             $this->_text .= '<div class="articlePage" id="' . $result->id . '"> ' . $this->texts[$curr_index] . '</div>';
             break;
         case 2:
             if ($limitstart == $curr_index) {
                 $this->_text .= $this->texts[$curr_index];
             }
             break;
     }
     return $result;
 }
开发者ID:noxidsoft,项目名称:flexicontent-cck,代码行数:42,代码来源:flexibreak.php

示例11: onBeforeRender

 function onBeforeRender()
 {
     if (defined('T3_PLUGIN') && T3::detect()) {
         $japp = JFactory::getApplication();
         JDispatcher::getInstance()->trigger('onT3BeforeRender');
         if ($japp->isAdmin()) {
             $t3app = T3::getApp();
             $t3app->addAssets();
         } else {
             $params = $japp->getTemplate(true)->params;
             if (defined('T3_THEMER') && $params->get('themermode', 1)) {
                 T3::import('admin/theme');
                 T3AdminTheme::addAssets();
             }
             //check for ajax action and render t3ajax type to before head type
             if (class_exists('T3Ajax')) {
                 T3Ajax::render();
             }
             // allow load module/modules in component using jdoc:include
             $doc = JFactory::getDocument();
             $main_content = $doc->getBuffer('component');
             if ($main_content) {
                 // parse jdoc
                 if (preg_match_all('#<jdoc:include\\ type="([^"]+)"(.*)\\/>#iU', $main_content, $matches)) {
                     $replace = array();
                     $with = array();
                     // Step through the jdocs in reverse order.
                     for ($i = 0; $i < count($matches[0]); $i++) {
                         $type = $matches[1][$i];
                         $attribs = empty($matches[2][$i]) ? array() : JUtility::parseAttributes($matches[2][$i]);
                         $name = isset($attribs['name']) ? $attribs['name'] : null;
                         $replace[] = $matches[0][$i];
                         $with[] = $doc->getBuffer($type, $name, $attribs);
                     }
                     $main_content = str_replace($replace, $with, $main_content);
                     // update buffer
                     $doc->setBuffer($main_content, 'component');
                 }
             }
         }
     }
 }
开发者ID:lazarch,项目名称:t3,代码行数:42,代码来源:t3.php

示例12: onPrepareItemDescription

 function onPrepareItemDescription(&$row, &$params, $page = 0)
 {
     $app = JFactory::getApplication();
     // expression to search for
     $regex = '#<hr([^>]*?)class=(\\"|\')system-pagebreak(\\"|\')([^>]*?)\\/*>#iU';
     // Get Plugin info
     $pluginParams = $this;
     if (!$pluginParams->get('enabled', 1)) {
         return true;
     }
     JPlugin::loadLanguage('plg_djcatalog2_pagebreak', JPATH_ADMINISTRATOR);
     // replacing readmore with <br /> - we don't need it
     $row->description = str_replace("<hr id=\"system-readmore\" />", "<br />", $row->description);
     if (strpos($row->description, 'class="system-pagebreak') === false && strpos($row->description, 'class=\'system-pagebreak') === false) {
         return true;
     }
     $view = $app->input->get('view', null, 'string');
     if (!JPluginHelper::isEnabled('djcatalog2', 'pagebreak') || $view != 'item' && $view != 'itemstable' && $view != 'items' && $view != 'producer') {
         $row->description = preg_replace($regex, '', $row->description);
         return;
     }
     // find all instances of plugin and put in $matches
     $matches = array();
     preg_match_all($regex, $row->description, $matches, PREG_SET_ORDER);
     // split the text around the plugin
     $text = preg_split($regex, $row->description);
     $title = array();
     // count the number of pages
     $n = count($text);
     if ($n > 1) {
         $pluginParams = $this->params;
         $style = $pluginParams->get('accordion', 2);
         $jinput = JFactory::getApplication()->input;
         if ($jinput->get('print', null) == '1' && $jinput->get('tmpl') == 'component') {
             $style = 'none';
         }
         $row->description = '';
         $row->description .= $text[0];
         $i = 1;
         foreach ($matches as $match) {
             if (@$match[0]) {
                 $attrs = JUtility::parseAttributes($match[0]);
                 if (@$attrs['alt']) {
                     $title[] = stripslashes($attrs['alt']);
                 } elseif (@$attrs['title']) {
                     $title[] = stripslashes($attrs['title']);
                 } else {
                     $title[] = JText::sprintf('PLG_DJCATALOG2_PAGEBREAK_TOGGLE', $i);
                 }
             } else {
                 $title[] = JText::sprintf('PLG_DJCATALOG2_PAGEBREAK_TOGGLE', $i);
             }
             $i++;
         }
         $row->tabs = '';
         $group_id = 'tab-' . htmlspecialchars($row->alias) . '-';
         if ($style == '1') {
             $row->tabs .= '<div class="accordion">';
             for ($i = 1; $i < $n; $i++) {
                 $class = $i == 1 ? 'class="accordion-body collapse in"' : 'class="accordion-body collapse"';
                 $row->tabs .= '<div class="accordion-group">';
                 $row->tabs .= '<div class="accordion-heading"><a class="accordion-toggle">' . $title[$i - 1] . '</a></div>';
                 $row->tabs .= '<div ' . $class . ' id="' . $group_id . $i . '"><div class="accordion-inner">' . $text[$i] . '</div></div>';
                 $row->tabs .= '</div>';
             }
             $row->tabs .= '</div>';
         } else {
             if ($style == '2') {
                 $row->tabs .= '<ul class="nav nav-tabs">';
                 for ($i = 1; $i < $n; $i++) {
                     $class = $i == 1 ? 'class="nav-toggler active"' : 'class="nav-toggler"';
                     $row->tabs .= '<li ' . $class . '><a>' . $title[$i - 1] . '</a></li>';
                 }
                 $row->tabs .= '</ul>';
                 $row->tabs .= '<div class="tab-content">';
                 for ($i = 1; $i < $n; $i++) {
                     $class = $i == 1 ? 'class="tab-pane active"' : 'class="tab-pane"';
                     $row->tabs .= '<div ' . $class . ' id="' . $group_id . $i . '">';
                     $row->tabs .= '<div>' . $text[$i] . '</div>';
                     $row->tabs .= '</div>';
                 }
                 $row->tabs .= '</div>';
             } else {
                 $row->tabs .= '<div class="djc_pagebreak">';
                 for ($i = 1; $i < $n; $i++) {
                     $row->tabs .= '<h3 class="djc_pagebreak-title">' . $title[$i - 1] . '</h3>';
                     $row->tabs .= '<div class="djc_pagebreak-content">' . $text[$i] . '</div>';
                 }
                 $row->tabs .= '</div>';
             }
         }
     }
     return true;
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:94,代码来源:pagebreak.php

示例13: _parseTemplate

 /**
  * Parse a document template
  *
  * @return The parsed contents of the template
  * @since  1.0
  */
 protected function _parseTemplate()
 {
     if (empty($this->_template)) {
         throw new Exception('ParseTemplate: template entity is empty');
     }
     $replaces = array();
     foreach ($this->parsedTags as $name => $val) {
         $matches = array();
         $replaces[$name] = array();
         if (preg_match_all($val['regexp'], $this->_template->content, $matches)) {
             if (!empty($matches)) {
                 foreach ($matches as $idx => $match) {
                     $matches[$idx] = array_reverse($match);
                 }
                 $count = count($matches[1]);
                 for ($i = 0; $i < $count; $i++) {
                     $k = 1;
                     $res = array();
                     foreach ($val['matches'] as $itemName => $item) {
                         if (isset($matches[$k])) {
                             if ($itemName == 'attribs') {
                                 $val['matches'][$itemName] = JUtility::parseAttributes($matches[$k][$i]);
                             } else {
                                 $val['matches'][$itemName] = $matches[$k][$i];
                             }
                         }
                         $replaces[$name][$matches[0][$i]] = $val['matches'];
                         $k++;
                     }
                 }
             }
         }
     }
     $this->_parsed = $replaces;
     return true;
 }
开发者ID:Rikisha,项目名称:proj,代码行数:42,代码来源:document.php

示例14: foreach

    $row->toc .= '<h3>' . $headingtext . '</h3>';
}
// TOC first Page link.
$class = $limitstart === 0 && $showall === 0 ? 'toclink active' : 'toclink';
$row->toc .= '<ul class="nav nav-tabs nav-stacked">
<li class="' . $class . '">

    <a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=') . '" class="' . $class . '">' . $heading . '</a>

</li>
';
$i = 2;
foreach ($matches as $bot) {
    $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid) . '&showall=&limitstart=' . ($i - 1));
    if (@$bot[0]) {
        $attrs2 = JUtility::parseAttributes($bot[0]);
        if (@$attrs2['alt']) {
            $title = stripslashes($attrs2['alt']);
        } elseif (@$attrs2['title']) {
            $title = stripslashes($attrs2['title']);
        } else {
            $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
        }
    } else {
        $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
    }
    $class = $limitstart == $i - 1 ? 'toclink active' : 'toclink';
    $row->toc .= '
        <li>

            <a href="' . $link . '" class="' . $class . '">' . $title . '</a>
开发者ID:angieradtke,项目名称:cms-naked,代码行数:31,代码来源:toc.php

示例15: _createTOC

    /**
     * Creates a Table of Contents for the pagebreak
     *
     * @param   object   &$row      The article object.  Note $article->text is also available
     * @param   array    &$matches  Array of matches of a regex in onContentPrepare
     * @param   integer  &$page     The 'page' number
     *
     * @return  void
     *
     * @since  1.6
     */
    protected function _createTOC(&$row, &$matches, &$page)
    {
        $heading = isset($row->title) ? $row->title : JText::_('PLG_CONTENT_PAGEBREAK_NO_TITLE');
        $input = JFactory::getApplication()->input;
        $limitstart = $input->getUInt('limitstart', 0);
        $showall = $input->getInt('showall', 0);
        // TOC header.
        $row->toc = '<div class="pull-right article-index">';
        if ($this->params->get('article_index') == 1) {
            $headingtext = JText::_('PLG_CONTENT_PAGEBREAK_ARTICLE_INDEX');
            if ($this->params->get('article_index_text')) {
                $headingtext = htmlspecialchars($this->params->get('article_index_text'), ENT_QUOTES, 'UTF-8');
            }
            $row->toc .= '<h3>' . $headingtext . '</h3>';
        }
        // TOC first Page link.
        $class = $limitstart === 0 && $showall === 0 ? 'toclink active' : 'toclink';
        $row->toc .= '<ul class="nav nav-tabs nav-stacked">
		<li class="' . $class . '">
			<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=') . '" class="' . $class . '">' . $heading . '</a>
		</li>
		';
        $i = 2;
        foreach ($matches as $bot) {
            $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=&limitstart=' . ($i - 1));
            if (@$bot[0]) {
                $attrs2 = JUtility::parseAttributes($bot[0]);
                if (@$attrs2['alt']) {
                    $title = stripslashes($attrs2['alt']);
                } elseif (@$attrs2['title']) {
                    $title = stripslashes($attrs2['title']);
                } else {
                    $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
                }
            } else {
                $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $i);
            }
            $class = $limitstart == $i - 1 ? 'toclink active' : 'toclink';
            $row->toc .= '
				<li>

					<a href="' . $link . '" class="' . $class . '">' . $title . '</a>

				</li>
				';
            $i++;
        }
        if ($this->params->get('showall')) {
            $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language) . '&showall=1&limitstart=');
            $class = $showall == 1 ? 'toclink active' : 'toclink';
            $row->toc .= '
			<li>

					<a href="' . $link . '" class="' . $class . '">' . JText::_('PLG_CONTENT_PAGEBREAK_ALL_PAGES') . '</a>

			</li>
			';
        }
        $row->toc .= '</ul></div>';
    }
开发者ID:educakanchay,项目名称:kanchay,代码行数:71,代码来源:pagebreak.php


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