Initial commit: WordPress wp-content (themes, plugins, languages)

- Theme: momentry (custom theme with REST API routes)
- Plugins: code-snippets (contains all API proxies)
- Languages: zh_TW translations
- Excludes: cache, backups, uploads, logs
This commit is contained in:
OpenCode
2026-05-29 19:07:56 +08:00
commit 09ef1f000f
6521 changed files with 867163 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
<?php
namespace WPMailSMTP\Compatibility;
use WPMailSMTP\Compatibility\Plugin\WPML;
use WPMailSMTP\Compatibility\Plugin\WPForms;
use WPMailSMTP\Compatibility\Plugin\Polylang;
use WPMailSMTP\Compatibility\Plugin\Admin2020;
use WPMailSMTP\Compatibility\Plugin\PolylangPro;
use WPMailSMTP\Compatibility\Plugin\WooCommerce;
use WPMailSMTP\Compatibility\Plugin\WPFormsLite;
use WPMailSMTP\Compatibility\Plugin\PluginAbstract;
/**
* Compatibility.
* Class for managing compatibility with other plugins.
*
* @since 2.8.0
*/
class Compatibility {
/**
* Initialized compatibility plugins.
*
* @since 2.8.0
*
* @var array
*/
protected $plugins = [];
/**
* Initialize class.
*
* @since 2.8.0
*/
public function init() {
$this->setup_compatibility();
}
/**
* Setup compatibility plugins.
*
* @since 2.8.0
*/
public function setup_compatibility() {
$plugins = [
'admin-2020' => Admin2020::class,
'wpforms-lite' => WPFormsLite::class,
'wpforms' => WPForms::class,
'woocommerce' => WooCommerce::class,
'wpml' => WPML::class,
'polylang' => Polylang::class,
'polylang-pro' => PolylangPro::class,
];
foreach ( $plugins as $key => $classname ) {
if ( class_exists( $classname ) && is_callable( [ $classname, 'is_applicable' ] ) ) {
if ( $classname::is_applicable() ) {
$this->plugins[ $key ] = new $classname();
}
}
}
}
/**
* Get compatibility plugin.
*
* @since 2.8.0
*
* @param string $key Plugin key.
*
* @return PluginAbstract|false
*/
public function get_plugin( $key ) {
return isset( $this->plugins[ $key ] ) ? $this->plugins[ $key ] : false;
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
use WPMailSMTP\WP;
/**
* Admin 2020 Lite compatibility plugin.
*
* @since 2.8.0
*/
class Admin2020 extends PluginAbstract {
/**
* If plugin can be loaded.
*
* @since 4.0.0
*
* @return bool
*/
public static function is_applicable() {
return parent::is_applicable() && WP::in_wp_admin();
}
/**
* Get plugin name.
*
* @since 2.8.0
*
* @return string
*/
public static function get_name() {
return 'Admin 2020';
}
/**
* Get plugin path.
*
* @since 2.8.0
*
* @return string
*/
public static function get_path() {
return 'admin-2020/admin-2020.php';
}
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin() {
add_action( 'wp_mail_smtp_admin_setup_wizard_load_setup_wizard_before', [ $this, 'disable_admin_bar' ] );
}
/**
* Disable admin bar on Setup Wizard page.
*
* @since 2.8.0
*/
public function disable_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar = ''; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
use WPMailSMTP\WP;
/**
* Compatibility plugin.
*
* @since 2.8.0
*/
abstract class PluginAbstract implements PluginInterface {
/**
* Class constructor.
*
* @since 2.8.0
*/
public function __construct() {
add_action( 'init', [ $this, 'load' ], 0 );
if ( WP::in_wp_admin() ) {
add_action( 'init', [ $this, 'load_admin' ], 0 );
}
$this->after_plugins_loaded();
}
/**
* Is plugin can be loaded.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_applicable() {
return static::is_activated();
}
/**
* Is plugin activated.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_activated() {
return WP::is_plugin_activated( static::get_path() );
}
/**
* Execute after plugins loaded.
*
* @since 2.8.0
*/
public function after_plugins_loaded() {
}
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin() {
}
/**
* Execute on init action.
*
* @since 2.8.0
*/
public function load() {
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* Compatibility plugin interface.
*
* @since 2.8.0
*/
interface PluginInterface {
/**
* Is plugin can be loaded.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_applicable();
/**
* Is plugin activated.
*
* @since 2.8.0
*
* @return bool
*/
public static function is_activated();
/**
* Execute after plugins loaded.
*
* @since 2.8.0
*/
public function after_plugins_loaded();
/**
* Execute on init action in admin area.
*
* @since 2.8.0
*/
public function load_admin();
/**
* Execute on init action.
*
* @since 2.8.0
*/
public function load();
/**
* Get plugin name.
*
* @since 2.8.0
*
* @return string
*/
public static function get_name();
/**
* Get plugin path.
*
* @since 2.8.0
*
* @return string
*/
public static function get_path();
}

View File

@@ -0,0 +1,65 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* Polylang compatibility plugin.
*
* @since 4.6.0
*/
class Polylang extends PluginAbstract {
/**
* Class constructor.
*
* @since 4.6.0
*/
public function __construct() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
add_action( 'pll_init', [ $this, 'load' ], PHP_INT_MAX );
}
/**
* Get plugin name.
*
* @since 4.6.0
*
* @return string
*/
public static function get_name() {
return 'Polylang';
}
/**
* Get plugin path.
*
* @since 4.6.0
*
* @return string
*/
public static function get_path() {
return 'polylang/polylang.php';
}
/**
* Execute after the Polylang plugin is loaded.
*
* @since 4.6.0
*/
public function load() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if (
! function_exists( 'PLL' ) ||
! property_exists( PLL(), 'options' ) ||
! isset( PLL()->options['force_lang'] ) ||
PLL()->options['force_lang'] !== 3
) {
return;
}
// Use unfiltered site URL for multidomain setup.
add_filter( 'wp_mail_smtp_wp_get_site_url_unfiltered', '__return_true' );
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* Polylang compatibility plugin.
*
* @since 4.6.0
*/
class PolylangPro extends Polylang {
/**
* Get plugin name.
*
* @since 4.6.0
*
* @return string
*/
public static function get_name() {
return 'Polylang Pro';
}
/**
* Get plugin path.
*
* @since 4.6.0
*
* @return string
*/
public static function get_path() {
return 'polylang-pro/polylang.php';
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* WPForms compatibility plugin.
*
* @since 4.0.0
*/
class WPForms extends WPFormsLite {
/**
* Get plugin name.
*
* @since 4.0.0
*
* @return string
*/
public static function get_name() {
return 'WPForms';
}
/**
* Get plugin path.
*
* @since 4.0.0
*
* @return string
*/
public static function get_path() {
return 'wpforms/wpforms.php';
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* WPForms Lite compatibility plugin.
*
* @since 4.0.0
*/
class WPFormsLite extends PluginAbstract {
/**
* Get plugin name.
*
* @since 4.0.0
*
* @return string
*/
public static function get_name() {
return 'WPForms Lite';
}
/**
* Get plugin path.
*
* @since 4.0.0
*
* @return string
*/
public static function get_path() {
return 'wpforms-lite/wpforms.php';
}
/**
* Execute on init action.
*
* @since 4.0.0
*/
public function load() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if ( wp_mail_smtp()->get_queue()->is_enabled() ) {
add_filter( 'wpforms_tasks_entry_emails_trigger_send_same_process', '__return_true', PHP_INT_MAX );
}
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
use SitePress;
/**
* WPML compatibility plugin.
*
* @since 4.6.0
*/
class WPML extends PluginAbstract {
/**
* Class constructor.
*
* @since 4.6.0
*/
public function __construct() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
add_action( 'wpml_loaded', [ $this, 'load' ], PHP_INT_MAX );
}
/**
* Get plugin name.
*
* @since 4.6.0
*
* @return string
*/
public static function get_name() {
return 'WPML Multilingual CMS';
}
/**
* Get plugin path.
*
* @since 4.6.0
*
* @return string
*/
public static function get_path() {
return 'sitepress-multilingual-cms/sitepress.php';
}
/**
* Execute after the WPML plugin is loaded.
*
* @param SitePress $wpml The WPML instance.
*
* @since 4.6.0
*/
public function load( $wpml = null ) { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if (
! $wpml instanceof SitePress ||
! method_exists( $wpml, 'get_setting' ) ||
! defined( 'WPML_LANGUAGE_NEGOTIATION_TYPE_DOMAIN' ) ||
WPML_LANGUAGE_NEGOTIATION_TYPE_DOMAIN !== (int) $wpml->get_setting( 'language_negotiation_type' )
) {
return;
}
// Use unfiltered site URL for multidomain setup.
add_filter( 'wp_mail_smtp_wp_get_site_url_unfiltered', '__return_true' );
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace WPMailSMTP\Compatibility\Plugin;
/**
* WooCommerce compatibility plugin.
*
* @since 4.0.0
*/
class WooCommerce extends PluginAbstract {
/**
* Get plugin name.
*
* @since 4.0.0
*
* @return string
*/
public static function get_name() {
return 'WooCommerce';
}
/**
* Get plugin path.
*
* @since 4.0.0
*
* @return string
*/
public static function get_path() {
return 'woocommerce/woocommerce.php';
}
/**
* Execute on init action.
*
* @since 4.0.0
*/
public function load() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
if ( wp_mail_smtp()->get_queue()->is_enabled() ) {
add_filter( 'woocommerce_defer_transactional_emails', '__return_false', PHP_INT_MAX );
}
}
}