Thread: [Easymod-cvs] easymod/install/em_files/includes/em em_actions.php,1.4,1.5 em_parser_text.php,1.6,1.7
Status: Beta
Brought to you by:
wgeric
[Easymod-cvs] easymod/install/em_files/includes/em em_actions.php,1.4,1.5 em_parser_text.php,1.6,1.7
From: Eric F. <wg...@us...> - 2006-01-15 05:30:11
|
Update of /cvsroot/easymod/easymod/install/em_files/includes/em In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24170/em_files/includes/em Modified Files: em_actions.php em_parser_text.php Log Message: - Fixed bug 1403875, Actions can now have as unlimited whitespace before and after the code. Whitespace is trimmed off of FINDs - Fixed a bug that I added in my last commit. I think I hit a wrong key combination. Index: em_actions.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_actions.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** em_actions.php 15 Jan 2006 04:56:32 -0000 1.4 --- em_actions.php 15 Jan 2006 05:29:59 -0000 1.5 *************** *** 92,96 **** $this->filename = $filename; $this->contents = open_file($this->filename); ! $this->contents = preg_split("/(\r|\n|)/", $this->contents, -1, PREG_SPLIT_DELIM_CAPTURE); $this->size_contents = count($this->contents); $this->start = $this->end = 0; --- 92,96 ---- $this->filename = $filename; $this->contents = open_file($this->filename); ! $this->contents = preg_split("/(\r|\n|\r\n)/", $this->contents, -1, PREG_SPLIT_DELIM_CAPTURE); $this->size_contents = count($this->contents); $this->start = $this->end = 0; *************** *** 201,205 **** foreach ($lines as $line) { ! // linux uses "\n", apples use "\r", and windows uses "" to represent new lines. of these, only "" // will be interpreted as a new line character on all systems. phpBB uses "\n" for line endings (linux) so // EasyMOD will also use that. --- 201,205 ---- foreach ($lines as $line) { ! // linux uses "\n", apples use "\r", and windows uses "\r\n" to represent new lines. of these, only "" // will be interpreted as a new line character on all systems. phpBB uses "\n" for line endings (linux) so // EasyMOD will also use that. Index: em_parser_text.php =================================================================== RCS file: /cvsroot/easymod/easymod/install/em_files/includes/em/em_parser_text.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** em_parser_text.php 15 Jan 2006 04:56:32 -0000 1.6 --- em_parser_text.php 15 Jan 2006 05:29:59 -0000 1.7 *************** *** 139,143 **** // Split file contents into an array of lines (dealing with LF, CRLF and CR). ! $this->mod_contents = preg_split("/\r?\n|\r/", $this->mod_contents); $this->mod_lines = count($this->mod_contents); $this->mod_loaded = true; --- 139,143 ---- // Split file contents into an array of lines (dealing with LF, CRLF and CR). ! $this->mod_contents = preg_split("/\r?\n|\r/", trim($this->mod_contents)); $this->mod_lines = count($this->mod_contents); $this->mod_loaded = true; *************** *** 247,252 **** $line = trim($this->mod_contents[$i]); ! // Empty lines and lines starting with 3 consecutive hashes (ignoring leading whitespaces) are ignored. ! if( !empty($line) && !preg_match('@^#{3}@', $line) ) { // How do we know whether it's a MOD Action command? --- 247,252 ---- $line = trim($this->mod_contents[$i]); ! // lines starting with 3 consecutive hashes (ignoring leading whitespaces) are ignored. ! if( !preg_match('@^#{3}@', $line) ) { // How do we know whether it's a MOD Action command? *************** *** 259,271 **** { $current_action = $match[1]; - /*should we say they are invalid here or put them in the unproccess actions section? - if( !isset($this->valid_actions[$current_action]) ) - { - // @TODO: An error triggered here would say something like "Invalid MOD action" - return false; - }*/ $current_line = $i + 1; } ! elseif( $line{0} != '#' ) { if( !isset($current_action) ) --- 259,265 ---- { $current_action = $match[1]; $current_line = $i + 1; } ! elseif( !empty($current_action) && $line{0} != '#' ) { if( !isset($current_action) ) *************** *** 295,298 **** --- 289,293 ---- } } + if( !isset($current_action) || $this->valid_actions[$current_action] != 'save-close-files' ) { *************** *** 310,314 **** $edit_number = -1; $inline_edit_number = -1; ! vd($mod_actions); $mod_actions_count = count($mod_actions); for( $i = 0; $i < $mod_actions_count; $i++ ) --- 305,309 ---- $edit_number = -1; $inline_edit_number = -1; ! $mod_actions_count = count($mod_actions); for( $i = 0; $i < $mod_actions_count; $i++ ) *************** *** 363,374 **** return false; } $inline_edit_number = -1; $edit_number++; ! $find = array(); ! for( $j = 0; $j < count($mod_actions[$i]['lines']); $j++ ) ! { ! $find[] = $mod_actions[$i]['lines'][$j]; ! } ! $this->actions['open'][$current_file]['edit'][$edit_number]['find'] = implode("\n", $find); unset($j, $find); } --- 358,365 ---- return false; } + $inline_edit_number = -1; $edit_number++; ! $this->actions['open'][$current_file]['edit'][$edit_number]['find'] = trim(implode("\n", $mod_actions[$i]['lines'])); unset($j, $find); } *************** *** 380,392 **** return false; } ! $code = array(); ! for( $j = 0; $j < count($mod_actions[$i]['lines']); $j++ ) ! { ! $code[] = $mod_actions[$i]['lines'][$j]; ! } $this->actions['open'][$current_file]['edit'][$edit_number]['action'][] = array( 'line' => $current_mod_line, 'type' => $current_action, ! 'code' => implode("\n", $code) ); unset($j, $code); --- 371,379 ---- return false; } ! $this->actions['open'][$current_file]['edit'][$edit_number]['action'][] = array( 'line' => $current_mod_line, 'type' => $current_action, ! 'code' => implode("\n", $mod_actions[$i]['lines']) ); unset($j, $code); *************** *** 463,472 **** else { ! $code = array(); ! for( $j = 0; $j < count($mod_actions[$i]['lines']); $j++ ) ! { ! $code[] = trim($mod_actions[$i]['lines'][$j]); ! } ! $this->actions[$current_action][] = implode("\n", $code); unset($j, $code); } --- 450,454 ---- else { ! $this->actions[$current_action][] = implode("\n", $mod_actions[$i]['lines']); unset($j, $code); } |