Skip to content

Commit

Permalink
Merge pull request #19 from gwa/develop
Browse files Browse the repository at this point in the history
	test fixes | cs fixes
  • Loading branch information
prisis committed Jul 20, 2015
2 parents 96e122f + fc5e47e commit 0511bb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/Gwa/MultisiteDirectoryResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* @link http://www.greatwhiteark.com
*
* @license MIT
*
* @version 0.0.5
*/

/**
Expand Down Expand Up @@ -70,13 +68,14 @@ public function fixNetworkAdminUrlFilter($path = '', $scheme = 'admin')
'/(wp-admin)/',
'/(wp-login\.php)/',
'/(wp-activate\.php)/',
'/(wp-signup\.php)/'
'/(wp-signup\.php)/',
];

$multiSiteUrl = [
$this->wpFolderName.'/wp-admin',
$this->wpFolderName.'/wp-login.php',
$this->wpFolderName.'/wp-activate.php',
$this->wpFolderName.'/wp-signup.php'
$this->wpFolderName.'/wp-signup.php',
];

return preg_replace($wordpressUrl, $multiSiteUrl, $path, 1);
Expand Down Expand Up @@ -124,6 +123,10 @@ public function fixStyleScriptPathFilter($src, $handle)
$src = site_url().'/'.$dir.$styleUrl[1];
}

if (strpos($src, 'plugins') && strpos($src, '//app')) {
$src = str_replace('//app', '/app', $src);
}

return esc_url($src);
}

Expand Down
10 changes: 6 additions & 4 deletions tests/MultisiteDirectoryResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,17 @@ public function testFixesStyleScriptURLWhenPluginUrlPassed($value = '')
$installpath = '/path/to/my/project';
$installsubfolder = 'foo/wp';

$urlPlugin = $domain.$installpath.'/app/plugins/';
$urlPlugin = $domain.$installpath.'//app/plugins/';
$expectedUrl = $domain.$installpath.'/app/plugins/';

$cwml = new MDR($installsubfolder);
$this->assertEquals($urlPlugin, $cwml->fixStyleScriptPathFilter($urlPlugin, ''));
$this->assertEquals($expectedUrl, $cwml->fixStyleScriptPathFilter($urlPlugin, ''));

$urlPlugin = 'http://example.org/projects/testWordpress/web/wp/app/plugins/';
$urlPlugin = 'http://example.org/projects/testWordpress/web/wp//app/plugins/';
$expectedUrl = 'http://example.org/projects/testWordpress/web/wp/app/plugins/';

$cwml = new MDR($installsubfolder);
$this->assertEquals($urlPlugin, $cwml->fixStyleScriptPathFilter($urlPlugin, ''));
$this->assertEquals($expectedUrl, $cwml->fixStyleScriptPathFilter($urlPlugin, ''));
}

public function testFixesStyleScriptURLWhenSiteUrlPassed()
Expand Down

0 comments on commit 0511bb7

Please sign in to comment.