| @@ -1,0 +1,81 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikBooking | |
| 4 | + * @subpackage core | |
| 5 | + * @author E4J s.r.l. | |
| 6 | + * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. | |
| 7 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +// No direct access | |
| 12 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * Declares all the URI helper methods that may differ between every supported platform. | |
| 16 | + * | |
| 17 | + * @since 1.5 | |
| 18 | + */ | |
| 19 | +interface VBOPlatformUriInterface | |
| 20 | +{ | |
| 21 | + /** | |
| 22 | + * Rewrites an internal URI that needs to be used outside of the website. | |
| 23 | + * This means that the routed URI MUST start with the base path of the site. | |
| 24 | + * | |
| 25 | + * @param mixed $query The query string or an associative array of data. | |
| 26 | + * @param boolean $xhtml Replace & by & for XML compliance. | |
| 27 | + * @param mixed $itemid The itemid to use. If null, the current one will be used. | |
| 28 | + * | |
| 29 | + * @return string The complete routed URI. | |
| 30 | + */ | |
| 31 | + public function route($query = '', $xhtml = true, $itemid = null); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * Routes an admin URL for being used outside from the website (complete URI). | |
| 35 | + * | |
| 36 | + * @param mixed $query The query string or an associative array of data. | |
| 37 | + * @param boolean $xhtml Replace & by & for XML compliance. | |
| 38 | + * | |
| 39 | + * @return string The complete routed URI. | |
| 40 | + */ | |
| 41 | + public function admin($query = '', $xhtml = true); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Prepares a plain/routed URL to be used for an AJAX request. | |
| 45 | + * | |
| 46 | + * @param mixed $query The query string or a routed URL. | |
| 47 | + * @param boolean $xhtml Replace & by & for XML compliance. | |
| 48 | + * | |
| 49 | + * @return string The AJAX end-point URI. | |
| 50 | + */ | |
| 51 | + public function ajax($query = '', $xhtml = false); | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Includes the CSRF-proof token within the specified query string/URL. | |
| 55 | + * | |
| 56 | + * @param mixed $query The query string or a routed URL. | |
| 57 | + * @param boolean $xhtml Replace & by & for XML compliance. | |
| 58 | + * | |
| 59 | + * @return string The resulting path. | |
| 60 | + */ | |
| 61 | + public function addCSRF($query = '', $xhtml = false); | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * Converts the given absolute path into a reachable URL. | |
| 65 | + * | |
| 66 | + * @param string $path The absolute path. | |
| 67 | + * @param boolean $relative True to receive a relative path. | |
| 68 | + * | |
| 69 | + * @return mixed The resulting URL on success, null otherwise. | |
| 70 | + */ | |
| 71 | + public function getUrlFromPath($path, $relative = false); | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Returns the platform base path. | |
| 75 | + * | |
| 76 | + * @return string | |
| 77 | + * | |
| 78 | + * @since 1.9 This method is now public and directly declared by the interface. | |
| 79 | + */ | |
| 80 | + public function getAbsolutePath(); | |
| 81 | +} | |