PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.32
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.32
1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.23 All 172 releases
userswp / widgets / output-location.php

output-location.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.32, at widgets/output-location.php

100 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 /**
7 * UsersWP output location widget.
8 *
9 * @since 1.1.2
10 */
11 class UWP_Output_Location_Widget extends WP_Super_Duper {
12
13 /**
14 * Register the output location widget with WordPress.
15 *
16 */
17 public function __construct() {
18
19
20 $options = array(
21 'textdomain' => 'userswp',
22 'block-icon' => 'admin-site',
23 'block-category'=> 'widgets',
24 'block-keywords'=> "['userswp','output']",
25 'class_name' => __CLASS__,
26 'base_id' => 'uwp_output_location',
27 'name' => __('UWP > Output Location','userswp'),
28 'no_wrap' => true,
29 'widget_ops' => array(
30 'description' => esc_html__('Displays fields which are selected to display in selected output location from form builder.','userswp'),
31 ),
32 'arguments' => array(
33 'location' => array(
34 'title' => __('Location:', 'userswp'),
35 'desc' => __('The location type to output.', 'userswp'),
36 'type' => 'select',
37 'options' => $this->show_in_locations(),
38 'desc_tip' => true,
39 'default' => '',
40 'advanced' => false
41 )
42 )
43
44 );
45
46
47 parent::__construct( $options );
48 }
49
50 /**
51 * The Super block output function.
52 *
53 * @param array $args
54 * @param array $widget_args
55 * @param string $content
56 *
57 * @return mixed|string|bool
58 */
59 public function output( $args = array(), $widget_args = array(), $content = '' ) {
60
61 $user = uwp_get_displayed_user();
62
63 $defaults = array(
64 'location' => '',
65 );
66
67 $args = wp_parse_args( $args, $defaults );
68
69 $args = apply_filters( 'uwp_widget_output_location_args', $args, $widget_args, $this );
70
71 ob_start();
72
73 echo '<div class="uwp-output-location uwp-output-location-'.esc_attr($args['location']).'">';
74
75 do_action('uwp_output_location', $user, $args['location']);
76
77 echo '</div>';
78
79 return ob_get_clean();
80
81 }
82
83 /**
84 * Returns locations array
85 *
86 * @return array
87 */
88 public function show_in_locations() {
89 $show_in_locations = array(
90 "users" => __("Users Page", 'userswp'),
91 "more_info" => __("More info tab", 'userswp'),
92 "profile_side" => __("Profile side", 'userswp'),
93 );
94
95 $show_in_locations = apply_filters('uwp_output_show_in_locations', $show_in_locations);
96
97 return $show_in_locations;
98 }
99
100 }