Plugin Directory

Changeset 3405600


Ignore:
Timestamp:
11/29/2025 04:57:44 AM (3 months ago)
Author:
codoc
Message:

0.9.57

Location:
codoc
Files:
6 added
4 edited
60 copied

Legend:

Unmodified
Added
Removed
  • codoc/tags/0.9.57/class-codoc.php

    r3404641 r3405600  
    5050            // Gutenberg のサポートがない場合は何もしない
    5151            if ( function_exists( 'register_block_type' ) )  {
    52                 // WPに登録ブロックとして認識させる(cgbは登録しないっぽい)
    53                 \WP_Block_Type_Registry::get_instance()->register('codoc/codoc-block');
    54                 // gutenberg
     52                // gutenberg - init.php handles all block registration and script enqueuing
    5553                require_once 'src/init.php';
    56                 add_action('wp_loaded', function() {
    57                     $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
    58                     wp_localize_script('codoc-block-js', 'OPTIONS', array(
    59                         'codoc_url'      => $this->get_codoc_url(),
    60                         'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
    61                         'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
    62                         'codoc_sdk_path'       => CODOC_SDK_PATH,
    63                         'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
    64                         'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
    65                         'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
    66                     ));
    67                     wp_set_script_translations('codoc-block-js', 'codoc',plugin_dir_path( __FILE__ ) . 'languages');
    68                 });
    6954            }
    7055            // tinymce
  • codoc/tags/0.9.57/codoc.php

    r3405195 r3405600  
    66Author:      codoc.jp
    77Author URI:  https://codoc.jp
    8 Version:     0.9.56.5
     8Version:     0.9.57
    99License:     GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 const CODOC_PLUGIN_VERSION        = '0.9.56.5';
     16const CODOC_PLUGIN_VERSION        = '0.9.57';
    1717const CODOC_URL                   = 'https://codoc.jp';
    1818const CODOC_USERCODE_OPTION_NAME  = 'codoc_usercode';
  • codoc/tags/0.9.57/readme.txt

    r3405195 r3405600  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 0.9.56.5
     7Stable tag: 0.9.57
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    1414== Description ==
    1515
    16 [codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer **Reader Plans (Subscription / Membership)**, and accept tips.
     16[codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer Reader Plans (Subscription / Membership), and accept tips.
    1717
    1818Originally built for Japanese creators, codoc is also fully compatible with users in the US/EU. 
    19 Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: USD/EUR).
    20 
    21 After setup, the plugin adds a **codoc block※** to the post editor. 
     19Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: JPY/USD/EUR).
     20
     21After setup, the plugin adds a codoc block※ to the post editor. 
    2222※Compatible with both Gutenberg and the Classic Editor (TinyMCE).
    2323
     
    4242- Article paywall 
    4343- One-time purchases 
    44 - **Reader Plans (Subscription / Membership)** 
     44- Reader Plans (Subscription / Membership)
    4545- Tipping support 
    4646- Stripe payments (Credit card / Apple Pay / Google Pay / BNPL) 
     
    6767
    6868= What are the requirements for creators to use codoc? =
    69 Creators must have a residence and bank account in **Japan or the United States**.
    70 
    71 = Can users outside Japan purchase content? =
     69Creators must reside in **Japan, the United States, or the EU** and have a bank account in each country.
     70
     71= Can users outside Supported coutry purchase content? =
    7272Yes. Anyone with a valid credit card can purchase. 
    73 Transactions are processed in **JPY**.
     73Transactions are processed in **JPY, USD or EUR** .
    7474
    7575= Where are article contents stored? =
     
    8585
    8686= How can I preview the article as buyers/non-buyers? =
    87 - As buyer: Click **"Already purchased, log in"** and authenticate with your codoc account. 
     87- As buyer: Click **"Sign in to restore purchase"** and authenticate with your codoc account. 
    8888- As non-buyer: Log out and view the article normally.
    8989
     
    120120= Do script tags work? =
    121121Yes. 
    122 External script tags have been supported since April 22, 2020 (Twitter/Instagram embeds, etc.)
     122External script tags have been supported. (Twitter/Instagram embeds, etc.)
    123123
    124124= I want to add buttons at the end of the article =
  • codoc/tags/0.9.57/src/init.php

    r2923260 r3405600  
    1515
    1616/**
    17  * Enqueue Gutenberg block assets for both frontend + backend.
    18  *
    19  * Assets enqueued:
    20  * 1. blocks.style.build.css - Frontend + Backend.
    21  * 2. blocks.build.js - Backend.
    22  * 3. blocks.editor.build.css - Backend.
     17 * Enqueue Gutenberg block assets for backend editor.
    2318 *
    2419 * @uses {wp-blocks} for block type registration & related functions.
     
    2823 * @since 1.0.0
    2924 */
    30 function wordpress_cgb_block_assets() { // phpcs:ignore
    31     // Register block styles for both frontend + backend.
    32     wp_register_style(
    33         'codoc-style-css', // Handle.
    34         plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
    35         array( 'wp-editor' ), // Dependency to include the CSS after it.
    36         null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    37     );
    38 
    39     // Register block editor script for backend.
    40     wp_register_script(
     25function wordpress_cgb_block_editor_assets() { // phpcs:ignore
     26    // Scripts and styles for editor only
     27    wp_enqueue_script(
    4128        'codoc-block-js', // Handle.
    4229        plugins_url( '/dist/blocks.build.js?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
     
    4532        true // Enqueue the script in the footer.
    4633    );
    47    
    48     // Register block editor styles for backend.
    49     wp_register_style(
     34
     35    // Pass necessary options to JavaScript
     36    global $_CODOC;
     37    $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
     38
     39    wp_localize_script('codoc-block-js', 'OPTIONS', array(
     40        'codoc_url'      => $_CODOC->get_codoc_url(),
     41        'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
     42        'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
     43        'codoc_sdk_path'       => defined('CODOC_SDK_PATH') ? CODOC_SDK_PATH : '/sdk/js/sdk.v1.js',
     44        'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
     45        'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
     46        'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
     47    ));
     48
     49    // Set script translations
     50    wp_set_script_translations('codoc-block-js', 'codoc', plugin_dir_path( dirname(__FILE__) ) . 'languages');
     51
     52    // Styles for editor only
     53    wp_enqueue_style(
    5054        'codoc-block-editor-css', // Handle.
    5155        plugins_url( 'dist/blocks.editor.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block editor CSS.
     
    5357        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
    5458    );
     59}
    5560
    56     /**
    57      * Register Gutenberg block on server-side.
    58      *
    59      * Register the block on server-side to ensure that the block
    60      * scripts and styles for both frontend and backend are
    61      * enqueued when the editor loads.
    62      *
    63      * @link https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type#enqueuing-block-scripts
    64      * @since 1.16.0
    65      */
    66     register_block_type(
    67         'cgb/block-wordpress', array(
    68             // Enqueue blocks.style.build.css on both frontend & backend.
    69             'style'         => 'codoc-style-css',
    70             // Enqueue blocks.build.js in the editor only.
    71             'editor_script' => 'codoc-block-js',
    72             // Enqueue blocks.editor.build.css in the editor only.
    73             'editor_style'  => 'codoc-block-editor-css',
    74         )
     61// Hook: Editor assets.
     62add_action( 'enqueue_block_editor_assets', 'wordpress_cgb_block_editor_assets' );
     63
     64/**
     65 * Enqueue Gutenberg block assets for frontend.
     66 *
     67 * @since 1.0.0
     68 */
     69function wordpress_cgb_block_frontend_assets() { // phpcs:ignore
     70    // Styles for frontend
     71    wp_enqueue_style(
     72        'codoc-style-css', // Handle.
     73        plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
     74        array( 'wp-editor' ), // Dependency to include the CSS after it.
     75        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    7576    );
    7677}
    7778
    78 // Hook: Block assets.
    79 add_action( 'init', 'wordpress_cgb_block_assets' );
     79// Hook: Frontend assets.
     80add_action( 'enqueue_block_assets', 'wordpress_cgb_block_frontend_assets' );
  • codoc/tags/0.9.57/trunk/class-codoc.php

    r3404641 r3405600  
    5050            // Gutenberg のサポートがない場合は何もしない
    5151            if ( function_exists( 'register_block_type' ) )  {
    52                 // WPに登録ブロックとして認識させる(cgbは登録しないっぽい)
    53                 \WP_Block_Type_Registry::get_instance()->register('codoc/codoc-block');
    54                 // gutenberg
     52                // gutenberg - init.php handles all block registration and script enqueuing
    5553                require_once 'src/init.php';
    56                 add_action('wp_loaded', function() {
    57                     $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
    58                     wp_localize_script('codoc-block-js', 'OPTIONS', array(
    59                         'codoc_url'      => $this->get_codoc_url(),
    60                         'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
    61                         'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
    62                         'codoc_sdk_path'       => CODOC_SDK_PATH,
    63                         'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
    64                         'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
    65                         'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
    66                     ));
    67                     wp_set_script_translations('codoc-block-js', 'codoc',plugin_dir_path( __FILE__ ) . 'languages');
    68                 });
    6954            }
    7055            // tinymce
  • codoc/tags/0.9.57/trunk/codoc.php

    r3405195 r3405600  
    66Author:      codoc.jp
    77Author URI:  https://codoc.jp
    8 Version:     0.9.56.5
     8Version:     0.9.57
    99License:     GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 const CODOC_PLUGIN_VERSION        = '0.9.56.5';
     16const CODOC_PLUGIN_VERSION        = '0.9.57';
    1717const CODOC_URL                   = 'https://codoc.jp';
    1818const CODOC_USERCODE_OPTION_NAME  = 'codoc_usercode';
  • codoc/tags/0.9.57/trunk/readme.txt

    r3405195 r3405600  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 0.9.56.5
     7Stable tag: 0.9.57
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    1414== Description ==
    1515
    16 [codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer **Reader Plans (Subscription / Membership)**, and accept tips.
     16[codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer Reader Plans (Subscription / Membership), and accept tips.
    1717
    1818Originally built for Japanese creators, codoc is also fully compatible with users in the US/EU. 
    19 Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: USD/EUR).
    20 
    21 After setup, the plugin adds a **codoc block※** to the post editor. 
     19Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: JPY/USD/EUR).
     20
     21After setup, the plugin adds a codoc block※ to the post editor. 
    2222※Compatible with both Gutenberg and the Classic Editor (TinyMCE).
    2323
     
    4242- Article paywall 
    4343- One-time purchases 
    44 - **Reader Plans (Subscription / Membership)** 
     44- Reader Plans (Subscription / Membership)
    4545- Tipping support 
    4646- Stripe payments (Credit card / Apple Pay / Google Pay / BNPL) 
     
    6767
    6868= What are the requirements for creators to use codoc? =
    69 Creators must have a residence and bank account in **Japan or the United States**.
    70 
    71 = Can users outside Japan purchase content? =
     69Creators must reside in **Japan, the United States, or the EU** and have a bank account in each country.
     70
     71= Can users outside Supported coutry purchase content? =
    7272Yes. Anyone with a valid credit card can purchase. 
    73 Transactions are processed in **JPY**.
     73Transactions are processed in **JPY, USD or EUR** .
    7474
    7575= Where are article contents stored? =
     
    8585
    8686= How can I preview the article as buyers/non-buyers? =
    87 - As buyer: Click **"Already purchased, log in"** and authenticate with your codoc account. 
     87- As buyer: Click **"Sign in to restore purchase"** and authenticate with your codoc account. 
    8888- As non-buyer: Log out and view the article normally.
    8989
     
    120120= Do script tags work? =
    121121Yes. 
    122 External script tags have been supported since April 22, 2020 (Twitter/Instagram embeds, etc.)
     122External script tags have been supported. (Twitter/Instagram embeds, etc.)
    123123
    124124= I want to add buttons at the end of the article =
  • codoc/tags/0.9.57/trunk/src/init.php

    r2923260 r3405600  
    1515
    1616/**
    17  * Enqueue Gutenberg block assets for both frontend + backend.
    18  *
    19  * Assets enqueued:
    20  * 1. blocks.style.build.css - Frontend + Backend.
    21  * 2. blocks.build.js - Backend.
    22  * 3. blocks.editor.build.css - Backend.
     17 * Enqueue Gutenberg block assets for backend editor.
    2318 *
    2419 * @uses {wp-blocks} for block type registration & related functions.
     
    2823 * @since 1.0.0
    2924 */
    30 function wordpress_cgb_block_assets() { // phpcs:ignore
    31     // Register block styles for both frontend + backend.
    32     wp_register_style(
    33         'codoc-style-css', // Handle.
    34         plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
    35         array( 'wp-editor' ), // Dependency to include the CSS after it.
    36         null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    37     );
    38 
    39     // Register block editor script for backend.
    40     wp_register_script(
     25function wordpress_cgb_block_editor_assets() { // phpcs:ignore
     26    // Scripts and styles for editor only
     27    wp_enqueue_script(
    4128        'codoc-block-js', // Handle.
    4229        plugins_url( '/dist/blocks.build.js?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
     
    4532        true // Enqueue the script in the footer.
    4633    );
    47    
    48     // Register block editor styles for backend.
    49     wp_register_style(
     34
     35    // Pass necessary options to JavaScript
     36    global $_CODOC;
     37    $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
     38
     39    wp_localize_script('codoc-block-js', 'OPTIONS', array(
     40        'codoc_url'      => $_CODOC->get_codoc_url(),
     41        'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
     42        'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
     43        'codoc_sdk_path'       => defined('CODOC_SDK_PATH') ? CODOC_SDK_PATH : '/sdk/js/sdk.v1.js',
     44        'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
     45        'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
     46        'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
     47    ));
     48
     49    // Set script translations
     50    wp_set_script_translations('codoc-block-js', 'codoc', plugin_dir_path( dirname(__FILE__) ) . 'languages');
     51
     52    // Styles for editor only
     53    wp_enqueue_style(
    5054        'codoc-block-editor-css', // Handle.
    5155        plugins_url( 'dist/blocks.editor.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block editor CSS.
     
    5357        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
    5458    );
     59}
    5560
    56     /**
    57      * Register Gutenberg block on server-side.
    58      *
    59      * Register the block on server-side to ensure that the block
    60      * scripts and styles for both frontend and backend are
    61      * enqueued when the editor loads.
    62      *
    63      * @link https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type#enqueuing-block-scripts
    64      * @since 1.16.0
    65      */
    66     register_block_type(
    67         'cgb/block-wordpress', array(
    68             // Enqueue blocks.style.build.css on both frontend & backend.
    69             'style'         => 'codoc-style-css',
    70             // Enqueue blocks.build.js in the editor only.
    71             'editor_script' => 'codoc-block-js',
    72             // Enqueue blocks.editor.build.css in the editor only.
    73             'editor_style'  => 'codoc-block-editor-css',
    74         )
     61// Hook: Editor assets.
     62add_action( 'enqueue_block_editor_assets', 'wordpress_cgb_block_editor_assets' );
     63
     64/**
     65 * Enqueue Gutenberg block assets for frontend.
     66 *
     67 * @since 1.0.0
     68 */
     69function wordpress_cgb_block_frontend_assets() { // phpcs:ignore
     70    // Styles for frontend
     71    wp_enqueue_style(
     72        'codoc-style-css', // Handle.
     73        plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
     74        array( 'wp-editor' ), // Dependency to include the CSS after it.
     75        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    7576    );
    7677}
    7778
    78 // Hook: Block assets.
    79 add_action( 'init', 'wordpress_cgb_block_assets' );
     79// Hook: Frontend assets.
     80add_action( 'enqueue_block_assets', 'wordpress_cgb_block_frontend_assets' );
  • codoc/trunk/class-codoc.php

    r3404641 r3405600  
    5050            // Gutenberg のサポートがない場合は何もしない
    5151            if ( function_exists( 'register_block_type' ) )  {
    52                 // WPに登録ブロックとして認識させる(cgbは登録しないっぽい)
    53                 \WP_Block_Type_Registry::get_instance()->register('codoc/codoc-block');
    54                 // gutenberg
     52                // gutenberg - init.php handles all block registration and script enqueuing
    5553                require_once 'src/init.php';
    56                 add_action('wp_loaded', function() {
    57                     $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
    58                     wp_localize_script('codoc-block-js', 'OPTIONS', array(
    59                         'codoc_url'      => $this->get_codoc_url(),
    60                         'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
    61                         'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
    62                         'codoc_sdk_path'       => CODOC_SDK_PATH,
    63                         'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
    64                         'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
    65                         'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
    66                     ));
    67                     wp_set_script_translations('codoc-block-js', 'codoc',plugin_dir_path( __FILE__ ) . 'languages');
    68                 });
    6954            }
    7055            // tinymce
  • codoc/trunk/codoc.php

    r3405195 r3405600  
    66Author:      codoc.jp
    77Author URI:  https://codoc.jp
    8 Version:     0.9.56.5
     8Version:     0.9.57
    99License:     GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 const CODOC_PLUGIN_VERSION        = '0.9.56.5';
     16const CODOC_PLUGIN_VERSION        = '0.9.57';
    1717const CODOC_URL                   = 'https://codoc.jp';
    1818const CODOC_USERCODE_OPTION_NAME  = 'codoc_usercode';
  • codoc/trunk/readme.txt

    r3405195 r3405600  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 0.9.56.5
     7Stable tag: 0.9.57
    88Requires PHP: 5.4
    99License: GPLv2 or later
     
    1414== Description ==
    1515
    16 [codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer **Reader Plans (Subscription / Membership)**, and accept tips.
     16[codoc](https://codoc.jp) is a simple and powerful WordPress paywall plugin that enables creators to sell paid articles, offer Reader Plans (Subscription / Membership), and accept tips.
    1717
    1818Originally built for Japanese creators, codoc is also fully compatible with users in the US/EU. 
    19 Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: USD/EUR).
    20 
    21 After setup, the plugin adds a **codoc block※** to the post editor. 
     19Payment is processed via Stripe, and buyers worldwide can purchase using a valid credit card (currency: JPY/USD/EUR).
     20
     21After setup, the plugin adds a codoc block※ to the post editor. 
    2222※Compatible with both Gutenberg and the Classic Editor (TinyMCE).
    2323
     
    4242- Article paywall 
    4343- One-time purchases 
    44 - **Reader Plans (Subscription / Membership)** 
     44- Reader Plans (Subscription / Membership)
    4545- Tipping support 
    4646- Stripe payments (Credit card / Apple Pay / Google Pay / BNPL) 
     
    6767
    6868= What are the requirements for creators to use codoc? =
    69 Creators must have a residence and bank account in **Japan or the United States**.
    70 
    71 = Can users outside Japan purchase content? =
     69Creators must reside in **Japan, the United States, or the EU** and have a bank account in each country.
     70
     71= Can users outside Supported coutry purchase content? =
    7272Yes. Anyone with a valid credit card can purchase. 
    73 Transactions are processed in **JPY**.
     73Transactions are processed in **JPY, USD or EUR** .
    7474
    7575= Where are article contents stored? =
     
    8585
    8686= How can I preview the article as buyers/non-buyers? =
    87 - As buyer: Click **"Already purchased, log in"** and authenticate with your codoc account. 
     87- As buyer: Click **"Sign in to restore purchase"** and authenticate with your codoc account. 
    8888- As non-buyer: Log out and view the article normally.
    8989
     
    120120= Do script tags work? =
    121121Yes. 
    122 External script tags have been supported since April 22, 2020 (Twitter/Instagram embeds, etc.)
     122External script tags have been supported. (Twitter/Instagram embeds, etc.)
    123123
    124124= I want to add buttons at the end of the article =
  • codoc/trunk/src/init.php

    r2923260 r3405600  
    1515
    1616/**
    17  * Enqueue Gutenberg block assets for both frontend + backend.
    18  *
    19  * Assets enqueued:
    20  * 1. blocks.style.build.css - Frontend + Backend.
    21  * 2. blocks.build.js - Backend.
    22  * 3. blocks.editor.build.css - Backend.
     17 * Enqueue Gutenberg block assets for backend editor.
    2318 *
    2419 * @uses {wp-blocks} for block type registration & related functions.
     
    2823 * @since 1.0.0
    2924 */
    30 function wordpress_cgb_block_assets() { // phpcs:ignore
    31     // Register block styles for both frontend + backend.
    32     wp_register_style(
    33         'codoc-style-css', // Handle.
    34         plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
    35         array( 'wp-editor' ), // Dependency to include the CSS after it.
    36         null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    37     );
    38 
    39     // Register block editor script for backend.
    40     wp_register_script(
     25function wordpress_cgb_block_editor_assets() { // phpcs:ignore
     26    // Scripts and styles for editor only
     27    wp_enqueue_script(
    4128        'codoc-block-js', // Handle.
    4229        plugins_url( '/dist/blocks.build.js?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
     
    4532        true // Enqueue the script in the footer.
    4633    );
    47    
    48     // Register block editor styles for backend.
    49     wp_register_style(
     34
     35    // Pass necessary options to JavaScript
     36    global $_CODOC;
     37    $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME);
     38
     39    wp_localize_script('codoc-block-js', 'OPTIONS', array(
     40        'codoc_url'      => $_CODOC->get_codoc_url(),
     41        'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME),
     42        'codoc_plugin_version' => CODOC_PLUGIN_VERSION,
     43        'codoc_sdk_path'       => defined('CODOC_SDK_PATH') ? CODOC_SDK_PATH : '/sdk/js/sdk.v1.js',
     44        'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0,
     45        'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 'yen',
     46        'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0,
     47    ));
     48
     49    // Set script translations
     50    wp_set_script_translations('codoc-block-js', 'codoc', plugin_dir_path( dirname(__FILE__) ) . 'languages');
     51
     52    // Styles for editor only
     53    wp_enqueue_style(
    5054        'codoc-block-editor-css', // Handle.
    5155        plugins_url( 'dist/blocks.editor.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block editor CSS.
     
    5357        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
    5458    );
     59}
    5560
    56     /**
    57      * Register Gutenberg block on server-side.
    58      *
    59      * Register the block on server-side to ensure that the block
    60      * scripts and styles for both frontend and backend are
    61      * enqueued when the editor loads.
    62      *
    63      * @link https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type#enqueuing-block-scripts
    64      * @since 1.16.0
    65      */
    66     register_block_type(
    67         'cgb/block-wordpress', array(
    68             // Enqueue blocks.style.build.css on both frontend & backend.
    69             'style'         => 'codoc-style-css',
    70             // Enqueue blocks.build.js in the editor only.
    71             'editor_script' => 'codoc-block-js',
    72             // Enqueue blocks.editor.build.css in the editor only.
    73             'editor_style'  => 'codoc-block-editor-css',
    74         )
     61// Hook: Editor assets.
     62add_action( 'enqueue_block_editor_assets', 'wordpress_cgb_block_editor_assets' );
     63
     64/**
     65 * Enqueue Gutenberg block assets for frontend.
     66 *
     67 * @since 1.0.0
     68 */
     69function wordpress_cgb_block_frontend_assets() { // phpcs:ignore
     70    // Styles for frontend
     71    wp_enqueue_style(
     72        'codoc-style-css', // Handle.
     73        plugins_url( 'dist/blocks.style.build.css?ver='  . CODOC_PLUGIN_VERSION, dirname( __FILE__ ) ), // Block style CSS.
     74        array( 'wp-editor' ), // Dependency to include the CSS after it.
     75        null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
    7576    );
    7677}
    7778
    78 // Hook: Block assets.
    79 add_action( 'init', 'wordpress_cgb_block_assets' );
     79// Hook: Frontend assets.
     80add_action( 'enqueue_block_assets', 'wordpress_cgb_block_frontend_assets' );
Note: See TracChangeset for help on using the changeset viewer.