Skip to content

Commit

Permalink
Renamed files
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszkrzaczkowski committed Mar 21, 2018
1 parent 033c6e9 commit e46f857
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ not enabled by default. You can enable it by adding this code before you
include csrf-magic.php.

function csrf_startup() {
csrf_conf('rewrite-js', '/web/path/to/csrf-magic.js');
csrf_conf('rewrite-js', '/web/path/to/Csrf.js');
}
// include_once '/path/to/csrf-magic.php';

(Be sure to place csrf-magic.js somewhere web accessible).
(Be sure to place Csrf.js somewhere web accessible).

The default method CSRF Magic uses to rewrite AJAX requests will
only work for browsers with support for XmlHttpRequest.prototype (this excludes
all versions of Internet Explorer). See this page for more information:
http://stackoverflow.com/questions/664315/internet-explorer-8-prototypes-and-xmlhttprequest

However, csrf-magic.js will
However, Csrf.js will
automatically detect and play nice with the following JavaScript frameworks:

* jQuery
Expand All @@ -82,7 +82,7 @@ been updated, and some JavaScript libraries have placed their copies of XHR
in local variables in closures, which makes it difficult for us to monkey-patch
it in automatically.)

To rewrite your own JavaScript library to use csrf-magic.js, you should modify
To rewrite your own JavaScript library to use Csrf.js, you should modify
your function that generates XMLHttpRequest to have this at the end:

return new CsrfMagic(xhrObject);
Expand Down Expand Up @@ -131,7 +131,7 @@ For example, this is a recommended configuration:

// This enables JavaScript rewriting and will ensure your AJAX calls
// don't stop working.
csrf_conf('rewrite-js', '/csrf-magic.js');
csrf_conf('rewrite-js', '/Csrf.js');

// This makes csrf-magic call my_csrf_callback() before exiting when
// there is a bad csrf token. This lets me customize the error page.
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions src/csrf-magic.php → src/Csrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* This library is PHP4 and PHP5 compatible.
*/
class CSRF
class Csrf
{
/**
* By default, when you include this file csrf-magic will automatically check
Expand All @@ -40,15 +40,15 @@ class CSRF
* $fatal === true (see csrf_check). This will usually output an error message
* about the failure.
*/
public static $callback = 'CsrfMagic\CSRF::callback'; //'csrf_callback'
public static $callback = 'CsrfMagic\Csrf::callback'; //'csrf_callback'

/**
* Whether or not to include our JavaScript library which also rewrites
* AJAX requests on this domain. Set this to the web path. This setting only works
* with supported JavaScript libraries in Internet Explorer; see README.txt for
* a list of supported libraries.
*/
public static $rewriteJs = 'csrf-magic/csrf-magic.js';
public static $rewriteJs = 'vendor/yetiforce/csrf-magic/src/Csrf.js';

/**
* A secret key used when hashing items. Please generate a random string and
Expand Down Expand Up @@ -134,7 +134,7 @@ class CSRF
/**
* Don't edit this!
*/
public static $version = '1.0.5';
public static $version = '1.0.6';

/**
* Even though the user told us to rewrite, we should do a quick heuristic
Expand Down Expand Up @@ -497,5 +497,3 @@ public static function init()
}
}
}

CSRF::init();

0 comments on commit e46f857

Please sign in to comment.