chore: initial snapshot of 2meet-data-optimizer-playlist-addon v0.1.0
Baseline before backporting wp-data-optimizer v3.0.1-v3.4.6. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Bootstrap for 2meet Data Optimizer Playlist AddOn.
|
||||
*
|
||||
* @package TMDO_PLAYLIST
|
||||
* @since 0.1.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
final class TMDO_Playlist_Bootstrap {
|
||||
|
||||
public static function init(): void {
|
||||
if ( ! class_exists( 'TMDO_API' ) && ! class_exists( 'WPDO_API' ) ) {
|
||||
add_action( 'admin_notices', array( __CLASS__, 'missing_core_notice' ) );
|
||||
return;
|
||||
}
|
||||
|
||||
load_plugin_textdomain(
|
||||
'tmdo-playlist',
|
||||
false,
|
||||
dirname( plugin_basename( TMDO_PLAYLIST_FILE ) ) . '/languages'
|
||||
);
|
||||
|
||||
require_once TMDO_PLAYLIST_PATH . 'includes/class-tmdo-playlist.php';
|
||||
|
||||
if ( class_exists( 'TMDO_Playlist' ) && method_exists( 'TMDO_Playlist', 'register' ) ) {
|
||||
TMDO_Playlist::register();
|
||||
}
|
||||
}
|
||||
|
||||
public static function missing_core_notice(): void {
|
||||
echo '<div class="notice notice-error"><p>';
|
||||
echo esc_html__( '2meet Data Optimizer Playlist AddOn 需要 2meet-data-optimizer 核心外掛,請先安裝並啟用。', 'tmdo-playlist' );
|
||||
echo '</p></div>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* TMDO_Playlist — integration with 2meet-playlist (Wave 3 / v2.2.0).
|
||||
*
|
||||
* 5 張表的歌單系統。註冊全部 + 含 fulltext index 的 2mpl_songs 適合
|
||||
* benchmark / doctor 觀察。
|
||||
*
|
||||
* @package WP_Data_Optimizer
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// phpcs:disable Squiz.Commenting.FunctionComment.Missing,Squiz.Commenting.InlineComment.InvalidEndChar,Generic.Commenting.DocComment.MissingShort,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.PHP.YodaConditions,Generic.CodeAnalysis.EmptyStatement -- v2.0.0 partner integrations: pure registration helpers + intentional silent catches.
|
||||
|
||||
/**
|
||||
* 2meet-playlist 整合。
|
||||
*/
|
||||
final class TMDO_Playlist {
|
||||
|
||||
public static function register(): void {
|
||||
$detected = class_exists( 'TMPL_Main' )
|
||||
|| class_exists( 'TMPL_Plugin' )
|
||||
|| file_exists( WP_PLUGIN_DIR . '/2meet-playlist/2meet-playlist.php' );
|
||||
if ( ! $detected ) {
|
||||
return;
|
||||
}
|
||||
add_action( 'wpdo_register_custom_tables', array( __CLASS__, 'register_custom_tables' ) );
|
||||
}
|
||||
|
||||
public static function register_custom_tables( TMDO_Custom_Table_Registry $registry ): void {
|
||||
$tables = array(
|
||||
'2mpl_singer_settings' => array( 'id', 'hp_vendor' ),
|
||||
'2mpl_songs' => array( 'id', null ),
|
||||
'2mpl_queue' => array( 'id', null ),
|
||||
'2mpl_rate_limits' => array( 'id', null ),
|
||||
'2mpl_sessions' => array( 'id', null ),
|
||||
);
|
||||
foreach ( $tables as $table_name => $meta ) {
|
||||
$registry->register(
|
||||
'2meet-playlist',
|
||||
array(
|
||||
'table_name' => $table_name,
|
||||
'primary_key' => $meta[0],
|
||||
'post_type_link' => $meta[1],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user