GRAYBYTE WORDPRESS FILE MANAGER1188

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/includes/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/public_html/wp-content/plugins/userswp/includes//class-addons.php
<?php
/**
 * UsersWP extensions screen related functions
 *
 * All UsersWP extensions screen related functions can be found here.
 *
 * @since      1.0.24
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * UsersWP_Admin_Addons Class.
 */
class UsersWP_Admin_Addons extends Ayecode_Addons {


	/**
	 * Get the extensions page tabs.
	 *
	 * @return array of tabs.
	 */
	public function get_tabs(){
		$tabs = array(
			'addons' => __("Addons", "userswp"),
            'recommended_plugins' => __("Recommended plugins", "userswp"),
            'membership' => __("Membership", "userswp"),
		);

		return $tabs;
	}

	/**
	 * Get section content for the addons screen.
	 *
	 * @param  string $section_id
	 *
	 * @return array
	 */
	public function get_section_data( $section_id ) {
		$section      = $this->get_tab( $section_id );
		$api_url = "https://userswp.io/edd-api/v2/products/";
		$section_data = new stdClass();

		//echo '###'.$section_id;

		if($section_id=='recommended_plugins'){
			$section_data->products = $this->get_recommend_wp_plugins_edd_formatted();
		}
		elseif ( ! empty( $section ) ) {
			if ( false === ( $section_data = get_transient( 'uwp_addons_section_' . $section_id ) ) ) { //@todo restore after testing
			//if ( 1==1) {

				$query_args = array( 'category' => $section_id, 'number' => 100);
				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);

				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'UsersWP Addons Page','timeout'     => 15, ) );

				if ( ! is_wp_error( $raw_section ) ) {
					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );

					if ( ! empty( $section_data->products ) ) {
						set_transient( 'uwp_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
					}
				}
			}
		}

		$products = isset($section_data->products) ? $section_data->products : '';

		return apply_filters( 'uwp_addons_section_data', $products, $section_id );
	}

	/**
	 * Outputs a button.
	 *
	 * @param string $url
	 * @param string $text
	 * @param string $theme
	 * @param string $plugin
	 */
	public function output_button( $addon ) {
		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
//		$button_text = __('Free','userswp');
//		$licensing = false;
//		$installed = false;
//		$price = '';
//		$license = '';
//		$slug = '';
//		$url = isset($addon->info->link) ? $addon->info->link : '';
//		$class = 'button-primary';
//		$install_status = 'get';
//		$onclick = '';

		$wp_org_themes = array('supreme-directory','directory-starter');

		$button_args = array(
			'type' => $current_tab,
			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
			'title' => isset($addon->info->title) ? $addon->info->title : '',
			'button_text' => __('Free','userswp'),
			'price_text' => __('Free','userswp'),
			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
			'class' => 'button-primary',
			'install_status' => 'get',
			'installed' => false,
			'price' => '',
			'licensing' => isset($addon->licensing->enabled) && $addon->licensing->enabled ? true : false,
			'license' => isset($addon->licensing->license) && $addon->licensing->license ? $addon->licensing->license : '',
			'onclick' => '',
			'slug' => isset($addon->info->slug) ? $addon->info->slug : '',
			'active' => false,
			'file' => '',
			'update_url' => '',
		);

		if($current_tab == 'addons' && isset($addon->info->id) && $addon->info->id){
			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
			$status = $this->install_plugin_install_status($addon);
			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
			$button_args['update_url'] = "https://userswp.io";
		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
			$button_args['installed'] = $this->is_theme_installed($addon);
			if(!in_array($button_args['slug'],$wp_org_themes)){
				$button_args['update_url'] = "https://userswp.io";
			}
		}elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
		}

		// set price
		if(isset($addon->pricing) && !empty($addon->pricing)){
			if(is_object($addon->pricing)){
				$prices = (Array)$addon->pricing;
				$button_args['price'] = reset($prices);
			}elseif(isset($addon->pricing)){
				$button_args['price'] = $addon->pricing;
			}
		}

		// set price text
		if( $button_args['price'] && $button_args['price'] != '0.00' ){
			$button_args['price_text'] = sprintf( __('From: $%d', 'userswp'), $button_args['price']);
		}


		// set if installed
		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
			$button_args['installed'] = true;
		}

//		print_r($button_args);
		// set if active
		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
			if($button_args['type'] != 'themes'){
				$button_args['active'] = is_plugin_active($button_args['file']);
			}else{
				$button_args['active'] = $this->is_theme_active($addon);
			}
		}

		// set button text and class
		if($button_args['active']){
			$button_args['button_text'] = __('Active','userswp');
			$button_args['class'] = ' button-secondary disabled ';
		}elseif($button_args['installed']){
			$button_args['button_text'] = __('Activate','userswp');

			if($button_args['type'] != 'themes'){
				if ( current_user_can( 'manage_options' ) ) {
					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
				}else{
					$button_args['url'] = '#';
				}
			}else{
				if ( current_user_can( 'switch_themes' ) ) {
					$button_args['url'] = $this->get_theme_activation_url($addon);
				}else{
					$button_args['url'] = '#';
				}
			}

		}else{
			if($button_args['type'] == 'recommended_plugins'){
				$button_args['button_text'] = __('Install','userswp');
			}else{
				$button_args['button_text'] = __('Get it','userswp');
			}
		}
		
		// filter the button arguments
		$button_args = apply_filters('edd_api_button_args',$button_args);

		// set price text
		if(isset($button_args['price_text'])){
			?>
			<a
				target="_blank"
				class="addons-price-text"
				href="<?php echo esc_url( $button_args['link'] ); ?>">
				<?php echo esc_html( $button_args['price_text'] ); ?>
			</a>
			<?php
		}

		$target = '';
		if ( ! empty( $button_args['url'] ) ) {
			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : '_blank';
		}

		?>
		<a
			data-licence="<?php echo esc_attr($button_args['license']);?>"
			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
			data-title="<?php echo esc_attr($button_args['title']);?>"
			data-type="<?php echo esc_attr($button_args['type']);?>"
			data-text-error-message="<?php esc_attr_e('Something went wrong!','userswp');?>"
			data-text-activate="<?php esc_attr_e('Activate','userswp');?>"
			data-text-activating="<?php esc_attr_e('Activating','userswp');?>"
			data-text-deactivate="<?php esc_attr_e('Deactivate','userswp');?>"
			data-text-installed="<?php esc_attr_e('Installed','userswp');?>"
			data-text-install="<?php esc_attr_e('Install','userswp');?>"
			data-text-installing="<?php esc_attr_e('Installing','userswp');?>"
			data-text-error="<?php esc_attr_e('Error','userswp');?>"
			<?php if(!empty($button_args['onclick'])){echo " onclick='".esc_html($button_args['onclick'] )."' ";}?>
			target="<?php echo esc_attr( $target );?>"
			class="addons-button  <?php echo esc_attr( $button_args['class'] ); ?>"
			href="<?php echo esc_url( $button_args['url'] ); ?>">
			<?php echo esc_html( $button_args['button_text'] ); ?>
		</a>
		<?php
	}


	/**
	 * Handles output of the addons page in admin.
	 */
	public function output() {
		$tabs            = $this->get_tabs();
		$sections        = $this->get_sections();
		$theme           = wp_get_theme();
		$section_keys    = array_keys( $sections );
		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
		include_once( USERSWP_PATH . '/admin/views/html-admin-page-addons.php' );
	}

	/**
	 * A list of recommended wp.org plugins.
	 * @return array
	 */
	public function get_recommend_wp_plugins(){
		$plugins = array(
            'geodirectory' => array(
                'url'   => 'https://wordpress.org/plugins/geodirectory/',
                'slug'   => 'geodirectory',
                'name'   => 'GeoDirectory',
                'desc'   => __('Turn any WordPress theme into a global business directory portal.','userswp'),
            ),
			'invoicing' => array(
				'url'   => 'https://wordpress.org/plugins/invoicing/',
				'slug'   => 'invoicing',
				'name'   => 'Invoicing',
				'desc'   => __('Create & Send Invoices, Manage Taxes & VAT. Collect One Time & Recurring Payments.','userswp'),
			),
		);

		return $plugins;
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
helpers
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
libraries
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
.htaccess
0.41 KB
July 10 2025 04:32:23
inteuuod / inteuuod
0644
abstract-uwp-privacy.php
3.543 KB
May 24 2018 18:32:58
inteuuod / inteuuod
0644
class-account.php
9.071 KB
January 09 2025 21:52:58
inteuuod / inteuuod
0644
class-activator.php
30.118 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-addons.php
9.592 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-ajax.php
2.782 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-countries.php
11.445 KB
April 28 2022 17:18:48
inteuuod / inteuuod
0644
class-date.php
6.316 KB
September 19 2017 17:57:46
inteuuod / inteuuod
0644
class-emails.php
22.155 KB
April 10 2025 19:10:18
inteuuod / inteuuod
0644
class-files.php
23.46 KB
July 16 2024 18:34:28
inteuuod / inteuuod
0644
class-forms.php
170.66 KB
February 19 2025 22:09:02
inteuuod / inteuuod
0644
class-meta.php
12.987 KB
May 25 2022 16:36:12
inteuuod / inteuuod
0644
class-notices.php
7.954 KB
December 12 2024 21:47:10
inteuuod / inteuuod
0644
class-pages.php
17.646 KB
June 01 2021 17:14:04
inteuuod / inteuuod
0644
class-profile.php
60.792 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-status.php
19.468 KB
July 16 2020 17:09:12
inteuuod / inteuuod
0644
class-tables.php
13.046 KB
June 25 2024 02:23:32
inteuuod / inteuuod
0644
class-templates.php
43.835 KB
March 19 2025 15:13:04
inteuuod / inteuuod
0644
class-tools.php
38.828 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-user-notifications.php
5.606 KB
February 19 2025 22:09:02
inteuuod / inteuuod
0644
class-userswp.php
35.552 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-uwp-background-updater.php
3.044 KB
June 27 2019 18:13:34
inteuuod / inteuuod
0644
class-uwp-compatibility.php
3.123 KB
October 10 2024 19:01:40
inteuuod / inteuuod
0644
class-uwp-defaults.php
9.666 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-uwp-privacy-erasers.php
1.328 KB
May 24 2018 18:32:58
inteuuod / inteuuod
0644
class-uwp-privacy-exporters.php
3.309 KB
February 19 2020 16:22:32
inteuuod / inteuuod
0644
class-uwp-privacy.php
3.062 KB
December 20 2024 18:16:58
inteuuod / inteuuod
0644
class-uwp-seo.php
11.987 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-validation.php
15.852 KB
November 01 2023 11:49:38
inteuuod / inteuuod
0644
deprecated-functions.php
0.181 KB
January 23 2020 19:10:04
inteuuod / inteuuod
0644
helpers.php
0.502 KB
January 23 2020 19:10:04
inteuuod / inteuuod
0644
index.php
0.025 KB
July 27 2017 16:44:24
inteuuod / inteuuod
0644
template-functions.php
6.082 KB
December 12 2024 21:47:10
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF