Plugin Directory

Changeset 2968855


Ignore:
Timestamp:
09/19/2023 05:49:35 PM (2 years ago)
Author:
thewpcatalyst
Message:

version 1.3.1

Location:
plus-features-for-advanced-custom-fields
Files:
112 added
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • plus-features-for-advanced-custom-fields/trunk/README.txt

    r2967759 r2968855  
    55Requires at least: 5.0
    66Tested up to: 6.3
    7 Stable tag: 1.3.0
     7Stable tag: 1.3.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    339339== Changelog ==
    340340
     341= 1.3.1 =
     342Fixed: JavaScript exception.
     343
    341344= 1.3.0 =
    342345Added rel="nofollow" on ACF link field type.
     
    372375== Upgrade Notice ==
    373376
    374 = 1.3.0 =
    375 Added shortcode support for button_group, true_false and link.
     377= 1.3.1 =
     378Fixed: JavaScript exception.
  • plus-features-for-advanced-custom-fields/trunk/acfp.php

    r2967777 r2968855  
    1616 * Plugin URI:        https://wordpress.org/plugins/plus-features-for-advanced-custom-fields
    1717 * Description:       Adds extra features to Advanced Custom Fields plugin(ACF)
    18  * Version:           1.3.0
     18 * Version:           1.3.1
    1919 * Author:            the WP Catalyst
    2020 * Author URI:        https://profiles.wordpress.org/thewpcatalyst/
     
    3535 * Rename this for your plugin and update it as you release new versions.
    3636 */
    37 define( 'ACFP_VERSION', '1.3.0' );
     37define( 'ACFP_VERSION', '1.3.1' );
    3838
    3939/**
  • plus-features-for-advanced-custom-fields/trunk/admin/class-acfp-admin.php

    r2967754 r2968855  
    2020 * @author     the WP Catalyst <[email protected]>
    2121 */
    22 class Acfp_Admin {
     22class ACFP_Admin {
    2323
    2424    /**
     
    104104        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/acfp-admin.js', array( 'jquery' ), $this->version, false );
    105105
    106         wp_enqueue_script( $this->plugin_name . '-override', plugin_dir_url( __FILE__ ) . 'js/acfp-input-override.js', array( 'jquery' ), $this->version, true );
    107106    }
     107
    108108
    109109    /**
     
    113113     */
    114114    public function init() {
    115         $this->remove_acf_link_field_type_hooks();// they will be re-added on this plugin.
    116         $this->include_field_types();
    117115    }
    118 
    119     /**
    120      * Removes the original hooks added on acf_field_link. This prevents overridden functions from been called.
    121      *
    122      * @return void
    123      */
    124     public function remove_acf_link_field_type_hooks() {
    125         $instance = acf_get_field_type( 'link' );
    126         // value
    127         if ( $instance instanceof acf_field_link ) {
    128             $this->remove_field_type_filter( $instance->name, 'acf/load_value', array( $instance, 'load_value' ), 10, 3 );
    129             $this->remove_field_type_filter( $instance->name, 'acf/update_value', array( $instance, 'update_value' ), 10, 3 );
    130             $this->remove_field_type_filter( $instance->name, 'acf/format_value', array( $instance, 'format_value' ), 10, 3 );
    131             $this->remove_field_type_filter( $instance->name, 'acf/validate_value', array( $instance, 'validate_value' ), 10, 4 );
    132             $this->remove_field_type_action( $instance->name, 'acf/delete_value', array( $instance, 'delete_value' ), 10, 3 );
    133 
    134             // field
    135             $this->remove_field_type_filter( $instance->name, 'acf/validate_rest_value', array( $instance, 'validate_rest_value' ), 10, 3 );
    136             $this->remove_field_type_filter( $instance->name, 'acf/validate_field', array( $instance, 'validate_field' ), 10, 1 );
    137             $this->remove_field_type_filter( $instance->name, 'acf/load_field', array( $instance, 'load_field' ), 10, 1 );
    138             $this->remove_field_type_filter( $instance->name, 'acf/update_field', array( $instance, 'update_field' ), 10, 1 );
    139             $this->remove_field_type_filter( $instance->name, 'acf/duplicate_field', array( $instance, 'duplicate_field' ), 10, 1 );
    140             $this->remove_field_type_action( $instance->name, 'acf/delete_field', array( $instance, 'delete_field' ), 10, 1 );
    141             $this->remove_field_type_action( $instance->name, 'acf/render_field', array( $instance, 'render_field' ), 9, 1 );
    142 
    143             $this->remove_field_type_action( $instance->name, 'acf/render_field_settings', array( $instance, 'render_field_settings' ), 9, 1 );
    144             $this->remove_field_type_filter( $instance->name, 'acf/prepare_field', array( $instance, 'prepare_field' ), 10, 1 );
    145             $this->remove_field_type_filter( $instance->name, 'acf/translate_field', array( $instance, 'translate_field' ), 10, 1 );
    146 
    147             // input actions
    148             $this->remove_action( 'acf/input/admin_enqueue_scripts', array( $instance, 'input_admin_enqueue_scripts' ), 10, 0 );
    149             $this->remove_action( 'acf/input/admin_head', array( $instance, 'input_admin_head' ), 10, 0 );
    150             $this->remove_action( 'acf/input/form_data', array( $instance, 'input_form_data' ), 10, 1 );
    151             $this->remove_filter( 'acf/input/admin_l10n', array( $instance, 'input_admin_l10n' ), 10, 1 );
    152             $this->remove_action( 'acf/input/admin_footer', array( $instance, 'input_admin_footer' ), 10, 1 );
    153 
    154             // field group actions
    155             $this->remove_action( 'acf/field_group/admin_enqueue_scripts', array( $instance, 'field_group_admin_enqueue_scripts' ), 10, 0 );
    156             $this->remove_action( 'acf/field_group/admin_head', array( $instance, 'field_group_admin_head' ), 10, 0 );
    157             $this->remove_action( 'acf/field_group/admin_footer', array( $instance, 'field_group_admin_footer' ), 10, 0 );
    158 
    159             foreach ( acf_get_combined_field_type_settings_tabs() as $tab_key => $tab_label ) {
    160                 $this->remove_field_type_action( $instance->name, "acf/field_group/render_field_settings_tab/{$tab_key}", array( $instance, "render_field_{$tab_key}_settings" ), 9, 1 );
    161             }
    162         }
    163 
    164     }
    165 
    166     /**
    167      * Removes field specific filter
    168      *
    169      * @param string  $field_type_name the name used to register the field.
    170      * @param string  $tag name of the hook
    171      * @param string  $function_to_add callback.
    172      * @param integer $priority priority.
    173      * @param integer $accepted_args number of args.
    174      * @return void
    175      */
    176     function remove_field_type_filter( string $field_type_name, string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
    177         $tag .= '/type=' . $field_type_name;
    178         $this->remove_filter( $tag, $function_to_add, $priority, $accepted_args );
    179 
    180     }
    181 
    182     /**
    183      * Removes filter
    184      *
    185      * @param string  $field_type_name the name used to register the field.
    186      * @param string  $tag name of the hook
    187      * @param string  $function_to_add callback.
    188      * @param integer $priority priority.
    189      * @param integer $accepted_args number of args.
    190      * @return void
    191      */
    192     function remove_filter( string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
    193         remove_filter( $tag, $function_to_add, $priority, $accepted_args );
    194 
    195     }
    196 
    197     /**
    198      * Removes field specific action
    199      *
    200      * @param string  $field_type_name the name used to register the field.
    201      * @param string  $tag name of the hook
    202      * @param string  $function_to_add callback.
    203      * @param integer $priority priority.
    204      * @param integer $accepted_args number of args.
    205      * @return void
    206      */
    207     function remove_field_type_action( string $field_type_name, string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
    208         $tag .= '/type=' . $field_type_name;
    209         $this->remove_action( $tag, $function_to_add, $priority, $accepted_args );
    210     }
    211 
    212     /**
    213      * Removes action
    214      *
    215      * @param string  $tag name of the hook
    216      * @param string  $function_to_add callback.
    217      * @param integer $priority priority.
    218      * @param integer $accepted_args number of args.
    219      * @return void
    220      */
    221     function remove_action( string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
    222         remove_action( $tag, $function_to_add, $priority, $accepted_args );
    223     }
    224 
    225 
    226     /**
    227      * Includes extra fields
    228      *
    229      * @return void
    230      */
    231     public function include_field_types() {
    232         if ( ! function_exists( 'acf_register_field_type' ) ) {
    233             return;
    234         }
    235 
    236         $acfp_field_types_classes = array(
    237             'ACFP_ACF_Field_Dual_Range_Slider' => 'includes/fields/class-acfp-acf-field-dual-range-slider.php',
    238             'ACFP_ACF_Link_Field'              => 'includes/fields/class-acfp-acf-link-field.php',
    239         );
    240 
    241         // phpcs:ignore WordPress.NamingConventions.ValidHookName
    242         $acfp_field_types_classes = apply_filters( 'acfp/include_field_types', $acfp_field_types_classes, $this->acfp );
    243 
    244         foreach ( $acfp_field_types_classes as $field_type_class => $class_path ) {
    245             require_once plugin_dir_path( dirname( __FILE__ ) ) . $class_path;
    246             acf_register_field_type( $field_type_class );
    247         }
    248 
    249     }
    250 
    251116}
  • plus-features-for-advanced-custom-fields/trunk/includes/class-acfp.php

    r2967754 r2968855  
    8686            $this->version = ACFP_VERSION;
    8787        } else {
    88             $this->version = '1.3.0';
     88            $this->version = '1.3.1';
    8989        }
    9090        $this->plugin_name                     = 'acfp';
     
    151151        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-acfp-admin.php';
    152152
     153        /**
     154         * The class responsible for defining all actions that occur in both admin and public area.
     155         */
     156        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'common/class-acfp-common.php';
    153157        /**
    154158         * The class responsible for defining all actions that occur in the public-facing
     
    225229
    226230        $plugin_acf_link_mod = new ACFP_ACF_Link_Field_Mod( $this );
     231        $this->loader->add_action( 'acf/init', $plugin_acf_link_mod, 'acf_init' );
     232        $this->loader->add_action( 'acf/register_scripts', $plugin_acf_link_mod, 'enqueue_extra_scripts_after_acf_scripts_and_styles', 10, 2 );
    227233        $this->loader->add_action( 'acf/load_value/type=link', $plugin_acf_link_mod, 'load_value', 10, 3 );
    228234        $this->loader->add_action( 'after_wp_tiny_mce', $plugin_acf_link_mod, 'after_wp_tiny_mce' );
     235
     236        $plugin_common = new ACFP_Common( $this );
     237        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_common, 'enqueue_styles' );
     238        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_common, 'enqueue_scripts' );
     239        $this->loader->add_action( 'acf/init', $plugin_common, 'acf_init' );
     240        $this->loader->add_action( 'init', $plugin_common, 'init' );
    229241    }
    230242
     
    237249     */
    238250    private function define_admin_hooks() {
    239 
    240         $plugin_admin = new Acfp_Admin( $this );
    241 
     251        $plugin_admin = new ACFP_Admin( $this );
    242252        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
    243253        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
    244         $this->loader->add_action( 'acf/init', $plugin_admin, 'init' );
    245 
     254        $this->loader->add_action( 'init', $plugin_admin, 'init' );
    246255    }
    247256
     
    254263     */
    255264    private function define_public_hooks() {
    256 
    257265        $plugin_public = new Acfp_Public( $this->get_plugin_name(), $this->get_version() );
    258 
    259266        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    260267        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
  • plus-features-for-advanced-custom-fields/trunk/includes/fields/class-acfp-acf-field-dual-range-slider.php

    r2967754 r2968855  
    1212/**
    1313 * The ACFP_ACF_Field_Dual_Range_Slider class
     14 *
    1415 * @since 1.0.0
    1516 */
     
    3839     *  @since   5.0.0
    3940     */
    40     function __construct() {
     41    public function __construct() {
    4142        $this->id = 'dual_range_slider';
    4243
     
    108109     *  @param   $field (array) the $field being edited.
    109110     */
    110     function render_field_settings( $field ) {
     111    public function render_field_settings( $field ) {
    111112        acf_render_field_setting(
    112113            $field,
     
    174175     *  @param    $field the $field being rendered.
    175176     */
    176     function render_field( $field ) {
     177    public function render_field( $field ) {
    177178        $field_id    = esc_attr( $this->id );
    178179        $min         = intval( $field['min_value'] );
     
    262263     *  @return  $value
    263264     */
    264     function update_value( $value, $post_id, $field ) {
     265    public function update_value( $value, $post_id, $field ) {
    265266        return $this->get_desired_value( $value );
    266267    }
     
    283284     *  @return  $valid
    284285     */
    285     function validate_value( $valid, $value, $field, $input ) {
     286    public function validate_value( $valid, $value, $field, $input ) {
    286287        $desired_value = $this->get_desired_value( $value );
    287288        if ( false === $desired_value ) {
  • plus-features-for-advanced-custom-fields/trunk/includes/fields/mods/class-acfp-acf-link-field-mod.php

    r2967754 r2968855  
    1616 */
    1717class ACFP_ACF_Link_Field_Mod {
     18    /**
     19     * The ID of this plugin.
     20     *
     21     * @since    1.3.1
     22     * @access   private
     23     * @var      string    $plugin_name    The ID of this plugin.
     24     */
     25    private $plugin_name;
     26
     27    /**
     28     * The version of this plugin.
     29     *
     30     * @since    1.3.1
     31     * @access   private
     32     * @var      string    $version    The current version of this plugin.
     33     */
     34    private $version;
     35
     36    /**
     37     * Holds ACFP class instance
     38     *
     39     * @var ACFP
     40     */
     41    private $acfp;
    1842
    1943    /**
     
    2448     */
    2549    public function __construct( Acfp $acfp ) {
    26 
     50        $this->acfp        = $acfp;
     51        $this->plugin_name = $acfp->get_plugin_name();
     52        $this->version     = $acfp->get_version();
    2753    }
    2854
     
    3864     * @return mixed
    3965     */
     66
     67    /**
     68     * Fired on acf/init action.
     69     *
     70     * @since    1.3.1
     71     *
     72     * @return void
     73     */
     74    public function acf_init() {
     75        $this->remove_acf_link_field_type_hooks();// they will be re-added on this plugin.
     76    }
     77
     78    /**
     79     * Removes the original hooks added on acf_field_link. This prevents overridden functions from been called.
     80     *
     81     * @since    1.3.1
     82     *
     83     * @return void
     84     */
     85    public function remove_acf_link_field_type_hooks() {
     86        $instance = acf_get_field_type( 'link' );
     87        // value.
     88        if ( $instance instanceof acf_field_link ) {
     89            $this->remove_field_type_filter( $instance->name, 'acf/load_value', array( $instance, 'load_value' ), 10, 3 );
     90            $this->remove_field_type_filter( $instance->name, 'acf/update_value', array( $instance, 'update_value' ), 10, 3 );
     91            $this->remove_field_type_filter( $instance->name, 'acf/format_value', array( $instance, 'format_value' ), 10, 3 );
     92            $this->remove_field_type_filter( $instance->name, 'acf/validate_value', array( $instance, 'validate_value' ), 10, 4 );
     93            $this->remove_field_type_action( $instance->name, 'acf/delete_value', array( $instance, 'delete_value' ), 10, 3 );
     94
     95            // field.
     96            $this->remove_field_type_filter( $instance->name, 'acf/validate_rest_value', array( $instance, 'validate_rest_value' ), 10, 3 );
     97            $this->remove_field_type_filter( $instance->name, 'acf/validate_field', array( $instance, 'validate_field' ), 10, 1 );
     98            $this->remove_field_type_filter( $instance->name, 'acf/load_field', array( $instance, 'load_field' ), 10, 1 );
     99            $this->remove_field_type_filter( $instance->name, 'acf/update_field', array( $instance, 'update_field' ), 10, 1 );
     100            $this->remove_field_type_filter( $instance->name, 'acf/duplicate_field', array( $instance, 'duplicate_field' ), 10, 1 );
     101            $this->remove_field_type_action( $instance->name, 'acf/delete_field', array( $instance, 'delete_field' ), 10, 1 );
     102            $this->remove_field_type_action( $instance->name, 'acf/render_field', array( $instance, 'render_field' ), 9, 1 );
     103
     104            $this->remove_field_type_action( $instance->name, 'acf/render_field_settings', array( $instance, 'render_field_settings' ), 9, 1 );
     105            $this->remove_field_type_filter( $instance->name, 'acf/prepare_field', array( $instance, 'prepare_field' ), 10, 1 );
     106            $this->remove_field_type_filter( $instance->name, 'acf/translate_field', array( $instance, 'translate_field' ), 10, 1 );
     107
     108            // input actions.
     109            $this->remove_action( 'acf/input/admin_enqueue_scripts', array( $instance, 'input_admin_enqueue_scripts' ), 10, 0 );
     110            $this->remove_action( 'acf/input/admin_head', array( $instance, 'input_admin_head' ), 10, 0 );
     111            $this->remove_action( 'acf/input/form_data', array( $instance, 'input_form_data' ), 10, 1 );
     112            $this->remove_filter( 'acf/input/admin_l10n', array( $instance, 'input_admin_l10n' ), 10, 1 );
     113            $this->remove_action( 'acf/input/admin_footer', array( $instance, 'input_admin_footer' ), 10, 1 );
     114
     115            // field group actions.
     116            $this->remove_action( 'acf/field_group/admin_enqueue_scripts', array( $instance, 'field_group_admin_enqueue_scripts' ), 10, 0 );
     117            $this->remove_action( 'acf/field_group/admin_head', array( $instance, 'field_group_admin_head' ), 10, 0 );
     118            $this->remove_action( 'acf/field_group/admin_footer', array( $instance, 'field_group_admin_footer' ), 10, 0 );
     119
     120            foreach ( acf_get_combined_field_type_settings_tabs() as $tab_key => $tab_label ) {
     121                $this->remove_field_type_action( $instance->name, "acf/field_group/render_field_settings_tab/{$tab_key}", array( $instance, "render_field_{$tab_key}_settings" ), 9, 1 );
     122            }
     123        }
     124
     125    }
     126
     127    /**
     128     * Removes field specific filter
     129     *
     130     * @since    1.3.1
     131     *
     132     * @param string  $field_type_name the name used to register the field.
     133     * @param string  $tag name of the hook.
     134     * @param string  $function_to_add callback.
     135     * @param integer $priority priority.
     136     * @param integer $accepted_args number of args.
     137     * @return void
     138     */
     139    protected function remove_field_type_filter( string $field_type_name, string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
     140        $tag .= '/type=' . $field_type_name;
     141        $this->remove_filter( $tag, $function_to_add, $priority, $accepted_args );
     142
     143    }
     144
     145    /**
     146     * Removes filter
     147     *
     148     * @since    1.3.1
     149     *
     150     * @param string  $tag name of the hook.
     151     * @param mixed   $function_to_add callback.
     152     * @param integer $priority priority.
     153     * @param integer $accepted_args number of args.
     154     * @return void
     155     */
     156    protected function remove_filter( string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
     157        remove_filter( $tag, $function_to_add, $priority, $accepted_args );
     158    }
     159
     160    /**
     161     * Removes field specific action
     162     *
     163     * @since    1.3.1
     164     *
     165     * @param string  $field_type_name the name used to register the field.
     166     * @param string  $tag name of the hook.
     167     * @param string  $function_to_add callback.
     168     * @param integer $priority priority.
     169     * @param integer $accepted_args number of args.
     170     * @return void
     171     */
     172    protected function remove_field_type_action( string $field_type_name, string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
     173        $tag .= '/type=' . $field_type_name;
     174        $this->remove_action( $tag, $function_to_add, $priority, $accepted_args );
     175    }
     176
     177    /**
     178     * Removes action
     179     *
     180     * @since    1.3.1
     181     *
     182     * @param string  $tag name of the hook.
     183     * @param string  $function_to_add callback.
     184     * @param integer $priority priority.
     185     * @param integer $accepted_args number of args.
     186     * @return void
     187     */
     188    protected function remove_action( string $tag = '', $function_to_add = '', int $priority = 10, int $accepted_args = 1 ) {
     189        remove_action( $tag, $function_to_add, $priority, $accepted_args );
     190    }
     191
     192    /**
     193     * Register the JavaScript after ACF core scripts and styles have been registered.
     194     *
     195     * @since    1.3.1
     196     *
     197     * @param  mixed $version ACF version.
     198     * @param  mixed $suffix ACF suffix for '.min' or ''.
     199     *
     200     * @return void
     201     */
     202    public function enqueue_extra_scripts_after_acf_scripts_and_styles( $version, $suffix ) {
     203        wp_enqueue_script( $this->plugin_name . '-acfp-input-override', $this->acfp->get_plugin_base_url() . 'assets/build/common/js/acfp-input-override' . $suffix . '.js', array( 'jquery' ), $this->version, true );
     204    }
    40205
    41206    /**
  • plus-features-for-advanced-custom-fields/trunk/includes/shortcodes/class-acfp-shortcode.php

    r2967754 r2968855  
    6666     */
    6767    public function acfp_shortcode( $atts ) {
     68        // Return if ACF is not active.
     69        if(! class_exists('ACF')){
     70            return;
     71        }
     72       
    6873        // Return if the ACF shortcode is disabled.
    6974        if ( ! acf_get_setting( 'enable_shortcode' ) ) {
     
    243248                $render = new ACFP_Render_Link( $field_value, $a );
    244249                break;
    245             /*case 'page_link':
     250            /*
     251            case 'page_link':
    246252                $render = new ACFP_Render_Page_Link( $field_value, $a );
    247253                break;
Note: See TracChangeset for help on using the changeset viewer.