📄 class.tslib_pibase.php
字号:
<'.trim('table '.$tableParams).'> '.implode('',$tRows).' </table> </div>'; return $out; } /** * Returns a list row. Get data from $this->internal['currentRow']; * (Dummy) * Notice: This function should ALWAYS be defined in the extension class of the plugin since it is directly concerned with the specific layout of the listing for your plugins purpose. * * @param integer Row counting. Starts at 0 (zero). Used for alternating class values in the output rows. * @return string HTML output, a table row with a class attribute set (alternative based on odd/even rows) */ function pi_list_row($c) { // Dummy return '<tr'.($c%2 ? $this->pi_classParam('listrow-odd') : '').'><td><p>[dummy row]</p></td></tr>'; } /** * Returns a list header row. * (Dummy) * Notice: This function should ALWAYS be defined in the extension class of the plugin since it is directly concerned with the specific layout of the listing for your plugins purpose. * * @return string HTML output, a table row with a class attribute set */ function pi_list_header() { return '<tr'.$this->pi_classParam('listrow-header').'><td><p>[dummy header row]</p></td></tr>'; } /*************************** * * Stylesheet, CSS * **************************/ /** * Returns a class-name prefixed with $this->prefixId and with all underscores substituted to dashes (-) * * @param string The class name (or the END of it since it will be prefixed by $this->prefixId.'-') * @return string The combined class name (with the correct prefix) */ function pi_getClassName($class) { return str_replace('_','-',$this->prefixId).($this->prefixId?'-':'').$class; } /** * Returns the class-attribute with the correctly prefixed classname * Using pi_getClassName() * * @param string The class name(s) (suffix) - separate multiple classes with commas * @param string Additional class names which should not be prefixed - separate multiple classes with commas * @return string A "class" attribute with value and a single space char before it. * @see pi_getClassName() */ function pi_classParam($class, $addClasses='') { $output = ''; foreach (t3lib_div::trimExplode(',',$class) as $v) { $output.= ' '.$this->pi_getClassName($v); } foreach (t3lib_div::trimExplode(',',$addClasses) as $v) { $output.= ' '.$v; } return ' class="'.trim($output).'"'; } /** * Sets CSS style-data for the $class-suffix (prefixed by pi_getClassName()) * * @param string $class: Class suffix, see pi_getClassName * @param string $data: CSS data * @param string If $selector is set to any CSS selector, eg 'P' or 'H1' or 'TABLE' then the style $data will regard those HTML-elements only * @return void * @deprecated I think this function should not be used (and probably isn't used anywhere). It was a part of a concept which was left behind quite quickly. * @private */ function pi_setClassStyle($class,$data,$selector='') { $GLOBALS['TSFE']->setCSS($this->pi_getClassName($class).($selector?' '.$selector:''),'.'.$this->pi_getClassName($class).($selector?' '.$selector:'').' {'.$data.'}'); } /** * Wraps the input string in a <div> tag with the class attribute set to the prefixId. * All content returned from your plugins should be returned through this function so all content from your plugin is encapsulated in a <div>-tag nicely identifying the content of your plugin. * * @param string HTML content to wrap in the div-tags with the "main class" of the plugin * @return string HTML content wrapped, ready to return to the parent object. */ function pi_wrapInBaseClass($str) { $content = '<div class="'.str_replace('_','-',$this->prefixId).'"> '.$str.' </div> '; if(!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) { $content = ' <!-- BEGIN: Content of extension "'.$this->extKey.'", plugin "'.$this->prefixId.'" --> '.$content.' <!-- END: Content of extension "'.$this->extKey.'", plugin "'.$this->prefixId.'" --> '; } return $content; } /*************************** * * Frontend editing: Edit panel, edit icons * **************************/ /** * Returns the Backend User edit panel for the $row from $tablename * * @param array Record array. * @param string Table name * @param string A label to show with the panel. * @param array TypoScript parameters to pass along to the EDITPANEL content Object that gets rendered. The property "allow" WILL get overridden/set though. * @return string Returns false/blank if no BE User login and of course if the panel is not shown for other reasons. Otherwise the HTML for the panel (a table). * @see tslib_cObj::EDITPANEL() */ function pi_getEditPanel($row='',$tablename='',$label='',$conf=Array()) { $panel=''; if (!$row || !$tablename) { $row = $this->internal['currentRow']; $tablename = $this->internal['currentTable']; } if ($GLOBALS['TSFE']->beUserLogin) { // Create local cObj if not set: if (!is_object($this->pi_EPtemp_cObj)) { $this->pi_EPtemp_cObj = t3lib_div::makeInstance('tslib_cObj'); $this->pi_EPtemp_cObj->setParent($this->cObj->data,$this->cObj->currentRecord); } // Initialize the cObj object with current row $this->pi_EPtemp_cObj->start($row,$tablename); // Setting TypoScript values in the $conf array. See documentation in TSref for the EDITPANEL cObject. $conf['allow'] = 'edit,new,delete,move,hide'; $panel = $this->pi_EPtemp_cObj->cObjGetSingle('EDITPANEL',$conf,'editpanel'); } if ($panel) { if ($label) { return '<!-- BEGIN: EDIT PANEL --><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top">'.$label.'</td><td valign="top" align="right">'.$panel.'</td></tr></table><!-- END: EDIT PANEL -->'; } else return '<!-- BEGIN: EDIT PANEL -->'.$panel.'<!-- END: EDIT PANEL -->'; } else return $label; } /** * Adds edit-icons to the input content. * tslib_cObj::editIcons used for rendering * * @param string HTML content to add icons to. The icons will be put right after the last content part in the string (that means before the ending series of HTML tags) * @param string The list of fields to edit when the icon is clicked. * @param string Title for the edit icon. * @param array Table record row * @param string Table name * @param array Conf array * @return string The processed content * @see tslib_cObj::editIcons() */ function pi_getEditIcon($content,$fields,$title='',$row='',$tablename='',$oConf=array()) { if ($GLOBALS['TSFE']->beUserLogin){ if (!$row || !$tablename) { $row = $this->internal['currentRow']; $tablename = $this->internal['currentTable']; } $conf=array_merge(array( 'beforeLastTag'=>1, 'iconTitle' => $title ),$oConf); $content=$this->cObj->editIcons($content,$tablename.':'.$fields,$conf,$tablename.':'.$row['uid'],$row,'&viewUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))); } return $content; } /*************************** * * Localization, locallang functions * **************************/ /** * Returns the localized label of the LOCAL_LANG key, $key * Notice that for debugging purposes prefixes for the output values can be set with the internal vars ->LLtestPrefixAlt and ->LLtestPrefix * * @param string The key from the LOCAL_LANG array for which to return the value. * @param string Alternative string to return IF no value is found set for the key, neither for the local language nor the default. * @param boolean If true, the output label is passed through htmlspecialchars() * @return string The value from LOCAL_LANG. */ function pi_getLL($key,$alt='',$hsc=FALSE) { if (isset($this->LOCAL_LANG[$this->LLkey][$key])) { $word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->LLkey][$key], $this->LOCAL_LANG_charset[$this->LLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used. } elseif ($this->altLLkey && isset($this->LOCAL_LANG[$this->altLLkey][$key])) { $word = $GLOBALS['TSFE']->csConv($this->LOCAL_LANG[$this->altLLkey][$key], $this->LOCAL_LANG_charset[$this->altLLkey][$key]); // The "from" charset is normally empty and thus it will convert from the charset of the system language, but if it is set (see ->pi_loadLL()) it will be used. } elseif (isset($this->LOCAL_LANG['default'][$key])) { $word = $this->LOCAL_LANG['default'][$key]; // No charset conversion because default is english and thereby ASCII } else { $word = $this->LLtestPrefixAlt.$alt; } $output = $this->LLtestPrefix.$word; if ($hsc) $output = htmlspecialchars($output); return $output; } /** * Loads local-language values by looking for a "locallang.php" file in the plugin class directory ($this->scriptRelPath) and if found includes it. * Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang.php" file. * * @return void */ function pi_loadLL() { if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) { $basePath = t3lib_extMgm::extPath($this->extKey).dirname($this->scriptRelPath).'/locallang.php'; // php or xml as source: In any case the charset will be that of the system language. // However, this function guarantees only return output for default language plus the specified language (which is different from how 3.7.0 dealt with it) $this->LOCAL_LANG = t3lib_div::readLLfile($basePath,$this->LLkey); if ($this->altLLkey) { $tempLOCAL_LANG = t3lib_div::readLLfile($basePath,$this->altLLkey); $this->LOCAL_LANG = array_merge(is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array(),$tempLOCAL_LANG); } // Overlaying labels from TypoScript (including fictitious language keys for non-system languages!): if (is_array($this->conf['_LOCAL_LANG.'])) { reset($this->conf['_LOCAL_LANG.']); while(list($k,$lA)=each($this->conf['_LOCAL_LANG.'])) { if (is_array($lA)) { $k = substr($k,0,-1); foreach($lA as $llK => $llV) { if (!is_array($llV)) { $this->LOCAL_LANG[$k][$llK] = $llV; if ($k != 'default') { $this->LOCAL_LANG_charset[$k][$llK] = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']; // For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion) } } } } } } } $this->LOCAL_LANG_loaded = 1; } /*************************** * * Database, queries * **************************/ /** * Makes a standard query for listing of records based on standard input vars from the 'browser' ($this->internal['results_at_a_time'] and $this->piVars['pointer']) and 'searchbox' ($this->piVars['sword'] and $this->internal['searchFieldList']) * Set $count to 1 if you wish to get a count(*) query for selecting the number of results. * Notice that the query will use $this->conf['pidList'] and $this->conf['recursive'] to generate a PID list within which to search for records. * * @param string See pi_exec_query() * @param boolean See pi_exec_query() * @param string See pi_exec_query() * @param mixed See pi_exec_query() * @param string See pi_exec_query() * @param string See pi_exec_query() * @param string See pi_exec_query() * @param boolean If set, the function will return the query not as a string but array with the various parts.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -