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


PHP Sh404sefHelperGeneral::getExportHeaders方法代码示例

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


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

示例1: _export

 protected function _export($start)
 {
     // do we have a valid filename
     $this->_filename = Sh404sefHelperFiles::createFileName($this->_filename, 'sh404sef_export_' . $this->_context);
     // put some data in the file
     $end = $start + self::MAX_PAGEIDS_PER_STEP + 1;
     $end = $end > $this->_total ? $this->_total : $end;
     // fetch shURLs record from model
     $model =& JModel::getInstance('urls', 'Sh404sefModel');
     $model->setContext('urls.view404');
     $options = (object) array('layout' => 'view404');
     $records = $model->getList($options, $returnZeroElement = false, $start, $forcedLimit = self::MAX_PAGEIDS_PER_STEP);
     // do we need a header written to the file, for first record
     $header = $start == 0 ? Sh404sefHelperGeneral::getExportHeaders($this->_context) . "\n" : '';
     // format them for text file output
     $data = '';
     $counter = $start;
     $glue = Sh404sefHelperFiles::$stringDelimiter . Sh404sefHelperFiles::$fieldDelimiter . Sh404sefHelperFiles::$stringDelimiter;
     if (!empty($records)) {
         foreach ($records as $record) {
             $counter++;
             $textRecord = $record->oldurl . $glue . $record->newurl . $glue . $record->cpt . $glue . $record->rank . $glue . $record->dateadd . $glue . '' . $glue . '' . $glue . '' . $glue . '' . $glue . '' . Sh404sefHelperFiles::$stringDelimiter;
             $line = Sh404sefHelperFiles::$stringDelimiter . $counter . $glue . $textRecord;
             $data .= $line . "\n";
         }
     }
     // prepare data for storage
     if (!empty($header)) {
         // first record written to file, prepend header
         $data = $header . $data;
     }
     // store in file
     $status = Sh404sefHelperFiles::appendToFile($this->_filename, $data);
     // return any error
     return $status;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:36,代码来源:exportview404.php

示例2: _analyzeImportFileContent

 /**
  * Analyze the content of a potential import file
  * to try recognize its content. Also find the
  * number of records in the file
  * @param string $filename fully pathed file name
  */
 protected function _analyzeImportFileContent($filename)
 {
     // read file content in an array
     $lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
     // start analysing
     if (empty($lines)) {
         throw new Sh404sefExceptionDefault(JText::_('COM_SH404SEF_IMPORT_UNRECOGNIZED_CONTENT'));
     }
     // extract header line
     jimport('joomla.utilities.string');
     $header = JString::trim(array_shift($lines));
     if (empty($header)) {
         throw new Sh404sefExceptionDefault(JText::_('COM_SH404SEF_IMPORT_UNRECOGNIZED_CONTENT'));
     }
     // check against known headers
     $headers = Sh404sefHelperGeneral::getExportHeaders();
     foreach ($headers as $key => $value) {
         if ($header == $value) {
             $importType = $key;
             break;
         }
     }
     // have we found something ?
     if (empty($importType)) {
         throw new Sh404sefExceptionDefault(JText::_('COM_SH404SEF_IMPORT_UNRECOGNIZED_CONTENT'));
     }
     // count items
     $this->_total = count($lines);
     // clear memory
     unset($lines);
     // return record
     return $importType;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:39,代码来源:importgeneric.php

示例3: _export

 protected function _export($start)
 {
     // do we have a valid filename
     $this->_filename = Sh404sefHelperFiles::createFileName($this->_filename, 'sh404sef_export_' . $this->_context);
     // put some data in the file
     $end = $start + self::MAX_PAGEIDS_PER_STEP + 1;
     $end = $end > $this->_total ? $this->_total : $end;
     // fetch pageIds record from model
     $model = ShlMvcModel_Base::getInstance('aliases', 'Sh404sefModel');
     $model->setContext('aliases.default');
     $options = (object) array('layout' => 'default', 'includeHomeData' => true);
     $records = $model->getList($options, $returnZeroElement = false, $start, $forcedLimit = self::MAX_PAGEIDS_PER_STEP);
     // do we need a header written to the file, for first record
     $header = $start == 0 ? Sh404sefHelperGeneral::getExportHeaders($this->_context) . "\n" : '';
     // format them for text file output
     $data = '';
     $counter = $start;
     $glue = Sh404sefHelperFiles::$stringDelimiter . Sh404sefHelperFiles::$fieldDelimiter . Sh404sefHelperFiles::$stringDelimiter;
     if (!empty($records)) {
         foreach ($records as $record) {
             $counter++;
             if ($record->newurl == sh404SEF_HOMEPAGE_CODE) {
                 $record->newurl = '__ Homepage __';
             }
             $textRecord = $record->alias . $glue . $record->oldurl . $glue . $record->newurl . $glue . $record->type . $glue . $record->hits . Sh404sefHelperFiles::$stringDelimiter;
             $line = Sh404sefHelperFiles::$stringDelimiter . $counter . $glue . $textRecord;
             $data .= $line . "\n";
         }
     }
     // prepare data for storage
     if (!empty($header)) {
         // first record written to file, prepend header
         $data = $header . $data;
     }
     // store in file
     $status = Sh404sefHelperFiles::appendToFile($this->_filename, $data);
     // return any error
     return $status;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:39,代码来源:exportaliases.php

示例4: _export

 protected function _export($start)
 {
     // do we have a valid filename
     $this->_filename = Sh404sefHelperFiles::createFileName($this->_filename, 'sh404sef_export_' . $this->_context);
     // put some data in the file
     $end = $start + self::MAX_PAGEIDS_PER_STEP + 1;
     $end = $end > $this->_total ? $this->_total : $end;
     // fetch pageIds record from model
     $model =& JModel::getInstance('urls', 'Sh404sefModel');
     $model->setContext('metas.default');
     $options = (object) array('layout' => 'export', 'getMetaData' => true, 'onlyWithMetaData' => true, 'simpleUrlList' => true);
     $records = $model->getList($options, $returnZeroElement = false, $start, $forcedLimit = self::MAX_PAGEIDS_PER_STEP);
     // do we need a header written to the file, for first record
     $header = $start == 0 ? Sh404sefHelperGeneral::getExportHeaders($this->_context) . "\n" : '';
     // format them for text file output
     $data = '';
     $counter = $start;
     $glue = Sh404sefHelperFiles::$stringDelimiter . Sh404sefHelperFiles::$fieldDelimiter . Sh404sefHelperFiles::$stringDelimiter;
     if (!empty($records)) {
         foreach ($records as $record) {
             $counter++;
             $data .= $this->_createLine($record, $counter, $glue);
         }
     }
     // prepare data for storage
     if (!empty($header)) {
         // first record written to file, prepend header
         $data = $header . $data;
     }
     // store in file
     $status = Sh404sefHelperFiles::appendToFile($this->_filename, $data);
     // return any error
     return $status;
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:34,代码来源:exportmetas.php


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