/** * Returns a new action object built using the information described in $action. * * @param object $json a JSON action as used in the admin pages of our plugin. * * @return NelioABPageAccessedAction the new action containing all the information in `$action`. * * @since PHPDOC * @Override */ public static function build_action_using_json4js($json) { if ($json->type == NelioABAction::EXTERNAL_PAGE_ACCESSED) { $value = $json->url; switch ($json->url_mode) { case 'exact': break; case 'starts-with': $value = $value . '***'; break; case 'ends-with': $value = '***' . $value; break; case 'contains': $value = '***' . $value . '***'; break; } $internal = false; } else { $value = $json->value; $internal = true; } $action = new NelioABPageAccessedAction($value, $internal); if (isset($json->name)) { $action->set_title($json->name); } if (isset($json->is_indirect) && $json->is_indirect) { $action->set_indirect_navigations_enabled(); } return $action; }