GRAYBYTE WORDPRESS FILE MANAGER7884

Server IP : 68.65.123.43 / Your IP : 216.73.216.162
System : Linux server266.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
PHP Version : 8.0.30
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/inteuuod/public_html/wp-content/plugins/userswp/widgets/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/public_html/wp-content/plugins/userswp/widgets//user-badge.php
<?php

/**
 * UsersWP Badge widget.
 */
class UWP_User_Badge_Widget extends WP_Super_Duper {

	public $arguments;

	/**
	 * Sets up the widgets name etc
	 */
	public function __construct() {

		$options = array(
			'textdomain'     => 'userswp',
			'block-icon'     => 'admin-site',
			'block-category' => 'widgets',
			'block-keywords' => "['badge','userswp']",
			'class_name'     => __CLASS__,
			'base_id'        => 'uwp_user_badge',
			'name'           => __( 'UWP > User Badge', 'userswp' ),
			'no_wrap'       => true,
			'widget_ops'     => array(
				'classname'     => 'uwp-user-badge',
				'description'   => esc_html__( 'Displays the user badge.', 'userswp' ),
				'userswp'  => true,
			)
		);

		parent::__construct( $options );
	}

	/**
	 * Set widget arguments.
	 *
	 */
	public function set_arguments() {
		$arguments = array(
			'user_id'  	=> array(
				'type' => 'number',
				'title' => __('User ID:', 'userswp'),
				'desc' => __('Leave blank to use current user id.', 'userswp'),
				'placeholder' => __('Leave blank to use current user id.', 'userswp'),
				'default' => '',
				'desc_tip' => true,
				'advanced' => false
			),
			'key'  => array(
				'type' => 'select',
				'title' => __('Field Key:', 'userswp'),
				'desc' => __('This is the custom field key.', 'userswp'),
				'placeholder' => '',
				'options' => $this->get_custom_field_keys(),
				'default'  => '',
				'desc_tip' => true,
				'advanced' => false
			),
			'condition'  => array(
				'type' => 'select',
				'title' => __('Field condition:', 'userswp'),
				'desc' => __('Select the custom field condition.', 'userswp'),
				'placeholder' => '',
				'options' => $this->get_badge_conditions(),
				'default' => 'is_equal',
				'desc_tip' => true,
				'advanced' => false
			),
			'search'  => array(
				'type' => 'text',
				'title' => __('Value to match:', 'userswp'),
				'desc' => __('Match this text with field value to display user badge.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'advanced' => false,
				'element_require' => '[%condition%]!="is_empty" && [%condition%]!="is_not_empty"'
			),
			'badge'  => array(
				'type' => 'text',
				'title' => __('Badge:', 'userswp'),
				'desc' => __('Badge text. Leave blank to show field title as a badge, or use %%input%% to use the input value of the field or %%profile_url%% for the user profile url, or the field key for any other info %%email%%.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'advanced' => false
			),
			'type'  => array(
				'title' => __('Type', 'userswp'),
				'desc' => __('Select the badge type.', 'userswp'),
				'type' => 'select',
				'options'   =>  array(
					"" => __('Badge', 'userswp'),
					"pill" => __('Pill', 'userswp'),
				),
				'default'  => '',
				'desc_tip' => true,
				'advanced' => false,
				'group'     => __("Design","userswp")
			),
			'shadow'  => array(
				'title' => __('Shadow', 'userswp'),
				'desc' => __('Select the shadow badge type.', 'userswp'),
				'type' => 'select',
				'options'   =>  array(
					"" => __('None', 'userswp'),
					"small" => __('Small', 'userswp'),
					"medium" => __('Medium', 'userswp'),
					"large" => __('Large', 'userswp'),
				),
				'default'  => '',
				'desc_tip' => true,
				'group'     => __("Design","userswp")
			),
			'color'  => array(
				'title' => __('Badge Color', 'userswp'),
				'desc' => __('Select the the badge color.', 'userswp'),
				'type' => 'select',
				'options'   =>  array(
					                "" => __('Custom colors', 'userswp'),
				                )+uwp_aui_colors(true),
				'default'  => '',
				'desc_tip' => true,
				'advanced' => false,
				'group'     => __("Design","userswp")
			),
			'bg_color'  => array(
				'type' => 'color',
				'title' => __('Badge background color:', 'userswp'),
				'desc' => __('Color for the badge background.', 'userswp'),
				'placeholder' => '',
				'default' => '#0073aa',
				'desc_tip' => true,
				'group'     => __("Design","userswp"),
				'element_require' => '[%color%]==""',
			),
			'txt_color'  => array(
				'type' => 'color',
				'title' => __('Badge text color:', 'userswp'),
				'desc' => __('Color for the badge text.', 'userswp'),
				'placeholder' => '',
				'desc_tip' => true,
				'default'  => '#ffffff',
				'group'     => __("Design","userswp"),
				'element_require' => '[%color%]==""',
			),
			'size'  => array(
				'type' => 'select',
				'title' => __('Badge size:', 'userswp'),
				'desc' => __('Size of the badge.', 'userswp'),
				'options' =>  array(
					"" => __('Medium', 'userswp'),
					"small" => __('Small', 'userswp'),
					"large" => __('Large', 'userswp'),
					"extra-large" => __('Extra Large', 'userswp'),
				),
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Design","userswp"),
			),
			'alignment'  => array(
				'type' => 'select',
				'title' => __('Alignment:', 'userswp'),
				'desc' => __('How the item should be positioned on the page.', 'userswp'),
				'options'   =>  array(
					"" => __('None', 'userswp'),
					"left" => __('Left', 'userswp'),
					"center" => __('Center', 'userswp'),
					"right" => __('Right', 'userswp'),
				),
				'default'  => '',
				'desc_tip' => true,
				'group'     => __("Design","userswp"),
			),
			'icon_class'  => array(
				'type' => 'text',
				'title' => __('Icon class:', 'userswp'),
				'desc' => __('You can show a font-awesome icon here by entering the icon class.', 'userswp'),
				'placeholder' => 'fas fa-award',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Design","userswp")
			),
			'css_class'  => array(
				'type' => 'text',
				'title' => __('Extra class:', 'userswp'),
				'desc' => __('Give the wrapper an extra class so you can style things as you want.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Design","userswp"),
			),
			'link'  => array(
				'type' => 'text',
				'title' => __('Link url:', 'userswp'),
				'desc' => __('Badge link url. You can use this to make the button link to something, %%input%% can be used here if a link or %%profile_url%% for the user profile url.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Click Action","userswp")
			),
			'new_window'  => array(
				'title' => __('Open link in new window:', 'userswp'),
				'desc' => __('This will open the link in a new window.', 'userswp'),
				'type' => 'checkbox',
				'desc_tip' => true,
				'value'  => '1',
				'default'  => 0,
				'group'     => __("Click Action","userswp")
			),
			'popover_title'  => array(
				'type' => 'text',
				'title' => __('Popover title:', 'userswp'),
				'desc' => __('Reveals some title text onclick. Enter some text or use %%input%% to use the input value of the field or the field key for any other info %%email%%.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Click Action","userswp")
			),
			'popover_text'  => array(
				'type' => 'text',
				'title' => __('Popover text:', 'userswp'),
				'desc' => __('Reveals some text onclick. Enter some text or use %%input%% to use the input value of the field or the field key for any other info %%email%%.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Click Action","userswp")
			),
			'tooltip_text'  => array(
				'type' => 'text',
				'title' => __('Tooltip text:', 'userswp'),
				'desc' => __('Reveals some text on hover. Enter some text or use %%input%% to use the input value of the field or the field key for any other info %%email%%. (this can NOT be used with popover text)', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Hover Action","userswp")
			),
			'hover_content'  => array(
				'type' => 'text',
				'title' => __('Hover content:', 'userswp'),
				'desc' => __('Change the button text on hover. Enter some text or use %%input%% to use the input value of the field or the field key for any other info %%email%%.', 'userswp'),
				'placeholder' => '',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Hover Action","userswp")
			),
			'hover_icon'  => array(
				'type' => 'text',
				'title' => __('Hover icon:', 'userswp'),
				'desc' => __('Change the button icon on hover. You can show a font-awesome icon here by entering the icon class.', 'userswp'),
				'placeholder' => 'fas fa-bacon',
				'default' => '',
				'desc_tip' => true,
				'group'     => __("Hover Action","userswp")
			),
		);

		return $arguments;
	}


	/**
	 * Outputs the user badge on the front-end.
	 *
	 * @param array $args
	 * @param array $widget_args
	 * @param string $content
	 *
	 * @return string
	 */
	public function output( $args = array(), $widget_args = array(), $content = '' ) {
		global $post;

		if('post_author' == $args['user_id'] && $post instanceof WP_Post){
			$user = get_userdata($post->post_author);
			$args['user_id'] = $post->post_author;
		} else if(isset($args['user_id']) && (int)$args['user_id'] > 0){
			$user = get_userdata($args['user_id']);
		} else {
			$user = uwp_get_displayed_user();
		}

		if(empty($args['user_id']) && !empty($user->ID)){
			$args['user_id'] = $user->ID;
		}

		if(!$user){
			return '';
		}

		$errors = array();
		if ( empty( $args['user_id'] ) ) {
			$errors[] = __('User ID is missing','userswp');
		}
		if ( empty( $args['key'] ) ) {
			$errors[] = __('Field key is missing', 'userswp');
		}

		$output = '';
		if ( ! empty( $errors ) ){
			$output .= implode( ", ", $errors );
		}

		$output .= uwp_get_user_badge( $args );

		return $output;
	}

	/**
	 * Gets an array of custom field keys for user badge.
	 *
	 * @return array
	 */
	public function get_custom_field_keys(){
		global $wpdb;
		$table_name = uwp_get_table_prefix() . 'uwp_form_fields';

		$fields = $wpdb->get_results("SELECT htmlvar_name, site_title FROM " . $table_name . " WHERE form_type = 'account'");

		$keys = array();
		if ( !empty( $fields ) ) {
			foreach( $fields as $field ) {
				if ( apply_filters( 'uwp_badge_field_skip_key', false, $field ) ) {
					continue;
				}
				$keys[ $field->htmlvar_name ] = $field->htmlvar_name . ' ( ' . __( wp_unslash( $field->site_title ), 'userswp' ) . ' )';
			}
		}

		return apply_filters( 'uwp_badge_field_keys', $keys );
	}
	
	/**
	 * Gets an array of badge field conditions.
	 *
	 * @return array
	 */
	public function get_badge_conditions(){
		$conditions = array(
			'is_equal' => __( 'is equal', 'userswp' ),
			'is_not_equal' => __( 'is not equal', 'userswp' ),
			'is_greater_than' => __( 'is greater than', 'userswp' ),
			'is_less_than' => __( 'is less than', 'userswp' ),
			'is_empty' => __( 'is empty', 'userswp' ),
			'is_not_empty' => __( 'is not empty', 'userswp' ),
		);

		return apply_filters( 'uwp_badge_conditions', $conditions );
	}
	
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
.htaccess
0.41 KB
July 10 2025 04:32:23
inteuuod / inteuuod
0644
account.php
3.679 KB
August 11 2020 15:42:14
inteuuod / inteuuod
0644
authorbox.php
7.871 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
button-group.php
5.444 KB
April 28 2022 17:18:48
inteuuod / inteuuod
0644
change.php
3.71 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
forgot.php
3.684 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
login.php
7.884 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
output-location.php
2.602 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
profile-actions.php
1.735 KB
October 30 2019 18:46:22
inteuuod / inteuuod
0644
profile-header.php
5.928 KB
November 04 2021 10:28:08
inteuuod / inteuuod
0644
profile-section.php
3.427 KB
August 11 2020 15:42:14
inteuuod / inteuuod
0644
profile-social.php
2.062 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
profile-tabs.php
6.597 KB
November 04 2021 10:28:08
inteuuod / inteuuod
0644
profile.php
2.304 KB
November 04 2021 10:28:08
inteuuod / inteuuod
0644
register.php
4.284 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
reset.php
3.28 KB
June 21 2022 14:28:20
inteuuod / inteuuod
0644
user-actions.php
1.784 KB
May 30 2020 12:36:16
inteuuod / inteuuod
0644
user-avatar.php
4.309 KB
March 15 2023 16:33:38
inteuuod / inteuuod
0644
user-badge.php
10.726 KB
January 09 2025 21:52:58
inteuuod / inteuuod
0644
user-cover.php
3.991 KB
September 06 2021 15:30:56
inteuuod / inteuuod
0644
user-meta.php
7.332 KB
January 09 2025 21:52:58
inteuuod / inteuuod
0644
user-post-counts.php
4.469 KB
June 25 2024 02:23:32
inteuuod / inteuuod
0644
user-title.php
2.68 KB
March 14 2024 20:54:16
inteuuod / inteuuod
0644
users-item.php
1.725 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
users-loop-actions.php
1.484 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
users-loop.php
2.605 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
users-search.php
1.919 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644
users.php
2.684 KB
September 22 2021 17:04:04
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF