Plugin Directory

Changeset 2926513


Ignore:
Timestamp:
06/15/2023 11:23:16 AM (3 years ago)
Author:
wallkit
Message:

tagging version 3.1.7

Location:
wallkit
Files:
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wallkit/tags/3.1.7/admin/class-wallkit-wp-admin.php

    r2901062 r2926513  
    529529    public function action_add_meta_box( ) {
    530530
    531         $selectedPostTypes = ['post'];
     531        $selectedPostTypes = [];
    532532        $registeredPostTypes = $this->collection->get_settings()->get_option("wk_check_post_type_access");
    533533        if( !empty($registeredPostTypes) && $this->collection->get_settings()->get_option("wk_check_post_access") )
    534534        {
    535             $selectedPostTypes = array_values( array_flip( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) ) );
     535            $selectedPostTypes = array_keys( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) );
    536536        }
    537537
     
    541541
    542542        add_meta_box( "wallkit-post-settings", "Wallkit Content", function(WP_Post $WP_Post) {
     543            wp_nonce_field( basename( __FILE__ ), 'wkwp_meta_box_nonce' );
    543544            ?>
    544545            <table>
     
    561562
    562563                <tr>
    563                     <td>Content Price:</td>
    564                     <td><b><?php echo esc_html((number_format($Content["price"] / 100, 2))) ?> <?php echo esc_html((strtoupper($Content["currency"]))); ?></b></td>
    565                 </tr>
    566 
    567                 <tr>
    568564                    <td>Content Created:</td>
    569565                    <td><b><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $Content["created_at"] ) ) ); ?></b></td>
     
    576572                <?php
    577573            }
     574
     575            $disablePaywall = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true);
    578576            ?>
     577
    579578                <tr>
    580                     <td>Auto Sync:</td>
    581                     <td><b><?php
    582                             if($this->collection->get_settings()->get_option("wk_is_auto_sync")) {?>
    583                                 ON <?php }
    584                             else { ?> OFF <?php } ?>
    585                         </b></td>
     579                    <td>Disable paywall:</td>
     580                    <td>
     581                        <input type="hidden" name="disable_paywall_on_post" value="0" />
     582                        <input type="checkbox" name="disable_paywall_on_post" value="1" <?php checked( $disablePaywall, '1' ); ?>>
     583                    </td>
    586584                </tr>
    587                 <tr>
    588                     <td>Access Granted:</td>
    589                     <td><b><?php echo esc_html($Statistic["number_of_check_access_allow"]); ?></b></td>
    590                 </tr>
    591                 <tr>
    592                     <td>Access Restricted:</td>
    593                     <td><b><?php echo esc_html($Statistic["number_of_check_access_deny"]); ?></b></td>
    594                 </tr>
    595 
    596585
    597586            </table>
     
    599588
    600589        }, $selectedPostTypes, "side", "high", NULL );
     590    }
     591
     592    public function wkwp_meta_box_save( $post_id ) {
     593        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || wp_is_post_autosave($post_id) ) {
     594            return;
     595        }
     596
     597        // verify nonce
     598        if (!isset($_POST['wkwp_meta_box_nonce']) || !wp_verify_nonce($_POST['wkwp_meta_box_nonce'], basename(__FILE__))) {
     599            return;
     600        }
     601
     602        if ( isset($_POST['disable_paywall_on_post']) ) {
     603            update_post_meta( $post_id, 'disable_paywall_on_post', $_POST['disable_paywall_on_post'] );
     604        }
    601605    }
    602606
  • wallkit/tags/3.1.7/includes/class-wallkit-wp-access.php

    r2874245 r2926513  
    9191        }
    9292
     93        $disablePaywallOnPost = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true);
     94        if($disablePaywallOnPost === '1')
     95        {
     96            return true;
     97        }
     98
    9399        try {
    94100
  • wallkit/tags/3.1.7/includes/class-wallkit-wp-settings.php

    r2923962 r2926513  
    380380            );
    381381
     382            //Selected post types for paywalled
     383            $selectedPostTypes = [];
     384            $registeredPostTypes = $this->get_option("wk_check_post_type_access");
     385            if( !empty($registeredPostTypes) && $this->get_option("wk_check_post_access") )
     386            {
     387                $selectedPostTypes = array_keys( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) );
     388            }
     389
    382390            $settings['config'] = [
    383391                'sign_in_button'        => (bool) $this->get_option('wk_sign_in_button', true),
     392                'check_post_types'      => (array) $selectedPostTypes,
    384393                'reload_on_logout'      => (bool) $this->get_option('wk_reload_on_logout', true),
    385394                'wk_free_paragraph'     => (int) $this->get_option('wk_free_paragraph', 1),
  • wallkit/tags/3.1.7/includes/class-wallkit-wp.php

    r2916784 r2926513  
    251251
    252252            $this->loader->add_action("add_meta_boxes", $plugin_admin, 'action_add_meta_box');
     253
     254            $this->loader->add_action("save_post", $plugin_admin, 'wkwp_meta_box_save');
    253255
    254256            $this->loader->add_action('wpwkp_task_create', $plugin_admin, 'action_create_task');
  • wallkit/tags/3.1.7/public/js/wallkit-setup.js

    r2923962 r2926513  
    208208                        postPaywallBlock = document.createElement('div');
    209209                        postPaywallBlock.classList.add('wkwp-paywall-block');
    210                         postPaywallBlock.insertAdjacentHTML('beforeend', wkPaywallBlock)
     210                        postPaywallBlock.insertAdjacentHTML('beforeend', wkPaywallBlock);
    211211                        postContentBody.parentNode.insertBefore(postPaywallBlock, postContentBody);
    212212                    }
  • wallkit/tags/3.1.7/readme.txt

    r2923962 r2926513  
    2727
    2828== Changelog ==
     29
     30= 3.1.7 =
     31*Release Date - 15 June 2023*
     32
     33#### Updates including:
     34- Allow admins disable paywall on post.
    2935
    3036= 3.1.6 =
  • wallkit/tags/3.1.7/wallkit-wp.php

    r2923962 r2926513  
    1010 * Plugin URI:        https://wallkit.net
    1111 * Description:       A Plug & Play paid-content system to manage subscribers, gather fees and drive additional content sales.
    12  * Version:           3.1.6
     12 * Version:           3.1.7
    1313 * Author:            Wallkit <dev@wallkit.net>
    1414 * Author URI:        https://wallkit.net/
     
    2727 * Rename this for your plugin and update it as you release new versions.
    2828 */
    29 define( 'WPWKP_VERSION', '3.1.6' );
     29define( 'WPWKP_VERSION', '3.1.7' );
    3030
    3131/**
  • wallkit/trunk/admin/class-wallkit-wp-admin.php

    r2901062 r2926513  
    529529    public function action_add_meta_box( ) {
    530530
    531         $selectedPostTypes = ['post'];
     531        $selectedPostTypes = [];
    532532        $registeredPostTypes = $this->collection->get_settings()->get_option("wk_check_post_type_access");
    533533        if( !empty($registeredPostTypes) && $this->collection->get_settings()->get_option("wk_check_post_access") )
    534534        {
    535             $selectedPostTypes = array_values( array_flip( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) ) );
     535            $selectedPostTypes = array_keys( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) );
    536536        }
    537537
     
    541541
    542542        add_meta_box( "wallkit-post-settings", "Wallkit Content", function(WP_Post $WP_Post) {
     543            wp_nonce_field( basename( __FILE__ ), 'wkwp_meta_box_nonce' );
    543544            ?>
    544545            <table>
     
    561562
    562563                <tr>
    563                     <td>Content Price:</td>
    564                     <td><b><?php echo esc_html((number_format($Content["price"] / 100, 2))) ?> <?php echo esc_html((strtoupper($Content["currency"]))); ?></b></td>
    565                 </tr>
    566 
    567                 <tr>
    568564                    <td>Content Created:</td>
    569565                    <td><b><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $Content["created_at"] ) ) ); ?></b></td>
     
    576572                <?php
    577573            }
     574
     575            $disablePaywall = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true);
    578576            ?>
     577
    579578                <tr>
    580                     <td>Auto Sync:</td>
    581                     <td><b><?php
    582                             if($this->collection->get_settings()->get_option("wk_is_auto_sync")) {?>
    583                                 ON <?php }
    584                             else { ?> OFF <?php } ?>
    585                         </b></td>
     579                    <td>Disable paywall:</td>
     580                    <td>
     581                        <input type="hidden" name="disable_paywall_on_post" value="0" />
     582                        <input type="checkbox" name="disable_paywall_on_post" value="1" <?php checked( $disablePaywall, '1' ); ?>>
     583                    </td>
    586584                </tr>
    587                 <tr>
    588                     <td>Access Granted:</td>
    589                     <td><b><?php echo esc_html($Statistic["number_of_check_access_allow"]); ?></b></td>
    590                 </tr>
    591                 <tr>
    592                     <td>Access Restricted:</td>
    593                     <td><b><?php echo esc_html($Statistic["number_of_check_access_deny"]); ?></b></td>
    594                 </tr>
    595 
    596585
    597586            </table>
     
    599588
    600589        }, $selectedPostTypes, "side", "high", NULL );
     590    }
     591
     592    public function wkwp_meta_box_save( $post_id ) {
     593        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || wp_is_post_autosave($post_id) ) {
     594            return;
     595        }
     596
     597        // verify nonce
     598        if (!isset($_POST['wkwp_meta_box_nonce']) || !wp_verify_nonce($_POST['wkwp_meta_box_nonce'], basename(__FILE__))) {
     599            return;
     600        }
     601
     602        if ( isset($_POST['disable_paywall_on_post']) ) {
     603            update_post_meta( $post_id, 'disable_paywall_on_post', $_POST['disable_paywall_on_post'] );
     604        }
    601605    }
    602606
  • wallkit/trunk/includes/class-wallkit-wp-access.php

    r2874245 r2926513  
    9191        }
    9292
     93        $disablePaywallOnPost = get_post_meta($WP_Post->ID, 'disable_paywall_on_post', true);
     94        if($disablePaywallOnPost === '1')
     95        {
     96            return true;
     97        }
     98
    9399        try {
    94100
  • wallkit/trunk/includes/class-wallkit-wp-settings.php

    r2923962 r2926513  
    380380            );
    381381
     382            //Selected post types for paywalled
     383            $selectedPostTypes = [];
     384            $registeredPostTypes = $this->get_option("wk_check_post_type_access");
     385            if( !empty($registeredPostTypes) && $this->get_option("wk_check_post_access") )
     386            {
     387                $selectedPostTypes = array_keys( array_filter($registeredPostTypes, function($post_type) { return $post_type; }) );
     388            }
     389
    382390            $settings['config'] = [
    383391                'sign_in_button'        => (bool) $this->get_option('wk_sign_in_button', true),
     392                'check_post_types'      => (array) $selectedPostTypes,
    384393                'reload_on_logout'      => (bool) $this->get_option('wk_reload_on_logout', true),
    385394                'wk_free_paragraph'     => (int) $this->get_option('wk_free_paragraph', 1),
  • wallkit/trunk/includes/class-wallkit-wp.php

    r2916784 r2926513  
    251251
    252252            $this->loader->add_action("add_meta_boxes", $plugin_admin, 'action_add_meta_box');
     253
     254            $this->loader->add_action("save_post", $plugin_admin, 'wkwp_meta_box_save');
    253255
    254256            $this->loader->add_action('wpwkp_task_create', $plugin_admin, 'action_create_task');
  • wallkit/trunk/public/js/wallkit-setup.js

    r2923962 r2926513  
    208208                        postPaywallBlock = document.createElement('div');
    209209                        postPaywallBlock.classList.add('wkwp-paywall-block');
    210                         postPaywallBlock.insertAdjacentHTML('beforeend', wkPaywallBlock)
     210                        postPaywallBlock.insertAdjacentHTML('beforeend', wkPaywallBlock);
    211211                        postContentBody.parentNode.insertBefore(postPaywallBlock, postContentBody);
    212212                    }
  • wallkit/trunk/readme.txt

    r2923962 r2926513  
    2727
    2828== Changelog ==
     29
     30= 3.1.7 =
     31*Release Date - 15 June 2023*
     32
     33#### Updates including:
     34- Allow admins disable paywall on post.
    2935
    3036= 3.1.6 =
  • wallkit/trunk/wallkit-wp.php

    r2923962 r2926513  
    1010 * Plugin URI:        https://wallkit.net
    1111 * Description:       A Plug & Play paid-content system to manage subscribers, gather fees and drive additional content sales.
    12  * Version:           3.1.6
     12 * Version:           3.1.7
    1313 * Author:            Wallkit <dev@wallkit.net>
    1414 * Author URI:        https://wallkit.net/
     
    2727 * Rename this for your plugin and update it as you release new versions.
    2828 */
    29 define( 'WPWKP_VERSION', '3.1.6' );
     29define( 'WPWKP_VERSION', '3.1.7' );
    3030
    3131/**
Note: See TracChangeset for help on using the changeset viewer.