php TYPO3-CMS-Core-Utility-DebugUtility类(方法)实例源码

下面列出了php TYPO3-CMS-Core-Utility-DebugUtility 类(方法)源码代码实例,从而了解它的用法。

作者:plan2ne    项目:TYPO3.CM   
/**
  * Returns the internal debug messages as a string.
  *
  * @return string
  */
 public function toString()
 {
     $messagesAsString = '';
     if (!empty($this->debugMessages)) {
         $messagesAsString = \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->debugMessages);
     }
     return $messagesAsString;
 }

作者:RocKordie    项目:rn_bas   
/**
  * @return string
  */
 public static function getDebugTrail()
 {
     tx_rnbase::load('tx_rnbase_util_TYPO3');
     if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) {
         return \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
     } else {
         return t3lib_utility_Debug::debugTrail();
     }
 }

作者:sitegeis    项目:ext-sol   
/**
  * @param $parameters
  */
 protected function writeDebugMessage($parameters)
 {
     $message = isset($parameters['msg']) ? $parameters['msg'] : '';
     if (TYPO3_MODE == 'BE') {
         DebugUtility::debug($parameters, $parameters['extKey'], 'DevLog ext:solr: ' . $message);
     } else {
         echo $message . ':<br/>';
         DebuggerUtility::var_dump($parameters);
     }
 }

作者:reinhardfuehrich    项目:typo3-formhandle   
public function getParams($PA, $fobj)
    {
        $params = unserialize($PA['itemFormElValue']);
        $output = '<input
			readonly="readonly" style="display:none"
			name="' . $PA['itemFormElName'] . '"
			value="' . htmlspecialchars($PA['itemFormElValue']) . '"
			onchange="' . htmlspecialchars(implode('', $PA['fieldChangeFunc'])) . '"
			' . $PA['onFocus'] . '/>
		';
        $output .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($params);
        return $output;
    }

作者:woehrla    项目:new.woehrl.d   
/**
  * Prints the messages to the screen
  *
  * @return void
  */
 public function outputDebugLog()
 {
     $out = '';
     foreach ($this->debugLog as $section => $logData) {
         $out .= $this->globals->getCObj()->wrap($section, $this->utilityFuncs->getSingle($this->settings, 'sectionHeaderWrap'));
         $sectionContent = '';
         foreach ($logData as $messageData) {
             $message = str_replace("\n", '<br />', $messageData['message']);
             $message = $this->globals->getCObj()->wrap($message, $this->utilityFuncs->getSingle($this->settings['severityWrap.'], $messageData['severity']));
             $sectionContent .= $this->globals->getCObj()->wrap($message, $this->settings['messageWrap']);
             if ($messageData['data']) {
                 $sectionContent .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($messageData['data']);
                 $sectionContent .= '<br />';
             }
         }
         $out .= $this->globals->getCObj()->wrap($sectionContent, $this->utilityFuncs->getSingle($this->settings, 'sectionWrap'));
     }
     print $out;
 }

作者:noxlud    项目:TYPO3v4-Cor   
/**
  * Logs a call to a deprecated function.
  * The log message will be taken from the annotation.
  *
  * @return void
  */
 public static function logDeprecatedFunction()
 {
     if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
         return;
     }
     $trail = debug_backtrace();
     if ($trail[1]['type']) {
         $function = new \ReflectionMethod($trail[1]['class'], $trail[1]['function']);
     } else {
         $function = new \ReflectionFunction($trail[1]['function']);
     }
     $msg = '';
     if (preg_match('/@deprecated\\s+(.*)/', $function->getDocComment(), $match)) {
         $msg = $match[1];
     }
     // Trigger PHP error with a short message: <function> is deprecated (called from <source>, defined in <source>)
     $errorMsg = 'Function ' . $trail[1]['function'];
     if ($trail[1]['class']) {
         $errorMsg .= ' of class ' . $trail[1]['class'];
     }
     $errorMsg .= ' is deprecated (called from ' . $trail[1]['file'] . '#' . $trail[1]['line'] . ', defined in ' . $function->getFileName() . '#' . $function->getStartLine() . ')';
     // Write a longer message to the deprecation log: <function> <annotion> - <trace> (<source>)
     $logMsg = $trail[1]['class'] . $trail[1]['type'] . $trail[1]['function'];
     $logMsg .= '() - ' . $msg . ' - ' . \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
     $logMsg .= ' (' . substr($function->getFileName(), strlen(PATH_site)) . '#' . $function->getStartLine() . ')';
     self::deprecationLog($logMsg);
 }

作者:hlo    项目:TYPO3.CM   
/**
     * Printing the debug-log from the DBAL extension
     *
     * To enabled debugging, you will have to enabled it in the configuration!
     *
     * @return 	string HTML content
     */
    protected function printLogMgm()
    {
        // Disable debugging in any case...
        $GLOBALS['TYPO3_DB']->debug = false;
        // Get cmd:
        $cmd = (string) GeneralUtility::_GP('cmd');
        switch ($cmd) {
            case 'flush':
                $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog');
                $res = $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('tx_dbal_debuglog_where');
                $outStr = 'Log FLUSHED!';
                break;
            case 'joins':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('table_join,exec_time,query,script', 'tx_dbal_debuglog', 'table_join!=\'\'', 'table_join,script,exec_time,query');
                // Init vars in which to pick up the query result:
                $tableIndex = array();
                $tRows = array();
                $tRows[] = '
						<tr>
							<td>Execution time</td>
							<td>Table joins</td>
							<td>Script</td>
							<td>Query</td>
						</tr>';
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    $tableArray = $GLOBALS['TYPO3_DB']->SQLparser->parseFromTables($row['table_join']);
                    // Create table name index:
                    foreach ($tableArray as $a) {
                        foreach ($tableArray as $b) {
                            if ($b['table'] != $a['table']) {
                                $tableIndex[$a['table']][$b['table']] = 1;
                            }
                        }
                    }
                    // Create output row
                    $tRows[] = '
							<tr>
								<td>' . htmlspecialchars($row['exec_time']) . '</td>
								<td>' . htmlspecialchars($row['table_join']) . '</td>
								<td>' . htmlspecialchars($row['script']) . '</td>
								<td>' . htmlspecialchars($row['query']) . '</td>
							</tr>';
                }
                // Printing direct joins:
                $outStr .= '<h4>Direct joins:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
                // Printing total dependencies:
                foreach ($tableIndex as $priTable => $a) {
                    foreach ($tableIndex as $tableN => $v) {
                        foreach ($v as $tableP => $vv) {
                            if ($tableP == $priTable) {
                                $tableIndex[$priTable] = array_merge($v, $a);
                            }
                        }
                    }
                }
                $outStr .= '<h4>Total dependencies:</h4>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($tableIndex);
                // Printing data rows:
                $outStr .= '
						<table border="1" cellspacing="0">' . implode('', $tRows) . '
						</table>';
                break;
            case 'errors':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('serdata,exec_time,query,script', 'tx_dbal_debuglog', 'errorFlag>0', '', 'tstamp DESC');
                // Init vars in which to pick up the query result:
                $tRows = array();
                $tRows[] = '
						<tr>
							<td>Execution time</td>
							<td>Error data</td>
							<td>Script</td>
							<td>Query</td>
						</tr>';
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    // Create output row
                    $tRows[] = '
							<tr>
								<td>' . htmlspecialchars($row['exec_time']) . '</td>
								<td>' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray(unserialize($row['serdata'])) . '</td>
								<td>' . htmlspecialchars($row['script']) . '</td>
								<td>' . htmlspecialchars($row['query']) . '</td>
							</tr>';
                }
                // Printing data rows:
                $outStr .= '
						<table border="1" cellspacing="0">' . implode('', $tRows) . '
						</table>';
                break;
            case 'parsing':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('query,serdata', 'tx_dbal_debuglog', 'errorFlag&2=2');
                $tRows = array();
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    // Create output row
                    $tRows[] = '
//.........这里部分代码省略.........

作者:wmdbsystem    项目:fal_dropbo   
/**
  * Replaces a file with file in local file system.
  *
  * @param string $fileIdentifier
  * @param string $localFilePath
  * @return bool TRUE if the operation succeeded
  */
 public function replaceFile($fileIdentifier, $localFilePath)
 {
     DebugUtility::debug(__FUNCTION__, 'Method');
     $this->cache->flush();
 }

作者:franzhol    项目:TYPO3.CM   
/**
  * Returns a table with the error-messages.
  *
  * @return string HTML print of error log
  */
 public function printErrorLog()
 {
     return !empty($this->errorLog) ? DebugUtility::viewArray($this->errorLog) : '';
 }

作者:BenjaminBec    项目:commerc   
/**
  * Debugging var with header and group.
  *
  * @param mixed $var Var
  * @param string $header Header
  * @param string $group Group
  *
  * @return void
  */
 protected function debug($var, $header, $group)
 {
     if ($this->debug) {
         \TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $header, $group);
     }
 }

作者:vip3ou    项目:TYPO3.CM   
//.........这里部分代码省略.........
                     }
                     break;
                 case 'date':
                     if (!$key) {
                         $key = 'd/m Y';
                     }
                     $retVal = date($key, $GLOBALS['EXEC_TIME']);
                     break;
                 case 'page':
                     $retVal = $tsfe->page[$key];
                     break;
                 case 'pagelayout':
                     // Check if the current page has a value in the DB field "backend_layout"
                     // if empty, check the root line for "backend_layout_next_level"
                     // same as
                     //   field = backend_layout
                     //   ifEmpty.data = levelfield:-2, backend_layout_next_level, slide
                     //   ifEmpty.ifEmpty = default
                     $retVal = $GLOBALS['TSFE']->page['backend_layout'];
                     // If it is set to "none" - don't use any
                     if ($retVal === '-1') {
                         $retVal = 'none';
                     } elseif ($retVal === '' || $retVal === '0') {
                         // If it not set check the root-line for a layout on next level and use this
                         // Remove first element, which is the current page
                         // See also \TYPO3\CMS\Backend\View\BackendLayoutView::getSelectedCombinedIdentifier()
                         $rootLine = $tsfe->rootLine;
                         array_shift($rootLine);
                         foreach ($rootLine as $rootLinePage) {
                             $retVal = (string) $rootLinePage['backend_layout_next_level'];
                             // If layout for "next level" is set to "none" - don't use any and stop searching
                             if ($retVal === '-1') {
                                 $retVal = 'none';
                                 break;
                             } elseif ($retVal !== '' && $retVal !== '0') {
                                 // Stop searching if a layout for "next level" is set
                                 break;
                             }
                         }
                     }
                     if ($retVal === '0' || $retVal === '') {
                         $retVal = 'default';
                     }
                     break;
                 case 'current':
                     $retVal = $this->data[$this->currentValKey];
                     break;
                 case 'db':
                     $selectParts = GeneralUtility::trimExplode(':', $key);
                     $db_rec = $tsfe->sys_page->getRawRecord($selectParts[0], $selectParts[1]);
                     if (is_array($db_rec) && $selectParts[2]) {
                         $retVal = $db_rec[$selectParts[2]];
                     }
                     break;
                 case 'lll':
                     $retVal = $tsfe->sL('LLL:' . $key);
                     break;
                 case 'path':
                     $retVal = $tsfe->tmpl->getFileName($key);
                     break;
                 case 'cobj':
                     switch ($key) {
                         case 'parentRecordNumber':
                             $retVal = $this->parentRecordNumber;
                             break;
                     }
                     break;
                 case 'debug':
                     switch ($key) {
                         case 'rootLine':
                             $retVal = DebugUtility::viewArray($tsfe->tmpl->rootLine);
                             break;
                         case 'fullRootLine':
                             $retVal = DebugUtility::viewArray($tsfe->rootLine);
                             break;
                         case 'data':
                             $retVal = DebugUtility::viewArray($this->data);
                             break;
                         case 'register':
                             $retVal = DebugUtility::viewArray($tsfe->register);
                             break;
                         case 'page':
                             $retVal = DebugUtility::viewArray($tsfe->page);
                             break;
                     }
                     break;
             }
         }
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) {
                 $hookObject = GeneralUtility::getUserObj($classData);
                 if (!$hookObject instanceof ContentObjectGetDataHookInterface) {
                     throw new \UnexpectedValueException('$hookObject must implement interface ' . ContentObjectGetDataHookInterface::class, 1195044480);
                 }
                 $retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
             }
         }
     }
     return $retVal;
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * Explain select queries
  * If $this->explainOutput is set, SELECT queries will be explained here. Only queries with more than one possible result row will be displayed.
  * The output is either printed as raw HTML output or embedded into the TS admin panel (checkbox must be enabled!)
  *
  * @todo Feature is not DBAL-compliant
  *
  * @param string $query SQL query
  * @param string $from_table Table(s) from which to select. This is what comes right after "FROM ...". Required value.
  * @param int $row_count Number of resulting rows
  * @return bool TRUE if explain was run, FALSE otherwise
  */
 protected function explain($query, $from_table, $row_count)
 {
     $debugAllowedForIp = GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
     if ((int) $this->explainOutput == 1 || (int) $this->explainOutput == 2 && $debugAllowedForIp) {
         // Raw HTML output
         $explainMode = 1;
     } elseif ((int) $this->explainOutput == 3 && is_object($GLOBALS['TT'])) {
         // Embed the output into the TS admin panel
         $explainMode = 2;
     } else {
         return false;
     }
     $error = $this->sql_error();
     $trail = \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail();
     $explain_tables = array();
     $explain_output = array();
     $res = $this->sql_query('EXPLAIN ' . $query, $this->link);
     if (is_a($res, '\\mysqli_result')) {
         while ($tempRow = $this->sql_fetch_assoc($res)) {
             $explain_output[] = $tempRow;
             $explain_tables[] = $tempRow['table'];
         }
         $this->sql_free_result($res);
     }
     $indices_output = array();
     // Notice: Rows are skipped if there is only one result, or if no conditions are set
     if ($explain_output[0]['rows'] > 1 || GeneralUtility::inList('ALL', $explain_output[0]['type'])) {
         // Only enable output if it's really useful
         $debug = true;
         foreach ($explain_tables as $table) {
             $tableRes = $this->sql_query('SHOW TABLE STATUS LIKE \'' . $table . '\'');
             $isTable = $this->sql_num_rows($tableRes);
             if ($isTable) {
                 $res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link);
                 if (is_a($res, '\\mysqli_result')) {
                     while ($tempRow = $this->sql_fetch_assoc($res)) {
                         $indices_output[] = $tempRow;
                     }
                     $this->sql_free_result($res);
                 }
             }
             $this->sql_free_result($tableRes);
         }
     } else {
         $debug = false;
     }
     if ($debug) {
         if ($explainMode) {
             $data = array();
             $data['query'] = $query;
             $data['trail'] = $trail;
             $data['row_count'] = $row_count;
             if ($error) {
                 $data['error'] = $error;
             }
             if (!empty($explain_output)) {
                 $data['explain'] = $explain_output;
             }
             if (!empty($indices_output)) {
                 $data['indices'] = $indices_output;
             }
             if ($explainMode == 1) {
                 \TYPO3\CMS\Core\Utility\DebugUtility::debug($data, 'Tables: ' . $from_table, 'DB SQL EXPLAIN');
             } elseif ($explainMode == 2) {
                 $GLOBALS['TT']->setTSselectQuery($data);
             }
         }
         return true;
     }
     return false;
 }

作者:abey    项目:powermai   
/**
  * Save mail on submit
  *
  * @param Mail $mail
  * @return void
  */
 protected function saveMail(Mail &$mail = null)
 {
     $marketingInfos = SessionUtility::getMarketingInfos();
     $mail->setPid(FrontendUtility::getStoragePage($this->settings['main']['pid']))->setSenderMail($this->mailRepository->getSenderMailFromArguments($mail))->setSenderName($this->mailRepository->getSenderNameFromArguments($mail))->setSubject($this->settings['receiver']['subject'])->setReceiverMail($this->settings['receiver']['email'])->setBody(DebugUtility::viewArray($this->mailRepository->getVariablesWithMarkersFromMail($mail)))->setSpamFactor(SessionUtility::getSpamFactorFromSession())->setTime(time() - SessionUtility::getFormStartFromSession($mail->getForm()->getUid(), $this->settings))->setUserAgent(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'))->setMarketingRefererDomain($marketingInfos['refererDomain'])->setMarketingReferer($marketingInfos['referer'])->setMarketingCountry($marketingInfos['country'])->setMarketingMobileDevice($marketingInfos['mobileDevice'])->setMarketingFrontendLanguage($marketingInfos['frontendLanguage'])->setMarketingBrowserLanguage($marketingInfos['browserLanguage'])->setMarketingPageFunnel($marketingInfos['pageFunnel']);
     if (FrontendUtility::isLoggedInFrontendUser()) {
         $mail->setFeuser($this->userRepository->findByUid(FrontendUtility::getPropertyFromLoggedInFrontendUser('uid')));
     }
     if (!ConfigurationUtility::isDisableIpLogActive()) {
         $mail->setSenderIp(GeneralUtility::getIndpEnv('REMOTE_ADDR'));
     }
     if ($this->settings['main']['optin'] || $this->settings['db']['hidden']) {
         $mail->setHidden(true);
     }
     foreach ($mail->getAnswers() as $answer) {
         $answer->setPid(FrontendUtility::getStoragePage($this->settings['main']['pid']));
     }
     $this->mailRepository->add($mail);
     $this->persistenceManager->persistAll();
 }

作者:teaminmedias-pluswer    项目:ke_searc   
/**
  * store collected data of defined indexers to db
  * @param integer $storagePid
  * @param string $title
  * @param string $type
  * @param integer $targetPid
  * @param string $content
  * @param string $tags
  * @param string $params
  * @param string $abstract
  * @param integer $language
  * @param integer $starttime
  * @param integer $endtime
  * @param string $fe_group
  * @param boolean $debugOnly
  * @param array $additionalFields
  * @return boolean|integer
  */
 public function storeInIndex($storagePid, $title, $type, $targetPid, $content, $tags = '', $params = '', $abstract = '', $language = 0, $starttime = 0, $endtime = 0, $fe_group = '', $debugOnly = false, $additionalFields = array())
 {
     // if there are errors found in current record return false and break processing
     if (!$this->checkIfRecordHasErrorsBeforeIndexing($storagePid, $title, $type, $targetPid)) {
         return false;
     }
     // optionally add tag set in the indexer configuration
     if (!empty($this->indexerConfig['filteroption']) && (substr($type, 0, 4) != 'file' || substr($type, 0, 4) == 'file' && $this->indexerConfig['index_use_page_tags_for_files'] || $this->indexerConfig['type'] == 'file')) {
         $indexerTag = $this->getTag($this->indexerConfig['filteroption']);
         $tagChar = $this->extConf['prePostTagChar'];
         if ($tags) {
             $tags .= ',' . $tagChar . $indexerTag . $tagChar;
         } else {
             $tags = $tagChar . $indexerTag . $tagChar;
         }
         $tags = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($tags);
     }
     $table = 'tx_kesearch_index';
     $fieldValues = $this->createFieldValuesForIndexing($storagePid, $title, $type, $targetPid, $content, $tags, $params, $abstract, $language, $starttime, $endtime, $fe_group, $additionalFields);
     // check if record already exists
     if (substr($type, 0, 4) == 'file') {
         $recordExists = $this->checkIfFileWasIndexed($fieldValues['type'], $fieldValues['hash']);
     } else {
         $recordExists = $this->checkIfRecordWasIndexed($fieldValues['orig_uid'], $fieldValues['pid'], $fieldValues['type'], $fieldValues['language']);
     }
     if ($recordExists) {
         // update existing record
         $where = 'uid=' . intval($this->currentRow['uid']);
         unset($fieldValues['crdate']);
         if ($debugOnly) {
             // do not process - just debug query
             \TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fieldValues), 1);
         } else {
             // process storing of index record and return uid
             $this->updateRecordInIndex($fieldValues);
             return true;
         }
     } else {
         // insert new record
         if ($debugOnly) {
             // do not process - just debug query
             \TYPO3\CMS\Core\Utility\DebugUtility::debug($GLOBALS['TYPO3_DB']->INSERTquery($table, $fieldValues, false));
         } else {
             // process storing of index record and return uid
             $this->insertRecordIntoIndex($fieldValues);
             return $GLOBALS['TYPO3_DB']->sql_insert_id();
         }
     }
 }

作者:Ape    项目:additional_schedule   
/**
  * Template rendering for subdatas and principal datas
  *
  * @param array   $templateMarkers
  * @param string  $templateSection
  * @param boolean $debug
  * @return string HTML code
  */
 public function renderAllTemplate($templateMarkers, $templateSection, $debug = false)
 {
     // Check if the template is loaded
     if (!$this->templateContent) {
         return false;
     }
     // Check argument
     if (!is_array($templateMarkers)) {
         return false;
     }
     if ($debug === true) {
         \TYPO3\CMS\Core\Utility\DebugUtility::debug($templateMarkers, 'Markers for ' . $templateSection);
     }
     $content = '';
     if (is_array($templateMarkers[0])) {
         foreach ($templateMarkers as $markers) {
             $content .= $this->renderAllTemplate($markers, $templateSection, $debug);
         }
     } else {
         $content = $this->renderSingle($templateMarkers, $templateSection);
     }
     return $this->cleanTemplate($content);
 }

作者:BenjaminBec    项目:commerc   
/**
  * Init Method for initialising the navigation.
  *
  * @param string $content Content passed to method
  * @param array $conf Typoscript Array
  *
  * @return array array for the menurendering of TYPO3
  */
 public function init($content, array $conf)
 {
     $this->mConf = $this->processConf($conf);
     if ($this->mConf['useRootlineInformationToUrl']) {
         $this->useRootlineInformationToUrl = $this->mConf['useRootlineInformationToUrl'];
     }
     $this->choosenCat = $this->mConf['category'];
     $this->nodeArrayAdditionalFields = GeneralUtility::trimExplode(',', $this->mConf['additionalFields'], 0);
     $this->pid = $this->mConf['overridePid'] ? $this->mConf['overridePid'] : $this->getFrontendController()->id;
     $this->gpVars = GeneralUtility::_GPmerged($this->prefixId);
     \CommerceTeam\Commerce\Utility\GeneralUtility::initializeFeUserBasket();
     $this->gpVars['basketHashValue'] = $this->getBasket()->getBasketHashValue();
     $this->pageRootline = $this->getFrontendController()->rootLine;
     $this->menuType = $this->mConf['1'];
     $this->entryLevel = (int) $this->mConf['entryLevel'];
     if ((int) $this->mConf['noAct'] > 0) {
         $this->noAct = true;
     }
     if ((int) $this->mConf['maxLevel'] > 0) {
         $this->maxLevel = (int) $this->mConf['maxLevel'];
     }
     /*
      * Detect if a user is logged in and if he or she has usergroups
      * as we have to take in accout, that different usergroups may have different
      * rights on the commerce tree, so consider this whe calculation the cache hash.
      */
     $usergroups = '';
     if (is_array($this->getFrontendUser()->user)) {
         $usergroups = $this->getFrontendUser()->user['usergroup'];
     }
     $this->cat = $this->getRootCategory();
     // Define a default
     $this->choosenCat = $this->mConf['category'];
     $this->showUid = $this->gpVars['showUid'] ? $this->gpVars['showUid'] : 0;
     $this->mDepth = $this->gpVars['mDepth'] ? $this->gpVars['mDepth'] : 0;
     $this->path = $this->gpVars['path'] ? $this->gpVars['path'] : 0;
     $this->expandAll = $this->mConf['expandAll'] ? $this->mConf['expandAll'] : 0;
     $menuErrorName = array();
     if (!($this->cat > 0)) {
         $menuErrorName[] = 'No category defined in TypoScript: lib.tx_commerce.navigation.special.category';
     }
     if (!($this->pid > 0)) {
         $menuErrorName[] = 'No OveridePID defined in TypoScript: lib.tx_commerce.navigation.special.overridePid';
     }
     if (!empty($menuErrorName)) {
         foreach ($menuErrorName as $oneError) {
             \TYPO3\CMS\Core\Utility\DebugUtility::debug($this->mConf, $oneError);
         }
         return $this->makeErrorMenu(5);
     }
     /*
      * Unique Hash for this usergroup and page to display the navigation
      */
     $hash = md5('tx_commerce_navigation:' . implode('-', $this->mConf) . ':' . $usergroups . ':' . $this->getFrontendController()->linkVars . ':' . GeneralUtility::getIndpEnv('HTTP_HOST'));
     /*
      * Render Menue Array and store in cache, if possible
      */
     if ($this->getFrontendController()->no_cache) {
         // Build directly and don't sore, if no_cache=1'
         $this->mTree = $this->makeArrayPostRender($this->pid, 'tx_commerce_categories', 'tx_commerce_categories_parent_category_mm', 'tx_commerce_products', 'tx_commerce_products_categories_mm', $this->cat, 1, 0, $this->maxLevel);
         /*
          * Sorting Options, there is only one type 'alphabetiDesc' :)
          * the others must to program
          *
          * @todo: implement sortType: alphabetiAsc, byUid, bySorting
          */
         if ($this->mConf['sortAllitems.']['type'] == 'alphabetiDesc') {
             $this->sortAllMenuArray($this->mTree, 'alphabetiDesc');
         }
     } else {
         $cachedMatrix = $this->getHash($hash);
         if (!empty($cachedMatrix)) {
             // User the cached version
             $this->mTree = $cachedMatrix;
         } else {
             // no cache present buld data and stor it in cache
             $this->mTree = $this->makeArrayPostRender($this->pid, 'tx_commerce_categories', 'tx_commerce_categories_parent_category_mm', 'tx_commerce_products', 'tx_commerce_products_categories_mm', $this->cat, 1, 0, $this->maxLevel);
             /*
              * Sorting Options, there is only one type 'alphabetiDesc' :)
              * the others must to program
              *
              * @todo: implement sortType: alphabetiAsc, byUid, bySorting
              */
             if ($this->mConf['sortAllitems.']['type'] == 'alphabetiDesc') {
                 $this->sortAllMenuArray($this->mTree, 'alphabetiDesc');
             }
             $this->storeHash($hash, $this->mTree);
         }
     }
     /*
      * Finish menue array rendering, now postprocessing
      * with current status of menue
//.........这里部分代码省略.........

作者:nawor    项目:crawle   
/**
     * Create the rows for display of the page tree
     * For each page a number of rows are shown displaying GET variable configuration
     *
     * @param	array		Page row
     * @param	string		Page icon and title for row
     * @return	string		HTML <tr> content (one or more)
     */
    public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon)
    {
        $skipMessage = '';
        // Get list of configurations
        $configurations = $this->getUrlsForPageRow($pageRow, $skipMessage);
        if (count($this->incomingConfigurationSelection) > 0) {
            // 	remove configuration that does not match the current selection
            foreach ($configurations as $confKey => $confArray) {
                if (!in_array($confKey, $this->incomingConfigurationSelection)) {
                    unset($configurations[$confKey]);
                }
            }
        }
        // Traverse parameter combinations:
        $c = 0;
        $cc = 0;
        $content = '';
        if (count($configurations)) {
            foreach ($configurations as $confKey => $confArray) {
                // Title column:
                if (!$c) {
                    $titleClm = '<td rowspan="' . count($configurations) . '">' . $pageTitleAndIcon . '</td>';
                } else {
                    $titleClm = '';
                }
                if (!in_array($pageRow['uid'], $this->expandExcludeString($confArray['subCfg']['exclude']))) {
                    // URL list:
                    $urlList = $this->urlListFromUrlArray($confArray, $pageRow, $this->scheduledTime, $this->reqMinute, $this->submitCrawlUrls, $this->downloadCrawlUrls, $this->duplicateTrack, $this->downloadUrls, $this->incomingProcInstructions);
                    // Expanded parameters:
                    $paramExpanded = '';
                    $calcAccu = array();
                    $calcRes = 1;
                    foreach ($confArray['paramExpanded'] as $gVar => $gVal) {
                        $paramExpanded .= '
							<tr>
								<td class="bgColor4-20">' . htmlspecialchars('&' . $gVar . '=') . '<br/>' . '(' . count($gVal) . ')' . '</td>
								<td class="bgColor4" nowrap="nowrap">' . nl2br(htmlspecialchars(implode(chr(10), $gVal))) . '</td>
							</tr>
						';
                        $calcRes *= count($gVal);
                        $calcAccu[] = count($gVal);
                    }
                    $paramExpanded = '<table class="lrPadding c-list param-expanded">' . $paramExpanded . '</table>';
                    $paramExpanded .= 'Comb: ' . implode('*', $calcAccu) . '=' . $calcRes;
                    // Options
                    $optionValues = '';
                    if ($confArray['subCfg']['userGroups']) {
                        $optionValues .= 'User Groups: ' . $confArray['subCfg']['userGroups'] . '<br/>';
                    }
                    if ($confArray['subCfg']['baseUrl']) {
                        $optionValues .= 'Base Url: ' . $confArray['subCfg']['baseUrl'] . '<br/>';
                    }
                    if ($confArray['subCfg']['procInstrFilter']) {
                        $optionValues .= 'ProcInstr: ' . $confArray['subCfg']['procInstrFilter'] . '<br/>';
                    }
                    // Compile row:
                    $content .= '
						<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '">
							' . $titleClm . '
							<td>' . htmlspecialchars($confKey) . '</td>
							<td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td>
							<td>' . $paramExpanded . '</td>
							<td nowrap="nowrap">' . $urlList . '</td>
							<td nowrap="nowrap">' . $optionValues . '</td>
							<td nowrap="nowrap">' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($confArray['subCfg']['procInstrParams.']) . '</td>
						</tr>';
                } else {
                    $content .= '<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '">
							' . $titleClm . '
							<td>' . htmlspecialchars($confKey) . '</td>
							<td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td>
						</tr>';
                }
                $c++;
            }
        } else {
            $message = !empty($skipMessage) ? ' (' . $skipMessage . ')' : '';
            // Compile row:
            $content .= '
				<tr class="bgColor-20" style="border-bottom: 1px solid black;">
					<td>' . $pageTitleAndIcon . '</td>
					<td colspan="6"><em>No entries</em>' . $message . '</td>
				</tr>';
        }
        return $content;
    }

作者:ulrikkol    项目:ca   
function hasPeriodChanged($old, $new, $reverse = false, $debug = false)
 {
     if ($debug) {
         \TYPO3\CMS\Core\Utility\DebugUtility::debug(array($old, $new, $reverse));
     }
     if ($reverse) {
         return intval($new) < intval($old);
     } else {
         return intval($new) > intval($old);
     }
 }

作者:advOp    项目:pw   
/**
  * Save mail on submit
  *
  * @param \In2code\Powermail\Domain\Model\Mail $mail
  * @return void
  */
 protected function saveMail(Mail &$mail = NULL)
 {
     $marketingInfos = Div::getMarketingInfos();
     $mail->setPid(Div::getStoragePage($this->settings['main']['pid']));
     $mail->setSenderMail($this->div->getSenderMailFromArguments($mail));
     $mail->setSenderName($this->div->getSenderNameFromArguments($mail));
     $mail->setSubject($this->settings['receiver']['subject']);
     $mail->setReceiverMail($this->settings['receiver']['email']);
     $mail->setBody(\TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->div->getVariablesWithLabels($mail)));
     $mail->setSpamFactor($GLOBALS['TSFE']->fe_user->getKey('ses', 'powermail_spamfactor'));
     $mail->setTime(time() - Div::getFormStartFromSession($mail->getForm()->getUid()));
     $mail->setUserAgent(GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
     $mail->setMarketingRefererDomain($marketingInfos['refererDomain']);
     $mail->setMarketingReferer($marketingInfos['referer']);
     $mail->setMarketingCountry($marketingInfos['country']);
     $mail->setMarketingMobileDevice($marketingInfos['mobileDevice']);
     $mail->setMarketingFrontendLanguage($marketingInfos['frontendLanguage']);
     $mail->setMarketingBrowserLanguage($marketingInfos['browserLanguage']);
     $mail->setMarketingPageFunnel($marketingInfos['pageFunnel']);
     if (intval($GLOBALS['TSFE']->fe_user->user['uid']) > 0) {
         $mail->setFeuser($this->userRepository->findByUid(Div::getPropertyFromLoggedInFeUser('uid')));
     }
     if (empty($this->settings['global']['disableIpLog'])) {
         $mail->setSenderIp(GeneralUtility::getIndpEnv('REMOTE_ADDR'));
     }
     if ($this->settings['main']['optin'] || $this->settings['db']['hidden']) {
         $mail->setHidden(TRUE);
     }
     foreach ($mail->getAnswers() as $answer) {
         $answer->setPid(Div::getStoragePage($this->settings['main']['pid']));
     }
     $this->mailRepository->add($mail);
     $this->persistenceManager->persistAll();
 }

作者:nicksergi    项目:TYPO3v4-Cor   
/**
  * Returns a table with the error-messages.
  *
  * @return string HTML print of error log
  * @todo Define visibility
  */
 public function printErrorLog()
 {
     return count($this->errorLog) ? \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->errorLog) : '';
 }


问题


面经


文章

微信
公众号

扫码关注公众号