Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/Integrations.tar

Gutenberg/FormSelector.php000066600000010551151130523410011604 0ustar00<?php

namespace WPForms\Integrations\Gutenberg;

use WPForms\Integrations\IntegrationInterface;

/**
 * Form Selector Gutenberg block with live preview.
 *
 * @package    WPForms\Integrations\Gutenberg
 * @author     WPForms
 * @since      1.4.8
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2018, WPForms LLC
 */
class FormSelector implements IntegrationInterface {

	/**
	 * Indicates if current integration is allowed to load.
	 *
	 * @since 1.4.8
	 *
	 * @return bool
	 */
	public function allow_load() {
		return \function_exists( 'register_block_type' );
	}

	/**
	 * Loads an integration.
	 *
	 * @since 1.4.8
	 */
	public function load() {
		$this->hooks();
	}

	/**
	 * Integration hooks.
	 *
	 * @since 1.4.8
	 */
	protected function hooks() {

		\add_action( 'init', array( $this, 'register_block' ) );
		\add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) );
	}

	/**
	 * Register WPForms Gutenberg block on the backend.
	 *
	 * @since 1.4.8
	 */
	public function register_block() {

		// Load CSS per global setting.
		if ( \wpforms_setting( 'disable-css', '1' ) === '1' ) {
			\wp_register_style(
				'wpforms-gutenberg-form-selector',
				WPFORMS_PLUGIN_URL . 'assets/css/wpforms-full.css',
				array( 'wp-edit-blocks' ),
				WPFORMS_VERSION
			);
		}

		if ( \wpforms_setting( 'disable-css', '1' ) === '2' ) {
			\wp_register_style(
				'wpforms-gutenberg-form-selector',
				WPFORMS_PLUGIN_URL . 'assets/css/wpforms-base.css',
				array( 'wp-edit-blocks' ),
				WPFORMS_VERSION
			);
		}

		\register_block_type( 'wpforms/form-selector', array(
			'attributes'      => array(
				'formId'       => array(
					'type' => 'string',
				),
				'displayTitle' => array(
					'type' => 'boolean',
				),
				'displayDesc'  => array(
					'type' => 'boolean',
				),
			),
			'editor_style'    => 'wpforms-gutenberg-form-selector',
			'render_callback' => array( $this, 'get_form_html' ),
		) );
	}

	/**
	 * Load WPForms Gutenberg block scripts.
	 *
	 * @since 1.4.8
	 */
	public function enqueue_block_editor_assets() {

		$i18n = array(
			'title'            => \esc_html__( 'WPForms', 'wpforms-lite' ),
			'description'      => \esc_html__( 'Select and display one of your forms.', 'wpforms-lite' ),
			'form_keyword'     => \esc_html__( 'form', 'wpforms-lite' ),
			'form_select'      => \esc_html__( 'Select a Form', 'wpforms-lite' ),
			'form_settings'    => \esc_html__( 'Form Settings', 'wpforms-lite' ),
			'form_selected'    => \esc_html__( 'Form', 'wpforms-lite' ),
			'show_title'       => \esc_html__( 'Show Title', 'wpforms-lite' ),
			'show_description' => \esc_html__( 'Show Description', 'wpforms-lite' ),
		);

		\wp_enqueue_script(
			'wpforms-gutenberg-form-selector',
			WPFORMS_PLUGIN_URL . 'assets/js/components/admin/gutenberg/formselector.min.js',
			array( 'wp-blocks', 'wp-i18n', 'wp-element' ),
			WPFORMS_VERSION,
			true
		);

		$forms = \wpforms()->form->get( '', array( 'order' => 'DESC' ) );

		\wp_localize_script(
			'wpforms-gutenberg-form-selector',
			'wpforms_gutenberg_form_selector',
			array(
				'logo_url' => WPFORMS_PLUGIN_URL . 'assets/images/sullie-vc.png',
				'wpnonce'  => \wp_create_nonce( 'wpforms-gutenberg-form-selector' ),
				'forms'    => ! empty( $forms ) ? $forms : array(),
				'i18n'     => $i18n,
			)
		);
	}

	/**
	 * Get form HTML to display in a WPForms Gutenberg block.
	 *
	 * @param array $attr Attributes passed by WPForms Gutenberg block.
	 *
	 * @since 1.4.8
	 *
	 * @return string
	 */
	public function get_form_html( $attr ) {

		$id = ! empty( $attr['formId'] ) ? \absint( $attr['formId'] ) : 0;

		if ( empty( $id ) ) {
			return '';
		}

		$is_gb_editor = \defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context'];

		$title = ! empty( $attr['displayTitle'] ) ? true : false;
		$desc  = ! empty( $attr['displayDesc'] ) ? true : false;

		// Disable form fields if called from the Gutenberg editor.
		if ( $is_gb_editor ) {
			\add_filter( 'wpforms_frontend_container_class', function ( $classes ) {
				$classes[] = 'wpforms-gutenberg-form-selector';
				return $classes;
			} );
			\add_action( 'wpforms_frontend_output', function () {
				echo '<fieldset disabled>';
			}, 3 );
			\add_action( 'wpforms_frontend_output', function () {
				echo '</fieldset>';
			}, 30 );
		}

		\ob_start();
		\wpforms_display( $id, $title, $desc );

		return \ob_get_clean();
	}
}
Gutenberg/.htaccess000066600000000424151130523410010263 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>Loader.php000066600000002234151130523410006463 0ustar00<?php

namespace WPForms\Integrations;

/**
 * Class Loader gives ability to track/load all integrations.
 *
 * @package    WPForms\Integrations
 * @author     WPForms
 * @since      1.4.8
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2018, WPForms LLC
 */
class Loader {

	/**
	 * Get the instance of a class and store it in itself.
	 *
	 * @since 1.4.8
	 */
	public static function get_instance() {

		static $instance;

		if ( ! $instance ) {
			$instance = new Loader();
		}

		return $instance;
	}

	/**
	 * Loader constructor.
	 *
	 * @since 1.4.8
	 */
	public function __construct() {

		$core_integrations = array(
			new Gutenberg\FormSelector(),
			new WPMailSMTP\Notifications(),
		);

		$integrations = \apply_filters( 'wpforms_integrations_available', $core_integrations );

		foreach ( $integrations as $integration ) {
			$this->load_integration( $integration );
		}
	}

	/**
	 * Load an integration.
	 *
	 * @param IntegrationInterface $integration Instance of an integration class.
	 *
	 * @since 1.4.8
	 */
	protected function load_integration( IntegrationInterface $integration ) {
		if ( $integration->allow_load() ) {
			$integration->load();
		}
	}
}
.htaccess000066600000000424151130523410006341 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>WPMailSMTP/Notifications.php000066600000005370151130523410011727 0ustar00<?php

namespace WPForms\Integrations\WPMailSMTP;

use WPForms\Integrations\IntegrationInterface;

/**
 * WP Mail SMTP hints inside form builder notifications.
 *
 * @package    WPForms\Integrations\Gutenberg
 * @author     WPForms
 * @since      1.4.8
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2018, WPForms LLC
 */
class Notifications implements IntegrationInterface {

	/**
	 * WP Mail SMTP options.
	 *
	 * @since 1.4.8
	 *
	 * @var \WPMailSMTP\Options
	 */
	public $options;

	/**
	 * Indicates if current integration is allowed to load.
	 *
	 * @since 1.4.8
	 *
	 * @return bool
	 */
	public function allow_load() {
		return \wpforms_is_admin_page( 'builder' ) && \function_exists( 'wp_mail_smtp' );
	}

	/**
	 * Loads an integration.
	 *
	 * @since 1.4.8
	 */
	public function load() {

		$this->options = new \WPMailSMTP\Options();
		$this->filters();
	}

	/**
	 * Integration filters.
	 *
	 * @since 1.4.8
	 */
	protected function filters() {

		\add_filter( 'wpforms_builder_notifications_from_name_after', array( $this, 'from_name_after' ) );
		\add_filter( 'wpforms_builder_notifications_from_email_after', array( $this, 'from_email_after' ) );
	}

	/**
	 * Display hint if WP Mail SMTP is forcing from name.
	 *
	 * @since 1.4.8
	 *
	 * @param string $after Text displayed after setting.
	 *
	 * @return string
	 */
	public function from_name_after( $after ) {

		if ( ! $this->options->get( 'mail', 'from_name_force' ) ) {
			return $after;
		}

		return sprintf(
			\wp_kses(
				/* translators: %s - URL WP Mail SMTP settings. */
				\__( 'This setting is disabled because you have the "Force From Name" setting enabled in <a href="%s" rel="noopener noreferrer" target="_blank">WP Mail SMTP</a>.', 'wpforms-lite' ),
				array(
					'a' => array(
						'href'   => array(),
						'rel'    => array(),
						'target' => array(),
					),
				)
			),
			\esc_url( \admin_url( 'options-general.php?page=wp-mail-smtp#wp-mail-smtp-setting-row-from_name' ) )
		);
	}

	/**
	 * Display hint if WP Mail SMTP is forcing from email.
	 *
	 * @since 1.4.8
	 *
	 * @param string $after Text displayed after setting.
	 *
	 * @return string
	 */
	public function from_email_after( $after ) {

		if ( ! $this->options->get( 'mail', 'from_email_force' ) ) {
			return $after;
		}

		return sprintf(
			\wp_kses(
				/* translators: %s - URL WP Mail SMTP settings. */
				\__( 'This setting is disabled because you have the "Force From Email" setting enabled in <a href="%s" rel="noopener noreferrer" target="_blank">WP Mail SMTP</a>.', 'wpforms-lite' ),
				array(
					'a' => array(
						'href'   => array(),
						'rel'    => array(),
						'target' => array(),
					),
				)
			),
			\esc_url( \admin_url( 'options-general.php?page=wp-mail-smtp#wp-mail-smtp-setting-row-from_email' ) )
		);
	}
}
WPMailSMTP/.htaccess000066600000000424151130523410010176 0ustar00<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
    Deny from all
</FilesMatch>
</IfModule>IntegrationInterface.php000066600000001053151130523410011357 0ustar00<?php

namespace WPForms\Integrations;

/**
 * Interface IntegrationInterface defines required methods for integrations to work properly.
 *
 * @package    WPForms\Integrations
 * @author     WPForms
 * @since      1.4.8
 * @license    GPL-2.0+
 * @copyright  Copyright (c) 2018, WPForms LLC
 */
interface IntegrationInterface {

	/**
	 * Indicates if current integration is allowed to load.
	 *
	 * @since 1.4.8
	 *
	 * @return bool
	 */
	public function allow_load();

	/**
	 * Loads an integration.
	 *
	 * @since 1.4.8
	 */
	public function load();
}
WpCode.php000066600000006041151143736600006451 0ustar00<?php
namespace AIOSEO\Plugin\Common\Integrations;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Route class for the API.
 *
 * @since 4.3.8
 */
class WpCode {
	/**
	 * Load the WPCode snippets for our desired username or return an empty array if not available.
	 *
	 * @since 4.3.8
	 *
	 * @return array The snippets.
	 */
	public static function loadWpCodeSnippets() {
		$snippets = self::getPlaceholderSnippets();
		if ( function_exists( 'wpcode_get_library_snippets_by_username' ) ) {
			$snippets = wpcode_get_library_snippets_by_username( 'aioseo' );
		}

		return $snippets;
	}

	/**
	 * Checks if the plugin is installed, either the lite or premium version.
	 *
	 * @since 4.3.8
	 *
	 * @return bool True if the plugin is installed.
	 */
	public static function isPluginInstalled() {
		return self::isProInstalled() || self::isLiteInstalled();
	}

	/**
	 * Is the pro plugin installed.
	 *
	 * @since 4.3.8
	 *
	 * @return bool True if the pro plugin is installed.
	 */
	public static function isProInstalled() {
		$installedPlugins = array_keys( get_plugins() );

		return in_array( 'wpcode-premium/wpcode.php', $installedPlugins, true );
	}

	/**
	 * Is the lite plugin installed.
	 *
	 * @since 4.3.8
	 *
	 * @return bool True if the lite plugin is installed.
	 */
	public static function isLiteInstalled() {
		$installedPlugins = array_keys( get_plugins() );

		return in_array( 'insert-headers-and-footers/ihaf.php', $installedPlugins, true );
	}

	/**
	 * Basic check if the plugin is active by looking for the main function.
	 *
	 * @since 4.3.8
	 *
	 * @return bool True if the plugin is active.
	 */
	public static function isPluginActive() {
		return function_exists( 'wpcode' );
	}

	/**
	 * Checks if the plugin is active but needs to be updated by checking if the function to load the
	 * library snippets by username exists.
	 *
	 * @since 4.3.8
	 *
	 * @return bool True if the plugin is active but needs to be updated.
	 */
	public static function pluginNeedsUpdate() {
		return self::isPluginActive() && ! function_exists( 'wpcode_get_library_snippets_by_username' );
	}

	/**
	 * Get placeholder snippets if the WPCode snippets are not available.
	 *
	 * @since 4.3.8
	 *
	 * @return array The placeholder snippets.
	 */
	private static function getPlaceholderSnippets() {
		$snippetTitles = [
			'Disable autogenerated shipping details schema for WooCommerce',
			'Disable SEO Preview feature',
			'Disable Shortcode Parsing in All in One SEO',
			'Enable WooCommerce Product Attributes in Search Appearance',
			'Fix LearnPress conflict that hides AIOSEO tabs on settings pages',
			'Limit Meta Description to 160 characters',
			'Limit SEO Title to 60 characters',
			'Noindex Product Search Pages',
			'Noindex Products under a Product Category',
		];

		$placeholderSnippets = [];
		foreach ( $snippetTitles as $snippetTitle ) {
			// Add placeholder install link so we show a button.
			$placeholderSnippets[] = [
				'title'   => $snippetTitle,
				'install' => 'https://library.wpcode.com/'
			];
		}

		return $placeholderSnippets;
	}
}Semrush.php000066600000013171151143736600006720 0ustar00<?php
namespace AIOSEO\Plugin\Common\Integrations;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class to integrate with the Semrush API.
 *
 * @since 4.0.16
 */
class Semrush {
	/**
	 * The Oauth2 URL.
	 *
	 * @since 4.0.16
	 *
	 * @var string
	 */
	public static $url = 'https://oauth.semrush.com/oauth2/access_token';

	/**
	 * The client ID for the Oauth2 integration.
	 *
	 * @since 4.0.16
	 *
	 * @var string
	 */
	public static $clientId = 'aioseo';

	/**
	 * The client secret for the Oauth2 integration.
	 *
	 * @since 4.0.16
	 *
	 * @var string
	 */
	public static $clientSecret = 'sdDUjYt6umO7sKM7mp4OrN8yeePTOQBy';

	/**
	 * Static method to authenticate the user.
	 *
	 * @since 4.0.16
	 *
	 * @param  string $authorizationCode The authorization code for the Oauth2 authentication.
	 * @return bool                      Whether the user is succesfully authenticated.
	 */
	public static function authenticate( $authorizationCode ) {
		$time     = time();
		$response = wp_remote_post( self::$url, [
			'headers' => [ 'Content-Type' => 'application/json' ],
			'body'    => wp_json_encode( [
				'client_id'     => self::$clientId,
				'client_secret' => self::$clientSecret,
				'grant_type'    => 'authorization_code',
				'code'          => $authorizationCode,
				'redirect_uri'  => 'https://oauth.semrush.com/oauth2/aioseo/success'
			] )
		] );

		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( 200 === $responseCode ) {
			$tokens = json_decode( wp_remote_retrieve_body( $response ) );

			return self::saveTokens( $tokens, $time );
		}

		return false;
	}

	/**
	 * Static method to refresh the tokens once expired.
	 *
	 * @since 4.0.16
	 *
	 * @return bool Whether the tokens were successfully renewed.
	 */
	public static function refreshTokens() {
		$refreshToken = aioseo()->internalOptions->integrations->semrush->refreshToken;
		if ( empty( $refreshToken ) ) {
			self::reset();

			return false;
		}

		$time     = time();
		$response = wp_remote_post( self::$url, [
			'headers' => [ 'Content-Type' => 'application/json' ],
			'body'    => wp_json_encode( [
				'client_id'     => self::$clientId,
				'client_secret' => self::$clientSecret,
				'grant_type'    => 'refresh_token',
				'refresh_token' => $refreshToken
			] )
		] );

		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( 200 === $responseCode ) {
			$tokens = json_decode( wp_remote_retrieve_body( $response ) );

			return self::saveTokens( $tokens, $time );
		}

		return false;
	}

	/**
	 * Clears out the internal options to reset the tokens.
	 *
	 * @since 4.1.5
	 *
	 * @return void
	 */
	private static function reset() {
		aioseo()->internalOptions->integrations->semrush->accessToken  = '';
		aioseo()->internalOptions->integrations->semrush->tokenType    = '';
		aioseo()->internalOptions->integrations->semrush->expires      = '';
		aioseo()->internalOptions->integrations->semrush->refreshToken = '';
	}

	/**
	 * Checks if the token has expired
	 *
	 * @since 4.0.16
	 *
	 * @return boolean Whether or not the token has expired.
	 */
	public static function hasExpired() {
		$tokens = self::getTokens();

		return time() >= $tokens['expires'];
	}

	/**
	 * Returns the tokens.
	 *
	 * @since 4.0.16
	 *
	 * @return array An array of token data.
	 */
	public static function getTokens() {
		return aioseo()->internalOptions->integrations->semrush->all();
	}

	/**
	 * Saves the token options.
	 *
	 * @since 4.0.16
	 *
	 * @param  Object $tokens The tokens object.
	 * @param  string $time   The time set before the request was made.
	 * @return bool           Whether the response was valid and successfully saved.
	 */
	public static function saveTokens( $tokens, $time ) {
		$expectedProps = [
			'access_token',
			'token_type',
			'expires_in',
			'refresh_token'
		];

		// If the oAuth response does not include all expected properties, drop it.
		foreach ( $expectedProps as $prop ) {
			if ( empty( $tokens->$prop ) ) {
				return false;
			}
		}

		// Save the options.
		aioseo()->internalOptions->integrations->semrush->accessToken  = $tokens->access_token;
		aioseo()->internalOptions->integrations->semrush->tokenType    = $tokens->token_type;
		aioseo()->internalOptions->integrations->semrush->expires      = $time + $tokens->expires_in;
		aioseo()->internalOptions->integrations->semrush->refreshToken = $tokens->refresh_token;

		return true;
	}

	/**
	 * API call to get keyphrases from semrush.
	 *
	 * @since 4.0.16
	 *
	 * @param  string      $keyphrase A primary keyphrase.
	 * @param  string      $database  A country database.
	 * @return object|bool            The response object or false if the tokens could not be refreshed.
	 */
	public static function getKeyphrases( $keyphrase, $database ) {
		if ( self::hasExpired() ) {
			$success = self::refreshTokens();
			if ( ! $success ) {
				return false;
			}
		}

		$transientKey = 'semrush_keyphrases_' . $keyphrase . '_' . $database;
		$results      = aioseo()->core->cache->get( $transientKey );

		if ( null !== $results ) {
			return $results;
		}

		$params = [
			'phrase'         => $keyphrase,
			'export_columns' => 'Ph,Nq,Td',
			'database'       => strtolower( $database ),
			'display_limit'  => 10,
			'display_offset' => 0,
			'display_sort'   => 'nq_desc',
			'display_filter' => '%2B|Nq|Lt|1000',
			'access_token'   => aioseo()->internalOptions->integrations->semrush->accessToken
		];

		$url = 'https://oauth.semrush.com/api/v1/keywords/phrase_fullsearch?' . http_build_query( $params );

		$response = wp_remote_get( $url );
		$body     = json_decode( wp_remote_retrieve_body( $response ) );

		aioseo()->core->cache->update( $transientKey, $body );

		return $body;
	}
}BbPress.php000066600000000776151145211140006626 0ustar00<?php
namespace AIOSEO\Plugin\Common\Integrations;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class to integrate with the bbPress plugin.
 *
 * @since 4.8.1
 */
class BbPress {
	/**
	 * Returns whether the current page is a bbPress component page.
	 *
	 * @since 4.8.1
	 *
	 * @return bool Whether the current page is a bbPress component page.
	 */
	public static function isComponentPage() {
		return ! empty( aioseo()->standalone->bbPress->component->templateType );
	}
}BuddyPress.php000066600000010740151145211140007342 0ustar00<?php
namespace AIOSEO\Plugin\Common\Integrations;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class to integrate with the BuddyPress plugin.
 *
 * @since 4.7.6
 */
class BuddyPress {
	/**
	 * Call the callback given by the first parameter.
	 *
	 * @since 4.7.6
	 *
	 * @param  callable   $callback The function to be called.
	 * @param  mixed      ...$args  Zero or more parameters to be passed to the function
	 * @return mixed|null           The function result or null if the function is not callable.
	 */
	public static function callFunc( $callback, ...$args ) {
		if ( is_callable( $callback ) ) {
			return call_user_func( $callback, ...$args );
		}

		return null;
	}

	/**
	 * Returns the BuddyPress email custom post type slug.
	 *
	 * @since 4.7.6
	 *
	 * @return string The BuddyPress email custom post type slug if found or an empty string.
	 */
	public static function getEmailCptSlug() {
		$slug = '';
		if ( aioseo()->helpers->isPluginActive( 'buddypress' ) ) {
			$slug = self::callFunc( 'bp_get_email_post_type' );
		}

		return is_scalar( $slug ) ? strval( $slug ) : '';
	}

	/**
	 * Retrieves the BuddyPress component archive page permalink.
	 *
	 * @since 4.7.6
	 *
	 * @param  string $component The BuddyPress component.
	 * @return string            The component archive page permalink.
	 */
	public static function getComponentArchiveUrl( $component ) {
		switch ( $component ) {
			case 'activity':
				$output = self::callFunc( 'bp_get_activity_directory_permalink' );
				break;
			case 'member':
				$output = self::callFunc( 'bp_get_members_directory_permalink' );
				break;
			case 'group':
				$output = self::callFunc( 'bp_get_groups_directory_url' );
				break;
			default:
				$output = '';
		}

		return is_scalar( $output ) ? strval( $output ) : '';
	}

	/**
	 * Returns the BuddyPress component single page permalink.
	 *
	 * @since 4.7.6
	 *
	 * @param  string $component The BuddyPress component.
	 * @param  mixed  $id        The component ID.
	 * @return string            The component single page permalink.
	 */
	public static function getComponentSingleUrl( $component, $id ) {
		switch ( $component ) {
			case 'activity':
				$output = self::callFunc( 'bp_activity_get_permalink', $id );
				break;
			case 'group':
				$output = self::callFunc( 'bp_get_group_url', $id );
				break;
			case 'member':
				$output = self::callFunc( 'bp_core_get_userlink', $id, false, true );
				break;
			default:
				$output = '';
		}

		return is_scalar( $output ) ? strval( $output ) : '';
	}

	/**
	 * Returns the BuddyPress component edit link.
	 *
	 * @since 4.7.6
	 *
	 * @param  string $component The BuddyPress component.
	 * @param  mixed  $id        The component ID.
	 * @return string            The component edit link.
	 */
	public static function getComponentEditUrl( $component, $id ) {
		switch ( $component ) {
			case 'activity':
				$output = add_query_arg( [
					'page'   => 'bp-activity',
					'aid'    => $id,
					'action' => 'edit'
				], self::callFunc( 'bp_get_admin_url', 'admin.php' ) );
				break;
			case 'group':
				$output = add_query_arg( [
					'page'   => 'bp-groups',
					'gid'    => $id,
					'action' => 'edit'
				], self::callFunc( 'bp_get_admin_url', 'admin.php' ) );
				break;
			case 'member':
				$output = get_edit_user_link( $id );
				break;
			default:
				$output = '';
		}

		return is_scalar( $output ) ? strval( $output ) : '';
	}

	/**
	 * Returns whether the BuddyPress component is active or not.
	 *
	 * @since 4.7.6
	 *
	 * @param  string $component The BuddyPress component.
	 * @return bool              Whether the BuddyPress component is active.
	 */
	public static function isComponentActive( $component ) {
		static $active = [];
		if ( isset( $active[ $component ] ) ) {
			return $active[ $component ];
		}

		switch ( $component ) {
			case 'activity':
				$active[ $component ] = self::callFunc( 'bp_is_active', 'activity' );
				break;
			case 'group':
				$active[ $component ] = self::callFunc( 'bp_is_active', 'groups' );
				break;
			case 'member':
				$active[ $component ] = self::callFunc( 'bp_is_active', 'members' );
				break;
			default:
				$active[ $component ] = false;
		}

		return $active[ $component ];
	}

	/**
	 * Returns whether the current page is a BuddyPress component page.
	 *
	 * @since 4.7.6
	 *
	 * @return bool Whether the current page is a BuddyPress component page.
	 */
	public static function isComponentPage() {
		return ! empty( aioseo()->standalone->buddyPress->component->templateType );
	}
}