Plugin Directory

Changeset 2820618


Ignore:
Timestamp:
11/18/2022 04:28:54 PM (3 years ago)
Author:
ybug
Message:

Release 1.1.0

Location:
ybug-feedback-widget
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ybug-feedback-widget/tags/1.1.0/includes/class-ybug-admin.php

    r2274425 r2820618  
    6161        <input type='text' name='ybug[project]' value='<?php echo $options['project'] ?>' size="64" class="regular-text code" placeholder="Copy &amp; paste your project ID here..." />
    6262        <p class="description">The ID of the project in Ybug that you have created for this site. Leave empty to disable Feedback Widget.</p>
     63        <?php
     64
     65    }
     66
     67    /**
     68     * Render JS snippet
     69     *
     70     * @since    1.1.0
     71     */
     72    public function render_restrict_access_field(  ) {
     73
     74        $options = get_option( 'ybug' );
     75        $options['restrict_access'] = @$options['restrict_access'] ?: 'no';
     76        $options['roles'] = @$options['roles'] ?: [];
     77        ?>
     78        <p>
     79            <label>
     80                <input name="ybug[restrict_access]" type="radio" value="no" class="tog" <?php checked( 'no' === $options['restrict_access'] ); ?> />
     81                <?php echo __( 'Show to everyone', 'ybug' ); ?>
     82            </label>
     83        </p>
     84        <p>
     85            <label>
     86                <input name="ybug[restrict_access]" type="radio" value="all" class="tog" <?php checked( 'all' === $options['restrict_access'] ); ?> />
     87                <?php echo __( 'Show to all logged in users', 'ybug' ); ?>
     88            </label>
     89        </p>
     90        <p>
     91            <label>
     92                <input name="ybug[restrict_access]" type="radio" value="roles" class="tog" <?php checked( 'roles' === $options['restrict_access'] ); ?> />
     93                <?php echo __( 'Show only to some users by role:', 'ybug' ); ?>
     94            </label>
     95        </p>
     96        <div class="ybug-roles-wrapper <?php if ($options['restrict_access'] !== 'roles') : ?>is-disabled<?php endif; ?>">
     97        <?php
     98        $editable_roles = get_editable_roles();
     99        foreach ( $editable_roles as $role => $details ) {
     100            $name = translate_user_role( $details['name'] );
     101            echo "<label for='ybug_role_{$details['name']}'>
     102                <input type='checkbox'
     103                    id='ybug_role_{$details['name']}'
     104                    name='ybug[roles][]'
     105                    value='" . esc_attr( $role ) . "'
     106                    " . disabled($options['restrict_access'] !== 'roles', true, false). "
     107                    " . checked( in_array($role, $options['roles']), true, false ) . "
     108                 />
     109                <span class='ybug-role-name'>$name</span>
     110            </label>";
     111        }
     112        ?>
     113        </div>
    63114        <?php
    64115
     
    162213            'Ybug_settings_section'
    163214        );
     215
     216        add_settings_field(
     217            'restrict_access',
     218            __( 'Restrict Access:', 'ybug' ),
     219            array( $this, 'render_restrict_access_field' ),
     220            'ybugSettings',
     221            'Ybug_settings_section'
     222        );
     223
     224
     225        wp_enqueue_style('options_css', plugins_url( 'styles/admin.css', __FILE__ ), array(), $this->version);
     226        wp_enqueue_script( 'validation_js', plugins_url( 'javascript/validation.js', __FILE__ ), array(), $this->version, true );
    164227    }
    165228
  • ybug-feedback-widget/tags/1.1.0/includes/class-ybug-public.php

    r2274425 r2820618  
    4040        $options = get_option( 'ybug' );
    4141
     42        // Show to all logged in users
     43        if (@$options['restrict_access'] === 'all' && !is_user_logged_in()) {
     44            return;
     45        }
     46
     47        // Show only to some users by role
     48        if (@$options['restrict_access'] === 'roles') {
     49            if (!array_filter($options['roles'], 'current_user_can')) {
     50                return;
     51            }
     52        }
     53
    4254        if (@$options['project']) {
    4355
  • ybug-feedback-widget/tags/1.1.0/readme.txt

    r2751171 r2820618  
    33Tags: feedback, bug-tracking, user feedback, visual feedback, feedback widget, feedback button, screenshot
    44Requires at least: 3.0.1
    5 Tested up to: 6.0
     5Tested up to: 6.1
    66Stable tag: trunk
    77Requires PHP: 5.3
     
    5959* Plugin release.
    6060
     61= 1.1.0 =
     62* Added new setting - access restriction
     63
    6164== Upgrade Notice ==
  • ybug-feedback-widget/tags/1.1.0/ybug.php

    r2274425 r2820618  
    1111 * Plugin Name:       Ybug Feedback Widget
    1212 * Description:       Collect visual feedback and bug reports with screenshots from your users. This plugin allows you to easily add Ybug Feedback Widget on your website.
    13  * Version:           1.0.0
     13 * Version:           1.1.0
    1414 * Requires at least: 3.1
    1515 * Requires PHP:      5.3
     
    2626}
    2727
    28 define( 'YBUG_VERSION', '1.0.0' );
     28define( 'YBUG_VERSION', '1.1.0' );
    2929
    3030function activate_ybug() {
  • ybug-feedback-widget/trunk/includes/class-ybug-admin.php

    r2274425 r2820618  
    6161        <input type='text' name='ybug[project]' value='<?php echo $options['project'] ?>' size="64" class="regular-text code" placeholder="Copy &amp; paste your project ID here..." />
    6262        <p class="description">The ID of the project in Ybug that you have created for this site. Leave empty to disable Feedback Widget.</p>
     63        <?php
     64
     65    }
     66
     67    /**
     68     * Render JS snippet
     69     *
     70     * @since    1.1.0
     71     */
     72    public function render_restrict_access_field(  ) {
     73
     74        $options = get_option( 'ybug' );
     75        $options['restrict_access'] = @$options['restrict_access'] ?: 'no';
     76        $options['roles'] = @$options['roles'] ?: [];
     77        ?>
     78        <p>
     79            <label>
     80                <input name="ybug[restrict_access]" type="radio" value="no" class="tog" <?php checked( 'no' === $options['restrict_access'] ); ?> />
     81                <?php echo __( 'Show to everyone', 'ybug' ); ?>
     82            </label>
     83        </p>
     84        <p>
     85            <label>
     86                <input name="ybug[restrict_access]" type="radio" value="all" class="tog" <?php checked( 'all' === $options['restrict_access'] ); ?> />
     87                <?php echo __( 'Show to all logged in users', 'ybug' ); ?>
     88            </label>
     89        </p>
     90        <p>
     91            <label>
     92                <input name="ybug[restrict_access]" type="radio" value="roles" class="tog" <?php checked( 'roles' === $options['restrict_access'] ); ?> />
     93                <?php echo __( 'Show only to some users by role:', 'ybug' ); ?>
     94            </label>
     95        </p>
     96        <div class="ybug-roles-wrapper <?php if ($options['restrict_access'] !== 'roles') : ?>is-disabled<?php endif; ?>">
     97        <?php
     98        $editable_roles = get_editable_roles();
     99        foreach ( $editable_roles as $role => $details ) {
     100            $name = translate_user_role( $details['name'] );
     101            echo "<label for='ybug_role_{$details['name']}'>
     102                <input type='checkbox'
     103                    id='ybug_role_{$details['name']}'
     104                    name='ybug[roles][]'
     105                    value='" . esc_attr( $role ) . "'
     106                    " . disabled($options['restrict_access'] !== 'roles', true, false). "
     107                    " . checked( in_array($role, $options['roles']), true, false ) . "
     108                 />
     109                <span class='ybug-role-name'>$name</span>
     110            </label>";
     111        }
     112        ?>
     113        </div>
    63114        <?php
    64115
     
    162213            'Ybug_settings_section'
    163214        );
     215
     216        add_settings_field(
     217            'restrict_access',
     218            __( 'Restrict Access:', 'ybug' ),
     219            array( $this, 'render_restrict_access_field' ),
     220            'ybugSettings',
     221            'Ybug_settings_section'
     222        );
     223
     224
     225        wp_enqueue_style('options_css', plugins_url( 'styles/admin.css', __FILE__ ), array(), $this->version);
     226        wp_enqueue_script( 'validation_js', plugins_url( 'javascript/validation.js', __FILE__ ), array(), $this->version, true );
    164227    }
    165228
  • ybug-feedback-widget/trunk/includes/class-ybug-public.php

    r2274425 r2820618  
    4040        $options = get_option( 'ybug' );
    4141
     42        // Show to all logged in users
     43        if (@$options['restrict_access'] === 'all' && !is_user_logged_in()) {
     44            return;
     45        }
     46
     47        // Show only to some users by role
     48        if (@$options['restrict_access'] === 'roles') {
     49            if (!array_filter($options['roles'], 'current_user_can')) {
     50                return;
     51            }
     52        }
     53
    4254        if (@$options['project']) {
    4355
  • ybug-feedback-widget/trunk/readme.txt

    r2751171 r2820618  
    33Tags: feedback, bug-tracking, user feedback, visual feedback, feedback widget, feedback button, screenshot
    44Requires at least: 3.0.1
    5 Tested up to: 6.0
     5Tested up to: 6.1
    66Stable tag: trunk
    77Requires PHP: 5.3
     
    5959* Plugin release.
    6060
     61= 1.1.0 =
     62* Added new setting - access restriction
     63
    6164== Upgrade Notice ==
  • ybug-feedback-widget/trunk/ybug.php

    r2274425 r2820618  
    1111 * Plugin Name:       Ybug Feedback Widget
    1212 * Description:       Collect visual feedback and bug reports with screenshots from your users. This plugin allows you to easily add Ybug Feedback Widget on your website.
    13  * Version:           1.0.0
     13 * Version:           1.1.0
    1414 * Requires at least: 3.1
    1515 * Requires PHP:      5.3
     
    2626}
    2727
    28 define( 'YBUG_VERSION', '1.0.0' );
     28define( 'YBUG_VERSION', '1.1.0' );
    2929
    3030function activate_ybug() {
Note: See TracChangeset for help on using the changeset viewer.