diff --git a/typo3/sysext/sys_action/ext_tables.php b/typo3/sysext/sys_action/ext_tables.php index c38b5cedfb197df2bebba9dfd3332fe1c7af12c4..281e08c767025d6ab36403e120f1f7b80b47b9c8 100755 --- a/typo3/sysext/sys_action/ext_tables.php +++ b/typo3/sysext/sys_action/ext_tables.php @@ -1,6 +1,6 @@ <?php -if (!defined ('TYPO3_MODE')) { - die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); } if (TYPO3_MODE == 'BE') { diff --git a/typo3/sysext/sys_action/task/class.tx_sysaction_list.php b/typo3/sysext/sys_action/task/class.tx_sysaction_list.php index 16af84b7b6331277c7885d035da1217a29d20850..a4e7140ec0ce62a0679afc6a116f6a5dcb5f4aff 100644 --- a/typo3/sysext/sys_action/task/class.tx_sysaction_list.php +++ b/typo3/sysext/sys_action/task/class.tx_sysaction_list.php @@ -27,7 +27,7 @@ /** * Class for the list rendering of Web>Task Center module * - * @author Thomas Maroschik <tmaroschik@dfau.de> + * @author Thomas Maroschik <tmaroschik@dfau.de> * @package TYPO3 * @subpackage core */ diff --git a/typo3/sysext/sys_action/task/class.tx_sysaction_task.php b/typo3/sysext/sys_action/task/class.tx_sysaction_task.php index 6a1555dda32273efca011e16ae91f6da56240386..2104390dacff00666ba9ac9fa9d634a4aa20a7b3 100644 --- a/typo3/sysext/sys_action/task/class.tx_sysaction_task.php +++ b/typo3/sysext/sys_action/task/class.tx_sysaction_task.php @@ -23,15 +23,13 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * This class provides a task for the taskcenter * - * @author Kasper Skårhøj <kasperYYYY@typo3.com> - * @author Georg Ringer <typo3@ringerge.org> - * @package TYPO3 - * @subpackage tx_sysaction - * + * @author Kasper Skårhøj <kasperYYYY@typo3.com> + * @author Georg Ringer <typo3@ringerge.org> + * @package TYPO3 + * @subpackage tx_sysaction */ class tx_sysaction_task implements tx_taskcenter_Task { @@ -59,11 +57,10 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } - /** * This method renders the task * - * @return string The task as HTML + * @return string The task as HTML */ public function getTask() { $content = ''; @@ -75,7 +72,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } - // if no task selected, render the menu + // If no task selected, render the menu if ($show == 0) { $content .= $this->taskObject->description( $GLOBALS['LANG']->getLL('sys_action'), @@ -86,7 +83,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } else { $record = t3lib_BEfunc::getRecord('sys_action', $show); - // if the action is not found + // If the action is not found if (count($record) == 0) { $flashMessage = t3lib_div::makeInstance( 't3lib_FlashMessage', @@ -96,10 +93,10 @@ class tx_sysaction_task implements tx_taskcenter_Task { ); $content .= $flashMessage->render(); } else { - // render the task + // Render the task $content .= $this->taskObject->description($record['title'], $record['description']); - // output depends on the type + // Output depends on the type switch ($record['type']) { case 1: $content .= $this->viewNewBackendUser($record); @@ -134,17 +131,17 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Gemeral overview over the task in the taskcenter menu * - * @return string Overview as HTML + * @return string Overview as HTML */ public function getOverview() { $content = '<p>' . $GLOBALS['LANG']->getLL('description') . '</p>'; - // get the actions + // Get the actions $actionList = $this->getActions(); if (count($actionList) > 0) { $items = ''; - // render a single action menu item + // Render a single action menu item foreach ($actionList as $action) { $active = (t3lib_div::_GP('show') === $action['uid']) ? ' class="active" ' : ''; $items .= '<li' . $active . '> @@ -163,8 +160,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { * Get all actions of an user. Admins can see any action, all others only those * whic are allowed in sys_action record itself. * - * @param boolean $toOverview: If TRUE, the link redirects to the taskcenter - * @return array Array holding every needed information of a sys_action + * @return array Array holding every needed information of a sys_action */ protected function getActions() { $actionList = array(); @@ -179,7 +175,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { 'sys_action.sorting' ); } else { - // editors can only see the actions which are assigned to a usergroup they belong to + // Editors can only see the actions which are assigned to a usergroup they belong to $additionalWhere = 'be_groups.uid IN (' . ($GLOBALS['BE_USER']->groupList ? $GLOBALS['BE_USER']->groupList : 0) . ')'; $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( @@ -193,10 +189,10 @@ class tx_sysaction_task implements tx_taskcenter_Task { ); } - while($actionRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + while ($actionRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $editActionLink = ''; - // admins are allowed to edit sys_action records + // Admins are allowed to edit sys_action records if ($GLOBALS['BE_USER']->isAdmin()) { $returnUrl = rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); $link = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR') . $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . $returnUrl . '&edit[sys_action][' . $actionRow['uid'] . ']=edit'; @@ -224,15 +220,15 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Render the menu of sys_actions * - * @return string list of sys_actions as HTML + * @return string List of sys_actions as HTML */ protected function renderActionList() { $content = ''; - // get the sys_action records + // Get the sys_action records $actionList = $this->getActions(); - // if any actions are found for the current users + // If any actions are found for the current users if (count($actionList) > 0) { $content .= $this->taskObject->renderListMenu($actionList); } else { @@ -263,14 +259,14 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Action to create a new BE user * - * @param array $record: sys_action record - * @return string form to create a new user + * @param array $record sys_action record + * @return string form to create a new user */ protected function viewNewBackendUser($record) { $content = ''; $beRec = t3lib_BEfunc::getRecord('be_users', intval($record['t1_copy_of_user'])); - // a record is neeed which is used as copy for the new user + // A record is neeed which is used as copy for the new user if (!is_array($beRec)) { $flashMessage = t3lib_div::makeInstance( 't3lib_FlashMessage', @@ -289,7 +285,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { if ($vars['sent'] == 1) { $errors = array(); - // basic error checks + // Basic error checks if (!empty($vars['email']) && !t3lib_div::validEmail($vars['email'])) { $errors[] = $GLOBALS['LANG']->getLL('error-wrong-email'); } @@ -309,7 +305,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } - // show errors if there are any + // Show errors if there are any if (count($errors) > 0) { $flashMessage = t3lib_div::makeInstance ( 't3lib_FlashMessage', @@ -319,10 +315,10 @@ class tx_sysaction_task implements tx_taskcenter_Task { ); $content .= $flashMessage->render() . '<br />'; } else { - // save user + // Save user $key = $this->saveNewBackendUser($record, $vars); - // success messsage + // Success messsage $flashMessage = t3lib_div::makeInstance ( 't3lib_FlashMessage', ($vars['key'] === 'NEW' ? $GLOBALS['LANG']->getLL('success-user-created') : $GLOBALS['LANG']->getLL('success-user-updated')), @@ -334,14 +330,14 @@ class tx_sysaction_task implements tx_taskcenter_Task { } - // load BE user to edit + // Load BE user to edit if (intval(t3lib_div::_GP('be_users_uid')) > 0) { $tmpUserId = intval(t3lib_div::_GP('be_users_uid')); - // check if the selected user is created by the current user + // Check if the selected user is created by the current user $rawRecord = $this->isCreatedByUser($tmpUserId, $record); if ($rawRecord) { - // delete user + // Delete user if (t3lib_div::_GP('delete') == 1) { $this->deleteUser($tmpUserId, $record['uid']); } @@ -408,9 +404,9 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Delete a BE user and redirect to the action by its id * - * @param int $userId: Id of the BE user - * @param int $actionId: Id of the action - * @return void + * @param integer $userId Id of the BE user + * @param integer $actionId Id of the action + * @return void */ protected function deleteUser($userId, $actionId) { $GLOBALS['TYPO3_DB']->exec_UPDATEquery( @@ -430,9 +426,9 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Check if a BE user is created by the current user * - * @param int $id: Id of the BE user - * @param array $action: sys_action record. - * @return mixed the record of the BE user if found, otherwise FALSE + * @param integer $id Id of the BE user + * @param array $action sys_action record. + * @return mixed The record of the BE user if found, otherwise FALSE */ protected function isCreatedByUser($id, $action) { $record = t3lib_BEfunc::getRecord( @@ -449,13 +445,12 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } - /** * Render all users who are created by the current BE user including a link to edit the record * - * @param array $action: sys_action record. - * @param int $selectedUser: Id of a selected user - * @return html list of users + * @param array $action sys_action record. + * @param integer $selectedUser Id of a selected user + * @return string html list of users */ protected function getCreatedUsers($action, $selectedUser) { $content = ''; @@ -470,12 +465,12 @@ class tx_sysaction_task implements tx_taskcenter_Task { 'username' ); - // render the user records + // Render the user records while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $icon = t3lib_iconworks::getSpriteIconForRecord('be_users', $row, array('title' => 'uid=' . $row['uid'])); $line = $icon . $this->action_linkUserName($row['username'], $row['realName'], $action['uid'], $row['uid']); - // selected user + // Selected user if ($row['uid'] == $selectedUser) { $line = '<strong>' . $line . '</strong>'; } @@ -484,7 +479,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } $GLOBALS['TYPO3_DB']->sql_free_result($res); - // if any records found + // If any records found if (count($userList)) { $content .= '<br />' . $this->taskObject->doc->section($GLOBALS['LANG']->getLL('action_t1_listOfUsers'), implode('<br />', $userList)); } @@ -492,26 +487,25 @@ class tx_sysaction_task implements tx_taskcenter_Task { return $content; } - /** * Create a link to edit a user * - * @param string $username: Username - * @param string $realName: Real name of the user - * @param int $sysActionUid: Id of the sys_action record - * @param int $userId: Id of the user - * @return html link + * @param string $username Username + * @param string $realName Real name of the user + * @param integer $sysActionUid Id of the sys_action record + * @param integer $userId Id of the user + * @return string html link */ protected function action_linkUserName($username, $realName, $sysActionUid, $userId) { if (!empty($realName)) { $username .= ' (' . $realName . ')'; } - // link to update the user record + // Link to update the user record $href = 'mod.php?M=user_task&SET[function]=sys_action.tx_sysaction_task&show=' . intval($sysActionUid) . '&be_users_uid=' . intval($userId); $link = '<a href="' . htmlspecialchars($href) . '">' . htmlspecialchars($username) . '</a>'; - // link to delete the user record + // Link to delete the user record $onClick = ' onClick="return confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL("lDelete_warning")).');"'; $link .= ' <a href="' . htmlspecialchars($href . '&delete=1') . '" ' . $onClick . '> @@ -523,16 +517,16 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Save/Update a BE user * - * @param array $record: Current action record - * @param array $vars: POST vars - * @return int Id of the new/updated user + * @param array $record Current action record + * @param array $vars POST vars + * @return integer Id of the new/updated user */ protected function saveNewBackendUser($record, $vars) { - // check if the db mount is a page the current user is allowed to.); + // Check if the db mount is a page the current user is allowed to.); $vars['db_mountpoints'] = $this->fixDbMount($vars['db_mountpoints']); - // check if the usergroup is allowed + // Check if the usergroup is allowed $vars['usergroup'] = $this->fixUserGroup($vars['usergroup'], $record); - // check if md5 is used as password encryption + // Check if md5 is used as password encryption if (strpos($GLOBALS['TCA']['be_users']['columns']['password']['config']['eval'], 'md5') !== FALSE) { $vars['password'] = md5($vars['password']); } @@ -557,10 +551,10 @@ class tx_sysaction_task implements tx_taskcenter_Task { $data['be_users'][$key]['createdByAction'] = $record['uid']; } } else { - // check ownership + // Check ownership $beRec = t3lib_BEfunc::getRecord('be_users', intval($key)); if (is_array($beRec) && $beRec['cruser_id'] == $GLOBALS['BE_USER']->user['uid']) { - $data=array(); + $data = array(); $data['be_users'][$key]['username'] = $this->fixUsername($vars['username'], $record['t1_userprefix']); if (trim($vars['password'])) { $data['be_users'][$key]['password'] = (trim($vars['password'])); @@ -576,7 +570,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } - // save/update user by using TCEmain + // Save/update user by using TCEmain if (is_array($data)) { $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->stripslashes_values = 0; @@ -589,7 +583,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { // Create $this->action_createDir($newUserId); } else { - // update + // Update $newUserId = intval($key); } unset($tce); @@ -600,9 +594,9 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Create the username based on the given username and the prefix * - * @param string $username: username - * @param string $prefix: prefix - * @return string Combined username + * @param string $username Username + * @param string $prefix Prefix + * @return string Combined username */ protected function fixUsername($username, $prefix) { return trim($prefix) . trim($username); @@ -611,17 +605,17 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Clean the to be applied usergroups from not allowed ones * - * @param array $appliedUsergroups: array of to be applied user groups - * @return array Cleaned array + * @param array $appliedUsergroups Array of to be applied user groups + * @return array Cleaned array */ protected function fixUserGroup($appliedUsergroups, $actionRecord) { if (is_array($appliedUsergroups)) { $cleanGroupList = array(); - // create an array from the allowed usergroups using the uid as key + // Create an array from the allowed usergroups using the uid as key $allowedUsergroups = array_flip(explode(',', $actionRecord['t1_allowed_groups'])); - // walk through the array and check every uid if it is undder the allowed ines + // Walk through the array and check every uid if it is undder the allowed ines foreach ($appliedUsergroups as $group) { if (isset($allowedUsergroups[$group])) { $cleanGroupList[] = $group; @@ -636,8 +630,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Clean the to be applied DB-Mounts from not allowed ones * - * @param string $appliedDbMounts: List of pages like pages_123,pages456 - * @return string Cleaned list + * @param string $appliedDbMounts List of pages like pages_123,pages456 + * @return string Cleaned list */ protected function fixDbMount($appliedDbMounts) { // Admins can see any page, no need to check there @@ -645,17 +639,17 @@ class tx_sysaction_task implements tx_taskcenter_Task { $cleanDbMountList = array(); $dbMounts = t3lib_div::trimExplode(',', $appliedDbMounts, 1); - // walk through every wanted DB-Mount and check if it allowed for the current user + // Walk through every wanted DB-Mount and check if it allowed for the current user foreach ($dbMounts as $dbMount) { $uid = intval(substr($dbMount, (strrpos($dbMount, '_') + 1))); $page = t3lib_BEfunc::getRecord('pages', $uid); - // check rootline and access rights + // Check rootline and access rights if ($this->checkRootline($uid) && $GLOBALS['BE_USER']->calcPerms($page)) { $cleanDbMountList[] = 'pages_' . $uid; } } - // build the clean list + // Build the clean list $appliedDbMounts = implode(',', $cleanDbMountList); } @@ -665,8 +659,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Check if a page is inside the rootline the current user can see * - * @param int $pageId: Id of the the page to be checked - * @return boolean Access to the page + * @param integer $pageId Id of the the page to be checked + * @return boolean Access to the page */ protected function checkRootline($pageId) { $access = FALSE; @@ -684,7 +678,6 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Add additional JavaScript to use the tceform select box * - * @param int $uid: Id of the user record * @return void */ protected function JScode() { @@ -699,7 +692,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Create a user directory if defined * - * @param int $uid: Id of the user record + * @param integer $uid Id of the user record * @return void */ protected function action_createDir($uid) { @@ -713,12 +706,12 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Get the path to the user home directory which is set in the localconf.php * - * @return string path + * @return string Path */ protected function action_getUserMainDir() { $path = $GLOBALS['TYPO3_CONF_VARS']['BE']['userHomePath']; - // if path is set and a valid directory + // If path is set and a valid directory if ($path && @is_dir($path) && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath'] && t3lib_div::isFirstPartOfStr($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['lockRootPath']) && @@ -733,18 +726,18 @@ class tx_sysaction_task implements tx_taskcenter_Task { * * @param array $record sys_action record * @param array $vars Selected be_user record - * @return string rendered user groups + * @return string Rendered user groups */ protected function getUsergroups($record, $vars) { $content = ''; - // do nothing if no groups are allowed + // Do nothing if no groups are allowed if (empty($record['t1_allowed_groups'])) { return $content; } $content .= '<option value=""></option>'; $grList = t3lib_div::trimExplode(',', $record['t1_allowed_groups'], 1); - foreach($grList as $group) { + foreach ($grList as $group) { $checkGroup = t3lib_BEfunc::getRecord('be_groups', $group); if (is_array($checkGroup)) { $selected = t3lib_div::inList($vars['usergroup'], $checkGroup['uid']) ? ' selected="selected" ' : ''; @@ -759,8 +752,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Action to create a new record * - * @param array $record: sys_action record - * @return redirect to form to create a record + * @param array $record sys_action record + * @return void Redirect to form to create a record */ protected function viewNewRecord($record) { $returnUrl = rawurlencode('mod.php?M=user_task'); @@ -771,8 +764,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Action to edit records * - * @param array $record: sys_action record - * @return string list of records + * @param array $record sys_action record + * @return string list of records */ protected function viewEditRecord($record) { $content = ''; @@ -789,7 +782,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { $record = t3lib_BEfunc::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]); $title = t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]); $description = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], 1); - if (isset($record['crdate'])) { // @todo: which information could be needfull + // @todo: which information could be needfull + if (isset($record['crdate'])) { $description .= ' - ' . t3lib_BEfunc::dateTimeAge($record['crdate']); } @@ -802,7 +796,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { ); } - // render the record list + // Render the record list $content .= $this->taskObject->renderListMenu($actionList); return $content; @@ -811,8 +805,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Action to view the result of a SQL query * - * @param array $record: sys_action record - * @return string result of the query + * @param array $record sys_action record + * @return string Result of the query */ protected function viewSqlQuery($record) { $content = ''; @@ -841,12 +835,12 @@ class tx_sysaction_task implements tx_taskcenter_Task { if (!$GLOBALS['TYPO3_DB']->sql_error()) { $fullsearch->formW = 48; - // additional configuration + // Additional configuration $GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = 1; $cP = $fullsearch->getQueryResultCode($type, $res, $sql_query['qC']['queryTable']); $actionContent = $cP['content']; - // if the result is rendered as csv or xml, show a download link + // If the result is rendered as csv or xml, show a download link if ($type === 'csv' || $type === 'xml') { $actionContent .= '<br /><br /><a href="' . t3lib_div::getIndpEnv('REQUEST_URI') . '&download_file=1"><strong>' . $GLOBALS['LANG']->getLL('action_download_file') . '</strong></a>'; } @@ -854,7 +848,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { $actionContent .= $GLOBALS['TYPO3_DB']->sql_error(); } } else { - // query is empty (not built) + // Query is empty (not built) $queryIsEmpty = TRUE; $flashMessage = t3lib_div::makeInstance ( 't3lib_FlashMessage', @@ -881,7 +875,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { $content .= $this->taskObject->doc->section($GLOBALS['LANG']->getLL('action_t2_result'), $actionContent, 0, 1); } else { - // query is not configured + // Query is not configured $flashMessage = t3lib_div::makeInstance ( 't3lib_FlashMessage', $GLOBALS['LANG']->getLL('action_notReady', TRUE), @@ -891,7 +885,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { $content .= '<br />' . $flashMessage->render(); } } else { - // required sysext lowlevel is not installed + // Required sysext lowlevel is not installed $flashMessage = t3lib_div::makeInstance ( 't3lib_FlashMessage', $GLOBALS['LANG']->getLL('action_lowlevelMissing', TRUE), @@ -906,8 +900,8 @@ class tx_sysaction_task implements tx_taskcenter_Task { /** * Action to create a list of records of a specific table and pid * - * @param array $record: sys_action record - * @return string list of records + * @param array $record sys_action record + * @return string list of records */ protected function viewRecordList($record) { $content = ''; @@ -1033,7 +1027,7 @@ class tx_sysaction_task implements tx_taskcenter_Task { } } } else { - // not enough rights to access the list view or the page + // Not enough rights to access the list view or the page $flashMessage = t3lib_div::makeInstance( 't3lib_FlashMessage', $GLOBALS['LANG']->getLL('action_error-access', TRUE), @@ -1046,4 +1040,4 @@ class tx_sysaction_task implements tx_taskcenter_Task { return $content; } } -?> +?> \ No newline at end of file diff --git a/typo3/sysext/sys_action/tca.php b/typo3/sysext/sys_action/tca.php index fd75ac225dd0b21ec840215460454c0446ab274f..a7b278a657c1743e923afe8adb7d7f63909cc34b 100755 --- a/typo3/sysext/sys_action/tca.php +++ b/typo3/sysext/sys_action/tca.php @@ -1,8 +1,6 @@ <?php -// ****************************************************************** -// sys_action -// ****************************************************************** + // sys_action $TCA['sys_action'] = array( 'ctrl' => $TCA['sys_action']['ctrl'], 'interface' => array( diff --git a/typo3/sysext/sys_action/toolbarmenu/class.tx_sysaction_toolbarmenu.php b/typo3/sysext/sys_action/toolbarmenu/class.tx_sysaction_toolbarmenu.php index 7e5373953d85df850e87aa297ced5787394cd6af..7db3ee1937c47ef069c93b825c6b9cef066a5648 100644 --- a/typo3/sysext/sys_action/toolbarmenu/class.tx_sysaction_toolbarmenu.php +++ b/typo3/sysext/sys_action/toolbarmenu/class.tx_sysaction_toolbarmenu.php @@ -25,30 +25,32 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - // load the language file + // Load the language file $GLOBALS['LANG']->includeLLFile('EXT:sys_action/locallang.xml'); /** * Adds action links to the backend's toolbar * - * @author Steffen Kamper <info@sk-typo3.de> + * @author Steffen Kamper <info@sk-typo3.de> * @package TYPO3 * @subpackage tx_sysaction */ class tx_sysactionToolbarMenu implements backend_toolbarItem { /** - * reference back to the backend object + * Reference back to the backend object * - * @var TYPO3backend + * @var TYPO3backend */ protected $backendReference; + + /** + * @var string + */ protected $EXTKEY = 'sys_action'; /** - * constructor - * - * @return void + * Constructor */ public function __construct(TYPO3backend &$backendReference = NULL) { $this->backendReference = $backendReference; @@ -57,21 +59,21 @@ class tx_sysactionToolbarMenu implements backend_toolbarItem { /** * sets the backend reference * - * @param TYPO3backend backend object reference - * @return void + * @param TYPO3backend $backendReference Backend object reference + * @return void */ public function setBackend(TYPO3backend &$backendReference) { $this->backendReference = $backendReference; } /** - * renders the toolbar menu + * Renders the toolbar menu * - * @return string the rendered backend menu - * @author Ingo Renner <ingo@typo3.org> + * @return string The rendered backend menu + * @author Ingo Renner <ingo@typo3.org> */ public function render() { - $actionMenu = array(); + $actionMenu = array(); $actionEntries = $this->getActionEntries(); if ($actionEntries) { @@ -95,16 +97,14 @@ class tx_sysactionToolbarMenu implements backend_toolbarItem { } else { return ''; } - - } /** - * gets the entries for the action menu + * Gets the entries for the action menu * - * @return array array of action menu entries - * @author Steffen Kamper <info@sk-typo3.de> - * @author Ingo Renner <ingo@typo3.org> + * @return array Array of action menu entries + * @author Steffen Kamper <info@sk-typo3.de> + * @author Ingo Renner <ingo@typo3.org> */ protected function getActionEntries() { $actions = array(); @@ -154,18 +154,18 @@ class tx_sysactionToolbarMenu implements backend_toolbarItem { } /** - * returns additional attributes for the list item in the toolbar + * Returns additional attributes for the list item in the toolbar * - * @return string list item HTML attibutes + * @return string List item HTML attibutes */ public function getAdditionalAttributes() { return ' id="tx-sys-action-menu"'; } /** - * adds the neccessary javascript ot the backend + * Adds the neccessary javascript ot the backend * - * @return void + * @return void */ protected function addJavascriptToBackend() { $this->backendReference->addJavascriptFile( @@ -174,9 +174,9 @@ class tx_sysactionToolbarMenu implements backend_toolbarItem { } /** - * adds the neccessary css ot the backend + * Adds the neccessary css ot the backend * - * @return void + * @return void */ protected function addCssToBackend() { $this->backendReference->addCssFile( @@ -189,10 +189,10 @@ class tx_sysactionToolbarMenu implements backend_toolbarItem { /** * Checks if user has access to the sys action menu * - * @return boolean TRUE if the user has access, FALSE otherwise + * @return boolean TRUE if the user has access, FALSE otherwise */ public function checkAccess() { - // taskcenter is enabled for everybody + // Taskcenter is enabled for everybody return TRUE; } } diff --git a/typo3/sysext/sys_action/toolbarmenu/registerToolbarItem.php b/typo3/sysext/sys_action/toolbarmenu/registerToolbarItem.php index 6e1aa8cf6a9623075d5945b9551136d0ce987280..c3eea56b014b09ee8e7fadbb34880cbf3fdd0e1b 100644 --- a/typo3/sysext/sys_action/toolbarmenu/registerToolbarItem.php +++ b/typo3/sysext/sys_action/toolbarmenu/registerToolbarItem.php @@ -1,14 +1,14 @@ <?php if (!defined('TYPO3_MODE')) { - die ('Access denied.'); + die('Access denied.'); } if (TYPO3_MODE == 'BE') { - // first include the class file + // First include the class file include_once(t3lib_extMgm::extPath('sys_action') . 'toolbarmenu/class.tx_sysaction_toolbarmenu.php'); - // now register the class as toolbar item + // Now register the class as toolbar item $GLOBALS['TYPO3backend']->addToolbarItem( 'sys_action', 'tx_sysactionToolbarMenu' diff --git a/typo3/sysext/t3editor/classes/class.tx_t3editor.php b/typo3/sysext/t3editor/classes/class.tx_t3editor.php index 9578fe77ddc9b14e371ab75d66f71fc92df99110..7293ce6441e5b04a4af1bec0a36c7aced2f5db30 100644 --- a/typo3/sysext/t3editor/classes/class.tx_t3editor.php +++ b/typo3/sysext/t3editor/classes/class.tx_t3editor.php @@ -25,11 +25,10 @@ * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ - /** * Provides a javascript-driven code editor with syntax highlighting for TS, HTML, CSS and more * - * @author Tobias Liebig <mail_typo3@etobi.de> + * @author Tobias Liebig <mail_typo3@etobi.de> */ $GLOBALS['LANG']->includeLLFile('EXT:t3editor/locallang.xml'); @@ -45,29 +44,35 @@ class tx_t3editor implements t3lib_Singleton { const MODE_SPARQL = 'sparql'; const MODE_MIXED = 'mixed'; + /** + * @var string + */ protected $mode = ''; + /** + * @var string + */ protected $ajaxSaveType = ''; /** - * counts the editors on the current page + * Counts the editors on the current page * - * @var int + * @var integer */ protected $editorCounter = 0; /** - * flag to enable the t3editor + * Flag to enable the t3editor * - * @var bool + * @var boolean */ protected $_isEnabled = TRUE; /** * sets the type of code to edit (::MODE_TYPOSCRIPT, ::MODE_JAVASCRIPT) * - * @param $mode string expects one of the predefined constants - * @return tx_t3editor + * @param $mode string Expects one of the predefined constants + * @return tx_t3editor */ public function setMode($mode) { $this->mode = $mode; @@ -75,20 +80,33 @@ class tx_t3editor implements t3lib_Singleton { } /** + *Set the AJAX save type * - * @param $ajaxSaveType - * @return tx_t3editor + * @param string $ajaxSaveType + * @return tx_t3editor */ public function setAjaxSaveType($ajaxSaveType) { $this->ajaxSaveType = $ajaxSaveType; return $this; } + /** + * Set mode by file + * + * @param string $file + * @return string + */ public function setModeByFile($file) { $fileInfo = t3lib_div::split_fileref($file); return $this->setModeByType($fileInfo['fileext']); } + /** + * Set mode by type + * + * @param string $type + * @return void + */ public function setModeByType($type) { switch ($type) { case 'html': @@ -123,12 +141,17 @@ class tx_t3editor implements t3lib_Singleton { $this->setMode($mode); } + /** + * Get mode + * + * @return string + */ public function getMode() { return $this->mode; } /** - * @return boolean TRUE if the t3editor is enabled + * @return boolean TRUE if the t3editor is enabled */ public function isEnabled() { return $this->_isEnabled; @@ -136,19 +159,17 @@ class tx_t3editor implements t3lib_Singleton { /** * Creates a new instance of the class - * - * @return void */ public function __construct() { - // disable pmktextarea to avoid conflicts (thanks Peter Klein for this suggestion) + // Disable pmktextarea to avoid conflicts (thanks Peter Klein for this suggestion) $GLOBALS["BE_USER"]->uc['disablePMKTextarea'] = 1; } /** * Retrieves JavaScript code (header part) for editor * - * @param template $doc - * @return string JavaScript code + * @param template $doc + * @return string JavaScript code */ public function getJavascriptCode($doc) { $content = ''; @@ -158,20 +179,20 @@ class tx_t3editor implements t3lib_Singleton { $path_t3e = t3lib_extmgm::extRelPath('t3editor'); $path_codemirror = 'contrib/codemirror/js/'; - // include needed javascript-frameworks + // Include needed javascript-frameworks $pageRenderer = $doc->getPageRenderer(); /** @var $pageRenderer t3lib_PageRenderer */ $pageRenderer->loadPrototype(); $pageRenderer->loadScriptaculous(); - // include editor-css + // Include editor-css $content .= '<link href="' . t3lib_div::createVersionNumberedFilename($GLOBALS['BACK_PATH'] . t3lib_extmgm::extRelPath('t3editor') . 'res/css/t3editor.css') . '" type="text/css" rel="stylesheet" />'; - // include editor-js-lib + // Include editor-js-lib $doc->loadJavascriptLib($path_codemirror . 'codemirror.js'); $doc->loadJavascriptLib($path_t3e . 'res/jslib/t3editor.js'); @@ -190,6 +211,11 @@ class tx_t3editor implements t3lib_Singleton { return $content; } + /** + * Get mode specific JavaScript code + * + * @return string + */ public function getModeSpecificJavascriptCode() { if (empty($this->mode)) { return ''; @@ -213,9 +239,9 @@ class tx_t3editor implements t3lib_Singleton { } /** - * get the template code, prepared for javascript (no line breaks, quoted in single quotes) + * Get the template code, prepared for javascript (no line breaks, quoted in single quotes) * - * @return string the template code, prepared to use in javascript + * @return string The template code, prepared to use in javascript */ protected function getPreparedTemplate() { $T3Editor_template = t3lib_div::getUrl( @@ -234,10 +260,10 @@ class tx_t3editor implements t3lib_Singleton { } /** - * determine the correct parser js file for given mode + * Determine the correct parser js file for given mode * - * @param string $mode - * @return string parser file name + * @param string $mode + * @return string Parser file name */ protected function getParserfileByMode($mode) { switch ($mode) { @@ -283,10 +309,10 @@ class tx_t3editor implements t3lib_Singleton { } /** - * determine the correct css file for given mode + * Determine the correct css file for given mode * - * @param string $mode - * @return string css file name + * @param string $mode + * @return string css file name */ protected function getStylesheetByMode($mode) { switch ($mode) { @@ -337,7 +363,7 @@ class tx_t3editor implements t3lib_Singleton { * Gets the labels to be used in JavaScript in the Ext JS interface. * TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class * - * @return array The labels to be used in JavaScript + * @return array The labels to be used in JavaScript */ protected function getJavaScriptLabels() { $coreLabels = array(); @@ -349,10 +375,10 @@ class tx_t3editor implements t3lib_Singleton { * Gets labels to be used in JavaScript fetched from the current locallang file. * TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class * - * @param string $selectionPrefix: Prefix to select the correct labels (default: 'js.') - * @param string $stripFromSelectionName: Sub-prefix to be removed from label names in the result (default: '') - * @return array Lables to be used in JavaScript of the current locallang file - * @todo Check, whether this method can be moved in a generic way to $GLOBALS['LANG'] + * @param string $selectionPrefix Prefix to select the correct labels (default: 'js.') + * @param string $stripFromSelectionName Sub-prefix to be removed from label names in the result (default: '') + * @return array Lables to be used in JavaScript of the current locallang file + * @todo Check, whether this method can be moved in a generic way to $GLOBALS['LANG'] */ protected function getJavaScriptLabelsFromLocallang($selectionPrefix = 'js.', $stripFromSelectionName = '') { $extraction = array(); @@ -375,14 +401,15 @@ class tx_t3editor implements t3lib_Singleton { /** * Generates HTML with code editor * - * @param string $name Name attribute of HTML tag - * @param string $class Class attribute of HTML tag - * @param string $content Content of the editor - * @param string $additionalParams Any additional editor parameters - * @param string $alt Alt attribute - * @return string Generated HTML code for editor + * @param string $name Name attribute of HTML tag + * @param string $class Class attribute of HTML tag + * @param string $content Content of the editor + * @param string $additionalParams Any additional editor parameters + * @param string $alt Alt attribute + * @param array $hiddenfields + * @return string Generated HTML code for editor */ - public function getCodeEditor($name, $class='', $content='', $additionalParams='', $alt='', array $hiddenfields = array()) { + public function getCodeEditor($name, $class = '', $content = '', $additionalParams = '', $alt='', array $hiddenfields = array()) { $code = ''; if ($this->isEnabled()) { @@ -428,7 +455,7 @@ class tx_t3editor implements t3lib_Singleton { } } else { - // fallback + // Fallback if (!empty($class)) { $class = 'class="' . $class . '" '; } @@ -441,8 +468,6 @@ class tx_t3editor implements t3lib_Singleton { return $code; } - - /** * Save the content from t3editor retrieved via Ajax * @@ -453,11 +478,11 @@ class tx_t3editor implements t3lib_Singleton { * } * }); * - * @param array params Parameters (not used yet) - * @param TYPO3AJAX ajaxObj AjaxObject to handle response + * @param array params Parameters (not used yet) + * @param TYPO3AJAX ajaxObj AjaxObject to handle response */ public function ajaxSaveCode($params, $ajaxObj) { - // cancel if its not an Ajax request + // cancel if its not an Ajax request if((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) { $ajaxObj->setContentFormat('json'); $codeType = t3lib_div::_GP('t3editor_savetype'); @@ -482,10 +507,10 @@ class tx_t3editor implements t3lib_Singleton { * Gets plugins that are defined at $TYPO3_CONF_VARS['EXTCONF']['t3editor']['plugins'] * (called by typo3/ajax.php) * - * @param array $params: additional parameters (not used here) - * @param TYPO3AJAX &$ajaxObj: the TYPO3AJAX object of this request - * @return void - * @author Oliver Hader <oliver@typo3.org> + * @param array $params additional parameters (not used here) + * @param TYPO3AJAX &$ajaxObj: the TYPO3AJAX object of this request + * @return void + * @author Oliver Hader <oliver@typo3.org> */ public function getPlugins($params, TYPO3AJAX &$ajaxObj) { $result = array(); diff --git a/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_fileedit.php b/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_fileedit.php index 79a3bf200ad314b81f75eb491bae68bf92674a3d..4d5192362642022b02d360c4d4c76f96901e98ed 100644 --- a/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_fileedit.php +++ b/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_fileedit.php @@ -127,7 +127,6 @@ class tx_t3editor_hooks_fileedit { $outCode, $parameters['pageContent'] ); - } /** diff --git a/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php b/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php index e55b29de2a530f8addf90e3edf7c916f305f0893..27533d758ca13566a269f50d1b9701bc97ed9373 100644 --- a/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php +++ b/typo3/sysext/t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php @@ -57,23 +57,24 @@ class tx_t3editor_hooks_tstemplateinfo { * * @param array $parameters * @param template $pObj + * @return void */ public function preStartPageHook($parameters, $pObj) { - // enable editor in Template-Modul + // Enable editor in Template-Modul if (t3lib_div::_GET('M') === 'web_ts') { $t3editor = $this->getT3editor(); - // insert javascript code in document header + // Insert javascript code in document header $pObj->JScode .= $t3editor->getJavascriptCode($pObj); } } - /** * Hook-function: * called in typo3/sysext/tstemplate_info/class.tx_tstemplateinfo.php * * @param array $parameters * @param tx_tstemplateinfo $pObj + * @return void */ public function postOutputProcessingHook($parameters, $pObj) { $t3editor = $this->getT3editor(); @@ -127,23 +128,24 @@ class tx_t3editor_hooks_tstemplateinfo { return FALSE; } - // if given use the requested template_uid - // if not, use the first template-record on the page (in this case there should only be one record!) + // If given use the requested template_uid + // if not, use the first template-record on the page (in this case there should only be one record!) $set = t3lib_div::_GP('SET'); $template_uid = $set['templatesOnPage'] ? $set['templatesOnPage'] : 0; - - $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here! - $tmpl->tt_track = 0; // Do not log time-performance information + // Defined global here! + $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); + // Do not log time-performance information + $tmpl->tt_track = 0; $tmpl->init(); - // Get the row of the first VISIBLE template of the page. whereclause like the frontend. + // Get the row of the first VISIBLE template of the page. whereclause like the frontend. $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); $existTemplate = (is_array($tplRow) ? TRUE : FALSE); if ($existTemplate) { $saveId = ($tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']); - // Update template ? + // Update template ? $POST = t3lib_div::_POST(); if ($POST['submit']) { @@ -167,7 +169,7 @@ class tx_t3editor_hooks_tstemplateinfo { } if (count($recData)) { - // process template row before saving + // process template row before saving require_once t3lib_extMgm::extPath('tstemplate_info').'class.tx_tstemplateinfo.php'; $tstemplateinfo = t3lib_div::makeInstance('tx_tstemplateinfo'); /* @var $tstemplateinfo tx_tstemplateinfo */ // load the MOD_SETTINGS in order to check if the includeTypoScriptFileContent is set @@ -178,18 +180,18 @@ class tx_t3editor_hooks_tstemplateinfo { ); $recData['sys_template'][$saveId] = $tstemplateinfo->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]); - // Create new tce-object + // Create new tce-object $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; - // Initialize + // Initialize $tce->start($recData, array()); - // Saved the stuff + // Saved the stuff $tce->process_datamap(); - // Clear the cache (note: currently only admin-users can clear the - // cache in tce_main.php) + // Clear the cache (note: currently only admin-users can clear the + // cache in tce_main.php) $tce->clear_cacheCmd('all'); $savingsuccess = TRUE; diff --git a/typo3/sysext/t3editor/classes/class.tx_t3editor_tceforms_wizard.php b/typo3/sysext/t3editor/classes/class.tx_t3editor_tceforms_wizard.php index 7fc80b5ad746406ae1d3457a80a5ae517f2568a6..a19dc4756cce5770798aa1fc85be0770e733eaa6 100644 --- a/typo3/sysext/t3editor/classes/class.tx_t3editor_tceforms_wizard.php +++ b/typo3/sysext/t3editor/classes/class.tx_t3editor_tceforms_wizard.php @@ -3,6 +3,13 @@ require_once(t3lib_extMgm::extPath('t3editor', 'classes/class.tx_t3editor.php')) class tx_t3editor_tceforms_wizard { + /** + * Main function + * + * @param array $parameters + * @param object $pObj + * @return string|NULL + */ public function main($parameters, $pObj) { $t3editor = t3lib_div::makeInstance('tx_t3editor'); if (!$t3editor->isEnabled()) { diff --git a/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_codecompletion.php b/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_codecompletion.php index d295c917c303ecfe22f13e9bb94ebd7f1b6acc3c..212db31573a0c30ed26bbe51c2d50242468a362b 100644 --- a/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_codecompletion.php +++ b/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_codecompletion.php @@ -36,10 +36,10 @@ class tx_t3editor_codecompletion { * General processor for AJAX requests. * (called by typo3/ajax.php) * - * @param array $params: additional parameters (not used here) - * @param TYPO3AJAX &$ajaxObj: the TYPO3AJAX object of this request - * @return void - * @author Oliver Hader <oliver@typo3.org> + * @param array $params Additional parameters (not used here) + * @param TYPO3AJAX &$ajaxObj The TYPO3AJAX object of this request + * @return void + * @author Oliver Hader <oliver@typo3.org> */ public function processAjaxRequest($params, TYPO3AJAX &$ajaxObj) { $this->ajaxObj = $ajaxObj; @@ -48,7 +48,7 @@ class tx_t3editor_codecompletion { $ajaxMethod = $ajaxIdParts[1]; $response = array(); - // Process the AJAX requests: + // Process the AJAX requests: if ($ajaxMethod == 'loadTemplates') { $ajaxObj->setContent($this->loadTemplates( intval(t3lib_div::_GP('pageId'))) @@ -61,10 +61,10 @@ class tx_t3editor_codecompletion { * Loads all templates up to a given page id (walking the rootline) and * cleans parts that are not required for the t3editor codecompletion. * - * @param integer $pageId: id of the page - * @param integer $templateId: currently unused (default: 0) - * @return array Cleaned array of TypoScript information - * @author Oliver Hader <oliver@typo3.org> + * @param integer $pageId ID of the page + * @param integer $templateId Currently unused (default: 0) + * @return array Cleaned array of TypoScript information + * @author Oliver Hader <oliver@typo3.org> */ protected function loadTemplates($pageId, $templateId = 0) { $templates = array(); @@ -89,10 +89,10 @@ class tx_t3editor_codecompletion { /** * Gets merged templates by walking the rootline to a given page id. * - * @todo oliver@typo3.org: Refactor this method and comment what's going on there - * @param integer $pageId - * @param integer $templateId - * @return array Setup part of merged template records + * @todo oliver@typo3.org: Refactor this method and comment what's going on there + * @param integer $pageId + * @param integer $templateId + * @return array Setup part of merged template records */ protected function getMergedTemplates($pageId, $templateId = 0) { $result = array(); @@ -108,15 +108,15 @@ class tx_t3editor_codecompletion { // This generates the constants/config + hierarchy info for the template. $tsParser->runThroughTemplates($rootLine); - // ts-setup & ts-constants of the currently edited template should not be included - // therefor we have to delete the last template from the stack + // ts-setup & ts-constants of the currently edited template should not be included + // therefor we have to delete the last template from the stack array_pop($tsParser->config); array_pop($tsParser->constants); $tsParser->linkObjects = TRUE; $tsParser->ext_regLinenumbers = FALSE; - $tsParser->bType=$bType; - $tsParser->resourceCheck=1; + $tsParser->bType = $bType; + $tsParser->resourceCheck = 1; $tsParser->uplPath = PATH_site . $tsParser->uplPath; $tsParser->removeFromGetFilePath = PATH_site; $tsParser->generateConfig(); @@ -129,16 +129,17 @@ class tx_t3editor_codecompletion { /** * Walks through a tree of TypoScript configuration an cleans it up. * - * @TODO oliver@typo3.org: Define and comment why this is necessary and exactly happens below - * @param array $treeBranch: TypoScript configuration or sub branch of it - * @return array Cleaned TypoScript branch + * @TODO oliver@typo3.org: Define and comment why this is necessary and exactly happens below + * @param array $treeBranch TypoScript configuration or sub branch of it + * @return array Cleaned TypoScript branch */ private function treeWalkCleanup(array $treeBranch) { $cleanedTreeBranch = array(); foreach ($treeBranch as $key => $value) { $dotCount = substr_count($key, '.'); - if ($dotCount == 0){ //type definition or value-assignment + //type definition or value-assignment + if ($dotCount == 0) { if ($value != '') { if (strlen($value) > 20) { $value = substr($value, 0, 20); diff --git a/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_tsrefloader.php b/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_tsrefloader.php index 7fd65868c1cc71ac7c6558d1beb7a7c60cf534c7..c19fe7ec007b6681a65099b85a172606ef251970 100644 --- a/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_tsrefloader.php +++ b/typo3/sysext/t3editor/classes/ts_codecompletion/class.tx_t3editor_tsrefloader.php @@ -28,7 +28,6 @@ /** * Loads TSref information from a XML file an responds to an AJAX call. * - * @TODO Refactor and correct phpDoc comments * @package TYPO3 * @author Stephan Petzl <spetzl@gmx.at> * @author Christian Kartnig <office@hahnepeter.de> @@ -37,32 +36,36 @@ $GLOBALS['LANG']->includeLLFile('EXT:t3editor/locallang.xml'); class tx_t3editor_TSrefLoader { - /** @var DOMDocument */ + /** + * @var DOMDocument + */ protected $xmlDoc; - /** @var TYPO3AJAX */ + /** + * @var TYPO3AJAX + */ protected $ajaxObj; /** * General processor for AJAX requests. * (called by typo3/ajax.php) * - * @param array $params: additional parameters (not used here) - * @param TYPO3AJAX &$ajaxObj: the TYPO3AJAX object of this request - * @return void - * @author Oliver Hader <oliver@typo3.org> + * @param array $params Additional parameters (not used here) + * @param TYPO3AJAX &$ajaxObj The TYPO3AJAX object of this request + * @return void + * @author Oliver Hader <oliver@typo3.org> */ public function processAjaxRequest($params, TYPO3AJAX &$ajaxObj) { $this->ajaxObj = $ajaxObj; - // Load the TSref XML information: + // Load the TSref XML information: $this->loadFile(t3lib_extMgm::extPath('t3editor') . 'res/tsref/tsref.xml'); $ajaxIdParts = explode('::', $ajaxObj->getAjaxID(), 2); $ajaxMethod = $ajaxIdParts[1]; $response = array(); - // Process the AJAX requests: + // Process the AJAX requests: if ($ajaxMethod == 'getTypes') { $ajaxObj->setContent($this->getTypes()); $ajaxObj->setContentFormat('jsonbody'); @@ -79,28 +82,28 @@ class tx_t3editor_TSrefLoader { } /** - * Enter description here... + * Load XML file * - * @param string $filepath - * @return void + * @param string $filepath + * @return void */ protected function loadFile($filepath) { $this->xmlDoc = new DOMDocument('1.0', 'utf-8'); $this->xmlDoc->load($filepath); - // @TODO: oliver@typo3.org: I guess this is not required here + // @TODO: oliver@typo3.org: I guess this is not required here $this->xmlDoc->saveXML(); } /** - * Enter description here... + * Get types from XML * - * @return array + * @return array */ protected function getTypes() { $types = $this->xmlDoc->getElementsByTagName('type'); $typeArr = array(); - foreach($types as $type){ + foreach ($types as $type){ $typeId = $type->getAttribute('id'); $typeName = $type->getAttribute('name'); if(!$typeName) { @@ -108,7 +111,7 @@ class tx_t3editor_TSrefLoader { } $properties = $type->getElementsByTagName('property'); $propArr = array(); - foreach($properties as $property) { + foreach ($properties as $property) { $p = array(); $p['name'] = $property->getAttribute('name'); $p['type'] = $property->getAttribute('type'); @@ -125,11 +128,11 @@ class tx_t3editor_TSrefLoader { } /** - * Enter description here... + * Get description * - * @param string $typeId - * @param string $parameterName - * @return string + * @param string $typeId + * @param string $parameterName + * @return string */ protected function getDescription($typeId, $parameterName = '') { if (!$typeId) { @@ -137,9 +140,10 @@ class tx_t3editor_TSrefLoader { return ''; } - // getElementById does only work with schema + // getElementById does only work with schema $type = $this->getType($typeId); - if ($parameterName) { //retrieve propertyDescription + // Retrieve propertyDescription + if ($parameterName) { $properties = $type->getElementsByTagName('property'); foreach ($properties as $propery) { $propName = $propery->getAttribute('name'); @@ -159,10 +163,10 @@ class tx_t3editor_TSrefLoader { } /** - * Enter description here... + * Get type * - * @param string $typeId - * @return DOMNode + * @param string $typeId + * @return DOMNode */ protected function getType($typeId) { $types = $this->xmlDoc->getElementsByTagName('type'); diff --git a/typo3/sysext/t3editor/ext_localconf.php b/typo3/sysext/t3editor/ext_localconf.php index 3b7c3da12718be018f01859a7597d20aa3f86707..ad0901d28781c5b82a68ef2596859542b9404d86 100644 --- a/typo3/sysext/t3editor/ext_localconf.php +++ b/typo3/sysext/t3editor/ext_localconf.php @@ -1,8 +1,10 @@ <?php -if (!defined ('TYPO3_MODE')) die ('Access denied.'); +if (!defined('TYPO3_MODE')) { + die('Access denied.'); +} if (TYPO3_MODE == 'BE') { - // register hooks for tstemplate module + // Register hooks for tstemplate module $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/template.php']['preStartPageHook'][] = 'EXT:t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php:&tx_t3editor_hooks_tstemplateinfo->preStartPageHook'; $TYPO3_CONF_VARS['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'][] = @@ -12,14 +14,13 @@ if (TYPO3_MODE == 'BE') { 'EXT:t3editor/classes/class.tx_t3editor_hooks_tstemplateinfo.php:&tx_t3editor_hooks_tstemplateinfo->save'; $TYPO3_CONF_VARS['SC_OPTIONS']['ext/t3editor/classes/class.tx_t3editor.php']['ajaxSaveCode']['file_edit'] = 'EXT:t3editor/classes/class.tx_t3editor_hooks_fileedit.php:&tx_t3editor_hooks_fileedit->save'; - + $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/template.php']['preStartPageHook'][] = 'EXT:t3editor/classes/class.tx_t3editor_hooks_fileedit.php:&tx_t3editor_hooks_fileedit->preStartPageHook'; $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/file_edit.php']['preOutputProcessingHook'][] = 'EXT:t3editor/classes/class.tx_t3editor_hooks_fileedit.php:&tx_t3editor_hooks_fileedit->preOutputProcessingHook'; $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/file_edit.php']['postOutputProcessingHook'][] = 'EXT:t3editor/classes/class.tx_t3editor_hooks_fileedit.php:&tx_t3editor_hooks_fileedit->postOutputProcessingHook'; - } ?> \ No newline at end of file