diff --git a/bin/deploy-free.sh b/bin/deploy-free.sh index e7ace97df..a5f152cc2 100755 --- a/bin/deploy-free.sh +++ b/bin/deploy-free.sh @@ -24,7 +24,7 @@ mv vk-blocks/ vk-blocks-copy-target/ # Cloneした無料版のディレクトリに移動 cd ./vk-blocks-copy-target/ # コピー先の トップディレクトリ を一旦削除 -rm -rf editor-css/* inc/* lib/* options-css/* src/* +rm -rf editor-css/* inc/* lib/* options-css/* src/* test/* # プロ版のディレクトリに移動 cd ../ diff --git a/inc/vk-blocks-pro/class-vk-blocks-pro-options.php b/inc/vk-blocks-pro/class-vk-blocks-pro-options.php deleted file mode 100644 index 7e27303bd..000000000 --- a/inc/vk-blocks-pro/class-vk-blocks-pro-options.php +++ /dev/null @@ -1,69 +0,0 @@ - array( - 'type' => 'string', - 'default' => 'display', - ), - 'new_faq_accordion' => array( - 'type' => 'string', - 'default' => 'disable', - ), - ); - - /** - * VK Blocks License Option schema - * - * @var array - */ - private $license_key_option_scheme = array( - 'vk_blocks_pro_license_key' => array( - 'type' => 'string', - 'default' => null, - ), - ); - - /** - * Constructor. - */ - private function __construct() { - add_filter( 'vk_blocks_default_options_scheme', array( $this, 'vk_blocks_pro_default_options_scheme' ) ); - } - - /** - * Initialize - * - * @return VK_Blocks_Pro_Options - */ - public static function init() { - // static 宣言しているので既に定義されている場合は $instance に null は入らずに既存のインスタンスのまま. - static $instance = null; - return $instance ? $instance : $instance = new static(); - } - - /** - * Pro Option - */ - public function vk_blocks_pro_default_options_scheme() { - $array = $this->vk_blocks_pro_option_schema; - if ( vk_blocks_is_license_setting() ) { - $array = array_merge( $this->license_key_option_scheme, $this->vk_blocks_pro_option_schema ); - } - return $array; - } -} diff --git a/inc/vk-blocks-pro/vk-blocks-pro-functions.php b/inc/vk-blocks-pro/vk-blocks-pro-functions.php index 06e381e8a..cb44d7d8b 100644 --- a/inc/vk-blocks-pro/vk-blocks-pro-functions.php +++ b/inc/vk-blocks-pro/vk-blocks-pro-functions.php @@ -8,9 +8,6 @@ // Pro 用の管理画面を読み込み. require_once dirname( __FILE__ ) . '/admin-pro/admin-pro.php'; -require_once dirname( __FILE__ ) . '/class-vk-blocks-pro-options.php'; -VK_Blocks_Pro_Options::init(); - /** * Pro 専用のスクリプトの読み込み */ diff --git a/inc/vk-blocks/class-vk-blocks-options.php b/inc/vk-blocks/class-vk-blocks-options.php index c698fbee0..c1e82e5ea 100644 --- a/inc/vk-blocks/class-vk-blocks-options.php +++ b/inc/vk-blocks/class-vk-blocks-options.php @@ -35,15 +35,15 @@ private function __construct() { */ public static function options_scheme() { $default_options_schema = array( - 'balloon_border_width' => array( + 'balloon_border_width' => array( 'type' => 'number', 'default' => 1, ), - 'margin_unit' => array( + 'margin_unit' => array( 'type' => 'string', 'default' => 'rem', ), - 'margin_size' => array( + 'margin_size' => array( 'type' => 'object', 'items' => array( 'xl' => array( @@ -133,13 +133,24 @@ public static function options_scheme() { ), ), ), - 'load_separate_option' => array( + 'load_separate_option' => array( 'type' => 'boolean', 'default' => false, ), + 'vk_blocks_pro_license_key' => array( + 'type' => 'string', + 'default' => null, + ), + 'display_vk_block_template' => array( + 'type' => 'string', + 'default' => 'display', + ), + 'new_faq_accordion' => array( + 'type' => 'string', + 'default' => 'disable', + ), ); - $array = array_merge( $default_options_schema, apply_filters( 'vk_blocks_default_options_scheme', array() ) ); - return $array; + return $default_options_schema; } /** diff --git a/test/phpunit/free/test-get-options-free.php b/test/phpunit/free/test-get-options-free.php deleted file mode 100644 index 6bc6077ab..000000000 --- a/test/phpunit/free/test-get-options-free.php +++ /dev/null @@ -1,141 +0,0 @@ - null, - 'correct' => array( - 'balloon_border_width' => 1, - 'margin_unit' => 'rem', - 'margin_size' => array( - 'xl' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'lg' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'md' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'sm' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'xs' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - ), - 'load_separate_option' => false, - ), - ), - array( - 'option' => array( - 'balloon_border_width' => 2, - 'margin_unit' => 'px', - 'margin_size' => array( - 'xl' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'lg' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'md' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'sm' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'xs' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - ), - 'load_separate_option' => true, - ), - 'correct' => array( - 'balloon_border_width' => 2, - 'margin_unit' => 'px', - 'margin_size' => array( - 'xl' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - 'lg' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'md' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'sm' => array( - 'mobile' => 1, - 'tablet' => 2, - 'pc' => 3, - ), - 'xs' => array( - 'mobile' => null, - 'tablet' => null, - 'pc' => null, - ), - ), - 'load_separate_option' => true, - ), - ), - ); - print PHP_EOL; - print '------------------------------------' . PHP_EOL; - print 'VK_Blocks_Options::get_options()' . PHP_EOL; - print '------------------------------------' . PHP_EOL; - foreach ( $test_data as $test_value ) { - - if ( empty( $test_value['option'] ) ){ - delete_option( 'vk_blocks_options' ); - } else { - update_option( 'vk_blocks_options', $test_value['option'] ); - } - - $return = VK_Blocks_Options::get_options(); - $correct = $test_value['correct']; - - print 'return :'; - print PHP_EOL; - var_dump( $return ); - print PHP_EOL; - print 'correct :'; - print PHP_EOL; - var_dump( $correct ); - print PHP_EOL; - $this->assertSame( $correct, $return ); - - } - } -} diff --git a/test/phpunit/pro/test-vk-blocks-options.php b/test/phpunit/pro/test-vk-blocks-options.php index cb34972a1..8adc21f58 100644 --- a/test/phpunit/pro/test-vk-blocks-options.php +++ b/test/phpunit/pro/test-vk-blocks-options.php @@ -7,172 +7,6 @@ class VKBlocksOptionsTest extends WP_UnitTestCase { - public function test_options_scheme() { - $test_data = array( - // Pro版 マージ - array( - 'option' => array( - 'vk_blocks_pro_license_key' => array( - 'type' => 'string', - 'default' => null, - ), - 'display_vk_block_template' => array( - 'type' => 'string', - 'default' => 'display', - ), - 'new_faq_accordion' => array( - 'type' => 'string', - 'default' => 'disable', - ), - ), - 'correct' => array( - 'balloon_border_width' => array( - 'type' => 'number', - 'default' => 1, - ), - 'margin_unit' => array( - 'type' => 'string', - 'default' => 'rem', - ), - 'margin_size' => array( - 'type' => 'object', - 'items' => array( - 'xl' => array( - 'type' => 'object', - 'items' => array( - 'mobile' => array( - 'type' => 'number', - 'default' => null, - ), - 'tablet' => array( - 'type' => 'number', - 'default' => null, - ), - 'pc' => array( - 'type' => 'number', - 'default' => null, - ), - ), - ), - 'lg' => array( - 'type' => 'object', - 'items' => array( - 'mobile' => array( - 'type' => 'number', - 'default' => null, - ), - 'tablet' => array( - 'type' => 'number', - 'default' => null, - ), - 'pc' => array( - 'type' => 'number', - 'default' => null, - ), - ), - ), - 'md' => array( - 'type' => 'object', - 'items' => array( - 'mobile' => array( - 'type' => 'number', - 'default' => null, - ), - 'tablet' => array( - 'type' => 'number', - 'default' => null, - ), - 'pc' => array( - 'type' => 'number', - 'default' => null, - ), - ), - ), - 'sm' => array( - 'type' => 'object', - 'items' => array( - 'mobile' => array( - 'type' => 'number', - 'default' => null, - ), - 'tablet' => array( - 'type' => 'number', - 'default' => null, - ), - 'pc' => array( - 'type' => 'number', - 'default' => null, - ), - ), - ), - 'xs' => array( - 'type' => 'object', - 'items' => array( - 'mobile' => array( - 'type' => 'number', - 'default' => null, - ), - 'tablet' => array( - 'type' => 'number', - 'default' => null, - ), - 'pc' => array( - 'type' => 'number', - 'default' => null, - ), - ), - ), - ), - ), - 'load_separate_option' => array( - 'type' => 'boolean', - 'default' => false, - ), - 'vk_blocks_pro_license_key' => array( - 'type' => 'string', - 'default' => null, - ), - 'display_vk_block_template' => array( - 'type' => 'string', - 'default' => 'display', - ), - 'new_faq_accordion' => array( - 'type' => 'string', - 'default' => 'disable', - ), - ), - ), - ); - print PHP_EOL; - print '------------------------------------' . PHP_EOL; - print 'options_scheme()' . PHP_EOL; - print '------------------------------------' . PHP_EOL; - foreach ( $test_data as $test_value ) { - if ( ! empty( $test_value['option'] ) ){ - $array = isset( $test_value['option'] ) ? $test_value['option'] : null; - add_filter( - 'vk_blocks_default_options_scheme', - function() use( $array ) { - return $array; - } - ); - } - $return = VK_Blocks_Options::options_scheme(); - $correct = $test_value['correct']; - - // print 'return :'; - // print PHP_EOL; - // var_dump( $return ); - // print PHP_EOL; - // print 'correct :'; - // print PHP_EOL; - // var_dump( $correct ); - // print PHP_EOL; - $this->assertSame( $correct, $return ); - - } - } - public function test_balloon_image_number() { $test_data = array( array(