chore: initial snapshot of 2meet-data-optimizer-quotation-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:
2026-07-31 05:06:36 +08:00
commit 31c23b64ff
14 changed files with 2606 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
/**
* Bootstrap for 2meet Data Optimizer Quotation AddOn.
*
* @package TMDO_QUOTATION
* @since 0.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
final class TMDO_Quotation_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-quotation',
false,
dirname( plugin_basename( TMDO_QUOTATION_FILE ) ) . '/languages'
);
require_once TMDO_QUOTATION_PATH . 'includes/class-tmdo-quotation.php';
if ( class_exists( 'TMDO_Quotation' ) && method_exists( 'TMDO_Quotation', 'register' ) ) {
TMDO_Quotation::register();
}
}
public static function missing_core_notice(): void {
echo '<div class="notice notice-error"><p>';
echo esc_html__( '2meet Data Optimizer Quotation AddOn 需要 2meet-data-optimizer 核心外掛,請先安裝並啟用。', 'tmdo-quotation' );
echo '</p></div>';
}
}
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* TMDO_Quotation — integration with 2meet-quotation (Wave 2 / v2.1.0).
*
* 2meet-quotation 採全 flat-custom-table 架構(8 張 wp_2mq_* 表),無 postmeta
* 依賴。本整合僅將其表登記到 Custom_Table_Registry,讓 wp wpdo doctor 與
* benchmark 涵蓋。
*
* @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-quotation 整合。
*/
final class TMDO_Quotation {
public static function register(): void {
$detected = class_exists( 'TMQUO_Main' )
|| class_exists( 'TMQUO_Plugin' )
|| file_exists( WP_PLUGIN_DIR . '/2meet-quotation/2meet-quotation.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(
'2mq_quotations' => array( 'id', 'hp_vendor' ), // vendor_id 關聯 hp_vendor
'2mq_quotation_items' => array( 'id', null ),
'2mq_quotation_history' => array( 'id', null ),
'2mq_vendor_presets' => array( 'id', 'hp_vendor' ),
'2mq_catalog_categories' => array( 'id', null ),
'2mq_catalog_items' => array( 'id', null ),
'2mq_quotation_templates' => array( 'id', null ),
'2mq_vendor_catalog_prices' => array( 'id', 'hp_vendor' ),
);
foreach ( $tables as $table_name => $meta ) {
$registry->register(
'2meet-quotation',
array(
'table_name' => $table_name,
'primary_key' => $meta[0],
'post_type_link' => $meta[1],
)
);
}
}
}