| Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/ |
| Current File : /home/x/b/o/xbodynamge/namtation/wp-content/WpCode.php.tar |
xbodynamge/namtation/wp-content/plugins/all-in-one-seo-pack/app/Common/Api/Integrations/WpCode.php 0000644 00000001656 15112030617 0030043 0 ustar 00 home <?php
namespace AIOSEO\Plugin\Common\Api\Integrations;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Integrations\WpCode as WpCodeIntegration;
/**
* Route class for the API.
*
* @since 4.3.8
*/
class WpCode {
/**
* Load the WPCode Snippets from the library, if available.
*
* @since 4.3.8
*
* @param \WP_REST_Request $request The REST Request
* @return \WP_REST_Response The response.
*/
public static function getSnippets( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
return new \WP_REST_Response( [
'success' => true,
'snippets' => WpCodeIntegration::loadWpCodeSnippets(),
'pluginInstalled' => WpCodeIntegration::isPluginInstalled(),
'pluginActive' => WpCodeIntegration::isPluginActive(),
'pluginNeedsUpdate' => WpCodeIntegration::pluginNeedsUpdate()
], 200 );
}
} home/xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/Common/Standalone/WpCode.php 0000644 00000001354 15113676442 0025627 0 ustar 00 <?php
namespace AIOSEO\Plugin\Common\Standalone;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Handles registering the AIOSEO username in the WPCode snippets library.
*
* @since 4.3.8
*/
class WpCode {
/**
* Class constructor.
*
* @since 4.3.8
*/
public function __construct() {
if ( ! is_admin() || wp_doing_ajax() || wp_doing_cron() ) {
return;
}
add_action( 'wpcode_loaded', [ $this, 'registerUsername' ] );
}
/**
* Enqueues the script.
*
* @since 4.3.8
*
* @return void
*/
public function registerUsername() {
if ( ! function_exists( 'wpcode_register_library_username' ) ) {
return;
}
wpcode_register_library_username( 'aioseo', AIOSEO_PLUGIN_SHORT_NAME );
}
} home/xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/Common/Api/Integrations/WpCode.php 0000644 00000001656 15113716577 0026727 0 ustar 00 <?php
namespace AIOSEO\Plugin\Common\Api\Integrations;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AIOSEO\Plugin\Common\Integrations\WpCode as WpCodeIntegration;
/**
* Route class for the API.
*
* @since 4.3.8
*/
class WpCode {
/**
* Load the WPCode Snippets from the library, if available.
*
* @since 4.3.8
*
* @param \WP_REST_Request $request The REST Request
* @return \WP_REST_Response The response.
*/
public static function getSnippets( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
return new \WP_REST_Response( [
'success' => true,
'snippets' => WpCodeIntegration::loadWpCodeSnippets(),
'pluginInstalled' => WpCodeIntegration::isPluginInstalled(),
'pluginActive' => WpCodeIntegration::isPluginActive(),
'pluginNeedsUpdate' => WpCodeIntegration::pluginNeedsUpdate()
], 200 );
}
} home/xbodynamge/dev/wp-content/plugins/all-in-one-seo-pack/app/Common/Integrations/WpCode.php 0000644 00000006041 15114332262 0026171 0 ustar 00 <?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;
}
} home/xbodynamge/namtation/wp-content/plugins/all-in-one-seo-pack/app/Common/Integrations/WpCode.php 0000644 00000006041 15114443404 0027406 0 ustar 00 <?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;
}
}