- Updates action names
This commit is contained in:
@@ -41,8 +41,8 @@ class Menu {
|
|||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
if(!empty($_REQUEST['page']) && preg_match('/mailpoet-/i', $_REQUEST['page'])) {
|
if(!empty($_REQUEST['page']) && preg_match('/mailpoet-/i', $_REQUEST['page'])) {
|
||||||
do_action('mailpoet_conflict_styles');
|
do_action('mailpoet_conflict_resolver_styles');
|
||||||
do_action('mailpoet_conflict_scripts');
|
do_action('mailpoet_conflict_resolver_scripts');
|
||||||
}
|
}
|
||||||
|
|
||||||
$main_page_slug = 'mailpoet-newsletters';
|
$main_page_slug = 'mailpoet-newsletters';
|
||||||
|
@@ -37,7 +37,7 @@ class Router {
|
|||||||
if(!method_exists($endpoint, $this->action) || !in_array($this->action, $endpoint->allowed_actions)) {
|
if(!method_exists($endpoint, $this->action) || !in_array($this->action, $endpoint->allowed_actions)) {
|
||||||
return $this->terminateRequest(self::RESPONSE_ERROR, __('Invalid router endpoint action.', 'mailpoet'));
|
return $this->terminateRequest(self::RESPONSE_ERROR, __('Invalid router endpoint action.', 'mailpoet'));
|
||||||
}
|
}
|
||||||
do_action('mailpoet_conflict_url_query_parameters');
|
do_action('mailpoet_conflict_resolver_router_url_query_parameters');
|
||||||
return call_user_func(
|
return call_user_func(
|
||||||
array(
|
array(
|
||||||
$endpoint,
|
$endpoint,
|
||||||
|
@@ -8,9 +8,9 @@ class ConflictResolver {
|
|||||||
);
|
);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
add_action('mailpoet_conflict_url_query_parameters', array($this, 'resolveRouterUrlQueryParametersConflict'));
|
add_action('mailpoet_conflict_resolver_router_url_query_parameters', array($this, 'resolveRouterUrlQueryParametersConflict'));
|
||||||
add_action('mailpoet_conflict_styles', array($this, 'resolveStylesConflict'));
|
add_action('mailpoet_conflict_resolver_styles', array($this, 'resolveStylesConflict'));
|
||||||
add_action('mailpoet_conflict_scripts', array($this, 'resolveScriptsConflict'));
|
add_action('mailpoet_conflict_resolver_scripts', array($this, 'resolveScriptsConflict'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveRouterUrlQueryParametersConflict() {
|
function resolveRouterUrlQueryParametersConflict() {
|
||||||
|
@@ -99,7 +99,7 @@ class FrontRouterTest extends MailPoetTest {
|
|||||||
function testItExecutesUrlParameterConflictResolverAction() {
|
function testItExecutesUrlParameterConflictResolverAction() {
|
||||||
$data = array('data' => 'dummy data');
|
$data = array('data' => 'dummy data');
|
||||||
$result = $this->router->init();
|
$result = $this->router->init();
|
||||||
expect((boolean) did_action('mailpoet_conflict_url_query_parameters'))->true();
|
expect((boolean) did_action('mailpoet_conflict_resolver_router_url_query_parameters'))->true();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItCanEncodeRequestData() {
|
function testItCanEncodeRequestData() {
|
||||||
|
@@ -13,17 +13,17 @@ class ConflictResolverTest extends MailPoetTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testItResolvesRouterUrlQueryParametersConflict() {
|
function testItResolvesRouterUrlQueryParametersConflict() {
|
||||||
expect(!empty($this->wp_filter['mailpoet_conflict_url_query_parameters']))->true();
|
expect(!empty($this->wp_filter['mailpoet_conflict_resolver_router_url_query_parameters']))->true();
|
||||||
// it should unset action & endpoint GET variables
|
// it should unset action & endpoint GET variables
|
||||||
$_GET['endpoint'] = $_GET['action'] = $_GET['test'] = 'test';
|
$_GET['endpoint'] = $_GET['action'] = $_GET['test'] = 'test';
|
||||||
do_action('mailpoet_conflict_url_query_parameters');
|
do_action('mailpoet_conflict_resolver_router_url_query_parameters');
|
||||||
expect(empty($_GET['endpoint']))->true();
|
expect(empty($_GET['endpoint']))->true();
|
||||||
expect(empty($_GET['action']))->true();
|
expect(empty($_GET['action']))->true();
|
||||||
expect(empty($_GET['test']))->false();
|
expect(empty($_GET['test']))->false();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItUnloadsConflictingStyles() {
|
function testItUnloadsConflictingStyles() {
|
||||||
expect(!empty($this->wp_filter['mailpoet_conflict_styles']))->true();
|
expect(!empty($this->wp_filter['mailpoet_conflict_resolver_styles']))->true();
|
||||||
wp_enqueue_style('select2', 'select2.css');
|
wp_enqueue_style('select2', 'select2.css');
|
||||||
wp_enqueue_style('select-2', 'select-2.css');
|
wp_enqueue_style('select-2', 'select-2.css');
|
||||||
wp_enqueue_style('test', 'test.css');
|
wp_enqueue_style('test', 'test.css');
|
||||||
@@ -41,7 +41,7 @@ class ConflictResolverTest extends MailPoetTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testItUnloadsConflictingScripts() {
|
function testItUnloadsConflictingScripts() {
|
||||||
expect(!empty($this->wp_filter['mailpoet_conflict_scripts']))->true();
|
expect(!empty($this->wp_filter['mailpoet_conflict_resolver_scripts']))->true();
|
||||||
wp_enqueue_script('select2', 'select2.js');
|
wp_enqueue_script('select2', 'select2.js');
|
||||||
wp_enqueue_script('select-2', 'select-2.js', null, null, $in_footer = true);
|
wp_enqueue_script('select-2', 'select-2.js', null, null, $in_footer = true);
|
||||||
wp_enqueue_script('test', 'test.js');
|
wp_enqueue_script('test', 'test.js');
|
||||||
|
Reference in New Issue
Block a user