| 1 |
<?php |
| 2 |
/** |
| 3 |
* Shortcode related functions |
| 4 |
* |
| 5 |
* This class defines all code necessary for UsersWP shortcodes. |
| 6 |
* |
| 7 |
* @since 1.0.0 |
| 8 |
* @author GeoDirectory Team <info@wpgeodirectory.com> |
| 9 |
*/ |
| 10 |
class UsersWP_Shortcodes { |
| 11 |
|
| 12 |
private $templates; |
| 13 |
|
| 14 |
public function __construct($templates) { |
| 15 |
$this->templates = $templates; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Returns the UsersWP profile page template content. |
| 20 |
* |
| 21 |
* @since 1.0.0 |
| 22 |
* @package userswp |
| 23 |
* @return string UsersWP template content. |
| 24 |
*/ |
| 25 |
public function profile() { |
| 26 |
return $this->uwp_generate_shortcode('profile'); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Returns the UsersWP template content based on type. |
| 31 |
* |
| 32 |
* @since 1.0.0 |
| 33 |
* @package userswp |
| 34 |
* @param string $type Template type. |
| 35 |
* @return string UsersWP template content. |
| 36 |
*/ |
| 37 |
public function uwp_generate_shortcode($type = 'register') { |
| 38 |
|
| 39 |
$template = $this->templates->uwp_locate_template($type); |
| 40 |
|
| 41 |
ob_start(); |
| 42 |
echo '<div class="uwp_page">'; |
| 43 |
if ($template) { |
| 44 |
include($template); |
| 45 |
} |
| 46 |
echo '</div>'; |
| 47 |
$output = ob_get_contents(); |
| 48 |
ob_end_clean(); |
| 49 |
|
| 50 |
return trim($output); |
| 51 |
} |
| 52 |
|
| 53 |
} |