Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3a17009c
authored
2010-08-17 21:49:17 +0000
by
Chris Boden
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Updated to work when placed symbolically
1 parent
b0ef0a50
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
tz-tools.php
tz-tools.php
View file @
3a17009
...
...
@@ -15,12 +15,20 @@ use Exception;
spl_autoload_register
(
__NAMESPACE__
.
'\autoloader'
);
require_once
(
__DIR__
.
DIRECTORY_SEPARATOR
.
'wp_functions.php'
);
// Code to prevent PHP from parsing Symlinks
if
(
defined
(
__NAMESPACE__
.
'\DIR'
))
{
define
(
__NAMESPACE__
.
'\OVERRIDE'
,
1
);
}
else
{
define
(
__NAMESPACE__
.
'\DIR'
,
__DIR__
);
}
define
(
__NAMESPACE__
.
'\FILE'
,
DIR
.
DIRECTORY_SEPARATOR
.
basename
(
__FILE__
));
require_once
(
DIR
.
DIRECTORY_SEPARATOR
.
'wp_functions.php'
);
_register_script
(
'addEvent'
,
url
(
'scripts/addEvent.js'
,
__FILE__
));
_register_script
(
'xmlhttpHandler'
,
url
(
'scripts/xmlhttpHandler.js'
,
__FILE__
));
_register_script
(
'fireEvent'
,
url
(
'scripts/fireEvent.js'
,
__FILE__
));
_register_script
(
'Cookie'
,
url
(
'scripts/Cookie/Cookie.js'
,
__FILE__
));
_register_script
(
'addEvent'
,
url
(
'scripts/addEvent.js'
,
FILE
));
_register_script
(
'xmlhttpHandler'
,
url
(
'scripts/xmlhttpHandler.js'
,
FILE
));
_register_script
(
'fireEvent'
,
url
(
'scripts/fireEvent.js'
,
FILE
));
_register_script
(
'Cookie'
,
url
(
'scripts/Cookie/Cookie.js'
,
FILE
));
import
(
'ShortCodes'
);
if
(
defined
(
'Tz\DEBUG'
)
&&
Tz\DEBUG
===
true
)
{
...
...
@@ -28,7 +36,7 @@ use Exception;
}
function
import
(
$com
)
{
$dir
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'com'
.
DIRECTORY_SEPARATOR
.
$com
.
DIRECTORY_SEPARATOR
;
$dir
=
DIR
.
DIRECTORY_SEPARATOR
.
'com'
.
DIRECTORY_SEPARATOR
.
$com
.
DIRECTORY_SEPARATOR
;
$file
=
$dir
.
$com
.
'.php'
;
if
(
is_dir
(
$dir
)
&&
is_file
(
$file
))
{
require_once
(
$file
);
...
...
@@ -40,14 +48,18 @@ function autoloader($class) {
$a
=
explode
(
'\\'
,
$class
);
$class
=
array_pop
(
$a
);
$file
=
__DIR__
.
DIRECTORY_SEPARATOR
.
'lib'
.
DIRECTORY_SEPARATOR
.
$class
.
'.php'
;
$file
=
DIR
.
DIRECTORY_SEPARATOR
.
'lib'
.
DIRECTORY_SEPARATOR
.
$class
.
'.php'
;
if
(
is_file
(
$file
))
{
include
(
$file
);
}
}
function
url
(
$script
,
$base_file
=
false
)
{
$base_dir
=
(
false
===
$base_file
?
__DIR__
:
dirname
(
$base_file
));
if
(
defined
(
__NAMESPACE__
.
'\OVERRIDE'
))
{
$base_file
=
str_replace
(
__DIR__
,
DIR
,
$base_file
);
}
$base_dir
=
(
false
===
$base_file
?
DIR
:
dirname
(
$base_file
));
$rel_path
=
str_replace
(
ABSPATH
,
''
,
$base_dir
);
$script
=
site_url
()
.
'/'
.
$rel_path
.
'/'
.
$script
;
...
...
Please
register
or
sign in
to post a comment