Activation
8 years ago
Config
8 years ago
Entities
8 years ago
Form
8 years ago
Views
8 years ago
Bootstrap.php
8 years ago
FrontEndBootstrap.php
9 years ago
Helpers.php
8 years ago
NestedPages.php
8 years ago
Redirects.php
8 years ago
RedirectsFrontEnd.php
8 years ago
Helpers.php
45 lines
| 1 | <?php |
| 2 | namespace NestedPages; |
| 3 | |
| 4 | /** |
| 5 | * Helper Functions |
| 6 | */ |
| 7 | class Helpers |
| 8 | { |
| 9 | /** |
| 10 | * Verify URL Format |
| 11 | * @param string - URL to check |
| 12 | * @return string - formatted URL |
| 13 | */ |
| 14 | public static function check_url($url) |
| 15 | { |
| 16 | return esc_url($url); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Plugin Root Directory |
| 21 | */ |
| 22 | public static function plugin_url() |
| 23 | { |
| 24 | return plugins_url('/', NESTEDPAGES_URI); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * View |
| 29 | */ |
| 30 | public static function view($file) |
| 31 | { |
| 32 | return dirname(__FILE__) . '/Views/' . $file . '.php'; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Link to the default WP Pages listing |
| 37 | * @since 1.2 |
| 38 | * @return string |
| 39 | */ |
| 40 | public static function defaultPagesLink($type = 'page') |
| 41 | { |
| 42 | $link = esc_url( admin_url('edit.php?post_type=' . $type ) ); |
| 43 | return $link; |
| 44 | } |
| 45 | } |