Skip to content

Commit

Permalink
- $boarddir, $sourcedir, $cachedir, $pluginsdir, $cssdir and $jssdir …
Browse files Browse the repository at this point in the history
…are now all hard-coded, relative to ROOT_DIR (ex-$boarddir) which itself is determined through PHP. This is the second step towards making Wedge folder moves easier. (Class-CSS.php, Load.php, ManagePlugins.php, ManageSettings.php, OriginalFiles.php, QueryString.php, Subs-Plugins.php, Subs-Template.php, index.php, install.php, ManageSettings.english.php)

! Fixed a PHP 5.3-only constant (__DIR__) showing up before it was allowed to. My, didn't I already do that before..?! (index.php)

* Gained a portion of a microsecond or two for PHP 5.4+ by completely skipping the magic quote crap, including the function_exists test. It's approximately one billionth of the time it took me to type this, basically. But on every page. Don't complain. (index.php)

- Removed folder presence tests at the start. If you want to remove them, well... That's your problem. Plus, I get to use a geeky syntax in this code block. (index.php)

@ Note: $pluginsdir/$pluginsurl and PLUGINS/PLUGINS_DIR are actually removed entirely, replaced by ROOT_DIR/ROOT hardcodings. They weren't used enough in the generic code flow to be worth a constant. Also removed CORE and CORE_DIR constants, for the same reasons, but I'm willing to restore constants by popular request.

@ Also, ROOT_DIR now automatically turns backslashes into slashes, reverting the need for that manipulation later on. I can see no reason why it couldn't be done so early!
  • Loading branch information
Nao committed Mar 20, 2014
1 parent b8ffdee commit 3969e46
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 225 deletions.
4 changes: 1 addition & 3 deletions core/app/Class-CSS.php
Expand Up @@ -708,8 +708,6 @@ class wess_func extends wess
{
function process(&$css)
{
global $boardurl, $boarddir;

if (!preg_match_all('~\b(width|height)\(([^)]+)\)~i', $css, $matches))
return;

Expand All @@ -721,7 +719,7 @@ function process(&$css)
$done[$file] = true;

// Get dimensions from file. Try to turn it into absolute path if a URL was given.
list ($width, $height) = @getimagesize(str_replace($boardurl, $boarddir, $file));
list ($width, $height) = @getimagesize(str_replace(ROOT, ROOT_DIR, $file));
$css = str_replace(array('width(' . $file . ')', 'height(' . $file . ')'), array($width, $height), $css);
}
}
Expand Down
9 changes: 4 additions & 5 deletions core/app/Load.php
Expand Up @@ -25,7 +25,7 @@
*/
function loadSettings()
{
global $settings, $context, $pluginsdir, $pluginsurl, $action_list, $action_no_log;
global $settings, $context, $action_list, $action_no_log;

// This is where it all began.
$context = array(
Expand Down Expand Up @@ -171,16 +171,15 @@ function loadSettings()
{
// Step through the list we think we have enabled.
$plugins = explode(',', $settings['enabled_plugins']);
$sane_path = str_replace('\\', '/', $pluginsdir);
$hook_stack = array();
foreach ($plugins as $plugin)
{
if (!empty($settings['plugin_' . $plugin]) && file_exists($sane_path . '/' . $plugin . '/plugin-info.xml'))
if (!empty($settings['plugin_' . $plugin]) && file_exists(ROOT_DIR . '/plugins/' . $plugin . '/plugin-info.xml'))
{
$plugin_details = @unserialize($settings['plugin_' . $plugin]);
$context['enabled_plugins'][$plugin_details['id']] = $plugin;
$context['plugins_dir'][$plugin_details['id']] = $sane_path . '/' . $plugin;
$context['plugins_url'][$plugin_details['id']] = $pluginsurl . '/' . $plugin;
$context['plugins_dir'][$plugin_details['id']] = ROOT_DIR . '/plugins/' . $plugin;
$context['plugins_url'][$plugin_details['id']] = ROOT . '/plugins/' . $plugin;
if (isset($plugin_details['actions']))
foreach ($plugin_details['actions'] as $action)
{
Expand Down

0 comments on commit 3969e46

Please sign in to comment.