Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbltr committed Oct 13, 2016
1 parent 03a4dde commit 1f3c2a0
Show file tree
Hide file tree
Showing 35 changed files with 118 additions and 102 deletions.
3 changes: 0 additions & 3 deletions Classes/Backend/class.tx_kesearch_classes_flexform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

class tx_kesearch_classes_flexform
{
/**
* @var language
*/
public $lang;
public $notAllowedFields;

Expand Down
5 changes: 3 additions & 2 deletions Classes/Backend/class.user_filterlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ public function getListOfAvailableFilteroptionsForFlexforms(&$config)
}

if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilteroptionsForFlexforms'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilteroptionsForFlexforms'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilteroptionsForFlexforms'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyFilteroptionsForFlexforms($config, $rowFilter, $this);
}
}
}
}
}
}
}
3 changes: 1 addition & 2 deletions Classes/Controller/BackendModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,5 +755,4 @@ protected function getBackendUser()
{
return $GLOBALS['BE_USER'];
}

}
}
3 changes: 2 additions & 1 deletion Classes/Scheduler/class.tx_kesearch_indexertask.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@


// include indexer class
require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search') . 'Classes/indexer/class.tx_kesearch_indexer.php');
require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search')
. 'Classes/indexer/class.tx_kesearch_indexer.php');

class tx_kesearch_indexertask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
{
Expand Down
2 changes: 1 addition & 1 deletion Classes/hooks/class.user_kesearchhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ public function modifyTemplaVoilaIndexEntry($uid, &$pageContent, &$tags, $cached
$additionalFields['orig_pid'] = $cachedPageRecords[0][$uid]['pid'];
}
}
}
}
13 changes: 5 additions & 8 deletions Classes/indexer/class.tx_kesearch_indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class tx_kesearch_indexer
public $indexingErrors = array();
public $startTime;
public $currentRow = array(); // current row which have to be inserted/updated to database

/**
* @var t3lib_Registry
*/
public $registry;

/**
Expand Down Expand Up @@ -278,7 +274,8 @@ public function prepareStatements()
// Statement to insert a new records to index table
$GLOBALS['TYPO3_DB']->sql_query('PREPARE insertStmt FROM "
INSERT INTO tx_kesearch_index
(pid, title, type, targetpid, content, tags, params, abstract, language, starttime, endtime, fe_group, tstamp, crdate' . $addInsertQueryFields . ')
(pid, title, type, targetpid, content, tags, params, abstract, language,'
. ' starttime, endtime, fe_group, tstamp, crdate' . $addInsertQueryFields . ')
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?' . $addInsertQueryValues . ', ?)
"');

Expand Down Expand Up @@ -414,7 +411,6 @@ public function rotateSphinxIndex()
$content .= '<div class="error">SPHINX ' . $retRow . '</div>' . "\n";
}
}

} else {
$content .= '<div class="error">SPHINX ERROR: "exec" call is not allowed. '
. 'Check your disable_functions setting in php.ini.</div>';
Expand Down Expand Up @@ -853,8 +849,9 @@ public function getTag($tagUid, $clearText = false)

/**
* Strips control characters
* @param string the content to sanitize
* @return string the sanitized content
*
* @param string $content content to sanitize
* @return string
* @see http://forge.typo3.org/issues/34808
*/
public function stripControlCharacters($content)
Expand Down
24 changes: 12 additions & 12 deletions Classes/indexer/class.tx_kesearch_indexer_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
***************************************************************/

use \TYPO3\CMS\Core\Utility\GeneralUtility;

use \TYPO3\CMS\Backend\Utility\BackendUtility;

/**
* Plugin 'Faceted search' for the 'ke_search' extension.
Expand All @@ -40,7 +40,6 @@ class tx_kesearch_indexer_types

/**
* needed to get all recursive pids
* @var t3lib_queryGenerator
*/
public $queryGen;

Expand Down Expand Up @@ -139,8 +138,8 @@ public function getPidList($startingPointsRecursive = '', $singlePages = '', $ta

// add complete page record to list of pids in $indexPids
$where = ' AND ' . $table . '.pid = pages.uid ';
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
$where .= BackendUtility::BEenableFields($table);
$where .= BackendUtility::deleteClause($table);
$this->pageRecords = $this->getPageRecords($indexPids, $where, 'pages,' . $table, 'pages.*');
if (count($this->pageRecords)) {
// create a new list of allowed pids
Expand All @@ -153,8 +152,9 @@ public function getPidList($startingPointsRecursive = '', $singlePages = '', $ta

/**
* Add Tags to records array
* @param array Simple array with uids of pages
* @param string additional where-clause
*
* @param array $uids Simple array with uids of pages
* @param string $pageWhere additional where-clause
* @return array extended array with uids and tags for records
*/
public function addTagsToRecords($uids, $pageWhere = '1=1')
Expand All @@ -171,8 +171,8 @@ public function addTagsToRecords($uids, $pageWhere = '1=1')
$where = 'pages.uid IN (' . implode(',', $uids) . ')';
$where .= ' AND pages.tx_kesearch_tags <> "" ';
$where .= ' AND FIND_IN_SET(tx_kesearch_filteroptions.uid, pages.tx_kesearch_tags)';
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_kesearch_filteroptions');
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_kesearch_filteroptions');
$where .= BackendUtility::BEenableFields('tx_kesearch_filteroptions');
$where .= BackendUtility::deleteClause('tx_kesearch_filteroptions');

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, 'pages.uid', '', '');
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
Expand All @@ -188,8 +188,8 @@ public function addTagsToRecords($uids, $pageWhere = '1=1')
$fields = 'automated_tagging, automated_tagging_exclude, tag';
$table = 'tx_kesearch_filteroptions';
$where = 'automated_tagging <> "" ';
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_kesearch_filteroptions');
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_kesearch_filteroptions');
$where .= BackendUtility::BEenableFields('tx_kesearch_filteroptions');
$where .= BackendUtility::deleteClause('tx_kesearch_filteroptions');

$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where);

Expand Down Expand Up @@ -327,8 +327,8 @@ public function getTag($tagUid, $clearText = false)
$fields = 'title,tag';
$table = 'tx_kesearch_filteroptions';
$where = 'uid="' . intval($tagUid) . '" ';
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
$where .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table);
$where .= BackendUtility::BEenableFields($table);
$where .= BackendUtility::deleteClause($table);

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, $where, '', '', '1');
$anz = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,4 @@ public function getContent($file)
return false;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
class tx_kesearch_indexer_filetypes_pdf extends tx_kesearch_indexer_types_file implements tx_kesearch_indexer_filetypes
{

var $extConf = array(); // saves the configuration of extension ke_search_hooks
var $app = array(); // saves the path to the executables
var $isAppArraySet = false;
public $extConf = array(); // saves the configuration of extension ke_search_hooks
public $app = array(); // saves the path to the executables
public $isAppArraySet = false;

/**
* class constructor
Expand Down Expand Up @@ -142,7 +142,7 @@ public function getPdfInfo($file)

/**
* Analysing PDF info into a useable format.
* @param array Array of PDF content, coming from the pdfinfo tool
* @param array $pdfInfoArray Data of PDF content, coming from the pdfinfo tool
* @return array The pdf informations as array in a useable format
*/
public function splitPdfInfo($pdfInfoArray)
Expand All @@ -169,5 +169,4 @@ public function removeEndJunk($string)
{
return trim(preg_replace('/[' . LF . chr(12) . ']*$/', '', $string));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,4 @@ public function getContent($file)
return false;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,4 @@ public function getContent($file)
return false;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public function startIndexing()

// hook for custom modifications of the indexed data, e.g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifya21glossaryIndexEntry'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifya21glossaryIndexEntry(
$title,
Expand Down Expand Up @@ -149,4 +150,4 @@ public function startIndexing()
}
return $content;
}
}
}
5 changes: 3 additions & 2 deletions Classes/indexer/types/class.tx_kesearch_indexer_types_cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function startIndexing()

// index expired events?
if (!$this->indexerConfig['cal_expired_events']) {
$where .= ' AND ((UNIX_TIMESTAMP(start_date) > UNIX_TIMESTAMP()) OR (UNIX_TIMESTAMP(end_date) > UNIX_TIMESTAMP())) ';
$where .= ' AND ((UNIX_TIMESTAMP(start_date) > UNIX_TIMESTAMP())'
. ' OR (UNIX_TIMESTAMP(end_date) > UNIX_TIMESTAMP())) ';
}

// add enablefields
Expand Down Expand Up @@ -187,4 +188,4 @@ private function buildCategoryTags($eventUid, &$tags)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public function startIndexing()

// hook for custom modifications of the indexed data, e. g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyCommentsIndexEntry'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyCommentsIndexEntry(
$title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ public function startIndexing()
$targetPID = $this->indexerConfig['targetpid'];

// get tags
$yacRecordTags = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',',
$yacRecord['tx_keyacsearchtags_tags'], true);
$yacRecordTags = TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',',
$yacRecord['tx_keyacsearchtags_tags'],
true
);

$tags = '';
$clearTextTags = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ public function startIndexing()

// hook for custom modifications of the indexed data, e. g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMMForumIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMMForumIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyMMForumIndexEntry'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyMMForumIndexEntry(
$title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public function startIndexing()

// hook for custom modifications of the indexed data, e.g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyExtNewsIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyExtNewsIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyExtNewsIndexEntry'] as
$_classRef) {
$_procObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyExtNewsIndexEntry(
$title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use \TYPO3\CMS\Core\Resource\ResourceFactory;
use \TYPO3\CMS\Core\Resource\FileInterface;
use \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;

define('DONOTINDEX', -3);


Expand Down Expand Up @@ -455,7 +456,6 @@ public function getPageContent($uid)
) {
$pageContent[$ttContentRow['sys_language_uid']] .= $content;
}

}
} else {
$this->counterWithoutContent++;
Expand Down Expand Up @@ -816,7 +816,8 @@ public function storeFileContentToIndex($fileObject, $content, $fileIndexerObjec

//hook for custom modifications of the indexed data, e. g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFileIndexEntryFromContentIndexer'] as
$_classRef) {
$_procObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyFileIndexEntryFromContentIndexer(
$fileObject,
Expand Down Expand Up @@ -882,7 +883,8 @@ public function getContentFromContentElement($ttContentRow)

// hook for modifiying a content elements content
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentFromContentElement'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentFromContentElement'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentFromContentElement'] as
$_classRef) {
$_procObj = &\TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyContentFromContentElement(
$bodytext,
Expand All @@ -895,4 +897,3 @@ public function getContentFromContentElement($ttContentRow)
return $bodytext;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,3 @@ public function startIndexing()
return $content;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public function getPageContent($uid)

// hook for custom modifications of the indexed data, e. g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyContentIndexEntry(
$row['header'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ public function startIndexing()

// hook for custom modifications of the indexed data, e. g. the tags
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'] as $_classRef) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyNewsIndexEntry'] as
$_classRef) {
$_procObj = &TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef);
$_procObj->modifyNewsIndexEntry(
$title,
Expand Down
7 changes: 2 additions & 5 deletions Classes/lib/class.tx_kesearch_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class tx_kesearch_db implements \TYPO3\CMS\Core\SingletonInterface
* @var tx_kesearch_pi1
*/
public $pObj;

/**
* @var tslib_cObj
*/
public $cObj;

public function __construct($pObj)
Expand Down Expand Up @@ -134,7 +130,8 @@ public function escapeString($string)
*/
public function getSearchResultBySphinx()
{
require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search_premium') . 'class.user_kesearchpremium.php');
require_once(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ke_search_premium')
. 'class.user_kesearchpremium.php');
$this->user_kesearchpremium = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('user_kesearchpremium');

// set ordering
Expand Down
5 changes: 0 additions & 5 deletions Classes/lib/class.tx_kesearch_filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class tx_kesearch_filters
* @var tx_kesearch_lib
*/
protected $pObj;

/**
* @var tslib_cObj
*/
protected $cObj;

/**
Expand Down Expand Up @@ -310,4 +306,3 @@ public function getTagChar()
return $this->tagChar;
}
}

Loading

0 comments on commit 1f3c2a0

Please sign in to comment.