| 1 |
<?php |
| 2 |
/** |
| 3 |
* Checks whether the current page is of given page type or not. |
| 4 |
* |
| 5 |
* @since 1.0.0 |
| 6 |
* @package userswp |
| 7 |
* @param string|bool $type Page type. |
| 8 |
* @return bool |
| 9 |
*/ |
| 10 |
function is_uwp_page($type = false) { |
| 11 |
$page = new UsersWP_Pages(); |
| 12 |
return $page->is_page($type); |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Checks whether the current page is register page or not. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
* @package userswp |
| 20 |
* @return bool |
| 21 |
*/ |
| 22 |
function is_uwp_register_page() { |
| 23 |
$page = new UsersWP_Pages(); |
| 24 |
return $page->is_register_page(); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Checks whether the current page is login page or not. |
| 29 |
* |
| 30 |
* @since 1.0.0 |
| 31 |
* @package userswp |
| 32 |
* @return bool |
| 33 |
*/ |
| 34 |
function is_uwp_login_page() { |
| 35 |
$page = new UsersWP_Pages(); |
| 36 |
return $page->is_login_page(); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* Checks whether the current page is forgot password page or not. |
| 41 |
* |
| 42 |
* @since 1.0.0 |
| 43 |
* @package userswp |
| 44 |
* @return bool |
| 45 |
*/ |
| 46 |
function is_uwp_forgot_page() { |
| 47 |
$page = new UsersWP_Pages(); |
| 48 |
return $page->is_forgot_page(); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Checks whether the current page is change password page or not. |
| 53 |
* |
| 54 |
* @since 1.0.0 |
| 55 |
* @package userswp |
| 56 |
* @return bool |
| 57 |
*/ |
| 58 |
function is_uwp_change_page() { |
| 59 |
$page = new UsersWP_Pages(); |
| 60 |
return $page->is_change_page(); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Checks whether the current page is reset password page or not. |
| 65 |
* |
| 66 |
* @since 1.0.0 |
| 67 |
* @package userswp |
| 68 |
* @return bool |
| 69 |
*/ |
| 70 |
function is_uwp_reset_page() { |
| 71 |
$page = new UsersWP_Pages(); |
| 72 |
return $page->is_reset_page(); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Checks whether the current page is account page or not. |
| 77 |
* |
| 78 |
* @since 1.0.0 |
| 79 |
* @package userswp |
| 80 |
* @return bool |
| 81 |
*/ |
| 82 |
function is_uwp_account_page() { |
| 83 |
$page = new UsersWP_Pages(); |
| 84 |
return $page->is_account_page(); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Checks whether the current page is profile page or not. |
| 89 |
* |
| 90 |
* @since 1.0.0 |
| 91 |
* @package userswp |
| 92 |
* @return bool |
| 93 |
*/ |
| 94 |
function is_uwp_profile_page() { |
| 95 |
$page = new UsersWP_Pages(); |
| 96 |
return $page->is_profile_page(); |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Checks whether the current page is users page or not. |
| 101 |
* |
| 102 |
* @since 1.0.0 |
| 103 |
* @package userswp |
| 104 |
* @return bool |
| 105 |
*/ |
| 106 |
function is_uwp_users_page() { |
| 107 |
$page = new UsersWP_Pages(); |
| 108 |
return $page->is_users_page(); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Checks whether the current page is multi register page or not. |
| 113 |
* |
| 114 |
* @since 1.0.0 |
| 115 |
* @package userswp |
| 116 |
* @return bool |
| 117 |
*/ |
| 118 |
function is_uwp_multi_register_page() { |
| 119 |
$page = new UsersWP_Pages(); |
| 120 |
return $page->is_multi_register_page(); |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* Checks whether the current page is logged in user profile page or not. |
| 125 |
* |
| 126 |
* @since 1.0.0 |
| 127 |
* @package userswp |
| 128 |
* @return bool |
| 129 |
*/ |
| 130 |
function is_uwp_current_user_profile_page() { |
| 131 |
$page = new UsersWP_Pages(); |
| 132 |
return $page->is_current_user_profile_page(); |
| 133 |
} |
| 134 |
|
| 135 |
/** |
| 136 |
* Returns all available pages as array to use in select dropdown. |
| 137 |
* |
| 138 |
* @since 1.0.0 |
| 139 |
* @package userswp |
| 140 |
* @return array Page array. |
| 141 |
*/ |
| 142 |
function uwp_get_pages() { |
| 143 |
$page = new UsersWP_Pages(); |
| 144 |
return $page->get_pages(); |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Gets the page slug using the given page type. |
| 149 |
* |
| 150 |
* @since 1.0.0 |
| 151 |
* @package userswp |
| 152 |
* @param string $page_type Page type. |
| 153 |
* @return string Page slug. |
| 154 |
*/ |
| 155 |
function uwp_get_page_slug($page_type = 'register_page') { |
| 156 |
$page = new UsersWP_Pages(); |
| 157 |
return $page->get_page_slug($page_type); |
| 158 |
} |
| 159 |
|
| 160 |
/** |
| 161 |
* Creates UsersWP page if not exists. |
| 162 |
* |
| 163 |
* @since 1.0.0 |
| 164 |
* @package userswp |
| 165 |
* @param string $slug Page slug. |
| 166 |
* @param string $option Page setting key. |
| 167 |
* @param string $page_title The post title. Default empty. |
| 168 |
* @param mixed $page_content The post content. Default empty. |
| 169 |
* @param int $post_parent Set this for the post it belongs to, if any. Default 0. |
| 170 |
* @param string $status The post status. Default 'draft'. |
| 171 |
*/ |
| 172 |
function uwp_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') { |
| 173 |
$page = new UsersWP_Pages(); |
| 174 |
$page->create_page($slug, $option, $page_title, $page_content, $post_parent, $status); |
| 175 |
} |
| 176 |
|
| 177 |
/** |
| 178 |
* Generates default UsersWP pages. Usually called during plugin activation. |
| 179 |
* |
| 180 |
* @since 1.0.0 |
| 181 |
* @package userswp |
| 182 |
* @return void |
| 183 |
*/ |
| 184 |
function uwp_generate_default_pages() { |
| 185 |
$page = new UsersWP_Pages(); |
| 186 |
$page->generate_default_pages(); |
| 187 |
} |
| 188 |
|
| 189 |
function uwp_get_page_id($type, $link) { |
| 190 |
$page = new UsersWP_Pages(); |
| 191 |
return $page->get_page_id($type, $link); |
| 192 |
} |