diff --git a/wp-content/plugins/PT-kandidaten b/wp-content/plugins/PT-kandidaten new file mode 160000 index 0000000..8d8f7e5 --- /dev/null +++ b/wp-content/plugins/PT-kandidaten @@ -0,0 +1 @@ +Subproject commit 8d8f7e5ead6d3d292593f412953fadbe84131c21 diff --git a/wp-content/plugins/advanced-custom-fields/README.md b/wp-content/plugins/advanced-custom-fields/README.md new file mode 100644 index 0000000..5322b70 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/README.md @@ -0,0 +1,25 @@ +# Advanced Custom Fields + +Welcome to the official Advanced Custom Fields repository on GitHub. ACF is a WordPress plugin used to take full control of your edit screens & custom field data. + +Looking for ACF version 4? Please use the [previous ACF repository](https://github.com/elliotcondon/acf). + +Upgrading from ACF version 4? Please read our [Upgrading from v4 to v5 guide](https://www.advancedcustomfields.com/resources/upgrading-v4-v5/). + +## Documentation + +Do you need help getting started with ACF, or do you have questions about one of the ACF features? You can [search through our documentation here](https://www.advancedcustomfields.com/resources). If you don't find the answers you're looking for, you can [submit a support ticket](https://support.advancedcustomfields.com/new-ticket/) or start a new forum thread in the [support forum](https://support.advancedcustomfields.com/). + +## Support + +This repository is not suitable for support. Please don't use our issue tracker for support requests, but for core issues only. +Support can take place in the appropriate channels: + +* Email based ticket system +* Community forum + +These channels can be accessed from our [support website](https://support.advancedcustomfields.com/). + +## Contributing + +If you have a patch, or stumbled upon an issue with ACF core, you can contribute this back to the code. Please create a new github issue with as much information as possible. \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/acf.php b/wp-content/plugins/advanced-custom-fields/acf.php new file mode 100644 index 0000000..62c8df7 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/acf.php @@ -0,0 +1,680 @@ +version; + $basename = plugin_basename( __FILE__ ); + $path = plugin_dir_path( __FILE__ ); + $url = plugin_dir_url( __FILE__ ); + $slug = dirname($basename); + + + // settings + $this->settings = array( + + // basic + 'name' => __('Advanced Custom Fields', 'acf'), + 'version' => $version, + + // urls + 'file' => __FILE__, + 'basename' => $basename, + 'path' => $path, + 'url' => $url, + 'slug' => $slug, + + // options + 'show_admin' => true, + 'show_updates' => true, + 'stripslashes' => false, + 'local' => true, + 'json' => true, + 'save_json' => '', + 'load_json' => array(), + 'default_language' => '', + 'current_language' => '', + 'capability' => 'manage_options', + 'uploader' => 'wp', + 'autoload' => false, + 'l10n' => true, + 'l10n_textdomain' => '', + 'google_api_key' => '', + 'google_api_client' => '', + 'enqueue_google_maps' => true, + 'enqueue_select2' => true, + 'enqueue_datepicker' => true, + 'enqueue_datetimepicker' => true, + 'select2_version' => 4, + 'row_index_offset' => 1, + 'remove_wp_meta_box' => true + ); + + + // constants + $this->define( 'ACF', true ); + $this->define( 'ACF_VERSION', $version ); + $this->define( 'ACF_PATH', $path ); + + // Include utility functions. + include_once( ACF_PATH . 'includes/acf-utility-functions.php'); + + // Include previous API functions. + acf_include('includes/api/api-helpers.php'); + acf_include('includes/api/api-template.php'); + acf_include('includes/api/api-term.php'); + + // Include classes. + acf_include('includes/class-acf-data.php'); + + // Include functions. + acf_include('includes/acf-helper-functions.php'); + acf_include('includes/acf-hook-functions.php'); + acf_include('includes/acf-field-functions.php'); + acf_include('includes/acf-field-group-functions.php'); + acf_include('includes/acf-form-functions.php'); + acf_include('includes/acf-meta-functions.php'); + acf_include('includes/acf-post-functions.php'); + acf_include('includes/acf-user-functions.php'); + acf_include('includes/acf-value-functions.php'); + acf_include('includes/acf-input-functions.php'); + + // fields + acf_include('includes/fields.php'); + acf_include('includes/fields/class-acf-field.php'); + + + // locations + acf_include('includes/locations.php'); + acf_include('includes/locations/class-acf-location.php'); + + + // core + acf_include('includes/assets.php'); + acf_include('includes/compatibility.php'); + acf_include('includes/deprecated.php'); + acf_include('includes/json.php'); + acf_include('includes/l10n.php'); + acf_include('includes/local-fields.php'); + acf_include('includes/local-meta.php'); + acf_include('includes/loop.php'); + acf_include('includes/media.php'); + acf_include('includes/revisions.php'); + acf_include('includes/updates.php'); + acf_include('includes/upgrades.php'); + acf_include('includes/validation.php'); + + // ajax + acf_include('includes/ajax/class-acf-ajax.php'); + acf_include('includes/ajax/class-acf-ajax-check-screen.php'); + acf_include('includes/ajax/class-acf-ajax-user-setting.php'); + acf_include('includes/ajax/class-acf-ajax-upgrade.php'); + + // forms + acf_include('includes/forms/form-attachment.php'); + acf_include('includes/forms/form-comment.php'); + acf_include('includes/forms/form-customizer.php'); + acf_include('includes/forms/form-front.php'); + acf_include('includes/forms/form-nav-menu.php'); + acf_include('includes/forms/form-post.php'); + acf_include('includes/forms/form-gutenberg.php'); + acf_include('includes/forms/form-taxonomy.php'); + acf_include('includes/forms/form-user.php'); + acf_include('includes/forms/form-widget.php'); + + + // admin + if( is_admin() ) { + acf_include('includes/admin/admin.php'); + acf_include('includes/admin/admin-field-group.php'); + acf_include('includes/admin/admin-field-groups.php'); + acf_include('includes/admin/admin-notices.php'); + acf_include('includes/admin/admin-tools.php'); + acf_include('includes/admin/admin-upgrade.php'); + acf_include('includes/admin/settings-info.php'); + } + + + // pro + acf_include('pro/acf-pro.php'); + + // Include tests. + if( defined('ACF_DEV') && ACF_DEV ) { + acf_include('tests/tests.php'); + } + + // actions + add_action('init', array($this, 'init'), 5); + add_action('init', array($this, 'register_post_types'), 5); + add_action('init', array($this, 'register_post_status'), 5); + + + // filters + add_filter('posts_where', array($this, 'posts_where'), 10, 2 ); + //add_filter('posts_request', array($this, 'posts_request'), 10, 1 ); + } + + + /* + * init + * + * This function will run after all plugins and theme functions have been included + * + * @type action (init) + * @date 28/09/13 + * @since 5.0.0 + * + * @param N/A + * @return N/A + */ + + function init() { + + // bail early if too early + // ensures all plugins have a chance to add fields, etc + if( !did_action('plugins_loaded') ) return; + + + // bail early if already init + if( acf_has_done('init') ) return; + + + // vars + $major = intval( acf_get_setting('version') ); + + + // update url + // - allow another plugin to modify dir (maybe force SSL) + acf_update_setting('url', plugin_dir_url( __FILE__ )); + + + // textdomain + acf_load_textdomain(); + + // include 3rd party support + acf_include('includes/third-party.php'); + + // include wpml support + if( defined('ICL_SITEPRESS_VERSION') ) { + acf_include('includes/wpml.php'); + } + + // fields + acf_include('includes/fields/class-acf-field-text.php'); + acf_include('includes/fields/class-acf-field-textarea.php'); + acf_include('includes/fields/class-acf-field-number.php'); + acf_include('includes/fields/class-acf-field-range.php'); + acf_include('includes/fields/class-acf-field-email.php'); + acf_include('includes/fields/class-acf-field-url.php'); + acf_include('includes/fields/class-acf-field-password.php'); + + acf_include('includes/fields/class-acf-field-image.php'); + acf_include('includes/fields/class-acf-field-file.php'); + acf_include('includes/fields/class-acf-field-wysiwyg.php'); + acf_include('includes/fields/class-acf-field-oembed.php'); + + acf_include('includes/fields/class-acf-field-select.php'); + acf_include('includes/fields/class-acf-field-checkbox.php'); + acf_include('includes/fields/class-acf-field-radio.php'); + acf_include('includes/fields/class-acf-field-button-group.php'); + acf_include('includes/fields/class-acf-field-true_false.php'); + + acf_include('includes/fields/class-acf-field-link.php'); + acf_include('includes/fields/class-acf-field-post_object.php'); + acf_include('includes/fields/class-acf-field-page_link.php'); + acf_include('includes/fields/class-acf-field-relationship.php'); + acf_include('includes/fields/class-acf-field-taxonomy.php'); + acf_include('includes/fields/class-acf-field-user.php'); + + acf_include('includes/fields/class-acf-field-google-map.php'); + acf_include('includes/fields/class-acf-field-date_picker.php'); + acf_include('includes/fields/class-acf-field-date_time_picker.php'); + acf_include('includes/fields/class-acf-field-time_picker.php'); + acf_include('includes/fields/class-acf-field-color_picker.php'); + + acf_include('includes/fields/class-acf-field-message.php'); + acf_include('includes/fields/class-acf-field-accordion.php'); + acf_include('includes/fields/class-acf-field-tab.php'); + acf_include('includes/fields/class-acf-field-group.php'); + do_action('acf/include_field_types', $major); + + + // locations + acf_include('includes/locations/class-acf-location-post-type.php'); + acf_include('includes/locations/class-acf-location-post-template.php'); + acf_include('includes/locations/class-acf-location-post-status.php'); + acf_include('includes/locations/class-acf-location-post-format.php'); + acf_include('includes/locations/class-acf-location-post-category.php'); + acf_include('includes/locations/class-acf-location-post-taxonomy.php'); + acf_include('includes/locations/class-acf-location-post.php'); + acf_include('includes/locations/class-acf-location-page-template.php'); + acf_include('includes/locations/class-acf-location-page-type.php'); + acf_include('includes/locations/class-acf-location-page-parent.php'); + acf_include('includes/locations/class-acf-location-page.php'); + acf_include('includes/locations/class-acf-location-current-user.php'); + acf_include('includes/locations/class-acf-location-current-user-role.php'); + acf_include('includes/locations/class-acf-location-user-form.php'); + acf_include('includes/locations/class-acf-location-user-role.php'); + acf_include('includes/locations/class-acf-location-taxonomy.php'); + acf_include('includes/locations/class-acf-location-attachment.php'); + acf_include('includes/locations/class-acf-location-comment.php'); + acf_include('includes/locations/class-acf-location-widget.php'); + acf_include('includes/locations/class-acf-location-nav-menu.php'); + acf_include('includes/locations/class-acf-location-nav-menu-item.php'); + do_action('acf/include_location_rules', $major); + + + // local fields + do_action('acf/include_fields', $major); + + + // action for 3rd party + do_action('acf/init'); + } + + + /* + * register_post_types + * + * This function will register post types and statuses + * + * @type function + * @date 22/10/2015 + * @since 5.3.2 + * + * @param n/a + * @return n/a + */ + + function register_post_types() { + + // vars + $cap = acf_get_setting('capability'); + + + // register post type 'acf-field-group' + register_post_type('acf-field-group', array( + 'labels' => array( + 'name' => __( 'Field Groups', 'acf' ), + 'singular_name' => __( 'Field Group', 'acf' ), + 'add_new' => __( 'Add New' , 'acf' ), + 'add_new_item' => __( 'Add New Field Group' , 'acf' ), + 'edit_item' => __( 'Edit Field Group' , 'acf' ), + 'new_item' => __( 'New Field Group' , 'acf' ), + 'view_item' => __( 'View Field Group', 'acf' ), + 'search_items' => __( 'Search Field Groups', 'acf' ), + 'not_found' => __( 'No Field Groups found', 'acf' ), + 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), + ), + 'public' => false, + 'show_ui' => true, + '_builtin' => false, + 'capability_type' => 'post', + 'capabilities' => array( + 'edit_post' => $cap, + 'delete_post' => $cap, + 'edit_posts' => $cap, + 'delete_posts' => $cap, + ), + 'hierarchical' => true, + 'rewrite' => false, + 'query_var' => false, + 'supports' => array('title'), + 'show_in_menu' => false, + )); + + + // register post type 'acf-field' + register_post_type('acf-field', array( + 'labels' => array( + 'name' => __( 'Fields', 'acf' ), + 'singular_name' => __( 'Field', 'acf' ), + 'add_new' => __( 'Add New' , 'acf' ), + 'add_new_item' => __( 'Add New Field' , 'acf' ), + 'edit_item' => __( 'Edit Field' , 'acf' ), + 'new_item' => __( 'New Field' , 'acf' ), + 'view_item' => __( 'View Field', 'acf' ), + 'search_items' => __( 'Search Fields', 'acf' ), + 'not_found' => __( 'No Fields found', 'acf' ), + 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), + ), + 'public' => false, + 'show_ui' => false, + '_builtin' => false, + 'capability_type' => 'post', + 'capabilities' => array( + 'edit_post' => $cap, + 'delete_post' => $cap, + 'edit_posts' => $cap, + 'delete_posts' => $cap, + ), + 'hierarchical' => true, + 'rewrite' => false, + 'query_var' => false, + 'supports' => array('title'), + 'show_in_menu' => false, + )); + + } + + + /* + * register_post_status + * + * This function will register custom post statuses + * + * @type function + * @date 22/10/2015 + * @since 5.3.2 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + function register_post_status() { + + // acf-disabled + register_post_status('acf-disabled', array( + 'label' => __( 'Inactive', 'acf' ), + 'public' => true, + 'exclude_from_search' => false, + 'show_in_admin_all_list' => true, + 'show_in_admin_status_list' => true, + 'label_count' => _n_noop( 'Inactive (%s)', 'Inactive (%s)', 'acf' ), + )); + + } + + + /* + * posts_where + * + * This function will add in some new parameters to the WP_Query args allowing fields to be found via key / name + * + * @type filter + * @date 5/12/2013 + * @since 5.0.0 + * + * @param $where (string) + * @param $wp_query (object) + * @return $where (string) + */ + + function posts_where( $where, $wp_query ) { + + // global + global $wpdb; + + + // acf_field_key + if( $field_key = $wp_query->get('acf_field_key') ) { + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key ); + } + + // acf_field_name + if( $field_name = $wp_query->get('acf_field_name') ) { + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name ); + } + + // acf_group_key + if( $group_key = $wp_query->get('acf_group_key') ) { + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key ); + } + + + // return + return $where; + + } + + + /* + * define + * + * This function will safely define a constant + * + * @type function + * @date 3/5/17 + * @since 5.5.13 + * + * @param $name (string) + * @param $value (mixed) + * @return n/a + */ + + function define( $name, $value = true ) { + + if( !defined($name) ) { + define( $name, $value ); + } + + } + + /** + * has_setting + * + * Returns true if has setting. + * + * @date 2/2/18 + * @since 5.6.5 + * + * @param string $name + * @return boolean + */ + + function has_setting( $name ) { + return isset($this->settings[ $name ]); + } + + /** + * get_setting + * + * Returns a setting. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param string $name + * @return mixed + */ + + function get_setting( $name ) { + return isset($this->settings[ $name ]) ? $this->settings[ $name ] : null; + } + + /** + * update_setting + * + * Updates a setting. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param string $name + * @param mixed $value + * @return n/a + */ + + function update_setting( $name, $value ) { + $this->settings[ $name ] = $value; + return true; + } + + /** + * get_data + * + * Returns data. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param string $name + * @return mixed + */ + + function get_data( $name ) { + return isset($this->data[ $name ]) ? $this->data[ $name ] : null; + } + + + /** + * set_data + * + * Sets data. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param string $name + * @param mixed $value + * @return n/a + */ + + function set_data( $name, $value ) { + $this->data[ $name ] = $value; + } + + + /** + * get_instance + * + * Returns an instance. + * + * @date 13/2/18 + * @since 5.6.9 + * + * @param string $class The instance class name. + * @return object + */ + + function get_instance( $class ) { + $name = strtolower($class); + return isset($this->instances[ $name ]) ? $this->instances[ $name ] : null; + } + + /** + * new_instance + * + * Creates and stores an instance. + * + * @date 13/2/18 + * @since 5.6.9 + * + * @param string $class The instance class name. + * @return object + */ + + function new_instance( $class ) { + $instance = new $class(); + $name = strtolower($class); + $this->instances[ $name ] = $instance; + return $instance; + } + +} + + +/* +* acf +* +* The main function responsible for returning the one true acf Instance to functions everywhere. +* Use this function like you would a global variable, except without needing to declare the global. +* +* Example: +* +* @type function +* @date 4/09/13 +* @since 4.3.0 +* +* @param N/A +* @return (object) +*/ + +function acf() { + + // globals + global $acf; + + + // initialize + if( !isset($acf) ) { + $acf = new ACF(); + $acf->initialize(); + } + + + // return + return $acf; + +} + + +// initialize +acf(); + + +endif; // class_exists check + +?> diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_dark.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_dark.scss new file mode 100644 index 0000000..d66128c --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_dark.scss @@ -0,0 +1,437 @@ +/*-------------------------------------------------------------------------------------------- +* +* Dark mode +* +* WordPress plugin: https://en-au.wordpress.org/plugins/dark-mode/ +* Github Documentation: https://github.com/danieltj27/Dark-Mode/wiki/Help:-Plugin-Compatibility-Guide +* +*--------------------------------------------------------------------------------------------*/ + +// Dark Mode Colours. +$white: #ffffff; +$black: #000000; +$blue: #0073aa; +$medium-blue: #00a0d2; +$clear: transparent; + +$accent-red: #dc3232; +$accent-orange: #f56e28; +$accent-yellow: #ffb900; +$accent-green: #46b450; +$accent-blue: $blue; +$accent-purple: #826eb4; + +$base-grey: #23282d; +$light-grey: #bbc8d4; +$heavy-grey: #37444c; +$dark-grey: #32373c; +$ultra-grey: #191f25; +$dark-silver: #50626f; +$base-blue: #2e74aa; +$light-blue: #4092d2; +$dark-blue: #2c5f88; +$ultra-blue: #1f3f58; +$bright-blue: #30ceff; + +$editor-lavender: #c678dd; +$editor-sunglo: #e06c75; +$editor-olivine: #98c379; + +// Custom variables. +$body_text: #bbc8d4; +$body_background: #23282d; +$body_background2: #191f25; +$postbox_background: #32373c; +$postbox_border: #191f25; +$postbox_divider: #23282d; +$input_background: #50626f; +$input_text: #fff; +$input_border: #191f25; + +// Mixins. +@mixin dark-text() { + color: $body_text; +} +@mixin dark-heading() { + color: $body_text; +} +@mixin dark-border() { + border-color: $postbox_border; +} +@mixin dark-background() { + background: $body_background; +} +@mixin darker-background() { + background: darken($body_background, 5%); +} +@mixin dark-postbox() { + background-color: $postbox_background; + border-color: $postbox_border; + color: $body_text; +} +@mixin dark-postbox-block() { + background-color: #2d3136; + border-color: $postbox_divider; +} +@mixin dark-divider() { + border-color: $postbox_divider; +} +@mixin dark-input() { + background-color: $input_background; + border-color: $input_border; + color: $input_text; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Global +* +*---------------------------------------------------------------------------------------------*/ + +// acf-box +.acf-box { + @include dark-postbox(); + + .title, + .footer { + @include dark-divider(); + } + + h2 { + @include dark-heading(); + } + + table, tbody, tr { + background: transparent !important; + } +} + +// thead +.acf-thead { + @include dark-heading(); + @include dark-border(); +} +.acf-tfoot { + @include dark-postbox-block(); +} + +// table clear +.acf-table.-clear, +.acf-table.-clear tr { + background: transparent !important; +} + +// loading overlay +.acf-loading-overlay { + background: rgba(0,0,0,0.5); +} + + +/*--------------------------------------------------------------------------------------------- +* +* Fields +* +*---------------------------------------------------------------------------------------------*/ + +// fields +.acf-fields { + + // field + > .acf-field { + @include dark-divider(); + } +} + +// fields (left) +.acf-fields.-left { + + > .acf-field { + &:before { + background: rgba(0,0,0,0.1); + @include dark-divider(); + } + } +} + +// fields (border) +.acf-fields.-border { + @include dark-postbox(); +} + +// width +.acf-field[data-width] + .acf-field[data-width] { + @include dark-divider(); +} + +// text +.acf-input-prepend, +.acf-input-append { + @include dark-postbox(); +} + +// tab +.acf-tab-wrap { + +} + +.acf-fields > .acf-tab-wrap { + @include dark-postbox(); + + .acf-tab-group { + @include dark-postbox-block(); + + li { + a { + @include dark-postbox-block(); + + &:hover { + @include dark-postbox-block(); + @include dark-text(); + } + } + + &.active a { + @include dark-postbox(); + } + } + } +} + +.acf-fields.-sidebar { + &:before { + @include dark-postbox-block(); + } +} + +.acf-fields.-sidebar.-left { + &:before { + @include dark-postbox-block(); + background: $body_background; + } + > .acf-tab-wrap.-left { + .acf-tab-group li a { + @include dark-postbox-block(); + } + + .acf-tab-group li.active a { + @include dark-postbox-block(); + } + } +} + +// file +.acf-file-uploader { + + .show-if-value { + @include dark-postbox(); + + .file-icon { + @include dark-postbox-block(); + } + } +} + +// acf-oembed +.acf-oembed { + @include dark-postbox-block(); + + .title { + @include dark-input(); + } +} + +// gallery +.acf-gallery { + @include dark-postbox-block(); + + .acf-gallery-main { + @include dark-background(); + } + + .acf-gallery-attachment { + .margin { + @include dark-postbox-block(); + } + } + + .acf-gallery-side { + @include dark-postbox-block(); + + .acf-gallery-side-info { + @include dark-postbox-block(); + } + } + + .acf-gallery-toolbar { + @include dark-postbox-block(); + } +} + +// button group +.acf-button-group { + + label:not(.selected) { + @include dark-postbox-block(); + } +} + +// switch +.acf-switch:not(.-on) { + @include dark-postbox-block(); + .acf-switch-slider { + @include dark-input(); + } +} + +// link +.acf-link .link-wrap { + @include dark-postbox-block(); +} + +// relationship +.acf-relationship { + .filters { + @include dark-postbox(); + } + .selection { + @include dark-postbox-block(); + .choices, + .choices-list, + .values { + @include dark-postbox-block(); + } + } +} + +// checkbox +.acf-taxonomy-field .categorychecklist-holder { + @include dark-postbox-block(); +} + +// google map +.acf-google-map { + @include dark-postbox-block(); + + .title { + @include dark-input(); + } +} + +// accordion +.acf-accordion { + @include dark-postbox(); +} +.acf-field.acf-accordion .acf-accordion-content > .acf-fields { + @include dark-border(); +} + +// flexible content +.acf-flexible-content { + .layout { + @include dark-postbox(); + + .acf-fc-layout-handle { + @include dark-postbox-block(); + + .acf-fc-layout-order { + @include dark-postbox(); + } + } + } +} + +// repeater +#wpbody .acf-table { + @include dark-postbox-block(); + + > tbody, + > thead { + > tr { + background: transparent; + + > td, + > th { + @include dark-border(); + } + } + } +} + +// Select +.acf-field select { + optgroup, optgroup:nth-child(2n) { + background: $input_background; + } +} + +/*--------------------------------------------------------------------------------------------- +* +* Field Group +* +*---------------------------------------------------------------------------------------------*/ + +// fields +#acf-field-group-fields { + + // field list + .acf-field-list-wrap { + @include dark-postbox(); + } + + .acf-field-list { + .no-fields-message { + @include dark-postbox(); + } + } + + // field + .acf-field-object { + @include dark-postbox(); + @include dark-divider(); + + + table, tbody, tr, td, th { + background: transparent; + @include dark-divider(); + } + + .acf-field { + .acf-label { + @include dark-postbox-block(); + } + } + + // sortable + &.ui-sortable-helper { + @include dark-border(); + box-shadow: none; + } + + &.ui-sortable-placeholder { + @include dark-postbox-block(); + box-shadow: none; + } + } + + .acf-field-object + .acf-field-object-tab::before, + .acf-field-object + .acf-field-object-accordion::before { + @include dark-postbox-block(); + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* Admin: Tools +* +*---------------------------------------------------------------------------------------------*/ + +// tools +.acf-meta-box-wrap { + + .acf-fields { + @include dark-input(); + background: transparent; + } +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_field-group.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_field-group.scss new file mode 100644 index 0000000..22daff3 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_field-group.scss @@ -0,0 +1,600 @@ +/*--------------------------------------------------------------------------------------------- +* +* Global +* +*---------------------------------------------------------------------------------------------*/ + +#adv-settings .show-field-keys label { + padding: 0 5px; +} + + +#acf-field-group-fields > .inside, +#acf-field-group-locations > .inside, +#acf-field-group-options > .inside { + padding: 0; + margin: 0; +} + +.acf-field { + + p.description { + font-style: normal; + font-size: 12px; + color: #777777; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Postbox: Publish +* +*---------------------------------------------------------------------------------------------*/ + +#minor-publishing-actions, +#misc-publishing-actions #visibility { + display: none; +} + +#minor-publishing { + border-bottom: 0 none; +} + +#misc-pub-section { + border-bottom: 0 none; +} + +#misc-publishing-actions .misc-pub-section { + border-bottom-color: #F5F5F5; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Postbox: Fields +* +*---------------------------------------------------------------------------------------------*/ + +#acf-field-group-fields { + border: 0 none; + box-shadow: none; + + + /* metabox */ + > .handlediv, + > .hndle { + display: none; + } + + + /* links */ + a { + text-decoration: none; + + &:active, + &:focus { + outline: none; + box-shadow: none; + } + } + + + /* table header */ + .li-field-order { width: 20%; } + .li-field-label { width: 30%; } + .li-field-name { width: 25%; } + .li-field-type { width: 25%; } + .li-field-key { display: none; } + + + /* show keys */ + &.show-field-keys { + + .li-field-label, + .li-field-name, + .li-field-type, + .li-field-key { width: 20%; } + .li-field-key { display: block; } + } + + + /* fields */ + .acf-field-list-wrap { + border: #DFDFDF solid 1px; + } + + .acf-field-list { + background: #F9F9F9; + margin-top: -1px; + + /* no fields */ + .no-fields-message { + padding: 15px 15px; + background: #fff; + display: none; + } + + /* empty */ + &.-empty { + .no-fields-message { + display: block; + } + } + } + +} + + +/* field object */ +.acf-field-object { + border-top: #F0F0F0 solid 1px; + background: #fff; + + /* sortable */ + &.ui-sortable-helper { + border-top-color: #fff; + box-shadow: 0 0 0 1px #DFDFDF, 0 1px 4px rgba(0,0,0,0.1); + } + + &.ui-sortable-placeholder { + box-shadow: 0 -1px 0 0 #DFDFDF; + visibility: visible !important; + background: #F9F9F9; + border-top-color: transparent; + min-height: 54px; + + // hide tab field separator + &:after, &:before { + visibility: hidden; + } + } + + + /* meta */ + > .meta { + display: none; + } + + + /* handle */ + > .handle { + + a { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + } + + li { + padding-top: 10px; + padding-bottom: 10px; + word-wrap: break-word; + } + + .acf-icon { + margin: 1px 0 0; + cursor: move; + background: transparent; + float: left; + + height: 28px; + line-height: 28px; + width: 28px; + font-size: 13px; + color: #444; + position: relative; + z-index: 1; + } + + strong { + display: block; + padding-bottom: 6px; + font-size: 14px; + line-height: 14px; + min-height: 14px; + } + + .row-options { + visibility: hidden; + + a { + margin-right: 4px; + } + + a.delete-field { + color: #a00; + + &:hover { color: #f00; } + } + } + + } + + /* open */ + &.open { + + + .acf-field-object { + border-top-color: #E1E1E1; + } + + > .handle { + background: $acf_blue; + border: darken($acf_blue, 2%) solid 1px; + text-shadow: #268FBB 0 1px 0; + color: #fff; + position: relative; + margin: -1px -1px 0 -1px; + + a { + color: #fff !important; + + &:hover { + text-decoration: underline !important; + } + } + + .acf-icon { + border-color: #fff; + color: #fff; + } + + .acf-required { + color: #fff; + } + } + } + + +/* + // debug + &[data-save="meta"] { + > .handle { + border-left: #ffb700 solid 5px !important; + } + } + + &[data-save="settings"] { + > .handle { + border-left: #0ec563 solid 5px !important; + } + } +*/ + + + /* hover */ + &:hover, &.-hover { + + > .handle { + + .row-options { + visibility: visible; + } + + } + } + + + /* settings */ + > .settings { + display: none; + width: 100%; + + > .acf-table { + border: none; + } + } + + + /* conditional logic */ + .rule-groups { + margin-top: 20px; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Postbox: Locations +* +*---------------------------------------------------------------------------------------------*/ + +.rule-groups { + + h4 { + margin: 15px 0 5px; + } + + .rule-group { + margin: 0 0 5px; + + h4 { + margin: 0 0 3px; + } + + td.param { + width: 35%; + } + + td.operator { + width: 20%; + } + + td.add { + width: 40px; + } + + td.remove { + width: 28px; + vertical-align: middle; + + a { + visibility: hidden; + } + } + + tr:hover td.remove a { + visibility: visible; + } + + /* Don't allow user to delete the first field group */ + &:first-child tr:first-child td.remove a { + visibility: hidden !important; + } + + // empty select + select:empty { + background: #f8f8f8; + } + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* Options +* +*---------------------------------------------------------------------------------------------*/ + +#acf-field-group-options tr[data-name="hide_on_screen"] li { + float: left; + width: 33%; +} + +@media (max-width: 1100px) { + + #acf-field-group-options tr[data-name="hide_on_screen"] li { + width: 50%; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Conditional Logic +* +*---------------------------------------------------------------------------------------------*/ + +table.conditional-logic-rules { + background: transparent; + border: 0 none; + border-radius: 0; +} + +table.conditional-logic-rules tbody td { + background: transparent; + border: 0 none !important; + padding: 5px 2px !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field: Tab +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-object-tab { + + // hide setting + .acf-field-setting-name, + .acf-field-setting-instructions, + .acf-field-setting-required, + .acf-field-setting-warning, + .acf-field-setting-wrapper { + display: none; + } + + // hide name + .li-field-name { + visibility: hidden; + } + + // add spacer + .acf-field-object + & { + + &:before { + display: block; + content: ""; + height: 5px; + width: 100%; + background: #f9f9f9; + border-bottom: #f0f0f0 solid 1px; + } + } + + p:first-child { + margin: 0.5em 0; + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field: Accordion +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-object-accordion { + @extend .acf-field-object-tab; + + // show settings + .acf-field-setting-instructions { + display: table-row; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field: Message +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-object-message tr[data-name="name"], +.acf-field-object-message tr[data-name="instructions"], +.acf-field-object-message tr[data-name="required"] { + display: none !important; +} + +.acf-field-object-message .li-field-name { + visibility: hidden; +} + +.acf-field-object-message textarea { + height: 175px !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field: Separator +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-object-separator tr[data-name="name"], +.acf-field-object-separator tr[data-name="instructions"], +.acf-field-object-separator tr[data-name="required"] { + display: none !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field: Date Picker +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-object-date-picker, +.acf-field-object-time-picker, +.acf-field-object-date-time-picker { + + .acf-radio-list { + + li { + line-height: 25px; + } + + span { + display: inline-block; + min-width: 10em; + } + + input[type="text"] { + width: 100px; + } + } + +} + +.acf-field-object-date-time-picker { + + .acf-radio-list { + + span { + min-width: 15em; + } + + input[type="text"] { + width: 200px; + } + } + +} + + +/*-------------------------------------------------------------------------------------------- +* +* Slug +* +*--------------------------------------------------------------------------------------------*/ + +#slugdiv { + + .inside { + padding: 12px; + margin: 0; + } + + input[type="text"] { + width: 100%; + height: 28px; + font-size: 14px; + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* RTL +* +*--------------------------------------------------------------------------------------------*/ + +html[dir="rtl"] .acf-field-object.open > .handle { + margin: -1px -1px 0; +} + +html[dir="rtl"] .acf-field-object.open > .handle .acf-icon { + float: right; +} + +html[dir="rtl"] .acf-field-object.open > .handle .li-field-order { + padding-left: 0 !important; + padding-right: 15px !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Device +* +*---------------------------------------------------------------------------------------------*/ + +@media only screen and (max-width: 850px) { + + tr.acf-field, + td.acf-label, + td.acf-input { + display: block !important; + width: auto !important; + border: 0 none !important; + } + + tr.acf-field { + border-top: #ededed solid 1px !important; + margin-bottom: 0 !important; + } + + td.acf-label { + background: transparent !important; + padding-bottom: 0 !important; + + } + +} + diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_fields.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_fields.scss new file mode 100644 index 0000000..5a150fa --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_fields.scss @@ -0,0 +1,2778 @@ +/*-------------------------------------------------------------------------------------------- +* +* acf-field +* +*--------------------------------------------------------------------------------------------*/ + +.acf-field, +.acf-field .acf-label, +.acf-field .acf-input { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + position: relative; +} + +.acf-field { + margin: 15px 0; + + // clear is important as it will avoid any layout issues with floating fields + // do not delete (you have tried this) + clear: both; + + // description + p.description { + display: block; + margin: 0; + padding: 0; + } + + // label + .acf-label { + vertical-align: top; + margin: 0 0 10px; + + label { + display: block; + font-weight: bold; + margin: 0 0 3px; + padding: 0; + } + + &:empty { + margin-bottom: 0; + } + } + + // input + .acf-input { + vertical-align: top; + + > p.description { + margin-top: 5px; + } + } + + // notice + .acf-notice { + margin: 0 0 15px; + background: #edf2ff; + color: #2183b9; + border: none; + + .acf-notice-dismiss { + background: transparent; + color: inherit; + + &:hover { + background: #fff; + } + } + + // dismiss + &.-dismiss { + padding-right: 40px; + } + + // error + &.-error { + background: #ffe6e6; + color: #d12626; + } + + // success + &.-success { + background: #eefbe8; + color: #32a23b; + } + + // warning + &.-warning { + background: #fff3e6; + color: #d16226; + } + } + + // table + @at-root td#{&}, tr#{&} { + margin: 0; + } +} + +// width +.acf-field[data-width] { + float: left; + clear: none; + + // next + + .acf-field[data-width] { + border-left: 1px solid #eeeeee; + } + + // rtl + html[dir="rtl"] & { + float: right; + + + .acf-field[data-width] { + border-left: none; + border-right: 1px solid #eeeeee; + } + } + + // table + @at-root td#{&}, tr#{&} { + float: none; + } + + // mobile +/* + @media screen and (max-width: $sm) { + float: none; + width: auto; + border-left-width: 0; + border-right-width: 0; + } +*/ +} + + +// float helpers +.acf-field.-c0 { + clear: both; + border-left-width: 0 !important; + + // rtl + html[dir="rtl"] & { + border-left-width: 1px !important; + border-right-width: 0 !important; + } +} + +.acf-field.-r0 { + border-top-width: 0 !important; +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-fields +* +*--------------------------------------------------------------------------------------------*/ + +.acf-fields { + position: relative; + + // clearifx + @include clearfix(); + + // border + &.-border { + border: #dfdfdf solid 1px; + background: #fff; + } + + // field + > .acf-field { + position: relative; + margin: 0; + padding: $field_padding; + border-top: #EEEEEE solid 1px; + + // first + &:first-child { + border-top-width: 0; + } + } + + // table + @at-root td#{&} { + padding: 0 !important; + } +} + + + +/*-------------------------------------------------------------------------------------------- +* +* acf-fields (clear) +* +*--------------------------------------------------------------------------------------------*/ + +.acf-fields.-clear > .acf-field { + border: none; + padding: 0; + margin: 15px 0; + + // width + &[data-width] { + border: none !important; + } + + // label + > .acf-label { + padding: 0; + } + + // input + > .acf-input { + padding: 0; + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-fields (left) +* +*--------------------------------------------------------------------------------------------*/ + +.acf-fields.-left > .acf-field { + padding: $fy 0; + + // clearifx + @include clearfix(); + + // sidebar + &:before { + content: ""; + display: block; + position: absolute; + z-index: 0; + background: #F9F9F9; + border-color: #E1E1E1; + border-style: solid; + border-width: 0 1px 0 0; + top: 0; + bottom: 0; + left: 0; + width: 20%; + } + + // width + &[data-width] { + float: none; + width: auto !important; + border-left-width: 0 !important; + border-right-width: 0 !important; + } + + // label + > .acf-label { + float: left; + width: 20%; + margin: 0; + padding: 0 $fx; + } + + // input + > .acf-input { + float: left; + width: 80%; + margin: 0; + padding: 0 $fx; + } + + // rtl + html[dir="rtl"] & { + + // sidebar + &:before { + border-width: 0 0 0 1px; + left: auto; + right: 0; + } + + // label + > .acf-label { + float: right; + } + + // input + > .acf-input { + float: right; + } + } + + // mobile + @media screen and (max-width: $sm) { + + // sidebar + &:before { + display: none; + } + + // label + > .acf-label { + width: 100%; + margin-bottom: 10px; + } + + // input + > .acf-input { + width: 100%; + } + } +} + +/* clear + left */ +.acf-fields.-clear.-left > .acf-field { + padding: 0; + border: none; + + // sidebar + &:before { + display: none; + } + + // label + > .acf-label { + padding: 0; + } + + // input + > .acf-input { + padding: 0; + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-table +* +*--------------------------------------------------------------------------------------------*/ + +.acf-table tr.acf-field { + + // label + > td.acf-label { + padding: $fp; + margin: 0; + background: #F9F9F9; + width: 20%; + } + + // input + > td.acf-input { + padding: $fp; + margin: 0; + border-left-color: #E1E1E1; + } +} + +.acf-sortable-tr-helper { + position: relative !important; + display: table-row !important; +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-postbox +* +*--------------------------------------------------------------------------------------------*/ + +.acf-postbox { + position: relative; + + // inside + > .inside { + margin: 0 !important; /* override WP style - do not delete - you have tried this before */ + padding: 0 !important; /* override WP style - do not delete - you have tried this before */ + } + + // hndle + > .hndle { + + /* edit field group */ + .acf-hndle-cog { + color: #AAAAAA; + font-size: 16px; + line-height: 20px; + padding: 0 2px; + float: right; + position: relative; + display: none; + + &:hover { + color: #777777; + } + } + } + + // hover + &:hover > .hndle .acf-hndle-cog { + display: block; + } + + // replace + .acf-replace-with-fields { + padding: 15px; + text-align: center; + } +} + +// Correct margin around #acf_after_title +#post-body-content #acf_after_title-sortables { + margin: 20px 0 -20px; +} + +/* seamless */ +.acf-postbox.seamless { + border: 0 none; + background: transparent; + box-shadow: none; + + + /* hide hndle */ + > .hndle, + > .handlediv { + display: none !important; + } + + + /* inside */ + > .inside { + display: block !important; /* stop metabox from hiding when closed */ + margin-left: -$field_padding_x !important; + margin-right: -$field_padding_x !important; + + > .acf-field { + border-color: transparent; + } + } +} + + +/* seamless (left) */ +.acf-postbox.seamless > .acf-fields.-left { + + /* hide sidebar bg */ + > .acf-field:before { + display: none; + } + + + /* mobile */ + @media screen and (max-width: 782px) { + + /* remove padding */ + & > .acf-field > .acf-label, + & > .acf-field > .acf-input { + padding: 0; + } + } +} + +/*--------------------------------------------------------------------------------------------- +* +* Inputs +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field { + + // inputs + input[type="text"], + input[type="password"], + input[type="number"], + input[type="search"], + input[type="email"], + input[type="url"], + textarea, + select { + width: 100%; + padding: 3px 5px; + resize: none; + margin: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + + font-size: 14px; + line-height: 1.4; + + // disabled + &:disabled { + background: #f8f8f8; + } + + // readonly + &[readonly] { + background: #f8f8f8; + } + } + + // textarea + textarea { + resize: vertical; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Text +* +*---------------------------------------------------------------------------------------------*/ +.acf-input-prepend, +.acf-input-append, +.acf-input-wrap { + box-sizing: border-box; +} + +.acf-input-prepend, +.acf-input-append { + font-size: 13px; + line-height: 20px; + padding: 3px 7px; + background: #F4F4F4; + border: #DFDFDF solid 1px; +} + +.acf-input-prepend { + float: left; + border-right-width: 0; + border-radius: 3px 0 0 3px; +} + +.acf-input-append { + float: right; + border-left-width: 0; + border-radius: 0 3px 3px 0; +} + +.acf-input-wrap { + position: relative; + overflow: hidden; + + input { + height: 28px; + margin: 0; + } +} + +input.acf-is-prepended { + border-radius: 0 3px 3px 0 !important; +} + +input.acf-is-appended { + border-radius: 3px 0 0 3px !important; +} + +input.acf-is-prepended.acf-is-appended { + border-radius: 0 !important; +} + + +/* rtl */ +html[dir="rtl"] .acf-input-prepend { + border-left-width: 0; + border-right-width: 1px; + border-radius: 0 3px 3px 0; + + float: right; +} + +html[dir="rtl"] .acf-input-append { + border-left-width: 1px; + border-right-width: 0; + border-radius: 3px 0 0 3px; + float: left; +} + +html[dir="rtl"] input.acf-is-prepended { + border-radius: 3px 0 0 3px !important; +} + +html[dir="rtl"] input.acf-is-appended { + border-radius: 0 3px 3px 0 !important; +} + +html[dir="rtl"] input.acf-is-prepended.acf-is-appended { + border-radius: 0 !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Color Picker +* +*---------------------------------------------------------------------------------------------*/ + +.acf-color-picker { + + .wp-picker-active { + position: relative; + z-index: 1; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Url +* +*---------------------------------------------------------------------------------------------*/ + +.acf-url { + + i { + position: absolute; + top: 4px; + left: 4px; + opacity: 0.5; + color: #A9A9A9; + } + + input[type="url"] { + padding-left: 25px; + } + + &.-valid i { + opacity: 1; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Select +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field select { + padding: 2px; +} + +.acf-field select optgroup { + padding: 5px; + background: #fff; +} + +.acf-field select option { + padding: 3px; +} + +.acf-field select optgroup option { + padding-left: 5px; +} + +.acf-field select optgroup:nth-child(2n) { + background: #F9F9F9; +} + +.acf-field .select2-input { + max-width: 200px; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Select2 (v3) +* +*---------------------------------------------------------------------------------------------*/ + +.select2-container.-acf { + + .select2-choices { + background: #fff; + border-color: #ddd; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset; + min-height: 31px; + + .select2-search-choice { + margin: 5px 0 5px 5px; + padding: 3px 5px 3px 18px; + border-color: #bbb; + background: #f9f9f9; + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset; + + /* sortable item*/ + &.ui-sortable-helper { + background: #5897fb; + border-color: darken(#5897fb, 5%); + color: #fff; + box-shadow: 0 0 3px rgba(0,0,0,0.1); + + a { + visibility: hidden; + } + } + + + /* sortable shadow */ + &.ui-sortable-placeholder { + background-color: #f7f7f7; + border-color: #f7f7f7; + visibility: visible !important; + } + } + + .select2-search-choice-focus { + border-color: #999; + } + + .select2-search-field input { + height: 31px; + line-height: 22px; + margin: 0; + padding: 5px 5px 5px 7px; + } + } + + .select2-choice { + border-color: #BBBBBB; + + .select2-arrow { + background: transparent; + border-left-color: #DFDFDF; + padding-left: 1px; + } + + .select2-result-description { + display: none; + } + } + + + + /* open */ + &.select2-container-active .select2-choices, + &.select2-dropdown-open .select2-choices { + border-color: #5B9DD9; + border-radius: 3px 3px 0 0; + } + + + /* single open */ + &.select2-dropdown-open .select2-choice { + background: #fff; + border-color: #5B9DD9; + } + +} + +/* rtl */ +html[dir="rtl"] .select2-container.-acf { + + .select2-search-choice-close { + left: 24px; + } + + .select2-choice > .select2-chosen { + margin-left: 42px; + } + + .select2-choice .select2-arrow { + padding-left: 0; + padding-right: 1px; + } +} + + +/* description */ +.select2-drop { + + /* search*/ + .select2-search { + padding: 4px 4px 0; + } + + + /* result */ + .select2-result { + + .select2-result-description { + color: #999; + font-size: 12px; + margin-left: 5px; + } + + + /* hover*/ + &.select2-highlighted { + + .select2-result-description { + color: #fff; + opacity: 0.75; + } + + } + + } + +} + + + +/*--------------------------------------------------------------------------------------------- +* +* Select2 (v4) +* +*---------------------------------------------------------------------------------------------*/ + +// Fix unneeded bottom margin. +.select2-container.-acf { + + // Reset WP default style. + li{ + margin-bottom: 0; + } + + // Multiple wrap. + .select2-selection--multiple { + + // If no value, increase hidden search input full width. + // Overrides calculated px width issues. + .select2-search--inline:first-child { + float: none; + input { + width: 100% !important; + } + } + + // ul: Remove padding because li already has margin-right. + .select2-selection__rendered { + padding-right: 0; + } + + // li + .select2-selection__choice { + background-color: #f7f7f7; + border-color: #cccccc; + + // Allow choice to wrap multiple lines. + max-width: 100%; + overflow: hidden; + word-wrap: normal !important; + white-space: normal; + + // Sortable. + &.ui-sortable-helper { + background: #5897fb; + border-color: darken(#5897fb, 5%); + color: #fff; + box-shadow: 0 0 3px rgba(0,0,0,0.1); + + span { + visibility: hidden; + } + } + + // Sortable shadow + &.ui-sortable-placeholder { + background-color: #f7f7f7; + border-color: #f7f7f7; + visibility: visible !important; + } + } + + // search + .select2-search__field { + box-shadow: none !important; + } + } + + // Single choice. + .select2-selection--single { + + } + + // Fix single select pushing out repeater field table width. + .acf-row & .select2-selection--single { + overflow: hidden; + .select2-selection__rendered { + white-space: normal; + } + } +} + +// z-index helper. +.select2-container { + .select2-dropdown { + z-index: 900000; + } +} + +/*--------------------------------------------------------------------------------------------- +* +* Link +* +*---------------------------------------------------------------------------------------------*/ + +.link-wrap { + border: #dddddd solid 1px; + border-radius: 3px; + padding: 5px; + line-height: 26px; + background: #fff; + + word-wrap: break-word; + word-break: break-all; + + .link-title { + padding: 0 5px; + } + +} + +.acf-link { + + .link-wrap, + .acf-icon.-link-ext { display: none; } + + /* value */ + &.-value { + + .button { display: none; } + .link-wrap { display: inline-block; } + + } + + + /* external */ + &.-external { + + .acf-icon.-link-ext { display: inline-block; } + + } + +} + +#wp-link-backdrop { z-index: 900000 !important; } +#wp-link-wrap { z-index: 900001 !important; } + + + +/*--------------------------------------------------------------------------------------------- +* +* Radio +* +*---------------------------------------------------------------------------------------------*/ + +ul.acf-radio-list, +ul.acf-checkbox-list { + background: transparent; + position: relative; + padding: 1px; + margin: 0; + + li { + font-size: 13px; + line-height: 22px; + margin: 0; + position: relative; + word-wrap: break-word; + + label { + display: inline; + } + + input[type="checkbox"], + input[type="radio"] { + margin: -1px 4px 0 0; + vertical-align: middle; + } + + input[type="text"] { + width: auto; + vertical-align: middle; + margin: 2px 0; + } + + + /* attachment sidebar fix*/ + span { + float: none; + } + + i { + vertical-align: middle; + } + } + + + /* hl */ + &.acf-hl { + + li { + margin-right: 20px; + clear: none; + } + } + + + /* rtl */ + html[dir="rtl"] & { + + input[type="checkbox"], + input[type="radio"] { + margin-left: 4px; + margin-right: 0; + } + } + + + + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Button Group +* +*---------------------------------------------------------------------------------------------*/ + +.acf-button-group { + display: inline-block; + + label { + display: inline-block; + border: #ccc solid 1px; + position: relative; + z-index: 1; + padding: 5px 10px; + background: #fff; + + &:hover { + border-color: darken(#ccc, 20%); + z-index: 2; + } + + &.selected { + border-color: darken(#309cf3, 1%); + background: #309cf3; + color: #fff; + z-index: 2; + + &:hover { + background: lighten(#309cf3, 5%); + } + } + } + + input { + display: none !important; + } + + + /* default (horizontal) */ + & { + padding-left: 1px; + display: inline-flex; + flex-direction: row; + flex-wrap: nowrap; + + label { + margin: 0 0 0 -1px; + flex: 1; + text-align: center; + white-space: nowrap; + + // corners + &:first-child { + border-radius: 3px 0 0 3px; + html[dir="rtl"] & { border-radius: 0 3px 3px 0; } + } + &:last-child { + border-radius: 0 3px 3px 0; + html[dir="rtl"] & { border-radius: 3px 0 0 3px; } + } + &:only-child { border-radius: 3px; } + } + } + + + /* vertical */ + &.-vertical { + padding-left: 0; + padding-top: 1px; + flex-direction: column; + + label { + margin: -1px 0 0 0; + + // corners + &:first-child { border-radius: 3px 3px 0 0; } + &:last-child { border-radius: 0 0 3px 3px; } + &:only-child { border-radius: 3px; } + + } + } + + +} + + + +/*--------------------------------------------------------------------------------------------- +* +* Checkbox +* +*---------------------------------------------------------------------------------------------*/ + +.acf-checkbox-list { + + .button { + margin: 10px 0 0; + } + +} + + + +/*--------------------------------------------------------------------------------------------- +* +* True / False +* +*---------------------------------------------------------------------------------------------*/ + +.acf-switch { + display: inline-block; + border-radius: 5px; + cursor: pointer; + position: relative; + background: #f8f8f8; + height: 30px; + vertical-align: middle; + //box-shadow: inset 0 0 1px rgba(0,0,0,0.2); + border: #ccc solid 1px; + + -webkit-transition: background 0.25s ease; + -moz-transition: background 0.25s ease; + -o-transition: background 0.25s ease; + transition: background 0.25s ease; + + span { + display: inline-block; + float: left; + text-align: center; + + font-size: 13px; + line-height: 22px; + + padding: 4px 10px; + min-width: 15px; + + i { + vertical-align: middle; + } + } + + .acf-switch-on { + color: #fff; + text-shadow: darken($acf_blue, 10%) 0 1px 0; + } + + .acf-switch-off { + + } + + .acf-switch-slider { + position: absolute; + top: 2px; + left: 2px; + bottom: 2px; + right: 50%; + z-index: 1; + background: #fff; + border-radius: 3px; + border: #ccc solid 1px; + + -webkit-transition: all 0.25s ease; + -moz-transition: all 0.25s ease; + -o-transition: all 0.25s ease; + transition: all 0.25s ease; + + transition-property: left, right; + } + + + /* hover */ + &:hover { + .acf-switch-slider{ + border-color: darken(#ccc, 10%); + } + } + + + /* active */ + &.-on { + background: #309cf3; + border-color: darken(#309cf3, 1%); + + .acf-switch-slider { + left: 50%; + right: 2px; + border-color: darken(#309cf3, 10%); + } + + /* hover */ + &:hover { + background: lighten(#309cf3, 5%); + } + } + + + /* focus */ + &.-focus { + + .acf-switch-slider { + border-color: #5b9dd9; + box-shadow: 0 0 2px rgba(30, 140, 190, 0.5); + } + + + &.-on { + + .acf-switch-slider { + border-color: darken($acf_blue, 20%); + box-shadow: 0 0 2px darken($acf_blue, 10%); + } + } + + } + + + /* message */ + + span { + margin-left: 6px; + } + +} + + +/* checkbox */ +.acf-switch-input { + opacity: 0; + position: absolute; + margin: 0; +} + + +/* in media modal */ +.compat-item .acf-true-false { + + .message { + float: none; + padding: 0; + vertical-align: middle; + } + +} + + +/*-------------------------------------------------------------------------- +* +* Google Map +* +*-------------------------------------------------------------------------*/ + +.acf-google-map { + position: relative; + border: #DFDFDF solid 1px; + background: #fff; + + .title { + position: relative; + border-bottom: #DFDFDF solid 1px; + + .search { + margin: 0; + font-size: 14px; + line-height: 30px; + height: 40px; + padding: 5px 10px; + border: 0 none; + box-shadow: none; + border-radius: 0; + font-family: inherit; + cursor: text; + } + + .acf-actions { + + } + + .acf-loading { + position: absolute; + top: 10px; + right: 11px; + display: none; + } + + &:hover { + .acf-actions { display: block; } + } + } + + .canvas { + height: 400px; + } + + + /* default is focused */ + .title { + .acf-icon.-location { + display: inline-block; + } + .acf-icon.-cancel { + display: none; + } + .acf-icon.-search { + display: none; + } + } + + + /* -search */ + &.-search .title { + .acf-icon.-location { + display: none; + } + .acf-icon.-cancel { + display: inline-block; + } + .acf-icon.-search { + display: inline-block; + } + } + + + + /* -value */ + &.-value .title { + .search { + font-weight: bold; + } + .acf-icon.-location { + display: none; + } + .acf-icon.-cancel { + display: inline-block; + } + .acf-icon.-search { + display: none; + } + } + + + /* -loading */ + &.-loading .title { + a { + display: none !important; + } + i { + display: inline-block; + } + } + +} + + + +/* autocomplete */ +.pac-container { + border-width: 1px 0; + box-shadow: none; +} + +.pac-container:after { + display: none; +} + +.pac-container .pac-item:first-child { + border-top: 0 none; +} +.pac-container .pac-item { + padding: 5px 10px; + cursor: pointer; +} + + +html[dir="rtl"] .pac-container .pac-item { + text-align: right; +} + + +/*-------------------------------------------------------------------------- +* +* Relationship +* +*-------------------------------------------------------------------------*/ + +.acf-relationship { + background: #fff; + + /* filters (top) */ + .filters { + @include clearfix(); + border: #DFDFDF solid 1px; + background: #fff; + + + .filter { + margin: 0; + padding: 0; + float: left; + width: 100%; + + + /* inner padding */ + span { + display: block; + padding: 7px 7px 7px 0; + } + + &:first-child span { + padding-left: 7px; + } + + + // inputs + input, select { + height: 28px; + line-height: 28px; + padding: 2px; + width: 100%; + margin: 0; + float: none; /* potential fix for media popup? */ + + &:focus, + &:active { + outline: none; + box-shadow: none; + } + } + + input { + border-color: transparent; + box-shadow: none; + } + + } + + + /* widths */ + &.-f2 { + .filter { width: 50%; } + } + &.-f3 { + .filter { width: 25%; } + .filter.-search { width: 50%; } + } + + } + + + /* list */ + .list { + margin: 0; + padding: 5px; + height: 160px; + overflow: auto; + + .acf-rel-label, + .acf-rel-item, + p { + padding: 5px 7px; + margin: 0; + display: block; + position: relative; + min-height: 18px; + } + + .acf-rel-label { + font-weight: bold; + } + + .acf-rel-item { + cursor: pointer; + + b { + text-decoration: underline; + font-weight: normal; + } + + .thumbnail { + background: darken(#f9f9f9, 10%); + width: 22px; + height: 22px; + float: left; + margin: -2px 5px 0 0; + + img { + max-width: 22px; + max-height: 22px; + margin: 0 auto; + display: block; + } + + &.-icon { + background: #fff; + + img { + max-height: 20px; + margin-top: 1px; + } + } + } + + /* hover */ + &:hover { + background: #3875D7; + color: #fff; + + .thumbnail { + background: lighten(#3875D7, 25%); + + &.-icon { + background: #fff; + } + } + } + + + /* disabled */ + &.disabled { + opacity: 0.5; + + &:hover { + background: transparent; + color: #333; + cursor: default; + + .thumbnail { + background: darken(#f9f9f9, 10%); + + &.-icon { + background: #fff; + } + } + } + } + } + + ul { + padding-bottom: 5px; + + .acf-rel-label, + .acf-rel-item, + p { + padding-left: 20px; + } + + } + + } + + + /* selection (bottom) */ + .selection { + @include clearfix(); + border: #DFDFDF solid 1px; + position: relative; + margin-top: -1px; + + .values, + .choices { + width: 50%; + background: #fff; + float: left + } + + /* choices */ + .choices { + background: #F9F9F9; + + .list { + border-right: #DFDFDF solid 1px; + } + + } + + + /* values */ + .values { + + .acf-icon { + position: absolute; + top: 4px; + right: 7px; + display: none; + + /* rtl */ + html[dir="rtl"] & { + right: auto; + left: 7px; + } + + } + + .acf-rel-item:hover .acf-icon { + display: block; + } + + .acf-rel-item { + cursor: move; + + b { + text-decoration: none; + } + + } + + } + + } + + +} + +/* menu item fix */ +.menu-item { + + .acf-relationship { + + ul { + width: auto; + } + + li { + display: block; + } + } +} + + +/*-------------------------------------------------------------------------- +* +* WYSIWYG +* +*-------------------------------------------------------------------------*/ + +.acf-editor-wrap { + + // Delay. + &.delay { + + .acf-editor-toolbar { + content: ""; + display: block; + background: #f5f5f5; + border-bottom: #dddddd solid 1px; + color: #555d66; + padding: 10px; + } + + .wp-editor-area { + padding: 10px; + border: none; + color: inherit !important; // Fixes white text bug. + } + } + + iframe{ + min-height: 200px; + } + + .wp-editor-container{ + border: 1px solid #E5E5E5; + box-shadow: none !important; + } + + .wp-editor-tabs { + box-sizing: content-box; + } +} + +// Full Screen Mode. +#mce_fullscreen_container { + z-index: 900000 !important; +} + +/*--------------------------------------------------------------------------------------------- +* +* Tab +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-tab { + display: none !important; +} + +// class to hide fields +.hidden-by-tab { + display: none !important; +} + +// ensure floating fields do not disturb tab wrap +.acf-tab-wrap { + clear: both; + z-index: 1; +} + +// tab group +.acf-tab-group { + border-bottom: #ccc solid 1px; + padding: 10px 10px 0; + + li { + margin: 0 0.5em 0 0; + + a { + padding: 5px 10px; + display: block; + + color: #555; + font-size: 14px; + font-weight: 600; + line-height: 24px; + + border: #ccc solid 1px; + border-bottom: 0 none; + text-decoration: none; + background: #e5e5e5; + transition: none; + + &:hover { + background: #FFF; + } + + &:focus { + outline: none; + box-shadow: none; + } + + &:empty { + display: none; + } + + } + + + // rtl + html[dir="rtl"] & { + margin: 0 0 0 0.5em; + } + + + // active + &.active a { + background: #F1F1F1; + color: #000; + padding-bottom: 6px; + margin-bottom: -1px; + position: relative; + z-index: 1; + } + } +} + + +// inside acf-fields +.acf-fields > .acf-tab-wrap { + background: #F9F9F9; + + // group + .acf-tab-group { + position: relative; + z-index: 1; + margin-bottom: -1px; + border-top: #DFDFDF solid 1px; + border-bottom: #DFDFDF solid 1px; + + li a { + background: #f1f1f1; + + &:hover { + background: #FFF; + } + } + + li.active a { + background: #FFFFFF; + } + } + + // first child + // fixes issue causing double border-top due to WP postbox .handlediv + &:first-child .acf-tab-group { + border-top: none; + } + +} + + +// inside acf-fields.-left +.acf-fields.-left > .acf-tab-wrap { + + // group + .acf-tab-group { + padding-left: 20%; + + /* mobile */ + @media screen and (max-width: $sm) { + padding-left: 10px; + } + + + /* rtl */ + html[dir="rtl"] & { + padding-left: 0; + padding-right: 20%; + + /* mobile */ + @media screen and (max-width: 850px) { + padding-right: 10px; + } + } + } +} + + +// left +.acf-tab-wrap.-left { + + // group + .acf-tab-group { + position: absolute; + left: 0; + width: 20%; + border: 0 none; + padding: 0 !important; /* important overrides 'left aligned labels' */ + margin: 1px 0 0; + + // li + li { + float: none; + margin: -1px 0 0; + + a { + border: 1px solid #ededed; + font-size: 13px; + line-height: 18px; + color: #0073aa; + padding: 10px; + margin: 0; + font-weight: normal; + border-width: 1px 0; + border-radius: 0; + background: transparent; + + &:hover { + color: #00a0d2; + } + } + + &.active a { + border-color:#DFDFDF; + color: #000; + margin-right: -1px; + background: #fff; + } + } + + // rtl + html[dir="rtl"] & { + left: auto; + right: 0; + + li.active a { + margin-right: 0; + margin-left: -1px; + } + } + } + + // space before field + .acf-field + &:before { + content: ""; + display: block; + position: relative; + z-index: 1; + height: 10px; + border-top: #DFDFDF solid 1px; + border-bottom: #DFDFDF solid 1px; + margin-bottom: -1px; + } + + + // first child has negative margin issues + &:first-child { + + .acf-tab-group { + + li:first-child a { + border-top: none; + } + } + } +} + + +/* sidebar */ +.acf-fields.-sidebar { + padding: 0 0 0 20% !important; + position: relative; + + /* before */ + &:before { + content: ""; + display: block; + position: absolute; + top: 0; + left: 0; + width: 20%; + bottom: 0; + border-right: #DFDFDF solid 1px; + background: #F9F9F9; + z-index: 1; + } + + + /* rtl */ + html[dir="rtl"] & { + padding: 0 20% 0 0 !important; + + &:before { + border-left: #DFDFDF solid 1px; + border-right-width: 0; + left: auto; + right: 0; + } + } + + + // left + &.-left { + padding: 0 0 0 180px !important; + + /* rtl */ + html[dir="rtl"] & { + padding: 0 180px 0 0 !important; + } + + &:before { + background: #F1F1F1; + border-color: #dfdfdf; + width: 180px; + } + + > .acf-tab-wrap.-left .acf-tab-group { + width: 180px; + + li a { + border-color: #e4e4e4; + } + + li.active a { + background: #F9F9F9; + } + + } + } + + // fix double border + > .acf-field-tab + .acf-field { + border-top: none; + } +} + + +// clear +.acf-fields.-clear > .acf-tab-wrap { + background: transparent; + + // group + .acf-tab-group { + margin-top: 0; + border-top: none; + padding-left: 0; + padding-right: 0; + + li a { + background: #e5e5e5; + + &:hover { + background: #fff; + } + } + + li.active a { + background: #f1f1f1; + } + } +} + + +/* seamless */ +.acf-postbox.seamless { + + // sidebar + > .acf-fields.-sidebar { + margin-left: 0 !important; + + &:before { + background: transparent; + } + } + + // default + > .acf-fields > .acf-tab-wrap { + background: transparent; + margin-bottom: 10px; + padding-left: $fx; + padding-right: $fx; + + .acf-tab-group { + border-top: 0 none; + + li a { + background: #e5e5e5; + + &:hover { + background: #fff; + } + } + + li.active a { + background: #f1f1f1; + } + } + } + + // left tabs + > .acf-fields > .acf-tab-wrap.-left { + + &:before { + border-top: none; + height: auto; + } + + .acf-tab-group { + margin-bottom: 0; + + li a { + border-width: 1px 0 1px 1px !important; + border-color: #cccccc; + background: #e5e5e5; + } + + li.active a { + background: #f1f1f1; + } + } + + } +} + + +// menu +.menu-edit, +.widget { + .acf-fields.-clear > .acf-tab-wrap .acf-tab-group li { + a { background: #f1f1f1; } + a:hover, &.active a { background: #fff; } + } +} + +.compat-item .acf-tab-wrap td { + display: block; +} + + + +/* within gallery sidebar */ +.acf-gallery-side .acf-tab-wrap { + border-top: 0 none !important; +} + +.acf-gallery-side .acf-tab-wrap .acf-tab-group { + margin: 10px 0 !important; + padding: 0 !important; +} + +.acf-gallery-side .acf-tab-group li.active a { + background: #F9F9F9 !important; +} + + + +/* withing widget */ +.widget .acf-tab-group { + border-bottom-color: #e8e8e8; +} + +.widget .acf-tab-group li a { + background: #F1F1F1; +} + +.widget .acf-tab-group li.active a { + background: #fff; +} + + +/* media popup (edit image) */ +.media-modal.acf-expanded .compat-attachment-fields > tbody > tr.acf-tab-wrap .acf-tab-group { + padding-left: 23%; + border-bottom-color: #DDDDDD; +} + + +/* table */ + + +.form-table > tbody > tr.acf-tab-wrap .acf-tab-group { + padding: 0 5px 0 210px; +} + +/* rtl */ + html[dir="rtl"] .form-table > tbody > tr.acf-tab-wrap .acf-tab-group { + padding: 0 210px 0 5px; + } + + +/*-------------------------------------------------------------------------------------------- +* +* oembed +* +*--------------------------------------------------------------------------------------------*/ + +.acf-oembed { + position: relative; + border: #DFDFDF solid 1px; + background: #fff; + + .title { + position: relative; + border-bottom: #DFDFDF solid 1px; + padding: 5px 10px; + + .input-search { + margin: 0; + font-size: 14px; + line-height: 30px; + height: 30px; + padding: 0; + border: 0 none; + box-shadow: none; + border-radius: 0; + font-family: inherit; + cursor: text; + } + + .acf-actions { + padding: 6px; + } + } + + .canvas { + position: relative; + min-height: 250px; + background: #F9F9F9; + + .canvas-media { + position: relative; + z-index: 1; + } + + iframe { + display: block; + margin: 0; + padding: 0; + width: 100%; + } + + .acf-icon.-picture { + @include centered(); + z-index: 0; + + height: 42px; + width: 42px; + font-size: 42px; + color: #999; + } + + .acf-loading-overlay { + background: rgba(255,255,255,0.9); + } + + .canvas-error { + position: absolute; + top: 50%; + left: 0%; + right: 0%; + margin: -9px 0 0 0; + text-align: center; + display: none; + + p { + padding: 8px; + margin: 0; + display: inline; + } + } + } + + // has value + &.has-value { + .canvas { + min-height: 50px; + } + + .input-search { + font-weight: bold; + } + + .title:hover .acf-actions { + display: block; + } + } + +} + +/*-------------------------------------------------------------------------------------------- +* +* Image +* +*--------------------------------------------------------------------------------------------*/ + +.acf-image-uploader { + @include clearfix(); + position: relative; + + + p { + margin: 0; + } + + + /* image wrap*/ + .image-wrap { + position: relative; + float: left; + + img { + max-width: 100%; + width: auto; + height: auto; + display: block; + min-width: 30px; + min-height: 30px; + background: #f1f1f1; + margin: 0; + padding: 0; + + + /* svg */ + &[src$=".svg"] { + min-height: 100px; + min-width: 100px; + } + } + + + /* hover */ + &:hover .acf-actions { + display: block; + } + } + + + /* input */ + input.button { + width: auto; + } + + + /* rtl */ + html[dir="rtl"] & { + + .image-wrap { + float: right; + } + + } + +} + + +/*-------------------------------------------------------------------------------------------- +* +* File +* +*--------------------------------------------------------------------------------------------*/ + +.acf-file-uploader { + position: relative; + + p { + margin: 0; + } + + .file-wrap { + border: #DFDFDF solid 1px; + min-height: 84px; + position: relative; + background: #fff; + } + + .file-icon { + position: absolute; + top: 0; + left: 0; + bottom: 0; + padding: 10px; + background: #F1F1F1; + border-right: #E5E5E5 solid 1px; + + img { + display: block; + padding: 0; + margin: 0; + max-width: 48px; + } + } + + .file-info { + padding: 10px; + margin-left: 69px; + + p { + margin: 0 0 2px; + font-size: 13px; + line-height: 1.4em; + word-break: break-all; + } + + a { + text-decoration: none; + } + } + + /* hover */ + &:hover .acf-actions { + display: block; + } + + + /* rtl */ + html[dir="rtl"] & { + + .file-icon { + left: auto; + right: 0; + border-left: #E5E5E5 solid 1px; + border-right: none; + } + + .file-info { + margin-right: 69px; + margin-left: 0; + } + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Date Picker +* +*---------------------------------------------------------------------------------------------*/ + +.acf-ui-datepicker .ui-datepicker { + z-index: 900000 !important; + + .ui-widget-header a { + cursor: pointer; + transition: none; + } +} + + +/* fix highlight state overriding hover / active */ +.acf-ui-datepicker .ui-state-highlight.ui-state-hover { + border: 1px solid #98b7e8 !important; + background: #98b7e8 !important; + font-weight: normal !important; + color: #ffffff !important; +} + +.acf-ui-datepicker .ui-state-highlight.ui-state-active { + border: 1px solid #3875d7 !important; + background: #3875d7 !important; + font-weight: normal !important; + color: #ffffff !important; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Separator field +* +*---------------------------------------------------------------------------------------------*/ + +.acf-field-separator { + + .acf-label { + margin-bottom: 0; + + label { + font-weight: normal; + } + } + + .acf-input { + display: none; + } + + + /* fields */ + .acf-fields > & { + background: #f9f9f9; + border-bottom: 1px solid #dfdfdf; + border-top: 1px solid #dfdfdf; + margin-bottom: -1px; + z-index: 2; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Taxonomy +* +*---------------------------------------------------------------------------------------------*/ + +.acf-taxonomy-field { + position: relative; + + .categorychecklist-holder { + border: #DFDFDF solid 1px; + border-radius: 3px; + max-height: 200px; + overflow: auto; + } + + .acf-checkbox-list { + margin: 0; + padding: 10px; + + ul.children { + padding-left: 18px; + } + } + + + /* hover */ + &:hover { + .acf-actions { + display: block; + } + } + + + /* select */ + &[data-ftype="select"] { + .acf-actions { + padding: 0; + margin: -9px; + } + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Range +* +*---------------------------------------------------------------------------------------------*/ + +.acf-range-wrap { + + .acf-append, + .acf-prepend { + display: inline-block; + vertical-align: middle; + line-height: 28px; + margin: 0 7px 0 0; + } + + .acf-append { + margin: 0 0 0 7px; + } + + input[type="range"] { + display: inline-block; + padding: 0; + margin: 0; + vertical-align: middle; + height: 28px; + + &:focus { + outline: none; + } + + } + + input[type="number"] { + display: inline-block; + min-width: 3em; + margin-left: 10px; + vertical-align: middle; + } + + + /* rtl */ + html[dir="rtl"] & { + + input[type="number"] { + margin-right: 10px; + margin-left: 0; + } + + .acf-append { margin: 0 7px 0 0; } + .acf-prepend { margin: 0 0 0 7px; } + + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* acf-accordion +* +*---------------------------------------------------------------------------------------------*/ + +.acf-accordion { + margin: 0; + padding: 0; + background: #fff; + + /* title */ + .acf-accordion-title { + margin: 0; + padding: 12px; + font-weight: bold; + cursor: pointer; + font-size: inherit; + font-size: 13px; + line-height: 1.4em; + + label { + margin: 0; + padding: 0; + font-size: 13px; + line-height: 1.4em; + } + + p { + font-weight: normal; + } + + .acf-accordion-icon { + float: right; + } + } + + .acf-accordion-content { + margin: 0; + padding: 0 12px 12px; + display: none; + } + + + /* open */ + &.-open { + + > .acf-accordion-content { + display: block; + } + + } +} + + +/* field specific */ +.acf-field.acf-accordion { + padding: 0 !important; + border-color: #dfdfdf; + + .acf-accordion-title { + padding: 12px; + width: auto !important; + float: none !important; + width: auto !important; + } + + .acf-accordion-content { + padding: 0; + float: none !important; + width: auto !important; + + > .acf-fields { + border-top: #EEEEEE solid 1px; + + &.-clear { + padding: 0 $fx $fy; + } + } + } +} + + +/* field specific (left) */ +.acf-fields.-left > .acf-field.acf-accordion { + padding: 0 !important; + + &:before { + display: none; + } + + .acf-accordion-title { + width: auto; + margin: 0 !important; + padding: 12px; + float: none !important; + } + + .acf-accordion-content { + padding: 0 !important; + } +} + + +/* field specific (clear) */ +.acf-fields.-clear > .acf-field.acf-accordion { + border: #cccccc solid 1px; + background: transparent; + + + .acf-field.acf-accordion { + margin-top: -16px; + } +} + + +/* table */ +tr.acf-field.acf-accordion { + background: transparent; + + > .acf-input { + padding: 0 !important; + border: #cccccc solid 1px; + } + + .acf-accordion-content { + padding: 0 12px 12px; + } +} + + +/* #addtag */ +#addtag div.acf-field.error { + border: 0 none; + padding: 8px 0; +} + + +#addtag > .acf-field.acf-accordion { + padding-right: 0; + margin-right: 5%; + + + p.submit { + margin-top: 0; + } +} + + + +/* border */ +tr.acf-accordion { + margin: 15px 0 !important; + + + tr.acf-accordion { + margin-top: -16px !important; + } +} + + +/* seamless */ +.acf-postbox.seamless > .acf-fields > .acf-accordion { + margin-left: $field_padding_x !important; + margin-right: $field_padding_x !important; +} + + +/* rtl */ +html[dir="rtl"] .acf-accordion { + +} + + +/* menu item */ +/* +.menu-item-settings > .field-acf > .acf-field.acf-accordion { + border: #dfdfdf solid 1px; + margin: 10px -13px 10px -11px; + + + .acf-field.acf-accordion { + margin-top: -11px; + } +} +*/ + + +/* widget */ +.widget .widget-content > .acf-field.acf-accordion { + border: #dfdfdf solid 1px; + margin-bottom: 10px; + + .acf-accordion-title { + margin-bottom: 0; + } + + + .acf-field.acf-accordion { + margin-top: -11px; + } +} + + +// seamless +.acf-postbox.seamless > .acf-fields > .acf-field.acf-accordion { + border: #e5e5e5 solid 1px; + + // siblings + + .acf-field.acf-accordion { + margin-top: -1px; + } +} + + +// media modal +.media-modal .compat-attachment-fields .acf-field.acf-accordion { + + // siblings + + .acf-field.acf-accordion { + margin-top: -1px; + } + + // input + > .acf-input { + width: 100%; + } + + // table + .compat-attachment-fields > tbody > tr > td { + padding-bottom: 5px; + } +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_forms.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_forms.scss new file mode 100644 index 0000000..9ad2a0e --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_forms.scss @@ -0,0 +1,306 @@ +/*-------------------------------------------------------------------------------------------- +* +* User +* +*--------------------------------------------------------------------------------------------*/ + +.form-table > tbody { + + /* field */ + > .acf-field { + + /* label */ + > .acf-label { + padding: 20px 10px 20px 0; + width: 210px; + + /* rtl */ + html[dir="rtl"] & { + padding: 20px 0 20px 10px; + } + + label { + font-size: 14px; + color: #23282d; + } + + } + + + /* input */ + > .acf-input { + padding: 15px 10px; + + /* rtl */ + html[dir="rtl"] & { + padding: 15px 10px 15px 5%; + } + } + + } + + + /* tab wrap */ + > .acf-tab-wrap td { + padding: 15px 5% 15px 0; + + /* rtl */ + html[dir="rtl"] & { + padding: 15px 0 15px 5%; + } + + } + + + /* misc */ + .form-table th.acf-th { + width: auto; + } + +} + +#your-profile, +#createuser { + + /* override for user css */ + .acf-field input[type="text"], + .acf-field input[type="password"], + .acf-field input[type="number"], + .acf-field input[type="search"], + .acf-field input[type="email"], + .acf-field input[type="url"], + .acf-field select { + max-width: 25em; + } + + .acf-field textarea { + max-width: 500px; + } + + + /* allow sub fields to display correctly */ + .acf-field .acf-field input[type="text"], + .acf-field .acf-field input[type="password"], + .acf-field .acf-field input[type="number"], + .acf-field .acf-field input[type="search"], + .acf-field .acf-field input[type="email"], + .acf-field .acf-field input[type="url"], + .acf-field .acf-field textarea, + .acf-field .acf-field select { + max-width: none; + } +} + +#registerform { + + h2 { + margin: 1em 0; + } + + .acf-field { + margin-top: 0; + + .acf-label { + margin-bottom: 0; + + label { + font-weight: normal; + line-height: 1.5; + } + } + +/* + .acf-input { + input { + font-size: 24px; + padding: 5px; + height: auto; + } + } +*/ + } + + p.submit { + text-align: right; + } + +} + +/*-------------------------------------------------------------------------------------------- +* +* Term +* +*--------------------------------------------------------------------------------------------*/ + +// add term +#acf-term-fields { + padding-right: 5%; + + > .acf-field { + + > .acf-label { + margin: 0; + + label { + font-size: 12px; + font-weight: normal; + } + } + } + +} + +p.submit .spinner, +p.submit .acf-spinner { + vertical-align: top; + float: none; + margin: 4px 4px 0; +} + + +// edit term +#edittag .acf-fields.-left { + + > .acf-field { + padding-left: 220px; + + &:before { + width: 209px; + } + + > .acf-label { + width: 220px; + margin-left: -220px; + padding: 0 10px; + } + + > .acf-input { + padding: 0; + } + } +} + +#edittag > .acf-fields.-left { + width: 96%; + + > .acf-field { + + > .acf-label { + padding-left: 0; + } + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* Comment +* +*--------------------------------------------------------------------------------------------*/ + +.editcomment td:first-child { + white-space: nowrap; + width: 131px; +} + + +/*-------------------------------------------------------------------------------------------- +* +* Widget +* +*--------------------------------------------------------------------------------------------*/ + +#widgets-right .widget .acf-field .description { + padding-left: 0; + padding-right: 0; +} + +.acf-widget-fields { + + > .acf-field { + + .acf-label { + margin-bottom: 5px; + + label { + font-weight: normal; + margin: 0; + } + } + } +} + +/*-------------------------------------------------------------------------------------------- +* +* Nav Menu +* +*--------------------------------------------------------------------------------------------*/ + +.acf-menu-settings { + border-top: 1px solid #eee; + margin-top: 2em; + + // seamless + &.-seamless { + border-top: none; + margin-top: 15px; + + > h2 { display: none; } + } + + // Fix relationship conflict. + .list li { + display: block; + margin-bottom: 0; + } +} + +.acf-menu-item-fields { + margin-right: 10px; + float: left; +} + +/*--------------------------------------------------------------------------------------------- +* +* Attachment Form (single) +* +*---------------------------------------------------------------------------------------------*/ + +#post .compat-attachment-fields { + + .compat-field-acf-form-data { + display: none; + } + + &, + > tbody, + > tbody > tr, + > tbody > tr > th, + > tbody > tr > td { + display: block; + } + + > tbody > .acf-field { + margin: 15px 0; + + > .acf-label { + margin: 0; + + label { + margin: 0; + padding: 0; + + p { + margin: 0 0 3px !important; + } + } + } + + > .acf-input { + margin: 0; + } + } +} + + + diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_global.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_global.scss new file mode 100644 index 0000000..0cddab3 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_global.scss @@ -0,0 +1,1812 @@ +/*-------------------------------------------------------------------------------------------- +* +* Global +* +*--------------------------------------------------------------------------------------------*/ + +/* Horizontal List */ +.acf-hl { padding: 0; margin: 0; list-style: none; display: block; position: relative; } +.acf-hl > li { float: left; display: block; margin: 0; padding: 0; } +.acf-hl > li.acf-fr { float: right; } + + +/* Horizontal List: Clearfix */ +.acf-hl:before, .acf-hl:after, +.acf-bl:before, .acf-bl:after, +.acf-cf:before, .acf-cf:after { + content: ""; + display: block; + line-height: 0; +} +.acf-hl:after, +.acf-bl:after, +.acf-cf:after { + clear: both; +} + + +/* Block List */ +.acf-bl { padding: 0; margin: 0; list-style: none; display: block; position: relative; } +.acf-bl > li { display: block; margin: 0; padding: 0; float: none; } + + +/* Visibility */ +.acf-hidden { + display: none !important; +} +.acf-empty { + display: table-cell !important; + * { display: none !important; } +} + +/* Float */ +.acf-fl { float: left; } +.acf-fr { float: right; } +.acf-fn { float: none; } + + +/* Align */ +.acf-al { text-align: left; } +.acf-ar { text-align: right; } +.acf-ac { text-align: center; } + + +/* loading */ +.acf-loading, +.acf-spinner { + display: inline-block; + height: 20px; + width: 20px; + vertical-align: text-top; + background: transparent url(../images/spinner.gif) no-repeat 50% 50%; +} + + +/* spinner */ +.acf-spinner { + display: none; +} + +.acf-spinner.is-active { + display: inline-block; +} + + +/* WP < 4.2 */ +.spinner.is-active { + display: inline-block; +} + + +/* required */ +.acf-required { + color: #f00; +} + + +/* show on hover */ +.acf-soh .acf-soh-target { + -webkit-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s; + -moz-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s; + -o-transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s; + transition: opacity 0.25s 0s ease-in-out, visibility 0s linear 0.25s; + + visibility: hidden; + opacity: 0; +} + +.acf-soh:hover .acf-soh-target { + -webkit-transition-delay:0s; + -moz-transition-delay:0s; + -o-transition-delay:0s; + transition-delay:0s; + + visibility: visible; + opacity: 1; +} + + +/* show if value */ +.show-if-value { display: none; } +.hide-if-value { display: block; } + +.has-value .show-if-value { display: block; } +.has-value .hide-if-value { display: none; } + + +/* select2 WP animation fix */ +.select2-search-choice-close { + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; +} + + +/*--------------------------------------------------------------------------------------------- +* +* tooltip +* +*---------------------------------------------------------------------------------------------*/ + +/* tooltip */ +.acf-tooltip { + background: #2F353E; + border-radius: 5px; + color: #fff; + padding: 5px 10px; + position: absolute; + font-size: 12px; + line-height: 1.4em; + z-index: 900000; + + + /* tip */ + &:before { + border: solid; + border-color: transparent; + border-width: 6px; + content: ""; + position: absolute; + } + + + /* positions */ + &.top { + margin-top: -8px; + + &:before { + top: 100%; + left: 50%; + margin-left: -6px; + border-top-color: #2F353E; + border-bottom-width: 0; + } + } + + &.right { + margin-left: 8px; + + &:before { + top: 50%; + margin-top: -6px; + right: 100%; + border-right-color: #2F353E; + border-left-width: 0; + } + } + + &.bottom { + margin-top: 8px; + + &:before { + bottom: 100%; + left: 50%; + margin-left: -6px; + border-bottom-color: #2F353E; + border-top-width: 0; + } + } + + &.left { + margin-left: -8px; + + &:before { + top: 50%; + margin-top: -6px; + left: 100%; + border-left-color: #2F353E; + border-right-width: 0; + } + } + + .acf-overlay { + z-index: -1; + } + +} + + +/* confirm */ +.acf-tooltip.-confirm { + z-index: 900001; // +1 higher than .acf-tooltip + + a { + text-decoration: none; + color: #9ea3a8; + + &:hover { + text-decoration: underline; + } + + &[data-event="confirm"] { + color: #F55E4F; + } + } +} + +.acf-overlay { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + cursor: default; +} + +.acf-tooltip-target { + position: relative; + z-index: 900002; // +1 higher than .acf-tooltip +} + + +/*--------------------------------------------------------------------------------------------- +* +* loading +* +*---------------------------------------------------------------------------------------------*/ +.acf-loading-overlay { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + cursor: default; + z-index: 99; + background: rgba(249, 249, 249, 0.5); + + i { + @include centered(); + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* callout +* +*---------------------------------------------------------------------------------------------*/ + +.acf-callout { + margin: 20px 0; + padding: 20px; + + background-color: #FCF8F2; + border-left: 3px solid #F0AD4E; +} + +.acf-callout h4 { + color: #F0AD4E; + margin: 0 !important; +} + +.acf-callout p { + margin-bottom: 0; +} + +.acf-callout.danger { + border-color: #D9534F; + background-color: #FDF7F7; +} + +.acf-callout.danger h4 { + color: #D9534F; +} + +.acf-callout.success { + background-color: #f4faf6; + border-color: #bcf1c5; +} + +.acf-callout.success h4 { + color: #3aad60; +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-icon +* +*--------------------------------------------------------------------------------------------*/ + +@font-face { + font-family: 'acf'; + src: url('../font/acf.eot?57601716'); + src: url('../font/acf.eot?57601716#iefix') format('embedded-opentype'), + url('../font/acf.woff2?57601716') format('woff2'), + url('../font/acf.woff?57601716') format('woff'), + url('../font/acf.ttf?57601716') format('truetype'), + url('../font/acf.svg?57601716#acf') format('svg'); + font-weight: normal; + font-style: normal; +} + +.acf-icon:before { + font-family: "acf"; + font-style: normal; + font-weight: normal; + speak: none; + + display: inline-block; + text-decoration: inherit; + width: 1em; + // margin-right: .2em; + text-align: center; + /* opacity: .8; */ + + /* For safety - reset parent styles, that can break glyph codes*/ + font-variant: normal; + text-transform: none; + + /* fix buttons height, for twitter bootstrap */ + line-height: 1em; + + /* Font smoothing. That was taken from TWBS */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + /* more consistent vertical align */ + position: relative; +} + +.acf-icon.-plus:before { content: '\e800'; } /* 'î €' */ +.acf-icon.-minus:before { content: '\e801'; } /* 'î ' */ +.acf-icon.-cancel:before { content: '\e802'; } /* 'î ‚' */ +.acf-icon.-pencil:before { content: '\e803'; top: -1px; } /* 'î ƒ' */ +.acf-icon.-location:before { content: '\e804'; } /* 'î „' */ +.acf-icon.-down:before { content: '\e805'; top: 1px; } /* 'î …' */ +.acf-icon.-left:before { content: '\e806'; left: -1px; } /* 'î †' */ +.acf-icon.-right:before { content: '\e807'; left: 1px; } /* 'î ‡' */ +.acf-icon.-up:before { content: '\e808'; top: -1px; } /* 'î ˆ' */ +.acf-icon.-sync:before { content: '\e809'; } /* 'î ‰' */ +.acf-icon.-globe:before { content: '\e80a'; } /* 'î Š' */ +.acf-icon.-picture:before { content: '\e80b'; } /* 'î ‹' */ +.acf-icon.-check:before { content: '\e80c'; } /* 'î Œ' */ +.acf-icon.-dot-3:before { content: '\e80d'; } /* 'î ' */ +.acf-icon.-arrow-combo:before { content: '\e80e'; } /* 'î Ž' */ +.acf-icon.-arrow-up:before { content: '\e810'; top: -1px; } /* 'î ' */ +.acf-icon.-arrow-down:before { content: '\e80f'; top: 1px; } /* 'î ' */ +.acf-icon.-search:before { content: '\e811'; } /* 'î ‘' */ +.acf-icon.-link-ext:before { content: '\f08e'; } /* '' */ + + +/* collapse */ +.acf-icon.-collapse:before { content: '\e810'; top: -1px; } /* arrow-up */ +.-collapsed .acf-icon.-collapse:before { content: '\e80f'; top: 1px; } /* arrow-down */ + + +/* default */ +.acf-icon { + display: inline-block; + height: 26px; + width: 26px; + border: transparent solid 1px; + border-radius: 100%; + + font-size: 16px; + line-height: 26px; + text-align: center; + text-decoration: none; + vertical-align: top; + box-sizing: content-box; +} + + +/* elements */ +span.acf-icon { + color: #999; + border-color: #BBB; + background-color: #fff; +} + + +/* icon */ +a.acf-icon { + color: #999; + border-color: #BBB; + background-color: #fff; + + position: relative; + overflow: hidden; + transition: none; + + + /* clear */ + &.-clear { + color: #444; + background: transparent; + border: none; + } + + + /* light*/ + &.light { + border: none; + padding: 1px; + background: #F5F5F5; + color: #72777c; + } + + + /* states */ + &:hover { + border-color: transparent; + background: $acf_blue; + color: #fff; + } + + &:active { + color: #fff; + background-color: darken($acf_blue, 5%); + } + + + /* remove WP outline box-shadow */ + &:active, + &:focus { + outline: none; + box-shadow: none; + } + + + /* red */ + &.-minus, + &.-cancel { + + &:hover { + background-color: #F55E4F; + } + + &:active { + background-color: darken(#F55E4F, 5%); + } + + } + +} + + +/* minor tweaks */ +.acf-icon.-pencil { + font-size: 15px; +} + +.acf-icon.-location { + font-size: 18px; +} + + +/* sizes */ +.acf-icon.small, +.acf-icon.-small { + width: 18px; + height: 18px; + line-height: 18px; + font-size: 14px; +} + + +/* dark */ +.acf-icon.dark { + border-color: transparent; + background: #23282D; + color: #eee; +} + +a.acf-icon.dark:hover { + border-color: transparent; + background: #191E23; + color: #00b9eb; +} + +a.acf-icon.-minus.dark:hover, +a.acf-icon.-cancel.dark:hover { + color: #D54E21; +} + + +/* grey */ +.acf-icon.grey { + border-color: transparent; + background: #b4b9be; + color: #fff; +} + +a.acf-icon.grey:hover { + border-color: transparent; + background: #00A0D2; + color: #fff; +} + +a.acf-icon.-minus.grey:hover, +a.acf-icon.-cancel.grey:hover { + background: #32373C; +} + + +/* red */ +.acf-icon.red { + border-color: transparent; + background-color: #F55E4F; + color: #fff; +} + + +/* yellow */ +.acf-icon.yellow { + border-color: transparent; + background-color: #FDBC40; + color: #fff; +} + + +/* logo */ +.acf-icon.logo { + width: 150px; + height: 150px; + background: #5EE8BF; + + border: 0 none; + position: absolute; + right: 0; + top: 0; +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-box +* +*--------------------------------------------------------------------------------------------*/ + +.acf-box { + background: #FFFFFF; + border: 1px solid #E5E5E5; + position: relative; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + + /* title */ + .title { + border-bottom: 1px solid #EEEEEE; + margin: 0; + padding: 15px; + + h3 { + font-size: 14px; + line-height: 1em; + margin: 0; + padding: 0; + } + } + + + .inner { + padding: 15px; + } + + h2 { + color: #333333; + font-size: 26px; + line-height: 1.25em; + margin: 0.25em 0 0.75em; + padding: 0; + } + + h3 { + margin: 1.5em 0 0; + } + + p { + margin-top: 0.5em; + } + + a { + text-decoration: none; + } + + i { + &.dashicons-external { + margin-top: -1px; + } + } + + /* footer */ + .footer { + border-top: 1px solid #eee; + padding: 12px; + font-size: 13px; + line-height: 1.5; + + p { + margin: 0; + } + } +} + +/*-------------------------------------------------------------------------------------------- +* +* acf-notice +* +*--------------------------------------------------------------------------------------------*/ + +.acf-notice { + position: relative; + display: block; + color: #fff; + margin: 5px 0 15px; + padding: 3px 12px; + background: $acf_notice; + border-left: darken($acf_notice, 8%) solid 4px; + + p { + font-size: 13px; + line-height: 1.5; + margin: 0.5em 0; + text-shadow: none; + color: inherit; + } + + a.acf-notice-dismiss { + position: absolute; + border-color: transparent; + top: 9px; + right: 12px; + color: #fff; + background: rgba(0,0,0,0.1); + + &:hover { + background: rgba(0,0,0,0.2); + } + } + + // dismiss + &.-dismiss { + padding-right: 40px; + } + + // error + &.-error { + background: $acf_error; + border-color: darken($acf_error, 8%); + } + + // success + &.-success { + background: $acf_success; + border-color: darken($acf_success, 8%); + } + + // warning + &.-warning { + background: $acf_warning; + border-color: darken($acf_warning, 8%); + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-table +* +*--------------------------------------------------------------------------------------------*/ + +.acf-table { + border: #DFDFDF solid 1px; + background: #fff; + border-spacing: 0; + border-radius: 0; + table-layout: auto; + padding: 0; + margin: 0; + width: 100%; + clear: both; + box-sizing: content-box; + + /* defaults */ + > tbody > tr, + > thead > tr { + + > th, > td { + padding: 8px; + vertical-align: top; + background: #fff; + text-align: left; + border-style: solid; + font-weight: normal; + } + + > th { + position: relative; + color: #333333; + } + + } + + + /* thead */ + > thead { + + > tr { + + > th { + border-color: #E1E1E1; + border-width: 0 0 1px 1px; + + &:first-child { + border-left-width: 0; + } + } + + } + + } + + + /* tbody */ + > tbody { + + > tr { + z-index: 1; + + > td { + border-color: #EDEDED; + border-width: 1px 0 0 1px; + + &:first-child { + border-left-width: 0; + } + } + + &:first-child > td { + border-top-width: 0; + } + } + + } + + + /* -clear */ + &.-clear { + border: 0 none; + + > tbody > tr, + > thead > tr { + + > td, >th { + border: 0 none; + padding: 4px; + } + } + } +} + + +/* remove tr */ +.acf-remove-element { + -webkit-transition: all 0.25s ease-out; + -moz-transition: all 0.25s ease-out; + -o-transition: all 0.25s ease-out; + transition: all 0.25s ease-out; + + transform: translate(50px, 0); + opacity: 0; +} + + +/* fade-up */ +.acf-fade-up { + -webkit-transition: all 0.25s ease-out; + -moz-transition: all 0.25s ease-out; + -o-transition: all 0.25s ease-out; + transition: all 0.25s ease-out; + + transform: translate(0, -10px); + opacity: 0; +} + + +/*--------------------------------------------------------------------------------------------- +* +* wp-admin +* +*---------------------------------------------------------------------------------------------*/ + +/* Menu */ +#adminmenu a[href="edit.php?post_type=acf-field-group&page=acf-settings-info"] { + display: none; +} + + +/*--------------------------------------------------------------------------------------------- +* +* Field Group List +* +*---------------------------------------------------------------------------------------------*/ + +#icon-edit.icon32-posts-acf-field-group { + background-position: -11px -5px; +} + +#acf-field-group-wrap { + + .tablenav, + p.search-box { + display: none; + } + + .wp-list-table { + + .column-acf-fg-description, + .column-acf-fg-description:before { + display: none !important; /* important needed to override mobile */ + } + + .column-acf-fg-count { + width: 10%; + } + + .column-acf-fg-status { + width: 10%; + } + + } + + .tablenav.bottom { + display: block; + } + + .acf-description { + font-weight: normal; + font-size: 13px; + color: #999; + margin-left: 7px; + font-style: italic; + } + +} + + + + +/* subsubsub */ +#acf-field-group-wrap .subsubsub { + + /* WPML */ + margin-bottom: 3px; + + ul { + margin: 0; + } + + + .subsubsub { + margin-top: 0; + } + + /* search */ + a:focus { + box-shadow: none; + } + +} + + + +/* columns (replicate post edit layout) */ +.acf-columns-2 { + margin-right: 300px; + clear: both; + @include clearfix(); + + /* rtl */ + html[dir="rtl"] & { + margin-right: 0; + margin-left: 300px; + } + + .acf-column-1 { + float: left; + width: 100%; + + /* rtl */ + html[dir="rtl"] & { + float: right; + } + } + + .acf-column-2 { + float: right; + margin-right: -300px; + width: 280px; + + /* rtl */ + html[dir="rtl"] & { + float: left; + margin-right: 0; + margin-left: -300px; + } + } + +} + + +/* search */ +#acf-field-group-wrap .search-box { + + &:after { + display: block; + content: ""; + height: 5px; + } + +} + +.acf-clear { + clear: both; +} + + +/* mobile compatibilty */ +@media screen and (max-width: 782px) { + + #acf-field-group-wrap #the-list .acf-icon:after { + content: attr(title); + position: absolute; + margin-left: 5px; + font-size: 13px; + line-height: 18px; + font-style: normal; + color: #444; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Fake table +* +*---------------------------------------------------------------------------------------------*/ + +.acf-thead, +.acf-tbody, +.acf-tfoot { + width: 100%; + padding: 0; + margin: 0; +} + +.acf-thead > li, +.acf-tbody > li, +.acf-tfoot > li { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + + padding: 8px 15px; + font-size: 12px; + line-height: 14px; +} + + +.acf-thead { + border-bottom: #E1E1E1 solid 1px; + color: #23282d; +} + +.acf-thead > li { + font-size: 14px; + line-height: 1.4em; + font-family: "Open Sans",sans-serif; + font-weight: bold; +} + +.acf-tfoot { + background: #f5f5f5; + border-top: #dddddd solid 1px; +} + +.acf-tfoot > li { + color: #7A9BBE; + font-size: 12px; + line-height: 27px; +} + +/*-------------------------------------------------------------------------------------------- +* +* Settings +* +*--------------------------------------------------------------------------------------------*/ + +.acf-settings-wrap { + + #poststuff { + padding-top: 15px; + } + + .acf-box { + margin: 20px 0; + } + + table { + margin: 0; + + .button { + vertical-align: middle; + } + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* Settings: Add-ons +* +*--------------------------------------------------------------------------------------------*/ + +.add-ons-list { + margin: 20px 0 0 -18px; + max-width: 960px; +} + +.add-ons-list .add-on { + width: 220px; + margin: 0 0 20px 18px; + float: left; +} + +.add-ons-list .add-on .inner { + min-height: 90px; +} + +.add-ons-list .add-on-acf-pro { + width: 940px; +} + +.add-ons-list .add-on .thumbnail { + +} + +.add-ons-list .add-on .thumbnail img { + display: block; +} + +.add-ons-list .add-on h3 a { + color: inherit; + text-decoration: none; +} + +.add-ons-list .add-on h3 { + margin: 0.5em 0; +} + + +/*-------------------------------------------------------------------------------------------- +* +* acf-popup +* +*--------------------------------------------------------------------------------------------*/ + +#acf-popup { + position: fixed; + z-index: 900000; + top: 0; + left: 0; + right: 0; + bottom: 0; + text-align: center; + + // bg + .bg { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 0; + background: rgba(0,0,0,0.25); + } + + &:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; + } + + // box + .acf-popup-box { + display: inline-block; + vertical-align: middle; + z-index: 1; + min-width: 300px; + min-height: 160px; + border-color: #aaaaaa; + box-shadow: 0 5px 30px -5px rgba(0, 0, 0, 0.25); + text-align: left; + @include rtl(); + + // title + .title { + min-height: 15px; + line-height: 15px; + + // icon + .acf-icon { + position: absolute; + top: 10px; + right: 10px; + + // rtl + html[dir="rtl"] & { + right: auto; + left: 10px; + } + } + } + + .inner { + min-height: 50px; + + // use margin instead of padding to allow inner elements marin to overlap and avoid large hitespace at top/bottom + padding: 0; + margin: 15px; + } + + // loading + .loading { + position: absolute; + top: 45px; + left: 0; + right: 0; + bottom: 0; + z-index: 2; + background: rgba(0,0,0,0.1); + display: none; + + i { + @include centered(); + } + } + + } +} + + +// acf-submit +.acf-submit { + margin-bottom: 0; + line-height: 28px; // .button height + + // message + span { + float: right; + color: #999; + + &.-error { + color: #dd4232; + } + } + + // button (allow margin between loading) + .button { + margin-right: 5px; + } +} + +/*-------------------------------------------------------------------------------------------- +* +* upgrade notice +* +*--------------------------------------------------------------------------------------------*/ + +#acf-upgrade-notice { + position: relative; + background: #fff; + border-left: 4px solid #00a0d2; + padding: 20px; + @include clearfix(); + + .col-content { + float: left; + width: 55%; + padding-left: 90px; + } + + .col-actions { + float: right; + text-align: center; + padding: 10px; + } + + img { + float: left; + width: 70px; + height: 70px; + margin: 0 0 0 -90px; + } + + h2 { + font-size: 16px; + margin: 2px 0 6.5px; + } + + p { + padding: 0; + margin: 0; + } + + .button:before { + margin-top: 11px; + } + + // mobile + @media screen and (max-width: $sm) { + + .col-content, + .col-actions { + float: none; + padding-left: 90px; + width: auto; + text-align: left; + } + } +} + + +/*-------------------------------------------------------------------------------------------- +* +* Welcome +* +*--------------------------------------------------------------------------------------------*/ + +.acf-wrap { + + h1 { + margin-top: 0; + padding-top: 20px; + } + + .about-text { + margin-top: 0.5em; + min-height: 50px; + } + + .about-headline-callout { + font-size: 2.4em; + font-weight: 300; + line-height: 1.3; + margin: 1.1em 0 0.2em; + text-align: center; + } + + .feature-section { + padding: 40px 0; + + h2 { + margin-top: 20px; + } + } + + .changelog { + list-style: disc; + padding-left: 15px; + + li { + margin: 0 0 0.75em; + } + } + + .acf-three-col { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + + > div { + flex: 1; + align-self: flex-start; + min-width: 31%; + max-width: 31%; + + @media screen and (max-width: $md) { + min-width: 48%; + } + + @media screen and (max-width: $sm) { + min-width: 100%; + } + } + + h3 .badge { + display: inline-block; + vertical-align: top; + border-radius: 5px; + background: #fc9700; + color: #fff; + font-weight: normal; + font-size: 12px; + padding: 2px 5px; + } + + img + h3 { + margin-top: 0.5em; + } + } +} + +/*-------------------------------------------------------------------------------------------- +* +* acf-hl cols +* +*--------------------------------------------------------------------------------------------*/ + +.acf-hl[data-cols] { + margin-left: -10px; + margin-right: -10px; + + > li { + padding: 0 10px; + + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + +} + + +/* sizes */ +.acf-hl[data-cols="2"] > li { width: 50%; } +.acf-hl[data-cols="3"] > li { width: 33.333%; } +.acf-hl[data-cols="4"] > li { width: 25%; } + + +/* mobile */ +@media screen and (max-width: $sm) { + + .acf-hl[data-cols] { + margin-left: 0; + margin-right: 0; + margin-top: -10px; + + > li { + width: 100% !important; + padding: 10px 0 0; + } + + } + +} + + + +/*-------------------------------------------------------------------------------------------- +* +* misc +* +*--------------------------------------------------------------------------------------------*/ + +.acf-actions { + text-align: right; + z-index: 1; + + a { + margin-left: 4px; + } + + + /* hover */ + &.-hover { + position: absolute; + display: none; + top: 0; + right: 0; + padding: 5px; + } + + + /* rtl */ + html[dir="rtl"] & { + + a { + margin-left: 0; + margin-right: 4px; + } + + &.-hover { + right: auto; + left: 0; + } + + } +} + + +/* ul compatibility */ +ul.acf-actions { + li { float: right; margin-left: 4px; } +} + + +/*-------------------------------------------------------------------------------------------- +* +* Plugins +* +*--------------------------------------------------------------------------------------------*/ + +.acf-plugin-upgrade-notice { + font-weight: normal; + color: #fff; + background: #d54d21; + padding: 1em; + margin: 9px 0; + + &:before { + content: "\f348"; + display: inline-block; + font: 400 18px/1 dashicons; + speak: none; + margin: 0 8px 0 -2px; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + vertical-align: top; + } + + h4 { + display: none; + } + + ul, + li { + display: inline; + color: inherit; + list-style: none; + } + + li:after { + content: '. '; + display: inline; + } + +} + + +/*-------------------------------------------------------------------------------------------- +* +* RTL +* +*--------------------------------------------------------------------------------------------*/ + +html[dir="rtl"] .acf-fl { float: right; } +html[dir="rtl"] .acf-fr { float: left; } + +html[dir="rtl"] .acf-hl > li { + float: right; +} + +html[dir="rtl"] .acf-hl > li.acf-fr { + float: left; +} + +html[dir="rtl"] .acf-icon.logo { + left: 0; + right: auto; +} + + +html[dir="rtl"] .acf-table thead th { + text-align: right; + border-right-width: 1px; + border-left-width: 0px; +} + +html[dir="rtl"] .acf-table > tbody > tr > td { + text-align: right; + border-right-width: 1px; + border-left-width: 0px; +} + +html[dir="rtl"] .acf-table > thead > tr > th:first-child, +html[dir="rtl"] .acf-table > tbody > tr > td:first-child { + border-right-width: 0; +} + +html[dir="rtl"] .acf-table > tbody > tr > td.order + td { + border-right-color: #e1e1e1; +} + + +/*--------------------------------------------------------------------------------------------- +* +* acf-postbox-columns +* +*---------------------------------------------------------------------------------------------*/ + +.acf-postbox-columns { + @include clearfix(); + position: relative; + margin-top: -11px; + margin-bottom: -11px; + margin-left: -12px; + margin-right: (280px - 12px); + + .acf-postbox-main, + .acf-postbox-side { + @include border-box(); + padding: 0 12px 12px; + } + + .acf-postbox-main { + float: left; + width: 100%; + } + + .acf-postbox-side { + float: right; + width: 280px; + margin-right: -280px; + + &:before { + content: ""; + display: block; + position: absolute; + width: 1px; + height: 100%; + top: 0; + right: 0; + background: #ebebeb; + } + } +} + + +/* mobile */ +@media only screen and (max-width: 850px) { + + .acf-postbox-columns { + margin: 0; + + .acf-postbox-main, + .acf-postbox-side { + float: none; + width: auto; + margin: 0; + padding: 0; + } + + .acf-postbox-side { + margin-top: 1em; + + &:before { + display: none; + } + } + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* acf-panel +* +*---------------------------------------------------------------------------------------------*/ + +.acf-panel { + margin-top: -1px; + border-top: 1px solid #e2e4e7; + border-bottom: 1px solid #e2e4e7; + + .acf-panel-title { + margin: 0; + padding: 12px; + font-weight: bold; + cursor: pointer; + font-size: inherit; + + i { + float: right; + } + } + + .acf-panel-inside { + margin: 0; + padding: 0 12px 12px; + display: none; + } + + /* open */ + &.-open { + + .acf-panel-inside { + display: block; + } + + } + + + /* inside postbox */ + .postbox & { + margin-left: -12px; + margin-right: -12px; + } + + + /* fields */ + .acf-field { + margin: 20px 0 0; + + .acf-label label { + color: #555d66; + font-weight: normal; + } + + &:first-child { + margin-top: 0; + } + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Admin Tools +* +*---------------------------------------------------------------------------------------------*/ + +#acf-admin-tools { + + .notice { + margin-top: 10px; + } +} + +.acf-meta-box-wrap { + margin-top: 10px; + + .postbox { + @include border-box(); + + .inside { + margin-bottom: 0; + } + + .hndle { + font-size: 14px; + padding: 8px 12px; + margin: 0; + line-height: 1.4; + } + + .handlediv { + display: none; + } + } + + + /* acf-fields */ + .acf-fields { + border: #ebebeb solid 1px; + background: #fafafa; + border-radius: 3px; + } +} + + +/* grid */ +.acf-meta-box-wrap.-grid { + margin-left: 8px; + margin-right: 8px; + + .postbox { + float: left; + clear: left; + width: 50%; + margin: 0 0 16px; + + &:nth-child(odd) { + margin-left: -8px; + } + + &:nth-child(even) { + float: right; + clear: right; + margin-right: -8px; + } + } +} + + +/* mobile */ +@media only screen and (max-width: 850px) { + + .acf-meta-box-wrap.-grid { + margin-left: 0; + margin-right: 0; + + .postbox { + margin-left: 0 !important; + margin-right: 0 !important; + width: 100%; + } + } +} + + +/* export tool */ +#acf-admin-tool-export { + + p { + max-width: 800px; + } + + ul { + column-width: 200px; + } + + .acf-postbox-side .button { + margin: 0; + width: 100%; + } + + textarea { + display: block; + width: 100%; + min-height: 500px; + + background: #fafafa; + box-shadow: none; + padding: 7px; + border-radius: 3px; + } + + /* panel: selection */ + .acf-panel-selection { + .acf-label { + display: none; + } + } +} + +/*--------------------------------------------------------------------------------------------- +* +* Retina +* +*---------------------------------------------------------------------------------------------*/ + +@media +only screen and (-webkit-min-device-pixel-ratio: 2), +only screen and ( min--moz-device-pixel-ratio: 2), +only screen and ( -o-min-device-pixel-ratio: 2/1), +only screen and ( min-device-pixel-ratio: 2), +only screen and ( min-resolution: 192dpi), +only screen and ( min-resolution: 2dppx) { + + .acf-loading, + .acf-spinner { + background-image: url(../images/spinner@2x.gif); + background-size: 20px 20px; + } + +} + + +/*--------------------------------------------------------------------------------------------- +* +* Device +* +*---------------------------------------------------------------------------------------------*/ + +@media only screen and (max-width: 850px) { + + .acf-columns-2 { + margin-right: 0; + } + + .acf-columns-2 .acf-column-1, + .acf-columns-2 .acf-column-2 { + float: none; + width: auto; + margin: 0; + } + +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_gutenberg.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_gutenberg.scss new file mode 100644 index 0000000..ab7466b --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_gutenberg.scss @@ -0,0 +1,123 @@ +/*-------------------------------------------------------------------------------------------- +* +* Gutenberg +* +*--------------------------------------------------------------------------------------------*/ +#editor { + + // main column is split into "editor" and "metaboxes". + // remove WP flex that pushed metaboxes to bottom. + .edit-post-visual-editor, + .edit-post-layout__metaboxes { + flex-basis: 0%; + flex-grow: 0; + } + + // metabox wrap + .edit-post-layout__metaboxes { + background: transparent; + border-top: 0 none; + margin-top: 0; + padding: 30px; + + @media screen and (min-width: 600px) { + padding: 46px; + } + + .edit-post-meta-boxes-area { + margin: 0; + } + + // make postbox look like a classic box. + .postbox { + border: #e2e4e7 solid 1px; + border-bottom: none; + margin: 0 0 20px; + } + } + + // improve handle style + .postbox { + .handlediv { + height: 46px; + width: auto; + padding: 0 14px 0 5px; + } + .hndle { + color: #191e23 !important; + font-size: 13px; + line-height: 16px; + + .acf-hndle-cog { + line-height: 16px; + } + } + + // change icons to match gutenberg sidebar accordions + .handlediv .toggle-indicator { + color: #191e23; + } + .handlediv .toggle-indicator:before { + content: "\f343"; + font-size: 18px; + width: auto; + } + &.closed .handlediv .toggle-indicator:before { + content: "\f347"; + } + } + + // acf-input-wrap + .acf-input-prepend, + .acf-input-append { + box-sizing: border-box; + height: 28px; + } + + // accordion + .acf-accordion { + padding: 0 !important; + + .acf-accordion-title { + color: #191e23; + font-weight: 600; + + &:hover { + background: #f8f9f9; + } + + label { + font-weight: inherit; + } + } + } + + // table + .acf-table { + box-sizing: border-box; + + .acf-row-handle { + width: 32px; + } + } + + // main error message + .components-notice-list .acf-notice.-error { + margin: 0 0 5px; + min-height: 50px; + padding: 6px 12px; + border-left: 4px solid #00a0d2; + color: #191e23; + background-color: #f9e2e2; + border-left-color: #d94f4f; + + p { + margin: 1em 0; + } + + .acf-notice-dismiss { + top: 15px; + right: 15px; + } + } +} diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_input.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_input.scss new file mode 100644 index 0000000..bb3b558 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_input.scss @@ -0,0 +1,61 @@ +/*-------------------------------------------------------------------------------------------- +* +* Confirm remove +* +*--------------------------------------------------------------------------------------------*/ + +.acf-temp-remove { + position: relative; + opacity: 1; + -webkit-transition: all 0.25s ease; + -moz-transition: all 0.25s ease; + -o-transition: all 0.25s ease; + transition: all 0.25s ease; + overflow: hidden; + + /* overlay prevents hover */ + &:after { + display: block; + content: ""; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 99; + } +} + + +/*-------------------------------------------------------------------------- +* +* Conditional Logic +* +*-------------------------------------------------------------------------*/ + +/* Hide */ +.hidden-by-conditional-logic { + display: none !important; +} + + +/* Hide (appear empty) */ +.hidden-by-conditional-logic.appear-empty { + display: table-cell !important; +} + +.hidden-by-conditional-logic.appear-empty .acf-input { + display: none !important; +} + + +/*-------------------------------------------------------------------------- +* +* 3rd Party +* +*-------------------------------------------------------------------------*/ + +/* Tabify shows hidden postboxes */ +.acf-postbox.acf-hidden { + display: none !important; +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_media.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_media.scss new file mode 100644 index 0000000..f68bf95 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_media.scss @@ -0,0 +1,505 @@ +/*--------------------------------------------------------------------------------------------- +* +* Media Model +* +*---------------------------------------------------------------------------------------------*/ + +/* WP sets tables to act as divs. ACF uses tables, so these muct be reset */ +.media-modal .compat-attachment-fields td.acf-input { + + table { + display: table; + table-layout: auto; + + tbody { + display: table-row-group; + } + + tr { + display: table-row; + } + + td, th { + display: table-cell; + } + + } + +} + + +/* field widths floats */ +.media-modal .compat-attachment-fields > tbody > .acf-field { + margin: 5px 0; + + > .acf-label { + min-width: 30%; + margin: 0; + padding: 0; + float: left; + text-align: right; + display: block; + float: left; + + > label { + padding-top: 6px; + margin: 0; + color: #666666; + font-weight: 400; + line-height: 16px; + } + } + + > .acf-input { + width: 65%; + margin: 0; + padding: 0; + float: right; + display: block; + } + + p.description { + margin: 0; + } +} + + +/* restricted selection (copy of WP .upload-errors)*/ +.acf-selection-error { + background: #ffebe8; + border: 1px solid #c00; + border-radius: 3px; + padding: 8px; + margin: 20px 0 0; + + .selection-error-label { + background: #CC0000; + border-radius: 3px; + color: #fff; + font-weight: bold; + margin-right: 8px; + padding: 2px 4px; + } + + .selection-error-message { + color: #b44; + display: block; + padding-top: 8px; + word-wrap: break-word; + white-space: pre-wrap; + } +} + + +/* disabled attachment */ +.media-modal .attachment.acf-disabled { + + .thumbnail { + opacity: 0.25 !important; + } + + .attachment-preview:before { + background: rgba(0,0,0,0.15); + z-index: 1; + position: relative; + } + +} + + +/* misc */ +.media-modal { + + /* compat-item */ + .compat-field-acf-form-data, + .compat-field-acf-blank { + display: none !important; + } + + + /* allow line breaks in upload error */ + .upload-error-message { + white-space: pre-wrap; + } + + + /* fix required span */ + .acf-required { + padding: 0 !important; + margin: 0 !important; + float: none !important; + color: #f00 !important; + } + + + /* sidebar */ + .media-sidebar { + + .compat-item{ + padding-bottom: 20px; + } + + } + + + /* mobile md */ + @media (max-width: 900px) { + + /* label */ + .setting span, + .compat-attachment-fields > tbody > .acf-field > .acf-label { + width: 98%; + float: none; + text-align: left; + min-height: 0; + padding: 0; + } + + + /* field */ + .setting input, + .setting textarea, + .compat-attachment-fields > tbody > .acf-field > .acf-input { + float: none; + height: auto; + max-width: none; + width: 98%; + } + + } + + +} + + + +/*--------------------------------------------------------------------------------------------- +* +* Media Model (expand details) +* +*---------------------------------------------------------------------------------------------*/ + +.media-modal .acf-expand-details { + float: right; + padding: 1px 10px; + margin-right: 6px; + height: 18px; + line-height: 18px; + color: #AAAAAA; + font-size: 12px; + + &:focus, &:active { + outline: 0 none; + box-shadow: none; + color: #AAAAAA; + } + + &:hover { + color: #666666 !important; + } + + span { + display: block; + float: left; + } + + .acf-icon { + margin: 0 4px 0 0; + } + + &:hover .acf-icon { + border-color: #AAAAAA; + } + + .is-open { display: none; } + .is-closed { display: block; } + + + /* mobile sm */ + @media (max-width: $sm) { + display: none; + } +} + + +/* expanded */ +.media-modal.acf-expanded { + + /* toggle */ + .acf-expand-details { + .is-open { display: block; } + .is-closed { display: none; } + + } + + // Components. + .attachments-browser .media-toolbar, + .attachments-browser .attachments { right: 740px; } + .media-sidebar { width: 708px; } + + // Sidebar. + .media-sidebar { + + // Attachment info. + .attachment-info { + .thumbnail { + float: left; + max-height: none; + + img { + max-width: 100%; + max-height: 200px; + } + } + + .details { + float: right; + } + } + + // Label + .attachment-info .thumbnail, + .attachment-details .setting span, + .compat-attachment-fields > tbody > .acf-field > .acf-label { + min-width: 20%; + margin-right: 0; + } + + // Input + .attachment-info .details, + .attachment-details .setting input, + .attachment-details .setting textarea, + .attachment-details .setting + .description, + .compat-attachment-fields > tbody > .acf-field > .acf-input { + min-width: 77%; + } + } + + // Screen: Medium. + @media (max-width: 900px) { + + // Components. + .attachments-browser .media-toolbar { display: none; } + .attachments { display: none; } + .media-sidebar { width: auto; max-width: none !important; bottom: 0 !important; } + + // Sidebar. + .media-sidebar { + + // Attachment info. + .attachment-info { + .thumbnail { + min-width: 0; + max-width: none; + width: 30%; + } + + .details { + min-width: 0; + max-width: none; + width: 67%; + } + + } + } + } + + // Screen: small. + @media (max-width: 640px) { + + // Sidebar. + .media-sidebar { + + // Attachment info. + .attachment-info { + .thumbnail, .details { + width: 100%; + } + } + } + } +} + + + +/*--------------------------------------------------------------------------------------------- +* +* ACF Media Model +* +*---------------------------------------------------------------------------------------------*/ + +.acf-media-modal { + + /* hide embed settings */ + .media-embed { + + .setting.align, + .setting.link-to { + display: none; + } + + } + + // only allow for devices larger than mobile + @media screen and (min-width: 1024px) { + + // - requires long selector to override WP core + .media-modal-content .media-frame .media-toolbar-secondary { + max-width: none; + + select.attachment-filters { + width: auto; + min-width: 150px; + max-width: none; + margin: 11px 6px 0 0; + vertical-align: middle; + } + } + } +} + + +/*--------------------------------------------------------------------------------------------- +* +* ACF Media Model (Select Mode) +* +*---------------------------------------------------------------------------------------------*/ + +.acf-media-modal.-select { + + + +} + + +/*--------------------------------------------------------------------------------------------- +* +* ACF Media Model (Edit Mode) +* +*---------------------------------------------------------------------------------------------*/ + +.acf-media-modal.-edit { + + /* resize modal */ + left: 15%; + right: 15%; + top: 100px; + bottom: 100px; + + + /* hide elements */ + .media-frame-menu, + .media-frame-router, + .media-frame-content .attachments, + .media-frame-content .media-toolbar { + display: none; + } + + + /* full width */ + .media-frame-title, + .media-frame-content, + .media-frame-toolbar, + .media-sidebar { + width: auto; + left: 0; + right: 0; + } + + + /* tidy up incorrect distance */ + .media-frame-content { + top: 50px; + } + + + /* title box shadow (to match media grid) */ + .media-frame-title { + border-bottom: 1px solid #DFDFDF; + box-shadow: 0 4px 4px -4px rgba(0, 0, 0, 0.1); + } + + + /* sidebar */ + .media-sidebar { + + padding: 0 16px; + + /* WP details */ + .attachment-details { + + overflow: visible; + + /* hide 'Attachment Details' heading */ + > h3, > h2 { + display: none; + } + + + /* remove overflow */ + .attachment-info { + background: #fff; + border-bottom: #dddddd solid 1px; + padding: 16px; + margin: 0 -16px 16px; + } + + /* move thumbnail */ + .thumbnail { + margin: 0 16px 0 0; + } + + .setting { + margin: 0 0 5px; + + span { + margin: 0; + } + } + + } + + + /* ACF fields */ + .compat-attachment-fields { + + > tbody > .acf-field { + margin: 0 0 5px; + + p.description { + margin-top: 3px; + } + } + + } + + + /* WP required message */ + .media-types-required-info { display: none; } + + } + + + /* mobile md */ + @media (max-width: 900px) { + top: 30px; + right: 30px; + bottom: 30px; + left: 30px; + } + + + /* mobile sm */ + @media (max-width: 640px) { + top: 0; + right: 0; + bottom: 0; + left: 0; + } + + @media (max-width: 480px) { + .media-frame-content { + top: 40px; + } + } +} diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_mixins.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_mixins.scss new file mode 100644 index 0000000..a4c2ddd --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_mixins.scss @@ -0,0 +1,39 @@ +/*-------------------------------------------------------------------------------------------- +* +* Mixins +* +*--------------------------------------------------------------------------------------------*/ +@mixin clearfix() { + &:after { + display: block; + clear: both; + content: ""; + } +} + +@mixin border-box() { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +@mixin centered() { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +@mixin animate( $properties: 'all' ) { + -webkit-transition: $properties 0.3s ease; // Safari 3.2+, Chrome + -moz-transition: $properties 0.3s ease; // Firefox 4-15 + -o-transition: $properties 0.3s ease; // Opera 10.5–12.00 + transition: $properties 0.3s ease; // Firefox 16+, Opera 12.50+ +} + +@mixin rtl() { + html[dir="rtl"] & { + text-align: right; + @content; + } +} diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_postbox.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_postbox.scss new file mode 100644 index 0000000..9e3b920 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_postbox.scss @@ -0,0 +1,50 @@ +// Postbox. + +// Gutenberg specific styles. +#editor { + + // Postbox container. + .edit-post-layout__metaboxes { + padding: 0; + } + + // Alter postbox to look like panel component. + .postbox { + color: #444; + + .handlediv { + color: #191e23 !important; + height: 46px; + width: auto; + padding: 0 14px 0 5px; + position: relative; + z-index: 2; + } + .hndle { + color: #191e23 !important; + font-size: 13px; + line-height: normal; + padding: 15px; + + &:hover { + background: #f2f4f5; + } + .acf-hndle-cog { + line-height: 16px; + } + } + + // change icons to match gutenberg sidebar accordions + .handlediv .toggle-indicator { + color: inherit; + &:before { + content: "\f343"; + font-size: 18px; + width: auto; + } + } + &.closed .handlediv .toggle-indicator:before { + content: "\f347"; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/_variables.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/_variables.scss new file mode 100644 index 0000000..968cad0 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/_variables.scss @@ -0,0 +1,24 @@ +/*-------------------------------------------------------------------------------------------- +* +* Vars +* +*--------------------------------------------------------------------------------------------*/ + +/* colors */ +$acf_blue: #2a9bd9; +$acf_notice: #2a9bd9; +$acf_error: #F55E4F; +$acf_success: #46b450; +$acf_warning: #fd8d3b; + +/* acf-field */ +$field_padding: 15px 12px; +$field_padding_x: 12px; +$field_padding_y: 15px; +$fp: 15px 12px; +$fy: 15px; +$fx: 12px; + +/* responsive */ +$md: 880px; +$sm: 640px; \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-dark.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-dark.scss new file mode 100644 index 0000000..7dac47f --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-dark.scss @@ -0,0 +1 @@ +@import "dark"; \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-field-group.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-field-group.scss new file mode 100644 index 0000000..d386eb3 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-field-group.scss @@ -0,0 +1,3 @@ +@import "variables"; +@import "mixins"; +@import "field-group"; \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-global.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-global.scss new file mode 100644 index 0000000..1a5a5b8 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-global.scss @@ -0,0 +1,3 @@ +@import "variables"; +@import "mixins"; +@import "global"; \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-input.scss b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-input.scss new file mode 100644 index 0000000..26abf66 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/css/acf-input.scss @@ -0,0 +1,7 @@ +@import "variables"; +@import "mixins"; +@import "fields"; +@import "forms"; +@import "media"; +@import "input"; +@import "postbox"; \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/images/acf-logo.psd b/wp-content/plugins/advanced-custom-fields/assets/build/images/acf-logo.psd new file mode 100644 index 0000000..0e54e17 Binary files /dev/null and b/wp-content/plugins/advanced-custom-fields/assets/build/images/acf-logo.psd differ diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-compatibility.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-compatibility.js new file mode 100644 index 0000000..d86140d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-compatibility.js @@ -0,0 +1,761 @@ +(function($, undefined){ + + /** + * acf.newCompatibility + * + * Inserts a new __proto__ object compatibility layer + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param object instance The object to modify. + * @param object compatibilty Optional. The compatibilty layer. + * @return object compatibilty + */ + + acf.newCompatibility = function( instance, compatibilty ){ + + // defaults + compatibilty = compatibilty || {}; + + // inherit __proto_- + compatibilty.__proto__ = instance.__proto__; + + // inject + instance.__proto__ = compatibilty; + + // reference + instance.compatibility = compatibilty; + + // return + return compatibilty; + }; + + /** + * acf.getCompatibility + * + * Returns the compatibility layer for a given instance + * + * @date 13/3/18 + * @since 5.6.9 + * + * @param object instance The object to look in. + * @return object|null compatibility The compatibility object or null on failure. + */ + + acf.getCompatibility = function( instance ) { + return instance.compatibility || null; + }; + + /** + * acf (compatibility) + * + * Compatibility layer for the acf object + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var _acf = acf.newCompatibility(acf, { + + // storage + l10n: {}, + o: {}, + fields: {}, + + // changed function names + update: acf.set, + add_action: acf.addAction, + remove_action: acf.removeAction, + do_action: acf.doAction, + add_filter: acf.addFilter, + remove_filter: acf.removeFilter, + apply_filters: acf.applyFilters, + parse_args: acf.parseArgs, + disable_el: acf.disable, + disable_form: acf.disable, + enable_el: acf.enable, + enable_form: acf.enable, + update_user_setting: acf.updateUserSetting, + prepare_for_ajax: acf.prepareForAjax, + is_ajax_success: acf.isAjaxSuccess, + remove_el: acf.remove, + remove_tr: acf.remove, + str_replace: acf.strReplace, + render_select: acf.renderSelect, + get_uniqid: acf.uniqid, + serialize_form: acf.serialize, + esc_html: acf.strEscape, + str_sanitize: acf.strSanitize, + + }); + + _acf._e = function( k1, k2 ){ + + // defaults + k1 = k1 || ''; + k2 = k2 || ''; + + // compability + var compatKey = k2 ? k1 + '.' + k2 : k1; + var compats = { + 'image.select': 'Select Image', + 'image.edit': 'Edit Image', + 'image.update': 'Update Image' + }; + if( compats[compatKey] ) { + return acf.__(compats[compatKey]); + } + + // try k1 + var string = this.l10n[ k1 ] || ''; + + // try k2 + if( k2 ) { + string = string[ k2 ] || ''; + } + + // return + return string; + }; + + _acf.get_selector = function( s ) { + + // vars + var selector = '.acf-field'; + + // bail early if no search + if( !s ) { + return selector; + } + + // compatibility with object + if( $.isPlainObject(s) ) { + if( $.isEmptyObject(s) ) { + return selector; + } else { + for( var k in s ) { s = s[k]; break; } + } + } + + // append + selector += '-' + s; + + // replace underscores (split/join replaces all and is faster than regex!) + selector = acf.strReplace('_', '-', selector); + + // remove potential double up + selector = acf.strReplace('field-field-', 'field-', selector); + + // return + return selector; + }; + + _acf.get_fields = function( s, $el, all ){ + + // args + var args = { + is: s || '', + parent: $el || false, + suppressFilters: all || false, + }; + + // change 'field_123' to '.acf-field-123' + if( args.is ) { + args.is = this.get_selector( args.is ); + } + + // return + return acf.findFields(args); + }; + + _acf.get_field = function( s, $el ){ + + // get fields + var $fields = this.get_fields.apply(this, arguments); + + // return + if( $fields.length ) { + return $fields.first(); + } else { + return false; + } + }; + + _acf.get_closest_field = function( $el, s ){ + return $el.closest( this.get_selector(s) ); + }; + + _acf.get_field_wrap = function( $el ){ + return $el.closest( this.get_selector() ); + }; + + _acf.get_field_key = function( $field ){ + return $field.data('key'); + }; + + _acf.get_field_type = function( $field ){ + return $field.data('type'); + }; + + _acf.get_data = function( $el, defaults ){ + return acf.parseArgs( $el.data(), defaults ); + }; + + _acf.maybe_get = function( obj, key, value ){ + + // default + if( value === undefined ) { + value = null; + } + + // get keys + keys = String(key).split('.'); + + // acf.isget + for( var i = 0; i < keys.length; i++ ) { + if( !obj.hasOwnProperty(keys[i]) ) { + return value; + } + obj = obj[ keys[i] ]; + } + return obj; + }; + + + /** + * hooks + * + * Modify add_action and add_filter functions to add compatibility with changed $field parameter + * Using the acf.add_action() or acf.add_filter() functions will interpret new field parameters as jQuery $field + * + * @date 12/5/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var compatibleArgument = function( arg ){ + return ( arg instanceof acf.Field ) ? arg.$el : arg; + }; + + var compatibleArguments = function( args ){ + return acf.arrayArgs( args ).map( compatibleArgument ); + } + + var compatibleCallback = function( origCallback ){ + return function(){ + + // convert to compatible arguments + if( arguments.length ) { + var args = compatibleArguments(arguments); + + // add default argument for 'ready', 'append' and 'load' events + } else { + var args = [ $(document) ]; + } + + // return + return origCallback.apply(this, args); + } + } + + _acf.add_action = function( action, callback, priority, context ){ + + // handle multiple actions + var actions = action.split(' '); + var length = actions.length; + if( length > 1 ) { + for( var i = 0; i < length; i++) { + action = actions[i]; + _acf.add_action.apply(this, arguments); + } + return this; + } + + // single + var callback = compatibleCallback(callback); + return acf.addAction.apply(this, arguments); + }; + + _acf.add_filter = function( action, callback, priority, context ){ + var callback = compatibleCallback(callback); + return acf.addFilter.apply(this, arguments); + }; + + /* + * acf.model + * + * This model acts as a scafold for action.event driven modules + * + * @type object + * @date 8/09/2014 + * @since 5.0.0 + * + * @param (object) + * @return (object) + */ + + _acf.model = { + actions: {}, + filters: {}, + events: {}, + extend: function( args ){ + + // extend + var model = $.extend( {}, this, args ); + + // setup actions + $.each(model.actions, function( name, callback ){ + model._add_action( name, callback ); + }); + + // setup filters + $.each(model.filters, function( name, callback ){ + model._add_filter( name, callback ); + }); + + // setup events + $.each(model.events, function( name, callback ){ + model._add_event( name, callback ); + }); + + // return + return model; + }, + + _add_action: function( name, callback ) { + + // split + var model = this, + data = name.split(' '); + + // add missing priority + var name = data[0] || '', + priority = data[1] || 10; + + // add action + acf.add_action(name, model[ callback ], priority, model); + + }, + + _add_filter: function( name, callback ) { + + // split + var model = this, + data = name.split(' '); + + // add missing priority + var name = data[0] || '', + priority = data[1] || 10; + + // add action + acf.add_filter(name, model[ callback ], priority, model); + }, + + _add_event: function( name, callback ) { + + // vars + var model = this, + i = name.indexOf(' '), + event = (i > 0) ? name.substr(0,i) : name, + selector = (i > 0) ? name.substr(i+1) : ''; + + // event + var fn = function( e ){ + + // append $el to event object + e.$el = $(this); + + // append $field to event object (used in field group) + if( acf.field_group ) { + e.$field = e.$el.closest('.acf-field-object'); + } + + // event + if( typeof model.event === 'function' ) { + e = model.event( e ); + } + + // callback + model[ callback ].apply(model, arguments); + + }; + + // add event + if( selector ) { + $(document).on(event, selector, fn); + } else { + $(document).on(event, fn); + } + }, + + get: function( name, value ){ + + // defaults + value = value || null; + + // get + if( typeof this[ name ] !== 'undefined' ) { + value = this[ name ]; + } + + // return + return value; + }, + + set: function( name, value ){ + + // set + this[ name ] = value; + + // function for 3rd party + if( typeof this[ '_set_' + name ] === 'function' ) { + this[ '_set_' + name ].apply(this); + } + + // return for chaining + return this; + } + }; + + /* + * field + * + * This model sets up many of the field's interactions + * + * @type function + * @date 21/02/2014 + * @since 3.5.1 + * + * @param n/a + * @return n/a + */ + + _acf.field = acf.model.extend({ + type: '', + o: {}, + $field: null, + _add_action: function( name, callback ) { + + // vars + var model = this; + + // update name + name = name + '_field/type=' + model.type; + + // add action + acf.add_action(name, function( $field ){ + + // focus + model.set('$field', $field); + + // callback + model[ callback ].apply(model, arguments); + }); + }, + + _add_filter: function( name, callback ) { + + // vars + var model = this; + + // update name + name = name + '_field/type=' + model.type; + + // add action + acf.add_filter(name, function( $field ){ + + // focus + model.set('$field', $field); + + // callback + model[ callback ].apply(model, arguments); + }); + }, + + _add_event: function( name, callback ) { + + // vars + var model = this, + event = name.substr(0,name.indexOf(' ')), + selector = name.substr(name.indexOf(' ')+1), + context = acf.get_selector(model.type); + + // add event + $(document).on(event, context + ' ' + selector, function( e ){ + + // vars + var $el = $(this); + var $field = acf.get_closest_field( $el, model.type ); + + // bail early if no field + if( !$field.length ) return; + + // focus + if( !$field.is(model.$field) ) { + model.set('$field', $field); + } + + // append to event + e.$el = $el; + e.$field = $field; + + // callback + model[ callback ].apply(model, [e]); + }); + }, + + _set_$field: function(){ + + // callback + if( typeof this.focus === 'function' ) { + this.focus(); + } + }, + + // depreciated + doFocus: function( $field ){ + return this.set('$field', $field); + } + }); + + + /** + * validation + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var _validation = acf.newCompatibility(acf.validation, { + remove_error: function( $field ){ + acf.getField( $field ).removeError(); + }, + add_warning: function( $field, message ){ + acf.getField( $field ).showNotice({ + text: message, + type: 'warning', + timeout: 1000 + }); + }, + fetch: acf.validateForm, + enableSubmit: acf.enableSubmit, + disableSubmit: acf.disableSubmit, + showSpinner: acf.showSpinner, + hideSpinner: acf.hideSpinner, + unlockForm: acf.unlockForm, + lockForm: acf.lockForm + }); + + + /** + * tooltip + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.tooltip = { + + tooltip: function( text, $el ){ + + var tooltip = acf.newTooltip({ + text: text, + target: $el + }); + + // return + return tooltip.$el; + }, + + temp: function( text, $el ){ + + var tooltip = acf.newTooltip({ + text: text, + target: $el, + timeout: 250 + }); + }, + + confirm: function( $el, callback, text, button_y, button_n ){ + + var tooltip = acf.newTooltip({ + confirm: true, + text: text, + target: $el, + confirm: function(){ + callback(true); + }, + cancel: function(){ + callback(false); + } + }); + }, + + confirm_remove: function( $el, callback ){ + + var tooltip = acf.newTooltip({ + confirmRemove: true, + target: $el, + confirm: function(){ + callback(true); + }, + cancel: function(){ + callback(false); + } + }); + }, + }; + + /** + * tooltip + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.media = new acf.Model({ + activeFrame: false, + actions: { + 'new_media_popup': 'onNewMediaPopup' + }, + + frame: function(){ + return this.activeFrame; + }, + + onNewMediaPopup: function( popup ){ + this.activeFrame = popup.frame; + }, + + popup: function( props ){ + + // update props + if( props.mime_types ) { + props.allowedTypes = props.mime_types; + } + if( props.id ) { + props.attachment = props.id; + } + + // new + var popup = acf.newMediaPopup( props ); + + // append +/* + if( props.selected ) { + popup.selected = props.selected; + } +*/ + + // return + return popup.frame; + } + }); + + + /** + * Select2 + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.select2 = { + init: function( $select, args, $field ){ + + // compatible args + if( args.allow_null ) { + args.allowNull = args.allow_null; + } + if( args.ajax_action ) { + args.ajaxAction = args.ajax_action; + } + if( $field ) { + args.field = acf.getField($field); + } + + // return + return acf.newSelect2( $select, args ); + }, + + destroy: function( $select ){ + return acf.getInstance( $select ).destroy(); + + }, + }; + + /** + * postbox + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.postbox = { + render: function( args ){ + + // compatible args + if( args.edit_url ) { + args.editLink = args.edit_url; + } + if( args.edit_title ) { + args.editTitle = args.edit_title; + } + + // return + return acf.newPostbox( args ); + } + }; + + /** + * acf.screen + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newCompatibility(acf.screen, { + update: function(){ + return this.set.apply(this, arguments); + }, + fetch: acf.screen.check + }); + _acf.ajax = acf.screen; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition-types.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition-types.js new file mode 100644 index 0000000..6c44df4 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition-types.js @@ -0,0 +1,447 @@ +(function($, undefined){ + + var __ = acf.__; + + var parseString = function( val ){ + return val ? '' + val : ''; + }; + + var isEqualTo = function( v1, v2 ){ + return ( parseString(v1).toLowerCase() === parseString(v2).toLowerCase() ); + }; + + var isEqualToNumber = function( v1, v2 ){ + return ( parseFloat(v1) === parseFloat(v2) ); + }; + + var isGreaterThan = function( v1, v2 ){ + return ( parseFloat(v1) > parseFloat(v2) ); + }; + + var isLessThan = function( v1, v2 ){ + return ( parseFloat(v1) < parseFloat(v2) ); + }; + + var inArray = function( v1, array ){ + + // cast all values as string + array = array.map(function(v2){ + return parseString(v2); + }); + + return (array.indexOf( v1 ) > -1); + } + + var containsString = function( haystack, needle ){ + return ( parseString(haystack).indexOf( parseString(needle) ) > -1 ); + }; + + var matchesPattern = function( v1, pattern ){ + var regexp = new RegExp(parseString(pattern), 'gi'); + return parseString(v1).match( regexp ); + }; + + /** + * hasValue + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var HasValue = acf.Condition.extend({ + type: 'hasValue', + operator: '!=empty', + label: __('Has any value'), + fieldTypes: [ 'text', 'textarea', 'number', 'range', 'email', 'url', 'password', 'image', 'file', 'wysiwyg', 'oembed', 'select', 'checkbox', 'radio', 'button_group', 'link', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user', 'google_map', 'date_picker', 'date_time_picker', 'time_picker', 'color_picker' ], + match: function( rule, field ){ + return (field.val() ? true : false); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( HasValue ); + + /** + * hasValue + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var HasNoValue = HasValue.extend({ + type: 'hasNoValue', + operator: '==empty', + label: __('Has no value'), + match: function( rule, field ){ + return !HasValue.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( HasNoValue ); + + + + /** + * EqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var EqualTo = acf.Condition.extend({ + type: 'equalTo', + operator: '==', + label: __('Value is equal to'), + fieldTypes: [ 'text', 'textarea', 'number', 'range', 'email', 'url', 'password' ], + match: function( rule, field ){ + if( $.isNumeric(rule.value) ) { + return isEqualToNumber( rule.value, field.val() ); + } else { + return isEqualTo( rule.value, field.val() ); + } + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( EqualTo ); + + /** + * NotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var NotEqualTo = EqualTo.extend({ + type: 'notEqualTo', + operator: '!=', + label: __('Value is not equal to'), + match: function( rule, field ){ + return !EqualTo.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( NotEqualTo ); + + /** + * PatternMatch + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var PatternMatch = acf.Condition.extend({ + type: 'patternMatch', + operator: '==pattern', + label: __('Value matches pattern'), + fieldTypes: [ 'text', 'textarea', 'email', 'url', 'password', 'wysiwyg' ], + match: function( rule, field ){ + return matchesPattern( field.val(), rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( PatternMatch ); + + /** + * Contains + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var Contains = acf.Condition.extend({ + type: 'contains', + operator: '==contains', + label: __('Value contains'), + fieldTypes: [ 'text', 'textarea', 'number', 'email', 'url', 'password', 'wysiwyg', 'oembed', 'select' ], + match: function( rule, field ){ + return containsString( field.val(), rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( Contains ); + + /** + * TrueFalseEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var TrueFalseEqualTo = EqualTo.extend({ + type: 'trueFalseEqualTo', + choiceType: 'select', + fieldTypes: [ 'true_false' ], + choices: function( field ){ + return [ + { + id: 1, + text: __('Checked') + } + ]; + }, + }); + + acf.registerConditionType( TrueFalseEqualTo ); + + /** + * TrueFalseNotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var TrueFalseNotEqualTo = NotEqualTo.extend({ + type: 'trueFalseNotEqualTo', + choiceType: 'select', + fieldTypes: [ 'true_false' ], + choices: function( field ){ + return [ + { + id: 1, + text: __('Checked') + } + ]; + }, + }); + + acf.registerConditionType( TrueFalseNotEqualTo ); + + /** + * SelectEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectEqualTo = acf.Condition.extend({ + type: 'selectEqualTo', + operator: '==', + label: __('Value is equal to'), + fieldTypes: [ 'select', 'checkbox', 'radio', 'button_group' ], + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + return inArray( rule.value, val ); + } else { + return isEqualTo( rule.value, val ); + } + }, + choices: function( fieldObject ){ + + // vars + var choices = []; + var lines = fieldObject.$setting('choices textarea').val().split("\n"); + + // allow null + if( fieldObject.$input('allow_null').prop('checked') ) { + choices.push({ + id: '', + text: __('Null') + }); + } + + // loop + lines.map(function( line ){ + + // split + line = line.split(':'); + + // default label to value + line[1] = line[1] || line[0]; + + // append + choices.push({ + id: $.trim( line[0] ), + text: $.trim( line[1] ) + }); + }); + + // return + return choices; + }, + }); + + acf.registerConditionType( SelectEqualTo ); + + /** + * SelectNotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectNotEqualTo = SelectEqualTo.extend({ + type: 'selectNotEqualTo', + operator: '!=', + label: __('Value is not equal to'), + match: function( rule, field ){ + return !SelectEqualTo.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( SelectNotEqualTo ); + + /** + * GreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var GreaterThan = acf.Condition.extend({ + type: 'greaterThan', + operator: '>', + label: __('Value is greater than'), + fieldTypes: [ 'number', 'range' ], + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + val = val.length; + } + return isGreaterThan( val, rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( GreaterThan ); + + + /** + * LessThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var LessThan = GreaterThan.extend({ + type: 'lessThan', + operator: '<', + label: __('Value is less than'), + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + val = val.length; + } + return isLessThan( val, rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( LessThan ); + + /** + * SelectedGreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectionGreaterThan = GreaterThan.extend({ + type: 'selectionGreaterThan', + label: __('Selection is greater than'), + fieldTypes: [ 'checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user' ], + }); + + acf.registerConditionType( SelectionGreaterThan ); + + /** + * SelectedGreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectionLessThan = LessThan.extend({ + type: 'selectionLessThan', + label: __('Selection is less than'), + fieldTypes: [ 'checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user' ], + }); + + acf.registerConditionType( SelectionLessThan ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition.js new file mode 100644 index 0000000..c5fd722 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-condition.js @@ -0,0 +1,249 @@ +(function($, undefined){ + + // vars + var storage = []; + + /** + * acf.Condition + * + * description + * + * @date 23/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.Condition = acf.Model.extend({ + + type: '', // used for model name + operator: '==', // rule operator + label: '', // label shown when editing fields + choiceType: 'input', // input, select + fieldTypes: [], // auto connect this conditions with these field types + + data: { + conditions: false, // the parent instance + field: false, // the field which we query against + rule: {} // the rule [field, operator, value] + }, + + events: { + 'change': 'change', + 'keyup': 'change', + 'enableField': 'change', + 'disableField': 'change' + }, + + setup: function( props ){ + $.extend(this.data, props); + }, + + getEventTarget: function( $el, event ){ + return $el || this.get('field').$el; + }, + + change: function( e, $el ){ + this.get('conditions').change( e ); + }, + + match: function( rule, field ){ + return false; + }, + + calculate: function(){ + return this.match( this.get('rule'), this.get('field') ); + }, + + choices: function( field ){ + return ''; + } + }); + + /** + * acf.newCondition + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newCondition = function( rule, conditions ){ + + // currently setting up conditions for fieldX, this field is the 'target' + var target = conditions.get('field'); + + // use the 'target' to find the 'trigger' field. + // - this field is used to setup the conditional logic events + var field = target.getField( rule.field ); + + // bail ealry if no target or no field (possible if field doesn't exist due to HTML error) + if( !target || !field ) { + return false; + } + + // vars + var args = { + rule: rule, + target: target, + conditions: conditions, + field: field + }; + + // vars + var fieldType = field.get('type'); + var operator = rule.operator; + + // get avaibale conditions + var conditionTypes = acf.getConditionTypes({ + fieldType: fieldType, + operator: operator, + }); + + // instantiate + var model = conditionTypes[0] || acf.Condition; + + // instantiate + var condition = new model( args ); + + // return + return condition; + }; + + /** + * mid + * + * Calculates the model ID for a field type + * + * @date 15/12/17 + * @since 5.6.5 + * + * @param string type + * @return string + */ + + var modelId = function( type ) { + return acf.strPascalCase( type || '' ) + 'Condition'; + }; + + /** + * acf.registerConditionType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.registerConditionType = function( model ){ + + // vars + var proto = model.prototype; + var type = proto.type; + var mid = modelId( type ); + + // store model + acf.models[ mid ] = model; + + // store reference + storage.push( type ); + }; + + /** + * acf.getConditionType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getConditionType = function( type ){ + var mid = modelId( type ); + return acf.models[ mid ] || false; + } + + /** + * acf.registerConditionForFieldType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.registerConditionForFieldType = function( conditionType, fieldType ){ + + // get model + var model = acf.getConditionType( conditionType ); + + // append + if( model ) { + model.prototype.fieldTypes.push( fieldType ); + } + }; + + /** + * acf.getConditionTypes + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getConditionTypes = function( args ){ + + // defaults + args = acf.parseArgs(args, { + fieldType: '', + operator: '' + }); + + // clonse available types + var types = []; + + // loop + storage.map(function( type ){ + + // vars + var model = acf.getConditionType(type); + var ProtoFieldTypes = model.prototype.fieldTypes; + var ProtoOperator = model.prototype.operator; + + // check fieldType + if( args.fieldType && ProtoFieldTypes.indexOf( args.fieldType ) === -1 ) { + return; + } + + // check operator + if( args.operator && ProtoOperator !== args.operator ) { + return; + } + + // append + types.push( model ); + }); + + // return + return types; + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-conditions.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-conditions.js new file mode 100644 index 0000000..087ea81 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-conditions.js @@ -0,0 +1,306 @@ +(function($, undefined){ + + // vars + var CONTEXT = 'conditional_logic'; + + /** + * conditionsManager + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var conditionsManager = new acf.Model({ + + id: 'conditionsManager', + + priority: 20, // run actions later + + actions: { + 'new_field': 'onNewField', + }, + + onNewField: function( field ){ + if( field.has('conditions') ) { + field.getConditions().render(); + } + }, + }); + + /** + * acf.Field.prototype.getField + * + * Finds a field that is related to another field + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var getSiblingField = function( field, key ){ + + // find sibling (very fast) + var fields = acf.getFields({ + key: key, + sibling: field.$el, + suppressFilters: true, + }); + + // find sibling-children (fast) + // needed for group fields, accordions, etc + if( !fields.length ) { + fields = acf.getFields({ + key: key, + parent: field.$el.parent(), + suppressFilters: true, + }); + } + + // return + if( fields.length ) { + return fields[0]; + } + return false; + }; + + acf.Field.prototype.getField = function( key ){ + + // get sibling field + var field = getSiblingField( this, key ); + + // return early + if( field ) { + return field; + } + + // move up through each parent and try again + var parents = this.parents(); + for( var i = 0; i < parents.length; i++ ) { + + // get sibling field + field = getSiblingField( parents[i], key ); + + // return early + if( field ) { + return field; + } + } + + // return + return false; + }; + + + /** + * acf.Field.prototype.getConditions + * + * Returns the field's conditions instance + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.Field.prototype.getConditions = function(){ + + // instantiate + if( !this.conditions ) { + this.conditions = new Conditions( this ); + } + + // return + return this.conditions; + }; + + + /** + * Conditions + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + var timeout = false; + var Conditions = acf.Model.extend({ + + id: 'Conditions', + + data: { + field: false, // The field with "data-conditions" (target). + timeStamp: false, // Reference used during "change" event. + groups: [], // The groups of condition instances. + }, + + setup: function( field ){ + + // data + this.data.field = field; + + // vars + var conditions = field.get('conditions'); + + // detect groups + if( conditions instanceof Array ) { + + // detect groups + if( conditions[0] instanceof Array ) { + + // loop + conditions.map(function(rules, i){ + this.addRules( rules, i ); + }, this); + + // detect rules + } else { + this.addRules( conditions ); + } + + // detect rule + } else { + this.addRule( conditions ); + } + }, + + change: function( e ){ + + // this function may be triggered multiple times per event due to multiple condition classes + // compare timestamp to allow only 1 trigger per event + if( this.get('timeStamp') === e.timeStamp ) { + return false; + } else { + this.set('timeStamp', e.timeStamp, true); + } + + // render condition and store result + var changed = this.render(); + }, + + render: function(){ + return this.calculate() ? this.show() : this.hide(); + }, + + show: function(){ + return this.get('field').showEnable(this.cid, CONTEXT); + }, + + hide: function(){ + return this.get('field').hideDisable(this.cid, CONTEXT); + }, + + calculate: function(){ + + // vars + var pass = false; + + // loop + this.getGroups().map(function( group ){ + + // igrnore this group if another group passed + if( pass ) return; + + // find passed + var passed = group.filter(function(condition){ + return condition.calculate(); + }); + + // if all conditions passed, update the global var + if( passed.length == group.length ) { + pass = true; + } + }); + + return pass; + }, + + hasGroups: function(){ + return this.data.groups != null; + }, + + getGroups: function(){ + return this.data.groups; + }, + + addGroup: function(){ + var group = []; + this.data.groups.push( group ); + return group; + }, + + hasGroup: function( i ){ + return this.data.groups[i] != null; + }, + + getGroup: function( i ){ + return this.data.groups[i]; + }, + + removeGroup: function( i ){ + this.data.groups[i].delete; + return this; + }, + + addRules: function( rules, group ){ + rules.map(function( rule ){ + this.addRule( rule, group ); + }, this); + }, + + addRule: function( rule, group ){ + + // defaults + group = group || 0; + + // vars + var groupArray; + + // get group + if( this.hasGroup(group) ) { + groupArray = this.getGroup(group); + } else { + groupArray = this.addGroup(); + } + + // instantiate + var condition = acf.newCondition( rule, this ); + + // bail ealry if condition failed (field did not exist) + if( !condition ) { + return false; + } + + // add rule + groupArray.push(condition); + }, + + hasRule: function(){ + + }, + + getRule: function( rule, group ){ + + // defaults + rule = rule || 0; + group = group || 0; + + return this.data.groups[ group ][ rule ]; + }, + + removeRule: function(){ + + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-accordion.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-accordion.js new file mode 100644 index 0000000..0f10ba5 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-accordion.js @@ -0,0 +1,232 @@ +(function($, undefined){ + + var i = 0; + + var Field = acf.Field.extend({ + + type: 'accordion', + + wait: '', + + $control: function(){ + return this.$('.acf-fields:first'); + }, + + initialize: function(){ + + // bail early if is cell + if( this.$el.is('td') ) return; + + // enpoint + if( this.get('endpoint') ) { + return this.remove(); + } + + // vars + var $field = this.$el; + var $label = this.$labelWrap() + var $input = this.$inputWrap(); + var $wrap = this.$control(); + var $instructions = $input.children('.description'); + + // force description into label + if( $instructions.length ) { + $label.append( $instructions ); + } + + // table + if( this.$el.is('tr') ) { + + // vars + var $table = this.$el.closest('table'); + var $newLabel = $('
'); + var $newInput = $('
'); + var $newTable = $(''); + var $newWrap = $(''); + + // dom + $newLabel.append( $label.html() ); + $newTable.append( $newWrap ); + $newInput.append( $newTable ); + $input.append( $newLabel ); + $input.append( $newInput ); + + // modify + $label.remove(); + $wrap.remove(); + $input.attr('colspan', 2); + + // update vars + $label = $newLabel; + $input = $newInput; + $wrap = $newWrap; + } + + // add classes + $field.addClass('acf-accordion'); + $label.addClass('acf-accordion-title'); + $input.addClass('acf-accordion-content'); + + // index + i++; + + // multi-expand + if( this.get('multi_expand') ) { + $field.attr('multi-expand', 1); + } + + // open + var order = acf.getPreference('this.accordions') || []; + if( order[i-1] !== undefined ) { + this.set('open', order[i-1]); + } + + if( this.get('open') ) { + $field.addClass('-open'); + $input.css('display', 'block'); // needed for accordion to close smoothly + } + + // add icon + $label.prepend( accordionManager.iconHtml({ open: this.get('open') }) ); + + // classes + // - remove 'inside' which is a #poststuff WP class + var $parent = $field.parent(); + $wrap.addClass( $parent.hasClass('-left') ? '-left' : '' ); + $wrap.addClass( $parent.hasClass('-clear') ? '-clear' : '' ); + + // append + $wrap.append( $field.nextUntil('.acf-field-accordion', '.acf-field') ); + + // clean up + $wrap.removeAttr('data-open data-multi_expand data-endpoint'); + }, + + }); + + acf.registerFieldType( Field ); + + + /** + * accordionManager + * + * Events manager for the acf accordion + * + * @date 14/2/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var accordionManager = new acf.Model({ + + actions: { + 'unload': 'onUnload' + }, + + events: { + 'click .acf-accordion-title': 'onClick', + 'invalidField .acf-accordion': 'onInvalidField' + }, + + isOpen: function( $el ) { + return $el.hasClass('-open'); + }, + + toggle: function( $el ){ + if( this.isOpen($el) ) { + this.close( $el ); + } else { + this.open( $el ); + } + }, + + iconHtml: function( props ){ + + // Determine icon. + //if( acf.isGutenberg() ) { + // var icon = props.open ? 'arrow-up-alt2' : 'arrow-down-alt2'; + //} else { + var icon = props.open ? 'arrow-down' : 'arrow-right'; + //} + + // Return HTML. + return ''; + }, + + open: function( $el ){ + + // open + $el.find('.acf-accordion-content:first').slideDown().css('display', 'block'); + $el.find('.acf-accordion-icon:first').replaceWith( this.iconHtml({ open: true }) ); + $el.addClass('-open'); + + // action + acf.doAction('show', $el); + + // close siblings + if( !$el.attr('multi-expand') ) { + $el.siblings('.acf-accordion.-open').each(function(){ + accordionManager.close( $(this) ); + }); + } + }, + + close: function( $el ){ + + // close + $el.find('.acf-accordion-content:first').slideUp(); + $el.find('.acf-accordion-icon:first').replaceWith( this.iconHtml({ open: false }) ); + $el.removeClass('-open'); + + // action + acf.doAction('hide', $el); + }, + + onClick: function( e, $el ){ + + // prevent Defailt + e.preventDefault(); + + // open close + this.toggle( $el.parent() ); + + }, + + onInvalidField: function( e, $el ){ + + // bail early if already focused + if( this.busy ) { + return; + } + + // disable functionality for 1sec (allow next validation to work) + this.busy = true; + this.setTimeout(function(){ + this.busy = false; + }, 1000); + + // open accordion + this.open( $el ); + }, + + onUnload: function( e ){ + + // vars + var order = []; + + // loop + $('.acf-accordion').each(function(){ + var open = $(this).hasClass('-open') ? 1 : 0; + order.push(open); + }); + + // set + if( order.length ) { + acf.setPreference('this.accordions', order); + } + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-button-group.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-button-group.js new file mode 100644 index 0000000..13f178d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-button-group.js @@ -0,0 +1,45 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'button_group', + + events: { + 'click input[type="radio"]': 'onClick' + }, + + $control: function(){ + return this.$('.acf-button-group'); + }, + + $input: function(){ + return this.$('input:checked'); + }, + + setValue: function( val ){ + this.$('input[value="' + val + '"]').prop('checked', true).trigger('change'); + }, + + onClick: function( e, $el ){ + + // vars + var $label = $el.parent('label'); + var selected = $label.hasClass('selected'); + + // remove previous selected + this.$('.selected').removeClass('selected'); + + // add active class + $label.addClass('selected'); + + // allow null + if( this.get('allow_null') && selected ) { + $label.removeClass('selected'); + $el.prop('checked', false).trigger('change'); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-checkbox.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-checkbox.js new file mode 100644 index 0000000..d8778d9 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-checkbox.js @@ -0,0 +1,97 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'checkbox', + + events: { + 'change input': 'onChange', + 'click .acf-add-checkbox': 'onClickAdd', + 'click .acf-checkbox-toggle': 'onClickToggle', + 'click .acf-checkbox-custom': 'onClickCustom' + }, + + $control: function(){ + return this.$('.acf-checkbox-list'); + }, + + $toggle: function(){ + return this.$('.acf-checkbox-toggle'); + }, + + $input: function(){ + return this.$('input[type="hidden"]'); + }, + + $inputs: function(){ + return this.$('input[type="checkbox"]').not('.acf-checkbox-toggle'); + }, + + getValue: function(){ + var val = []; + this.$(':checked').each(function(){ + val.push( $(this).val() ); + }); + return val.length ? val : false; + }, + + onChange: function( e, $el ){ + + // vars + var checked = $el.prop('checked'); + var $toggle = this.$toggle(); + + // selected + if( checked ) { + $el.parent().addClass('selected'); + } else { + $el.parent().removeClass('selected'); + } + + // determine if all inputs are checked + if( $toggle.length ) { + var $inputs = this.$inputs(); + + // all checked + if( $inputs.not(':checked').length == 0 ) { + $toggle.prop('checked', true); + } else { + $toggle.prop('checked', false); + } + } + }, + + onClickAdd: function( e, $el ){ + var html = '
  • '; + $el.parent('li').before( html ); + }, + + onClickToggle: function( e, $el ){ + var checked = $el.prop('checked'); + var $inputs = this.$inputs(); + $inputs.prop('checked', checked); + }, + + onClickCustom: function( e, $el ){ + var checked = $el.prop('checked'); + var $text = $el.next('input[type="text"]'); + + // checked + if( checked ) { + $text.prop('disabled', false); + + // not checked + } else { + $text.prop('disabled', true); + + // remove + if( $text.val() == '' ) { + $el.parent('li').remove(); + } + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-color-picker.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-color-picker.js new file mode 100644 index 0000000..7d59719 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-color-picker.js @@ -0,0 +1,64 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'color_picker', + + wait: 'load', + + $control: function(){ + return this.$('.acf-color-picker'); + }, + + $input: function(){ + return this.$('input[type="hidden"]'); + }, + + $inputText: function(){ + return this.$('input[type="text"]'); + }, + + setValue: function( val ){ + + // update input (with change) + acf.val( this.$input(), val ); + + // update iris + this.$inputText().iris('color', val); + }, + + initialize: function(){ + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // event + var onChange = function( e ){ + + // timeout is required to ensure the $input val is correct + setTimeout(function(){ + acf.val( $input, $inputText.val() ); + }, 1); + } + + // args + var args = { + defaultColor: false, + palettes: true, + hide: true, + change: onChange, + clear: onChange + }; + + // filter + var args = acf.applyFilters('color_picker_args', args, this); + + // initialize + $inputText.wpColorPicker( args ); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-picker.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-picker.js new file mode 100644 index 0000000..7efdb60 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-picker.js @@ -0,0 +1,157 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'date_picker', + + events: { + 'blur input[type="text"]': 'onBlur' + }, + + $control: function(){ + return this.$('.acf-date-picker'); + }, + + $input: function(){ + return this.$('input[type="hidden"]'); + }, + + $inputText: function(){ + return this.$('input[type="text"]'); + }, + + initialize: function(){ + + // save_format: compatibility with ACF < 5.0.0 + if( this.has('save_format') ) { + return this.initializeCompatibility(); + } + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // args + var args = { + dateFormat: this.get('date_format'), + altField: $input, + altFormat: 'yymmdd', + changeYear: true, + yearRange: "-100:+100", + changeMonth: true, + showButtonPanel: true, + firstDay: this.get('first_day') + }; + + // filter + args = acf.applyFilters('date_picker_args', args, this); + + // add date picker + acf.newDatePicker( $inputText, args ); + + // action + acf.doAction('date_picker_init', $inputText, args, this); + + }, + + initializeCompatibility: function(){ + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // get and set value from alt field + $inputText.val( $input.val() ); + + // args + var args = { + dateFormat: this.get('date_format'), + altField: $input, + altFormat: this.get('save_format'), + changeYear: true, + yearRange: "-100:+100", + changeMonth: true, + showButtonPanel: true, + firstDay: this.get('first_day') + }; + + // filter for 3rd party customization + args = acf.applyFilters('date_picker_args', args, this); + + // backup + var dateFormat = args.dateFormat; + + // change args.dateFormat + args.dateFormat = this.get('save_format'); + + // add date picker + acf.newDatePicker( $inputText, args ); + + // now change the format back to how it should be. + $inputText.datepicker( 'option', 'dateFormat', dateFormat ); + + // action for 3rd party customization + acf.doAction('date_picker_init', $inputText, args, this); + }, + + onBlur: function(){ + if( !this.$inputText().val() ) { + acf.val( this.$input(), '' ); + } + } + }); + + acf.registerFieldType( Field ); + + + // manager + var datePickerManager = new acf.Model({ + priority: 5, + wait: 'ready', + initialize: function(){ + + // vars + var locale = acf.get('locale'); + var rtl = acf.get('rtl'); + var l10n = acf.get('datePickerL10n'); + + // bail ealry if no l10n + if( !l10n ) { + return false; + } + + // bail ealry if no datepicker library + if( typeof $.datepicker === 'undefined' ) { + return false; + } + + // rtl + l10n.isRTL = rtl; + + // append + $.datepicker.regional[ locale ] = l10n; + $.datepicker.setDefaults(l10n); + } + }); + + // add + acf.newDatePicker = function( $input, args ){ + + // bail ealry if no datepicker library + if( typeof $.datepicker === 'undefined' ) { + return false; + } + + // defaults + args = args || {}; + + // initialize + $input.datepicker( args ); + + // wrap the datepicker (only if it hasn't already been wrapped) + if( $('body > #ui-datepicker-div').exists() ) { + $('body > #ui-datepicker-div').wrap('
    '); + } + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-time-picker.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-time-picker.js new file mode 100644 index 0000000..8cae782 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-date-time-picker.js @@ -0,0 +1,99 @@ +(function($, undefined){ + + var Field = acf.models.DatePickerField.extend({ + + type: 'date_time_picker', + + $control: function(){ + return this.$('.acf-date-time-picker'); + }, + + initialize: function(){ + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // args + var args = { + dateFormat: this.get('date_format'), + timeFormat: this.get('time_format'), + altField: $input, + altFieldTimeOnly: false, + altFormat: 'yy-mm-dd', + altTimeFormat: 'HH:mm:ss', + changeYear: true, + yearRange: "-100:+100", + changeMonth: true, + showButtonPanel: true, + firstDay: this.get('first_day'), + controlType: 'select', + oneLine: true + }; + + // filter + args = acf.applyFilters('date_time_picker_args', args, this); + + // add date time picker + acf.newDateTimePicker( $inputText, args ); + + // action + acf.doAction('date_time_picker_init', $inputText, args, this); + } + }); + + acf.registerFieldType( Field ); + + + // manager + var dateTimePickerManager = new acf.Model({ + priority: 5, + wait: 'ready', + initialize: function(){ + + // vars + var locale = acf.get('locale'); + var rtl = acf.get('rtl'); + var l10n = acf.get('dateTimePickerL10n'); + + // bail ealry if no l10n + if( !l10n ) { + return false; + } + + // bail ealry if no datepicker library + if( typeof $.timepicker === 'undefined' ) { + return false; + } + + // rtl + l10n.isRTL = rtl; + + // append + $.timepicker.regional[ locale ] = l10n; + $.timepicker.setDefaults(l10n); + } + }); + + + // add + acf.newDateTimePicker = function( $input, args ){ + + // bail ealry if no datepicker library + if( typeof $.timepicker === 'undefined' ) { + return false; + } + + // defaults + args = args || {}; + + // initialize + $input.datetimepicker( args ); + + // wrap the datepicker (only if it hasn't already been wrapped) + if( $('body > #ui-datepicker-div').exists() ) { + $('body > #ui-datepicker-div').wrap('
    '); + } + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-file.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-file.js new file mode 100644 index 0000000..476764b --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-file.js @@ -0,0 +1,120 @@ +(function($, undefined){ + + var Field = acf.models.ImageField.extend({ + + type: 'file', + + $control: function(){ + return this.$('.acf-file-uploader'); + }, + + $input: function(){ + return this.$('input[type="hidden"]'); + }, + + validateAttachment: function( attachment ){ + + // defaults + attachment = attachment || {}; + + // WP attachment + if( attachment.id !== undefined ) { + attachment = attachment.attributes; + } + + // args + attachment = acf.parseArgs(attachment, { + url: '', + alt: '', + title: '', + filename: '', + filesizeHumanReadable: '', + icon: '/wp-includes/images/media/default.png' + }); + + // return + return attachment; + }, + + render: function( attachment ){ + + // vars + attachment = this.validateAttachment( attachment ); + + // update image + this.$('img').attr({ + src: attachment.icon, + alt: attachment.alt, + title: attachment.title + }); + + // update elements + this.$('[data-name="title"]').text( attachment.title ); + this.$('[data-name="filename"]').text( attachment.filename ).attr( 'href', attachment.url ); + this.$('[data-name="filesize"]').text( attachment.filesizeHumanReadable ); + + // vars + var val = attachment.id || ''; + + // update val + acf.val( this.$input(), val ); + + // update class + if( val ) { + this.$control().addClass('has-value'); + } else { + this.$control().removeClass('has-value'); + } + }, + + selectAttachment: function(){ + + // vars + var parent = this.parent(); + var multiple = (parent && parent.get('type') === 'repeater'); + + // new frame + var frame = acf.newMediaPopup({ + mode: 'select', + title: acf.__('Select File'), + field: this.get('key'), + multiple: multiple, + library: this.get('library'), + allowedTypes: this.get('mime_types'), + select: $.proxy(function( attachment, i ) { + if( i > 0 ) { + this.append( attachment, parent ); + } else { + this.render( attachment ); + } + }, this) + }); + }, + + editAttachment: function(){ + + // vars + var val = this.val(); + + // bail early if no val + if( !val ) { + return false; + } + + // popup + var frame = acf.newMediaPopup({ + mode: 'edit', + title: acf.__('Edit File'), + button: acf.__('Update File'), + attachment: val, + field: this.get('key'), + select: $.proxy(function( attachment, i ) { + this.render( attachment ); + }, this) + }); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-google-map.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-google-map.js new file mode 100644 index 0000000..a04cc70 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-google-map.js @@ -0,0 +1,553 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'google_map', + + map: false, + + wait: 'load', + + events: { + 'click a[data-name="clear"]': 'onClickClear', + 'click a[data-name="locate"]': 'onClickLocate', + 'click a[data-name="search"]': 'onClickSearch', + 'keydown .search': 'onKeydownSearch', + 'keyup .search': 'onKeyupSearch', + 'focus .search': 'onFocusSearch', + 'blur .search': 'onBlurSearch', + 'showField': 'onShow' + }, + + $control: function(){ + return this.$('.acf-google-map'); + }, + + $input: function( name ){ + return this.$('input[data-name="' + (name || 'address') + '"]'); + }, + + $search: function(){ + return this.$('.search'); + }, + + $canvas: function(){ + return this.$('.canvas'); + }, + + addClass: function( name ){ + this.$control().addClass( name ); + }, + + removeClass: function( name ){ + this.$control().removeClass( name ); + }, + + getValue: function(){ + + // defaults + var val = { + lat: '', + lng: '', + address: '' + }; + + // loop + this.$('input[type="hidden"]').each(function(){ + val[ $(this).data('name') ] = $(this).val(); + }); + + // return false if no lat/lng + if( !val.lat || !val.lng ) { + val = false; + } + + // return + return val; + }, + + setValue: function( val ){ + + // defaults + val = acf.parseArgs(val, { + lat: '', + lng: '', + address: '' + }); + + // loop + for( var name in val ) { + acf.val( this.$input(name), val[name] ); + } + + // return false if no lat/lng + if( !val.lat || !val.lng ) { + val = false; + } + + // render + this.renderVal( val ); + + // action + var latLng = this.newLatLng( val.lat, val.lng ); + acf.doAction('google_map_change', latLng, this.map, this); + }, + + renderVal: function( val ){ + + // has value + if( val ) { + this.addClass('-value'); + this.setPosition( val.lat, val.lng ); + this.map.marker.setVisible( true ); + + // no value + } else { + this.removeClass('-value'); + this.map.marker.setVisible( false ); + } + + // search + this.$search().val( val.address ); + }, + + setPosition: function( lat, lng ){ + + // vars + var latLng = this.newLatLng( lat, lng ); + + // update marker + this.map.marker.setPosition( latLng ); + + // show marker + this.map.marker.setVisible( true ); + + // center + this.center(); + + // return + return this; + }, + + center: function(){ + + // vars + var position = this.map.marker.getPosition(); + var lat = this.get('lat'); + var lng = this.get('lng'); + + // if marker exists, center on the marker + if( position ) { + lat = position.lat(); + lng = position.lng(); + } + + // latlng + var latLng = this.newLatLng( lat, lng ); + + // set center of map + this.map.setCenter( latLng ); + }, + + getSearchVal: function(){ + return this.$search().val(); + }, + + initialize: function(){ + + // Ensure Google API is loaded and then initialize map. + withAPI( this.initializeMap.bind(this) ); + }, + + newLatLng: function( lat, lng ){ + return new google.maps.LatLng( parseFloat(lat), parseFloat(lng) ); + }, + + initializeMap: function(){ + + // vars + var zoom = this.get('zoom'); + var lat = this.get('lat'); + var lng = this.get('lng'); + + // Create Map. + var mapArgs = { + scrollwheel: false, + zoom: parseInt( zoom ), + center: this.newLatLng(lat, lng), + mapTypeId: google.maps.MapTypeId.ROADMAP, + marker: { + draggable: true, + raiseOnDrag: true + }, + autocomplete: {} + }; + mapArgs = acf.applyFilters('google_map_args', mapArgs, this); + var map = new google.maps.Map( this.$canvas()[0], mapArgs ); + + // Create Marker. + var markerArgs = acf.parseArgs(mapArgs.marker, { + draggable: true, + raiseOnDrag: true, + map: map + }); + markerArgs = acf.applyFilters('google_map_marker_args', markerArgs, this); + var marker = new google.maps.Marker( markerArgs ); + + // Maybe Create Autocomplete. + var autocomplete = false; + if( acf.isset(google, 'maps', 'places', 'Autocomplete') ) { + var autocompleteArgs = mapArgs.autocomplete || {}; + autocompleteArgs = acf.applyFilters('google_map_autocomplete_args', autocompleteArgs, this); + autocomplete = new google.maps.places.Autocomplete( this.$search()[0], autocompleteArgs ); + autocomplete.bindTo('bounds', map); + } + + // Add map events. + this.addMapEvents( this, map, marker, autocomplete ); + + // Append references. + map.acf = this; + map.marker = marker; + map.autocomplete = autocomplete; + this.map = map; + + // action for 3rd party customization + acf.doAction('google_map_init', map, marker, this); + + // set position + var val = this.getValue(); + this.renderVal( val ); + }, + + addMapEvents: function( field, map, marker, autocomplete ){ + + // Click map. + google.maps.event.addListener( map, 'click', function( e ) { + + // vars + var lat = e.latLng.lat(); + var lng = e.latLng.lng(); + + // search + field.searchPosition( lat, lng ); + }); + + // Drag marker. + google.maps.event.addListener( marker, 'dragend', function(){ + + // vars + var position = this.getPosition(); + var lat = position.lat(); + var lng = position.lng(); + + // search + field.searchPosition( lat, lng ); + }); + + // Autocomplete search. + if( autocomplete ) { + + // autocomplete event place_changed is triggered each time the input changes + // customize the place object with the current "search value" to allow users controll over the address text + google.maps.event.addListener(autocomplete, 'place_changed', function() { + var place = this.getPlace(); + place.address = field.getSearchVal(); + field.setPlace( place ); + }); + } + }, + + searchPosition: function( lat, lng ){ + + // vars + var latLng = this.newLatLng( lat, lng ); + var $wrap = this.$control(); + + // set position + this.setPosition( lat, lng ); + + // add class + $wrap.addClass('-loading'); + + // callback + var callback = $.proxy(function( results, status ){ + + // remove class + $wrap.removeClass('-loading'); + + // vars + var address = ''; + + // validate + if( status != google.maps.GeocoderStatus.OK ) { + console.log('Geocoder failed due to: ' + status); + } else if( !results[0] ) { + console.log('No results found'); + } else { + address = results[0].formatted_address; + } + + // update val + this.val({ + lat: lat, + lng: lng, + address: address + }); + + }, this); + + // query + geocoder.geocode({ 'latLng' : latLng }, callback); + }, + + setPlace: function( place ){ + + // bail if no place + if( !place ) return this; + + // search name if no geometry + // - possible when hitting enter in search address + if( place.name && !place.geometry ) { + this.searchAddress(place.name); + return this; + } + + // vars + var lat = place.geometry.location.lat(); + var lng = place.geometry.location.lng(); + var address = place.address || place.formatted_address; + + // update + this.setValue({ + lat: lat, + lng: lng, + address: address + }); + + // return + return this; + }, + + searchAddress: function( address ){ + + // is address latLng? + var latLng = address.split(','); + if( latLng.length == 2 ) { + + // vars + var lat = latLng[0]; + var lng = latLng[1]; + + // check + if( $.isNumeric(lat) && $.isNumeric(lng) ) { + return this.searchPosition( lat, lng ); + } + } + + // vars + var $wrap = this.$control(); + + // add class + $wrap.addClass('-loading'); + + // callback + var callback = this.proxy(function( results, status ){ + + // remove class + $wrap.removeClass('-loading'); + + // vars + var lat = ''; + var lng = ''; + + // validate + if( status != google.maps.GeocoderStatus.OK ) { + console.log('Geocoder failed due to: ' + status); + } else if( !results[0] ) { + console.log('No results found'); + } else { + lat = results[0].geometry.location.lat(); + lng = results[0].geometry.location.lng(); + //address = results[0].formatted_address; + } + + // update val + this.val({ + lat: lat, + lng: lng, + address: address + }); + + //acf.doAction('google_map_geocode_results', results, status, this.$el, this); + + }); + + // query + geocoder.geocode({ 'address' : address }, callback); + }, + + searchLocation: function(){ + + // Try HTML5 geolocation + if( !navigator.geolocation ) { + return alert( acf.__('Sorry, this browser does not support geolocation') ); + } + + // vars + var $wrap = this.$control(); + + // add class + $wrap.addClass('-loading'); + + // callback + var onSuccess = $.proxy(function( results, status ){ + + // remove class + $wrap.removeClass('-loading'); + + // vars + var lat = results.coords.latitude; + var lng = results.coords.longitude; + + // search; + this.searchPosition( lat, lng ); + + }, this); + + var onFailure = function( error ){ + $wrap.removeClass('-loading'); + } + + // try query + navigator.geolocation.getCurrentPosition( onSuccess, onFailure ); + }, + + onClickClear: function( e, $el ){ + this.val( false ); + }, + + onClickLocate: function( e, $el ){ + this.searchLocation(); + }, + + onClickSearch: function( e, $el ){ + this.searchAddress( this.$search().val() ); + }, + + onFocusSearch: function( e, $el ){ + this.removeClass('-value'); + this.onKeyupSearch.apply(this, arguments); + }, + + onBlurSearch: function( e, $el ){ + + // timeout to allow onClickLocate event + this.setTimeout(function(){ + this.removeClass('-search'); + if( $el.val() ) { + this.addClass('-value'); + } + }, 100); + }, + + onKeyupSearch: function( e, $el ){ + if( $el.val() ) { + this.addClass('-search'); + } else { + this.removeClass('-search'); + } + }, + + onKeydownSearch: function( e, $el ){ + + // prevent form from submitting + if( e.which == 13 ) { + e.preventDefault(); + } + }, + + onMousedown: function(){ + +/* + // clear timeout in 1ms (onMousedown will run before onBlurSearch) + this.setTimeout(function(){ + clearTimeout( this.get('timeout') ); + }, 1); +*/ + }, + + onShow: function(){ + + // bail early if no map + // - possible if JS API was not loaded + if( !this.map ) { + return false; + } + + // center map when it is shown (by a tab / collapsed row) + // - use delay to avoid rendering issues with browsers (ensures div is visible) + this.setTimeout( this.center, 10 ); + } + }); + + acf.registerFieldType( Field ); + + // Vars. + var loading = false; + var geocoder = false; + + /** + * withAPI + * + * Loads the Google Maps API library and troggers callback. + * + * @date 28/3/19 + * @since 5.7.14 + * + * @param function callback The callback to excecute. + * @return void + */ + + function withAPI( callback ) { + + // Check if geocoder exists. + if( geocoder ) { + return callback(); + } + + // Check if geocoder API exists. + if( acf.isset(window, 'google', 'maps', 'Geocoder') ) { + geocoder = new google.maps.Geocoder(); + return callback(); + } + + // Geocoder will need to be loaded. Hook callback to action. + acf.addAction( 'google_map_api_loaded', callback ); + + // Bail early if already loading API. + if( loading ) { + return; + } + + // load api + var url = acf.get('google_map_api'); + if( url ) { + + // Set loading status. + loading = true; + + // Load API + $.ajax({ + url: url, + dataType: 'script', + cache: true, + success: function(){ + geocoder = new google.maps.Geocoder(); + acf.doAction('google_map_api_loaded'); + } + }); + } + } + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-image.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-image.js new file mode 100644 index 0000000..36fc71f --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-image.js @@ -0,0 +1,198 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'image', + + $control: function(){ + return this.$('.acf-image-uploader'); + }, + + $input: function(){ + return this.$('input[type="hidden"]'); + }, + + events: { + 'click a[data-name="add"]': 'onClickAdd', + 'click a[data-name="edit"]': 'onClickEdit', + 'click a[data-name="remove"]': 'onClickRemove', + 'change input[type="file"]': 'onChange' + }, + + initialize: function(){ + + // add attribute to form + if( this.get('uploader') === 'basic' ) { + this.$el.closest('form').attr('enctype', 'multipart/form-data'); + } + }, + + validateAttachment: function( attachment ){ + + // defaults + attachment = attachment || {}; + + // WP attachment + if( attachment.id !== undefined ) { + attachment = attachment.attributes; + } + + // args + attachment = acf.parseArgs(attachment, { + url: '', + alt: '', + title: '', + caption: '', + description: '', + width: 0, + height: 0 + }); + + // preview size + var url = acf.isget(attachment, 'sizes', this.get('preview_size'), 'url'); + if( url !== null ) { + attachment.url = url; + } + + // return + return attachment; + }, + + render: function( attachment ){ + + // vars + attachment = this.validateAttachment( attachment ); + + // update image + this.$('img').attr({ + src: attachment.url, + alt: attachment.alt, + title: attachment.title + }); + + // vars + var val = attachment.id || ''; + + // update val + this.val( val ); + + // update class + if( val ) { + this.$control().addClass('has-value'); + } else { + this.$control().removeClass('has-value'); + } + }, + + // create a new repeater row and render value + append: function( attachment, parent ){ + + // create function to find next available field within parent + var getNext = function( field, parent ){ + + // find existing file fields within parent + var fields = acf.getFields({ + key: field.get('key'), + parent: parent.$el + }); + + // find the first field with no value + for( var i = 0; i < fields.length; i++ ) { + if( !fields[i].val() ) { + return fields[i]; + } + } + + // return + return false; + } + + // find existing file fields within parent + var field = getNext( this, parent ); + + // add new row if no available field + if( !field ) { + parent.$('.acf-button:last').trigger('click'); + field = getNext( this, parent ); + } + + // render + if( field ) { + field.render( attachment ); + } + }, + + selectAttachment: function(){ + + // vars + var parent = this.parent(); + var multiple = (parent && parent.get('type') === 'repeater'); + + // new frame + var frame = acf.newMediaPopup({ + mode: 'select', + type: 'image', + title: acf.__('Select Image'), + field: this.get('key'), + multiple: multiple, + library: this.get('library'), + allowedTypes: this.get('mime_types'), + select: $.proxy(function( attachment, i ) { + if( i > 0 ) { + this.append( attachment, parent ); + } else { + this.render( attachment ); + } + }, this) + }); + }, + + editAttachment: function(){ + + // vars + var val = this.val(); + + // bail early if no val + if( !val ) return; + + // popup + var frame = acf.newMediaPopup({ + mode: 'edit', + title: acf.__('Edit Image'), + button: acf.__('Update Image'), + attachment: val, + field: this.get('key'), + select: $.proxy(function( attachment, i ) { + this.render( attachment ); + }, this) + }); + }, + + removeAttachment: function(){ + this.render( false ); + }, + + onClickAdd: function( e, $el ){ + this.selectAttachment(); + }, + + onClickEdit: function( e, $el ){ + this.editAttachment(); + }, + + onClickRemove: function( e, $el ){ + this.removeAttachment(); + }, + + onChange: function( e, $el ){ + var $hiddenInput = this.$input(); + + acf.getFileInputData($el, function( data ){ + $hiddenInput.val( $.param(data) ); + }); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-link.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-link.js new file mode 100644 index 0000000..4d4fc1d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-link.js @@ -0,0 +1,191 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'link', + + events: { + 'click a[data-name="add"]': 'onClickEdit', + 'click a[data-name="edit"]': 'onClickEdit', + 'click a[data-name="remove"]': 'onClickRemove', + 'change .link-node': 'onChange', + }, + + $control: function(){ + return this.$('.acf-link'); + }, + + $node: function(){ + return this.$('.link-node'); + }, + + getValue: function(){ + + // vars + var $node = this.$node(); + + // return false if empty + if( !$node.attr('href') ) { + return false; + } + + // return + return { + title: $node.html(), + url: $node.attr('href'), + target: $node.attr('target') + }; + }, + + setValue: function( val ){ + + // default + val = acf.parseArgs(val, { + title: '', + url: '', + target: '' + }); + + // vars + var $div = this.$control(); + var $node = this.$node(); + + // remove class + $div.removeClass('-value -external'); + + // add class + if( val.url ) $div.addClass('-value'); + if( val.target === '_blank' ) $div.addClass('-external'); + + // update text + this.$('.link-title').html( val.title ); + this.$('.link-url').attr('href', val.url).html( val.url ); + + // update node + $node.html(val.title); + $node.attr('href', val.url); + $node.attr('target', val.target); + + // update inputs + this.$('.input-title').val( val.title ); + this.$('.input-target').val( val.target ); + this.$('.input-url').val( val.url ).trigger('change'); + }, + + onClickEdit: function( e, $el ){ + acf.wpLink.open( this.$node() ); + }, + + onClickRemove: function( e, $el ){ + this.setValue( false ); + }, + + onChange: function( e, $el ){ + + // get the changed value + var val = this.getValue(); + + // update inputs + this.setValue(val); + } + + }); + + acf.registerFieldType( Field ); + + + // manager + acf.wpLink = new acf.Model({ + + getNodeValue: function(){ + var $node = this.get('node'); + return { + title: $node.html(), + url: $node.attr('href'), + target: $node.attr('target') + }; + }, + + setNodeValue: function( val ){ + var $node = this.get('node'); + $node.html( val.title ); + $node.attr('href', val.url); + $node.attr('target', val.target); + $node.trigger('change'); + }, + + getInputValue: function(){ + return { + title: $('#wp-link-text').val(), + url: $('#wp-link-url').val(), + target: $('#wp-link-target').prop('checked') ? '_blank' : '' + }; + }, + + setInputValue: function( val ){ + $('#wp-link-text').val( val.title ); + $('#wp-link-url').val( val.url ); + $('#wp-link-target').prop('checked', val.target === '_blank' ); + }, + + open: function( $node ){ + + // add events + this.on('wplink-open', 'onOpen'); + this.on('wplink-close', 'onClose'); + + // set node + this.set('node', $node); + + // create textarea + var $textarea = $(''); + $('body').append( $textarea ); + + // vars + var val = this.getNodeValue(); + + // open popup + wpLink.open( 'acf-link-textarea', val.url, val.title, null ); + + }, + + onOpen: function(){ + + // always show title (WP will hide title if empty) + $('#wp-link-wrap').addClass('has-text-field'); + + // set inputs + var val = this.getNodeValue(); + this.setInputValue( val ); + }, + + close: function(){ + wpLink.close(); + }, + + onClose: function(){ + + // bail early if no node + // needed due to WP triggering this event twice + if( !this.has('node') ) { + return false; + } + + // remove events + this.off('wplink-open'); + this.off('wplink-close'); + + // set value + var val = this.getInputValue(); + this.setNodeValue( val ); + + // remove textarea + $('#acf-link-textarea').remove(); + + // reset + this.set('node', null); + + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-oembed.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-oembed.js new file mode 100644 index 0000000..840e1d5 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-oembed.js @@ -0,0 +1,163 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'oembed', + + events: { + 'click [data-name="clear-button"]': 'onClickClear', + 'keypress .input-search': 'onKeypressSearch', + 'keyup .input-search': 'onKeyupSearch', + 'change .input-search': 'onChangeSearch' + }, + + $control: function(){ + return this.$('.acf-oembed'); + }, + + $input: function(){ + return this.$('.input-value'); + }, + + $search: function(){ + return this.$('.input-search'); + }, + + getValue: function(){ + return this.$input().val(); + }, + + getSearchVal: function(){ + return this.$search().val(); + }, + + setValue: function( val ){ + + // class + if( val ) { + this.$control().addClass('has-value'); + } else { + this.$control().removeClass('has-value'); + } + + acf.val( this.$input(), val ); + }, + + showLoading: function( show ){ + acf.showLoading( this.$('.canvas') ); + }, + + hideLoading: function(){ + acf.hideLoading( this.$('.canvas') ); + }, + + maybeSearch: function(){ + + // vars + var prevUrl = this.val(); + var url = this.getSearchVal(); + + // no value + if( !url ) { + return this.clear(); + } + + // fix missing 'http://' - causes the oembed code to error and fail + if( url.substr(0, 4) != 'http' ) { + url = 'http://' + url; + } + + // bail early if no change + if( url === prevUrl ) return; + + // clear existing timeout + var timeout = this.get('timeout'); + if( timeout ) { + clearTimeout( timeout ); + } + + // set new timeout + var callback = $.proxy(this.search, this, url); + this.set('timeout', setTimeout(callback, 300)); + + }, + + search: function( url ){ + + // ajax + var ajaxData = { + action: 'acf/fields/oembed/search', + s: url, + field_key: this.get('key') + }; + + // clear existing timeout + var xhr = this.get('xhr'); + if( xhr ) { + xhr.abort(); + } + + // loading + this.showLoading(); + + // query + var xhr = $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'json', + context: this, + success: function( json ){ + + // error + if( !json || !json.html ) { + json = { + url: false, + html: '' + } + } + + // update vars + this.val( json.url ); + this.$('.canvas-media').html( json.html ); + }, + complete: function(){ + this.hideLoading(); + } + }); + + this.set('xhr', xhr); + }, + + clear: function(){ + this.val(''); + this.$search().val(''); + this.$('.canvas-media').html(''); + }, + + onClickClear: function( e, $el ){ + this.clear(); + }, + + onKeypressSearch: function( e, $el ){ + if( e.which == 13 ) { + e.preventDefault(); + this.maybeSearch(); + } + }, + + onKeyupSearch: function( e, $el ){ + if( $el.val() ) { + this.maybeSearch(); + } + }, + + onChangeSearch: function( e, $el ){ + this.maybeSearch(); + } + + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-page-link.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-page-link.js new file mode 100644 index 0000000..2910455 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-page-link.js @@ -0,0 +1,9 @@ +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'page_link', + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-post-object.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-post-object.js new file mode 100644 index 0000000..7704bef --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-post-object.js @@ -0,0 +1,9 @@ +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'post_object', + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-radio.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-radio.js new file mode 100644 index 0000000..d51de77 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-radio.js @@ -0,0 +1,68 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'radio', + + events: { + 'click input[type="radio"]': 'onClick', + }, + + $control: function(){ + return this.$('.acf-radio-list'); + }, + + $input: function(){ + return this.$('input:checked'); + }, + + $inputText: function(){ + return this.$('input[type="text"]'); + }, + + getValue: function(){ + var val = this.$input().val(); + if( val === 'other' && this.get('other_choice') ) { + val = this.$inputText().val(); + } + return val; + }, + + onClick: function( e, $el ){ + + // vars + var $label = $el.parent('label'); + var selected = $label.hasClass('selected'); + var val = $el.val(); + + // remove previous selected + this.$('.selected').removeClass('selected'); + + // add active class + $label.addClass('selected'); + + // allow null + if( this.get('allow_null') && selected ) { + $label.removeClass('selected'); + $el.prop('checked', false).trigger('change'); + val = false; + } + + // other + if( this.get('other_choice') ) { + + // enable + if( val === 'other' ) { + this.$inputText().prop('disabled', false); + + // disable + } else { + this.$inputText().prop('disabled', true); + } + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-range.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-range.js new file mode 100644 index 0000000..cf9d416 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-range.js @@ -0,0 +1,42 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'range', + + events: { + 'input input[type="range"]': 'onChange', + 'change input': 'onChange' + }, + + $input: function(){ + return this.$('input[type="range"]'); + }, + + $inputAlt: function(){ + return this.$('input[type="number"]'); + }, + + setValue: function( val ){ + this.busy = true; + + // Update range input (with change). + acf.val( this.$input(), val ); + + // Update alt input (without change). + // Read in input value to inherit min/max validation. + acf.val( this.$inputAlt(), this.$input().val(), true ); + + this.busy = false; + }, + + onChange: function( e, $el ){ + if( !this.busy ) { + this.setValue( $el.val() ); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-relationship.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-relationship.js new file mode 100644 index 0000000..13d535c --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-relationship.js @@ -0,0 +1,380 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'relationship', + + events: { + 'keypress [data-filter]': 'onKeypressFilter', + 'change [data-filter]': 'onChangeFilter', + 'keyup [data-filter]': 'onChangeFilter', + 'click .choices-list .acf-rel-item': 'onClickAdd', + 'click [data-name="remove_item"]': 'onClickRemove', + 'mouseover': 'onHover' + }, + + $control: function(){ + return this.$('.acf-relationship'); + }, + + $list: function( list ) { + return this.$('.' + list + '-list'); + }, + + $listItems: function( list ) { + return this.$list( list ).find('.acf-rel-item'); + }, + + $listItem: function( list, id ) { + return this.$list( list ).find('.acf-rel-item[data-id="' + id + '"]'); + }, + + getValue: function(){ + var val = []; + this.$listItems('values').each(function(){ + val.push( $(this).data('id') ); + }); + return val.length ? val : false; + }, + + newChoice: function( props ){ + return [ + '
  • ', + '' + props.text + '', + '
  • ' + ].join(''); + }, + + newValue: function( props ){ + return [ + '
  • ', + '', + '' + props.text, + '', + '', + '
  • ' + ].join(''); + }, + + addSortable: function( self ){ + + // sortable + this.$list('values').sortable({ + items: 'li', + forceHelperSize: true, + forcePlaceholderSize: true, + scroll: true, + update: function(){ + self.$input().trigger('change'); + } + }); + }, + + initialize: function(){ + + // scroll + var onScroll = this.proxy(function(e){ + + // bail early if no more results + if( this.get('loading') || !this.get('more') ) { + return; + } + + // Scrolled to bottom + var $list = this.$list('choices'); + var scrollTop = Math.ceil( $list.scrollTop() ); + var scrollHeight = Math.ceil( $list[0].scrollHeight ); + var innerHeight = Math.ceil( $list.innerHeight() ); + var paged = this.get('paged') || 1; + if( (scrollTop + innerHeight) >= scrollHeight ) { + + // update paged + this.set('paged', (paged+1)); + + // fetch + this.fetch(); + } + + }); + + this.$list('choices').scrollTop(0).on('scroll', onScroll); + + // fetch + this.fetch(); + }, + + onHover: function( e ){ + + // only once + $().off(e); + + // add sortable + this.addSortable( this ); + }, + + onKeypressFilter: function( e, $el ){ + + // don't submit form + if( e.which == 13 ) { + e.preventDefault(); + } + }, + + onChangeFilter: function( e, $el ){ + + // vars + var val = $el.val(); + var filter = $el.data('filter'); + + // Bail early if filter has not changed + if( this.get(filter) === val ) { + return; + } + + // update attr + this.set(filter, val); + + // reset paged + this.set('paged', 1); + + // fetch + if( $el.is('select') ) { + this.fetch(); + + // search must go through timeout + } else { + this.maybeFetch(); + } + }, + + onClickAdd: function( e, $el ){ + + // vars + var val = this.val(); + var max = parseInt( this.get('max') ); + + // can be added? + if( $el.hasClass('disabled') ) { + return false; + } + + // validate + if( max > 0 && val && val.length >= max ) { + + // add notice + this.showNotice({ + text: acf.__('Maximum values reached ( {max} values )').replace('{max}', max), + type: 'warning' + }); + return false; + } + + // disable + $el.addClass('disabled'); + + // add + var html = this.newValue({ + id: $el.data('id'), + text: $el.html() + }); + this.$list('values').append( html ) + + // trigger change + this.$input().trigger('change'); + }, + + onClickRemove: function( e, $el ){ + + // Prevent default here because generic handler wont be triggered. + e.preventDefault(); + + // vars + var $span = $el.parent(); + var $li = $span.parent(); + var id = $span.data('id'); + + // remove value + $li.remove(); + + // show choice + this.$listItem('choices', id).removeClass('disabled'); + + // trigger change + this.$input().trigger('change'); + }, + + maybeFetch: function(){ + + // vars + var timeout = this.get('timeout'); + + // abort timeout + if( timeout ) { + clearTimeout( timeout ); + } + + // fetch + timeout = this.setTimeout(this.fetch, 300); + this.set('timeout', timeout); + }, + + getAjaxData: function(){ + + // load data based on element attributes + var ajaxData = this.$control().data(); + for( var name in ajaxData ) { + ajaxData[ name ] = this.get( name ); + } + + // extra + ajaxData.action = 'acf/fields/relationship/query'; + ajaxData.field_key = this.get('key'); + + // Filter. + ajaxData = acf.applyFilters( 'relationship_ajax_data', ajaxData, this ); + + // return + return ajaxData; + }, + + fetch: function(){ + + // abort XHR if this field is already loading AJAX data + var xhr = this.get('xhr'); + if( xhr ) { + xhr.abort(); + } + + // add to this.o + var ajaxData = this.getAjaxData(); + + // clear html if is new query + var $choiceslist = this.$list( 'choices' ); + if( ajaxData.paged == 1 ) { + $choiceslist.html(''); + } + + // loading + var $loading = $('
  • ' + acf.__('Loading') + '
  • '); + $choiceslist.append($loading); + this.set('loading', true); + + // callback + var onComplete = function(){ + this.set('loading', false); + $loading.remove(); + }; + + var onSuccess = function( json ){ + + // no results + if( !json || !json.results || !json.results.length ) { + + // prevent pagination + this.set('more', false); + + // add message + if( this.get('paged') == 1 ) { + this.$list('choices').append('
  • ' + acf.__('No matches found') + '
  • '); + } + + // return + return; + } + + // set more (allows pagination scroll) + this.set('more', json.more ); + + // get new results + var html = this.walkChoices(json.results); + var $html = $( html ); + + // apply .disabled to left li's + var val = this.val(); + if( val && val.length ) { + val.map(function( id ){ + $html.find('.acf-rel-item[data-id="' + id + '"]').addClass('disabled'); + }); + } + + // append + $choiceslist.append( $html ); + + // merge together groups + var $prevLabel = false; + var $prevList = false; + + $choiceslist.find('.acf-rel-label').each(function(){ + + var $label = $(this); + var $list = $label.siblings('ul'); + + if( $prevLabel && $prevLabel.text() == $label.text() ) { + $prevList.append( $list.children() ); + $(this).parent().remove(); + return; + } + + // update vars + $prevLabel = $label; + $prevList = $list; + }); + }; + + // get results + var xhr = $.ajax({ + url: acf.get('ajaxurl'), + dataType: 'json', + type: 'post', + data: acf.prepareForAjax(ajaxData), + context: this, + success: onSuccess, + complete: onComplete + }); + + // set + this.set('xhr', xhr); + }, + + walkChoices: function( data ){ + + // walker + var walk = function( data ){ + + // vars + var html = ''; + + // is array + if( $.isArray(data) ) { + data.map(function(item){ + html += walk( item ); + }); + + // is item + } else if( $.isPlainObject(data) ) { + + // group + if( data.children !== undefined ) { + + html += '
  • ' + data.text + '
      '; + html += walk( data.children ); + html += '
  • '; + + // single + } else { + html += '
  • ' + data.text + '
  • '; + } + } + + // return + return html; + }; + + return walk( data ); + } + + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-select.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-select.js new file mode 100644 index 0000000..cb555c6 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-select.js @@ -0,0 +1,57 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'select', + + select2: false, + + wait: 'load', + + events: { + 'removeField': 'onRemove' + }, + + $input: function(){ + return this.$('select'); + }, + + initialize: function(){ + + // vars + var $select = this.$input(); + + // inherit data + this.inherit( $select ); + + // select2 + if( this.get('ui') ) { + + // populate ajax_data (allowing custom attribute to already exist) + var ajaxAction = this.get('ajax_action'); + if( !ajaxAction ) { + ajaxAction = 'acf/fields/' + this.get('type') + '/query'; + } + + // select2 + this.select2 = acf.newSelect2($select, { + field: this, + ajax: this.get('ajax'), + multiple: this.get('multiple'), + placeholder: this.get('placeholder'), + allowNull: this.get('allow_null'), + ajaxAction: ajaxAction, + }); + } + }, + + onRemove: function(){ + if( this.select2 ) { + this.select2.destroy(); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-tab.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-tab.js new file mode 100644 index 0000000..8483f1b --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-tab.js @@ -0,0 +1,505 @@ +(function($, undefined){ + + // vars + var CONTEXT = 'tab'; + + var Field = acf.Field.extend({ + + type: 'tab', + + wait: '', + + tabs: false, + + tab: false, + + findFields: function(){ + return this.$el.nextUntil('.acf-field-tab', '.acf-field'); + }, + + getFields: function(){ + return acf.getFields( this.findFields() ); + }, + + findTabs: function(){ + return this.$el.prevAll('.acf-tab-wrap:first'); + }, + + findTab: function(){ + return this.$('.acf-tab-button'); + }, + + initialize: function(){ + + // bail early if is td + if( this.$el.is('td') ) { + this.events = {}; + return false; + } + + // vars + var $tabs = this.findTabs(); + var $tab = this.findTab(); + var settings = acf.parseArgs($tab.data(), { + endpoint: false, + placement: '', + before: this.$el + }); + + // create wrap + if( !$tabs.length || settings.endpoint ) { + this.tabs = new Tabs( settings ); + } else { + this.tabs = $tabs.data('acf'); + } + + // add tab + this.tab = this.tabs.addTab($tab, this); + }, + + isActive: function(){ + return this.tab.isActive(); + }, + + showFields: function(){ + + // show fields + this.getFields().map(function( field ){ + field.show( this.cid, CONTEXT ); + field.hiddenByTab = false; + }, this); + + }, + + hideFields: function(){ + + // hide fields + this.getFields().map(function( field ){ + field.hide( this.cid, CONTEXT ); + field.hiddenByTab = this.tab; + }, this); + + }, + + show: function( lockKey ){ + + // show field and store result + var visible = acf.Field.prototype.show.apply(this, arguments); + + // check if now visible + if( visible ) { + + // show tab + this.tab.show(); + + // check active tabs + this.tabs.refresh(); + } + + // return + return visible; + }, + + hide: function( lockKey ){ + + // hide field and store result + var hidden = acf.Field.prototype.hide.apply(this, arguments); + + // check if now hidden + if( hidden ) { + + // hide tab + this.tab.hide(); + + // reset tabs if this was active + if( this.isActive() ) { + this.tabs.reset(); + } + } + + // return + return hidden; + }, + + enable: function( lockKey ){ + + // enable fields + this.getFields().map(function( field ){ + field.enable( CONTEXT ); + }); + }, + + disable: function( lockKey ){ + + // disable fields + this.getFields().map(function( field ){ + field.disable( CONTEXT ); + }); + } + }); + + acf.registerFieldType( Field ); + + + /** + * tabs + * + * description + * + * @date 8/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var i = 0; + var Tabs = acf.Model.extend({ + + tabs: [], + + active: false, + + actions: { + 'refresh': 'onRefresh' + }, + + data: { + before: false, + placement: 'top', + index: 0, + initialized: false, + }, + + setup: function( settings ){ + + // data + $.extend(this.data, settings); + + // define this prop to avoid scope issues + this.tabs = []; + this.active = false; + + // vars + var placement = this.get('placement'); + var $before = this.get('before'); + var $parent = $before.parent(); + + // add sidebar for left placement + if( placement == 'left' && $parent.hasClass('acf-fields') ) { + $parent.addClass('-sidebar'); + } + + // create wrap + if( $before.is('tr') ) { + this.$el = $('
    '); + } else { + this.$el = $('
      '); + } + + // append + $before.before( this.$el ); + + // set index + this.set('index', i, true); + i++; + }, + + initializeTabs: function(){ + + // find first visible tab + var tab = this.getVisible().shift(); + + // remember previous tab state + var order = acf.getPreference('this.tabs') || []; + var groupIndex = this.get('index'); + var tabIndex = order[ groupIndex ]; + + if( this.tabs[ tabIndex ] && this.tabs[ tabIndex ].isVisible() ) { + tab = this.tabs[ tabIndex ]; + } + + // select + if( tab ) { + this.selectTab( tab ); + } else { + this.closeTabs(); + } + + // set local variable used by tabsManager + this.set('initialized', true); + }, + + getVisible: function(){ + return this.tabs.filter(function( tab ){ + return tab.isVisible(); + }); + }, + + getActive: function(){ + return this.active; + }, + + setActive: function( tab ){ + return this.active = tab; + }, + + hasActive: function(){ + return (this.active !== false); + }, + + isActive: function( tab ){ + var active = this.getActive(); + return (active && active.cid === tab.cid); + }, + + closeActive: function(){ + if( this.hasActive() ) { + this.closeTab( this.getActive() ); + } + }, + + openTab: function( tab ){ + + // close existing tab + this.closeActive(); + + // open + tab.open(); + + // set active + this.setActive( tab ); + }, + + closeTab: function( tab ){ + + // close + tab.close(); + + // set active + this.setActive( false ); + }, + + closeTabs: function(){ + this.tabs.map( this.closeTab, this ); + }, + + selectTab: function( tab ){ + + // close other tabs + this.tabs.map(function( t ){ + if( tab.cid !== t.cid ) { + this.closeTab( t ); + } + }, this); + + // open + this.openTab( tab ); + + }, + + addTab: function( $a, field ){ + + // create
    • + var $li = $('
    • '); + + // append + $li.append( $a ); + + // append + this.$('ul').append( $li ); + + // initialize + var tab = new Tab({ + $el: $li, + field: field, + group: this, + }); + + // store + this.tabs.push( tab ); + + // return + return tab; + }, + + reset: function(){ + + // close existing tab + this.closeActive(); + + // find and active a tab + return this.refresh(); + }, + + refresh: function(){ + + // bail early if active already exists + if( this.hasActive() ) { + return false; + } + + // find next active tab + var tab = this.getVisible().shift(); + + // open tab + if( tab ) { + this.openTab( tab ); + } + + // return + return tab; + }, + + onRefresh: function(){ + + // only for left placements + if( this.get('placement') !== 'left' ) { + return; + } + + // vars + var $parent = this.$el.parent(); + var $list = this.$el.children('ul'); + var attribute = $parent.is('td') ? 'height' : 'min-height'; + + // find height (minus 1 for border-bottom) + var height = $list.position().top + $list.outerHeight(true) - 1; + + // add css + $parent.css(attribute, height); + } + }); + + var Tab = acf.Model.extend({ + + group: false, + + field: false, + + events: { + 'click a': 'onClick' + }, + + index: function(){ + return this.$el.index(); + }, + + isVisible: function(){ + return acf.isVisible( this.$el ); + }, + + isActive: function(){ + return this.$el.hasClass('active'); + }, + + open: function(){ + + // add class + this.$el.addClass('active'); + + // show field + this.field.showFields(); + }, + + close: function(){ + + // remove class + this.$el.removeClass('active'); + + // hide field + this.field.hideFields(); + }, + + onClick: function( e, $el ){ + + // prevent default + e.preventDefault(); + + // toggle + this.toggle(); + }, + + toggle: function(){ + + // bail early if already active + if( this.isActive() ) { + return; + } + + // toggle this tab + this.group.openTab( this ); + } + }); + + var tabsManager = new acf.Model({ + + priority: 50, + + actions: { + 'prepare': 'render', + 'append': 'render', + 'unload': 'onUnload', + 'invalid_field': 'onInvalidField' + }, + + findTabs: function(){ + return $('.acf-tab-wrap'); + }, + + getTabs: function(){ + return acf.getInstances( this.findTabs() ); + }, + + render: function( $el ){ + this.getTabs().map(function( tabs ){ + if( !tabs.get('initialized') ) { + tabs.initializeTabs(); + } + }); + }, + + onInvalidField: function( field ){ + + // bail early if busy + if( this.busy ) { + return; + } + + // ignore if not hidden by tab + if( !field.hiddenByTab ) { + return; + } + + // toggle tab + field.hiddenByTab.toggle(); + + // ignore other invalid fields + this.busy = true; + this.setTimeout(function(){ + this.busy = false; + }, 100); + }, + + onUnload: function(){ + + // vars + var order = []; + + // loop + this.getTabs().map(function( group ){ + var active = group.hasActive() ? group.getActive().index() : 0; + order.push(active); + }); + + // bail if no tabs + if( !order.length ) { + return; + } + + // update + acf.setPreference('this.tabs', order); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-taxonomy.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-taxonomy.js new file mode 100644 index 0000000..2cbd76d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-taxonomy.js @@ -0,0 +1,321 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'taxonomy', + + data: { + 'ftype': 'select' + }, + + select2: false, + + wait: 'load', + + events: { + 'click a[data-name="add"]': 'onClickAdd', + 'click input[type="radio"]': 'onClickRadio', + }, + + $control: function(){ + return this.$('.acf-taxonomy-field'); + }, + + $input: function(){ + return this.getRelatedPrototype().$input.apply(this, arguments); + }, + + getRelatedType: function(){ + + // vars + var fieldType = this.get('ftype'); + + // normalize + if( fieldType == 'multi_select' ) { + fieldType = 'select'; + } + + // return + return fieldType; + + }, + + getRelatedPrototype: function(){ + return acf.getFieldType( this.getRelatedType() ).prototype; + }, + + getValue: function(){ + return this.getRelatedPrototype().getValue.apply(this, arguments); + }, + + setValue: function(){ + return this.getRelatedPrototype().setValue.apply(this, arguments); + }, + + initialize: function(){ + this.getRelatedPrototype().initialize.apply(this, arguments); + }, + + onRemove: function(){ + if( this.select2 ) { + this.select2.destroy(); + } + }, + + onClickAdd: function( e, $el ){ + + // vars + var field = this; + var popup = false; + var $form = false; + var $name = false; + var $parent = false; + var $button = false; + var $message = false; + var notice = false; + + // step 1. + var step1 = function(){ + + // popup + popup = acf.newPopup({ + title: $el.attr('title'), + loading: true, + width: '300px' + }); + + // ajax + var ajaxData = { + action: 'acf/fields/taxonomy/add_term', + field_key: field.get('key') + }; + + // get HTML + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'html', + success: step2 + }); + }; + + // step 2. + var step2 = function( html ){ + + // update popup + popup.loading(false); + popup.content(html); + + // vars + $form = popup.$('form'); + $name = popup.$('input[name="term_name"]'); + $parent = popup.$('select[name="term_parent"]'); + $button = popup.$('.acf-submit-button'); + + // focus + $name.focus(); + + // submit form + popup.on('submit', 'form', step3); + }; + + // step 3. + var step3 = function( e, $el ){ + + // prevent + e.preventDefault(); + e.stopImmediatePropagation(); + + // basic validation + if( $name.val() === '' ) { + $name.focus(); + return false; + } + + // disable + acf.startButtonLoading( $button ); + + // ajax + var ajaxData = { + action: 'acf/fields/taxonomy/add_term', + field_key: field.get('key'), + term_name: $name.val(), + term_parent: $parent.length ? $parent.val() : 0 + }; + + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'json', + success: step4 + }); + }; + + // step 4. + var step4 = function( json ){ + + // enable + acf.stopButtonLoading( $button ); + + // remove prev notice + if( notice ) { + notice.remove(); + } + + // success + if( acf.isAjaxSuccess(json) ) { + + // clear name + $name.val(''); + + // update term lists + step5( json.data ); + + // notice + notice = acf.newNotice({ + type: 'success', + text: acf.getAjaxMessage(json), + target: $form, + timeout: 2000, + dismiss: false + }); + + } else { + + // notice + notice = acf.newNotice({ + type: 'error', + text: acf.getAjaxError(json), + target: $form, + timeout: 2000, + dismiss: false + }); + } + + // focus + $name.focus(); + }; + + // step 5. + var step5 = function( term ){ + + // update parent dropdown + var $option = $(''); + if( term.term_parent ) { + $parent.children('option[value="' + term.term_parent + '"]').after( $option ); + } else { + $parent.append( $option ); + } + + // add this new term to all taxonomy field + var fields = acf.getFields({ + type: 'taxonomy' + }); + + fields.map(function( otherField ){ + if( otherField.get('taxonomy') == field.get('taxonomy') ) { + otherField.appendTerm( term ); + } + }); + + // select + field.selectTerm( term.term_id ); + }; + + // run + step1(); + }, + + appendTerm: function( term ){ + + if( this.getRelatedType() == 'select' ) { + this.appendTermSelect( term ); + } else { + this.appendTermCheckbox( term ); + } + }, + + appendTermSelect: function( term ){ + + this.select2.addOption({ + id: term.term_id, + text: term.term_label + }); + + }, + + appendTermCheckbox: function( term ){ + + // vars + var name = this.$('[name]:first').attr('name'); + var $ul = this.$('ul:first'); + + // allow multiple selection + if( this.getRelatedType() == 'checkbox' ) { + name += '[]'; + } + + // create new li + var $li = $([ + '
    • ', + '', + '
    • ' + ].join('')); + + // find parent + if( term.term_parent ) { + + // vars + var $parent = $ul.find('li[data-id="' + term.term_parent + '"]'); + + // update vars + $ul = $parent.children('ul'); + + // create ul + if( !$ul.exists() ) { + $ul = $('
        '); + $parent.append( $ul ); + } + } + + // append + $ul.append( $li ); + }, + + selectTerm: function( id ){ + if( this.getRelatedType() == 'select' ) { + this.select2.selectOption( id ); + } else { + var $input = this.$('input[value="' + id + '"]'); + $input.prop('checked', true).trigger('change'); + } + }, + + onClickRadio: function( e, $el ){ + + // vars + var $label = $el.parent('label'); + var selected = $label.hasClass('selected'); + + // remove previous selected + this.$('.selected').removeClass('selected'); + + // add active class + $label.addClass('selected'); + + // allow null + if( this.get('allow_null') && selected ) { + $label.removeClass('selected'); + $el.prop('checked', false).trigger('change'); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-time-picker.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-time-picker.js new file mode 100644 index 0000000..b5caf56 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-time-picker.js @@ -0,0 +1,77 @@ +(function($, undefined){ + + var Field = acf.models.DatePickerField.extend({ + + type: 'time_picker', + + $control: function(){ + return this.$('.acf-time-picker'); + }, + + initialize: function(){ + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // args + var args = { + timeFormat: this.get('time_format'), + altField: $input, + altFieldTimeOnly: false, + altTimeFormat: 'HH:mm:ss', + showButtonPanel: true, + controlType: 'select', + oneLine: true, + closeText: acf.get('dateTimePickerL10n').selectText, + timeOnly: true, + }; + + // add custom 'Close = Select' functionality + args.onClose = function( value, dp_instance, t_instance ){ + + // vars + var $close = dp_instance.dpDiv.find('.ui-datepicker-close'); + + // if clicking close button + if( !value && $close.is(':hover') ) { + t_instance._updateDateTime(); + } + }; + + + // filter + args = acf.applyFilters('time_picker_args', args, this); + + // add date time picker + acf.newTimePicker( $inputText, args ); + + // action + acf.doAction('time_picker_init', $inputText, args, this); + } + }); + + acf.registerFieldType( Field ); + + + // add + acf.newTimePicker = function( $input, args ){ + + // bail ealry if no datepicker library + if( typeof $.timepicker === 'undefined' ) { + return false; + } + + // defaults + args = args || {}; + + // initialize + $input.timepicker( args ); + + // wrap the datepicker (only if it hasn't already been wrapped) + if( $('body > #ui-datepicker-div').exists() ) { + $('body > #ui-datepicker-div').wrap('
        '); + } + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-true-false.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-true-false.js new file mode 100644 index 0000000..435cce6 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-true-false.js @@ -0,0 +1,95 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'true_false', + + events: { + 'change .acf-switch-input': 'onChange', + 'focus .acf-switch-input': 'onFocus', + 'blur .acf-switch-input': 'onBlur', + 'keypress .acf-switch-input': 'onKeypress' + }, + + $input: function(){ + return this.$('input[type="checkbox"]'); + }, + + $switch: function(){ + return this.$('.acf-switch'); + }, + + getValue: function(){ + return this.$input().prop('checked') ? 1 : 0; + }, + + initialize: function(){ + this.render(); + }, + + render: function(){ + + // vars + var $switch = this.$switch(); + + // bail ealry if no $switch + if( !$switch.length ) return; + + // vars + var $on = $switch.children('.acf-switch-on'); + var $off = $switch.children('.acf-switch-off'); + var width = Math.max( $on.width(), $off.width() ); + + // bail ealry if no width + if( !width ) return; + + // set widths + $on.css( 'min-width', width ); + $off.css( 'min-width', width ); + + }, + + switchOn: function() { + this.$input().prop('checked', true); + this.$switch().addClass('-on'); + }, + + switchOff: function() { + this.$input().prop('checked', false); + this.$switch().removeClass('-on'); + }, + + onChange: function( e, $el ){ + if( $el.prop('checked') ) { + this.switchOn(); + } else { + this.switchOff(); + } + }, + + onFocus: function( e, $el ){ + this.$switch().addClass('-focus'); + }, + + onBlur: function( e, $el ){ + this.$switch().removeClass('-focus'); + }, + + onKeypress: function( e, $el ){ + + // left + if( e.keyCode === 37 ) { + return this.switchOff(); + } + + // right + if( e.keyCode === 39 ) { + return this.switchOn(); + } + + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-url.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-url.js new file mode 100644 index 0000000..55c0538 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-url.js @@ -0,0 +1,64 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'url', + + events: { + 'keyup input[type="url"]': 'onkeyup' + }, + + $control: function(){ + return this.$('.acf-input-wrap'); + }, + + $input: function(){ + return this.$('input[type="url"]'); + }, + + initialize: function(){ + this.render(); + }, + + isValid: function(){ + + // vars + var val = this.val(); + + // bail early if no val + if( !val ) { + return false; + } + + // url + if( val.indexOf('://') !== -1 ) { + return true; + } + + // protocol relative url + if( val.indexOf('//') === 0 ) { + return true; + } + + // return + return false; + }, + + render: function(){ + + // add class + if( this.isValid() ) { + this.$control().addClass('-valid'); + } else { + this.$control().removeClass('-valid'); + } + }, + + onkeyup: function( e, $el ){ + this.render(); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-user.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-user.js new file mode 100644 index 0000000..3677b33 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-user.js @@ -0,0 +1,9 @@ +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'user', + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-wysiwyg.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-wysiwyg.js new file mode 100644 index 0000000..b8ec69d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field-wysiwyg.js @@ -0,0 +1,102 @@ +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'wysiwyg', + + wait: 'load', + + events: { + 'mousedown .acf-editor-wrap.delay': 'onMousedown', + 'unmountField': 'disableEditor', + 'remountField': 'enableEditor', + 'removeField': 'disableEditor' + }, + + $control: function(){ + return this.$('.acf-editor-wrap'); + }, + + $input: function(){ + return this.$('textarea'); + }, + + getMode: function(){ + return this.$control().hasClass('tmce-active') ? 'visual' : 'text'; + }, + + initialize: function(){ + + // initializeEditor if no delay + if( !this.$control().hasClass('delay') ) { + this.initializeEditor(); + } + }, + + initializeEditor: function(){ + + // vars + var $wrap = this.$control(); + var $textarea = this.$input(); + var args = { + tinymce: true, + quicktags: true, + toolbar: this.get('toolbar'), + mode: this.getMode(), + field: this + }; + + // generate new id + var oldId = $textarea.attr('id'); + var newId = acf.uniqueId('acf-editor-'); + + // store copy of textarea data + var data = $textarea.data(); + + // rename + acf.rename({ + target: $wrap, + search: oldId, + replace: newId, + destructive: true + }); + + // update id + this.set('id', newId, true); + + // initialize + acf.tinymce.initialize( newId, args ); + + // apply data to new textarea (acf.rename creates a new textarea element due to destructive mode) + // fixes bug where conditional logic "disabled" is lost during "screen_check" + this.$input().data(data); + }, + + onMousedown: function( e ){ + + // prevent default + e.preventDefault(); + + // remove delay class + var $wrap = this.$control(); + $wrap.removeClass('delay'); + $wrap.find('.acf-editor-toolbar').remove(); + + // initialize + this.initializeEditor(); + }, + + enableEditor: function(){ + if( this.getMode() == 'visual' ) { + acf.tinymce.enable( this.get('id') ); + } + }, + + disableEditor: function(){ + acf.tinymce.destroy( this.get('id') ); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field.js new file mode 100644 index 0000000..63cd830 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-field.js @@ -0,0 +1,524 @@ +(function($, undefined){ + + // vars + var storage = []; + + /** + * acf.Field + * + * description + * + * @date 23/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.Field = acf.Model.extend({ + + // field type + type: '', + + // class used to avoid nested event triggers + eventScope: '.acf-field', + + // initialize events on 'ready' + wait: 'ready', + + /** + * setup + * + * Called during the constructor function to setup this field ready for initialization + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param jQuery $field The field element. + * @return void + */ + + setup: function( $field ){ + + // set $el + this.$el = $field; + + // inherit $field data + this.inherit( $field ); + + // inherit controll data + this.inherit( this.$control() ); + }, + + /** + * val + * + * Sets or returns the field's value + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param mixed val Optional. The value to set + * @return mixed + */ + + val: function( val ){ + if( val !== undefined ) { + return this.setValue( val ); + } else { + return this.prop('disabled') ? null : this.getValue(); + } + }, + + /** + * getValue + * + * returns the field's value + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param void + * @return mixed + */ + + getValue: function(){ + return this.$input().val(); + }, + + /** + * setValue + * + * sets the field's value and returns true if changed + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param mixed val + * @return boolean. True if changed. + */ + + setValue: function( val ){ + return acf.val( this.$input(), val ); + }, + + /** + * __ + * + * i18n helper to be removed + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + __: function( string ){ + return acf._e( this.type, string ); + }, + + /** + * $control + * + * returns the control jQuery element used for inheriting data. Uses this.control setting. + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param void + * @return jQuery + */ + + $control: function(){ + return false; + }, + + /** + * $input + * + * returns the input jQuery element used for saving values. Uses this.input setting. + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param void + * @return jQuery + */ + + $input: function(){ + return this.$('[name]:first'); + }, + + /** + * $inputWrap + * + * description + * + * @date 12/5/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + $inputWrap: function(){ + return this.$('.acf-input:first'); + }, + + /** + * $inputWrap + * + * description + * + * @date 12/5/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + $labelWrap: function(){ + return this.$('.acf-label:first'); + }, + + /** + * getInputName + * + * Returns the field's input name + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param void + * @return string + */ + + getInputName: function(){ + return this.$input().attr('name') || ''; + }, + + /** + * parent + * + * returns the field's parent field or false on failure. + * + * @date 8/5/18 + * @since 5.6.9 + * + * @param void + * @return object|false + */ + + parent: function() { + + // vars + var parents = this.parents(); + + // return + return parents.length ? parents[0] : false; + }, + + /** + * parents + * + * description + * + * @date 9/7/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + parents: function(){ + + // vars + var $parents = this.$el.parents('.acf-field'); + + // convert + var parents = acf.getFields( $parents ); + + // return + return parents; + }, + + show: function( lockKey, context ){ + + // show field and store result + var changed = acf.show( this.$el, lockKey ); + + // do action if visibility has changed + if( changed ) { + this.prop('hidden', false); + acf.doAction('show_field', this, context); + } + + // return + return changed; + }, + + hide: function( lockKey, context ){ + + // hide field and store result + var changed = acf.hide( this.$el, lockKey ); + + // do action if visibility has changed + if( changed ) { + this.prop('hidden', true); + acf.doAction('hide_field', this, context); + } + + // return + return changed; + }, + + enable: function( lockKey, context ){ + + // enable field and store result + var changed = acf.enable( this.$el, lockKey ); + + // do action if disabled has changed + if( changed ) { + this.prop('disabled', false); + acf.doAction('enable_field', this, context); + } + + // return + return changed; + }, + + disable: function( lockKey, context ){ + + // disabled field and store result + var changed = acf.disable( this.$el, lockKey ); + + // do action if disabled has changed + if( changed ) { + this.prop('disabled', true); + acf.doAction('disable_field', this, context); + } + + // return + return changed; + }, + + showEnable: function( lockKey, context ){ + + // enable + this.enable.apply(this, arguments); + + // show and return true if changed + return this.show.apply(this, arguments); + }, + + hideDisable: function( lockKey, context ){ + + // disable + this.disable.apply(this, arguments); + + // hide and return true if changed + return this.hide.apply(this, arguments); + }, + + showNotice: function( props ){ + + // ensure object + if( typeof props !== 'object' ) { + props = { text: props }; + } + + // remove old notice + if( this.notice ) { + this.notice.remove(); + } + + // create new notice + props.target = this.$inputWrap(); + this.notice = acf.newNotice( props ); + }, + + removeNotice: function( timeout ){ + if( this.notice ) { + this.notice.away( timeout || 0 ); + this.notice = false; + } + }, + + showError: function( message ){ + + // add class + this.$el.addClass('acf-error'); + + // add message + if( message !== undefined ) { + this.showNotice({ + text: message, + type: 'error', + dismiss: false + }); + } + + // action + acf.doAction('invalid_field', this); + + // add event + this.$el.one('focus change', 'input, select, textarea', $.proxy( this.removeError, this )); + }, + + removeError: function(){ + + // remove class + this.$el.removeClass('acf-error'); + + // remove notice + this.removeNotice( 250 ); + + // action + acf.doAction('valid_field', this); + }, + + trigger: function( name, args, bubbles ){ + + // allow some events to bubble + if( name == 'invalidField' ) { + bubbles = true; + } + + // return + return acf.Model.prototype.trigger.apply(this, [name, args, bubbles]); + }, + }); + + /** + * newField + * + * description + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newField = function( $field ){ + + // vars + var type = $field.data('type'); + var mid = modelId( type ); + var model = acf.models[ mid ] || acf.Field; + + // instantiate + var field = new model( $field ); + + // actions + acf.doAction('new_field', field); + + // return + return field; + }; + + /** + * mid + * + * Calculates the model ID for a field type + * + * @date 15/12/17 + * @since 5.6.5 + * + * @param string type + * @return string + */ + + var modelId = function( type ) { + return acf.strPascalCase( type || '' ) + 'Field'; + }; + + /** + * registerFieldType + * + * description + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.registerFieldType = function( model ){ + + // vars + var proto = model.prototype; + var type = proto.type; + var mid = modelId( type ); + + // store model + acf.models[ mid ] = model; + + // store reference + storage.push( type ); + }; + + /** + * acf.getFieldType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getFieldType = function( type ){ + var mid = modelId( type ); + return acf.models[ mid ] || false; + } + + /** + * acf.getFieldTypes + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getFieldTypes = function( args ){ + + // defaults + args = acf.parseArgs(args, { + category: '', + // hasValue: true + }); + + // clonse available types + var types = []; + + // loop + storage.map(function( type ){ + + // vars + var model = acf.getFieldType(type); + var proto = model.prototype; + + // check operator + if( args.category && proto.category !== args.category ) { + return; + } + + // append + types.push( model ); + }); + + // return + return types; + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-fields.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-fields.js new file mode 100644 index 0000000..0cea0bf --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-fields.js @@ -0,0 +1,372 @@ +(function($, undefined){ + + /** + * findFields + * + * Returns a jQuery selection object of acf fields. + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object $args { + * Optional. Arguments to find fields. + * + * @type string key The field's key (data-attribute). + * @type string name The field's name (data-attribute). + * @type string type The field's type (data-attribute). + * @type string is jQuery selector to compare against. + * @type jQuery parent jQuery element to search within. + * @type jQuery sibling jQuery element to search alongside. + * @type limit int The number of fields to find. + * @type suppressFilters bool Whether to allow filters to add/remove results. Default behaviour will ignore clone fields. + * } + * @return jQuery + */ + + acf.findFields = function( args ){ + + // vars + var selector = '.acf-field'; + var $fields = false; + + // args + args = acf.parseArgs(args, { + key: '', + name: '', + type: '', + is: '', + parent: false, + sibling: false, + limit: false, + visible: false, + suppressFilters: false, + }); + + // filter args + if( !args.suppressFilters ) { + args = acf.applyFilters('find_fields_args', args); + } + + // key + if( args.key ) { + selector += '[data-key="' + args.key + '"]'; + } + + // type + if( args.type ) { + selector += '[data-type="' + args.type + '"]'; + } + + // name + if( args.name ) { + selector += '[data-name="' + args.name + '"]'; + } + + // is + if( args.is ) { + selector += args.is; + } + + // visibility + if( args.visible ) { + selector += ':visible'; + } + + // query + if( args.parent ) { + $fields = args.parent.find( selector ); + } else if( args.sibling ) { + $fields = args.sibling.siblings( selector ); + } else { + $fields = $( selector ); + } + + // filter + if( !args.suppressFilters ) { + $fields = $fields.not('.acf-clone .acf-field'); + $fields = acf.applyFilters('find_fields', $fields); + } + + // limit + if( args.limit ) { + $fields = $fields.slice( 0, args.limit ); + } + + // return + return $fields; + + }; + + /** + * findField + * + * Finds a specific field with jQuery + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string key The field's key. + * @param jQuery $parent jQuery element to search within. + * @return jQuery + */ + + acf.findField = function( key, $parent ){ + return acf.findFields({ + key: key, + limit: 1, + parent: $parent, + suppressFilters: true + }); + }; + + /** + * getField + * + * Returns a field instance + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param jQuery|string $field jQuery element or field key. + * @return object + */ + + acf.getField = function( $field ){ + + // allow jQuery + if( $field instanceof jQuery ) { + + // find fields + } else { + $field = acf.findField( $field ); + } + + // instantiate + var field = $field.data('acf'); + if( !field ) { + field = acf.newField( $field ); + } + + // return + return field; + }; + + /** + * getFields + * + * Returns multiple field instances + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param jQuery|object $fields jQuery elements or query args. + * @return array + */ + + acf.getFields = function( $fields ){ + + // allow jQuery + if( $fields instanceof jQuery ) { + + // find fields + } else { + $fields = acf.findFields( $fields ); + } + + // loop + var fields = []; + $fields.each(function(){ + var field = acf.getField( $(this) ); + fields.push( field ); + }); + + // return + return fields; + }; + + /** + * findClosestField + * + * Returns the closest jQuery field element + * + * @date 9/4/18 + * @since 5.6.9 + * + * @param jQuery $el + * @return jQuery + */ + + acf.findClosestField = function( $el ){ + return $el.closest('.acf-field'); + }; + + /** + * getClosestField + * + * Returns the closest field instance + * + * @date 22/1/18 + * @since 5.6.5 + * + * @param jQuery $el + * @return object + */ + + acf.getClosestField = function( $el ){ + var $field = acf.findClosestField( $el ); + return this.getField( $field ); + }; + + /** + * addGlobalFieldAction + * + * Sets up callback logic for global field actions + * + * @date 15/6/18 + * @since 5.6.9 + * + * @param string action + * @return void + */ + + var addGlobalFieldAction = function( action ){ + + // vars + var globalAction = action; + var pluralAction = action + '_fields'; // ready_fields + var singleAction = action + '_field'; // ready_field + + // global action + var globalCallback = function( $el /*, arg1, arg2, etc*/ ){ + //console.log( action, arguments ); + + // get args [$el, ...] + var args = acf.arrayArgs( arguments ); + var extraArgs = args.slice(1); + + // find fields + var fields = acf.getFields({ parent: $el }); + + // check + if( fields.length ) { + + // pluralAction + var pluralArgs = [ pluralAction, fields ].concat( extraArgs ); + acf.doAction.apply(null, pluralArgs); + } + }; + + // plural action + var pluralCallback = function( fields /*, arg1, arg2, etc*/ ){ + //console.log( pluralAction, arguments ); + + // get args [fields, ...] + var args = acf.arrayArgs( arguments ); + var extraArgs = args.slice(1); + + // loop + fields.map(function( field, i ){ + //setTimeout(function(){ + // singleAction + var singleArgs = [ singleAction, field ].concat( extraArgs ); + acf.doAction.apply(null, singleArgs); + //}, i * 100); + }); + }; + + // add actions + acf.addAction(globalAction, globalCallback); + acf.addAction(pluralAction, pluralCallback); + + // also add single action + addSingleFieldAction( action ); + } + + /** + * addSingleFieldAction + * + * Sets up callback logic for single field actions + * + * @date 15/6/18 + * @since 5.6.9 + * + * @param string action + * @return void + */ + + var addSingleFieldAction = function( action ){ + + // vars + var singleAction = action + '_field'; // ready_field + var singleEvent = action + 'Field'; // readyField + + // single action + var singleCallback = function( field /*, arg1, arg2, etc*/ ){ + //console.log( singleAction, arguments ); + + // get args [field, ...] + var args = acf.arrayArgs( arguments ); + var extraArgs = args.slice(1); + + // action variations (ready_field/type=image) + var variations = ['type', 'name', 'key']; + variations.map(function( variation ){ + + // vars + var prefix = '/' + variation + '=' + field.get(variation); + + // singleAction + args = [ singleAction + prefix , field ].concat( extraArgs ); + acf.doAction.apply(null, args); + }); + + // event + if( singleFieldEvents.indexOf(action) > -1 ) { + field.trigger(singleEvent, extraArgs); + } + }; + + // add actions + acf.addAction(singleAction, singleCallback); + } + + // vars + var globalFieldActions = [ 'prepare', 'ready', 'load', 'append', 'remove', 'unmount', 'remount', 'sortstart', 'sortstop', 'show', 'hide', 'unload' ]; + var singleFieldActions = [ 'valid', 'invalid', 'enable', 'disable', 'new' ]; + var singleFieldEvents = [ 'remove', 'unmount', 'remount', 'sortstart', 'sortstop', 'show', 'hide', 'unload', 'valid', 'invalid', 'enable', 'disable' ]; + + // add + globalFieldActions.map( addGlobalFieldAction ); + singleFieldActions.map( addSingleFieldAction ); + + /** + * fieldsEventManager + * + * Manages field actions and events + * + * @date 15/12/17 + * @since 5.6.5 + * + * @param void + * @param void + */ + + var fieldsEventManager = new acf.Model({ + id: 'fieldsEventManager', + events: { + 'click .acf-field a[href="#"]': 'onClick', + 'change .acf-field': 'onChange' + }, + onClick: function( e ){ + + // prevent default of any link with an href of # + e.preventDefault(); + }, + onChange: function(){ + + // preview hack allows post to save with no title or content + $('#_acf_changed').val(1); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-helpers.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-helpers.js new file mode 100644 index 0000000..c54010a --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-helpers.js @@ -0,0 +1,361 @@ +(function($, undefined){ + + /** + * refreshHelper + * + * description + * + * @date 1/7/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var refreshHelper = new acf.Model({ + priority: 90, + timeout: 0, + actions: { + 'new_field': 'refresh', + 'show_field': 'refresh', + 'hide_field': 'refresh', + 'remove_field': 'refresh' + }, + refresh: function(){ + clearTimeout( this.timeout ); + this.timeout = setTimeout(function(){ + acf.doAction('refresh'); + }, 0); + } + }); + + /** + * mountHelper + * + * Adds compatiblity for the 'unmount' and 'remount' actions added in 5.8.0 + * + * @date 7/3/19 + * @since 5.7.14 + * + * @param void + * @return void + */ + var mountHelper = new acf.Model({ + priority: 1, + actions: { + 'sortstart': 'onSortstart', + 'sortstop': 'onSortstop' + }, + onSortstart: function( $item ){ + acf.doAction('unmount', $item); + }, + onSortstop: function( $item ){ + acf.doAction('remount', $item); + } + }); + + /** + * sortableHelper + * + * Adds compatibility for sorting a
        element + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var sortableHelper = new acf.Model({ + actions: { + 'sortstart': 'onSortstart' + }, + onSortstart: function( $item, $placeholder ){ + + // if $item is a tr, apply some css to the elements + if( $item.is('tr') ) { + + // replace $placeholder children with a single td + // fixes "width calculation issues" due to conditional logic hiding some children + $placeholder.html(''); + + // add helper class to remove absolute positioning + $item.addClass('acf-sortable-tr-helper'); + + // set fixed widths for children + $item.children().each(function(){ + $(this).width( $(this).width() ); + }); + + // mimic height + $placeholder.height( $item.height() + 'px' ); + + // remove class + $item.removeClass('acf-sortable-tr-helper'); + } + } + }); + + /** + * duplicateHelper + * + * Fixes browser bugs when duplicating an element + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var duplicateHelper = new acf.Model({ + actions: { + 'after_duplicate': 'onAfterDuplicate' + }, + onAfterDuplicate: function( $el, $el2 ){ + + // get original values + var vals = []; + $el.find('select').each(function(i){ + vals.push( $(this).val() ); + }); + + // set duplicate values + $el2.find('select').each(function(i){ + $(this).val( vals[i] ); + }); + } + }); + + /** + * tableHelper + * + * description + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var tableHelper = new acf.Model({ + + id: 'tableHelper', + + priority: 20, + + actions: { + 'refresh': 'renderTables' + }, + + renderTables: function( $el ){ + + // loop + var self = this; + $('.acf-table:visible').each(function(){ + self.renderTable( $(this) ); + }); + }, + + renderTable: function( $table ){ + + // vars + var $ths = $table.find('> thead > tr:visible > th[data-key]'); + var $tds = $table.find('> tbody > tr:visible > td[data-key]'); + + // bail early if no thead + if( !$ths.length || !$tds.length ) { + return false; + } + + + // visiblity + $ths.each(function( i ){ + + // vars + var $th = $(this); + var key = $th.data('key'); + var $cells = $tds.filter('[data-key="' + key + '"]'); + var $hidden = $cells.filter('.acf-hidden'); + + // always remove empty and allow cells to be hidden + $cells.removeClass('acf-empty'); + + // hide $th if all cells are hidden + if( $cells.length === $hidden.length ) { + acf.hide( $th ); + + // force all hidden cells to appear empty + } else { + acf.show( $th ); + $hidden.addClass('acf-empty'); + } + }); + + + // clear width + $ths.css('width', 'auto'); + + // get visible + $ths = $ths.not('.acf-hidden'); + + // vars + var availableWidth = 100; + var colspan = $ths.length; + + // set custom widths first + var $fixedWidths = $ths.filter('[data-width]'); + $fixedWidths.each(function(){ + var width = $(this).data('width'); + $(this).css('width', width + '%'); + availableWidth -= width; + }); + + // set auto widths + var $auoWidths = $ths.not('[data-width]'); + if( $auoWidths.length ) { + var width = availableWidth / $auoWidths.length; + $auoWidths.css('width', width + '%'); + availableWidth = 0; + } + + // avoid stretching issue + if( availableWidth > 0 ) { + $ths.last().css('width', 'auto'); + } + + + // update colspan on collapsed + $tds.filter('.-collapsed-target').each(function(){ + + // vars + var $td = $(this); + + // check if collapsed + if( $td.parent().hasClass('-collapsed') ) { + $td.attr('colspan', $ths.length); + } else { + $td.removeAttr('colspan'); + } + }); + } + }); + + + /** + * fieldsHelper + * + * description + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var fieldsHelper = new acf.Model({ + + id: 'fieldsHelper', + + priority: 30, + + actions: { + 'refresh': 'renderGroups' + }, + + renderGroups: function(){ + + // loop + var self = this; + $('.acf-fields:visible').each(function(){ + self.renderGroup( $(this) ); + }); + }, + + renderGroup: function( $el ){ + + // vars + var top = 0; + var height = 0; + var $row = $(); + + // get fields + var $fields = $el.children('.acf-field[data-width]:visible'); + + // bail early if no fields + if( !$fields.length ) { + return false; + } + + // bail ealry if is .-left + if( $el.hasClass('-left') ) { + $fields.removeAttr('data-width'); + $fields.css('width', 'auto'); + return false; + } + + // reset fields + $fields.removeClass('-r0 -c0').css({'min-height': 0}); + + // loop + $fields.each(function( i ){ + + // vars + var $field = $(this); + var position = $field.position(); + var thisTop = Math.ceil( position.top ); + var thisLeft = Math.ceil( position.left ); + + // detect change in row + if( $row.length && thisTop > top ) { + + // set previous heights + $row.css({'min-height': height+'px'}); + + // update position due to change in row above + position = $field.position(); + thisTop = Math.ceil( position.top ); + thisLeft = Math.ceil( position.left ); + + // reset vars + top = 0; + height = 0; + $row = $(); + } + + // rtl + if( acf.get('rtl') ) { + thisLeft = Math.ceil( $field.parent().width() - (position.left + $field.outerWidth()) ); + } + + // add classes + if( thisTop == 0 ) { + $field.addClass('-r0'); + } else if( thisLeft == 0 ) { + $field.addClass('-c0'); + } + + // get height after class change + // - add 1 for subpixel rendering + var thisHeight = Math.ceil( $field.outerHeight() ) + 1; + + // set height + height = Math.max( height, thisHeight ); + + // set y + top = Math.max( top, thisTop ); + + // append + $row = $row.add( $field ); + }); + + // clean up + if( $row.length ) { + $row.css({'min-height': height+'px'}); + } + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-hooks.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-hooks.js new file mode 100755 index 0000000..45bc849 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-hooks.js @@ -0,0 +1,252 @@ +( function( window, undefined ) { + "use strict"; + + /** + * Handles managing all events for whatever you plug it into. Priorities for hooks are based on lowest to highest in + * that, lowest priority hooks are fired first. + */ + var EventManager = function() { + /** + * Maintain a reference to the object scope so our public methods never get confusing. + */ + var MethodsAvailable = { + removeFilter : removeFilter, + applyFilters : applyFilters, + addFilter : addFilter, + removeAction : removeAction, + doAction : doAction, + addAction : addAction, + storage : getStorage + }; + + /** + * Contains the hooks that get registered with this EventManager. The array for storage utilizes a "flat" + * object literal such that looking up the hook utilizes the native object literal hash. + */ + var STORAGE = { + actions : {}, + filters : {} + }; + + function getStorage() { + + return STORAGE; + + }; + + /** + * Adds an action to the event manager. + * + * @param action Must contain namespace.identifier + * @param callback Must be a valid callback function before this action is added + * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook + * @param [context] Supply a value to be used for this + */ + function addAction( action, callback, priority, context ) { + if( typeof action === 'string' && typeof callback === 'function' ) { + priority = parseInt( ( priority || 10 ), 10 ); + _addHook( 'actions', action, callback, priority, context ); + } + + return MethodsAvailable; + } + + /** + * Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is + * that the first argument must always be the action. + */ + function doAction( /* action, arg1, arg2, ... */ ) { + var args = Array.prototype.slice.call( arguments ); + var action = args.shift(); + + if( typeof action === 'string' ) { + _runHook( 'actions', action, args ); + } + + return MethodsAvailable; + } + + /** + * Removes the specified action if it contains a namespace.identifier & exists. + * + * @param action The action to remove + * @param [callback] Callback function to remove + */ + function removeAction( action, callback ) { + if( typeof action === 'string' ) { + _removeHook( 'actions', action, callback ); + } + + return MethodsAvailable; + } + + /** + * Adds a filter to the event manager. + * + * @param filter Must contain namespace.identifier + * @param callback Must be a valid callback function before this action is added + * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook + * @param [context] Supply a value to be used for this + */ + function addFilter( filter, callback, priority, context ) { + if( typeof filter === 'string' && typeof callback === 'function' ) { + priority = parseInt( ( priority || 10 ), 10 ); + _addHook( 'filters', filter, callback, priority, context ); + } + + return MethodsAvailable; + } + + /** + * Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that + * the first argument must always be the filter. + */ + function applyFilters( /* filter, filtered arg, arg2, ... */ ) { + var args = Array.prototype.slice.call( arguments ); + var filter = args.shift(); + + if( typeof filter === 'string' ) { + return _runHook( 'filters', filter, args ); + } + + return MethodsAvailable; + } + + /** + * Removes the specified filter if it contains a namespace.identifier & exists. + * + * @param filter The action to remove + * @param [callback] Callback function to remove + */ + function removeFilter( filter, callback ) { + if( typeof filter === 'string') { + _removeHook( 'filters', filter, callback ); + } + + return MethodsAvailable; + } + + /** + * Removes the specified hook by resetting the value of it. + * + * @param type Type of hook, either 'actions' or 'filters' + * @param hook The hook (namespace.identifier) to remove + * @private + */ + function _removeHook( type, hook, callback, context ) { + if ( !STORAGE[ type ][ hook ] ) { + return; + } + if ( !callback ) { + STORAGE[ type ][ hook ] = []; + } else { + var handlers = STORAGE[ type ][ hook ]; + var i; + if ( !context ) { + for ( i = handlers.length; i--; ) { + if ( handlers[i].callback === callback ) { + handlers.splice( i, 1 ); + } + } + } + else { + for ( i = handlers.length; i--; ) { + var handler = handlers[i]; + if ( handler.callback === callback && handler.context === context) { + handlers.splice( i, 1 ); + } + } + } + } + } + + /** + * Adds the hook to the appropriate storage container + * + * @param type 'actions' or 'filters' + * @param hook The hook (namespace.identifier) to add to our event manager + * @param callback The function that will be called when the hook is executed. + * @param priority The priority of this hook. Must be an integer. + * @param [context] A value to be used for this + * @private + */ + function _addHook( type, hook, callback, priority, context ) { + var hookObject = { + callback : callback, + priority : priority, + context : context + }; + + // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19 + var hooks = STORAGE[ type ][ hook ]; + if( hooks ) { + hooks.push( hookObject ); + hooks = _hookInsertSort( hooks ); + } + else { + hooks = [ hookObject ]; + } + + STORAGE[ type ][ hook ] = hooks; + } + + /** + * Use an insert sort for keeping our hooks organized based on priority. This function is ridiculously faster + * than bubble sort, etc: http://jsperf.com/javascript-sort + * + * @param hooks The custom array containing all of the appropriate hooks to perform an insert sort on. + * @private + */ + function _hookInsertSort( hooks ) { + var tmpHook, j, prevHook; + for( var i = 1, len = hooks.length; i < len; i++ ) { + tmpHook = hooks[ i ]; + j = i; + while( ( prevHook = hooks[ j - 1 ] ) && prevHook.priority > tmpHook.priority ) { + hooks[ j ] = hooks[ j - 1 ]; + --j; + } + hooks[ j ] = tmpHook; + } + + return hooks; + } + + /** + * Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is. + * + * @param type 'actions' or 'filters' + * @param hook The hook ( namespace.identifier ) to be ran. + * @param args Arguments to pass to the action/filter. If it's a filter, args is actually a single parameter. + * @private + */ + function _runHook( type, hook, args ) { + var handlers = STORAGE[ type ][ hook ]; + + if ( !handlers ) { + return (type === 'filters') ? args[0] : false; + } + + var i = 0, len = handlers.length; + if ( type === 'filters' ) { + for ( ; i < len; i++ ) { + args[ 0 ] = handlers[ i ].callback.apply( handlers[ i ].context, args ); + } + } else { + for ( ; i < len; i++ ) { + handlers[ i ].callback.apply( handlers[ i ].context, args ); + } + } + + return ( type === 'filters' ) ? args[ 0 ] : true; + } + + // return all of the publicly available methods + return MethodsAvailable; + + }; + + // instantiate + acf.hooks = new EventManager(); + +} )( window ); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-media.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-media.js new file mode 100644 index 0000000..0606ef2 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-media.js @@ -0,0 +1,832 @@ +(function($, undefined){ + + /** + * acf.newMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newMediaPopup = function( args ){ + + // args + var popup = null; + var args = acf.parseArgs(args, { + mode: 'select', // 'select', 'edit' + title: '', // 'Upload Image' + button: '', // 'Select Image' + type: '', // 'image', '' + field: false, // field instance + allowedTypes: '', // '.jpg, .png, etc' + library: 'all', // 'all', 'uploadedTo' + multiple: false, // false, true, 'add' + attachment: 0, // the attachment to edit + autoOpen: true, // open the popup automatically + open: function(){}, // callback after close + select: function(){}, // callback after select + close: function(){} // callback after close + }); + + // initialize + if( args.mode == 'edit' ) { + popup = new acf.models.EditMediaPopup( args ); + } else { + popup = new acf.models.SelectMediaPopup( args ); + } + + // open popup (allow frame customization before opening) + if( args.autoOpen ) { + setTimeout(function(){ + popup.open(); + }, 1); + } + + // action + acf.doAction('new_media_popup', popup); + + // return + return popup; + }; + + + /** + * getPostID + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var getPostID = function() { + var postID = acf.get('post_id'); + return $.isNumeric(postID) ? postID : 0; + } + + + /** + * acf.getMimeTypes + * + * description + * + * @date 11/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getMimeTypes = function(){ + return this.get('mimeTypes'); + }; + + acf.getMimeType = function( name ){ + + // vars + var allTypes = acf.getMimeTypes(); + + // search + if( allTypes[name] !== undefined ) { + return allTypes[name]; + } + + // some types contain a mixed key such as "jpg|jpeg|jpe" + for( var key in allTypes ) { + if( key.indexOf(name) !== -1 ) { + return allTypes[key]; + } + } + + // return + return false; + }; + + + /** + * MediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var MediaPopup = acf.Model.extend({ + + id: 'MediaPopup', + data: {}, + defaults: {}, + frame: false, + + setup: function( props ){ + $.extend(this.data, props); + }, + + initialize: function(){ + + // vars + var options = this.getFrameOptions(); + + // add states + this.addFrameStates( options ); + + // create frame + var frame = wp.media( options ); + + // add args reference + frame.acf = this; + + // add events + this.addFrameEvents( frame, options ); + + // strore frame + this.frame = frame; + }, + + open: function(){ + this.frame.open(); + }, + + close: function(){ + this.frame.close(); + }, + + remove: function(){ + this.frame.detach(); + this.frame.remove(); + }, + + getFrameOptions: function(){ + + // vars + var options = { + title: this.get('title'), + multiple: this.get('multiple'), + library: {}, + states: [] + }; + + // type + if( this.get('type') ) { + options.library.type = this.get('type'); + } + + // type + if( this.get('library') === 'uploadedTo' ) { + options.library.uploadedTo = getPostID(); + } + + // attachment + if( this.get('attachment') ) { + options.library.post__in = [ this.get('attachment') ]; + } + + // button + if( this.get('button') ) { + options.button = { + text: this.get('button') + }; + } + + // return + return options; + }, + + addFrameStates: function( options ){ + + // create query + var Query = wp.media.query( options.library ); + + // add _acfuploader + // this is super wack! + // if you add _acfuploader to the options.library args, new uploads will not be added to the library view. + // this has been traced back to the wp.media.model.Query initialize function (which can't be overriden) + // Adding any custom args will cause the Attahcments to not observe the uploader queue + // To bypass this security issue, we add in the args AFTER the Query has been initialized + // options.library._acfuploader = settings.field; + if( this.get('field') && acf.isset(Query, 'mirroring', 'args') ) { + Query.mirroring.args._acfuploader = this.get('field'); + } + + // add states + options.states.push( + + // main state + new wp.media.controller.Library({ + library: Query, + multiple: this.get('multiple'), + title: this.get('title'), + priority: 20, + filterable: 'all', + editable: true, + allowLocalEdits: true + }) + + ); + + // edit image functionality (added in WP 3.9) + if( acf.isset(wp, 'media', 'controller', 'EditImage') ) { + options.states.push( new wp.media.controller.EditImage() ); + } + }, + + addFrameEvents: function( frame, options ){ + + // log all events + //frame.on('all', function( e ) { + // console.log( 'frame all: %o', e ); + //}); + + // add class + frame.on('open',function() { + this.$el.closest('.media-modal').addClass('acf-media-modal -' + this.acf.get('mode') ); + }, frame); + + // edit image view + // source: media-views.js:2410 editImageContent() + frame.on('content:render:edit-image', function(){ + + var image = this.state().get('image'); + var view = new wp.media.view.EditImage({ model: image, controller: this }).render(); + this.content.set( view ); + + // after creating the wrapper view, load the actual editor via an ajax call + view.loadEditor(); + + }, frame); + + // update toolbar button + //frame.on( 'toolbar:create:select', function( toolbar ) { + // toolbar.view = new wp.media.view.Toolbar.Select({ + // text: frame.options._button, + // controller: this + // }); + //}, frame ); + + // on select + frame.on('select', function() { + + // vars + var selection = frame.state().get('selection'); + + // if selecting images + if( selection ) { + + // loop + selection.each(function( attachment, i ){ + frame.acf.get('select').apply( frame.acf, [attachment, i] ); + }); + } + }); + + // on close + frame.on('close',function(){ + + // callback and remove + setTimeout(function(){ + frame.acf.get('close').apply( frame.acf ); + frame.acf.remove(); + }, 1); + }); + } + }); + + + /** + * acf.models.SelectMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.models.SelectMediaPopup = MediaPopup.extend({ + id: 'SelectMediaPopup', + setup: function( props ){ + + // default button + if( !props.button ) { + props.button = acf._x('Select', 'verb'); + } + + // parent + MediaPopup.prototype.setup.apply(this, arguments); + }, + + addFrameEvents: function( frame, options ){ + + // plupload + // adds _acfuploader param to validate uploads + if( acf.isset(_wpPluploadSettings, 'defaults', 'multipart_params') ) { + + // add _acfuploader so that Uploader will inherit + _wpPluploadSettings.defaults.multipart_params._acfuploader = this.get('field'); + + // remove acf_field so future Uploaders won't inherit + frame.on('open', function(){ + delete _wpPluploadSettings.defaults.multipart_params._acfuploader; + }); + } + + // browse + frame.on('content:activate:browse', function(){ + + // vars + var toolbar = false; + + // populate above vars making sure to allow for failure + // perhaps toolbar does not exist because the frame open is Upload Files + try { + toolbar = frame.content.get().toolbar; + } catch(e) { + console.log(e); + return; + } + + // callback + frame.acf.customizeFilters.apply(frame.acf, [toolbar]); + }); + + // parent + MediaPopup.prototype.addFrameEvents.apply(this, arguments); + + }, + + customizeFilters: function( toolbar ){ + + // vars + var filters = toolbar.get('filters'); + + // image + if( this.get('type') == 'image' ) { + + // update all + filters.filters.all.text = acf.__('All images'); + + // remove some filters + delete filters.filters.audio; + delete filters.filters.video; + delete filters.filters.image; + + // update all filters to show images + $.each(filters.filters, function( i, filter ){ + filter.props.type = filter.props.type || 'image'; + }); + } + + // specific types + if( this.get('allowedTypes') ) { + + // convert ".jpg, .png" into ["jpg", "png"] + var allowedTypes = this.get('allowedTypes').split(' ').join('').split('.').join('').split(','); + + // loop + allowedTypes.map(function( name ){ + + // get type + var mimeType = acf.getMimeType( name ); + + // bail early if no type + if( !mimeType ) return; + + // create new filter + var newFilter = { + text: mimeType, + props: { + status: null, + type: mimeType, + uploadedTo: null, + orderby: 'date', + order: 'DESC' + }, + priority: 20 + }; + + // append + filters.filters[ mimeType ] = newFilter; + + }); + } + + + + // uploaded to post + if( this.get('library') === 'uploadedTo' ) { + + // vars + var uploadedTo = this.frame.options.library.uploadedTo; + + // remove some filters + delete filters.filters.unattached; + delete filters.filters.uploaded; + + // add uploadedTo to filters + $.each(filters.filters, function( i, filter ){ + filter.text += ' (' + acf.__('Uploaded to this post') + ')'; + filter.props.uploadedTo = uploadedTo; + }); + } + + // add _acfuploader to filters + var field = this.get('field'); + $.each(filters.filters, function( k, filter ){ + filter.props._acfuploader = field; + }); + + // add _acfuplaoder to search + var search = toolbar.get('search'); + search.model.attributes._acfuploader = field; + + // render (custom function added to prototype) + if( filters.renderFilters ) { + filters.renderFilters(); + } + } + }); + + + /** + * acf.models.EditMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.models.EditMediaPopup = MediaPopup.extend({ + id: 'SelectMediaPopup', + setup: function( props ){ + + // default button + if( !props.button ) { + props.button = acf._x('Update', 'verb'); + } + + // parent + MediaPopup.prototype.setup.apply(this, arguments); + }, + + addFrameEvents: function( frame, options ){ + + // add class + frame.on('open',function() { + + // add class + this.$el.closest('.media-modal').addClass('acf-expanded'); + + // set to browse + if( this.content.mode() != 'browse' ) { + this.content.mode('browse'); + } + + // set selection + var state = this.state(); + var selection = state.get('selection'); + var attachment = wp.media.attachment( frame.acf.get('attachment') ); + selection.add( attachment ); + + }, frame); + + // parent + MediaPopup.prototype.addFrameEvents.apply(this, arguments); + + } + }); + + + /** + * customizePrototypes + * + * description + * + * @date 11/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var customizePrototypes = new acf.Model({ + id: 'customizePrototypes', + wait: 'ready', + + initialize: function(){ + + // bail early if no media views + if( !acf.isset(window, 'wp', 'media', 'view') ) { + return; + } + + // fix bug where CPT without "editor" does not set post.id setting which then prevents uploadedTo from working + var postID = getPostID(); + if( postID && acf.isset(wp, 'media', 'view', 'settings', 'post') ) { + wp.media.view.settings.post.id = postID; + } + + // customize + this.customizeAttachmentsButton(); + this.customizeAttachmentsRouter(); + this.customizeAttachmentFilters(); + this.customizeAttachmentCompat(); + this.customizeAttachmentLibrary(); + }, + + customizeAttachmentsButton: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Button') ) { + return; + } + + // Extend + var Button = wp.media.view.Button; + wp.media.view.Button = Button.extend({ + + // Fix bug where "Select" button appears blank after editing an image. + // Do this by simplifying Button initialize function and avoid deleting this.options. + initialize: function() { + var options = _.defaults( this.options, this.defaults ); + this.model = new Backbone.Model( options ); + this.listenTo( this.model, 'change', this.render ); + } + }); + + }, + + customizeAttachmentsRouter: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Router') ) { + return; + } + + // vars + var Parent = wp.media.view.Router; + + // extend + wp.media.view.Router = Parent.extend({ + + addExpand: function(){ + + // vars + var $a = $([ + '', + '' + acf.__('Expand Details') + '', + '' + acf.__('Collapse Details') + '', + '' + ].join('')); + + // add events + $a.on('click', function( e ){ + e.preventDefault(); + var $div = $(this).closest('.media-modal'); + if( $div.hasClass('acf-expanded') ) { + $div.removeClass('acf-expanded'); + } else { + $div.addClass('acf-expanded'); + } + }); + + // append + this.$el.append( $a ); + }, + + initialize: function(){ + + // initialize + Parent.prototype.initialize.apply( this, arguments ); + + // add buttons + this.addExpand(); + + // return + return this; + } + }); + }, + + customizeAttachmentFilters: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'AttachmentFilters', 'All') ) { + return; + } + + // vars + var Parent = wp.media.view.AttachmentFilters.All; + + // renderFilters + // copied from media-views.js:6939 + Parent.prototype.renderFilters = function(){ + + // Build `' ).val( value ).html( filter.text )[0], + priority: filter.priority || 50 + }; + }, this ).sortBy('priority').pluck('el').value() ); + + }; + }, + + customizeAttachmentCompat: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'AttachmentCompat') ) { + return; + } + + // vars + var AttachmentCompat = wp.media.view.AttachmentCompat; + var timeout = false; + + // extend + wp.media.view.AttachmentCompat = AttachmentCompat.extend({ + + render: function() { + + // WP bug + // When multiple media frames exist on the same page (WP content, WYSIWYG, image, file ), + // WP creates multiple instances of this AttachmentCompat view. + // Each instance will attempt to render when a new modal is created. + // Use a property to avoid this and only render once per instance. + if( this.rendered ) { + return this; + } + + // render HTML + AttachmentCompat.prototype.render.apply( this, arguments ); + + // when uploading, render is called twice. + // ignore first render by checking for #acf-form-data element + if( !this.$('#acf-form-data').length ) { + return this; + } + + // clear timeout + clearTimeout( timeout ); + + // setTimeout + timeout = setTimeout($.proxy(function(){ + this.rendered = true; + acf.doAction('append', this.$el); + }, this), 50); + + // return + return this; + }, + + save: function( event ) { + var data = {}; + + if ( event ) { + event.preventDefault(); + } + + //_.each( this.$el.serializeArray(), function( pair ) { + // data[ pair.name ] = pair.value; + //}); + + // Serialize data more thoroughly to allow chckbox inputs to save. + data = acf.serializeForAjax(this.$el); + + this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); + this.model.saveCompat( data ).always( _.bind( this.postSave, this ) ); + } + }); + + }, + + customizeAttachmentLibrary: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Attachment', 'Library') ) { + return; + } + + // vars + var AttachmentLibrary = wp.media.view.Attachment.Library; + + // extend + wp.media.view.Attachment.Library = AttachmentLibrary.extend({ + + render: function() { + + // vars + var popup = acf.isget(this, 'controller', 'acf'); + var attributes = acf.isget(this, 'model', 'attributes'); + + // check vars exist to avoid errors + if( popup && attributes ) { + + // show errors + if( attributes.acf_errors ) { + this.$el.addClass('acf-disabled'); + } + + // disable selected + var selected = popup.get('selected'); + if( selected && selected.indexOf(attributes.id) > -1 ) { + this.$el.addClass('acf-selected'); + } + } + + // render + return AttachmentLibrary.prototype.render.apply( this, arguments ); + + }, + + + /* + * toggleSelection + * + * This function is called before an attachment is selected + * A good place to check for errors and prevent the 'select' function from being fired + * + * @type function + * @date 29/09/2016 + * @since 5.4.0 + * + * @param options (object) + * @return n/a + */ + + toggleSelection: function( options ) { + + // vars + // source: wp-includes/js/media-views.js:2880 + var collection = this.collection, + selection = this.options.selection, + model = this.model, + single = selection.single(); + + + // vars + var frame = this.controller; + var errors = acf.isget(this, 'model', 'attributes', 'acf_errors'); + var $sidebar = frame.$el.find('.media-frame-content .media-sidebar'); + + // remove previous error + $sidebar.children('.acf-selection-error').remove(); + + // show attachment details + $sidebar.children().removeClass('acf-hidden'); + + // add message + if( frame && errors ) { + + // vars + var filename = acf.isget(this, 'model', 'attributes', 'filename'); + + // hide attachment details + // Gallery field continues to show previously selected attachment... + $sidebar.children().addClass('acf-hidden'); + + // append message + $sidebar.prepend([ + '
        ', + '' + acf.__('Restricted') +'', + '' + filename + '', + '' + errors + '', + '
        ' + ].join('')); + + // reset selection (unselects all attachments) + selection.reset(); + + // set single (attachment displayed in sidebar) + selection.single( model ); + + // return and prevent 'select' form being fired + return; + + } + + // return + return AttachmentLibrary.prototype.toggleSelection.apply( this, arguments ); + } + }); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-model.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-model.js new file mode 100644 index 0000000..cd0690a --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-model.js @@ -0,0 +1,908 @@ +(function($, undefined){ + + // Cached regex to split keys for `addEvent`. + var delegateEventSplitter = /^(\S+)\s*(.*)$/; + + /** + * extend + * + * Helper function to correctly set up the prototype chain for subclasses + * Heavily inspired by backbone.js + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object protoProps New properties for this object. + * @return function. + */ + + var extend = function( protoProps ) { + + // vars + var Parent = this; + var Child; + + // The constructor function for the new subclass is either defined by you + // (the "constructor" property in your `extend` definition), or defaulted + // by us to simply call the parent constructor. + if( protoProps && protoProps.hasOwnProperty('constructor') ) { + Child = protoProps.constructor; + } else { + Child = function(){ return Parent.apply(this, arguments); }; + } + + // Add static properties to the constructor function, if supplied. + $.extend(Child, Parent); + + // Set the prototype chain to inherit from `parent`, without calling + // `parent`'s constructor function and add the prototype properties. + Child.prototype = Object.create(Parent.prototype); + $.extend(Child.prototype, protoProps); + Child.prototype.constructor = Child; + + // Set a convenience property in case the parent's prototype is needed later. + //Child.prototype.__parent__ = Parent.prototype; + + // return + return Child; + + }; + + + /** + * Model + * + * Base class for all inheritence + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object props + * @return function. + */ + + var Model = acf.Model = function(){ + + // generate uique client id + this.cid = acf.uniqueId('acf'); + + // set vars to avoid modifying prototype + this.data = $.extend(true, {}, this.data); + + // pass props to setup function + this.setup.apply(this, arguments); + + // store on element (allow this.setup to create this.$el) + if( this.$el && !this.$el.data('acf') ) { + this.$el.data('acf', this); + } + + // initialize + var initialize = function(){ + this.initialize(); + this.addEvents(); + this.addActions(); + this.addFilters(); + }; + + // initialize on action + if( this.wait && !acf.didAction(this.wait) ) { + this.addAction(this.wait, initialize); + + // initialize now + } else { + initialize.apply(this); + } + }; + + // Attach all inheritable methods to the Model prototype. + $.extend(Model.prototype, { + + // Unique model id + id: '', + + // Unique client id + cid: '', + + // jQuery element + $el: null, + + // Data specific to this instance + data: {}, + + // toggle used when changing data + busy: false, + changed: false, + + // Setup events hooks + events: {}, + actions: {}, + filters: {}, + + // class used to avoid nested event triggers + eventScope: '', + + // action to wait until initialize + wait: false, + + // action priority default + priority: 10, + + /** + * get + * + * Gets a specific data value + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @return mixed + */ + + get: function( name ) { + return this.data[name]; + }, + + /** + * has + * + * Returns `true` if the data exists and is not null + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @return boolean + */ + + has: function( name ) { + return this.get(name) != null; + }, + + /** + * set + * + * Sets a specific data value + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param mixed value + * @return this + */ + + set: function( name, value, silent ) { + + // bail if unchanged + var prevValue = this.get(name); + if( prevValue == value ) { + return this; + } + + // set data + this.data[ name ] = value; + + // trigger events + if( !silent ) { + this.changed = true; + this.trigger('changed:' + name, [value, prevValue]); + this.trigger('changed', [name, value, prevValue]); + } + + // return + return this; + }, + + /** + * inherit + * + * Inherits the data from a jQuery element + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param jQuery $el + * @return this + */ + + inherit: function( data ){ + + // allow jQuery + if( data instanceof jQuery ) { + data = data.data(); + } + + // extend + $.extend(this.data, data); + + // return + return this; + }, + + /** + * prop + * + * mimics the jQuery prop function + * + * @date 4/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + prop: function(){ + return this.$el.prop.apply(this.$el, arguments); + }, + + /** + * setup + * + * Run during constructor function + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param n/a + * @return n/a + */ + + setup: function( props ){ + $.extend(this, props); + }, + + /** + * initialize + * + * Also run during constructor function + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param n/a + * @return n/a + */ + + initialize: function(){}, + + /** + * addElements + * + * Adds multiple jQuery elements to this object + * + * @date 9/5/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + addElements: function( elements ){ + elements = elements || this.elements || null; + if( !elements || !Object.keys(elements).length ) return false; + for( var i in elements ) { + this.addElement( i, elements[i] ); + } + }, + + /** + * addElement + * + * description + * + * @date 9/5/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + addElement: function( name, selector){ + this[ '$' + name ] = this.$( selector ); + }, + + /** + * addEvents + * + * Adds multiple event handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object events {event1 : callback, event2 : callback, etc } + * @return n/a + */ + + addEvents: function( events ){ + events = events || this.events || null; + if( !events ) return false; + for( var key in events ) { + var match = key.match(delegateEventSplitter); + this.on(match[1], match[2], events[key]); + } + }, + + /** + * removeEvents + * + * Removes multiple event handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object events {event1 : callback, event2 : callback, etc } + * @return n/a + */ + + removeEvents: function( events ){ + events = events || this.events || null; + if( !events ) return false; + for( var key in events ) { + var match = key.match(delegateEventSplitter); + this.off(match[1], match[2], events[key]); + } + }, + + /** + * getEventTarget + * + * Returns a jQUery element to tigger an event on + * + * @date 5/6/18 + * @since 5.6.9 + * + * @param jQuery $el The default jQuery element. Optional. + * @param string event The event name. Optional. + * @return jQuery + */ + + getEventTarget: function( $el, event ){ + return $el || this.$el || $(document); + }, + + /** + * validateEvent + * + * Returns true if the event target's closest $el is the same as this.$el + * Requires both this.el and this.$el to be defined + * + * @date 5/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + validateEvent: function( e ){ + if( this.eventScope ) { + return $( e.target ).closest( this.eventScope ).is( this.$el ); + } else { + return true; + } + }, + + /** + * proxyEvent + * + * Returns a new event callback function scoped to this model + * + * @date 29/3/18 + * @since 5.6.9 + * + * @param function callback + * @return function + */ + + proxyEvent: function( callback ){ + return this.proxy(function(e){ + + // validate + if( !this.validateEvent(e) ) { + return; + } + + // construct args + var args = acf.arrayArgs( arguments ); + var extraArgs = args.slice(1); + var eventArgs = [ e, $(e.currentTarget) ].concat( extraArgs ); + + // callback + callback.apply(this, eventArgs); + }); + }, + + /** + * on + * + * Adds an event handler similar to jQuery + * Uses the instance 'cid' to namespace event + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + on: function( a1, a2, a3, a4 ){ + + // vars + var $el, event, selector, callback, args; + + // find args + if( a1 instanceof jQuery ) { + + // 1. args( $el, event, selector, callback ) + if( a4 ) { + $el = a1; event = a2; selector = a3; callback = a4; + + // 2. args( $el, event, callback ) + } else { + $el = a1; event = a2; callback = a3; + } + } else { + + // 3. args( event, selector, callback ) + if( a3 ) { + event = a1; selector = a2; callback = a3; + + // 4. args( event, callback ) + } else { + event = a1; callback = a2; + } + } + + // element + $el = this.getEventTarget( $el ); + + // modify callback + if( typeof callback === 'string' ) { + callback = this.proxyEvent( this[callback] ); + } + + // modify event + event = event + '.' + this.cid; + + // args + if( selector ) { + args = [ event, selector, callback ]; + } else { + args = [ event, callback ]; + } + + // on() + $el.on.apply($el, args); + }, + + /** + * off + * + * Removes an event handler similar to jQuery + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + off: function( a1, a2 ,a3 ){ + + // vars + var $el, event, selector, args; + + // find args + if( a1 instanceof jQuery ) { + + // 1. args( $el, event, selector ) + if( a3 ) { + $el = a1; event = a2; selector = a3; + + // 2. args( $el, event ) + } else { + $el = a1; event = a2; + } + } else { + + // 3. args( event, selector ) + if( a2 ) { + event = a1; selector = a2; + + // 4. args( event ) + } else { + event = a1; + } + } + + // element + $el = this.getEventTarget( $el ); + + // modify event + event = event + '.' + this.cid; + + // args + if( selector ) { + args = [ event, selector ]; + } else { + args = [ event ]; + } + + // off() + $el.off.apply($el, args); + }, + + /** + * trigger + * + * Triggers an event similar to jQuery + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + trigger: function( name, args, bubbles ){ + var $el = this.getEventTarget(); + if( bubbles ) { + $el.trigger.apply( $el, arguments ); + } else { + $el.triggerHandler.apply( $el, arguments ); + } + return this; + }, + + /** + * addActions + * + * Adds multiple action handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object actions {action1 : callback, action2 : callback, etc } + * @return n/a + */ + + addActions: function( actions ){ + actions = actions || this.actions || null; + if( !actions ) return false; + for( var i in actions ) { + this.addAction( i, actions[i] ); + } + }, + + /** + * removeActions + * + * Removes multiple action handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object actions {action1 : callback, action2 : callback, etc } + * @return n/a + */ + + removeActions: function( actions ){ + actions = actions || this.actions || null; + if( !actions ) return false; + for( var i in actions ) { + this.removeAction( i, actions[i] ); + } + }, + + /** + * addAction + * + * Adds an action using the wp.hooks library + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + addAction: function( name, callback, priority ){ + //console.log('addAction', name, priority); + // defaults + priority = priority || this.priority; + + // modify callback + if( typeof callback === 'string' ) { + callback = this[ callback ]; + } + + // add + acf.addAction(name, callback, priority, this); + + }, + + /** + * removeAction + * + * Remove an action using the wp.hooks library + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + removeAction: function( name, callback ){ + acf.removeAction(name, this[ callback ]); + }, + + /** + * addFilters + * + * Adds multiple filter handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object filters {filter1 : callback, filter2 : callback, etc } + * @return n/a + */ + + addFilters: function( filters ){ + filters = filters || this.filters || null; + if( !filters ) return false; + for( var i in filters ) { + this.addFilter( i, filters[i] ); + } + }, + + /** + * addFilter + * + * Adds a filter using the wp.hooks library + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + addFilter: function( name, callback, priority ){ + + // defaults + priority = priority || this.priority; + + // modify callback + if( typeof callback === 'string' ) { + callback = this[ callback ]; + } + + // add + acf.addFilter(name, callback, priority, this); + + }, + + /** + * removeFilters + * + * Removes multiple filter handlers + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param object filters {filter1 : callback, filter2 : callback, etc } + * @return n/a + */ + + removeFilters: function( filters ){ + filters = filters || this.filters || null; + if( !filters ) return false; + for( var i in filters ) { + this.removeFilter( i, filters[i] ); + } + }, + + /** + * removeFilter + * + * Remove a filter using the wp.hooks library + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param string callback + * @return n/a + */ + + removeFilter: function( name, callback ){ + acf.removeFilter(name, this[ callback ]); + }, + + /** + * $ + * + * description + * + * @date 16/12/17 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + $: function( selector ){ + return this.$el.find( selector ); + }, + + /** + * remove + * + * Removes the element and listenters + * + * @date 19/12/17 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + remove: function(){ + this.removeEvents(); + this.removeActions(); + this.removeFilters(); + this.$el.remove(); + }, + + /** + * setTimeout + * + * description + * + * @date 16/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + setTimeout: function( callback, milliseconds ){ + return setTimeout( this.proxy(callback), milliseconds ); + }, + + /** + * time + * + * used for debugging + * + * @date 7/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + time: function(){ + console.time( this.id || this.cid ); + }, + + /** + * timeEnd + * + * used for debugging + * + * @date 7/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + timeEnd: function(){ + console.timeEnd( this.id || this.cid ); + }, + + /** + * show + * + * description + * + * @date 15/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + show: function(){ + acf.show( this.$el ); + }, + + + /** + * hide + * + * description + * + * @date 15/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + hide: function(){ + acf.hide( this.$el ); + }, + + /** + * proxy + * + * Returns a new function scoped to this model + * + * @date 29/3/18 + * @since 5.6.9 + * + * @param function callback + * @return function + */ + + proxy: function( callback ){ + return $.proxy( callback, this ); + } + + + }); + + // Set up inheritance for the model + Model.extend = extend; + + // Global model storage + acf.models = {}; + + /** + * acf.getInstance + * + * This function will get an instance from an element + * + * @date 5/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getInstance = function( $el ){ + return $el.data('acf'); + }; + + /** + * acf.getInstances + * + * This function will get an array of instances from multiple elements + * + * @date 5/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getInstances = function( $el ){ + var instances = []; + $el.each(function(){ + instances.push( acf.getInstance( $(this) ) ); + }); + return instances; + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-notice.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-notice.js new file mode 100644 index 0000000..ea2de79 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-notice.js @@ -0,0 +1,146 @@ +(function($, undefined){ + + var Notice = acf.Model.extend({ + + data: { + text: '', + type: '', + timeout: 0, + dismiss: true, + target: false, + close: function(){} + }, + + events: { + 'click .acf-notice-dismiss': 'onClickClose', + }, + + tmpl: function(){ + return '
        '; + }, + + setup: function( props ){ + $.extend(this.data, props); + this.$el = $(this.tmpl()); + }, + + initialize: function(){ + + // render + this.render(); + + // show + this.show(); + }, + + render: function(){ + + // class + this.type( this.get('type') ); + + // text + this.html( '

        ' + this.get('text') + '

        ' ); + + // close + if( this.get('dismiss') ) { + this.$el.append(''); + this.$el.addClass('-dismiss'); + } + + // timeout + var timeout = this.get('timeout'); + if( timeout ) { + this.away( timeout ); + } + }, + + update: function( props ){ + + // update + $.extend(this.data, props); + + // re-initialize + this.initialize(); + + // refresh events + this.removeEvents(); + this.addEvents(); + }, + + show: function(){ + var $target = this.get('target'); + if( $target ) { + $target.prepend( this.$el ); + } + }, + + hide: function(){ + this.$el.remove(); + }, + + away: function( timeout ){ + this.setTimeout(function(){ + acf.remove( this.$el ); + }, timeout ); + }, + + type: function( type ){ + + // remove prev type + var prevType = this.get('type'); + if( prevType ) { + this.$el.removeClass('-' + prevType); + } + + // add new type + this.$el.addClass('-' + type); + + // backwards compatibility + if( type == 'error' ) { + this.$el.addClass('acf-error-message'); + } + }, + + html: function( html ){ + this.$el.html( html ); + }, + + text: function( text ){ + this.$('p').html( text ); + }, + + onClickClose: function( e, $el ){ + e.preventDefault(); + this.get('close').apply(this, arguments); + this.remove(); + } + }); + + acf.newNotice = function( props ){ + + // ensure object + if( typeof props !== 'object' ) { + props = { text: props }; + } + + // instantiate + return new Notice( props ); + }; + + var noticeManager = new acf.Model({ + wait: 'prepare', + priority: 1, + initialize: function(){ + + // vars + var $notice = $('.acf-admin-notice'); + + // move to avoid WP flicker + if( $notice.length ) { + $('h1:first').after( $notice ); + } + } + }); + + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-panel.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-panel.js new file mode 100644 index 0000000..8584eca --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-panel.js @@ -0,0 +1,34 @@ +(function($, undefined){ + + var panel = new acf.Model({ + + events: { + 'click .acf-panel-title': 'onClick', + }, + + onClick: function( e, $el ){ + e.preventDefault(); + this.toggle( $el.parent() ); + }, + + isOpen: function( $el ) { + return $el.hasClass('-open'); + }, + + toggle: function( $el ){ + this.isOpen($el) ? this.close( $el ) : this.open( $el ); + }, + + open: function( $el ){ + $el.addClass('-open'); + $el.find('.acf-panel-title i').attr('class', 'dashicons dashicons-arrow-down'); + }, + + close: function( $el ){ + $el.removeClass('-open'); + $el.find('.acf-panel-title i').attr('class', 'dashicons dashicons-arrow-right'); + } + + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-popup.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-popup.js new file mode 100644 index 0000000..e0d807e --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-popup.js @@ -0,0 +1,121 @@ +(function($, undefined){ + + acf.models.Popup = acf.Model.extend({ + + data: { + title: '', + content: '', + width: 0, + height: 0, + loading: false, + }, + + events: { + 'click [data-event="close"]': 'onClickClose', + 'click .acf-close-popup': 'onClickClose', + }, + + setup: function( props ){ + $.extend(this.data, props); + this.$el = $(this.tmpl()); + }, + + initialize: function(){ + this.render(); + this.open(); + }, + + tmpl: function(){ + return [ + '
        ', + '
        ', + '

        ', + '
        ', + '
        ', + '
        ', + '
        ', + '
        ' + ].join(''); + }, + + render: function(){ + + // vars + var title = this.get('title'); + var content = this.get('content'); + var loading = this.get('loading'); + var width = this.get('width'); + var height = this.get('height'); + + // html + this.title( title ); + this.content( content ); + + // width + if( width ) { + this.$('.acf-popup-box').css('width', width); + } + + // height + if( height ) { + this.$('.acf-popup-box').css('min-height', height); + } + + // loading + this.loading( loading ); + + // action + acf.doAction('append', this.$el); + + }, + + update: function( props ){ + this.data = acf.parseArgs(props, this.data); + this.render(); + }, + + title: function( title ){ + this.$('.title:first h3').html( title ); + }, + + content: function( content ){ + this.$('.inner:first').html( content ); + }, + + loading: function( show ){ + var $loading = this.$('.loading:first'); + show ? $loading.show() : $loading.hide(); + }, + + open: function(){ + $('body').append( this.$el ); + }, + + close: function(){ + this.remove(); + }, + + onClickClose: function( e, $el ){ + e.preventDefault(); + this.close(); + } + + }); + + /** + * newPopup + * + * Creates a new Popup with the supplied props + * + * @date 17/12/17 + * @since 5.6.5 + * + * @param object props + * @return object + */ + + acf.newPopup = function( props ){ + return new acf.models.Popup( props ); + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-postbox.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-postbox.js new file mode 100644 index 0000000..4870390 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-postbox.js @@ -0,0 +1,212 @@ +(function($, undefined){ + + /** + * postboxManager + * + * Manages postboxes on the screen. + * + * @date 25/5/19 + * @since 5.8.1 + * + * @param void + * @return void + */ + var postboxManager = new acf.Model({ + wait: 'prepare', + priority: 1, + initialize: function(){ + (acf.get('postboxes') || []).map( acf.newPostbox ); + }, + }); + + /** + * acf.getPostbox + * + * Returns a postbox instance. + * + * @date 23/9/18 + * @since 5.7.7 + * + * @param mixed $el Either a jQuery element or the postbox id. + * @return object + */ + acf.getPostbox = function( $el ){ + + // allow string parameter + if( typeof arguments[0] == 'string' ) { + $el = $('#' + arguments[0]); + } + + // return instance + return acf.getInstance( $el ); + }; + + /** + * acf.getPostboxes + * + * Returns an array of postbox instances. + * + * @date 23/9/18 + * @since 5.7.7 + * + * @param void + * @return array + */ + acf.getPostboxes = function(){ + return acf.getInstances( $('.acf-postbox') ); + }; + + /** + * acf.newPostbox + * + * Returns a new postbox instance for the given props. + * + * @date 20/9/18 + * @since 5.7.6 + * + * @param object props The postbox properties. + * @return object + */ + acf.newPostbox = function( props ){ + return new acf.models.Postbox( props ); + }; + + /** + * acf.models.Postbox + * + * The postbox model. + * + * @date 20/9/18 + * @since 5.7.6 + * + * @param void + * @return void + */ + acf.models.Postbox = acf.Model.extend({ + + data: { + id: '', + key: '', + style: 'default', + label: 'top', + edit: '' + }, + + setup: function( props ){ + + // compatibilty + if( props.editLink ) { + props.edit = props.editLink; + } + + // extend data + $.extend(this.data, props); + + // set $el + this.$el = this.$postbox(); + }, + + $postbox: function(){ + return $('#' + this.get('id')); + }, + + $hide: function(){ + return $('#' + this.get('id') + '-hide'); + }, + + $hideLabel: function(){ + return this.$hide().parent(); + }, + + $hndle: function(){ + return this.$('> .hndle'); + }, + + $inside: function(){ + return this.$('> .inside'); + }, + + isVisible: function(){ + return this.$el.hasClass('acf-hidden'); + }, + + initialize: function(){ + + // Add default class. + this.$el.addClass('acf-postbox'); + + // Remove 'hide-if-js class. + // This class is added by WP to postboxes that are hidden via the "Screen Options" tab. + this.$el.removeClass('hide-if-js'); + + // Add field group style class (ignore in block editor). + if( acf.get('editor') !== 'block' ) { + var style = this.get('style'); + if( style !== 'default' ) { + this.$el.addClass( style ); + } + } + + // Add .inside class. + this.$inside().addClass('acf-fields').addClass('-' + this.get('label')); + + // Append edit link. + var edit = this.get('edit'); + if( edit ) { + this.$hndle().append(''); + } + + // Show postbox. + this.show(); + }, + + show: function(){ + + // Show label. + this.$hideLabel().show(); + + // toggle on checkbox + this.$hide().prop('checked', true); + + // Show postbox + this.$el.show().removeClass('acf-hidden'); + }, + + enable: function(){ + acf.enable( this.$el, 'postbox' ); + }, + + showEnable: function(){ + this.show(); + this.enable(); + }, + + hide: function(){ + + // Hide label. + this.$hideLabel().hide(); + + // Hide postbox + this.$el.hide().addClass('acf-hidden'); + }, + + disable: function(){ + acf.disable( this.$el, 'postbox' ); + }, + + hideDisable: function(){ + this.hide(); + this.disable(); + }, + + html: function( html ){ + + // Update HTML. + this.$inside().html( html ); + + // Do action. + acf.doAction('append', this.$el); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-screen.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-screen.js new file mode 100644 index 0000000..0b1a857 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-screen.js @@ -0,0 +1,593 @@ +(function($, undefined){ + + acf.screen = new acf.Model({ + + active: true, + + xhr: false, + + timeout: false, + + wait: 'load', + + events: { + 'change #page_template': 'onChange', + 'change #parent_id': 'onChange', + 'change #post-formats-select': 'onChange', + 'change .categorychecklist': 'onChange', + 'change .tagsdiv': 'onChange', + 'change .acf-taxonomy-field[data-save="1"]': 'onChange', + 'change #product-type': 'onChange' + }, + + isPost: function(){ + return acf.get('screen') === 'post'; + }, + + isUser: function(){ + return acf.get('screen') === 'user'; + }, + + isTaxonomy: function(){ + return acf.get('screen') === 'taxonomy'; + }, + + isAttachment: function(){ + return acf.get('screen') === 'attachment'; + }, + + isNavMenu: function(){ + return acf.get('screen') === 'nav_menu'; + }, + + isWidget: function(){ + return acf.get('screen') === 'widget'; + }, + + isComment: function(){ + return acf.get('screen') === 'comment'; + }, + + getPageTemplate: function(){ + var $el = $('#page_template'); + return $el.length ? $el.val() : null; + }, + + getPageParent: function( e, $el ){ + var $el = $('#parent_id'); + return $el.length ? $el.val() : null; + }, + + getPageType: function( e, $el ){ + return this.getPageParent() ? 'child' : 'parent'; + }, + + getPostType: function(){ + return $('#post_type').val(); + }, + + getPostFormat: function( e, $el ){ + var $el = $('#post-formats-select input:checked'); + if( $el.length ) { + var val = $el.val(); + return (val == '0') ? 'standard' : val; + } + return null; + }, + + getPostCoreTerms: function(){ + + // vars + var terms = {}; + + // serialize WP taxonomy postboxes + var data = acf.serialize( $('.categorydiv, .tagsdiv') ); + + // use tax_input (tag, custom-taxonomy) when possible. + // this data is already formatted in taxonomy => [terms]. + if( data.tax_input ) { + terms = data.tax_input; + } + + // append "category" which uses a different name + if( data.post_category ) { + terms.category = data.post_category; + } + + // convert any string values (tags) into array format + for( var tax in terms ) { + if( !acf.isArray(terms[tax]) ) { + terms[tax] = terms[tax].split(/,[\s]?/); + } + } + + // return + return terms; + }, + + getPostTerms: function(){ + + // Get core terms. + var terms = this.getPostCoreTerms(); + + // loop over taxonomy fields and add their values + acf.getFields({type: 'taxonomy'}).map(function( field ){ + + // ignore fields that don't save + if( !field.get('save') ) { + return; + } + + // vars + var val = field.val(); + var tax = field.get('taxonomy'); + + // check val + if( val ) { + + // ensure terms exists + terms[ tax ] = terms[ tax ] || []; + + // ensure val is an array + val = acf.isArray(val) ? val : [val]; + + // append + terms[ tax ] = terms[ tax ].concat( val ); + } + }); + + // add WC product type + if( (productType = this.getProductType()) !== null ) { + terms.product_type = [productType]; + } + + // remove duplicate values + for( var tax in terms ) { + terms[tax] = acf.uniqueArray(terms[tax]); + } + + // return + return terms; + }, + + getProductType: function(){ + var $el = $('#product-type'); + return $el.length ? $el.val() : null; + }, + + check: function(){ + + // bail early if not for post + if( acf.get('screen') !== 'post' ) { + return; + } + + // abort XHR if is already loading AJAX data + if( this.xhr ) { + this.xhr.abort(); + } + + // vars + var ajaxData = acf.parseArgs(this.data, { + action: 'acf/ajax/check_screen', + screen: acf.get('screen'), + exists: [] + }); + + // post id + if( this.isPost() ) { + ajaxData.post_id = acf.get('post_id'); + } + + // post type + if( (postType = this.getPostType()) !== null ) { + ajaxData.post_type = postType; + } + + // page template + if( (pageTemplate = this.getPageTemplate()) !== null ) { + ajaxData.page_template = pageTemplate; + } + + // page parent + if( (pageParent = this.getPageParent()) !== null ) { + ajaxData.page_parent = pageParent; + } + + // page type + if( (pageType = this.getPageType()) !== null ) { + ajaxData.page_type = pageType; + } + + // post format + if( (postFormat = this.getPostFormat()) !== null ) { + ajaxData.post_format = postFormat; + } + + // post terms + if( (postTerms = this.getPostTerms()) !== null ) { + ajaxData.post_terms = postTerms; + } + + // add array of existing postboxes to increase performance and reduce JSON HTML + acf.getPostboxes().map(function( postbox ){ + ajaxData.exists.push( postbox.get('key') ); + }); + + // filter + ajaxData = acf.applyFilters('check_screen_args', ajaxData); + + // success + var onSuccess = function( json ){ + + // Check success. + if( acf.isAjaxSuccess(json) ) { + + // Render post screen. + if( acf.get('screen') == 'post' ) { + this.renderPostScreen( json.data ); + + // Render user screen. + } else if( acf.get('screen') == 'user' ) { + this.renderUserScreen( json.data ); + } + } + + // action + acf.doAction('check_screen_complete', json.data, ajaxData); + }; + + // ajax + this.xhr = $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax( ajaxData ), + type: 'post', + dataType: 'json', + context: this, + success: onSuccess + }); + }, + + onChange: function( e, $el ){ + this.setTimeout(this.check, 1); + }, + + renderPostScreen: function( data ){ + + // vars + var visible = []; + + // Helper function to copy events + var copyEvents = function( $from, $to ){ + var events = $._data($from[0]).events; + for( var type in events ) { + for( var i = 0; i < events[type].length; i++ ) { + $to.on( type, events[type][i].handler ); + } + } + } + + // Helper function to sort metabox. + var sortMetabox = function( id, ids ){ + + // Find position of id within ids. + var index = ids.indexOf( id ); + + // Bail early if index not found. + if( index == -1 ) { + return false; + } + + // Loop over metaboxes behind (in reverse order). + for( var i = index-1; i >= 0; i-- ) { + if( $('#'+ids[i]).length ) { + return $('#'+ids[i]).after( $('#'+id) ); + } + } + + // Loop over metaboxes infront. + for( var i = index+1; i < ids.length; i++ ) { + if( $('#'+ids[i]).length ) { + return $('#'+ids[i]).before( $('#'+id) ); + } + } + + // Return false if not sorted. + return false; + }; + + // Show these postboxes. + data.results.map(function( result, i ){ + + // vars + var postbox = acf.getPostbox( result.id ); + + // Create postbox if doesn't exist. + if( !postbox ) { + + // Create it. + var $postbox = $([ + '
        ', + '', + '

        ', + '' + result.title + '', + '

        ', + '
        ', + result.html, + '
        ', + '
        ' + ].join('')); + + // Create new hide toggle. + if( $('#adv-settings').length ) { + var $prefs = $('#adv-settings .metabox-prefs'); + var $label = $([ + '' + ].join('')); + + // Copy default WP events onto checkbox. + copyEvents( $prefs.find('input').first(), $label.find('input') ); + + // Append hide label + $prefs.append( $label ); + } + + // Append metabox to the bottom of "side-sortables". + if( result.position === 'side' ) { + $('#' + result.position + '-sortables').append( $postbox ); + + // Prepend metabox to the top of "normal-sortbables". + } else { + $('#' + result.position + '-sortables').prepend( $postbox ); + } + + // Position metabox amongst existing ACF metaboxes within the same location. + var order = []; + data.results.map(function( _result ){ + if( result.position === _result.position && $('#' + result.position + '-sortables #' + _result.id).length ) { + order.push( _result.id ); + } + }); + sortMetabox(result.id, order) + + // Check 'sorted' for user preference. + if( data.sorted ) { + + // Loop over each position (acf_after_title, side, normal). + for( var position in data.sorted ) { + + // Explode string into array of ids. + var order = data.sorted[position].split(','); + + // Position metabox relative to order. + if( sortMetabox(result.id, order) ) { + break; + } + } + } + + // Copy default WP events onto metabox. + var $submitdiv = $('#submitdiv'); + if( $('#submitdiv').length ) { + copyEvents( $submitdiv.children('.handlediv'), $postbox.children('.handlediv') ); + copyEvents( $submitdiv.children('.hndle'), $postbox.children('.hndle') ); + } + + // Initalize it (modifies HTML). + postbox = acf.newPostbox( result ); + + // Trigger action. + acf.doAction('append', $postbox); + acf.doAction('append_postbox', postbox); + } + + // show postbox + postbox.showEnable(); + + // Do action. + acf.doAction('show_postbox', postbox); + + // append + visible.push( result.id ); + }); + + // Hide these postboxes. + acf.getPostboxes().map(function( postbox ){ + if( visible.indexOf( postbox.get('id') ) === -1 ) { + postbox.hideDisable(); + + // Do action. + acf.doAction('hide_postbox', postbox); + } + }); + + // Update style. + $('#acf-style').html( data.style ); + }, + + renderUserScreen: function( json ){ + + } + }); + + /** + * gutenScreen + * + * Adds compatibility with the Gutenberg edit screen. + * + * @date 11/12/18 + * @since 5.8.0 + * + * @param void + * @return void + */ + var gutenScreen = new acf.Model({ + + // Wait until load to avoid 'core' issues when loading taxonomies. + wait: 'load', + + initialize: function(){ + + // Bail early if not Gutenberg. + if( !acf.isGutenberg() ) { + return; + } + + // Listen for changes. + wp.data.subscribe(this.proxy(this.onChange)); + + // Customize "acf.screen.get" functions. + acf.screen.getPageTemplate = this.getPageTemplate; + acf.screen.getPageParent = this.getPageParent; + acf.screen.getPostType = this.getPostType; + acf.screen.getPostFormat = this.getPostFormat; + acf.screen.getPostCoreTerms = this.getPostCoreTerms; + + // Disable unload + acf.unload.disable(); + + // Add actions. + //this.addAction( 'append_postbox', acf.screen.refreshAvailableMetaBoxesPerLocation ); + }, + + onChange: function(){ + + // Get edits. + var edits = wp.data.select( 'core/editor' ).getPostEdits(); + + // Check specific attributes. + var attributes = [ + 'template', + 'parent', + 'format' + ]; + + // Append taxonomy attributes. + var taxonomies = wp.data.select( 'core' ).getTaxonomies() || []; + taxonomies.map(function( taxonomy ){ + attributes.push( taxonomy.rest_base ); + }); + + // Filter out attributes that have not changed. + attributes = attributes.filter(this.proxy(function( attr ){ + return ( edits[attr] !== undefined && edits[attr] !== this.get(attr) ); + })); + + // Trigger change if has attributes. + if( attributes.length ) { + this.triggerChange( edits ) + } + }, + + triggerChange: function( edits ){ + + // Update this.data if edits are provided. + if( edits !== undefined ) { + this.data = edits; + } + + // Check screen. + acf.screen.check(); + }, + + getPageTemplate: function(){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'template' ); + }, + + getPageParent: function( e, $el ){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'parent' ); + }, + + getPostType: function(){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'type' ); + }, + + getPostFormat: function( e, $el ){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'format' ); + }, + + getPostCoreTerms: function(){ + + // vars + var terms = {}; + + // Loop over taxonomies. + var taxonomies = wp.data.select( 'core' ).getTaxonomies() || []; + taxonomies.map(function( taxonomy ){ + + // Append selected taxonomies to terms object. + var postTerms = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomy.rest_base ); + if( postTerms ) { + terms[ taxonomy.slug ] = postTerms; + } + }); + + // return + return terms; + } + }); + + /** + * acf.screen.refreshAvailableMetaBoxesPerLocation + * + * Refreshes the WP data state based on metaboxes found in the DOM. + * + * Caution. Not safe to use. + * Causes duplicate dispatch listeners when saving post resulting in duplicate postmeta. + * + * @date 6/3/19 + * @since 5.7.13 + * + * @param void + * @return void + */ + acf.screen.refreshAvailableMetaBoxesPerLocation = function() { + + // Extract vars. + var select = wp.data.select( 'core/edit-post' ); + var dispatch = wp.data.dispatch( 'core/edit-post' ); + + // Load current metabox locations and data. + var data = {}; + select.getActiveMetaBoxLocations().map(function( location ){ + data[ location ] = select.getMetaBoxesPerLocation( location ); + }); + + // Generate flat array of existing ids. + var ids = []; + for( var k in data ) { + ids = ids.concat( data[k].map(function(m){ return m.id; }) ); + } + + // Append ACF metaboxes. + acf.getPostboxes().map(function( postbox ){ + + // Ignore if already exists in data. + if( ids.indexOf( postbox.get('id') ) !== -1 ) { + return; + } + + // Get metabox location looking at parent form. + var location = postbox.$el.closest('form').attr('class').replace('metabox-location-', ''); + + // Ensure location exists. + data[ location ] = data[ location ] || []; + + // Append. + data[ location ].push({ + id: postbox.get('id'), + title: postbox.get('title') + }); + }); + + // Update state. + dispatch.setAvailableMetaBoxesPerLocation(data); + }; + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-select2.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-select2.js new file mode 100644 index 0000000..87e640f --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-select2.js @@ -0,0 +1,793 @@ +(function($, undefined){ + + /** + * acf.newSelect2 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newSelect2 = function( $select, props ){ + + // defaults + props = acf.parseArgs(props, { + allowNull: false, + placeholder: '', + multiple: false, + field: false, + ajax: false, + ajaxAction: '', + ajaxData: function( data ){ return data; }, + ajaxResults: function( json ){ return json; }, + }); + + // initialize + if( getVersion() == 4 ) { + var select2 = new Select2_4( $select, props ); + } else { + var select2 = new Select2_3( $select, props ); + } + + // actions + acf.doAction('new_select2', select2); + + // return + return select2; + }; + + /** + * getVersion + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + function getVersion() { + + // v4 + if( acf.isset(window, 'jQuery', 'fn', 'select2', 'amd') ) { + return 4; + } + + // v3 + if( acf.isset(window, 'Select2') ) { + return 3; + } + + // return + return false; + } + + /** + * Select2 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2 = acf.Model.extend({ + + setup: function( $select, props ){ + $.extend(this.data, props); + this.$el = $select; + }, + + initialize: function(){ + + }, + + selectOption: function( value ){ + var $option = this.getOption( value ); + if( !$option.prop('selected') ) { + $option.prop('selected', true).trigger('change'); + } + }, + + unselectOption: function( value ){ + var $option = this.getOption( value ); + if( $option.prop('selected') ) { + $option.prop('selected', false).trigger('change'); + } + }, + + getOption: function( value ){ + return this.$('option[value="' + value + '"]'); + }, + + addOption: function( option ){ + + // defaults + option = acf.parseArgs(option, { + id: '', + text: '', + selected: false + }); + + // vars + var $option = this.getOption( option.id ); + + // append + if( !$option.length ) { + $option = $(''); + $option.html( option.text ); + $option.attr('value', option.id); + $option.prop('selected', option.selected); + this.$el.append($option); + } + + // chain + return $option; + }, + + getValue: function(){ + + // vars + var val = []; + var $options = this.$el.find('option:selected'); + + // bail early if no selected + if( !$options.exists() ) { + return val; + } + + // sort by attribute + $options = $options.sort(function(a, b) { + return +a.getAttribute('data-i') - +b.getAttribute('data-i'); + }); + + // loop + $options.each(function(){ + var $el = $(this); + val.push({ + $el: $el, + id: $el.attr('value'), + text: $el.text(), + }); + }); + + // return + return val; + + }, + + mergeOptions: function(){ + + }, + + getChoices: function(){ + + // callback + var crawl = function( $parent ){ + + // vars + var choices = []; + + // loop + $parent.children().each(function(){ + + // vars + var $child = $(this); + + // optgroup + if( $child.is('optgroup') ) { + + choices.push({ + text: $child.attr('label'), + children: crawl( $child ) + }); + + // option + } else { + + choices.push({ + id: $child.attr('value'), + text: $child.text() + }); + } + }); + + // return + return choices; + }; + + // crawl + return crawl( this.$el ); + }, + + decodeChoices: function( choices ){ + + // callback + var crawl = function( items ){ + items.map(function( item ){ + item.text = acf.decode( item.text ); + if( item.children ) { + item.children = crawl( item.children ); + } + return item; + }); + return items; + }; + + // crawl + return crawl( choices ); + }, + + getAjaxData: function( params ){ + + // vars + var ajaxData = { + action: this.get('ajaxAction'), + s: params.term || '', + paged: params.page || 1 + }; + + // field helper + var field = this.get('field'); + if( field ) { + ajaxData.field_key = field.get('key'); + } + + // callback + var callback = this.get('ajaxData'); + if( callback ) { + ajaxData = callback.apply( this, [ajaxData, params] ); + } + + // filter + ajaxData = acf.applyFilters( 'select2_ajax_data', ajaxData, this.data, this.$el, (field || false), this ); + + // return + return acf.prepareForAjax(ajaxData); + }, + + getAjaxResults: function( json, params ){ + + // defaults + json = acf.parseArgs(json, { + results: false, + more: false, + }); + + // decode + if( json.results ) { + json.results = this.decodeChoices(json.results); + } + + // callback + var callback = this.get('ajaxResults'); + if( callback ) { + json = callback.apply( this, [json, params] ); + } + + // filter + json = acf.applyFilters( 'select2_ajax_results', json, params, this ); + + // return + return json; + }, + + processAjaxResults: function( json, params ){ + + // vars + var json = this.getAjaxResults( json, params ); + + // change more to pagination + if( json.more ) { + json.pagination = { more: true }; + } + + // merge together groups + setTimeout($.proxy(this.mergeOptions, this), 1); + + // return + return json; + }, + + destroy: function(){ + + // destroy via api + if( this.$el.data('select2') ) { + this.$el.select2('destroy'); + } + + // destory via HTML (duplicating HTML does not contain data) + this.$el.siblings('.select2-container').remove(); + } + + }); + + + /** + * Select2_4 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2_4 = Select2.extend({ + + initialize: function(){ + + // vars + var $select = this.$el; + var options = { + width: '100%', + allowClear: this.get('allowNull'), + placeholder: this.get('placeholder'), + multiple: this.get('multiple'), + data: [], + escapeMarkup: function( m ){ return m; } + }; + + // multiple + if( options.multiple ) { + + // reorder options + this.getValue().map(function( item ){ + item.$el.detach().appendTo( $select ); + }); + } + + // remove conflicting atts + $select.removeData('ajax'); + $select.removeAttr('data-ajax'); + + // ajax + if( this.get('ajax') ) { + + options.ajax = { + url: acf.get('ajaxurl'), + delay: 250, + dataType: 'json', + type: 'post', + cache: false, + data: $.proxy(this.getAjaxData, this), + processResults: $.proxy(this.processAjaxResults, this), + }; + } + + // filter for 3rd party customization + //options = acf.applyFilters( 'select2_args', options, $select, this ); + var field = this.get('field'); + options = acf.applyFilters( 'select2_args', options, $select, this.data, (field || false), this ); + + // add select2 + $select.select2( options ); + + // get container (Select2 v4 does not return this from constructor) + var $container = $select.next('.select2-container'); + + // multiple + if( options.multiple ) { + + // vars + var $ul = $container.find('ul'); + + // sortable + $ul.sortable({ + stop: function( e ) { + + // loop + $ul.find('.select2-selection__choice').each(function() { + + // vars + var $option = $( $(this).data('data').element ); + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // trigger change on input (JS error if trigger on select) + $select.trigger('change'); + } + }); + + // on select, move to end + $select.on('select2:select', this.proxy(function( e ){ + this.getOption( e.params.data.id ).detach().appendTo( this.$el ); + })); + } + + // add class + $container.addClass('-acf'); + + // action for 3rd party customization + acf.doAction('select2_init', $select, options, this.data, (field || false), this); + }, + + mergeOptions: function(){ + + // vars + var $prevOptions = false; + var $prevGroup = false; + + // loop + $('.select2-results__option[role="group"]').each(function(){ + + // vars + var $options = $(this).children('ul'); + var $group = $(this).children('strong'); + + // compare to previous + if( $prevGroup && $prevGroup.text() === $group.text() ) { + $prevOptions.append( $options.children() ); + $(this).remove(); + return; + } + + // update vars + $prevOptions = $options; + $prevGroup = $group; + + }); + }, + + }); + + /** + * Select2_3 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2_3 = Select2.extend({ + + initialize: function(){ + + // vars + var $select = this.$el; + var value = this.getValue(); + var multiple = this.get('multiple'); + var options = { + width: '100%', + allowClear: this.get('allowNull'), + placeholder: this.get('placeholder'), + separator: '||', + multiple: this.get('multiple'), + data: this.getChoices(), + escapeMarkup: function( m ){ return m; }, + dropdownCss: { + 'z-index': '999999999' + }, + initSelection: function( element, callback ) { + if( multiple ) { + callback( value ); + } else { + callback( value.shift() ); + } + } + }; + + // get hidden input + var $input = $select.siblings('input'); + if( !$input.length ) { + $input = $(''); + $select.before( $input ); + } + + // set input value + inputValue = value.map(function(item){ return item.id }).join('||'); + $input.val( inputValue ); + + // multiple + if( options.multiple ) { + + // reorder options + value.map(function( item ){ + item.$el.detach().appendTo( $select ); + }); + } + + // remove blank option as we have a clear all button + if( options.allowClear ) { + options.data = options.data.filter(function(item){ + return item.id !== ''; + }); + } + + // remove conflicting atts + $select.removeData('ajax'); + $select.removeAttr('data-ajax'); + + // ajax + if( this.get('ajax') ) { + + options.ajax = { + url: acf.get('ajaxurl'), + quietMillis: 250, + dataType: 'json', + type: 'post', + cache: false, + data: $.proxy(this.getAjaxData, this), + results: $.proxy(this.processAjaxResults, this), + }; + } + + // filter for 3rd party customization + var field = this.get('field'); + options = acf.applyFilters( 'select2_args', options, $select, this.data, (field || false), this ); + + // add select2 + $input.select2( options ); + + // get container + var $container = $input.select2('container'); + + // helper to find this select's option + var getOption = $.proxy(this.getOption, this); + + // multiple + if( options.multiple ) { + + // vars + var $ul = $container.find('ul'); + + // sortable + $ul.sortable({ + stop: function() { + + // loop + $ul.find('.select2-search-choice').each(function() { + + // vars + var data = $(this).data('select2Data'); + var $option = getOption( data.id ); + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // trigger change on input (JS error if trigger on select) + $select.trigger('change'); + } + }); + } + + // on select, create option and move to end + $input.on('select2-selecting', function( e ){ + + // vars + var item = e.choice; + var $option = getOption( item.id ); + + // create if doesn't exist + if( !$option.length ) { + $option = $(''); + } + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // add class + $container.addClass('-acf'); + + // action for 3rd party customization + acf.doAction('select2_init', $select, options, this.data, (field || false), this); + + // change + $input.on('change', function(){ + var val = $input.val(); + if( val.indexOf('||') ) { + val = val.split('||'); + } + $select.val( val ).trigger('change'); + }); + + // hide select + $select.hide(); + }, + + mergeOptions: function(){ + + // vars + var $prevOptions = false; + var $prevGroup = false; + + // loop + $('#select2-drop .select2-result-with-children').each(function(){ + + // vars + var $options = $(this).children('ul'); + var $group = $(this).children('.select2-result-label'); + + // compare to previous + if( $prevGroup && $prevGroup.text() === $group.text() ) { + $prevGroup.append( $options.children() ); + $(this).remove(); + return; + } + + // update vars + $prevOptions = $options; + $prevGroup = $group; + + }); + + }, + + getAjaxData: function( term, page ){ + + // create Select2 v4 params + var params = { + term: term, + page: page + } + + // return + return Select2.prototype.getAjaxData.apply(this, [params]); + }, + + }); + + + // manager + var select2Manager = new acf.Model({ + priority: 5, + wait: 'prepare', + initialize: function(){ + + // vars + var locale = acf.get('locale'); + var rtl = acf.get('rtl'); + var l10n = acf.get('select2L10n'); + var version = getVersion(); + + // bail ealry if no l10n + if( !l10n ) { + return false; + } + + // bail early if 'en' + if( locale.indexOf('en') === 0 ) { + return false; + } + + // initialize + if( version == 4 ) { + this.addTranslations4(); + } else if( version == 3 ) { + this.addTranslations3(); + } + }, + + addTranslations4: function(){ + + // vars + var l10n = acf.get('select2L10n'); + var locale = acf.get('locale'); + + // modify local to match html[lang] attribute (used by Select2) + locale = locale.replace('_', '-'); + + // select2L10n + var select2L10n = { + errorLoading: function () { + return l10n.load_fail; + }, + inputTooLong: function (args) { + var overChars = args.input.length - args.maximum; + if( overChars > 1 ) { + return l10n.input_too_long_n.replace( '%d', overChars ); + } + return l10n.input_too_long_1; + }, + inputTooShort: function( args ){ + var remainingChars = args.minimum - args.input.length; + if( remainingChars > 1 ) { + return l10n.input_too_short_n.replace( '%d', remainingChars ); + } + return l10n.input_too_short_1; + }, + loadingMore: function () { + return l10n.load_more; + }, + maximumSelected: function( args ) { + var maximum = args.maximum; + if( maximum > 1 ) { + return l10n.selection_too_long_n.replace( '%d', maximum ); + } + return l10n.selection_too_long_1; + }, + noResults: function () { + return l10n.matches_0; + }, + searching: function () { + return l10n.searching; + } + }; + + // append + jQuery.fn.select2.amd.define('select2/i18n/' + locale, [], function(){ + return select2L10n; + }); + }, + + addTranslations3: function(){ + + // vars + var l10n = acf.get('select2L10n'); + var locale = acf.get('locale'); + + // modify local to match html[lang] attribute (used by Select2) + locale = locale.replace('_', '-'); + + // select2L10n + var select2L10n = { + formatMatches: function( matches ) { + if( matches > 1 ) { + return l10n.matches_n.replace( '%d', matches ); + } + return l10n.matches_1; + }, + formatNoMatches: function() { + return l10n.matches_0; + }, + formatAjaxError: function() { + return l10n.load_fail; + }, + formatInputTooShort: function( input, min ) { + var remainingChars = min - input.length; + if( remainingChars > 1 ) { + return l10n.input_too_short_n.replace( '%d', remainingChars ); + } + return l10n.input_too_short_1; + }, + formatInputTooLong: function( input, max ) { + var overChars = input.length - max; + if( overChars > 1 ) { + return l10n.input_too_long_n.replace( '%d', overChars ); + } + return l10n.input_too_long_1; + }, + formatSelectionTooBig: function( maximum ) { + if( maximum > 1 ) { + return l10n.selection_too_long_n.replace( '%d', maximum ); + } + return l10n.selection_too_long_1; + }, + formatLoadMore: function() { + return l10n.load_more; + }, + formatSearching: function() { + return l10n.searching; + } + }; + + // ensure locales exists + $.fn.select2.locales = $.fn.select2.locales || {}; + + // append + $.fn.select2.locales[ locale ] = select2L10n; + $.extend($.fn.select2.defaults, select2L10n); + } + + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tinymce.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tinymce.js new file mode 100644 index 0000000..4dbaa7d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tinymce.js @@ -0,0 +1,398 @@ +(function($, undefined){ + + acf.tinymce = { + + /* + * defaults + * + * This function will return default mce and qt settings + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + defaults: function(){ + + // bail early if no tinyMCEPreInit + if( typeof tinyMCEPreInit === 'undefined' ) return false; + + // vars + var defaults = { + tinymce: tinyMCEPreInit.mceInit.acf_content, + quicktags: tinyMCEPreInit.qtInit.acf_content + }; + + // return + return defaults; + }, + + + /* + * initialize + * + * This function will initialize the tinymce and quicktags instances + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initialize: function( id, args ){ + + // defaults + args = acf.parseArgs(args, { + tinymce: true, + quicktags: true, + toolbar: 'full', + mode: 'visual', // visual,text + field: false + }); + + // tinymce + if( args.tinymce ) { + this.initializeTinymce( id, args ); + } + + // quicktags + if( args.quicktags ) { + this.initializeQuicktags( id, args ); + } + }, + + + /* + * initializeTinymce + * + * This function will initialize the tinymce instance + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initializeTinymce: function( id, args ){ + + // vars + var $textarea = $('#'+id); + var defaults = this.defaults(); + var toolbars = acf.get('toolbars'); + var field = args.field || false; + var $field = field.$el || false; + + // bail early + if( typeof tinymce === 'undefined' ) return false; + if( !defaults ) return false; + + // check if exists + if( tinymce.get(id) ) { + return this.enable( id ); + } + + // settings + var init = $.extend( {}, defaults.tinymce, args.tinymce ); + init.id = id; + init.selector = '#' + id; + + // toolbar + var toolbar = args.toolbar; + if( toolbar && toolbars && toolbars[toolbar] ) { + + for( var i = 1; i <= 4; i++ ) { + init[ 'toolbar' + i ] = toolbars[toolbar][i] || ''; + } + } + + // event + init.setup = function( ed ){ + + ed.on('change', function(e) { + ed.save(); // save to textarea + $textarea.trigger('change'); + }); + + // Fix bug where Gutenberg does not hear "mouseup" event and tries to select multiple blocks. + ed.on('mouseup', function(e) { + var event = new MouseEvent('mouseup'); + window.dispatchEvent(event); + }); + + // Temporarily comment out. May not be necessary due to wysiwyg field actions. + //ed.on('unload', function(e) { + // acf.tinymce.remove( id ); + //}); + }; + + // disable wp_autoresize_on (no solution yet for fixed toolbar) + init.wp_autoresize_on = false; + + // Enable wpautop allowing value to save without

        tags. + // Only if the "TinyMCE Advanced" plugin hasn't already set this functionality. + if( !init.tadv_noautop ) { + init.wpautop = true; + } + + // hook for 3rd party customization + init = acf.applyFilters('wysiwyg_tinymce_settings', init, id, field); + + // z-index fix (caused too many conflicts) + //if( acf.isset(tinymce,'ui','FloatPanel') ) { + // tinymce.ui.FloatPanel.zIndex = 900000; + //} + + // store settings + tinyMCEPreInit.mceInit[ id ] = init; + + // visual tab is active + if( args.mode == 'visual' ) { + + // init + var result = tinymce.init( init ); + + // get editor + var ed = tinymce.get( id ); + + // validate + if( !ed ) { + return false; + } + + // add reference + ed.acf = args.field; + + // action + acf.doAction('wysiwyg_tinymce_init', ed, ed.id, init, field); + } + }, + + /* + * initializeQuicktags + * + * This function will initialize the quicktags instance + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initializeQuicktags: function( id, args ){ + + // vars + var defaults = this.defaults(); + + // bail early + if( typeof quicktags === 'undefined' ) return false; + if( !defaults ) return false; + + // settings + var init = $.extend( {}, defaults.quicktags, args.quicktags ); + init.id = id; + + // filter + var field = args.field || false; + var $field = field.$el || false; + init = acf.applyFilters('wysiwyg_quicktags_settings', init, init.id, field); + + // store settings + tinyMCEPreInit.qtInit[ id ] = init; + + // init + var ed = quicktags( init ); + + // validate + if( !ed ) { + return false; + } + + // generate HTML + this.buildQuicktags( ed ); + + // action for 3rd party customization + acf.doAction('wysiwyg_quicktags_init', ed, ed.id, init, field); + }, + + + /* + * buildQuicktags + * + * This function will build the quicktags HTML + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + buildQuicktags: function( ed ){ + + var canvas, name, settings, theButtons, html, ed, id, i, use, instanceId, + defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,'; + + canvas = ed.canvas; + name = ed.name; + settings = ed.settings; + html = ''; + theButtons = {}; + use = ''; + instanceId = ed.id; + + // set buttons + if ( settings.buttons ) { + use = ','+settings.buttons+','; + } + + for ( i in edButtons ) { + if ( ! edButtons[i] ) { + continue; + } + + id = edButtons[i].id; + if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) { + continue; + } + + if ( ! edButtons[i].instance || edButtons[i].instance === instanceId ) { + theButtons[id] = edButtons[i]; + + if ( edButtons[i].html ) { + html += edButtons[i].html( name + '_' ); + } + } + } + + if ( use && use.indexOf(',dfw,') !== -1 ) { + theButtons.dfw = new QTags.DFWButton(); + html += theButtons.dfw.html( name + '_' ); + } + + if ( 'rtl' === document.getElementsByTagName( 'html' )[0].dir ) { + theButtons.textdirection = new QTags.TextDirectionButton(); + html += theButtons.textdirection.html( name + '_' ); + } + + ed.toolbar.innerHTML = html; + ed.theButtons = theButtons; + + if ( typeof jQuery !== 'undefined' ) { + jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] ); + } + + }, + + disable: function( id ){ + this.destroyTinymce( id ); + }, + + remove: function( id ){ + this.destroyTinymce( id ); + }, + + destroy: function( id ){ + this.destroyTinymce( id ); + }, + + destroyTinymce: function( id ){ + + // bail early + if( typeof tinymce === 'undefined' ) return false; + + // get editor + var ed = tinymce.get( id ); + + // bail early if no editor + if( !ed ) return false; + + // save + ed.save(); + + // destroy editor + ed.destroy(); + + // return + return true; + }, + + enable: function( id ){ + this.enableTinymce( id ); + }, + + enableTinymce: function( id ){ + + // bail early + if( typeof switchEditors === 'undefined' ) return false; + + // bail ealry if not initialized + if( typeof tinyMCEPreInit.mceInit[ id ] === 'undefined' ) return false; + + // toggle + switchEditors.go( id, 'tmce'); + + // return + return true; + } + }; + + var editorManager = new acf.Model({ + + // hook in before fieldsEventManager, conditions, etc + priority: 5, + + actions: { + 'prepare': 'onPrepare', + 'ready': 'onReady', + }, + onPrepare: function(){ + + // find hidden editor which may exist within a field + var $div = $('#acf-hidden-wp-editor'); + + // move to footer + if( $div.exists() ) { + $div.appendTo('body'); + } + }, + onReady: function(){ + + // Restore wp.editor functions used by tinymce removed in WP5. + if( acf.isset(window,'wp','oldEditor') ) { + wp.editor.autop = wp.oldEditor.autop; + wp.editor.removep = wp.oldEditor.removep; + } + + // bail early if no tinymce + if( !acf.isset(window,'tinymce','on') ) return; + + // restore default activeEditor + tinymce.on('AddEditor', function( data ){ + + // vars + var editor = data.editor; + + // bail early if not 'acf' + if( editor.id.substr(0, 3) !== 'acf' ) return; + + // override if 'content' exists + editor = tinymce.editors.content || editor; + + // update vars + tinymce.activeEditor = editor; + wpActiveEditor = editor.id; + }); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tooltip.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tooltip.js new file mode 100644 index 0000000..c4977c1 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-tooltip.js @@ -0,0 +1,324 @@ +(function($, undefined){ + + acf.newTooltip = function( props ){ + + // ensure object + if( typeof props !== 'object' ) { + props = { text: props }; + } + + // confirmRemove + if( props.confirmRemove !== undefined ) { + + props.textConfirm = acf.__('Remove'); + props.textCancel = acf.__('Cancel'); + return new TooltipConfirm( props ); + + // confirm + } else if( props.confirm !== undefined ) { + + return new TooltipConfirm( props ); + + // default + } else { + return new Tooltip( props ); + } + + }; + + var Tooltip = acf.Model.extend({ + + data: { + text: '', + timeout: 0, + target: null + }, + + tmpl: function(){ + return '

        '; + }, + + setup: function( props ){ + $.extend(this.data, props); + this.$el = $(this.tmpl()); + }, + + initialize: function(){ + + // render + this.render(); + + // append + this.show(); + + // position + this.position(); + + // timeout + var timeout = this.get('timeout'); + if( timeout ) { + setTimeout( $.proxy(this.fade, this), timeout ); + } + }, + + update: function( props ){ + $.extend(this.data, props); + this.initialize(); + }, + + render: function(){ + this.html( this.get('text') ); + }, + + show: function(){ + $('body').append( this.$el ); + }, + + hide: function(){ + this.$el.remove(); + }, + + fade: function(){ + + // add class + this.$el.addClass('acf-fade-up'); + + // remove + this.setTimeout(function(){ + this.remove(); + }, 250); + }, + + html: function( html ){ + this.$el.html( html ); + }, + + position: function(){ + + // vars + var $tooltip = this.$el; + var $target = this.get('target'); + if( !$target ) return; + + // Reset position. + $tooltip.removeClass('right left bottom top').css({ top: 0, left: 0 }); + + // Declare tollerance to edge of screen. + var tolerance = 10; + + // Find target position. + var targetWidth = $target.outerWidth(); + var targetHeight = $target.outerHeight(); + var targetTop = $target.offset().top; + var targetLeft = $target.offset().left; + + // Find tooltip position. + var tooltipWidth = $tooltip.outerWidth(); + var tooltipHeight = $tooltip.outerHeight(); + var tooltipTop = $tooltip.offset().top; // Should be 0, but WP media grid causes this to be 32 (toolbar padding). + + // Assume default top alignment. + var top = targetTop - tooltipHeight - tooltipTop; + var left = targetLeft + (targetWidth / 2) - (tooltipWidth / 2); + + // Check if too far left. + if( left < tolerance ) { + $tooltip.addClass('right'); + left = targetLeft + targetWidth; + top = targetTop + (targetHeight / 2) - (tooltipHeight / 2) - tooltipTop; + + // Check if too far right. + } else if( (left + tooltipWidth + tolerance) > $(window).width() ) { + $tooltip.addClass('left'); + left = targetLeft - tooltipWidth; + top = targetTop + (targetHeight / 2) - (tooltipHeight / 2) - tooltipTop; + + // Check if too far up. + } else if( top - $(window).scrollTop() < tolerance ) { + $tooltip.addClass('bottom'); + top = targetTop + targetHeight - tooltipTop; + + // No colision with edges. + } else { + $tooltip.addClass('top'); + } + + // update css + $tooltip.css({ 'top': top, 'left': left }); + } + }); + + var TooltipConfirm = Tooltip.extend({ + + data: { + text: '', + textConfirm: '', + textCancel: '', + target: null, + targetConfirm: true, + confirm: function(){}, + cancel: function(){}, + context: false + }, + + events: { + 'click [data-event="cancel"]': 'onCancel', + 'click [data-event="confirm"]': 'onConfirm', + }, + + addEvents: function(){ + + // add events + acf.Model.prototype.addEvents.apply(this); + + // vars + var $document = $(document); + var $target = this.get('target'); + + // add global 'cancel' click event + // - use timeout to avoid the current 'click' event triggering the onCancel function + this.setTimeout(function(){ + this.on( $document, 'click', 'onCancel' ); + }); + + // add target 'confirm' click event + // - allow setting to control this feature + if( this.get('targetConfirm') ) { + this.on( $target, 'click', 'onConfirm' ); + } + }, + + removeEvents: function(){ + + // remove events + acf.Model.prototype.removeEvents.apply(this); + + // vars + var $document = $(document); + var $target = this.get('target'); + + // remove custom events + this.off( $document, 'click' ); + this.off( $target, 'click' ); + }, + + render: function(){ + + // defaults + var text = this.get('text') || acf.__('Are you sure?'); + var textConfirm = this.get('textConfirm') || acf.__('Yes'); + var textCancel = this.get('textCancel') || acf.__('No'); + + // html + var html = [ + text, + '' + textConfirm + '', + '' + textCancel + '' + ].join(' '); + + // html + this.html( html ); + + // class + this.$el.addClass('-confirm'); + }, + + onCancel: function( e, $el ){ + + // prevent default + e.preventDefault(); + e.stopImmediatePropagation(); + + // callback + var callback = this.get('cancel'); + var context = this.get('context') || this; + callback.apply( context, arguments ); + + //remove + this.remove(); + }, + + onConfirm: function( e, $el ){ + + // prevent default + e.preventDefault(); + e.stopImmediatePropagation(); + + // callback + var callback = this.get('confirm'); + var context = this.get('context') || this; + callback.apply( context, arguments ); + + //remove + this.remove(); + } + }); + + // storage + acf.models.Tooltip = Tooltip; + acf.models.TooltipConfirm = TooltipConfirm; + + + /** + * tooltipManager + * + * description + * + * @date 17/4/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var tooltipHoverHelper = new acf.Model({ + + tooltip: false, + + events: { + 'mouseenter .acf-js-tooltip': 'showTitle', + 'mouseup .acf-js-tooltip': 'hideTitle', + 'mouseleave .acf-js-tooltip': 'hideTitle' + }, + + showTitle: function( e, $el ){ + + // vars + var title = $el.attr('title'); + + // bail ealry if no title + if( !title ) { + return; + } + + // clear title to avoid default browser tooltip + $el.attr('title', ''); + + // create + if( !this.tooltip ) { + this.tooltip = acf.newTooltip({ + text: title, + target: $el + }); + + // update + } else { + this.tooltip.update({ + text: title, + target: $el + }); + } + + }, + + hideTitle: function( e, $el ){ + + // hide tooltip + this.tooltip.hide(); + + // restore title + $el.attr('title', this.tooltip.get('text')); + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-unload.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-unload.js new file mode 100644 index 0000000..d7a1c0f --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-unload.js @@ -0,0 +1,62 @@ +(function($, undefined){ + + acf.unload = new acf.Model({ + + wait: 'load', + active: true, + changed: false, + + actions: { + 'validation_failure': 'startListening', + 'validation_success': 'stopListening' + }, + + events: { + 'change form .acf-field': 'startListening', + 'submit form': 'stopListening' + }, + + enable: function(){ + this.active = true; + }, + + disable: function(){ + this.active = false; + }, + + reset: function(){ + this.stopListening(); + }, + + startListening: function(){ + + // bail ealry if already changed, not active + if( this.changed || !this.active ) { + return; + } + + // update + this.changed = true; + + // add event + $(window).on('beforeunload', this.onUnload); + + }, + + stopListening: function(){ + + // update + this.changed = false; + + // remove event + $(window).off('beforeunload', this.onUnload); + + }, + + onUnload: function(){ + return acf.__('The changes you made will be lost if you navigate away from this page'); + } + + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-validation.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-validation.js new file mode 100644 index 0000000..26f4213 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf-validation.js @@ -0,0 +1,1006 @@ +(function($, undefined){ + + /** + * Validator + * + * The model for validating forms + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + var Validator = acf.Model.extend({ + + /** @var string The model identifier. */ + id: 'Validator', + + /** @var object The model data. */ + data: { + + /** @var array The form errors. */ + errors: [], + + /** @var object The form notice. */ + notice: null, + + /** @var string The form status. loading, invalid, valid */ + status: '' + }, + + /** @var object The model events. */ + events: { + 'changed:status': 'onChangeStatus' + }, + + /** + * addErrors + * + * Adds errors to the form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param array errors An array of errors. + * @return void + */ + addErrors: function( errors ){ + errors.map( this.addError, this ); + }, + + /** + * addError + * + * Adds and error to the form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object error An error object containing input and message. + * @return void + */ + addError: function( error ){ + this.data.errors.push( error ); + }, + + /** + * hasErrors + * + * Returns true if the form has errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return bool + */ + hasErrors: function(){ + return this.data.errors.length; + }, + + /** + * clearErrors + * + * Removes any errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + clearErrors: function(){ + return this.data.errors = []; + }, + + /** + * getErrors + * + * Returns the forms errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getErrors: function(){ + return this.data.errors; + }, + + /** + * getFieldErrors + * + * Returns the forms field errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getFieldErrors: function(){ + + // vars + var errors = []; + var inputs = []; + + // loop + this.getErrors().map(function(error){ + + // bail early if global + if( !error.input ) return; + + // update if exists + var i = inputs.indexOf(error.input); + if( i > -1 ) { + errors[ i ] = error; + + // update + } else { + errors.push( error ); + inputs.push( error.input ); + } + }); + + // return + return errors; + }, + + /** + * getGlobalErrors + * + * Returns the forms global errors (errors without a specific input). + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getGlobalErrors: function(){ + + // return array of errors that contain no input + return this.getErrors().filter(function(error){ + return !error.input; + }); + }, + + /** + * showErrors + * + * Displays all errors for this form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + showErrors: function(){ + + // bail early if no errors + if( !this.hasErrors() ) { + return; + } + + // vars + var fieldErrors = this.getFieldErrors(); + var globalErrors = this.getGlobalErrors(); + + // vars + var errorCount = 0; + var $scrollTo = false; + + // loop + fieldErrors.map(function( error ){ + + // get input + var $input = this.$('[name="' + error.input + '"]').first(); + + // if $_POST value was an array, this $input may not exist + if( !$input.length ) { + $input = this.$('[name^="' + error.input + '"]').first(); + } + + // bail early if input doesn't exist + if( !$input.length ) { + return; + } + + // increase + errorCount++; + + // get field + var field = acf.getClosestField( $input ); + + // show error + field.showError( error.message ); + + // set $scrollTo + if( !$scrollTo ) { + $scrollTo = field.$el; + } + }, this); + + // errorMessage + var errorMessage = acf.__('Validation failed'); + globalErrors.map(function( error ){ + errorMessage += '. ' + error.message; + }); + if( errorCount == 1 ) { + errorMessage += '. ' + acf.__('1 field requires attention'); + } else if( errorCount > 1 ) { + errorMessage += '. ' + acf.__('%d fields require attention').replace('%d', errorCount); + } + + // notice + if( this.has('notice') ) { + this.get('notice').update({ + type: 'error', + text: errorMessage + }); + } else { + var notice = acf.newNotice({ + type: 'error', + text: errorMessage, + target: this.$el + }); + this.set('notice', notice); + } + + // if no $scrollTo, set to message + if( !$scrollTo ) { + $scrollTo = this.get('notice').$el; + } + + // timeout + setTimeout(function(){ + $("html, body").animate({ scrollTop: $scrollTo.offset().top - ( $(window).height() / 2 ) }, 500); + }, 10); + }, + + /** + * onChangeStatus + * + * Update the form class when changing the 'status' data + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The form element. + * @param string value The new status. + * @param string prevValue The old status. + * @return void + */ + onChangeStatus: function( e, $el, value, prevValue ){ + this.$el.removeClass('is-'+prevValue).addClass('is-'+value); + }, + + /** + * validate + * + * Vaildates the form via AJAX. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object args A list of settings to customize the validation process. + * @return bool True if the form is valid. + */ + validate: function( args ){ + + // default args + args = acf.parseArgs(args, { + + // trigger event + event: false, + + // reset the form after submit + reset: false, + + // loading callback + loading: function(){}, + + // complete callback + complete: function(){}, + + // failure callback + failure: function(){}, + + // success callback + success: function( $form ){ + $form.submit(); + } + }); + + // return true if is valid - allows form submit + if( this.get('status') == 'valid' ) { + return true; + } + + // return false if is currently validating - prevents form submit + if( this.get('status') == 'validating' ) { + return false; + } + + // return true if no ACF fields exist (no need to validate) + if( !this.$('.acf-field').length ) { + return true; + } + + // if event is provided, create a new success callback. + if( args.event ) { + var event = $.Event(null, args.event); + args.success = function(){ + acf.enableSubmit( $(event.target) ).trigger( event ); + } + } + + // action for 3rd party + acf.doAction('validation_begin', this.$el); + + // lock form + acf.lockForm( this.$el ); + + // loading callback + args.loading( this.$el, this ); + + // update status + this.set('status', 'validating'); + + // success callback + var onSuccess = function( json ){ + + // validate + if( !acf.isAjaxSuccess(json) ) { + return; + } + + // filter + var data = acf.applyFilters('validation_complete', json.data, this.$el, this); + + // add errors + if( !data.valid ) { + this.addErrors( data.errors ); + } + }; + + // complete + var onComplete = function(){ + + // unlock form + acf.unlockForm( this.$el ); + + // failure + if( this.hasErrors() ) { + + // update status + this.set('status', 'invalid'); + + // action + acf.doAction('validation_failure', this.$el, this); + + // display errors + this.showErrors(); + + // failure callback + args.failure( this.$el, this ); + + // success + } else { + + // update status + this.set('status', 'valid'); + + // remove previous error message + if( this.has('notice') ) { + this.get('notice').update({ + type: 'success', + text: acf.__('Validation successful'), + timeout: 1000 + }); + } + + // action + acf.doAction('validation_success', this.$el, this); + acf.doAction('submit', this.$el); + + // success callback (submit form) + args.success( this.$el, this ); + + // lock form + acf.lockForm( this.$el ); + + // reset + if( args.reset ) { + this.reset(); + } + } + + // complete callback + args.complete( this.$el, this ); + + // clear errors + this.clearErrors(); + }; + + // serialize form data + var data = acf.serialize( this.$el ); + data.action = 'acf/validate_save_post'; + + // ajax + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(data), + type: 'post', + dataType: 'json', + context: this, + success: onSuccess, + complete: onComplete + }); + + // return false to fail validation and allow AJAX + return false + }, + + /** + * setup + * + * Called during the constructor function to setup this instance + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return void + */ + setup: function( $form ){ + + // set $el + this.$el = $form; + }, + + /** + * reset + * + * Rests the validation to be used again. + * + * @date 6/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + reset: function(){ + + // reset data + this.set('errors', []); + this.set('notice', null); + this.set('status', ''); + + // unlock form + acf.unlockForm( this.$el ); + } + }); + + /** + * getValidator + * + * Returns the instance for a given form element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $el The form element. + * @return object + */ + var getValidator = function( $el ){ + + // instantiate + var validator = $el.data('acf'); + if( !validator ) { + validator = new Validator( $el ); + } + + // return + return validator; + }; + + /** + * acf.validateForm + * + * A helper function for the Validator.validate() function. + * Returns true if form is valid, or fetches a validation request and returns false. + * + * @date 4/4/18 + * @since 5.6.9 + * + * @param object args A list of settings to customize the validation process. + * @return bool + */ + + acf.validateForm = function( args ){ + return getValidator( args.form ).validate( args ); + }; + + /** + * acf.enableSubmit + * + * Enables a submit button and returns the element. + * + * @date 30/8/18 + * @since 5.7.4 + * + * @param jQuery $submit The submit button. + * @return jQuery + */ + acf.enableSubmit = function( $submit ){ + return $submit.removeClass('disabled'); + }; + + /** + * acf.disableSubmit + * + * Disables a submit button and returns the element. + * + * @date 30/8/18 + * @since 5.7.4 + * + * @param jQuery $submit The submit button. + * @return jQuery + */ + acf.disableSubmit = function( $submit ){ + return $submit.addClass('disabled'); + }; + + /** + * acf.showSpinner + * + * Shows the spinner element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $spinner The spinner element. + * @return jQuery + */ + acf.showSpinner = function( $spinner ){ + $spinner.addClass('is-active'); // add class (WP > 4.2) + $spinner.css('display', 'inline-block'); // css (WP < 4.2) + return $spinner; + }; + + /** + * acf.hideSpinner + * + * Hides the spinner element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $spinner The spinner element. + * @return jQuery + */ + acf.hideSpinner = function( $spinner ){ + $spinner.removeClass('is-active'); // add class (WP > 4.2) + $spinner.css('display', 'none'); // css (WP < 4.2) + return $spinner; + }; + + /** + * acf.lockForm + * + * Locks a form by disabeling its primary inputs and showing a spinner. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + acf.lockForm = function( $form ){ + + // vars + var $wrap = findSubmitWrap( $form ); + var $submit = $wrap.find('.button, [type="submit"]'); + var $spinner = $wrap.find('.spinner, .acf-spinner'); + + // hide all spinners (hides the preview spinner) + acf.hideSpinner( $spinner ); + + // lock + acf.disableSubmit( $submit ); + acf.showSpinner( $spinner.last() ); + return $form; + }; + + /** + * acf.unlockForm + * + * Unlocks a form by enabeling its primary inputs and hiding all spinners. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + acf.unlockForm = function( $form ){ + + // vars + var $wrap = findSubmitWrap( $form ); + var $submit = $wrap.find('.button, [type="submit"]'); + var $spinner = $wrap.find('.spinner, .acf-spinner'); + + // unlock + acf.enableSubmit( $submit ); + acf.hideSpinner( $spinner ); + return $form; + }; + + /** + * findSubmitWrap + * + * An internal function to find the 'primary' form submit wrapping element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + var findSubmitWrap = function( $form ){ + + // default post submit div + var $wrap = $form.find('#submitdiv'); + if( $wrap.length ) { + return $wrap; + } + + // 3rd party publish box + var $wrap = $form.find('#submitpost'); + if( $wrap.length ) { + return $wrap; + } + + // term, user + var $wrap = $form.find('p.submit').last(); + if( $wrap.length ) { + return $wrap; + } + + // front end form + var $wrap = $form.find('.acf-form-submit'); + if( $wrap.length ) { + return $wrap; + } + + // default + return $form; + }; + + /** + * acf.validation + * + * Global validation logic + * + * @date 4/4/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + acf.validation = new acf.Model({ + + /** @var string The model identifier. */ + id: 'validation', + + /** @var bool The active state. Set to false before 'prepare' to prevent validation. */ + active: true, + + /** @var string The model initialize time. */ + wait: 'prepare', + + /** @var object The model actions. */ + actions: { + 'ready': 'addInputEvents', + 'append': 'addInputEvents' + }, + + /** @var object The model events. */ + events: { + 'click input[type="submit"]': 'onClickSubmit', + 'click button[type="submit"]': 'onClickSubmit', + //'click #editor .editor-post-publish-button': 'onClickSubmitGutenberg', + 'click #save-post': 'onClickSave', + 'submit form#post': 'onSubmitPost', + 'submit form': 'onSubmit', + }, + + /** + * initialize + * + * Called when initializing the model. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + initialize: function(){ + + // check 'validation' setting + if( !acf.get('validation') ) { + this.active = false; + this.actions = {}; + this.events = {}; + } + }, + + /** + * enable + * + * Enables validation. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + enable: function(){ + this.active = true; + }, + + /** + * disable + * + * Disables validation. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + disable: function(){ + this.active = false; + }, + + /** + * reset + * + * Rests the form validation to be used again + * + * @date 6/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return void + */ + reset: function( $form ){ + getValidator( $form ).reset(); + }, + + /** + * addInputEvents + * + * Adds 'invalid' event listeners to HTML inputs. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $el The element being added / readied. + * @return void + */ + addInputEvents: function( $el ){ + + // vars + var $inputs = $('.acf-field [name]', $el); + + // check + if( $inputs.length ) { + this.on( $inputs, 'invalid', 'onInvalid' ); + } + }, + + /** + * onInvalid + * + * Callback for the 'invalid' event. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onInvalid: function( e, $el ){ + + // prevent default + // - prevents browser error message + // - also fixes chrome bug where 'hidden-by-tab' field throws focus error + e.preventDefault(); + + // vars + var $form = $el.closest('form'); + + // check form exists + if( $form.length ) { + + // add error to validator + getValidator( $form ).addError({ + input: $el.attr('name'), + message: e.target.validationMessage + }); + + // trigger submit on $form + // - allows for "save", "preview" and "publish" to work + $form.submit(); + } + }, + + /** + * onClickSubmit + * + * Callback when clicking submit. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSubmit: function( e, $el ){ + + // store the "click event" for later use in this.onSubmit() + this.set('originalEvent', e); + }, + + /** + * onClickSave + * + * Set ignore to true when saving a draft. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSave: function( e, $el ) { + this.set('ignore', true); + }, + + /** + * onClickSubmitGutenberg + * + * Custom validation event for the gutenberg editor. + * + * @date 29/10/18 + * @since 5.8.0 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSubmitGutenberg: function( e, $el ){ + + // validate + var valid = acf.validateForm({ + form: $('#editor'), + event: e, + reset: true, + failure: function( $form, validator ){ + var $notice = validator.get('notice').$el; + $notice.appendTo('.components-notice-list'); + $notice.find('.acf-notice-dismiss').removeClass('small'); + } + }); + + // if not valid, stop event and allow validation to continue + if( !valid ) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + }, + + /** + * onSubmitPost + * + * Callback when the 'post' form is submit. + * + * @date 5/3/19 + * @since 5.7.13 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onSubmitPost: function( e, $el ) { + + // Check if is preview. + if( $('input#wp-preview').val() === 'dopreview' ) { + + // Ignore validation. + this.set('ignore', true); + + // Unlock form to fix conflict with core "submit.edit-post" event causing all submit buttons to be disabled. + acf.unlockForm( $el ) + } + }, + + /** + * onSubmit + * + * Callback when the form is submit. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onSubmit: function( e, $el ){ + + // Allow form to submit if... + if( + // Validation has been disabled. + !this.active + + // Or this event is to be ignored. + || this.get('ignore') + + // Or this event has already been prevented. + || e.isDefaultPrevented() + ) { + // Return early and call reset function. + return this.allowSubmit(); + } + + // Validate form. + var valid = acf.validateForm({ + form: $el, + event: this.get('originalEvent') + }); + + // If not valid, stop event to prevent form submit. + if( !valid ) { + e.preventDefault(); + } + }, + + /** + * allowSubmit + * + * Resets data during onSubmit when the form is allowed to submit. + * + * @date 5/3/19 + * @since 5.7.13 + * + * @param void + * @return void + */ + allowSubmit: function(){ + + // Reset "ignore" state. + this.set('ignore', false); + + // Reset "originalEvent" object. + this.set('originalEvent', false); + + // Return true + return true; + } + }); + +})(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf.js b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf.js new file mode 100644 index 0000000..a233e13 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/build/js/_acf.js @@ -0,0 +1,2188 @@ +(function($, undefined){ + + /** + * acf + * + * description + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + // The global acf object + var acf = {}; + + // Set as a browser global + window.acf = acf; + + /** @var object Data sent from PHP */ + acf.data = {}; + + + /** + * get + * + * Gets a specific data value + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @return mixed + */ + + acf.get = function( name ){ + return this.data[name] || null; + }; + + + /** + * has + * + * Returns `true` if the data exists and is not null + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @return boolean + */ + + acf.has = function( name ){ + return this.get(name) !== null; + }; + + + /** + * set + * + * Sets a specific data value + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string name + * @param mixed value + * @return this + */ + + acf.set = function( name, value ){ + this.data[ name ] = value; + return this; + }; + + + /** + * uniqueId + * + * Returns a unique ID + * + * @date 9/11/17 + * @since 5.6.3 + * + * @param string prefix Optional prefix. + * @return string + */ + + var idCounter = 0; + acf.uniqueId = function(prefix){ + var id = ++idCounter + ''; + return prefix ? prefix + id : id; + }; + + /** + * acf.uniqueArray + * + * Returns a new array with only unique values + * Credit: https://stackoverflow.com/questions/1960473/get-all-unique-values-in-an-array-remove-duplicates + * + * @date 23/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.uniqueArray = function( array ){ + function onlyUnique(value, index, self) { + return self.indexOf(value) === index; + } + return array.filter( onlyUnique ); + }; + + /** + * uniqid + * + * Returns a unique ID (PHP version) + * + * @date 9/11/17 + * @since 5.6.3 + * @source http://locutus.io/php/misc/uniqid/ + * + * @param string prefix Optional prefix. + * @return string + */ + + var uniqidSeed = ''; + acf.uniqid = function(prefix, moreEntropy){ + // discuss at: http://locutus.io/php/uniqid/ + // original by: Kevin van Zonneveld (http://kvz.io) + // revised by: Kankrelune (http://www.webfaktory.info/) + // note 1: Uses an internal counter (in locutus global) to avoid collision + // example 1: var $id = uniqid() + // example 1: var $result = $id.length === 13 + // returns 1: true + // example 2: var $id = uniqid('foo') + // example 2: var $result = $id.length === (13 + 'foo'.length) + // returns 2: true + // example 3: var $id = uniqid('bar', true) + // example 3: var $result = $id.length === (23 + 'bar'.length) + // returns 3: true + if (typeof prefix === 'undefined') { + prefix = ''; + } + + var retId; + var formatSeed = function(seed, reqWidth) { + seed = parseInt(seed, 10).toString(16); // to hex str + if (reqWidth < seed.length) { // so long we split + return seed.slice(seed.length - reqWidth); + } + if (reqWidth > seed.length) { // so short we pad + return Array(1 + (reqWidth - seed.length)).join('0') + seed; + } + return seed; + }; + + if (!uniqidSeed) { // init seed with big random int + uniqidSeed = Math.floor(Math.random() * 0x75bcd15); + } + uniqidSeed++; + + retId = prefix; // start with prefix, add current milliseconds hex string + retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8); + retId += formatSeed(uniqidSeed, 5); // add seed hex string + if (moreEntropy) { + // for more entropy we add a float lower to 10 + retId += (Math.random() * 10).toFixed(8).toString(); + } + + return retId; + }; + + + /** + * strReplace + * + * Performs a string replace + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string search + * @param string replace + * @param string subject + * @return string + */ + + acf.strReplace = function( search, replace, subject ){ + return subject.split(search).join(replace); + }; + + + /** + * strCamelCase + * + * Converts a string into camelCase + * Thanks to https://stackoverflow.com/questions/2970525/converting-any-string-into-camel-case + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string str + * @return string + */ + + acf.strCamelCase = function( str ){ + + // replace [_-] characters with space + str = str.replace(/[_-]/g, ' '); + + // camelCase + str = str.replace(/(?:^\w|\b\w|\s+)/g, function(match, index) { + if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces + return index == 0 ? match.toLowerCase() : match.toUpperCase(); + }); + + // return + return str; + }; + + /** + * strPascalCase + * + * Converts a string into PascalCase + * Thanks to https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript + * + * @date 14/12/17 + * @since 5.6.5 + * + * @param string str + * @return string + */ + + acf.strPascalCase = function( str ){ + var camel = acf.strCamelCase( str ); + return camel.charAt(0).toUpperCase() + camel.slice(1); + }; + + /** + * acf.strSlugify + * + * Converts a string into a HTML class friendly slug + * + * @date 21/3/18 + * @since 5.6.9 + * + * @param string str + * @return string + */ + + acf.strSlugify = function( str ){ + return acf.strReplace( '_', '-', str.toLowerCase() ); + }; + + + acf.strSanitize = function( str ){ + + // chars (https://jsperf.com/replace-foreign-characters) + var map = { + "À": "A", + "Ã": "A", + "Â": "A", + "Ã": "A", + "Ä": "A", + "Ã…": "A", + "Æ": "AE", + "Ç": "C", + "È": "E", + "É": "E", + "Ê": "E", + "Ë": "E", + "ÃŒ": "I", + "Ã": "I", + "ÃŽ": "I", + "Ã": "I", + "Ã": "D", + "Ñ": "N", + "Ã’": "O", + "Ó": "O", + "Ô": "O", + "Õ": "O", + "Ö": "O", + "Ø": "O", + "Ù": "U", + "Ú": "U", + "Û": "U", + "Ü": "U", + "Ã": "Y", + "ß": "s", + "à": "a", + "á": "a", + "â": "a", + "ã": "a", + "ä": "a", + "Ã¥": "a", + "æ": "ae", + "ç": "c", + "è": "e", + "é": "e", + "ê": "e", + "ë": "e", + "ì": "i", + "í": "i", + "î": "i", + "ï": "i", + "ñ": "n", + "ò": "o", + "ó": "o", + "ô": "o", + "õ": "o", + "ö": "o", + "ø": "o", + "ù": "u", + "ú": "u", + "û": "u", + "ü": "u", + "ý": "y", + "ÿ": "y", + "Ä€": "A", + "Ä": "a", + "Ä‚": "A", + "ă": "a", + "Ä„": "A", + "Ä…": "a", + "Ć": "C", + "ć": "c", + "Ĉ": "C", + "ĉ": "c", + "ÄŠ": "C", + "Ä‹": "c", + "ÄŒ": "C", + "Ä": "c", + "ÄŽ": "D", + "Ä": "d", + "Ä": "D", + "Ä‘": "d", + "Ä’": "E", + "Ä“": "e", + "Ä”": "E", + "Ä•": "e", + "Ä–": "E", + "Ä—": "e", + "Ę": "E", + "Ä™": "e", + "Äš": "E", + "Ä›": "e", + "Äœ": "G", + "Ä": "g", + "Äž": "G", + "ÄŸ": "g", + "Ä ": "G", + "Ä¡": "g", + "Ä¢": "G", + "Ä£": "g", + "Ĥ": "H", + "Ä¥": "h", + "Ħ": "H", + "ħ": "h", + "Ĩ": "I", + "Ä©": "i", + "Ī": "I", + "Ä«": "i", + "Ĭ": "I", + "Ä­": "i", + "Ä®": "I", + "į": "i", + "İ": "I", + "ı": "i", + "IJ": "IJ", + "ij": "ij", + "Ä´": "J", + "ĵ": "j", + "Ķ": "K", + "Ä·": "k", + "Ĺ": "L", + "ĺ": "l", + "Ä»": "L", + "ļ": "l", + "Ľ": "L", + "ľ": "l", + "Ä¿": "L", + "Å€": "l", + "Å": "l", + "Å‚": "l", + "Ń": "N", + "Å„": "n", + "Å…": "N", + "ņ": "n", + "Ň": "N", + "ň": "n", + "ʼn": "n", + "ÅŒ": "O", + "Å": "o", + "ÅŽ": "O", + "Å": "o", + "Å": "O", + "Å‘": "o", + "Å’": "OE", + "Å“": "oe", + "Å”": "R", + "Å•": "r", + "Å–": "R", + "Å—": "r", + "Ř": "R", + "Å™": "r", + "Åš": "S", + "Å›": "s", + "Åœ": "S", + "Å": "s", + "Åž": "S", + "ÅŸ": "s", + "Å ": "S", + "Å¡": "s", + "Å¢": "T", + "Å£": "t", + "Ť": "T", + "Å¥": "t", + "Ŧ": "T", + "ŧ": "t", + "Ũ": "U", + "Å©": "u", + "Ū": "U", + "Å«": "u", + "Ŭ": "U", + "Å­": "u", + "Å®": "U", + "ů": "u", + "Ű": "U", + "ű": "u", + "Ų": "U", + "ų": "u", + "Å´": "W", + "ŵ": "w", + "Ŷ": "Y", + "Å·": "y", + "Ÿ": "Y", + "Ź": "Z", + "ź": "z", + "Å»": "Z", + "ż": "z", + "Ž": "Z", + "ž": "z", + "Å¿": "s", + "Æ’": "f", + "Æ ": "O", + "Æ¡": "o", + "Ư": "U", + "ư": "u", + "Ç": "A", + "ÇŽ": "a", + "Ç": "I", + "Ç": "i", + "Ç‘": "O", + "Ç’": "o", + "Ç“": "U", + "Ç”": "u", + "Ç•": "U", + "Ç–": "u", + "Ç—": "U", + "ǘ": "u", + "Ç™": "U", + "Çš": "u", + "Ç›": "U", + "Çœ": "u", + "Ǻ": "A", + "Ç»": "a", + "Ǽ": "AE", + "ǽ": "ae", + "Ǿ": "O", + "Ç¿": "o", + + // extra + ' ': '_', + "'": '', + '?': '', + '/': '', + '\\': '', + '.': '', + ',': '', + '`': '', + '>': '', + '<': '', + '"': '', + '[': '', + ']': '', + '|': '', + '{': '', + '}': '', + '(': '', + ')': '' + }; + + // vars + var nonWord = /\W/g; + var mapping = function (c) { + return (map[c] !== undefined) ? map[c] : c; + }; + + // replace + str = str.replace(nonWord, mapping); + + // lowercase + str = str.toLowerCase(); + + // return + return str; + }; + + /** + * acf.strMatch + * + * Returns the number of characters that match between two strings + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.strMatch = function( s1, s2 ){ + + // vars + var val = 0; + var min = Math.min( s1.length, s2.length ); + + // loop + for( var i = 0; i < min; i++ ) { + if( s1[i] !== s2[i] ) { + break; + } + val++; + } + + // return + return val; + }; + + /** + * acf.decode + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.decode = function( string ){ + return $(''); + $('body').append( $textarea ); + + // vars + var val = this.getNodeValue(); + + // open popup + wpLink.open( 'acf-link-textarea', val.url, val.title, null ); + + }, + + onOpen: function(){ + + // always show title (WP will hide title if empty) + $('#wp-link-wrap').addClass('has-text-field'); + + // set inputs + var val = this.getNodeValue(); + this.setInputValue( val ); + }, + + close: function(){ + wpLink.close(); + }, + + onClose: function(){ + + // bail early if no node + // needed due to WP triggering this event twice + if( !this.has('node') ) { + return false; + } + + // remove events + this.off('wplink-open'); + this.off('wplink-close'); + + // set value + var val = this.getInputValue(); + this.setNodeValue( val ); + + // remove textarea + $('#acf-link-textarea').remove(); + + // reset + this.set('node', null); + + } + }); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'oembed', + + events: { + 'click [data-name="clear-button"]': 'onClickClear', + 'keypress .input-search': 'onKeypressSearch', + 'keyup .input-search': 'onKeyupSearch', + 'change .input-search': 'onChangeSearch' + }, + + $control: function(){ + return this.$('.acf-oembed'); + }, + + $input: function(){ + return this.$('.input-value'); + }, + + $search: function(){ + return this.$('.input-search'); + }, + + getValue: function(){ + return this.$input().val(); + }, + + getSearchVal: function(){ + return this.$search().val(); + }, + + setValue: function( val ){ + + // class + if( val ) { + this.$control().addClass('has-value'); + } else { + this.$control().removeClass('has-value'); + } + + acf.val( this.$input(), val ); + }, + + showLoading: function( show ){ + acf.showLoading( this.$('.canvas') ); + }, + + hideLoading: function(){ + acf.hideLoading( this.$('.canvas') ); + }, + + maybeSearch: function(){ + + // vars + var prevUrl = this.val(); + var url = this.getSearchVal(); + + // no value + if( !url ) { + return this.clear(); + } + + // fix missing 'http://' - causes the oembed code to error and fail + if( url.substr(0, 4) != 'http' ) { + url = 'http://' + url; + } + + // bail early if no change + if( url === prevUrl ) return; + + // clear existing timeout + var timeout = this.get('timeout'); + if( timeout ) { + clearTimeout( timeout ); + } + + // set new timeout + var callback = $.proxy(this.search, this, url); + this.set('timeout', setTimeout(callback, 300)); + + }, + + search: function( url ){ + + // ajax + var ajaxData = { + action: 'acf/fields/oembed/search', + s: url, + field_key: this.get('key') + }; + + // clear existing timeout + var xhr = this.get('xhr'); + if( xhr ) { + xhr.abort(); + } + + // loading + this.showLoading(); + + // query + var xhr = $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'json', + context: this, + success: function( json ){ + + // error + if( !json || !json.html ) { + json = { + url: false, + html: '' + } + } + + // update vars + this.val( json.url ); + this.$('.canvas-media').html( json.html ); + }, + complete: function(){ + this.hideLoading(); + } + }); + + this.set('xhr', xhr); + }, + + clear: function(){ + this.val(''); + this.$search().val(''); + this.$('.canvas-media').html(''); + }, + + onClickClear: function( e, $el ){ + this.clear(); + }, + + onKeypressSearch: function( e, $el ){ + if( e.which == 13 ) { + e.preventDefault(); + this.maybeSearch(); + } + }, + + onKeyupSearch: function( e, $el ){ + if( $el.val() ) { + this.maybeSearch(); + } + }, + + onChangeSearch: function( e, $el ){ + this.maybeSearch(); + } + + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'radio', + + events: { + 'click input[type="radio"]': 'onClick', + }, + + $control: function(){ + return this.$('.acf-radio-list'); + }, + + $input: function(){ + return this.$('input:checked'); + }, + + $inputText: function(){ + return this.$('input[type="text"]'); + }, + + getValue: function(){ + var val = this.$input().val(); + if( val === 'other' && this.get('other_choice') ) { + val = this.$inputText().val(); + } + return val; + }, + + onClick: function( e, $el ){ + + // vars + var $label = $el.parent('label'); + var selected = $label.hasClass('selected'); + var val = $el.val(); + + // remove previous selected + this.$('.selected').removeClass('selected'); + + // add active class + $label.addClass('selected'); + + // allow null + if( this.get('allow_null') && selected ) { + $label.removeClass('selected'); + $el.prop('checked', false).trigger('change'); + val = false; + } + + // other + if( this.get('other_choice') ) { + + // enable + if( val === 'other' ) { + this.$inputText().prop('disabled', false); + + // disable + } else { + this.$inputText().prop('disabled', true); + } + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'range', + + events: { + 'input input[type="range"]': 'onChange', + 'change input': 'onChange' + }, + + $input: function(){ + return this.$('input[type="range"]'); + }, + + $inputAlt: function(){ + return this.$('input[type="number"]'); + }, + + setValue: function( val ){ + this.busy = true; + + // Update range input (with change). + acf.val( this.$input(), val ); + + // Update alt input (without change). + // Read in input value to inherit min/max validation. + acf.val( this.$inputAlt(), this.$input().val(), true ); + + this.busy = false; + }, + + onChange: function( e, $el ){ + if( !this.busy ) { + this.setValue( $el.val() ); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'relationship', + + events: { + 'keypress [data-filter]': 'onKeypressFilter', + 'change [data-filter]': 'onChangeFilter', + 'keyup [data-filter]': 'onChangeFilter', + 'click .choices-list .acf-rel-item': 'onClickAdd', + 'click [data-name="remove_item"]': 'onClickRemove', + 'mouseover': 'onHover' + }, + + $control: function(){ + return this.$('.acf-relationship'); + }, + + $list: function( list ) { + return this.$('.' + list + '-list'); + }, + + $listItems: function( list ) { + return this.$list( list ).find('.acf-rel-item'); + }, + + $listItem: function( list, id ) { + return this.$list( list ).find('.acf-rel-item[data-id="' + id + '"]'); + }, + + getValue: function(){ + var val = []; + this.$listItems('values').each(function(){ + val.push( $(this).data('id') ); + }); + return val.length ? val : false; + }, + + newChoice: function( props ){ + return [ + '
      • ', + '' + props.text + '', + '
      • ' + ].join(''); + }, + + newValue: function( props ){ + return [ + '
      • ', + '', + '' + props.text, + '', + '', + '
      • ' + ].join(''); + }, + + addSortable: function( self ){ + + // sortable + this.$list('values').sortable({ + items: 'li', + forceHelperSize: true, + forcePlaceholderSize: true, + scroll: true, + update: function(){ + self.$input().trigger('change'); + } + }); + }, + + initialize: function(){ + + // scroll + var onScroll = this.proxy(function(e){ + + // bail early if no more results + if( this.get('loading') || !this.get('more') ) { + return; + } + + // Scrolled to bottom + var $list = this.$list('choices'); + var scrollTop = Math.ceil( $list.scrollTop() ); + var scrollHeight = Math.ceil( $list[0].scrollHeight ); + var innerHeight = Math.ceil( $list.innerHeight() ); + var paged = this.get('paged') || 1; + if( (scrollTop + innerHeight) >= scrollHeight ) { + + // update paged + this.set('paged', (paged+1)); + + // fetch + this.fetch(); + } + + }); + + this.$list('choices').scrollTop(0).on('scroll', onScroll); + + // fetch + this.fetch(); + }, + + onHover: function( e ){ + + // only once + $().off(e); + + // add sortable + this.addSortable( this ); + }, + + onKeypressFilter: function( e, $el ){ + + // don't submit form + if( e.which == 13 ) { + e.preventDefault(); + } + }, + + onChangeFilter: function( e, $el ){ + + // vars + var val = $el.val(); + var filter = $el.data('filter'); + + // Bail early if filter has not changed + if( this.get(filter) === val ) { + return; + } + + // update attr + this.set(filter, val); + + // reset paged + this.set('paged', 1); + + // fetch + if( $el.is('select') ) { + this.fetch(); + + // search must go through timeout + } else { + this.maybeFetch(); + } + }, + + onClickAdd: function( e, $el ){ + + // vars + var val = this.val(); + var max = parseInt( this.get('max') ); + + // can be added? + if( $el.hasClass('disabled') ) { + return false; + } + + // validate + if( max > 0 && val && val.length >= max ) { + + // add notice + this.showNotice({ + text: acf.__('Maximum values reached ( {max} values )').replace('{max}', max), + type: 'warning' + }); + return false; + } + + // disable + $el.addClass('disabled'); + + // add + var html = this.newValue({ + id: $el.data('id'), + text: $el.html() + }); + this.$list('values').append( html ) + + // trigger change + this.$input().trigger('change'); + }, + + onClickRemove: function( e, $el ){ + + // Prevent default here because generic handler wont be triggered. + e.preventDefault(); + + // vars + var $span = $el.parent(); + var $li = $span.parent(); + var id = $span.data('id'); + + // remove value + $li.remove(); + + // show choice + this.$listItem('choices', id).removeClass('disabled'); + + // trigger change + this.$input().trigger('change'); + }, + + maybeFetch: function(){ + + // vars + var timeout = this.get('timeout'); + + // abort timeout + if( timeout ) { + clearTimeout( timeout ); + } + + // fetch + timeout = this.setTimeout(this.fetch, 300); + this.set('timeout', timeout); + }, + + getAjaxData: function(){ + + // load data based on element attributes + var ajaxData = this.$control().data(); + for( var name in ajaxData ) { + ajaxData[ name ] = this.get( name ); + } + + // extra + ajaxData.action = 'acf/fields/relationship/query'; + ajaxData.field_key = this.get('key'); + + // Filter. + ajaxData = acf.applyFilters( 'relationship_ajax_data', ajaxData, this ); + + // return + return ajaxData; + }, + + fetch: function(){ + + // abort XHR if this field is already loading AJAX data + var xhr = this.get('xhr'); + if( xhr ) { + xhr.abort(); + } + + // add to this.o + var ajaxData = this.getAjaxData(); + + // clear html if is new query + var $choiceslist = this.$list( 'choices' ); + if( ajaxData.paged == 1 ) { + $choiceslist.html(''); + } + + // loading + var $loading = $('
      • ' + acf.__('Loading') + '
      • '); + $choiceslist.append($loading); + this.set('loading', true); + + // callback + var onComplete = function(){ + this.set('loading', false); + $loading.remove(); + }; + + var onSuccess = function( json ){ + + // no results + if( !json || !json.results || !json.results.length ) { + + // prevent pagination + this.set('more', false); + + // add message + if( this.get('paged') == 1 ) { + this.$list('choices').append('
      • ' + acf.__('No matches found') + '
      • '); + } + + // return + return; + } + + // set more (allows pagination scroll) + this.set('more', json.more ); + + // get new results + var html = this.walkChoices(json.results); + var $html = $( html ); + + // apply .disabled to left li's + var val = this.val(); + if( val && val.length ) { + val.map(function( id ){ + $html.find('.acf-rel-item[data-id="' + id + '"]').addClass('disabled'); + }); + } + + // append + $choiceslist.append( $html ); + + // merge together groups + var $prevLabel = false; + var $prevList = false; + + $choiceslist.find('.acf-rel-label').each(function(){ + + var $label = $(this); + var $list = $label.siblings('ul'); + + if( $prevLabel && $prevLabel.text() == $label.text() ) { + $prevList.append( $list.children() ); + $(this).parent().remove(); + return; + } + + // update vars + $prevLabel = $label; + $prevList = $list; + }); + }; + + // get results + var xhr = $.ajax({ + url: acf.get('ajaxurl'), + dataType: 'json', + type: 'post', + data: acf.prepareForAjax(ajaxData), + context: this, + success: onSuccess, + complete: onComplete + }); + + // set + this.set('xhr', xhr); + }, + + walkChoices: function( data ){ + + // walker + var walk = function( data ){ + + // vars + var html = ''; + + // is array + if( $.isArray(data) ) { + data.map(function(item){ + html += walk( item ); + }); + + // is item + } else if( $.isPlainObject(data) ) { + + // group + if( data.children !== undefined ) { + + html += '
      • ' + data.text + '
          '; + html += walk( data.children ); + html += '
      • '; + + // single + } else { + html += '
      • ' + data.text + '
      • '; + } + } + + // return + return html; + }; + + return walk( data ); + } + + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'select', + + select2: false, + + wait: 'load', + + events: { + 'removeField': 'onRemove' + }, + + $input: function(){ + return this.$('select'); + }, + + initialize: function(){ + + // vars + var $select = this.$input(); + + // inherit data + this.inherit( $select ); + + // select2 + if( this.get('ui') ) { + + // populate ajax_data (allowing custom attribute to already exist) + var ajaxAction = this.get('ajax_action'); + if( !ajaxAction ) { + ajaxAction = 'acf/fields/' + this.get('type') + '/query'; + } + + // select2 + this.select2 = acf.newSelect2($select, { + field: this, + ajax: this.get('ajax'), + multiple: this.get('multiple'), + placeholder: this.get('placeholder'), + allowNull: this.get('allow_null'), + ajaxAction: ajaxAction, + }); + } + }, + + onRemove: function(){ + if( this.select2 ) { + this.select2.destroy(); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + // vars + var CONTEXT = 'tab'; + + var Field = acf.Field.extend({ + + type: 'tab', + + wait: '', + + tabs: false, + + tab: false, + + findFields: function(){ + return this.$el.nextUntil('.acf-field-tab', '.acf-field'); + }, + + getFields: function(){ + return acf.getFields( this.findFields() ); + }, + + findTabs: function(){ + return this.$el.prevAll('.acf-tab-wrap:first'); + }, + + findTab: function(){ + return this.$('.acf-tab-button'); + }, + + initialize: function(){ + + // bail early if is td + if( this.$el.is('td') ) { + this.events = {}; + return false; + } + + // vars + var $tabs = this.findTabs(); + var $tab = this.findTab(); + var settings = acf.parseArgs($tab.data(), { + endpoint: false, + placement: '', + before: this.$el + }); + + // create wrap + if( !$tabs.length || settings.endpoint ) { + this.tabs = new Tabs( settings ); + } else { + this.tabs = $tabs.data('acf'); + } + + // add tab + this.tab = this.tabs.addTab($tab, this); + }, + + isActive: function(){ + return this.tab.isActive(); + }, + + showFields: function(){ + + // show fields + this.getFields().map(function( field ){ + field.show( this.cid, CONTEXT ); + field.hiddenByTab = false; + }, this); + + }, + + hideFields: function(){ + + // hide fields + this.getFields().map(function( field ){ + field.hide( this.cid, CONTEXT ); + field.hiddenByTab = this.tab; + }, this); + + }, + + show: function( lockKey ){ + + // show field and store result + var visible = acf.Field.prototype.show.apply(this, arguments); + + // check if now visible + if( visible ) { + + // show tab + this.tab.show(); + + // check active tabs + this.tabs.refresh(); + } + + // return + return visible; + }, + + hide: function( lockKey ){ + + // hide field and store result + var hidden = acf.Field.prototype.hide.apply(this, arguments); + + // check if now hidden + if( hidden ) { + + // hide tab + this.tab.hide(); + + // reset tabs if this was active + if( this.isActive() ) { + this.tabs.reset(); + } + } + + // return + return hidden; + }, + + enable: function( lockKey ){ + + // enable fields + this.getFields().map(function( field ){ + field.enable( CONTEXT ); + }); + }, + + disable: function( lockKey ){ + + // disable fields + this.getFields().map(function( field ){ + field.disable( CONTEXT ); + }); + } + }); + + acf.registerFieldType( Field ); + + + /** + * tabs + * + * description + * + * @date 8/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var i = 0; + var Tabs = acf.Model.extend({ + + tabs: [], + + active: false, + + actions: { + 'refresh': 'onRefresh' + }, + + data: { + before: false, + placement: 'top', + index: 0, + initialized: false, + }, + + setup: function( settings ){ + + // data + $.extend(this.data, settings); + + // define this prop to avoid scope issues + this.tabs = []; + this.active = false; + + // vars + var placement = this.get('placement'); + var $before = this.get('before'); + var $parent = $before.parent(); + + // add sidebar for left placement + if( placement == 'left' && $parent.hasClass('acf-fields') ) { + $parent.addClass('-sidebar'); + } + + // create wrap + if( $before.is('tr') ) { + this.$el = $(''); + } else { + this.$el = $('
          '); + } + + // append + $before.before( this.$el ); + + // set index + this.set('index', i, true); + i++; + }, + + initializeTabs: function(){ + + // find first visible tab + var tab = this.getVisible().shift(); + + // remember previous tab state + var order = acf.getPreference('this.tabs') || []; + var groupIndex = this.get('index'); + var tabIndex = order[ groupIndex ]; + + if( this.tabs[ tabIndex ] && this.tabs[ tabIndex ].isVisible() ) { + tab = this.tabs[ tabIndex ]; + } + + // select + if( tab ) { + this.selectTab( tab ); + } else { + this.closeTabs(); + } + + // set local variable used by tabsManager + this.set('initialized', true); + }, + + getVisible: function(){ + return this.tabs.filter(function( tab ){ + return tab.isVisible(); + }); + }, + + getActive: function(){ + return this.active; + }, + + setActive: function( tab ){ + return this.active = tab; + }, + + hasActive: function(){ + return (this.active !== false); + }, + + isActive: function( tab ){ + var active = this.getActive(); + return (active && active.cid === tab.cid); + }, + + closeActive: function(){ + if( this.hasActive() ) { + this.closeTab( this.getActive() ); + } + }, + + openTab: function( tab ){ + + // close existing tab + this.closeActive(); + + // open + tab.open(); + + // set active + this.setActive( tab ); + }, + + closeTab: function( tab ){ + + // close + tab.close(); + + // set active + this.setActive( false ); + }, + + closeTabs: function(){ + this.tabs.map( this.closeTab, this ); + }, + + selectTab: function( tab ){ + + // close other tabs + this.tabs.map(function( t ){ + if( tab.cid !== t.cid ) { + this.closeTab( t ); + } + }, this); + + // open + this.openTab( tab ); + + }, + + addTab: function( $a, field ){ + + // create
        • + var $li = $('
        • '); + + // append + $li.append( $a ); + + // append + this.$('ul').append( $li ); + + // initialize + var tab = new Tab({ + $el: $li, + field: field, + group: this, + }); + + // store + this.tabs.push( tab ); + + // return + return tab; + }, + + reset: function(){ + + // close existing tab + this.closeActive(); + + // find and active a tab + return this.refresh(); + }, + + refresh: function(){ + + // bail early if active already exists + if( this.hasActive() ) { + return false; + } + + // find next active tab + var tab = this.getVisible().shift(); + + // open tab + if( tab ) { + this.openTab( tab ); + } + + // return + return tab; + }, + + onRefresh: function(){ + + // only for left placements + if( this.get('placement') !== 'left' ) { + return; + } + + // vars + var $parent = this.$el.parent(); + var $list = this.$el.children('ul'); + var attribute = $parent.is('td') ? 'height' : 'min-height'; + + // find height (minus 1 for border-bottom) + var height = $list.position().top + $list.outerHeight(true) - 1; + + // add css + $parent.css(attribute, height); + } + }); + + var Tab = acf.Model.extend({ + + group: false, + + field: false, + + events: { + 'click a': 'onClick' + }, + + index: function(){ + return this.$el.index(); + }, + + isVisible: function(){ + return acf.isVisible( this.$el ); + }, + + isActive: function(){ + return this.$el.hasClass('active'); + }, + + open: function(){ + + // add class + this.$el.addClass('active'); + + // show field + this.field.showFields(); + }, + + close: function(){ + + // remove class + this.$el.removeClass('active'); + + // hide field + this.field.hideFields(); + }, + + onClick: function( e, $el ){ + + // prevent default + e.preventDefault(); + + // toggle + this.toggle(); + }, + + toggle: function(){ + + // bail early if already active + if( this.isActive() ) { + return; + } + + // toggle this tab + this.group.openTab( this ); + } + }); + + var tabsManager = new acf.Model({ + + priority: 50, + + actions: { + 'prepare': 'render', + 'append': 'render', + 'unload': 'onUnload', + 'invalid_field': 'onInvalidField' + }, + + findTabs: function(){ + return $('.acf-tab-wrap'); + }, + + getTabs: function(){ + return acf.getInstances( this.findTabs() ); + }, + + render: function( $el ){ + this.getTabs().map(function( tabs ){ + if( !tabs.get('initialized') ) { + tabs.initializeTabs(); + } + }); + }, + + onInvalidField: function( field ){ + + // bail early if busy + if( this.busy ) { + return; + } + + // ignore if not hidden by tab + if( !field.hiddenByTab ) { + return; + } + + // toggle tab + field.hiddenByTab.toggle(); + + // ignore other invalid fields + this.busy = true; + this.setTimeout(function(){ + this.busy = false; + }, 100); + }, + + onUnload: function(){ + + // vars + var order = []; + + // loop + this.getTabs().map(function( group ){ + var active = group.hasActive() ? group.getActive().index() : 0; + order.push(active); + }); + + // bail if no tabs + if( !order.length ) { + return; + } + + // update + acf.setPreference('this.tabs', order); + } + }); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'post_object', + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'page_link', + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.models.SelectField.extend({ + type: 'user', + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'taxonomy', + + data: { + 'ftype': 'select' + }, + + select2: false, + + wait: 'load', + + events: { + 'click a[data-name="add"]': 'onClickAdd', + 'click input[type="radio"]': 'onClickRadio', + }, + + $control: function(){ + return this.$('.acf-taxonomy-field'); + }, + + $input: function(){ + return this.getRelatedPrototype().$input.apply(this, arguments); + }, + + getRelatedType: function(){ + + // vars + var fieldType = this.get('ftype'); + + // normalize + if( fieldType == 'multi_select' ) { + fieldType = 'select'; + } + + // return + return fieldType; + + }, + + getRelatedPrototype: function(){ + return acf.getFieldType( this.getRelatedType() ).prototype; + }, + + getValue: function(){ + return this.getRelatedPrototype().getValue.apply(this, arguments); + }, + + setValue: function(){ + return this.getRelatedPrototype().setValue.apply(this, arguments); + }, + + initialize: function(){ + this.getRelatedPrototype().initialize.apply(this, arguments); + }, + + onRemove: function(){ + if( this.select2 ) { + this.select2.destroy(); + } + }, + + onClickAdd: function( e, $el ){ + + // vars + var field = this; + var popup = false; + var $form = false; + var $name = false; + var $parent = false; + var $button = false; + var $message = false; + var notice = false; + + // step 1. + var step1 = function(){ + + // popup + popup = acf.newPopup({ + title: $el.attr('title'), + loading: true, + width: '300px' + }); + + // ajax + var ajaxData = { + action: 'acf/fields/taxonomy/add_term', + field_key: field.get('key') + }; + + // get HTML + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'html', + success: step2 + }); + }; + + // step 2. + var step2 = function( html ){ + + // update popup + popup.loading(false); + popup.content(html); + + // vars + $form = popup.$('form'); + $name = popup.$('input[name="term_name"]'); + $parent = popup.$('select[name="term_parent"]'); + $button = popup.$('.acf-submit-button'); + + // focus + $name.focus(); + + // submit form + popup.on('submit', 'form', step3); + }; + + // step 3. + var step3 = function( e, $el ){ + + // prevent + e.preventDefault(); + e.stopImmediatePropagation(); + + // basic validation + if( $name.val() === '' ) { + $name.focus(); + return false; + } + + // disable + acf.startButtonLoading( $button ); + + // ajax + var ajaxData = { + action: 'acf/fields/taxonomy/add_term', + field_key: field.get('key'), + term_name: $name.val(), + term_parent: $parent.length ? $parent.val() : 0 + }; + + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(ajaxData), + type: 'post', + dataType: 'json', + success: step4 + }); + }; + + // step 4. + var step4 = function( json ){ + + // enable + acf.stopButtonLoading( $button ); + + // remove prev notice + if( notice ) { + notice.remove(); + } + + // success + if( acf.isAjaxSuccess(json) ) { + + // clear name + $name.val(''); + + // update term lists + step5( json.data ); + + // notice + notice = acf.newNotice({ + type: 'success', + text: acf.getAjaxMessage(json), + target: $form, + timeout: 2000, + dismiss: false + }); + + } else { + + // notice + notice = acf.newNotice({ + type: 'error', + text: acf.getAjaxError(json), + target: $form, + timeout: 2000, + dismiss: false + }); + } + + // focus + $name.focus(); + }; + + // step 5. + var step5 = function( term ){ + + // update parent dropdown + var $option = $(''); + if( term.term_parent ) { + $parent.children('option[value="' + term.term_parent + '"]').after( $option ); + } else { + $parent.append( $option ); + } + + // add this new term to all taxonomy field + var fields = acf.getFields({ + type: 'taxonomy' + }); + + fields.map(function( otherField ){ + if( otherField.get('taxonomy') == field.get('taxonomy') ) { + otherField.appendTerm( term ); + } + }); + + // select + field.selectTerm( term.term_id ); + }; + + // run + step1(); + }, + + appendTerm: function( term ){ + + if( this.getRelatedType() == 'select' ) { + this.appendTermSelect( term ); + } else { + this.appendTermCheckbox( term ); + } + }, + + appendTermSelect: function( term ){ + + this.select2.addOption({ + id: term.term_id, + text: term.term_label + }); + + }, + + appendTermCheckbox: function( term ){ + + // vars + var name = this.$('[name]:first').attr('name'); + var $ul = this.$('ul:first'); + + // allow multiple selection + if( this.getRelatedType() == 'checkbox' ) { + name += '[]'; + } + + // create new li + var $li = $([ + '
        • ', + '', + '
        • ' + ].join('')); + + // find parent + if( term.term_parent ) { + + // vars + var $parent = $ul.find('li[data-id="' + term.term_parent + '"]'); + + // update vars + $ul = $parent.children('ul'); + + // create ul + if( !$ul.exists() ) { + $ul = $('
            '); + $parent.append( $ul ); + } + } + + // append + $ul.append( $li ); + }, + + selectTerm: function( id ){ + if( this.getRelatedType() == 'select' ) { + this.select2.selectOption( id ); + } else { + var $input = this.$('input[value="' + id + '"]'); + $input.prop('checked', true).trigger('change'); + } + }, + + onClickRadio: function( e, $el ){ + + // vars + var $label = $el.parent('label'); + var selected = $label.hasClass('selected'); + + // remove previous selected + this.$('.selected').removeClass('selected'); + + // add active class + $label.addClass('selected'); + + // allow null + if( this.get('allow_null') && selected ) { + $label.removeClass('selected'); + $el.prop('checked', false).trigger('change'); + } + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.models.DatePickerField.extend({ + + type: 'time_picker', + + $control: function(){ + return this.$('.acf-time-picker'); + }, + + initialize: function(){ + + // vars + var $input = this.$input(); + var $inputText = this.$inputText(); + + // args + var args = { + timeFormat: this.get('time_format'), + altField: $input, + altFieldTimeOnly: false, + altTimeFormat: 'HH:mm:ss', + showButtonPanel: true, + controlType: 'select', + oneLine: true, + closeText: acf.get('dateTimePickerL10n').selectText, + timeOnly: true, + }; + + // add custom 'Close = Select' functionality + args.onClose = function( value, dp_instance, t_instance ){ + + // vars + var $close = dp_instance.dpDiv.find('.ui-datepicker-close'); + + // if clicking close button + if( !value && $close.is(':hover') ) { + t_instance._updateDateTime(); + } + }; + + + // filter + args = acf.applyFilters('time_picker_args', args, this); + + // add date time picker + acf.newTimePicker( $inputText, args ); + + // action + acf.doAction('time_picker_init', $inputText, args, this); + } + }); + + acf.registerFieldType( Field ); + + + // add + acf.newTimePicker = function( $input, args ){ + + // bail ealry if no datepicker library + if( typeof $.timepicker === 'undefined' ) { + return false; + } + + // defaults + args = args || {}; + + // initialize + $input.timepicker( args ); + + // wrap the datepicker (only if it hasn't already been wrapped) + if( $('body > #ui-datepicker-div').exists() ) { + $('body > #ui-datepicker-div').wrap('
            '); + } + }; + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'true_false', + + events: { + 'change .acf-switch-input': 'onChange', + 'focus .acf-switch-input': 'onFocus', + 'blur .acf-switch-input': 'onBlur', + 'keypress .acf-switch-input': 'onKeypress' + }, + + $input: function(){ + return this.$('input[type="checkbox"]'); + }, + + $switch: function(){ + return this.$('.acf-switch'); + }, + + getValue: function(){ + return this.$input().prop('checked') ? 1 : 0; + }, + + initialize: function(){ + this.render(); + }, + + render: function(){ + + // vars + var $switch = this.$switch(); + + // bail ealry if no $switch + if( !$switch.length ) return; + + // vars + var $on = $switch.children('.acf-switch-on'); + var $off = $switch.children('.acf-switch-off'); + var width = Math.max( $on.width(), $off.width() ); + + // bail ealry if no width + if( !width ) return; + + // set widths + $on.css( 'min-width', width ); + $off.css( 'min-width', width ); + + }, + + switchOn: function() { + this.$input().prop('checked', true); + this.$switch().addClass('-on'); + }, + + switchOff: function() { + this.$input().prop('checked', false); + this.$switch().removeClass('-on'); + }, + + onChange: function( e, $el ){ + if( $el.prop('checked') ) { + this.switchOn(); + } else { + this.switchOff(); + } + }, + + onFocus: function( e, $el ){ + this.$switch().addClass('-focus'); + }, + + onBlur: function( e, $el ){ + this.$switch().removeClass('-focus'); + }, + + onKeypress: function( e, $el ){ + + // left + if( e.keyCode === 37 ) { + return this.switchOff(); + } + + // right + if( e.keyCode === 39 ) { + return this.switchOn(); + } + + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'url', + + events: { + 'keyup input[type="url"]': 'onkeyup' + }, + + $control: function(){ + return this.$('.acf-input-wrap'); + }, + + $input: function(){ + return this.$('input[type="url"]'); + }, + + initialize: function(){ + this.render(); + }, + + isValid: function(){ + + // vars + var val = this.val(); + + // bail early if no val + if( !val ) { + return false; + } + + // url + if( val.indexOf('://') !== -1 ) { + return true; + } + + // protocol relative url + if( val.indexOf('//') === 0 ) { + return true; + } + + // return + return false; + }, + + render: function(){ + + // add class + if( this.isValid() ) { + this.$control().addClass('-valid'); + } else { + this.$control().removeClass('-valid'); + } + }, + + onkeyup: function( e, $el ){ + this.render(); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + var Field = acf.Field.extend({ + + type: 'wysiwyg', + + wait: 'load', + + events: { + 'mousedown .acf-editor-wrap.delay': 'onMousedown', + 'unmountField': 'disableEditor', + 'remountField': 'enableEditor', + 'removeField': 'disableEditor' + }, + + $control: function(){ + return this.$('.acf-editor-wrap'); + }, + + $input: function(){ + return this.$('textarea'); + }, + + getMode: function(){ + return this.$control().hasClass('tmce-active') ? 'visual' : 'text'; + }, + + initialize: function(){ + + // initializeEditor if no delay + if( !this.$control().hasClass('delay') ) { + this.initializeEditor(); + } + }, + + initializeEditor: function(){ + + // vars + var $wrap = this.$control(); + var $textarea = this.$input(); + var args = { + tinymce: true, + quicktags: true, + toolbar: this.get('toolbar'), + mode: this.getMode(), + field: this + }; + + // generate new id + var oldId = $textarea.attr('id'); + var newId = acf.uniqueId('acf-editor-'); + + // store copy of textarea data + var data = $textarea.data(); + + // rename + acf.rename({ + target: $wrap, + search: oldId, + replace: newId, + destructive: true + }); + + // update id + this.set('id', newId, true); + + // initialize + acf.tinymce.initialize( newId, args ); + + // apply data to new textarea (acf.rename creates a new textarea element due to destructive mode) + // fixes bug where conditional logic "disabled" is lost during "screen_check" + this.$input().data(data); + }, + + onMousedown: function( e ){ + + // prevent default + e.preventDefault(); + + // remove delay class + var $wrap = this.$control(); + $wrap.removeClass('delay'); + $wrap.find('.acf-editor-toolbar').remove(); + + // initialize + this.initializeEditor(); + }, + + enableEditor: function(){ + if( this.getMode() == 'visual' ) { + acf.tinymce.enable( this.get('id') ); + } + }, + + disableEditor: function(){ + acf.tinymce.destroy( this.get('id') ); + } + }); + + acf.registerFieldType( Field ); + +})(jQuery); + +(function($, undefined){ + + // vars + var storage = []; + + /** + * acf.Condition + * + * description + * + * @date 23/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.Condition = acf.Model.extend({ + + type: '', // used for model name + operator: '==', // rule operator + label: '', // label shown when editing fields + choiceType: 'input', // input, select + fieldTypes: [], // auto connect this conditions with these field types + + data: { + conditions: false, // the parent instance + field: false, // the field which we query against + rule: {} // the rule [field, operator, value] + }, + + events: { + 'change': 'change', + 'keyup': 'change', + 'enableField': 'change', + 'disableField': 'change' + }, + + setup: function( props ){ + $.extend(this.data, props); + }, + + getEventTarget: function( $el, event ){ + return $el || this.get('field').$el; + }, + + change: function( e, $el ){ + this.get('conditions').change( e ); + }, + + match: function( rule, field ){ + return false; + }, + + calculate: function(){ + return this.match( this.get('rule'), this.get('field') ); + }, + + choices: function( field ){ + return ''; + } + }); + + /** + * acf.newCondition + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newCondition = function( rule, conditions ){ + + // currently setting up conditions for fieldX, this field is the 'target' + var target = conditions.get('field'); + + // use the 'target' to find the 'trigger' field. + // - this field is used to setup the conditional logic events + var field = target.getField( rule.field ); + + // bail ealry if no target or no field (possible if field doesn't exist due to HTML error) + if( !target || !field ) { + return false; + } + + // vars + var args = { + rule: rule, + target: target, + conditions: conditions, + field: field + }; + + // vars + var fieldType = field.get('type'); + var operator = rule.operator; + + // get avaibale conditions + var conditionTypes = acf.getConditionTypes({ + fieldType: fieldType, + operator: operator, + }); + + // instantiate + var model = conditionTypes[0] || acf.Condition; + + // instantiate + var condition = new model( args ); + + // return + return condition; + }; + + /** + * mid + * + * Calculates the model ID for a field type + * + * @date 15/12/17 + * @since 5.6.5 + * + * @param string type + * @return string + */ + + var modelId = function( type ) { + return acf.strPascalCase( type || '' ) + 'Condition'; + }; + + /** + * acf.registerConditionType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.registerConditionType = function( model ){ + + // vars + var proto = model.prototype; + var type = proto.type; + var mid = modelId( type ); + + // store model + acf.models[ mid ] = model; + + // store reference + storage.push( type ); + }; + + /** + * acf.getConditionType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getConditionType = function( type ){ + var mid = modelId( type ); + return acf.models[ mid ] || false; + } + + /** + * acf.registerConditionForFieldType + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.registerConditionForFieldType = function( conditionType, fieldType ){ + + // get model + var model = acf.getConditionType( conditionType ); + + // append + if( model ) { + model.prototype.fieldTypes.push( fieldType ); + } + }; + + /** + * acf.getConditionTypes + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getConditionTypes = function( args ){ + + // defaults + args = acf.parseArgs(args, { + fieldType: '', + operator: '' + }); + + // clonse available types + var types = []; + + // loop + storage.map(function( type ){ + + // vars + var model = acf.getConditionType(type); + var ProtoFieldTypes = model.prototype.fieldTypes; + var ProtoOperator = model.prototype.operator; + + // check fieldType + if( args.fieldType && ProtoFieldTypes.indexOf( args.fieldType ) === -1 ) { + return; + } + + // check operator + if( args.operator && ProtoOperator !== args.operator ) { + return; + } + + // append + types.push( model ); + }); + + // return + return types; + }; + +})(jQuery); + +(function($, undefined){ + + // vars + var CONTEXT = 'conditional_logic'; + + /** + * conditionsManager + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var conditionsManager = new acf.Model({ + + id: 'conditionsManager', + + priority: 20, // run actions later + + actions: { + 'new_field': 'onNewField', + }, + + onNewField: function( field ){ + if( field.has('conditions') ) { + field.getConditions().render(); + } + }, + }); + + /** + * acf.Field.prototype.getField + * + * Finds a field that is related to another field + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var getSiblingField = function( field, key ){ + + // find sibling (very fast) + var fields = acf.getFields({ + key: key, + sibling: field.$el, + suppressFilters: true, + }); + + // find sibling-children (fast) + // needed for group fields, accordions, etc + if( !fields.length ) { + fields = acf.getFields({ + key: key, + parent: field.$el.parent(), + suppressFilters: true, + }); + } + + // return + if( fields.length ) { + return fields[0]; + } + return false; + }; + + acf.Field.prototype.getField = function( key ){ + + // get sibling field + var field = getSiblingField( this, key ); + + // return early + if( field ) { + return field; + } + + // move up through each parent and try again + var parents = this.parents(); + for( var i = 0; i < parents.length; i++ ) { + + // get sibling field + field = getSiblingField( parents[i], key ); + + // return early + if( field ) { + return field; + } + } + + // return + return false; + }; + + + /** + * acf.Field.prototype.getConditions + * + * Returns the field's conditions instance + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.Field.prototype.getConditions = function(){ + + // instantiate + if( !this.conditions ) { + this.conditions = new Conditions( this ); + } + + // return + return this.conditions; + }; + + + /** + * Conditions + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + var timeout = false; + var Conditions = acf.Model.extend({ + + id: 'Conditions', + + data: { + field: false, // The field with "data-conditions" (target). + timeStamp: false, // Reference used during "change" event. + groups: [], // The groups of condition instances. + }, + + setup: function( field ){ + + // data + this.data.field = field; + + // vars + var conditions = field.get('conditions'); + + // detect groups + if( conditions instanceof Array ) { + + // detect groups + if( conditions[0] instanceof Array ) { + + // loop + conditions.map(function(rules, i){ + this.addRules( rules, i ); + }, this); + + // detect rules + } else { + this.addRules( conditions ); + } + + // detect rule + } else { + this.addRule( conditions ); + } + }, + + change: function( e ){ + + // this function may be triggered multiple times per event due to multiple condition classes + // compare timestamp to allow only 1 trigger per event + if( this.get('timeStamp') === e.timeStamp ) { + return false; + } else { + this.set('timeStamp', e.timeStamp, true); + } + + // render condition and store result + var changed = this.render(); + }, + + render: function(){ + return this.calculate() ? this.show() : this.hide(); + }, + + show: function(){ + return this.get('field').showEnable(this.cid, CONTEXT); + }, + + hide: function(){ + return this.get('field').hideDisable(this.cid, CONTEXT); + }, + + calculate: function(){ + + // vars + var pass = false; + + // loop + this.getGroups().map(function( group ){ + + // igrnore this group if another group passed + if( pass ) return; + + // find passed + var passed = group.filter(function(condition){ + return condition.calculate(); + }); + + // if all conditions passed, update the global var + if( passed.length == group.length ) { + pass = true; + } + }); + + return pass; + }, + + hasGroups: function(){ + return this.data.groups != null; + }, + + getGroups: function(){ + return this.data.groups; + }, + + addGroup: function(){ + var group = []; + this.data.groups.push( group ); + return group; + }, + + hasGroup: function( i ){ + return this.data.groups[i] != null; + }, + + getGroup: function( i ){ + return this.data.groups[i]; + }, + + removeGroup: function( i ){ + this.data.groups[i].delete; + return this; + }, + + addRules: function( rules, group ){ + rules.map(function( rule ){ + this.addRule( rule, group ); + }, this); + }, + + addRule: function( rule, group ){ + + // defaults + group = group || 0; + + // vars + var groupArray; + + // get group + if( this.hasGroup(group) ) { + groupArray = this.getGroup(group); + } else { + groupArray = this.addGroup(); + } + + // instantiate + var condition = acf.newCondition( rule, this ); + + // bail ealry if condition failed (field did not exist) + if( !condition ) { + return false; + } + + // add rule + groupArray.push(condition); + }, + + hasRule: function(){ + + }, + + getRule: function( rule, group ){ + + // defaults + rule = rule || 0; + group = group || 0; + + return this.data.groups[ group ][ rule ]; + }, + + removeRule: function(){ + + } + }); + +})(jQuery); + +(function($, undefined){ + + var __ = acf.__; + + var parseString = function( val ){ + return val ? '' + val : ''; + }; + + var isEqualTo = function( v1, v2 ){ + return ( parseString(v1).toLowerCase() === parseString(v2).toLowerCase() ); + }; + + var isEqualToNumber = function( v1, v2 ){ + return ( parseFloat(v1) === parseFloat(v2) ); + }; + + var isGreaterThan = function( v1, v2 ){ + return ( parseFloat(v1) > parseFloat(v2) ); + }; + + var isLessThan = function( v1, v2 ){ + return ( parseFloat(v1) < parseFloat(v2) ); + }; + + var inArray = function( v1, array ){ + + // cast all values as string + array = array.map(function(v2){ + return parseString(v2); + }); + + return (array.indexOf( v1 ) > -1); + } + + var containsString = function( haystack, needle ){ + return ( parseString(haystack).indexOf( parseString(needle) ) > -1 ); + }; + + var matchesPattern = function( v1, pattern ){ + var regexp = new RegExp(parseString(pattern), 'gi'); + return parseString(v1).match( regexp ); + }; + + /** + * hasValue + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var HasValue = acf.Condition.extend({ + type: 'hasValue', + operator: '!=empty', + label: __('Has any value'), + fieldTypes: [ 'text', 'textarea', 'number', 'range', 'email', 'url', 'password', 'image', 'file', 'wysiwyg', 'oembed', 'select', 'checkbox', 'radio', 'button_group', 'link', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user', 'google_map', 'date_picker', 'date_time_picker', 'time_picker', 'color_picker' ], + match: function( rule, field ){ + return (field.val() ? true : false); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( HasValue ); + + /** + * hasValue + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var HasNoValue = HasValue.extend({ + type: 'hasNoValue', + operator: '==empty', + label: __('Has no value'), + match: function( rule, field ){ + return !HasValue.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( HasNoValue ); + + + + /** + * EqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var EqualTo = acf.Condition.extend({ + type: 'equalTo', + operator: '==', + label: __('Value is equal to'), + fieldTypes: [ 'text', 'textarea', 'number', 'range', 'email', 'url', 'password' ], + match: function( rule, field ){ + if( $.isNumeric(rule.value) ) { + return isEqualToNumber( rule.value, field.val() ); + } else { + return isEqualTo( rule.value, field.val() ); + } + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( EqualTo ); + + /** + * NotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var NotEqualTo = EqualTo.extend({ + type: 'notEqualTo', + operator: '!=', + label: __('Value is not equal to'), + match: function( rule, field ){ + return !EqualTo.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( NotEqualTo ); + + /** + * PatternMatch + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var PatternMatch = acf.Condition.extend({ + type: 'patternMatch', + operator: '==pattern', + label: __('Value matches pattern'), + fieldTypes: [ 'text', 'textarea', 'email', 'url', 'password', 'wysiwyg' ], + match: function( rule, field ){ + return matchesPattern( field.val(), rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( PatternMatch ); + + /** + * Contains + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var Contains = acf.Condition.extend({ + type: 'contains', + operator: '==contains', + label: __('Value contains'), + fieldTypes: [ 'text', 'textarea', 'number', 'email', 'url', 'password', 'wysiwyg', 'oembed', 'select' ], + match: function( rule, field ){ + return containsString( field.val(), rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( Contains ); + + /** + * TrueFalseEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var TrueFalseEqualTo = EqualTo.extend({ + type: 'trueFalseEqualTo', + choiceType: 'select', + fieldTypes: [ 'true_false' ], + choices: function( field ){ + return [ + { + id: 1, + text: __('Checked') + } + ]; + }, + }); + + acf.registerConditionType( TrueFalseEqualTo ); + + /** + * TrueFalseNotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var TrueFalseNotEqualTo = NotEqualTo.extend({ + type: 'trueFalseNotEqualTo', + choiceType: 'select', + fieldTypes: [ 'true_false' ], + choices: function( field ){ + return [ + { + id: 1, + text: __('Checked') + } + ]; + }, + }); + + acf.registerConditionType( TrueFalseNotEqualTo ); + + /** + * SelectEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectEqualTo = acf.Condition.extend({ + type: 'selectEqualTo', + operator: '==', + label: __('Value is equal to'), + fieldTypes: [ 'select', 'checkbox', 'radio', 'button_group' ], + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + return inArray( rule.value, val ); + } else { + return isEqualTo( rule.value, val ); + } + }, + choices: function( fieldObject ){ + + // vars + var choices = []; + var lines = fieldObject.$setting('choices textarea').val().split("\n"); + + // allow null + if( fieldObject.$input('allow_null').prop('checked') ) { + choices.push({ + id: '', + text: __('Null') + }); + } + + // loop + lines.map(function( line ){ + + // split + line = line.split(':'); + + // default label to value + line[1] = line[1] || line[0]; + + // append + choices.push({ + id: $.trim( line[0] ), + text: $.trim( line[1] ) + }); + }); + + // return + return choices; + }, + }); + + acf.registerConditionType( SelectEqualTo ); + + /** + * SelectNotEqualTo + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectNotEqualTo = SelectEqualTo.extend({ + type: 'selectNotEqualTo', + operator: '!=', + label: __('Value is not equal to'), + match: function( rule, field ){ + return !SelectEqualTo.prototype.match.apply(this, arguments); + } + }); + + acf.registerConditionType( SelectNotEqualTo ); + + /** + * GreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var GreaterThan = acf.Condition.extend({ + type: 'greaterThan', + operator: '>', + label: __('Value is greater than'), + fieldTypes: [ 'number', 'range' ], + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + val = val.length; + } + return isGreaterThan( val, rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( GreaterThan ); + + + /** + * LessThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var LessThan = GreaterThan.extend({ + type: 'lessThan', + operator: '<', + label: __('Value is less than'), + match: function( rule, field ){ + var val = field.val(); + if( val instanceof Array ) { + val = val.length; + } + return isLessThan( val, rule.value ); + }, + choices: function( fieldObject ){ + return ''; + } + }); + + acf.registerConditionType( LessThan ); + + /** + * SelectedGreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectionGreaterThan = GreaterThan.extend({ + type: 'selectionGreaterThan', + label: __('Selection is greater than'), + fieldTypes: [ 'checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user' ], + }); + + acf.registerConditionType( SelectionGreaterThan ); + + /** + * SelectedGreaterThan + * + * description + * + * @date 1/2/18 + * @since 5.6.5 + * + * @param void + * @return void + */ + + var SelectionLessThan = LessThan.extend({ + type: 'selectionLessThan', + label: __('Selection is less than'), + fieldTypes: [ 'checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user' ], + }); + + acf.registerConditionType( SelectionLessThan ); + +})(jQuery); + +(function($, undefined){ + + /** + * acf.newMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newMediaPopup = function( args ){ + + // args + var popup = null; + var args = acf.parseArgs(args, { + mode: 'select', // 'select', 'edit' + title: '', // 'Upload Image' + button: '', // 'Select Image' + type: '', // 'image', '' + field: false, // field instance + allowedTypes: '', // '.jpg, .png, etc' + library: 'all', // 'all', 'uploadedTo' + multiple: false, // false, true, 'add' + attachment: 0, // the attachment to edit + autoOpen: true, // open the popup automatically + open: function(){}, // callback after close + select: function(){}, // callback after select + close: function(){} // callback after close + }); + + // initialize + if( args.mode == 'edit' ) { + popup = new acf.models.EditMediaPopup( args ); + } else { + popup = new acf.models.SelectMediaPopup( args ); + } + + // open popup (allow frame customization before opening) + if( args.autoOpen ) { + setTimeout(function(){ + popup.open(); + }, 1); + } + + // action + acf.doAction('new_media_popup', popup); + + // return + return popup; + }; + + + /** + * getPostID + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var getPostID = function() { + var postID = acf.get('post_id'); + return $.isNumeric(postID) ? postID : 0; + } + + + /** + * acf.getMimeTypes + * + * description + * + * @date 11/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.getMimeTypes = function(){ + return this.get('mimeTypes'); + }; + + acf.getMimeType = function( name ){ + + // vars + var allTypes = acf.getMimeTypes(); + + // search + if( allTypes[name] !== undefined ) { + return allTypes[name]; + } + + // some types contain a mixed key such as "jpg|jpeg|jpe" + for( var key in allTypes ) { + if( key.indexOf(name) !== -1 ) { + return allTypes[key]; + } + } + + // return + return false; + }; + + + /** + * MediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var MediaPopup = acf.Model.extend({ + + id: 'MediaPopup', + data: {}, + defaults: {}, + frame: false, + + setup: function( props ){ + $.extend(this.data, props); + }, + + initialize: function(){ + + // vars + var options = this.getFrameOptions(); + + // add states + this.addFrameStates( options ); + + // create frame + var frame = wp.media( options ); + + // add args reference + frame.acf = this; + + // add events + this.addFrameEvents( frame, options ); + + // strore frame + this.frame = frame; + }, + + open: function(){ + this.frame.open(); + }, + + close: function(){ + this.frame.close(); + }, + + remove: function(){ + this.frame.detach(); + this.frame.remove(); + }, + + getFrameOptions: function(){ + + // vars + var options = { + title: this.get('title'), + multiple: this.get('multiple'), + library: {}, + states: [] + }; + + // type + if( this.get('type') ) { + options.library.type = this.get('type'); + } + + // type + if( this.get('library') === 'uploadedTo' ) { + options.library.uploadedTo = getPostID(); + } + + // attachment + if( this.get('attachment') ) { + options.library.post__in = [ this.get('attachment') ]; + } + + // button + if( this.get('button') ) { + options.button = { + text: this.get('button') + }; + } + + // return + return options; + }, + + addFrameStates: function( options ){ + + // create query + var Query = wp.media.query( options.library ); + + // add _acfuploader + // this is super wack! + // if you add _acfuploader to the options.library args, new uploads will not be added to the library view. + // this has been traced back to the wp.media.model.Query initialize function (which can't be overriden) + // Adding any custom args will cause the Attahcments to not observe the uploader queue + // To bypass this security issue, we add in the args AFTER the Query has been initialized + // options.library._acfuploader = settings.field; + if( this.get('field') && acf.isset(Query, 'mirroring', 'args') ) { + Query.mirroring.args._acfuploader = this.get('field'); + } + + // add states + options.states.push( + + // main state + new wp.media.controller.Library({ + library: Query, + multiple: this.get('multiple'), + title: this.get('title'), + priority: 20, + filterable: 'all', + editable: true, + allowLocalEdits: true + }) + + ); + + // edit image functionality (added in WP 3.9) + if( acf.isset(wp, 'media', 'controller', 'EditImage') ) { + options.states.push( new wp.media.controller.EditImage() ); + } + }, + + addFrameEvents: function( frame, options ){ + + // log all events + //frame.on('all', function( e ) { + // console.log( 'frame all: %o', e ); + //}); + + // add class + frame.on('open',function() { + this.$el.closest('.media-modal').addClass('acf-media-modal -' + this.acf.get('mode') ); + }, frame); + + // edit image view + // source: media-views.js:2410 editImageContent() + frame.on('content:render:edit-image', function(){ + + var image = this.state().get('image'); + var view = new wp.media.view.EditImage({ model: image, controller: this }).render(); + this.content.set( view ); + + // after creating the wrapper view, load the actual editor via an ajax call + view.loadEditor(); + + }, frame); + + // update toolbar button + //frame.on( 'toolbar:create:select', function( toolbar ) { + // toolbar.view = new wp.media.view.Toolbar.Select({ + // text: frame.options._button, + // controller: this + // }); + //}, frame ); + + // on select + frame.on('select', function() { + + // vars + var selection = frame.state().get('selection'); + + // if selecting images + if( selection ) { + + // loop + selection.each(function( attachment, i ){ + frame.acf.get('select').apply( frame.acf, [attachment, i] ); + }); + } + }); + + // on close + frame.on('close',function(){ + + // callback and remove + setTimeout(function(){ + frame.acf.get('close').apply( frame.acf ); + frame.acf.remove(); + }, 1); + }); + } + }); + + + /** + * acf.models.SelectMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.models.SelectMediaPopup = MediaPopup.extend({ + id: 'SelectMediaPopup', + setup: function( props ){ + + // default button + if( !props.button ) { + props.button = acf._x('Select', 'verb'); + } + + // parent + MediaPopup.prototype.setup.apply(this, arguments); + }, + + addFrameEvents: function( frame, options ){ + + // plupload + // adds _acfuploader param to validate uploads + if( acf.isset(_wpPluploadSettings, 'defaults', 'multipart_params') ) { + + // add _acfuploader so that Uploader will inherit + _wpPluploadSettings.defaults.multipart_params._acfuploader = this.get('field'); + + // remove acf_field so future Uploaders won't inherit + frame.on('open', function(){ + delete _wpPluploadSettings.defaults.multipart_params._acfuploader; + }); + } + + // browse + frame.on('content:activate:browse', function(){ + + // vars + var toolbar = false; + + // populate above vars making sure to allow for failure + // perhaps toolbar does not exist because the frame open is Upload Files + try { + toolbar = frame.content.get().toolbar; + } catch(e) { + console.log(e); + return; + } + + // callback + frame.acf.customizeFilters.apply(frame.acf, [toolbar]); + }); + + // parent + MediaPopup.prototype.addFrameEvents.apply(this, arguments); + + }, + + customizeFilters: function( toolbar ){ + + // vars + var filters = toolbar.get('filters'); + + // image + if( this.get('type') == 'image' ) { + + // update all + filters.filters.all.text = acf.__('All images'); + + // remove some filters + delete filters.filters.audio; + delete filters.filters.video; + delete filters.filters.image; + + // update all filters to show images + $.each(filters.filters, function( i, filter ){ + filter.props.type = filter.props.type || 'image'; + }); + } + + // specific types + if( this.get('allowedTypes') ) { + + // convert ".jpg, .png" into ["jpg", "png"] + var allowedTypes = this.get('allowedTypes').split(' ').join('').split('.').join('').split(','); + + // loop + allowedTypes.map(function( name ){ + + // get type + var mimeType = acf.getMimeType( name ); + + // bail early if no type + if( !mimeType ) return; + + // create new filter + var newFilter = { + text: mimeType, + props: { + status: null, + type: mimeType, + uploadedTo: null, + orderby: 'date', + order: 'DESC' + }, + priority: 20 + }; + + // append + filters.filters[ mimeType ] = newFilter; + + }); + } + + + + // uploaded to post + if( this.get('library') === 'uploadedTo' ) { + + // vars + var uploadedTo = this.frame.options.library.uploadedTo; + + // remove some filters + delete filters.filters.unattached; + delete filters.filters.uploaded; + + // add uploadedTo to filters + $.each(filters.filters, function( i, filter ){ + filter.text += ' (' + acf.__('Uploaded to this post') + ')'; + filter.props.uploadedTo = uploadedTo; + }); + } + + // add _acfuploader to filters + var field = this.get('field'); + $.each(filters.filters, function( k, filter ){ + filter.props._acfuploader = field; + }); + + // add _acfuplaoder to search + var search = toolbar.get('search'); + search.model.attributes._acfuploader = field; + + // render (custom function added to prototype) + if( filters.renderFilters ) { + filters.renderFilters(); + } + } + }); + + + /** + * acf.models.EditMediaPopup + * + * description + * + * @date 10/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.models.EditMediaPopup = MediaPopup.extend({ + id: 'SelectMediaPopup', + setup: function( props ){ + + // default button + if( !props.button ) { + props.button = acf._x('Update', 'verb'); + } + + // parent + MediaPopup.prototype.setup.apply(this, arguments); + }, + + addFrameEvents: function( frame, options ){ + + // add class + frame.on('open',function() { + + // add class + this.$el.closest('.media-modal').addClass('acf-expanded'); + + // set to browse + if( this.content.mode() != 'browse' ) { + this.content.mode('browse'); + } + + // set selection + var state = this.state(); + var selection = state.get('selection'); + var attachment = wp.media.attachment( frame.acf.get('attachment') ); + selection.add( attachment ); + + }, frame); + + // parent + MediaPopup.prototype.addFrameEvents.apply(this, arguments); + + } + }); + + + /** + * customizePrototypes + * + * description + * + * @date 11/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var customizePrototypes = new acf.Model({ + id: 'customizePrototypes', + wait: 'ready', + + initialize: function(){ + + // bail early if no media views + if( !acf.isset(window, 'wp', 'media', 'view') ) { + return; + } + + // fix bug where CPT without "editor" does not set post.id setting which then prevents uploadedTo from working + var postID = getPostID(); + if( postID && acf.isset(wp, 'media', 'view', 'settings', 'post') ) { + wp.media.view.settings.post.id = postID; + } + + // customize + this.customizeAttachmentsButton(); + this.customizeAttachmentsRouter(); + this.customizeAttachmentFilters(); + this.customizeAttachmentCompat(); + this.customizeAttachmentLibrary(); + }, + + customizeAttachmentsButton: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Button') ) { + return; + } + + // Extend + var Button = wp.media.view.Button; + wp.media.view.Button = Button.extend({ + + // Fix bug where "Select" button appears blank after editing an image. + // Do this by simplifying Button initialize function and avoid deleting this.options. + initialize: function() { + var options = _.defaults( this.options, this.defaults ); + this.model = new Backbone.Model( options ); + this.listenTo( this.model, 'change', this.render ); + } + }); + + }, + + customizeAttachmentsRouter: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Router') ) { + return; + } + + // vars + var Parent = wp.media.view.Router; + + // extend + wp.media.view.Router = Parent.extend({ + + addExpand: function(){ + + // vars + var $a = $([ + '', + '' + acf.__('Expand Details') + '', + '' + acf.__('Collapse Details') + '', + '' + ].join('')); + + // add events + $a.on('click', function( e ){ + e.preventDefault(); + var $div = $(this).closest('.media-modal'); + if( $div.hasClass('acf-expanded') ) { + $div.removeClass('acf-expanded'); + } else { + $div.addClass('acf-expanded'); + } + }); + + // append + this.$el.append( $a ); + }, + + initialize: function(){ + + // initialize + Parent.prototype.initialize.apply( this, arguments ); + + // add buttons + this.addExpand(); + + // return + return this; + } + }); + }, + + customizeAttachmentFilters: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'AttachmentFilters', 'All') ) { + return; + } + + // vars + var Parent = wp.media.view.AttachmentFilters.All; + + // renderFilters + // copied from media-views.js:6939 + Parent.prototype.renderFilters = function(){ + + // Build `' ).val( value ).html( filter.text )[0], + priority: filter.priority || 50 + }; + }, this ).sortBy('priority').pluck('el').value() ); + + }; + }, + + customizeAttachmentCompat: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'AttachmentCompat') ) { + return; + } + + // vars + var AttachmentCompat = wp.media.view.AttachmentCompat; + var timeout = false; + + // extend + wp.media.view.AttachmentCompat = AttachmentCompat.extend({ + + render: function() { + + // WP bug + // When multiple media frames exist on the same page (WP content, WYSIWYG, image, file ), + // WP creates multiple instances of this AttachmentCompat view. + // Each instance will attempt to render when a new modal is created. + // Use a property to avoid this and only render once per instance. + if( this.rendered ) { + return this; + } + + // render HTML + AttachmentCompat.prototype.render.apply( this, arguments ); + + // when uploading, render is called twice. + // ignore first render by checking for #acf-form-data element + if( !this.$('#acf-form-data').length ) { + return this; + } + + // clear timeout + clearTimeout( timeout ); + + // setTimeout + timeout = setTimeout($.proxy(function(){ + this.rendered = true; + acf.doAction('append', this.$el); + }, this), 50); + + // return + return this; + }, + + save: function( event ) { + var data = {}; + + if ( event ) { + event.preventDefault(); + } + + //_.each( this.$el.serializeArray(), function( pair ) { + // data[ pair.name ] = pair.value; + //}); + + // Serialize data more thoroughly to allow chckbox inputs to save. + data = acf.serializeForAjax(this.$el); + + this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); + this.model.saveCompat( data ).always( _.bind( this.postSave, this ) ); + } + }); + + }, + + customizeAttachmentLibrary: function(){ + + // validate + if( !acf.isset(wp, 'media', 'view', 'Attachment', 'Library') ) { + return; + } + + // vars + var AttachmentLibrary = wp.media.view.Attachment.Library; + + // extend + wp.media.view.Attachment.Library = AttachmentLibrary.extend({ + + render: function() { + + // vars + var popup = acf.isget(this, 'controller', 'acf'); + var attributes = acf.isget(this, 'model', 'attributes'); + + // check vars exist to avoid errors + if( popup && attributes ) { + + // show errors + if( attributes.acf_errors ) { + this.$el.addClass('acf-disabled'); + } + + // disable selected + var selected = popup.get('selected'); + if( selected && selected.indexOf(attributes.id) > -1 ) { + this.$el.addClass('acf-selected'); + } + } + + // render + return AttachmentLibrary.prototype.render.apply( this, arguments ); + + }, + + + /* + * toggleSelection + * + * This function is called before an attachment is selected + * A good place to check for errors and prevent the 'select' function from being fired + * + * @type function + * @date 29/09/2016 + * @since 5.4.0 + * + * @param options (object) + * @return n/a + */ + + toggleSelection: function( options ) { + + // vars + // source: wp-includes/js/media-views.js:2880 + var collection = this.collection, + selection = this.options.selection, + model = this.model, + single = selection.single(); + + + // vars + var frame = this.controller; + var errors = acf.isget(this, 'model', 'attributes', 'acf_errors'); + var $sidebar = frame.$el.find('.media-frame-content .media-sidebar'); + + // remove previous error + $sidebar.children('.acf-selection-error').remove(); + + // show attachment details + $sidebar.children().removeClass('acf-hidden'); + + // add message + if( frame && errors ) { + + // vars + var filename = acf.isget(this, 'model', 'attributes', 'filename'); + + // hide attachment details + // Gallery field continues to show previously selected attachment... + $sidebar.children().addClass('acf-hidden'); + + // append message + $sidebar.prepend([ + '
            ', + '' + acf.__('Restricted') +'', + '' + filename + '', + '' + errors + '', + '
            ' + ].join('')); + + // reset selection (unselects all attachments) + selection.reset(); + + // set single (attachment displayed in sidebar) + selection.single( model ); + + // return and prevent 'select' form being fired + return; + + } + + // return + return AttachmentLibrary.prototype.toggleSelection.apply( this, arguments ); + } + }); + } + }); + +})(jQuery); + +(function($, undefined){ + + acf.screen = new acf.Model({ + + active: true, + + xhr: false, + + timeout: false, + + wait: 'load', + + events: { + 'change #page_template': 'onChange', + 'change #parent_id': 'onChange', + 'change #post-formats-select': 'onChange', + 'change .categorychecklist': 'onChange', + 'change .tagsdiv': 'onChange', + 'change .acf-taxonomy-field[data-save="1"]': 'onChange', + 'change #product-type': 'onChange' + }, + + isPost: function(){ + return acf.get('screen') === 'post'; + }, + + isUser: function(){ + return acf.get('screen') === 'user'; + }, + + isTaxonomy: function(){ + return acf.get('screen') === 'taxonomy'; + }, + + isAttachment: function(){ + return acf.get('screen') === 'attachment'; + }, + + isNavMenu: function(){ + return acf.get('screen') === 'nav_menu'; + }, + + isWidget: function(){ + return acf.get('screen') === 'widget'; + }, + + isComment: function(){ + return acf.get('screen') === 'comment'; + }, + + getPageTemplate: function(){ + var $el = $('#page_template'); + return $el.length ? $el.val() : null; + }, + + getPageParent: function( e, $el ){ + var $el = $('#parent_id'); + return $el.length ? $el.val() : null; + }, + + getPageType: function( e, $el ){ + return this.getPageParent() ? 'child' : 'parent'; + }, + + getPostType: function(){ + return $('#post_type').val(); + }, + + getPostFormat: function( e, $el ){ + var $el = $('#post-formats-select input:checked'); + if( $el.length ) { + var val = $el.val(); + return (val == '0') ? 'standard' : val; + } + return null; + }, + + getPostCoreTerms: function(){ + + // vars + var terms = {}; + + // serialize WP taxonomy postboxes + var data = acf.serialize( $('.categorydiv, .tagsdiv') ); + + // use tax_input (tag, custom-taxonomy) when possible. + // this data is already formatted in taxonomy => [terms]. + if( data.tax_input ) { + terms = data.tax_input; + } + + // append "category" which uses a different name + if( data.post_category ) { + terms.category = data.post_category; + } + + // convert any string values (tags) into array format + for( var tax in terms ) { + if( !acf.isArray(terms[tax]) ) { + terms[tax] = terms[tax].split(/,[\s]?/); + } + } + + // return + return terms; + }, + + getPostTerms: function(){ + + // Get core terms. + var terms = this.getPostCoreTerms(); + + // loop over taxonomy fields and add their values + acf.getFields({type: 'taxonomy'}).map(function( field ){ + + // ignore fields that don't save + if( !field.get('save') ) { + return; + } + + // vars + var val = field.val(); + var tax = field.get('taxonomy'); + + // check val + if( val ) { + + // ensure terms exists + terms[ tax ] = terms[ tax ] || []; + + // ensure val is an array + val = acf.isArray(val) ? val : [val]; + + // append + terms[ tax ] = terms[ tax ].concat( val ); + } + }); + + // add WC product type + if( (productType = this.getProductType()) !== null ) { + terms.product_type = [productType]; + } + + // remove duplicate values + for( var tax in terms ) { + terms[tax] = acf.uniqueArray(terms[tax]); + } + + // return + return terms; + }, + + getProductType: function(){ + var $el = $('#product-type'); + return $el.length ? $el.val() : null; + }, + + check: function(){ + + // bail early if not for post + if( acf.get('screen') !== 'post' ) { + return; + } + + // abort XHR if is already loading AJAX data + if( this.xhr ) { + this.xhr.abort(); + } + + // vars + var ajaxData = acf.parseArgs(this.data, { + action: 'acf/ajax/check_screen', + screen: acf.get('screen'), + exists: [] + }); + + // post id + if( this.isPost() ) { + ajaxData.post_id = acf.get('post_id'); + } + + // post type + if( (postType = this.getPostType()) !== null ) { + ajaxData.post_type = postType; + } + + // page template + if( (pageTemplate = this.getPageTemplate()) !== null ) { + ajaxData.page_template = pageTemplate; + } + + // page parent + if( (pageParent = this.getPageParent()) !== null ) { + ajaxData.page_parent = pageParent; + } + + // page type + if( (pageType = this.getPageType()) !== null ) { + ajaxData.page_type = pageType; + } + + // post format + if( (postFormat = this.getPostFormat()) !== null ) { + ajaxData.post_format = postFormat; + } + + // post terms + if( (postTerms = this.getPostTerms()) !== null ) { + ajaxData.post_terms = postTerms; + } + + // add array of existing postboxes to increase performance and reduce JSON HTML + acf.getPostboxes().map(function( postbox ){ + ajaxData.exists.push( postbox.get('key') ); + }); + + // filter + ajaxData = acf.applyFilters('check_screen_args', ajaxData); + + // success + var onSuccess = function( json ){ + + // Check success. + if( acf.isAjaxSuccess(json) ) { + + // Render post screen. + if( acf.get('screen') == 'post' ) { + this.renderPostScreen( json.data ); + + // Render user screen. + } else if( acf.get('screen') == 'user' ) { + this.renderUserScreen( json.data ); + } + } + + // action + acf.doAction('check_screen_complete', json.data, ajaxData); + }; + + // ajax + this.xhr = $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax( ajaxData ), + type: 'post', + dataType: 'json', + context: this, + success: onSuccess + }); + }, + + onChange: function( e, $el ){ + this.setTimeout(this.check, 1); + }, + + renderPostScreen: function( data ){ + + // vars + var visible = []; + + // Helper function to copy events + var copyEvents = function( $from, $to ){ + var events = $._data($from[0]).events; + for( var type in events ) { + for( var i = 0; i < events[type].length; i++ ) { + $to.on( type, events[type][i].handler ); + } + } + } + + // Helper function to sort metabox. + var sortMetabox = function( id, ids ){ + + // Find position of id within ids. + var index = ids.indexOf( id ); + + // Bail early if index not found. + if( index == -1 ) { + return false; + } + + // Loop over metaboxes behind (in reverse order). + for( var i = index-1; i >= 0; i-- ) { + if( $('#'+ids[i]).length ) { + return $('#'+ids[i]).after( $('#'+id) ); + } + } + + // Loop over metaboxes infront. + for( var i = index+1; i < ids.length; i++ ) { + if( $('#'+ids[i]).length ) { + return $('#'+ids[i]).before( $('#'+id) ); + } + } + + // Return false if not sorted. + return false; + }; + + // Show these postboxes. + data.results.map(function( result, i ){ + + // vars + var postbox = acf.getPostbox( result.id ); + + // Create postbox if doesn't exist. + if( !postbox ) { + + // Create it. + var $postbox = $([ + '
            ', + '', + '

            ', + '' + result.title + '', + '

            ', + '
            ', + result.html, + '
            ', + '
            ' + ].join('')); + + // Create new hide toggle. + if( $('#adv-settings').length ) { + var $prefs = $('#adv-settings .metabox-prefs'); + var $label = $([ + '' + ].join('')); + + // Copy default WP events onto checkbox. + copyEvents( $prefs.find('input').first(), $label.find('input') ); + + // Append hide label + $prefs.append( $label ); + } + + // Append metabox to the bottom of "side-sortables". + if( result.position === 'side' ) { + $('#' + result.position + '-sortables').append( $postbox ); + + // Prepend metabox to the top of "normal-sortbables". + } else { + $('#' + result.position + '-sortables').prepend( $postbox ); + } + + // Position metabox amongst existing ACF metaboxes within the same location. + var order = []; + data.results.map(function( _result ){ + if( result.position === _result.position && $('#' + result.position + '-sortables #' + _result.id).length ) { + order.push( _result.id ); + } + }); + sortMetabox(result.id, order) + + // Check 'sorted' for user preference. + if( data.sorted ) { + + // Loop over each position (acf_after_title, side, normal). + for( var position in data.sorted ) { + + // Explode string into array of ids. + var order = data.sorted[position].split(','); + + // Position metabox relative to order. + if( sortMetabox(result.id, order) ) { + break; + } + } + } + + // Copy default WP events onto metabox. + var $submitdiv = $('#submitdiv'); + if( $('#submitdiv').length ) { + copyEvents( $submitdiv.children('.handlediv'), $postbox.children('.handlediv') ); + copyEvents( $submitdiv.children('.hndle'), $postbox.children('.hndle') ); + } + + // Initalize it (modifies HTML). + postbox = acf.newPostbox( result ); + + // Trigger action. + acf.doAction('append', $postbox); + acf.doAction('append_postbox', postbox); + } + + // show postbox + postbox.showEnable(); + + // Do action. + acf.doAction('show_postbox', postbox); + + // append + visible.push( result.id ); + }); + + // Hide these postboxes. + acf.getPostboxes().map(function( postbox ){ + if( visible.indexOf( postbox.get('id') ) === -1 ) { + postbox.hideDisable(); + + // Do action. + acf.doAction('hide_postbox', postbox); + } + }); + + // Update style. + $('#acf-style').html( data.style ); + }, + + renderUserScreen: function( json ){ + + } + }); + + /** + * gutenScreen + * + * Adds compatibility with the Gutenberg edit screen. + * + * @date 11/12/18 + * @since 5.8.0 + * + * @param void + * @return void + */ + var gutenScreen = new acf.Model({ + + // Wait until load to avoid 'core' issues when loading taxonomies. + wait: 'load', + + initialize: function(){ + + // Bail early if not Gutenberg. + if( !acf.isGutenberg() ) { + return; + } + + // Listen for changes. + wp.data.subscribe(this.proxy(this.onChange)); + + // Customize "acf.screen.get" functions. + acf.screen.getPageTemplate = this.getPageTemplate; + acf.screen.getPageParent = this.getPageParent; + acf.screen.getPostType = this.getPostType; + acf.screen.getPostFormat = this.getPostFormat; + acf.screen.getPostCoreTerms = this.getPostCoreTerms; + + // Disable unload + acf.unload.disable(); + + // Add actions. + //this.addAction( 'append_postbox', acf.screen.refreshAvailableMetaBoxesPerLocation ); + }, + + onChange: function(){ + + // Get edits. + var edits = wp.data.select( 'core/editor' ).getPostEdits(); + + // Check specific attributes. + var attributes = [ + 'template', + 'parent', + 'format' + ]; + + // Append taxonomy attributes. + var taxonomies = wp.data.select( 'core' ).getTaxonomies() || []; + taxonomies.map(function( taxonomy ){ + attributes.push( taxonomy.rest_base ); + }); + + // Filter out attributes that have not changed. + attributes = attributes.filter(this.proxy(function( attr ){ + return ( edits[attr] !== undefined && edits[attr] !== this.get(attr) ); + })); + + // Trigger change if has attributes. + if( attributes.length ) { + this.triggerChange( edits ) + } + }, + + triggerChange: function( edits ){ + + // Update this.data if edits are provided. + if( edits !== undefined ) { + this.data = edits; + } + + // Check screen. + acf.screen.check(); + }, + + getPageTemplate: function(){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'template' ); + }, + + getPageParent: function( e, $el ){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'parent' ); + }, + + getPostType: function(){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'type' ); + }, + + getPostFormat: function( e, $el ){ + return wp.data.select( 'core/editor' ).getEditedPostAttribute( 'format' ); + }, + + getPostCoreTerms: function(){ + + // vars + var terms = {}; + + // Loop over taxonomies. + var taxonomies = wp.data.select( 'core' ).getTaxonomies() || []; + taxonomies.map(function( taxonomy ){ + + // Append selected taxonomies to terms object. + var postTerms = wp.data.select( 'core/editor' ).getEditedPostAttribute( taxonomy.rest_base ); + if( postTerms ) { + terms[ taxonomy.slug ] = postTerms; + } + }); + + // return + return terms; + } + }); + + /** + * acf.screen.refreshAvailableMetaBoxesPerLocation + * + * Refreshes the WP data state based on metaboxes found in the DOM. + * + * Caution. Not safe to use. + * Causes duplicate dispatch listeners when saving post resulting in duplicate postmeta. + * + * @date 6/3/19 + * @since 5.7.13 + * + * @param void + * @return void + */ + acf.screen.refreshAvailableMetaBoxesPerLocation = function() { + + // Extract vars. + var select = wp.data.select( 'core/edit-post' ); + var dispatch = wp.data.dispatch( 'core/edit-post' ); + + // Load current metabox locations and data. + var data = {}; + select.getActiveMetaBoxLocations().map(function( location ){ + data[ location ] = select.getMetaBoxesPerLocation( location ); + }); + + // Generate flat array of existing ids. + var ids = []; + for( var k in data ) { + ids = ids.concat( data[k].map(function(m){ return m.id; }) ); + } + + // Append ACF metaboxes. + acf.getPostboxes().map(function( postbox ){ + + // Ignore if already exists in data. + if( ids.indexOf( postbox.get('id') ) !== -1 ) { + return; + } + + // Get metabox location looking at parent form. + var location = postbox.$el.closest('form').attr('class').replace('metabox-location-', ''); + + // Ensure location exists. + data[ location ] = data[ location ] || []; + + // Append. + data[ location ].push({ + id: postbox.get('id'), + title: postbox.get('title') + }); + }); + + // Update state. + dispatch.setAvailableMetaBoxesPerLocation(data); + }; + +})(jQuery); + +(function($, undefined){ + + /** + * acf.newSelect2 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newSelect2 = function( $select, props ){ + + // defaults + props = acf.parseArgs(props, { + allowNull: false, + placeholder: '', + multiple: false, + field: false, + ajax: false, + ajaxAction: '', + ajaxData: function( data ){ return data; }, + ajaxResults: function( json ){ return json; }, + }); + + // initialize + if( getVersion() == 4 ) { + var select2 = new Select2_4( $select, props ); + } else { + var select2 = new Select2_3( $select, props ); + } + + // actions + acf.doAction('new_select2', select2); + + // return + return select2; + }; + + /** + * getVersion + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + function getVersion() { + + // v4 + if( acf.isset(window, 'jQuery', 'fn', 'select2', 'amd') ) { + return 4; + } + + // v3 + if( acf.isset(window, 'Select2') ) { + return 3; + } + + // return + return false; + } + + /** + * Select2 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2 = acf.Model.extend({ + + setup: function( $select, props ){ + $.extend(this.data, props); + this.$el = $select; + }, + + initialize: function(){ + + }, + + selectOption: function( value ){ + var $option = this.getOption( value ); + if( !$option.prop('selected') ) { + $option.prop('selected', true).trigger('change'); + } + }, + + unselectOption: function( value ){ + var $option = this.getOption( value ); + if( $option.prop('selected') ) { + $option.prop('selected', false).trigger('change'); + } + }, + + getOption: function( value ){ + return this.$('option[value="' + value + '"]'); + }, + + addOption: function( option ){ + + // defaults + option = acf.parseArgs(option, { + id: '', + text: '', + selected: false + }); + + // vars + var $option = this.getOption( option.id ); + + // append + if( !$option.length ) { + $option = $(''); + $option.html( option.text ); + $option.attr('value', option.id); + $option.prop('selected', option.selected); + this.$el.append($option); + } + + // chain + return $option; + }, + + getValue: function(){ + + // vars + var val = []; + var $options = this.$el.find('option:selected'); + + // bail early if no selected + if( !$options.exists() ) { + return val; + } + + // sort by attribute + $options = $options.sort(function(a, b) { + return +a.getAttribute('data-i') - +b.getAttribute('data-i'); + }); + + // loop + $options.each(function(){ + var $el = $(this); + val.push({ + $el: $el, + id: $el.attr('value'), + text: $el.text(), + }); + }); + + // return + return val; + + }, + + mergeOptions: function(){ + + }, + + getChoices: function(){ + + // callback + var crawl = function( $parent ){ + + // vars + var choices = []; + + // loop + $parent.children().each(function(){ + + // vars + var $child = $(this); + + // optgroup + if( $child.is('optgroup') ) { + + choices.push({ + text: $child.attr('label'), + children: crawl( $child ) + }); + + // option + } else { + + choices.push({ + id: $child.attr('value'), + text: $child.text() + }); + } + }); + + // return + return choices; + }; + + // crawl + return crawl( this.$el ); + }, + + decodeChoices: function( choices ){ + + // callback + var crawl = function( items ){ + items.map(function( item ){ + item.text = acf.decode( item.text ); + if( item.children ) { + item.children = crawl( item.children ); + } + return item; + }); + return items; + }; + + // crawl + return crawl( choices ); + }, + + getAjaxData: function( params ){ + + // vars + var ajaxData = { + action: this.get('ajaxAction'), + s: params.term || '', + paged: params.page || 1 + }; + + // field helper + var field = this.get('field'); + if( field ) { + ajaxData.field_key = field.get('key'); + } + + // callback + var callback = this.get('ajaxData'); + if( callback ) { + ajaxData = callback.apply( this, [ajaxData, params] ); + } + + // filter + ajaxData = acf.applyFilters( 'select2_ajax_data', ajaxData, this.data, this.$el, (field || false), this ); + + // return + return acf.prepareForAjax(ajaxData); + }, + + getAjaxResults: function( json, params ){ + + // defaults + json = acf.parseArgs(json, { + results: false, + more: false, + }); + + // decode + if( json.results ) { + json.results = this.decodeChoices(json.results); + } + + // callback + var callback = this.get('ajaxResults'); + if( callback ) { + json = callback.apply( this, [json, params] ); + } + + // filter + json = acf.applyFilters( 'select2_ajax_results', json, params, this ); + + // return + return json; + }, + + processAjaxResults: function( json, params ){ + + // vars + var json = this.getAjaxResults( json, params ); + + // change more to pagination + if( json.more ) { + json.pagination = { more: true }; + } + + // merge together groups + setTimeout($.proxy(this.mergeOptions, this), 1); + + // return + return json; + }, + + destroy: function(){ + + // destroy via api + if( this.$el.data('select2') ) { + this.$el.select2('destroy'); + } + + // destory via HTML (duplicating HTML does not contain data) + this.$el.siblings('.select2-container').remove(); + } + + }); + + + /** + * Select2_4 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2_4 = Select2.extend({ + + initialize: function(){ + + // vars + var $select = this.$el; + var options = { + width: '100%', + allowClear: this.get('allowNull'), + placeholder: this.get('placeholder'), + multiple: this.get('multiple'), + data: [], + escapeMarkup: function( m ){ return m; } + }; + + // multiple + if( options.multiple ) { + + // reorder options + this.getValue().map(function( item ){ + item.$el.detach().appendTo( $select ); + }); + } + + // remove conflicting atts + $select.removeData('ajax'); + $select.removeAttr('data-ajax'); + + // ajax + if( this.get('ajax') ) { + + options.ajax = { + url: acf.get('ajaxurl'), + delay: 250, + dataType: 'json', + type: 'post', + cache: false, + data: $.proxy(this.getAjaxData, this), + processResults: $.proxy(this.processAjaxResults, this), + }; + } + + // filter for 3rd party customization + //options = acf.applyFilters( 'select2_args', options, $select, this ); + var field = this.get('field'); + options = acf.applyFilters( 'select2_args', options, $select, this.data, (field || false), this ); + + // add select2 + $select.select2( options ); + + // get container (Select2 v4 does not return this from constructor) + var $container = $select.next('.select2-container'); + + // multiple + if( options.multiple ) { + + // vars + var $ul = $container.find('ul'); + + // sortable + $ul.sortable({ + stop: function( e ) { + + // loop + $ul.find('.select2-selection__choice').each(function() { + + // vars + var $option = $( $(this).data('data').element ); + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // trigger change on input (JS error if trigger on select) + $select.trigger('change'); + } + }); + + // on select, move to end + $select.on('select2:select', this.proxy(function( e ){ + this.getOption( e.params.data.id ).detach().appendTo( this.$el ); + })); + } + + // add class + $container.addClass('-acf'); + + // action for 3rd party customization + acf.doAction('select2_init', $select, options, this.data, (field || false), this); + }, + + mergeOptions: function(){ + + // vars + var $prevOptions = false; + var $prevGroup = false; + + // loop + $('.select2-results__option[role="group"]').each(function(){ + + // vars + var $options = $(this).children('ul'); + var $group = $(this).children('strong'); + + // compare to previous + if( $prevGroup && $prevGroup.text() === $group.text() ) { + $prevOptions.append( $options.children() ); + $(this).remove(); + return; + } + + // update vars + $prevOptions = $options; + $prevGroup = $group; + + }); + }, + + }); + + /** + * Select2_3 + * + * description + * + * @date 13/1/18 + * @since 5.6.5 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var Select2_3 = Select2.extend({ + + initialize: function(){ + + // vars + var $select = this.$el; + var value = this.getValue(); + var multiple = this.get('multiple'); + var options = { + width: '100%', + allowClear: this.get('allowNull'), + placeholder: this.get('placeholder'), + separator: '||', + multiple: this.get('multiple'), + data: this.getChoices(), + escapeMarkup: function( m ){ return m; }, + dropdownCss: { + 'z-index': '999999999' + }, + initSelection: function( element, callback ) { + if( multiple ) { + callback( value ); + } else { + callback( value.shift() ); + } + } + }; + + // get hidden input + var $input = $select.siblings('input'); + if( !$input.length ) { + $input = $(''); + $select.before( $input ); + } + + // set input value + inputValue = value.map(function(item){ return item.id }).join('||'); + $input.val( inputValue ); + + // multiple + if( options.multiple ) { + + // reorder options + value.map(function( item ){ + item.$el.detach().appendTo( $select ); + }); + } + + // remove blank option as we have a clear all button + if( options.allowClear ) { + options.data = options.data.filter(function(item){ + return item.id !== ''; + }); + } + + // remove conflicting atts + $select.removeData('ajax'); + $select.removeAttr('data-ajax'); + + // ajax + if( this.get('ajax') ) { + + options.ajax = { + url: acf.get('ajaxurl'), + quietMillis: 250, + dataType: 'json', + type: 'post', + cache: false, + data: $.proxy(this.getAjaxData, this), + results: $.proxy(this.processAjaxResults, this), + }; + } + + // filter for 3rd party customization + var field = this.get('field'); + options = acf.applyFilters( 'select2_args', options, $select, this.data, (field || false), this ); + + // add select2 + $input.select2( options ); + + // get container + var $container = $input.select2('container'); + + // helper to find this select's option + var getOption = $.proxy(this.getOption, this); + + // multiple + if( options.multiple ) { + + // vars + var $ul = $container.find('ul'); + + // sortable + $ul.sortable({ + stop: function() { + + // loop + $ul.find('.select2-search-choice').each(function() { + + // vars + var data = $(this).data('select2Data'); + var $option = getOption( data.id ); + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // trigger change on input (JS error if trigger on select) + $select.trigger('change'); + } + }); + } + + // on select, create option and move to end + $input.on('select2-selecting', function( e ){ + + // vars + var item = e.choice; + var $option = getOption( item.id ); + + // create if doesn't exist + if( !$option.length ) { + $option = $(''); + } + + // detach and re-append to end + $option.detach().appendTo( $select ); + }); + + // add class + $container.addClass('-acf'); + + // action for 3rd party customization + acf.doAction('select2_init', $select, options, this.data, (field || false), this); + + // change + $input.on('change', function(){ + var val = $input.val(); + if( val.indexOf('||') ) { + val = val.split('||'); + } + $select.val( val ).trigger('change'); + }); + + // hide select + $select.hide(); + }, + + mergeOptions: function(){ + + // vars + var $prevOptions = false; + var $prevGroup = false; + + // loop + $('#select2-drop .select2-result-with-children').each(function(){ + + // vars + var $options = $(this).children('ul'); + var $group = $(this).children('.select2-result-label'); + + // compare to previous + if( $prevGroup && $prevGroup.text() === $group.text() ) { + $prevGroup.append( $options.children() ); + $(this).remove(); + return; + } + + // update vars + $prevOptions = $options; + $prevGroup = $group; + + }); + + }, + + getAjaxData: function( term, page ){ + + // create Select2 v4 params + var params = { + term: term, + page: page + } + + // return + return Select2.prototype.getAjaxData.apply(this, [params]); + }, + + }); + + + // manager + var select2Manager = new acf.Model({ + priority: 5, + wait: 'prepare', + initialize: function(){ + + // vars + var locale = acf.get('locale'); + var rtl = acf.get('rtl'); + var l10n = acf.get('select2L10n'); + var version = getVersion(); + + // bail ealry if no l10n + if( !l10n ) { + return false; + } + + // bail early if 'en' + if( locale.indexOf('en') === 0 ) { + return false; + } + + // initialize + if( version == 4 ) { + this.addTranslations4(); + } else if( version == 3 ) { + this.addTranslations3(); + } + }, + + addTranslations4: function(){ + + // vars + var l10n = acf.get('select2L10n'); + var locale = acf.get('locale'); + + // modify local to match html[lang] attribute (used by Select2) + locale = locale.replace('_', '-'); + + // select2L10n + var select2L10n = { + errorLoading: function () { + return l10n.load_fail; + }, + inputTooLong: function (args) { + var overChars = args.input.length - args.maximum; + if( overChars > 1 ) { + return l10n.input_too_long_n.replace( '%d', overChars ); + } + return l10n.input_too_long_1; + }, + inputTooShort: function( args ){ + var remainingChars = args.minimum - args.input.length; + if( remainingChars > 1 ) { + return l10n.input_too_short_n.replace( '%d', remainingChars ); + } + return l10n.input_too_short_1; + }, + loadingMore: function () { + return l10n.load_more; + }, + maximumSelected: function( args ) { + var maximum = args.maximum; + if( maximum > 1 ) { + return l10n.selection_too_long_n.replace( '%d', maximum ); + } + return l10n.selection_too_long_1; + }, + noResults: function () { + return l10n.matches_0; + }, + searching: function () { + return l10n.searching; + } + }; + + // append + jQuery.fn.select2.amd.define('select2/i18n/' + locale, [], function(){ + return select2L10n; + }); + }, + + addTranslations3: function(){ + + // vars + var l10n = acf.get('select2L10n'); + var locale = acf.get('locale'); + + // modify local to match html[lang] attribute (used by Select2) + locale = locale.replace('_', '-'); + + // select2L10n + var select2L10n = { + formatMatches: function( matches ) { + if( matches > 1 ) { + return l10n.matches_n.replace( '%d', matches ); + } + return l10n.matches_1; + }, + formatNoMatches: function() { + return l10n.matches_0; + }, + formatAjaxError: function() { + return l10n.load_fail; + }, + formatInputTooShort: function( input, min ) { + var remainingChars = min - input.length; + if( remainingChars > 1 ) { + return l10n.input_too_short_n.replace( '%d', remainingChars ); + } + return l10n.input_too_short_1; + }, + formatInputTooLong: function( input, max ) { + var overChars = input.length - max; + if( overChars > 1 ) { + return l10n.input_too_long_n.replace( '%d', overChars ); + } + return l10n.input_too_long_1; + }, + formatSelectionTooBig: function( maximum ) { + if( maximum > 1 ) { + return l10n.selection_too_long_n.replace( '%d', maximum ); + } + return l10n.selection_too_long_1; + }, + formatLoadMore: function() { + return l10n.load_more; + }, + formatSearching: function() { + return l10n.searching; + } + }; + + // ensure locales exists + $.fn.select2.locales = $.fn.select2.locales || {}; + + // append + $.fn.select2.locales[ locale ] = select2L10n; + $.extend($.fn.select2.defaults, select2L10n); + } + + }); + +})(jQuery); + +(function($, undefined){ + + acf.tinymce = { + + /* + * defaults + * + * This function will return default mce and qt settings + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + defaults: function(){ + + // bail early if no tinyMCEPreInit + if( typeof tinyMCEPreInit === 'undefined' ) return false; + + // vars + var defaults = { + tinymce: tinyMCEPreInit.mceInit.acf_content, + quicktags: tinyMCEPreInit.qtInit.acf_content + }; + + // return + return defaults; + }, + + + /* + * initialize + * + * This function will initialize the tinymce and quicktags instances + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initialize: function( id, args ){ + + // defaults + args = acf.parseArgs(args, { + tinymce: true, + quicktags: true, + toolbar: 'full', + mode: 'visual', // visual,text + field: false + }); + + // tinymce + if( args.tinymce ) { + this.initializeTinymce( id, args ); + } + + // quicktags + if( args.quicktags ) { + this.initializeQuicktags( id, args ); + } + }, + + + /* + * initializeTinymce + * + * This function will initialize the tinymce instance + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initializeTinymce: function( id, args ){ + + // vars + var $textarea = $('#'+id); + var defaults = this.defaults(); + var toolbars = acf.get('toolbars'); + var field = args.field || false; + var $field = field.$el || false; + + // bail early + if( typeof tinymce === 'undefined' ) return false; + if( !defaults ) return false; + + // check if exists + if( tinymce.get(id) ) { + return this.enable( id ); + } + + // settings + var init = $.extend( {}, defaults.tinymce, args.tinymce ); + init.id = id; + init.selector = '#' + id; + + // toolbar + var toolbar = args.toolbar; + if( toolbar && toolbars && toolbars[toolbar] ) { + + for( var i = 1; i <= 4; i++ ) { + init[ 'toolbar' + i ] = toolbars[toolbar][i] || ''; + } + } + + // event + init.setup = function( ed ){ + + ed.on('change', function(e) { + ed.save(); // save to textarea + $textarea.trigger('change'); + }); + + // Fix bug where Gutenberg does not hear "mouseup" event and tries to select multiple blocks. + ed.on('mouseup', function(e) { + var event = new MouseEvent('mouseup'); + window.dispatchEvent(event); + }); + + // Temporarily comment out. May not be necessary due to wysiwyg field actions. + //ed.on('unload', function(e) { + // acf.tinymce.remove( id ); + //}); + }; + + // disable wp_autoresize_on (no solution yet for fixed toolbar) + init.wp_autoresize_on = false; + + // Enable wpautop allowing value to save without

            tags. + // Only if the "TinyMCE Advanced" plugin hasn't already set this functionality. + if( !init.tadv_noautop ) { + init.wpautop = true; + } + + // hook for 3rd party customization + init = acf.applyFilters('wysiwyg_tinymce_settings', init, id, field); + + // z-index fix (caused too many conflicts) + //if( acf.isset(tinymce,'ui','FloatPanel') ) { + // tinymce.ui.FloatPanel.zIndex = 900000; + //} + + // store settings + tinyMCEPreInit.mceInit[ id ] = init; + + // visual tab is active + if( args.mode == 'visual' ) { + + // init + var result = tinymce.init( init ); + + // get editor + var ed = tinymce.get( id ); + + // validate + if( !ed ) { + return false; + } + + // add reference + ed.acf = args.field; + + // action + acf.doAction('wysiwyg_tinymce_init', ed, ed.id, init, field); + } + }, + + /* + * initializeQuicktags + * + * This function will initialize the quicktags instance + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + initializeQuicktags: function( id, args ){ + + // vars + var defaults = this.defaults(); + + // bail early + if( typeof quicktags === 'undefined' ) return false; + if( !defaults ) return false; + + // settings + var init = $.extend( {}, defaults.quicktags, args.quicktags ); + init.id = id; + + // filter + var field = args.field || false; + var $field = field.$el || false; + init = acf.applyFilters('wysiwyg_quicktags_settings', init, init.id, field); + + // store settings + tinyMCEPreInit.qtInit[ id ] = init; + + // init + var ed = quicktags( init ); + + // validate + if( !ed ) { + return false; + } + + // generate HTML + this.buildQuicktags( ed ); + + // action for 3rd party customization + acf.doAction('wysiwyg_quicktags_init', ed, ed.id, init, field); + }, + + + /* + * buildQuicktags + * + * This function will build the quicktags HTML + * + * @type function + * @date 18/8/17 + * @since 5.6.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + buildQuicktags: function( ed ){ + + var canvas, name, settings, theButtons, html, ed, id, i, use, instanceId, + defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,'; + + canvas = ed.canvas; + name = ed.name; + settings = ed.settings; + html = ''; + theButtons = {}; + use = ''; + instanceId = ed.id; + + // set buttons + if ( settings.buttons ) { + use = ','+settings.buttons+','; + } + + for ( i in edButtons ) { + if ( ! edButtons[i] ) { + continue; + } + + id = edButtons[i].id; + if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) { + continue; + } + + if ( ! edButtons[i].instance || edButtons[i].instance === instanceId ) { + theButtons[id] = edButtons[i]; + + if ( edButtons[i].html ) { + html += edButtons[i].html( name + '_' ); + } + } + } + + if ( use && use.indexOf(',dfw,') !== -1 ) { + theButtons.dfw = new QTags.DFWButton(); + html += theButtons.dfw.html( name + '_' ); + } + + if ( 'rtl' === document.getElementsByTagName( 'html' )[0].dir ) { + theButtons.textdirection = new QTags.TextDirectionButton(); + html += theButtons.textdirection.html( name + '_' ); + } + + ed.toolbar.innerHTML = html; + ed.theButtons = theButtons; + + if ( typeof jQuery !== 'undefined' ) { + jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] ); + } + + }, + + disable: function( id ){ + this.destroyTinymce( id ); + }, + + remove: function( id ){ + this.destroyTinymce( id ); + }, + + destroy: function( id ){ + this.destroyTinymce( id ); + }, + + destroyTinymce: function( id ){ + + // bail early + if( typeof tinymce === 'undefined' ) return false; + + // get editor + var ed = tinymce.get( id ); + + // bail early if no editor + if( !ed ) return false; + + // save + ed.save(); + + // destroy editor + ed.destroy(); + + // return + return true; + }, + + enable: function( id ){ + this.enableTinymce( id ); + }, + + enableTinymce: function( id ){ + + // bail early + if( typeof switchEditors === 'undefined' ) return false; + + // bail ealry if not initialized + if( typeof tinyMCEPreInit.mceInit[ id ] === 'undefined' ) return false; + + // toggle + switchEditors.go( id, 'tmce'); + + // return + return true; + } + }; + + var editorManager = new acf.Model({ + + // hook in before fieldsEventManager, conditions, etc + priority: 5, + + actions: { + 'prepare': 'onPrepare', + 'ready': 'onReady', + }, + onPrepare: function(){ + + // find hidden editor which may exist within a field + var $div = $('#acf-hidden-wp-editor'); + + // move to footer + if( $div.exists() ) { + $div.appendTo('body'); + } + }, + onReady: function(){ + + // Restore wp.editor functions used by tinymce removed in WP5. + if( acf.isset(window,'wp','oldEditor') ) { + wp.editor.autop = wp.oldEditor.autop; + wp.editor.removep = wp.oldEditor.removep; + } + + // bail early if no tinymce + if( !acf.isset(window,'tinymce','on') ) return; + + // restore default activeEditor + tinymce.on('AddEditor', function( data ){ + + // vars + var editor = data.editor; + + // bail early if not 'acf' + if( editor.id.substr(0, 3) !== 'acf' ) return; + + // override if 'content' exists + editor = tinymce.editors.content || editor; + + // update vars + tinymce.activeEditor = editor; + wpActiveEditor = editor.id; + }); + } + }); + +})(jQuery); + +(function($, undefined){ + + /** + * Validator + * + * The model for validating forms + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + var Validator = acf.Model.extend({ + + /** @var string The model identifier. */ + id: 'Validator', + + /** @var object The model data. */ + data: { + + /** @var array The form errors. */ + errors: [], + + /** @var object The form notice. */ + notice: null, + + /** @var string The form status. loading, invalid, valid */ + status: '' + }, + + /** @var object The model events. */ + events: { + 'changed:status': 'onChangeStatus' + }, + + /** + * addErrors + * + * Adds errors to the form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param array errors An array of errors. + * @return void + */ + addErrors: function( errors ){ + errors.map( this.addError, this ); + }, + + /** + * addError + * + * Adds and error to the form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object error An error object containing input and message. + * @return void + */ + addError: function( error ){ + this.data.errors.push( error ); + }, + + /** + * hasErrors + * + * Returns true if the form has errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return bool + */ + hasErrors: function(){ + return this.data.errors.length; + }, + + /** + * clearErrors + * + * Removes any errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + clearErrors: function(){ + return this.data.errors = []; + }, + + /** + * getErrors + * + * Returns the forms errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getErrors: function(){ + return this.data.errors; + }, + + /** + * getFieldErrors + * + * Returns the forms field errors. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getFieldErrors: function(){ + + // vars + var errors = []; + var inputs = []; + + // loop + this.getErrors().map(function(error){ + + // bail early if global + if( !error.input ) return; + + // update if exists + var i = inputs.indexOf(error.input); + if( i > -1 ) { + errors[ i ] = error; + + // update + } else { + errors.push( error ); + inputs.push( error.input ); + } + }); + + // return + return errors; + }, + + /** + * getGlobalErrors + * + * Returns the forms global errors (errors without a specific input). + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return array + */ + getGlobalErrors: function(){ + + // return array of errors that contain no input + return this.getErrors().filter(function(error){ + return !error.input; + }); + }, + + /** + * showErrors + * + * Displays all errors for this form. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + showErrors: function(){ + + // bail early if no errors + if( !this.hasErrors() ) { + return; + } + + // vars + var fieldErrors = this.getFieldErrors(); + var globalErrors = this.getGlobalErrors(); + + // vars + var errorCount = 0; + var $scrollTo = false; + + // loop + fieldErrors.map(function( error ){ + + // get input + var $input = this.$('[name="' + error.input + '"]').first(); + + // if $_POST value was an array, this $input may not exist + if( !$input.length ) { + $input = this.$('[name^="' + error.input + '"]').first(); + } + + // bail early if input doesn't exist + if( !$input.length ) { + return; + } + + // increase + errorCount++; + + // get field + var field = acf.getClosestField( $input ); + + // show error + field.showError( error.message ); + + // set $scrollTo + if( !$scrollTo ) { + $scrollTo = field.$el; + } + }, this); + + // errorMessage + var errorMessage = acf.__('Validation failed'); + globalErrors.map(function( error ){ + errorMessage += '. ' + error.message; + }); + if( errorCount == 1 ) { + errorMessage += '. ' + acf.__('1 field requires attention'); + } else if( errorCount > 1 ) { + errorMessage += '. ' + acf.__('%d fields require attention').replace('%d', errorCount); + } + + // notice + if( this.has('notice') ) { + this.get('notice').update({ + type: 'error', + text: errorMessage + }); + } else { + var notice = acf.newNotice({ + type: 'error', + text: errorMessage, + target: this.$el + }); + this.set('notice', notice); + } + + // if no $scrollTo, set to message + if( !$scrollTo ) { + $scrollTo = this.get('notice').$el; + } + + // timeout + setTimeout(function(){ + $("html, body").animate({ scrollTop: $scrollTo.offset().top - ( $(window).height() / 2 ) }, 500); + }, 10); + }, + + /** + * onChangeStatus + * + * Update the form class when changing the 'status' data + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The form element. + * @param string value The new status. + * @param string prevValue The old status. + * @return void + */ + onChangeStatus: function( e, $el, value, prevValue ){ + this.$el.removeClass('is-'+prevValue).addClass('is-'+value); + }, + + /** + * validate + * + * Vaildates the form via AJAX. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object args A list of settings to customize the validation process. + * @return bool True if the form is valid. + */ + validate: function( args ){ + + // default args + args = acf.parseArgs(args, { + + // trigger event + event: false, + + // reset the form after submit + reset: false, + + // loading callback + loading: function(){}, + + // complete callback + complete: function(){}, + + // failure callback + failure: function(){}, + + // success callback + success: function( $form ){ + $form.submit(); + } + }); + + // return true if is valid - allows form submit + if( this.get('status') == 'valid' ) { + return true; + } + + // return false if is currently validating - prevents form submit + if( this.get('status') == 'validating' ) { + return false; + } + + // return true if no ACF fields exist (no need to validate) + if( !this.$('.acf-field').length ) { + return true; + } + + // if event is provided, create a new success callback. + if( args.event ) { + var event = $.Event(null, args.event); + args.success = function(){ + acf.enableSubmit( $(event.target) ).trigger( event ); + } + } + + // action for 3rd party + acf.doAction('validation_begin', this.$el); + + // lock form + acf.lockForm( this.$el ); + + // loading callback + args.loading( this.$el, this ); + + // update status + this.set('status', 'validating'); + + // success callback + var onSuccess = function( json ){ + + // validate + if( !acf.isAjaxSuccess(json) ) { + return; + } + + // filter + var data = acf.applyFilters('validation_complete', json.data, this.$el, this); + + // add errors + if( !data.valid ) { + this.addErrors( data.errors ); + } + }; + + // complete + var onComplete = function(){ + + // unlock form + acf.unlockForm( this.$el ); + + // failure + if( this.hasErrors() ) { + + // update status + this.set('status', 'invalid'); + + // action + acf.doAction('validation_failure', this.$el, this); + + // display errors + this.showErrors(); + + // failure callback + args.failure( this.$el, this ); + + // success + } else { + + // update status + this.set('status', 'valid'); + + // remove previous error message + if( this.has('notice') ) { + this.get('notice').update({ + type: 'success', + text: acf.__('Validation successful'), + timeout: 1000 + }); + } + + // action + acf.doAction('validation_success', this.$el, this); + acf.doAction('submit', this.$el); + + // success callback (submit form) + args.success( this.$el, this ); + + // lock form + acf.lockForm( this.$el ); + + // reset + if( args.reset ) { + this.reset(); + } + } + + // complete callback + args.complete( this.$el, this ); + + // clear errors + this.clearErrors(); + }; + + // serialize form data + var data = acf.serialize( this.$el ); + data.action = 'acf/validate_save_post'; + + // ajax + $.ajax({ + url: acf.get('ajaxurl'), + data: acf.prepareForAjax(data), + type: 'post', + dataType: 'json', + context: this, + success: onSuccess, + complete: onComplete + }); + + // return false to fail validation and allow AJAX + return false + }, + + /** + * setup + * + * Called during the constructor function to setup this instance + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return void + */ + setup: function( $form ){ + + // set $el + this.$el = $form; + }, + + /** + * reset + * + * Rests the validation to be used again. + * + * @date 6/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + reset: function(){ + + // reset data + this.set('errors', []); + this.set('notice', null); + this.set('status', ''); + + // unlock form + acf.unlockForm( this.$el ); + } + }); + + /** + * getValidator + * + * Returns the instance for a given form element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $el The form element. + * @return object + */ + var getValidator = function( $el ){ + + // instantiate + var validator = $el.data('acf'); + if( !validator ) { + validator = new Validator( $el ); + } + + // return + return validator; + }; + + /** + * acf.validateForm + * + * A helper function for the Validator.validate() function. + * Returns true if form is valid, or fetches a validation request and returns false. + * + * @date 4/4/18 + * @since 5.6.9 + * + * @param object args A list of settings to customize the validation process. + * @return bool + */ + + acf.validateForm = function( args ){ + return getValidator( args.form ).validate( args ); + }; + + /** + * acf.enableSubmit + * + * Enables a submit button and returns the element. + * + * @date 30/8/18 + * @since 5.7.4 + * + * @param jQuery $submit The submit button. + * @return jQuery + */ + acf.enableSubmit = function( $submit ){ + return $submit.removeClass('disabled'); + }; + + /** + * acf.disableSubmit + * + * Disables a submit button and returns the element. + * + * @date 30/8/18 + * @since 5.7.4 + * + * @param jQuery $submit The submit button. + * @return jQuery + */ + acf.disableSubmit = function( $submit ){ + return $submit.addClass('disabled'); + }; + + /** + * acf.showSpinner + * + * Shows the spinner element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $spinner The spinner element. + * @return jQuery + */ + acf.showSpinner = function( $spinner ){ + $spinner.addClass('is-active'); // add class (WP > 4.2) + $spinner.css('display', 'inline-block'); // css (WP < 4.2) + return $spinner; + }; + + /** + * acf.hideSpinner + * + * Hides the spinner element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $spinner The spinner element. + * @return jQuery + */ + acf.hideSpinner = function( $spinner ){ + $spinner.removeClass('is-active'); // add class (WP > 4.2) + $spinner.css('display', 'none'); // css (WP < 4.2) + return $spinner; + }; + + /** + * acf.lockForm + * + * Locks a form by disabeling its primary inputs and showing a spinner. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + acf.lockForm = function( $form ){ + + // vars + var $wrap = findSubmitWrap( $form ); + var $submit = $wrap.find('.button, [type="submit"]'); + var $spinner = $wrap.find('.spinner, .acf-spinner'); + + // hide all spinners (hides the preview spinner) + acf.hideSpinner( $spinner ); + + // lock + acf.disableSubmit( $submit ); + acf.showSpinner( $spinner.last() ); + return $form; + }; + + /** + * acf.unlockForm + * + * Unlocks a form by enabeling its primary inputs and hiding all spinners. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + acf.unlockForm = function( $form ){ + + // vars + var $wrap = findSubmitWrap( $form ); + var $submit = $wrap.find('.button, [type="submit"]'); + var $spinner = $wrap.find('.spinner, .acf-spinner'); + + // unlock + acf.enableSubmit( $submit ); + acf.hideSpinner( $spinner ); + return $form; + }; + + /** + * findSubmitWrap + * + * An internal function to find the 'primary' form submit wrapping element. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return jQuery + */ + var findSubmitWrap = function( $form ){ + + // default post submit div + var $wrap = $form.find('#submitdiv'); + if( $wrap.length ) { + return $wrap; + } + + // 3rd party publish box + var $wrap = $form.find('#submitpost'); + if( $wrap.length ) { + return $wrap; + } + + // term, user + var $wrap = $form.find('p.submit').last(); + if( $wrap.length ) { + return $wrap; + } + + // front end form + var $wrap = $form.find('.acf-form-submit'); + if( $wrap.length ) { + return $wrap; + } + + // default + return $form; + }; + + /** + * acf.validation + * + * Global validation logic + * + * @date 4/4/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + acf.validation = new acf.Model({ + + /** @var string The model identifier. */ + id: 'validation', + + /** @var bool The active state. Set to false before 'prepare' to prevent validation. */ + active: true, + + /** @var string The model initialize time. */ + wait: 'prepare', + + /** @var object The model actions. */ + actions: { + 'ready': 'addInputEvents', + 'append': 'addInputEvents' + }, + + /** @var object The model events. */ + events: { + 'click input[type="submit"]': 'onClickSubmit', + 'click button[type="submit"]': 'onClickSubmit', + //'click #editor .editor-post-publish-button': 'onClickSubmitGutenberg', + 'click #save-post': 'onClickSave', + 'submit form#post': 'onSubmitPost', + 'submit form': 'onSubmit', + }, + + /** + * initialize + * + * Called when initializing the model. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + initialize: function(){ + + // check 'validation' setting + if( !acf.get('validation') ) { + this.active = false; + this.actions = {}; + this.events = {}; + } + }, + + /** + * enable + * + * Enables validation. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + enable: function(){ + this.active = true; + }, + + /** + * disable + * + * Disables validation. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param void + * @return void + */ + disable: function(){ + this.active = false; + }, + + /** + * reset + * + * Rests the form validation to be used again + * + * @date 6/9/18 + * @since 5.7.5 + * + * @param jQuery $form The form element. + * @return void + */ + reset: function( $form ){ + getValidator( $form ).reset(); + }, + + /** + * addInputEvents + * + * Adds 'invalid' event listeners to HTML inputs. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param jQuery $el The element being added / readied. + * @return void + */ + addInputEvents: function( $el ){ + + // vars + var $inputs = $('.acf-field [name]', $el); + + // check + if( $inputs.length ) { + this.on( $inputs, 'invalid', 'onInvalid' ); + } + }, + + /** + * onInvalid + * + * Callback for the 'invalid' event. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onInvalid: function( e, $el ){ + + // prevent default + // - prevents browser error message + // - also fixes chrome bug where 'hidden-by-tab' field throws focus error + e.preventDefault(); + + // vars + var $form = $el.closest('form'); + + // check form exists + if( $form.length ) { + + // add error to validator + getValidator( $form ).addError({ + input: $el.attr('name'), + message: e.target.validationMessage + }); + + // trigger submit on $form + // - allows for "save", "preview" and "publish" to work + $form.submit(); + } + }, + + /** + * onClickSubmit + * + * Callback when clicking submit. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSubmit: function( e, $el ){ + + // store the "click event" for later use in this.onSubmit() + this.set('originalEvent', e); + }, + + /** + * onClickSave + * + * Set ignore to true when saving a draft. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSave: function( e, $el ) { + this.set('ignore', true); + }, + + /** + * onClickSubmitGutenberg + * + * Custom validation event for the gutenberg editor. + * + * @date 29/10/18 + * @since 5.8.0 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onClickSubmitGutenberg: function( e, $el ){ + + // validate + var valid = acf.validateForm({ + form: $('#editor'), + event: e, + reset: true, + failure: function( $form, validator ){ + var $notice = validator.get('notice').$el; + $notice.appendTo('.components-notice-list'); + $notice.find('.acf-notice-dismiss').removeClass('small'); + } + }); + + // if not valid, stop event and allow validation to continue + if( !valid ) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + }, + + /** + * onSubmitPost + * + * Callback when the 'post' form is submit. + * + * @date 5/3/19 + * @since 5.7.13 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onSubmitPost: function( e, $el ) { + + // Check if is preview. + if( $('input#wp-preview').val() === 'dopreview' ) { + + // Ignore validation. + this.set('ignore', true); + + // Unlock form to fix conflict with core "submit.edit-post" event causing all submit buttons to be disabled. + acf.unlockForm( $el ) + } + }, + + /** + * onSubmit + * + * Callback when the form is submit. + * + * @date 4/9/18 + * @since 5.7.5 + * + * @param object e The event object. + * @param jQuery $el The input element. + * @return void + */ + onSubmit: function( e, $el ){ + + // Allow form to submit if... + if( + // Validation has been disabled. + !this.active + + // Or this event is to be ignored. + || this.get('ignore') + + // Or this event has already been prevented. + || e.isDefaultPrevented() + ) { + // Return early and call reset function. + return this.allowSubmit(); + } + + // Validate form. + var valid = acf.validateForm({ + form: $el, + event: this.get('originalEvent') + }); + + // If not valid, stop event to prevent form submit. + if( !valid ) { + e.preventDefault(); + } + }, + + /** + * allowSubmit + * + * Resets data during onSubmit when the form is allowed to submit. + * + * @date 5/3/19 + * @since 5.7.13 + * + * @param void + * @return void + */ + allowSubmit: function(){ + + // Reset "ignore" state. + this.set('ignore', false); + + // Reset "originalEvent" object. + this.set('originalEvent', false); + + // Return true + return true; + } + }); + +})(jQuery); + +(function($, undefined){ + + /** + * refreshHelper + * + * description + * + * @date 1/7/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var refreshHelper = new acf.Model({ + priority: 90, + timeout: 0, + actions: { + 'new_field': 'refresh', + 'show_field': 'refresh', + 'hide_field': 'refresh', + 'remove_field': 'refresh' + }, + refresh: function(){ + clearTimeout( this.timeout ); + this.timeout = setTimeout(function(){ + acf.doAction('refresh'); + }, 0); + } + }); + + /** + * mountHelper + * + * Adds compatiblity for the 'unmount' and 'remount' actions added in 5.8.0 + * + * @date 7/3/19 + * @since 5.7.14 + * + * @param void + * @return void + */ + var mountHelper = new acf.Model({ + priority: 1, + actions: { + 'sortstart': 'onSortstart', + 'sortstop': 'onSortstop' + }, + onSortstart: function( $item ){ + acf.doAction('unmount', $item); + }, + onSortstop: function( $item ){ + acf.doAction('remount', $item); + } + }); + + /** + * sortableHelper + * + * Adds compatibility for sorting a

            element + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var sortableHelper = new acf.Model({ + actions: { + 'sortstart': 'onSortstart' + }, + onSortstart: function( $item, $placeholder ){ + + // if $item is a tr, apply some css to the elements + if( $item.is('tr') ) { + + // replace $placeholder children with a single td + // fixes "width calculation issues" due to conditional logic hiding some children + $placeholder.html(''); + + // add helper class to remove absolute positioning + $item.addClass('acf-sortable-tr-helper'); + + // set fixed widths for children + $item.children().each(function(){ + $(this).width( $(this).width() ); + }); + + // mimic height + $placeholder.height( $item.height() + 'px' ); + + // remove class + $item.removeClass('acf-sortable-tr-helper'); + } + } + }); + + /** + * duplicateHelper + * + * Fixes browser bugs when duplicating an element + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var duplicateHelper = new acf.Model({ + actions: { + 'after_duplicate': 'onAfterDuplicate' + }, + onAfterDuplicate: function( $el, $el2 ){ + + // get original values + var vals = []; + $el.find('select').each(function(i){ + vals.push( $(this).val() ); + }); + + // set duplicate values + $el2.find('select').each(function(i){ + $(this).val( vals[i] ); + }); + } + }); + + /** + * tableHelper + * + * description + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var tableHelper = new acf.Model({ + + id: 'tableHelper', + + priority: 20, + + actions: { + 'refresh': 'renderTables' + }, + + renderTables: function( $el ){ + + // loop + var self = this; + $('.acf-table:visible').each(function(){ + self.renderTable( $(this) ); + }); + }, + + renderTable: function( $table ){ + + // vars + var $ths = $table.find('> thead > tr:visible > th[data-key]'); + var $tds = $table.find('> tbody > tr:visible > td[data-key]'); + + // bail early if no thead + if( !$ths.length || !$tds.length ) { + return false; + } + + + // visiblity + $ths.each(function( i ){ + + // vars + var $th = $(this); + var key = $th.data('key'); + var $cells = $tds.filter('[data-key="' + key + '"]'); + var $hidden = $cells.filter('.acf-hidden'); + + // always remove empty and allow cells to be hidden + $cells.removeClass('acf-empty'); + + // hide $th if all cells are hidden + if( $cells.length === $hidden.length ) { + acf.hide( $th ); + + // force all hidden cells to appear empty + } else { + acf.show( $th ); + $hidden.addClass('acf-empty'); + } + }); + + + // clear width + $ths.css('width', 'auto'); + + // get visible + $ths = $ths.not('.acf-hidden'); + + // vars + var availableWidth = 100; + var colspan = $ths.length; + + // set custom widths first + var $fixedWidths = $ths.filter('[data-width]'); + $fixedWidths.each(function(){ + var width = $(this).data('width'); + $(this).css('width', width + '%'); + availableWidth -= width; + }); + + // set auto widths + var $auoWidths = $ths.not('[data-width]'); + if( $auoWidths.length ) { + var width = availableWidth / $auoWidths.length; + $auoWidths.css('width', width + '%'); + availableWidth = 0; + } + + // avoid stretching issue + if( availableWidth > 0 ) { + $ths.last().css('width', 'auto'); + } + + + // update colspan on collapsed + $tds.filter('.-collapsed-target').each(function(){ + + // vars + var $td = $(this); + + // check if collapsed + if( $td.parent().hasClass('-collapsed') ) { + $td.attr('colspan', $ths.length); + } else { + $td.removeAttr('colspan'); + } + }); + } + }); + + + /** + * fieldsHelper + * + * description + * + * @date 6/3/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var fieldsHelper = new acf.Model({ + + id: 'fieldsHelper', + + priority: 30, + + actions: { + 'refresh': 'renderGroups' + }, + + renderGroups: function(){ + + // loop + var self = this; + $('.acf-fields:visible').each(function(){ + self.renderGroup( $(this) ); + }); + }, + + renderGroup: function( $el ){ + + // vars + var top = 0; + var height = 0; + var $row = $(); + + // get fields + var $fields = $el.children('.acf-field[data-width]:visible'); + + // bail early if no fields + if( !$fields.length ) { + return false; + } + + // bail ealry if is .-left + if( $el.hasClass('-left') ) { + $fields.removeAttr('data-width'); + $fields.css('width', 'auto'); + return false; + } + + // reset fields + $fields.removeClass('-r0 -c0').css({'min-height': 0}); + + // loop + $fields.each(function( i ){ + + // vars + var $field = $(this); + var position = $field.position(); + var thisTop = Math.ceil( position.top ); + var thisLeft = Math.ceil( position.left ); + + // detect change in row + if( $row.length && thisTop > top ) { + + // set previous heights + $row.css({'min-height': height+'px'}); + + // update position due to change in row above + position = $field.position(); + thisTop = Math.ceil( position.top ); + thisLeft = Math.ceil( position.left ); + + // reset vars + top = 0; + height = 0; + $row = $(); + } + + // rtl + if( acf.get('rtl') ) { + thisLeft = Math.ceil( $field.parent().width() - (position.left + $field.outerWidth()) ); + } + + // add classes + if( thisTop == 0 ) { + $field.addClass('-r0'); + } else if( thisLeft == 0 ) { + $field.addClass('-c0'); + } + + // get height after class change + // - add 1 for subpixel rendering + var thisHeight = Math.ceil( $field.outerHeight() ) + 1; + + // set height + height = Math.max( height, thisHeight ); + + // set y + top = Math.max( top, thisTop ); + + // append + $row = $row.add( $field ); + }); + + // clean up + if( $row.length ) { + $row.css({'min-height': height+'px'}); + } + } + }); + +})(jQuery); + +(function($, undefined){ + + /** + * acf.newCompatibility + * + * Inserts a new __proto__ object compatibility layer + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param object instance The object to modify. + * @param object compatibilty Optional. The compatibilty layer. + * @return object compatibilty + */ + + acf.newCompatibility = function( instance, compatibilty ){ + + // defaults + compatibilty = compatibilty || {}; + + // inherit __proto_- + compatibilty.__proto__ = instance.__proto__; + + // inject + instance.__proto__ = compatibilty; + + // reference + instance.compatibility = compatibilty; + + // return + return compatibilty; + }; + + /** + * acf.getCompatibility + * + * Returns the compatibility layer for a given instance + * + * @date 13/3/18 + * @since 5.6.9 + * + * @param object instance The object to look in. + * @return object|null compatibility The compatibility object or null on failure. + */ + + acf.getCompatibility = function( instance ) { + return instance.compatibility || null; + }; + + /** + * acf (compatibility) + * + * Compatibility layer for the acf object + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var _acf = acf.newCompatibility(acf, { + + // storage + l10n: {}, + o: {}, + fields: {}, + + // changed function names + update: acf.set, + add_action: acf.addAction, + remove_action: acf.removeAction, + do_action: acf.doAction, + add_filter: acf.addFilter, + remove_filter: acf.removeFilter, + apply_filters: acf.applyFilters, + parse_args: acf.parseArgs, + disable_el: acf.disable, + disable_form: acf.disable, + enable_el: acf.enable, + enable_form: acf.enable, + update_user_setting: acf.updateUserSetting, + prepare_for_ajax: acf.prepareForAjax, + is_ajax_success: acf.isAjaxSuccess, + remove_el: acf.remove, + remove_tr: acf.remove, + str_replace: acf.strReplace, + render_select: acf.renderSelect, + get_uniqid: acf.uniqid, + serialize_form: acf.serialize, + esc_html: acf.strEscape, + str_sanitize: acf.strSanitize, + + }); + + _acf._e = function( k1, k2 ){ + + // defaults + k1 = k1 || ''; + k2 = k2 || ''; + + // compability + var compatKey = k2 ? k1 + '.' + k2 : k1; + var compats = { + 'image.select': 'Select Image', + 'image.edit': 'Edit Image', + 'image.update': 'Update Image' + }; + if( compats[compatKey] ) { + return acf.__(compats[compatKey]); + } + + // try k1 + var string = this.l10n[ k1 ] || ''; + + // try k2 + if( k2 ) { + string = string[ k2 ] || ''; + } + + // return + return string; + }; + + _acf.get_selector = function( s ) { + + // vars + var selector = '.acf-field'; + + // bail early if no search + if( !s ) { + return selector; + } + + // compatibility with object + if( $.isPlainObject(s) ) { + if( $.isEmptyObject(s) ) { + return selector; + } else { + for( var k in s ) { s = s[k]; break; } + } + } + + // append + selector += '-' + s; + + // replace underscores (split/join replaces all and is faster than regex!) + selector = acf.strReplace('_', '-', selector); + + // remove potential double up + selector = acf.strReplace('field-field-', 'field-', selector); + + // return + return selector; + }; + + _acf.get_fields = function( s, $el, all ){ + + // args + var args = { + is: s || '', + parent: $el || false, + suppressFilters: all || false, + }; + + // change 'field_123' to '.acf-field-123' + if( args.is ) { + args.is = this.get_selector( args.is ); + } + + // return + return acf.findFields(args); + }; + + _acf.get_field = function( s, $el ){ + + // get fields + var $fields = this.get_fields.apply(this, arguments); + + // return + if( $fields.length ) { + return $fields.first(); + } else { + return false; + } + }; + + _acf.get_closest_field = function( $el, s ){ + return $el.closest( this.get_selector(s) ); + }; + + _acf.get_field_wrap = function( $el ){ + return $el.closest( this.get_selector() ); + }; + + _acf.get_field_key = function( $field ){ + return $field.data('key'); + }; + + _acf.get_field_type = function( $field ){ + return $field.data('type'); + }; + + _acf.get_data = function( $el, defaults ){ + return acf.parseArgs( $el.data(), defaults ); + }; + + _acf.maybe_get = function( obj, key, value ){ + + // default + if( value === undefined ) { + value = null; + } + + // get keys + keys = String(key).split('.'); + + // acf.isget + for( var i = 0; i < keys.length; i++ ) { + if( !obj.hasOwnProperty(keys[i]) ) { + return value; + } + obj = obj[ keys[i] ]; + } + return obj; + }; + + + /** + * hooks + * + * Modify add_action and add_filter functions to add compatibility with changed $field parameter + * Using the acf.add_action() or acf.add_filter() functions will interpret new field parameters as jQuery $field + * + * @date 12/5/18 + * @since 5.6.9 + * + * @param void + * @return void + */ + + var compatibleArgument = function( arg ){ + return ( arg instanceof acf.Field ) ? arg.$el : arg; + }; + + var compatibleArguments = function( args ){ + return acf.arrayArgs( args ).map( compatibleArgument ); + } + + var compatibleCallback = function( origCallback ){ + return function(){ + + // convert to compatible arguments + if( arguments.length ) { + var args = compatibleArguments(arguments); + + // add default argument for 'ready', 'append' and 'load' events + } else { + var args = [ $(document) ]; + } + + // return + return origCallback.apply(this, args); + } + } + + _acf.add_action = function( action, callback, priority, context ){ + + // handle multiple actions + var actions = action.split(' '); + var length = actions.length; + if( length > 1 ) { + for( var i = 0; i < length; i++) { + action = actions[i]; + _acf.add_action.apply(this, arguments); + } + return this; + } + + // single + var callback = compatibleCallback(callback); + return acf.addAction.apply(this, arguments); + }; + + _acf.add_filter = function( action, callback, priority, context ){ + var callback = compatibleCallback(callback); + return acf.addFilter.apply(this, arguments); + }; + + /* + * acf.model + * + * This model acts as a scafold for action.event driven modules + * + * @type object + * @date 8/09/2014 + * @since 5.0.0 + * + * @param (object) + * @return (object) + */ + + _acf.model = { + actions: {}, + filters: {}, + events: {}, + extend: function( args ){ + + // extend + var model = $.extend( {}, this, args ); + + // setup actions + $.each(model.actions, function( name, callback ){ + model._add_action( name, callback ); + }); + + // setup filters + $.each(model.filters, function( name, callback ){ + model._add_filter( name, callback ); + }); + + // setup events + $.each(model.events, function( name, callback ){ + model._add_event( name, callback ); + }); + + // return + return model; + }, + + _add_action: function( name, callback ) { + + // split + var model = this, + data = name.split(' '); + + // add missing priority + var name = data[0] || '', + priority = data[1] || 10; + + // add action + acf.add_action(name, model[ callback ], priority, model); + + }, + + _add_filter: function( name, callback ) { + + // split + var model = this, + data = name.split(' '); + + // add missing priority + var name = data[0] || '', + priority = data[1] || 10; + + // add action + acf.add_filter(name, model[ callback ], priority, model); + }, + + _add_event: function( name, callback ) { + + // vars + var model = this, + i = name.indexOf(' '), + event = (i > 0) ? name.substr(0,i) : name, + selector = (i > 0) ? name.substr(i+1) : ''; + + // event + var fn = function( e ){ + + // append $el to event object + e.$el = $(this); + + // append $field to event object (used in field group) + if( acf.field_group ) { + e.$field = e.$el.closest('.acf-field-object'); + } + + // event + if( typeof model.event === 'function' ) { + e = model.event( e ); + } + + // callback + model[ callback ].apply(model, arguments); + + }; + + // add event + if( selector ) { + $(document).on(event, selector, fn); + } else { + $(document).on(event, fn); + } + }, + + get: function( name, value ){ + + // defaults + value = value || null; + + // get + if( typeof this[ name ] !== 'undefined' ) { + value = this[ name ]; + } + + // return + return value; + }, + + set: function( name, value ){ + + // set + this[ name ] = value; + + // function for 3rd party + if( typeof this[ '_set_' + name ] === 'function' ) { + this[ '_set_' + name ].apply(this); + } + + // return for chaining + return this; + } + }; + + /* + * field + * + * This model sets up many of the field's interactions + * + * @type function + * @date 21/02/2014 + * @since 3.5.1 + * + * @param n/a + * @return n/a + */ + + _acf.field = acf.model.extend({ + type: '', + o: {}, + $field: null, + _add_action: function( name, callback ) { + + // vars + var model = this; + + // update name + name = name + '_field/type=' + model.type; + + // add action + acf.add_action(name, function( $field ){ + + // focus + model.set('$field', $field); + + // callback + model[ callback ].apply(model, arguments); + }); + }, + + _add_filter: function( name, callback ) { + + // vars + var model = this; + + // update name + name = name + '_field/type=' + model.type; + + // add action + acf.add_filter(name, function( $field ){ + + // focus + model.set('$field', $field); + + // callback + model[ callback ].apply(model, arguments); + }); + }, + + _add_event: function( name, callback ) { + + // vars + var model = this, + event = name.substr(0,name.indexOf(' ')), + selector = name.substr(name.indexOf(' ')+1), + context = acf.get_selector(model.type); + + // add event + $(document).on(event, context + ' ' + selector, function( e ){ + + // vars + var $el = $(this); + var $field = acf.get_closest_field( $el, model.type ); + + // bail early if no field + if( !$field.length ) return; + + // focus + if( !$field.is(model.$field) ) { + model.set('$field', $field); + } + + // append to event + e.$el = $el; + e.$field = $field; + + // callback + model[ callback ].apply(model, [e]); + }); + }, + + _set_$field: function(){ + + // callback + if( typeof this.focus === 'function' ) { + this.focus(); + } + }, + + // depreciated + doFocus: function( $field ){ + return this.set('$field', $field); + } + }); + + + /** + * validation + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + var _validation = acf.newCompatibility(acf.validation, { + remove_error: function( $field ){ + acf.getField( $field ).removeError(); + }, + add_warning: function( $field, message ){ + acf.getField( $field ).showNotice({ + text: message, + type: 'warning', + timeout: 1000 + }); + }, + fetch: acf.validateForm, + enableSubmit: acf.enableSubmit, + disableSubmit: acf.disableSubmit, + showSpinner: acf.showSpinner, + hideSpinner: acf.hideSpinner, + unlockForm: acf.unlockForm, + lockForm: acf.lockForm + }); + + + /** + * tooltip + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.tooltip = { + + tooltip: function( text, $el ){ + + var tooltip = acf.newTooltip({ + text: text, + target: $el + }); + + // return + return tooltip.$el; + }, + + temp: function( text, $el ){ + + var tooltip = acf.newTooltip({ + text: text, + target: $el, + timeout: 250 + }); + }, + + confirm: function( $el, callback, text, button_y, button_n ){ + + var tooltip = acf.newTooltip({ + confirm: true, + text: text, + target: $el, + confirm: function(){ + callback(true); + }, + cancel: function(){ + callback(false); + } + }); + }, + + confirm_remove: function( $el, callback ){ + + var tooltip = acf.newTooltip({ + confirmRemove: true, + target: $el, + confirm: function(){ + callback(true); + }, + cancel: function(){ + callback(false); + } + }); + }, + }; + + /** + * tooltip + * + * description + * + * @date 15/2/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.media = new acf.Model({ + activeFrame: false, + actions: { + 'new_media_popup': 'onNewMediaPopup' + }, + + frame: function(){ + return this.activeFrame; + }, + + onNewMediaPopup: function( popup ){ + this.activeFrame = popup.frame; + }, + + popup: function( props ){ + + // update props + if( props.mime_types ) { + props.allowedTypes = props.mime_types; + } + if( props.id ) { + props.attachment = props.id; + } + + // new + var popup = acf.newMediaPopup( props ); + + // append +/* + if( props.selected ) { + popup.selected = props.selected; + } +*/ + + // return + return popup.frame; + } + }); + + + /** + * Select2 + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.select2 = { + init: function( $select, args, $field ){ + + // compatible args + if( args.allow_null ) { + args.allowNull = args.allow_null; + } + if( args.ajax_action ) { + args.ajaxAction = args.ajax_action; + } + if( $field ) { + args.field = acf.getField($field); + } + + // return + return acf.newSelect2( $select, args ); + }, + + destroy: function( $select ){ + return acf.getInstance( $select ).destroy(); + + }, + }; + + /** + * postbox + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + _acf.postbox = { + render: function( args ){ + + // compatible args + if( args.edit_url ) { + args.editLink = args.edit_url; + } + if( args.edit_title ) { + args.editTitle = args.edit_title; + } + + // return + return acf.newPostbox( args ); + } + }; + + /** + * acf.screen + * + * description + * + * @date 11/6/18 + * @since 5.6.9 + * + * @param type $var Description. Default. + * @return type Description. + */ + + acf.newCompatibility(acf.screen, { + update: function(){ + return this.set.apply(this, arguments); + }, + fetch: acf.screen.check + }); + _acf.ajax = acf.screen; + +})(jQuery); + +// @codekit-prepend "_acf.js"; +// @codekit-prepend "_acf-hooks.js"; +// @codekit-prepend "_acf-model.js"; +// @codekit-prepend "_acf-popup.js"; +// @codekit-prepend "_acf-unload.js"; +// @codekit-prepend "_acf-panel.js"; +// @codekit-prepend "_acf-notice.js"; +// @codekit-prepend "_acf-postbox.js"; +// @codekit-prepend "_acf-tooltip.js"; +// @codekit-prepend "_acf-field.js"; +// @codekit-prepend "_acf-fields.js"; +// @codekit-prepend "_acf-field-accordion.js"; +// @codekit-prepend "_acf-field-button-group.js"; +// @codekit-prepend "_acf-field-checkbox.js"; +// @codekit-prepend "_acf-field-color-picker.js"; +// @codekit-prepend "_acf-field-date-picker.js"; +// @codekit-prepend "_acf-field-date-time-picker.js"; +// @codekit-prepend "_acf-field-google-map.js"; +// @codekit-prepend "_acf-field-image.js"; +// @codekit-prepend "_acf-field-file.js"; +// @codekit-prepend "_acf-field-link.js"; +// @codekit-prepend "_acf-field-oembed.js"; +// @codekit-prepend "_acf-field-radio.js"; +// @codekit-prepend "_acf-field-range.js"; +// @codekit-prepend "_acf-field-relationship.js"; +// @codekit-prepend "_acf-field-select.js"; +// @codekit-prepend "_acf-field-tab.js"; +// @codekit-prepend "_acf-field-post-object.js"; +// @codekit-prepend "_acf-field-page-link.js"; +// @codekit-prepend "_acf-field-user.js"; +// @codekit-prepend "_acf-field-taxonomy.js"; +// @codekit-prepend "_acf-field-time-picker.js"; +// @codekit-prepend "_acf-field-true-false.js"; +// @codekit-prepend "_acf-field-url.js"; +// @codekit-prepend "_acf-field-wysiwyg.js"; +// @codekit-prepend "_acf-condition.js"; +// @codekit-prepend "_acf-conditions.js"; +// @codekit-prepend "_acf-condition-types.js"; +// @codekit-prepend "_acf-media.js"; +// @codekit-prepend "_acf-screen.js"; +// @codekit-prepend "_acf-select2.js"; +// @codekit-prepend "_acf-tinymce.js"; +// @codekit-prepend "_acf-validation.js"; +// @codekit-prepend "_acf-helpers.js"; +// @codekit-prepend "_acf-compatibility"; diff --git a/wp-content/plugins/advanced-custom-fields/assets/js/acf-input.min.js b/wp-content/plugins/advanced-custom-fields/assets/js/acf-input.min.js new file mode 100644 index 0000000..81b2fe2 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/assets/js/acf-input.min.js @@ -0,0 +1,4 @@ +!function(t,e){var i={};window.acf=i,i.data={},i.get=function(t){return this.data[t]||null},i.has=function(t){return null!==this.get(t)},i.set=function(t,e){return this.data[t]=e,this};var n=0;i.uniqueId=function(t){var e=++n+"";return t?t+e:e},i.uniqueArray=function(t){function e(t,e,i){return i.indexOf(t)===e}return t.filter(e)};var a="";i.uniqid=function(t,e){var i;void 0===t&&(t="");var n=function(t,e){return e<(t=parseInt(t,10).toString(16)).length?t.slice(t.length-e):e>t.length?Array(e-t.length+1).join("0")+t:t};return a||(a=Math.floor(123456789*Math.random())),a++,i=t,i+=n(parseInt((new Date).getTime()/1e3,10),8),i+=n(a,5),e&&(i+=(10*Math.random()).toFixed(8).toString()),i},i.strReplace=function(t,e,i){return i.split(t).join(e)},i.strCamelCase=function(t){return t=(t=t.replace(/[_-]/g," ")).replace(/(?:^\w|\b\w|\s+)/g,function(t,e){return 0==+t?"":0==e?t.toLowerCase():t.toUpperCase()})},i.strPascalCase=function(t){var e=i.strCamelCase(t);return e.charAt(0).toUpperCase()+e.slice(1)},i.strSlugify=function(t){return i.strReplace("_","-",t.toLowerCase())},i.strSanitize=function(t){var e={"À":"A","Ã":"A","Â":"A","Ã":"A","Ä":"A","Ã…":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","ÃŒ":"I","Ã":"I","ÃŽ":"I","Ã":"I","Ã":"D","Ñ":"N","Ã’":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ã":"Y","ß":"s","à":"a","á":"a","â":"a","ã":"a","ä":"a","Ã¥":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ä€":"A","Ä":"a","Ä‚":"A","ă":"a","Ä„":"A","Ä…":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","ÄŠ":"C","Ä‹":"c","ÄŒ":"C","Ä":"c","ÄŽ":"D","Ä":"d","Ä":"D","Ä‘":"d","Ä’":"E","Ä“":"e","Ä”":"E","Ä•":"e","Ä–":"E","Ä—":"e","Ę":"E","Ä™":"e","Äš":"E","Ä›":"e","Äœ":"G","Ä":"g","Äž":"G","ÄŸ":"g","Ä ":"G","Ä¡":"g","Ä¢":"G","Ä£":"g","Ĥ":"H","Ä¥":"h","Ħ":"H","ħ":"h","Ĩ":"I","Ä©":"i","Ī":"I","Ä«":"i","Ĭ":"I","Ä­":"i","Ä®":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ä´":"J","ĵ":"j","Ķ":"K","Ä·":"k","Ĺ":"L","ĺ":"l","Ä»":"L","ļ":"l","Ľ":"L","ľ":"l","Ä¿":"L","Å€":"l","Å":"l","Å‚":"l","Ń":"N","Å„":"n","Å…":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","ÅŒ":"O","Å":"o","ÅŽ":"O","Å":"o","Å":"O","Å‘":"o","Å’":"OE","Å“":"oe","Å”":"R","Å•":"r","Å–":"R","Å—":"r","Ř":"R","Å™":"r","Åš":"S","Å›":"s","Åœ":"S","Å":"s","Åž":"S","ÅŸ":"s","Å ":"S","Å¡":"s","Å¢":"T","Å£":"t","Ť":"T","Å¥":"t","Ŧ":"T","ŧ":"t","Ũ":"U","Å©":"u","Ū":"U","Å«":"u","Ŭ":"U","Å­":"u","Å®":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Å´":"W","ŵ":"w","Ŷ":"Y","Å·":"y","Ÿ":"Y","Ź":"Z","ź":"z","Å»":"Z","ż":"z","Ž":"Z","ž":"z","Å¿":"s","Æ’":"f","Æ ":"O","Æ¡":"o","Ư":"U","ư":"u","Ç":"A","ÇŽ":"a","Ç":"I","Ç":"i","Ç‘":"O","Ç’":"o","Ç“":"U","Ç”":"u","Ç•":"U","Ç–":"u","Ç—":"U","ǘ":"u","Ç™":"U","Çš":"u","Ç›":"U","Çœ":"u","Ǻ":"A","Ç»":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","Ç¿":"o"," ":"_","'":"","?":"","/":"","\\":"",".":"",",":"","`":"",">":"","<":"",'"':"","[":"","]":"","|":"","{":"","}":"","(":"",")":""},i=/\W/g,n=function(t){return void 0!==e[t]?e[t]:t};return t=(t=t.replace(i,n)).toLowerCase()},i.strMatch=function(t,e){for(var i=0,n=Math.min(t.length,e.length),a=0;a").html(e).text()},i.strEscape=function(e){return t("
            ").text(e).html()},i.parseArgs=function(e,i){return"object"!=typeof e&&(e={}),"object"!=typeof i&&(i={}),t.extend({},i,e)},null==window.acfL10n&&(acfL10n={}),i.__=function(t){return acfL10n[t]||t},i._x=function(t,e){return acfL10n[t+"."+e]||acfL10n[t]||t},i._n=function(t,e,n){return 1==n?i.__(t):i.__(e)},i.isArray=function(t){return Array.isArray(t)},i.isObject=function(t){return"object"==typeof t};var r=function(t,e,n){var a=(e=e.replace("[]","[%%index%%]")).match(/([^\[\]])+/g);if(a)for(var r=a.length,o=t,s=0;s
            ');var s=e.parent();e.css({height:i,width:n,margin:a,position:"absolute"}),setTimeout(function(){s.css({opacity:0,height:t.endHeight})},50),setTimeout(function(){e.attr("style",o),s.remove(),t.complete()},301)},u=function(e){var i=e.target,n=i.height(),a=i.children().length,r=t('
            ');i.addClass("acf-remove-element"),setTimeout(function(){i.html(r)},251),setTimeout(function(){i.removeClass("acf-remove-element"),r.css({height:e.endHeight})},300),setTimeout(function(){i.remove(),e.complete()},451)};i.duplicate=function(t){t instanceof jQuery&&(t={target:t});var e=0;(t=i.parseArgs(t,{target:!1,search:"",replace:"",before:function(t){},after:function(t,e){},append:function(t,i){t.after(i),e=1}})).target=t.target||t.$el;var n=t.target;t.search=t.search||n.attr("data-id"),t.replace=t.replace||i.uniqid(),t.before(n),i.doAction("before_duplicate",n);var a=n.clone();return i.rename({target:a,search:t.search,replace:t.replace}),a.removeClass("acf-clone"),a.find(".ui-sortable").removeClass("ui-sortable"),t.after(n,a),i.doAction("after_duplicate",n,a),t.append(n,a),i.doAction("append",a),a},i.rename=function(t){t instanceof jQuery&&(t={target:t});var e=(t=i.parseArgs(t,{target:!1,destructive:!1,search:"",replace:""})).target,n=t.search||e.attr("data-id"),a=t.replace||i.uniqid("acf"),r=function(t,e){return e.replace(n,a)};if(t.destructive){var o=e.outerHTML();o=i.strReplace(n,a,o),e.replaceWith(o)}else e.attr("data-id",a),e.find('[id*="'+n+'"]').attr("id",r),e.find('[for*="'+n+'"]').attr("for",r),e.find('[name*="'+n+'"]').attr("name",r);return e},i.prepareForAjax=function(t){return t.nonce=i.get("nonce"),t.post_id=i.get("post_id"),i.has("language")&&(t.lang=i.get("language")),t=i.applyFilters("prepare_for_ajax",t)},i.startButtonLoading=function(t){t.prop("disabled",!0),t.after(' ')},i.stopButtonLoading=function(t){t.prop("disabled",!1),t.next(".acf-loading").remove()},i.showLoading=function(t){t.append('
            ')},i.hideLoading=function(t){t.children(".acf-loading-overlay").remove()},i.updateUserSetting=function(e,n){var a={action:"acf/ajax/user_setting",name:e,value:n};t.ajax({url:i.get("ajaxurl"),data:i.prepareForAjax(a),type:"post",dataType:"html"})},i.val=function(t,e,i){var n=t.val();return e!==n&&(t.val(e),t.is("select")&&null===t.val()?(t.val(n),!1):(!0!==i&&t.trigger("change"),!0))},i.show=function(t,e){return e&&i.unlock(t,"hidden",e),!i.isLocked(t,"hidden")&&(!!t.hasClass("acf-hidden")&&(t.removeClass("acf-hidden"),!0))},i.hide=function(t,e){return e&&i.lock(t,"hidden",e),!t.hasClass("acf-hidden")&&(t.addClass("acf-hidden"),!0)},i.isHidden=function(t){return t.hasClass("acf-hidden")},i.isVisible=function(t){return!i.isHidden(t)};var d=function(t,e){return!t.hasClass("acf-disabled")&&(e&&i.unlock(t,"disabled",e),!i.isLocked(t,"disabled")&&(!!t.prop("disabled")&&(t.prop("disabled",!1),!0)))};i.enable=function(e,i){if(e.attr("name"))return d(e,i);var n=!1;return e.find("[name]").each(function(){var e;d(t(this),i)&&(n=!0)}),n};var f=function(t,e){return e&&i.lock(t,"disabled",e),!t.prop("disabled")&&(t.prop("disabled",!0),!0)};i.disable=function(e,i){if(e.attr("name"))return f(e,i);var n=!1;return e.find("[name]").each(function(){var e;f(t(this),i)&&(n=!0)}),n},i.isset=function(t){for(var e=1;e-1){var o=window.URL||window.webkitURL,s=new Image;s.onload=function(){a.width=this.width,a.height=this.height,e(a)},s.src=o.createObjectURL(r)}else e(a);else e(a)},i.isAjaxSuccess=function(t){return t&&t.success},i.getAjaxMessage=function(t){return i.isget(t,"data","message")},i.getAjaxError=function(t){return i.isget(t,"data","error")},i.renderSelect=function(t,e){var n=t.val(),a=[],r=function(t){var e="";return t.map(function(t){var n=t.text||t.label||"",o=t.id||t.value||"";a.push(o),t.children?e+=''+r(t.children)+"":e+='"}),e};return t.html(r(e)),a.indexOf(n)>-1&&t.val(n),t.val()};var h=function(t,e){return t.data("acf-lock-"+e)||[]},p=function(t,e,i){t.data("acf-lock-"+e,i)};i.lock=function(t,e,i){var n=h(t,e),a;n.indexOf(i)<0&&(n.push(i),p(t,e,n))},i.unlock=function(t,e,i){var n=h(t,e),a=n.indexOf(i);return a>-1&&(n.splice(a,1),p(t,e,n)),0===n.length},i.isLocked=function(t,e){return h(t,e).length>0},i.isGutenberg=function(){return window.wp&&wp.data&&wp.data.select&&wp.data.select("core/editor")},i.objectToArray=function(t){return Object.keys(t).map(function(e){return t[e]})},t.fn.exists=function(){return t(this).length>0},t.fn.outerHTML=function(){return t(this).get(0).outerHTML},Array.prototype.indexOf||(Array.prototype.indexOf=function(e){return t.inArray(e,this)}),t(document).ready(function(){i.doAction("ready")}),t(window).on("load",function(){i.doAction("load")}),t(window).on("beforeunload",function(){i.doAction("unload")}),t(window).on("resize",function(){i.doAction("resize")}),t(document).on("sortstart",function(t,e){i.doAction("sortstart",e.item,e.placeholder)}),t(document).on("sortstop",function(t,e){i.doAction("sortstop",e.item,e.placeholder)})}(jQuery),function(t,e){"use strict";var i=function(){function t(){return f}function e(t,e,i,n){return"string"==typeof t&&"function"==typeof e&&c("actions",t,e,i=parseInt(i||10,10),n),d}function i(){var t=Array.prototype.slice.call(arguments),e=t.shift();return"string"==typeof e&&u("actions",e,t),d}function n(t,e){return"string"==typeof t&&s("actions",t,e),d}function a(t,e,i,n){return"string"==typeof t&&"function"==typeof e&&c("filters",t,e,i=parseInt(i||10,10),n),d}function r(){var t=Array.prototype.slice.call(arguments),e=t.shift();return"string"==typeof e?u("filters",e,t):d}function o(t,e){return"string"==typeof t&&s("filters",t,e),d}function s(t,e,i,n){if(f[t][e])if(i){var a=f[t][e],r;if(n)for(r=a.length;r--;){var o=a[r];o.callback===i&&o.context===n&&a.splice(r,1)}else for(r=a.length;r--;)a[r].callback===i&&a.splice(r,1)}else f[t][e]=[]}function c(t,e,i,n,a){var r={callback:i,priority:n,context:a},o=f[t][e];o?(o.push(r),o=l(o)):o=[r],f[t][e]=o}function l(t){for(var e,i,n,a=1,r=t.length;ae.priority;)t[i]=t[i-1],--i;t[i]=e}return t}function u(t,e,i){var n=f[t][e];if(!n)return"filters"===t&&i[0];var a=0,r=n.length;if("filters"===t)for(;a','
            ','

            ','
            ','
            ',"
            ",'
            ',""].join("")},render:function(){var t=this.get("title"),e=this.get("content"),i=this.get("loading"),n=this.get("width"),a=this.get("height");this.title(t),this.content(e),n&&this.$(".acf-popup-box").css("width",n),a&&this.$(".acf-popup-box").css("min-height",a),this.loading(i),acf.doAction("append",this.$el)},update:function(t){this.data=acf.parseArgs(t,this.data),this.render()},title:function(t){this.$(".title:first h3").html(t)},content:function(t){this.$(".inner:first").html(t)},loading:function(t){var e=this.$(".loading:first");t?e.show():e.hide()},open:function(){t("body").append(this.$el)},close:function(){this.remove()},onClickClose:function(t,e){t.preventDefault(),this.close()}}),acf.newPopup=function(t){return new acf.models.Popup(t)}}(jQuery),function(t,e){acf.unload=new acf.Model({wait:"load",active:!0,changed:!1,actions:{validation_failure:"startListening",validation_success:"stopListening"},events:{"change form .acf-field":"startListening","submit form":"stopListening"},enable:function(){this.active=!0},disable:function(){this.active=!1},reset:function(){this.stopListening()},startListening:function(){!this.changed&&this.active&&(this.changed=!0,t(window).on("beforeunload",this.onUnload))},stopListening:function(){this.changed=!1,t(window).off("beforeunload",this.onUnload)},onUnload:function(){return acf.__("The changes you made will be lost if you navigate away from this page")}})}(jQuery),function(t,e){var i=new acf.Model({events:{"click .acf-panel-title":"onClick"},onClick:function(t,e){t.preventDefault(),this.toggle(e.parent())},isOpen:function(t){return t.hasClass("-open")},toggle:function(t){this.isOpen(t)?this.close(t):this.open(t)},open:function(t){t.addClass("-open"),t.find(".acf-panel-title i").attr("class","dashicons dashicons-arrow-down")},close:function(t){t.removeClass("-open"),t.find(".acf-panel-title i").attr("class","dashicons dashicons-arrow-right")}})}(jQuery),function(t,e){var i=acf.Model.extend({data:{text:"",type:"",timeout:0,dismiss:!0,target:!1,close:function(){}},events:{"click .acf-notice-dismiss":"onClickClose"},tmpl:function(){return'
            '},setup:function(e){t.extend(this.data,e),this.$el=t(this.tmpl())},initialize:function(){this.render(),this.show()},render:function(){this.type(this.get("type")),this.html("

            "+this.get("text")+"

            "),this.get("dismiss")&&(this.$el.append(''),this.$el.addClass("-dismiss"));var t=this.get("timeout");t&&this.away(t)},update:function(e){t.extend(this.data,e),this.initialize(),this.removeEvents(),this.addEvents()},show:function(){var t=this.get("target");t&&t.prepend(this.$el)},hide:function(){this.$el.remove()},away:function(t){this.setTimeout(function(){acf.remove(this.$el)},t)},type:function(t){var e=this.get("type");e&&this.$el.removeClass("-"+e),this.$el.addClass("-"+t),"error"==t&&this.$el.addClass("acf-error-message")},html:function(t){this.$el.html(t)},text:function(t){this.$("p").html(t)},onClickClose:function(t,e){t.preventDefault(),this.get("close").apply(this,arguments),this.remove()}});acf.newNotice=function(t){return"object"!=typeof t&&(t={text:t}),new i(t)};var n=new acf.Model({wait:"prepare",priority:1,initialize:function(){var e=t(".acf-admin-notice");e.length&&t("h1:first").after(e)}})}(jQuery),function(t,e){var i=new acf.Model({wait:"prepare",priority:1,initialize:function(){(acf.get("postboxes")||[]).map(acf.newPostbox)}});acf.getPostbox=function(e){return"string"==typeof e&&(e=t("#"+e)),acf.getInstance(e)},acf.getPostboxes=function(){return acf.getInstances(t(".acf-postbox"))},acf.newPostbox=function(t){return new acf.models.Postbox(t)},acf.models.Postbox=acf.Model.extend({data:{id:"",key:"",style:"default",label:"top",edit:""},setup:function(e){e.editLink&&(e.edit=e.editLink),t.extend(this.data,e),this.$el=this.$postbox()},$postbox:function(){return t("#"+this.get("id"))},$hide:function(){return t("#"+this.get("id")+"-hide")},$hideLabel:function(){return this.$hide().parent()},$hndle:function(){return this.$("> .hndle")},$inside:function(){return this.$("> .inside")},isVisible:function(){return this.$el.hasClass("acf-hidden")},initialize:function(){if(this.$el.addClass("acf-postbox"),this.$el.removeClass("hide-if-js"),"block"!==acf.get("editor")){var t=this.get("style");"default"!==t&&this.$el.addClass(t)}this.$inside().addClass("acf-fields").addClass("-"+this.get("label"));var e=this.get("edit");e&&this.$hndle().append(''),this.show()},show:function(){this.$hideLabel().show(),this.$hide().prop("checked",!0),this.$el.show().removeClass("acf-hidden")},enable:function(){acf.enable(this.$el,"postbox")},showEnable:function(){this.show(),this.enable()},hide:function(){this.$hideLabel().hide(),this.$el.hide().addClass("acf-hidden")},disable:function(){acf.disable(this.$el,"postbox")},hideDisable:function(){this.hide(),this.disable()},html:function(t){this.$inside().html(t),acf.doAction("append",this.$el)}})}(jQuery),function(t,e){acf.newTooltip=function(t){return"object"!=typeof t&&(t={text:t}),void 0!==t.confirmRemove?(t.textConfirm=acf.__("Remove"),t.textCancel=acf.__("Cancel"),new n(t)):void 0!==t.confirm?new n(t):new i(t)};var i=acf.Model.extend({data:{text:"",timeout:0,target:null},tmpl:function(){return'
            '},setup:function(e){t.extend(this.data,e),this.$el=t(this.tmpl())},initialize:function(){this.render(),this.show(),this.position();var e=this.get("timeout");e&&setTimeout(t.proxy(this.fade,this),e)},update:function(e){t.extend(this.data,e),this.initialize()},render:function(){this.html(this.get("text"))},show:function(){t("body").append(this.$el)},hide:function(){this.$el.remove()},fade:function(){this.$el.addClass("acf-fade-up"),this.setTimeout(function(){this.remove()},250)},html:function(t){this.$el.html(t)},position:function(){var e=this.$el,i=this.get("target");if(i){e.removeClass("right left bottom top").css({top:0,left:0});var n=10,a=i.outerWidth(),r=i.outerHeight(),o=i.offset().top,s=i.offset().left,c=e.outerWidth(),l=e.outerHeight(),u=e.offset().top,d=o-l-u,f=s+a/2-c/2;f<10?(e.addClass("right"),f=s+a,d=o+r/2-l/2-u):f+c+10>t(window).width()?(e.addClass("left"),f=s-c,d=o+r/2-l/2-u):d-t(window).scrollTop()<10?(e.addClass("bottom"),d=o+r-u):e.addClass("top"),e.css({top:d,left:f})}}}),n=i.extend({data:{text:"",textConfirm:"",textCancel:"",target:null,targetConfirm:!0,confirm:function(){},cancel:function(){},context:!1},events:{'click [data-event="cancel"]':"onCancel",'click [data-event="confirm"]':"onConfirm"},addEvents:function(){acf.Model.prototype.addEvents.apply(this);var e=t(document),i=this.get("target");this.setTimeout(function(){this.on(e,"click","onCancel")}),this.get("targetConfirm")&&this.on(i,"click","onConfirm")},removeEvents:function(){acf.Model.prototype.removeEvents.apply(this);var e=t(document),i=this.get("target");this.off(e,"click"),this.off(i,"click")},render:function(){var t,e,i,n=[this.get("text")||acf.__("Are you sure?"),''+(this.get("textConfirm")||acf.__("Yes"))+"",''+(this.get("textCancel")||acf.__("No"))+""].join(" ");this.html(n),this.$el.addClass("-confirm")},onCancel:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("cancel"),n=this.get("context")||this;i.apply(n,arguments),this.remove()},onConfirm:function(t,e){t.preventDefault(),t.stopImmediatePropagation();var i=this.get("confirm"),n=this.get("context")||this;i.apply(n,arguments),this.remove()}});acf.models.Tooltip=i,acf.models.TooltipConfirm=n;var a=new acf.Model({tooltip:!1,events:{"mouseenter .acf-js-tooltip":"showTitle","mouseup .acf-js-tooltip":"hideTitle","mouseleave .acf-js-tooltip":"hideTitle"},showTitle:function(t,e){var i=e.attr("title");i&&(e.attr("title",""),this.tooltip?this.tooltip.update({text:i,target:e}):this.tooltip=acf.newTooltip({text:i,target:e}))},hideTitle:function(t,e){this.tooltip.hide(),e.attr("title",this.tooltip.get("text"))}})}(jQuery),function(t,e){var i=[];acf.Field=acf.Model.extend({type:"",eventScope:".acf-field",wait:"ready",setup:function(t){this.$el=t,this.inherit(t),this.inherit(this.$control())},val:function(t){return void 0!==t?this.setValue(t):this.prop("disabled")?null:this.getValue()},getValue:function(){return this.$input().val()},setValue:function(t){return acf.val(this.$input(),t)},__:function(t){return acf._e(this.type,t)},$control:function(){return!1},$input:function(){return this.$("[name]:first")},$inputWrap:function(){return this.$(".acf-input:first")},$labelWrap:function(){return this.$(".acf-label:first")},getInputName:function(){return this.$input().attr("name")||""},parent:function(){var t=this.parents();return!!t.length&&t[0]},parents:function(){var t=this.$el.parents(".acf-field"),e;return acf.getFields(t)},show:function(t,e){var i=acf.show(this.$el,t);return i&&(this.prop("hidden",!1),acf.doAction("show_field",this,e)),i},hide:function(t,e){var i=acf.hide(this.$el,t);return i&&(this.prop("hidden",!0),acf.doAction("hide_field",this,e)),i},enable:function(t,e){var i=acf.enable(this.$el,t);return i&&(this.prop("disabled",!1),acf.doAction("enable_field",this,e)),i},disable:function(t,e){var i=acf.disable(this.$el,t);return i&&(this.prop("disabled",!0),acf.doAction("disable_field",this,e)),i},showEnable:function(t,e){return this.enable.apply(this,arguments),this.show.apply(this,arguments)},hideDisable:function(t,e){return this.disable.apply(this,arguments),this.hide.apply(this,arguments)},showNotice:function(t){"object"!=typeof t&&(t={text:t}),this.notice&&this.notice.remove(),t.target=this.$inputWrap(),this.notice=acf.newNotice(t)},removeNotice:function(t){this.notice&&(this.notice.away(t||0),this.notice=!1)},showError:function(e){this.$el.addClass("acf-error"),void 0!==e&&this.showNotice({text:e,type:"error",dismiss:!1}),acf.doAction("invalid_field",this),this.$el.one("focus change","input, select, textarea",t.proxy(this.removeError,this))},removeError:function(){this.$el.removeClass("acf-error"),this.removeNotice(250),acf.doAction("valid_field",this)},trigger:function(t,e,i){return"invalidField"==t&&(i=!0),acf.Model.prototype.trigger.apply(this,[t,e,i])}}),acf.newField=function(t){var e=t.data("type"),i=n(e),a,r=new(acf.models[i]||acf.Field)(t);return acf.doAction("new_field",r),r};var n=function(t){return acf.strPascalCase(t||"")+"Field"};acf.registerFieldType=function(t){var e,a=t.prototype.type,r=n(a);acf.models[r]=t,i.push(a)},acf.getFieldType=function(t){var e=n(t);return acf.models[e]||!1},acf.getFieldTypes=function(t){t=acf.parseArgs(t,{category:""});var e=[];return i.map(function(i){var n=acf.getFieldType(i),a=n.prototype;t.category&&a.category!==t.category||e.push(n)}),e}}(jQuery),function(t,e){acf.findFields=function(e){var i=".acf-field",n=!1;return(e=acf.parseArgs(e,{key:"",name:"",type:"",is:"",parent:!1,sibling:!1,limit:!1,visible:!1,suppressFilters:!1})).suppressFilters||(e=acf.applyFilters("find_fields_args",e)),e.key&&(i+='[data-key="'+e.key+'"]'),e.type&&(i+='[data-type="'+e.type+'"]'),e.name&&(i+='[data-name="'+e.name+'"]'),e.is&&(i+=e.is),e.visible&&(i+=":visible"),n=e.parent?e.parent.find(i):e.sibling?e.sibling.siblings(i):t(i),e.suppressFilters||(n=n.not(".acf-clone .acf-field"),n=acf.applyFilters("find_fields",n)),e.limit&&(n=n.slice(0,e.limit)),n},acf.findField=function(t,e){return acf.findFields({key:t,limit:1,parent:e,suppressFilters:!0})},acf.getField=function(t){t instanceof jQuery||(t=acf.findField(t));var e=t.data("acf");return e||(e=acf.newField(t)),e},acf.getFields=function(e){e instanceof jQuery||(e=acf.findFields(e));var i=[];return e.each(function(){var e=acf.getField(t(this));i.push(e)}),i},acf.findClosestField=function(t){return t.closest(".acf-field")},acf.getClosestField=function(t){var e=acf.findClosestField(t);return this.getField(e)};var i=function(t){var e=t,i=t+"_fields",a=t+"_field",r=function(t){var e=acf.arrayArgs(arguments),n=e.slice(1),a=acf.getFields({parent:t});if(a.length){var r=[i,a].concat(n);acf.doAction.apply(null,r)}},o=function(t){var e=acf.arrayArgs(arguments),i=e.slice(1);t.map(function(t,e){var n=[a,t].concat(i);acf.doAction.apply(null,n)})};acf.addAction(e,r),acf.addAction(i,o),n(t)},n=function(t){var e=t+"_field",i=t+"Field",n=function(n){var a=acf.arrayArgs(arguments),r=a.slice(1),s=["type","name","key"];s.map(function(t){var i="/"+t+"="+n.get(t);a=[e+i,n].concat(r),acf.doAction.apply(null,a)}),o.indexOf(t)>-1&&n.trigger(i,r)};acf.addAction(e,n)},a,r=["valid","invalid","enable","disable","new"],o=["remove","unmount","remount","sortstart","sortstop","show","hide","unload","valid","invalid","enable","disable"];["prepare","ready","load","append","remove","unmount","remount","sortstart","sortstop","show","hide","unload"].map(i),r.map(n);var s=new acf.Model({id:"fieldsEventManager",events:{'click .acf-field a[href="#"]':"onClick","change .acf-field":"onChange"},onClick:function(t){t.preventDefault()},onChange:function(){t("#_acf_changed").val(1)}})}(jQuery),function(t,e){var i=0,n=acf.Field.extend({type:"accordion",wait:"",$control:function(){return this.$(".acf-fields:first")},initialize:function(){if(!this.$el.is("td")){if(this.get("endpoint"))return this.remove();var e=this.$el,n=this.$labelWrap(),r=this.$inputWrap(),o=this.$control(),s=r.children(".description");if(s.length&&n.append(s),this.$el.is("tr")){var c=this.$el.closest("table"),l=t('
            '),u=t('
            '),d=t('
                '),f=t("");l.append(n.html()),d.append(f),u.append(d),r.append(l),r.append(u),n.remove(),o.remove(),r.attr("colspan",2),n=l,r=u,o=f}e.addClass("acf-accordion"),n.addClass("acf-accordion-title"),r.addClass("acf-accordion-content"),i++,this.get("multi_expand")&&e.attr("multi-expand",1);var h=acf.getPreference("this.accordions")||[];void 0!==h[i-1]&&this.set("open",h[i-1]),this.get("open")&&(e.addClass("-open"),r.css("display","block")),n.prepend(a.iconHtml({open:this.get("open")}));var p=e.parent();o.addClass(p.hasClass("-left")?"-left":""),o.addClass(p.hasClass("-clear")?"-clear":""),o.append(e.nextUntil(".acf-field-accordion",".acf-field")),o.removeAttr("data-open data-multi_expand data-endpoint")}}});acf.registerFieldType(n);var a=new acf.Model({actions:{unload:"onUnload"},events:{ +"click .acf-accordion-title":"onClick","invalidField .acf-accordion":"onInvalidField"},isOpen:function(t){return t.hasClass("-open")},toggle:function(t){this.isOpen(t)?this.close(t):this.open(t)},iconHtml:function(t){var e;return''},open:function(e){e.find(".acf-accordion-content:first").slideDown().css("display","block"),e.find(".acf-accordion-icon:first").replaceWith(this.iconHtml({open:!0})),e.addClass("-open"),acf.doAction("show",e),e.attr("multi-expand")||e.siblings(".acf-accordion.-open").each(function(){a.close(t(this))})},close:function(t){t.find(".acf-accordion-content:first").slideUp(),t.find(".acf-accordion-icon:first").replaceWith(this.iconHtml({open:!1})),t.removeClass("-open"),acf.doAction("hide",t)},onClick:function(t,e){t.preventDefault(),this.toggle(e.parent())},onInvalidField:function(t,e){this.busy||(this.busy=!0,this.setTimeout(function(){this.busy=!1},1e3),this.open(e))},onUnload:function(e){var i=[];t(".acf-accordion").each(function(){var e=t(this).hasClass("-open")?1:0;i.push(e)}),i.length&&acf.setPreference("this.accordions",i)}})}(jQuery),function(t,e){var i=acf.Field.extend({type:"button_group",events:{'click input[type="radio"]':"onClick"},$control:function(){return this.$(".acf-button-group")},$input:function(){return this.$("input:checked")},setValue:function(t){this.$('input[value="'+t+'"]').prop("checked",!0).trigger("change")},onClick:function(t,e){var i=e.parent("label"),n=i.hasClass("selected");this.$(".selected").removeClass("selected"),i.addClass("selected"),this.get("allow_null")&&n&&(i.removeClass("selected"),e.prop("checked",!1).trigger("change"))}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"checkbox",events:{"change input":"onChange","click .acf-add-checkbox":"onClickAdd","click .acf-checkbox-toggle":"onClickToggle","click .acf-checkbox-custom":"onClickCustom"},$control:function(){return this.$(".acf-checkbox-list")},$toggle:function(){return this.$(".acf-checkbox-toggle")},$input:function(){return this.$('input[type="hidden"]')},$inputs:function(){return this.$('input[type="checkbox"]').not(".acf-checkbox-toggle")},getValue:function(){var e=[];return this.$(":checked").each(function(){e.push(t(this).val())}),!!e.length&&e},onChange:function(t,e){var i=e.prop("checked"),n=this.$toggle(),a;(i?e.parent().addClass("selected"):e.parent().removeClass("selected"),n.length)&&(0==this.$inputs().not(":checked").length?n.prop("checked",!0):n.prop("checked",!1))},onClickAdd:function(t,e){var i='
              • ';e.parent("li").before(i)},onClickToggle:function(t,e){var i=e.prop("checked"),n;this.$inputs().prop("checked",i)},onClickCustom:function(t,e){var i=e.prop("checked"),n=e.next('input[type="text"]');i?n.prop("disabled",!1):(n.prop("disabled",!0),""==n.val()&&e.parent("li").remove())}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"color_picker",wait:"load",$control:function(){return this.$(".acf-color-picker")},$input:function(){return this.$('input[type="hidden"]')},$inputText:function(){return this.$('input[type="text"]')},setValue:function(t){acf.val(this.$input(),t),this.$inputText().iris("color",t)},initialize:function(){var t=this.$input(),e=this.$inputText(),i=function(i){setTimeout(function(){acf.val(t,e.val())},1)},n={defaultColor:!1,palettes:!0,hide:!0,change:i,clear:i},n=acf.applyFilters("color_picker_args",n,this);e.wpColorPicker(n)}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"date_picker",events:{'blur input[type="text"]':"onBlur"},$control:function(){return this.$(".acf-date-picker")},$input:function(){return this.$('input[type="hidden"]')},$inputText:function(){return this.$('input[type="text"]')},initialize:function(){if(this.has("save_format"))return this.initializeCompatibility();var t=this.$input(),e=this.$inputText(),i={dateFormat:this.get("date_format"),altField:t,altFormat:"yymmdd",changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.get("first_day")};i=acf.applyFilters("date_picker_args",i,this),acf.newDatePicker(e,i),acf.doAction("date_picker_init",e,i,this)},initializeCompatibility:function(){var t=this.$input(),e=this.$inputText();e.val(t.val());var i={dateFormat:this.get("date_format"),altField:t,altFormat:this.get("save_format"),changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.get("first_day")},n=(i=acf.applyFilters("date_picker_args",i,this)).dateFormat;i.dateFormat=this.get("save_format"),acf.newDatePicker(e,i),e.datepicker("option","dateFormat",n),acf.doAction("date_picker_init",e,i,this)},onBlur:function(){this.$inputText().val()||acf.val(this.$input(),"")}});acf.registerFieldType(i);var n=new acf.Model({priority:5,wait:"ready",initialize:function(){var e=acf.get("locale"),i=acf.get("rtl"),n=acf.get("datePickerL10n");return!!n&&(void 0!==t.datepicker&&(n.isRTL=i,t.datepicker.regional[e]=n,void t.datepicker.setDefaults(n)))}});acf.newDatePicker=function(e,i){if(void 0===t.datepicker)return!1;i=i||{},e.datepicker(i),t("body > #ui-datepicker-div").exists()&&t("body > #ui-datepicker-div").wrap('
                ')}}(jQuery),function(t,e){var i=acf.models.DatePickerField.extend({type:"date_time_picker",$control:function(){return this.$(".acf-date-time-picker")},initialize:function(){var t=this.$input(),e=this.$inputText(),i={dateFormat:this.get("date_format"),timeFormat:this.get("time_format"),altField:t,altFieldTimeOnly:!1,altFormat:"yy-mm-dd",altTimeFormat:"HH:mm:ss",changeYear:!0,yearRange:"-100:+100",changeMonth:!0,showButtonPanel:!0,firstDay:this.get("first_day"),controlType:"select",oneLine:!0};i=acf.applyFilters("date_time_picker_args",i,this),acf.newDateTimePicker(e,i),acf.doAction("date_time_picker_init",e,i,this)}});acf.registerFieldType(i);var n=new acf.Model({priority:5,wait:"ready",initialize:function(){var e=acf.get("locale"),i=acf.get("rtl"),n=acf.get("dateTimePickerL10n");return!!n&&(void 0!==t.timepicker&&(n.isRTL=i,t.timepicker.regional[e]=n,void t.timepicker.setDefaults(n)))}});acf.newDateTimePicker=function(e,i){if(void 0===t.timepicker)return!1;i=i||{},e.datetimepicker(i),t("body > #ui-datepicker-div").exists()&&t("body > #ui-datepicker-div").wrap('
                ')}}(jQuery),function(t,e){function i(e){if(r)return e();if(acf.isset(window,"google","maps","Geocoder"))return r=new google.maps.Geocoder,e();if(acf.addAction("google_map_api_loaded",e),!a){var i=acf.get("google_map_api");i&&(a=!0,t.ajax({url:i,dataType:"script",cache:!0,success:function(){r=new google.maps.Geocoder,acf.doAction("google_map_api_loaded")}}))}}var n=acf.Field.extend({type:"google_map",map:!1,wait:"load",events:{'click a[data-name="clear"]':"onClickClear",'click a[data-name="locate"]':"onClickLocate",'click a[data-name="search"]':"onClickSearch","keydown .search":"onKeydownSearch","keyup .search":"onKeyupSearch","focus .search":"onFocusSearch","blur .search":"onBlurSearch",showField:"onShow"},$control:function(){return this.$(".acf-google-map")},$input:function(t){return this.$('input[data-name="'+(t||"address")+'"]')},$search:function(){return this.$(".search")},$canvas:function(){return this.$(".canvas")},addClass:function(t){this.$control().addClass(t)},removeClass:function(t){this.$control().removeClass(t)},getValue:function(){var e={lat:"",lng:"",address:""};return this.$('input[type="hidden"]').each(function(){e[t(this).data("name")]=t(this).val()}),e.lat&&e.lng||(e=!1),e},setValue:function(t){for(var e in t=acf.parseArgs(t,{lat:"",lng:"",address:""}))acf.val(this.$input(e),t[e]);t.lat&&t.lng||(t=!1),this.renderVal(t);var i=this.newLatLng(t.lat,t.lng);acf.doAction("google_map_change",i,this.map,this)},renderVal:function(t){t?(this.addClass("-value"),this.setPosition(t.lat,t.lng),this.map.marker.setVisible(!0)):(this.removeClass("-value"),this.map.marker.setVisible(!1)),this.$search().val(t.address)},setPosition:function(t,e){var i=this.newLatLng(t,e);return this.map.marker.setPosition(i),this.map.marker.setVisible(!0),this.center(),this},center:function(){var t=this.map.marker.getPosition(),e=this.get("lat"),i=this.get("lng");t&&(e=t.lat(),i=t.lng());var n=this.newLatLng(e,i);this.map.setCenter(n)},getSearchVal:function(){return this.$search().val()},initialize:function(){i(this.initializeMap.bind(this))},newLatLng:function(t,e){return new google.maps.LatLng(parseFloat(t),parseFloat(e))},initializeMap:function(){var t=this.get("zoom"),e=this.get("lat"),i=this.get("lng"),n={scrollwheel:!1,zoom:parseInt(t),center:this.newLatLng(e,i),mapTypeId:google.maps.MapTypeId.ROADMAP,marker:{draggable:!0,raiseOnDrag:!0},autocomplete:{}};n=acf.applyFilters("google_map_args",n,this);var a=new google.maps.Map(this.$canvas()[0],n),r=acf.parseArgs(n.marker,{draggable:!0,raiseOnDrag:!0,map:a});r=acf.applyFilters("google_map_marker_args",r,this);var o=new google.maps.Marker(r),s=!1;if(acf.isset(google,"maps","places","Autocomplete")){var c=n.autocomplete||{};c=acf.applyFilters("google_map_autocomplete_args",c,this),(s=new google.maps.places.Autocomplete(this.$search()[0],c)).bindTo("bounds",a)}this.addMapEvents(this,a,o,s),a.acf=this,a.marker=o,a.autocomplete=s,this.map=a,acf.doAction("google_map_init",a,o,this);var l=this.getValue();this.renderVal(l)},addMapEvents:function(t,e,i,n){google.maps.event.addListener(e,"click",function(e){var i=e.latLng.lat(),n=e.latLng.lng();t.searchPosition(i,n)}),google.maps.event.addListener(i,"dragend",function(){var e=this.getPosition(),i=e.lat(),n=e.lng();t.searchPosition(i,n)}),n&&google.maps.event.addListener(n,"place_changed",function(){var e=this.getPlace();e.address=t.getSearchVal(),t.setPlace(e)})},searchPosition:function(e,i){var n=this.newLatLng(e,i),a=this.$control();this.setPosition(e,i),a.addClass("-loading");var o=t.proxy(function(t,n){a.removeClass("-loading");var r="";n!=google.maps.GeocoderStatus.OK?console.log("Geocoder failed due to: "+n):t[0]?r=t[0].formatted_address:console.log("No results found"),this.val({lat:e,lng:i,address:r})},this);r.geocode({latLng:n},o)},setPlace:function(t){if(!t)return this;if(t.name&&!t.geometry)return this.searchAddress(t.name),this;var e=t.geometry.location.lat(),i=t.geometry.location.lng(),n=t.address||t.formatted_address;return this.setValue({lat:e,lng:i,address:n}),this},searchAddress:function(e){var i=e.split(",");if(2==i.length){var n=i[0],a=i[1];if(t.isNumeric(n)&&t.isNumeric(a))return this.searchPosition(n,a)}var o=this.$control();o.addClass("-loading");var s=this.proxy(function(t,i){o.removeClass("-loading");var n="",a="";i!=google.maps.GeocoderStatus.OK?console.log("Geocoder failed due to: "+i):t[0]?(n=t[0].geometry.location.lat(),a=t[0].geometry.location.lng()):console.log("No results found"),this.val({lat:n,lng:a,address:e})});r.geocode({address:e},s)},searchLocation:function(){if(!navigator.geolocation)return alert(acf.__("Sorry, this browser does not support geolocation"));var e=this.$control();e.addClass("-loading");var i=t.proxy(function(t,i){e.removeClass("-loading");var n=t.coords.latitude,a=t.coords.longitude;this.searchPosition(n,a)},this),n=function(t){e.removeClass("-loading")};navigator.geolocation.getCurrentPosition(i,n)},onClickClear:function(t,e){this.val(!1)},onClickLocate:function(t,e){this.searchLocation()},onClickSearch:function(t,e){this.searchAddress(this.$search().val())},onFocusSearch:function(t,e){this.removeClass("-value"),this.onKeyupSearch.apply(this,arguments)},onBlurSearch:function(t,e){this.setTimeout(function(){this.removeClass("-search"),e.val()&&this.addClass("-value")},100)},onKeyupSearch:function(t,e){e.val()?this.addClass("-search"):this.removeClass("-search")},onKeydownSearch:function(t,e){13==t.which&&t.preventDefault()},onMousedown:function(){},onShow:function(){if(!this.map)return!1;this.setTimeout(this.center,10)}});acf.registerFieldType(n);var a=!1,r=!1}(jQuery),function(t,e){var i=acf.Field.extend({type:"image",$control:function(){return this.$(".acf-image-uploader")},$input:function(){return this.$('input[type="hidden"]')},events:{'click a[data-name="add"]':"onClickAdd",'click a[data-name="edit"]':"onClickEdit",'click a[data-name="remove"]':"onClickRemove",'change input[type="file"]':"onChange"},initialize:function(){"basic"===this.get("uploader")&&this.$el.closest("form").attr("enctype","multipart/form-data")},validateAttachment:function(t){void 0!==(t=t||{}).id&&(t=t.attributes),t=acf.parseArgs(t,{url:"",alt:"",title:"",caption:"",description:"",width:0,height:0});var e=acf.isget(t,"sizes",this.get("preview_size"),"url");return null!==e&&(t.url=e),t},render:function(t){t=this.validateAttachment(t),this.$("img").attr({src:t.url,alt:t.alt,title:t.title});var e=t.id||"";this.val(e),e?this.$control().addClass("has-value"):this.$control().removeClass("has-value")},append:function(t,e){var i=function(t,e){for(var i=acf.getFields({key:t.get("key"),parent:e.$el}),n=0;n0?this.append(t,e):this.render(t)},this)})},editAttachment:function(){var e=this.val();if(e)var i=acf.newMediaPopup({mode:"edit",title:acf.__("Edit Image"),button:acf.__("Update Image"),attachment:e,field:this.get("key"),select:t.proxy(function(t,e){this.render(t)},this)})},removeAttachment:function(){this.render(!1)},onClickAdd:function(t,e){this.selectAttachment()},onClickEdit:function(t,e){this.editAttachment()},onClickRemove:function(t,e){this.removeAttachment()},onChange:function(e,i){var n=this.$input();acf.getFileInputData(i,function(e){n.val(t.param(e))})}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.models.ImageField.extend({type:"file",$control:function(){return this.$(".acf-file-uploader")},$input:function(){return this.$('input[type="hidden"]')},validateAttachment:function(t){return void 0!==(t=t||{}).id&&(t=t.attributes),t=acf.parseArgs(t,{url:"",alt:"",title:"",filename:"",filesizeHumanReadable:"",icon:"/wp-includes/images/media/default.png"})},render:function(t){t=this.validateAttachment(t),this.$("img").attr({src:t.icon,alt:t.alt,title:t.title}),this.$('[data-name="title"]').text(t.title),this.$('[data-name="filename"]').text(t.filename).attr("href",t.url),this.$('[data-name="filesize"]').text(t.filesizeHumanReadable);var e=t.id||"";acf.val(this.$input(),e),e?this.$control().addClass("has-value"):this.$control().removeClass("has-value")},selectAttachment:function(){var e=this.parent(),i=e&&"repeater"===e.get("type"),n=acf.newMediaPopup({mode:"select",title:acf.__("Select File"),field:this.get("key"),multiple:i,library:this.get("library"),allowedTypes:this.get("mime_types"),select:t.proxy(function(t,i){i>0?this.append(t,e):this.render(t)},this)})},editAttachment:function(){var e=this.val();if(!e)return!1;var i=acf.newMediaPopup({mode:"edit",title:acf.__("Edit File"),button:acf.__("Update File"),attachment:e,field:this.get("key"),select:t.proxy(function(t,e){this.render(t)},this)})}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"link",events:{'click a[data-name="add"]':"onClickEdit",'click a[data-name="edit"]':"onClickEdit",'click a[data-name="remove"]':"onClickRemove","change .link-node":"onChange"},$control:function(){return this.$(".acf-link")},$node:function(){return this.$(".link-node")},getValue:function(){var t=this.$node();return!!t.attr("href")&&{title:t.html(),url:t.attr("href"),target:t.attr("target")}},setValue:function(t){t=acf.parseArgs(t,{title:"",url:"",target:""});var e=this.$control(),i=this.$node();e.removeClass("-value -external"),t.url&&e.addClass("-value"),"_blank"===t.target&&e.addClass("-external"),this.$(".link-title").html(t.title),this.$(".link-url").attr("href",t.url).html(t.url),i.html(t.title),i.attr("href",t.url),i.attr("target",t.target),this.$(".input-title").val(t.title),this.$(".input-target").val(t.target),this.$(".input-url").val(t.url).trigger("change")},onClickEdit:function(t,e){acf.wpLink.open(this.$node())},onClickRemove:function(t,e){this.setValue(!1)},onChange:function(t,e){var i=this.getValue();this.setValue(i)}});acf.registerFieldType(i),acf.wpLink=new acf.Model({getNodeValue:function(){var t=this.get("node");return{title:t.html(),url:t.attr("href"),target:t.attr("target")}},setNodeValue:function(t){var e=this.get("node");e.html(t.title),e.attr("href",t.url),e.attr("target",t.target),e.trigger("change")},getInputValue:function(){return{title:t("#wp-link-text").val(),url:t("#wp-link-url").val(),target:t("#wp-link-target").prop("checked")?"_blank":""}},setInputValue:function(e){t("#wp-link-text").val(e.title),t("#wp-link-url").val(e.url),t("#wp-link-target").prop("checked","_blank"===e.target)},open:function(e){this.on("wplink-open","onOpen"),this.on("wplink-close","onClose"),this.set("node",e);var i=t('');t("body").append(i);var n=this.getNodeValue();wpLink.open("acf-link-textarea",n.url,n.title,null)},onOpen:function(){t("#wp-link-wrap").addClass("has-text-field");var e=this.getNodeValue();this.setInputValue(e)},close:function(){wpLink.close()},onClose:function(){if(!this.has("node"))return!1;this.off("wplink-open"),this.off("wplink-close");var e=this.getInputValue();this.setNodeValue(e),t("#acf-link-textarea").remove(),this.set("node",null)}})}(jQuery),function(t,e){var i=acf.Field.extend({type:"oembed",events:{'click [data-name="clear-button"]':"onClickClear","keypress .input-search":"onKeypressSearch","keyup .input-search":"onKeyupSearch","change .input-search":"onChangeSearch"},$control:function(){return this.$(".acf-oembed")},$input:function(){return this.$(".input-value")},$search:function(){return this.$(".input-search")},getValue:function(){return this.$input().val()},getSearchVal:function(){return this.$search().val()},setValue:function(t){t?this.$control().addClass("has-value"):this.$control().removeClass("has-value"),acf.val(this.$input(),t)},showLoading:function(t){acf.showLoading(this.$(".canvas"))},hideLoading:function(){acf.hideLoading(this.$(".canvas"))},maybeSearch:function(){var e=this.val(),i=this.getSearchVal();if(!i)return this.clear();if("http"!=i.substr(0,4)&&(i="http://"+i),i!==e){var n=this.get("timeout");n&&clearTimeout(n);var a=t.proxy(this.search,this,i);this.set("timeout",setTimeout(a,300))}},search:function(e){var i={action:"acf/fields/oembed/search",s:e,field_key:this.get("key")},n;(n=this.get("xhr"))&&n.abort(),this.showLoading();var n=t.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(i),type:"post",dataType:"json",context:this,success:function(t){t&&t.html||(t={url:!1,html:""}),this.val(t.url),this.$(".canvas-media").html(t.html)},complete:function(){this.hideLoading()}});this.set("xhr",n)},clear:function(){this.val(""),this.$search().val(""),this.$(".canvas-media").html("")},onClickClear:function(t,e){this.clear()},onKeypressSearch:function(t,e){13==t.which&&(t.preventDefault(),this.maybeSearch())},onKeyupSearch:function(t,e){e.val()&&this.maybeSearch()},onChangeSearch:function(t,e){this.maybeSearch()}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"radio",events:{'click input[type="radio"]':"onClick"},$control:function(){return this.$(".acf-radio-list")},$input:function(){return this.$("input:checked")},$inputText:function(){return this.$('input[type="text"]')},getValue:function(){var t=this.$input().val();return"other"===t&&this.get("other_choice")&&(t=this.$inputText().val()),t},onClick:function(t,e){var i=e.parent("label"),n=i.hasClass("selected"),a=e.val();this.$(".selected").removeClass("selected"),i.addClass("selected"),this.get("allow_null")&&n&&(i.removeClass("selected"),e.prop("checked",!1).trigger("change"),a=!1),this.get("other_choice")&&("other"===a?this.$inputText().prop("disabled",!1):this.$inputText().prop("disabled",!0))}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"range",events:{'input input[type="range"]':"onChange","change input":"onChange"},$input:function(){return this.$('input[type="range"]')},$inputAlt:function(){return this.$('input[type="number"]')},setValue:function(t){this.busy=!0,acf.val(this.$input(),t),acf.val(this.$inputAlt(),this.$input().val(),!0),this.busy=!1},onChange:function(t,e){this.busy||this.setValue(e.val())}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"relationship",events:{"keypress [data-filter]":"onKeypressFilter","change [data-filter]":"onChangeFilter","keyup [data-filter]":"onChangeFilter","click .choices-list .acf-rel-item":"onClickAdd",'click [data-name="remove_item"]':"onClickRemove",mouseover:"onHover"},$control:function(){return this.$(".acf-relationship")},$list:function(t){return this.$("."+t+"-list")},$listItems:function(t){return this.$list(t).find(".acf-rel-item")},$listItem:function(t,e){return this.$list(t).find('.acf-rel-item[data-id="'+e+'"]')},getValue:function(){var e=[];return this.$listItems("values").each(function(){e.push(t(this).data("id"))}),!!e.length&&e},newChoice:function(t){return["
              • ",''+t.text+"","
              • "].join("")},newValue:function(t){return["
              • ",'',''+t.text,'',"","
              • "].join("")},addSortable:function(t){this.$list("values").sortable({items:"li",forceHelperSize:!0,forcePlaceholderSize:!0,scroll:!0,update:function(){t.$input().trigger("change")}})},initialize:function(){var t=this.proxy(function(t){if(!this.get("loading")&&this.get("more")){var e=this.$list("choices"),i=Math.ceil(e.scrollTop()),n=Math.ceil(e[0].scrollHeight),a=Math.ceil(e.innerHeight()),r=this.get("paged")||1;i+a>=n&&(this.set("paged",r+1),this.fetch())}});this.$list("choices").scrollTop(0).on("scroll",t),this.fetch()},onHover:function(e){t().off(e),this.addSortable(this)},onKeypressFilter:function(t,e){13==t.which&&t.preventDefault()},onChangeFilter:function(t,e){var i=e.val(),n=e.data("filter");this.get(n)!==i&&(this.set(n,i),this.set("paged",1),e.is("select")?this.fetch():this.maybeFetch())},onClickAdd:function(t,e){var i=this.val(),n=parseInt(this.get("max"));if(e.hasClass("disabled"))return!1;if(n>0&&i&&i.length>=n)return this.showNotice({text:acf.__("Maximum values reached ( {max} values )").replace("{max}",n),type:"warning"}),!1;e.addClass("disabled");var a=this.newValue({id:e.data("id"),text:e.html()});this.$list("values").append(a),this.$input().trigger("change")},onClickRemove:function(t,e){t.preventDefault();var i=e.parent(),n=i.parent(),a=i.data("id");n.remove(),this.$listItem("choices",a).removeClass("disabled"),this.$input().trigger("change")},maybeFetch:function(){var t=this.get("timeout");t&&clearTimeout(t),t=this.setTimeout(this.fetch,300),this.set("timeout",t)},getAjaxData:function(){var t=this.$control().data();for(var e in t)t[e]=this.get(e);return t.action="acf/fields/relationship/query",t.field_key=this.get("key"),t=acf.applyFilters("relationship_ajax_data",t,this)},fetch:function(){var e;(e=this.get("xhr"))&&e.abort();var i=this.getAjaxData(),n=this.$list("choices");1==i.paged&&n.html("");var a=t('
              • '+acf.__("Loading")+"
              • ");n.append(a),this.set("loading",!0);var r=function(){this.set("loading",!1),a.remove()},o=function(e){if(!e||!e.results||!e.results.length)return this.set("more",!1),void(1==this.get("paged")&&this.$list("choices").append("
              • "+acf.__("No matches found")+"
              • "));this.set("more",e.more);var i=this.walkChoices(e.results),a=t(i),r=this.val();r&&r.length&&r.map(function(t){a.find('.acf-rel-item[data-id="'+t+'"]').addClass("disabled")}),n.append(a);var o=!1,s=!1;n.find(".acf-rel-label").each(function(){var e=t(this),i=e.siblings("ul");if(o&&o.text()==e.text())return s.append(i.children()),void t(this).parent().remove();o=e,s=i})},e=t.ajax({url:acf.get("ajaxurl"),dataType:"json",type:"post",data:acf.prepareForAjax(i),context:this,success:o,complete:r});this.set("xhr",e)},walkChoices:function(e){var i=function(e){var n="";return t.isArray(e)?e.map(function(t){n+=i(t)}):t.isPlainObject(e)&&(void 0!==e.children?(n+='
              • '+e.text+'
                  ',n+=i(e.children),n+="
              • "):n+='
              • '+e.text+"
              • "),n};return i(e)}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"select",select2:!1,wait:"load",events:{removeField:"onRemove"},$input:function(){return this.$("select")},initialize:function(){var t=this.$input();if(this.inherit(t),this.get("ui")){var e=this.get("ajax_action");e||(e="acf/fields/"+this.get("type")+"/query"),this.select2=acf.newSelect2(t,{field:this,ajax:this.get("ajax"),multiple:this.get("multiple"),placeholder:this.get("placeholder"),allowNull:this.get("allow_null"),ajaxAction:e})}},onRemove:function(){this.select2&&this.select2.destroy()}});acf.registerFieldType(i)}(jQuery),function(t,e){var i="tab",n=acf.Field.extend({type:"tab",wait:"",tabs:!1,tab:!1,findFields:function(){return this.$el.nextUntil(".acf-field-tab",".acf-field")},getFields:function(){return acf.getFields(this.findFields())},findTabs:function(){return this.$el.prevAll(".acf-tab-wrap:first")},findTab:function(){return this.$(".acf-tab-button")},initialize:function(){if(this.$el.is("td"))return this.events={},!1;var t=this.findTabs(),e=this.findTab(),i=acf.parseArgs(e.data(),{endpoint:!1,placement:"",before:this.$el});!t.length||i.endpoint?this.tabs=new r(i):this.tabs=t.data("acf"),this.tab=this.tabs.addTab(e,this)},isActive:function(){return this.tab.isActive()},showFields:function(){this.getFields().map(function(t){t.show(this.cid,"tab"),t.hiddenByTab=!1},this)},hideFields:function(){this.getFields().map(function(t){t.hide(this.cid,"tab"),t.hiddenByTab=this.tab},this)},show:function(t){var e=acf.Field.prototype.show.apply(this,arguments);return e&&(this.tab.show(),this.tabs.refresh()),e},hide:function(t){var e=acf.Field.prototype.hide.apply(this,arguments);return e&&(this.tab.hide(),this.isActive()&&this.tabs.reset()),e},enable:function(t){this.getFields().map(function(t){t.enable("tab")})},disable:function(t){this.getFields().map(function(t){t.disable("tab")})}});acf.registerFieldType(n);var a=0,r=acf.Model.extend({tabs:[],active:!1,actions:{refresh:"onRefresh"},data:{before:!1,placement:"top",index:0,initialized:!1},setup:function(e){t.extend(this.data,e),this.tabs=[],this.active=!1;var i=this.get("placement"),n=this.get("before"),r=n.parent();"left"==i&&r.hasClass("acf-fields")&&r.addClass("-sidebar"),n.is("tr")?this.$el=t('
                '):this.$el=t('
                  '),n.before(this.$el),this.set("index",a,!0),a++},initializeTabs:function(){var t=this.getVisible().shift(),e,i,n=(acf.getPreference("this.tabs")||[])[this.get("index")];this.tabs[n]&&this.tabs[n].isVisible()&&(t=this.tabs[n]),t?this.selectTab(t):this.closeTabs(),this.set("initialized",!0)},getVisible:function(){return this.tabs.filter(function(t){return t.isVisible()})},getActive:function(){return this.active},setActive:function(t){return this.active=t},hasActive:function(){return!1!==this.active},isActive:function(t){var e=this.getActive();return e&&e.cid===t.cid},closeActive:function(){this.hasActive()&&this.closeTab(this.getActive())},openTab:function(t){this.closeActive(),t.open(),this.setActive(t)},closeTab:function(t){t.close(),this.setActive(!1)},closeTabs:function(){this.tabs.map(this.closeTab,this)},selectTab:function(t){this.tabs.map(function(e){t.cid!==e.cid&&this.closeTab(e)},this),this.openTab(t)},addTab:function(e,i){var n=t("
                • ");n.append(e),this.$("ul").append(n);var a=new o({$el:n,field:i,group:this});return this.tabs.push(a),a},reset:function(){return this.closeActive(),this.refresh()},refresh:function(){if(this.hasActive())return!1;var t=this.getVisible().shift();return t&&this.openTab(t),t},onRefresh:function(){if("left"===this.get("placement")){var t=this.$el.parent(),e=this.$el.children("ul"),i=t.is("td")?"height":"min-height",n=e.position().top+e.outerHeight(!0)-1;t.css(i,n)}}}),o=acf.Model.extend({group:!1,field:!1,events:{"click a":"onClick"},index:function(){return this.$el.index()},isVisible:function(){return acf.isVisible(this.$el)},isActive:function(){return this.$el.hasClass("active")},open:function(){this.$el.addClass("active"),this.field.showFields()},close:function(){this.$el.removeClass("active"),this.field.hideFields()},onClick:function(t,e){t.preventDefault(),this.toggle()},toggle:function(){this.isActive()||this.group.openTab(this)}}),s=new acf.Model({priority:50,actions:{prepare:"render",append:"render",unload:"onUnload",invalid_field:"onInvalidField"},findTabs:function(){return t(".acf-tab-wrap")},getTabs:function(){return acf.getInstances(this.findTabs())},render:function(t){this.getTabs().map(function(t){t.get("initialized")||t.initializeTabs()})},onInvalidField:function(t){this.busy||t.hiddenByTab&&(t.hiddenByTab.toggle(),this.busy=!0,this.setTimeout(function(){this.busy=!1},100))},onUnload:function(){var t=[];this.getTabs().map(function(e){var i=e.hasActive()?e.getActive().index():0;t.push(i)}),t.length&&acf.setPreference("this.tabs",t)}})}(jQuery),function(t,e){var i=acf.models.SelectField.extend({type:"post_object"});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.models.SelectField.extend({type:"page_link"});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.models.SelectField.extend({type:"user"});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"taxonomy",data:{ftype:"select"},select2:!1,wait:"load",events:{'click a[data-name="add"]':"onClickAdd",'click input[type="radio"]':"onClickRadio"},$control:function(){return this.$(".acf-taxonomy-field")},$input:function(){return this.getRelatedPrototype().$input.apply(this,arguments)},getRelatedType:function(){var t=this.get("ftype");return"multi_select"==t&&(t="select"),t},getRelatedPrototype:function(){return acf.getFieldType(this.getRelatedType()).prototype},getValue:function(){return this.getRelatedPrototype().getValue.apply(this,arguments)},setValue:function(){return this.getRelatedPrototype().setValue.apply(this,arguments)},initialize:function(){this.getRelatedPrototype().initialize.apply(this,arguments)},onRemove:function(){this.select2&&this.select2.destroy()},onClickAdd:function(e,i){var n=this,a=!1,r=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=function(){a=acf.newPopup({title:i.attr("title"),loading:!0,width:"300px"});var e={action:"acf/fields/taxonomy/add_term",field_key:n.get("key")};t.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(e),type:"post",dataType:"html",success:f})},f=function(t){a.loading(!1),a.content(t),r=a.$("form"),o=a.$('input[name="term_name"]'),s=a.$('select[name="term_parent"]'),c=a.$(".acf-submit-button"),o.focus(),a.on("submit","form",h)},h=function(e,i){if(e.preventDefault(),e.stopImmediatePropagation(),""===o.val())return o.focus(),!1;acf.startButtonLoading(c);var a={action:"acf/fields/taxonomy/add_term",field_key:n.get("key"),term_name:o.val(),term_parent:s.length?s.val():0};t.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(a),type:"post",dataType:"json",success:p})},p=function(t){acf.stopButtonLoading(c),u&&u.remove(),acf.isAjaxSuccess(t)?(o.val(""),g(t.data), +u=acf.newNotice({type:"success",text:acf.getAjaxMessage(t),target:r,timeout:2e3,dismiss:!1})):u=acf.newNotice({type:"error",text:acf.getAjaxError(t),target:r,timeout:2e3,dismiss:!1}),o.focus()},g=function(e){var i=t('"),a;e.term_parent?s.children('option[value="'+e.term_parent+'"]').after(i):s.append(i),acf.getFields({type:"taxonomy"}).map(function(t){t.get("taxonomy")==n.get("taxonomy")&&t.appendTerm(e)}),n.selectTerm(e.term_id)};d()},appendTerm:function(t){"select"==this.getRelatedType()?this.appendTermSelect(t):this.appendTermCheckbox(t)},appendTermSelect:function(t){this.select2.addOption({id:t.term_id,text:t.term_label})},appendTermCheckbox:function(e){var i=this.$("[name]:first").attr("name"),n=this.$("ul:first");"checkbox"==this.getRelatedType()&&(i+="[]");var a=t(['
                • ',"","
                • "].join(""));if(e.term_parent){var r=n.find('li[data-id="'+e.term_parent+'"]');(n=r.children("ul")).exists()||(n=t(''),r.append(n))}n.append(a)},selectTerm:function(t){var e;"select"==this.getRelatedType()?this.select2.selectOption(t):this.$('input[value="'+t+'"]').prop("checked",!0).trigger("change")},onClickRadio:function(t,e){var i=e.parent("label"),n=i.hasClass("selected");this.$(".selected").removeClass("selected"),i.addClass("selected"),this.get("allow_null")&&n&&(i.removeClass("selected"),e.prop("checked",!1).trigger("change"))}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.models.DatePickerField.extend({type:"time_picker",$control:function(){return this.$(".acf-time-picker")},initialize:function(){var t=this.$input(),e=this.$inputText(),i={timeFormat:this.get("time_format"),altField:t,altFieldTimeOnly:!1,altTimeFormat:"HH:mm:ss",showButtonPanel:!0,controlType:"select",oneLine:!0,closeText:acf.get("dateTimePickerL10n").selectText,timeOnly:!0,onClose:function(t,e,i){var n=e.dpDiv.find(".ui-datepicker-close");!t&&n.is(":hover")&&i._updateDateTime()}};i=acf.applyFilters("time_picker_args",i,this),acf.newTimePicker(e,i),acf.doAction("time_picker_init",e,i,this)}});acf.registerFieldType(i),acf.newTimePicker=function(e,i){if(void 0===t.timepicker)return!1;i=i||{},e.timepicker(i),t("body > #ui-datepicker-div").exists()&&t("body > #ui-datepicker-div").wrap('
                  ')}}(jQuery),function(t,e){var i=acf.Field.extend({type:"true_false",events:{"change .acf-switch-input":"onChange","focus .acf-switch-input":"onFocus","blur .acf-switch-input":"onBlur","keypress .acf-switch-input":"onKeypress"},$input:function(){return this.$('input[type="checkbox"]')},$switch:function(){return this.$(".acf-switch")},getValue:function(){return this.$input().prop("checked")?1:0},initialize:function(){this.render()},render:function(){var t=this.$switch();if(t.length){var e=t.children(".acf-switch-on"),i=t.children(".acf-switch-off"),n=Math.max(e.width(),i.width());n&&(e.css("min-width",n),i.css("min-width",n))}},switchOn:function(){this.$input().prop("checked",!0),this.$switch().addClass("-on")},switchOff:function(){this.$input().prop("checked",!1),this.$switch().removeClass("-on")},onChange:function(t,e){e.prop("checked")?this.switchOn():this.switchOff()},onFocus:function(t,e){this.$switch().addClass("-focus")},onBlur:function(t,e){this.$switch().removeClass("-focus")},onKeypress:function(t,e){return 37===t.keyCode?this.switchOff():39===t.keyCode?this.switchOn():void 0}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"url",events:{'keyup input[type="url"]':"onkeyup"},$control:function(){return this.$(".acf-input-wrap")},$input:function(){return this.$('input[type="url"]')},initialize:function(){this.render()},isValid:function(){var t=this.val();return!!t&&(-1!==t.indexOf("://")||0===t.indexOf("//"))},render:function(){this.isValid()?this.$control().addClass("-valid"):this.$control().removeClass("-valid")},onkeyup:function(t,e){this.render()}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=acf.Field.extend({type:"wysiwyg",wait:"load",events:{"mousedown .acf-editor-wrap.delay":"onMousedown",unmountField:"disableEditor",remountField:"enableEditor",removeField:"disableEditor"},$control:function(){return this.$(".acf-editor-wrap")},$input:function(){return this.$("textarea")},getMode:function(){return this.$control().hasClass("tmce-active")?"visual":"text"},initialize:function(){this.$control().hasClass("delay")||this.initializeEditor()},initializeEditor:function(){var t=this.$control(),e=this.$input(),i={tinymce:!0,quicktags:!0,toolbar:this.get("toolbar"),mode:this.getMode(),field:this},n=e.attr("id"),a=acf.uniqueId("acf-editor-"),r=e.data();acf.rename({target:t,search:n,replace:a,destructive:!0}),this.set("id",a,!0),acf.tinymce.initialize(a,i),this.$input().data(r)},onMousedown:function(t){t.preventDefault();var e=this.$control();e.removeClass("delay"),e.find(".acf-editor-toolbar").remove(),this.initializeEditor()},enableEditor:function(){"visual"==this.getMode()&&acf.tinymce.enable(this.get("id"))},disableEditor:function(){acf.tinymce.destroy(this.get("id"))}});acf.registerFieldType(i)}(jQuery),function(t,e){var i=[];acf.Condition=acf.Model.extend({type:"",operator:"==",label:"",choiceType:"input",fieldTypes:[],data:{conditions:!1,field:!1,rule:{}},events:{change:"change",keyup:"change",enableField:"change",disableField:"change"},setup:function(e){t.extend(this.data,e)},getEventTarget:function(t,e){return t||this.get("field").$el},change:function(t,e){this.get("conditions").change(t)},match:function(t,e){return!1},calculate:function(){return this.match(this.get("rule"),this.get("field"))},choices:function(t){return''}}),acf.newCondition=function(t,e){var i=e.get("field"),n=i.getField(t.field);if(!i||!n)return!1;var a={rule:t,target:i,conditions:e,field:n},r=n.get("type"),o=t.operator,s,c,l;return new(acf.getConditionTypes({fieldType:r,operator:o})[0]||acf.Condition)(a)};var n=function(t){return acf.strPascalCase(t||"")+"Condition"};acf.registerConditionType=function(t){var e,a=t.prototype.type,r=n(a);acf.models[r]=t,i.push(a)},acf.getConditionType=function(t){var e=n(t);return acf.models[e]||!1},acf.registerConditionForFieldType=function(t,e){var i=acf.getConditionType(t);i&&i.prototype.fieldTypes.push(e)},acf.getConditionTypes=function(t){t=acf.parseArgs(t,{fieldType:"",operator:""});var e=[];return i.map(function(i){var n=acf.getConditionType(i),a=n.prototype.fieldTypes,r=n.prototype.operator;t.fieldType&&-1===a.indexOf(t.fieldType)||t.operator&&r!==t.operator||e.push(n)}),e}}(jQuery),function(t,e){var i="conditional_logic",n=new acf.Model({id:"conditionsManager",priority:20,actions:{new_field:"onNewField"},onNewField:function(t){t.has("conditions")&&t.getConditions().render()}}),a=function(t,e){var i=acf.getFields({key:e,sibling:t.$el,suppressFilters:!0});return i.length||(i=acf.getFields({key:e,parent:t.$el.parent(),suppressFilters:!0})),!!i.length&&i[0]};acf.Field.prototype.getField=function(t){var e=a(this,t);if(e)return e;for(var i=this.parents(),n=0;nparseFloat(e)},s=function(t,e){return parseFloat(t)-1},l=function(t,e){return n(t).indexOf(n(e))>-1},u=function(t,e){var i=new RegExp(n(e),"gi");return n(t).match(i)},d=acf.Condition.extend({type:"hasValue",operator:"!=empty",label:i("Has any value"),fieldTypes:["text","textarea","number","range","email","url","password","image","file","wysiwyg","oembed","select","checkbox","radio","button_group","link","post_object","page_link","relationship","taxonomy","user","google_map","date_picker","date_time_picker","time_picker","color_picker"],match:function(t,e){return!!e.val()},choices:function(t){return''}});acf.registerConditionType(d);var f=d.extend({type:"hasNoValue",operator:"==empty",label:i("Has no value"),match:function(t,e){return!d.prototype.match.apply(this,arguments)}});acf.registerConditionType(f);var h=acf.Condition.extend({type:"equalTo",operator:"==",label:i("Value is equal to"),fieldTypes:["text","textarea","number","range","email","url","password"],match:function(e,i){return t.isNumeric(e.value)?r(e.value,i.val()):a(e.value,i.val())},choices:function(t){return''}});acf.registerConditionType(h);var p=h.extend({type:"notEqualTo",operator:"!=",label:i("Value is not equal to"),match:function(t,e){return!h.prototype.match.apply(this,arguments)}});acf.registerConditionType(p);var g=acf.Condition.extend({type:"patternMatch",operator:"==pattern",label:i("Value matches pattern"),fieldTypes:["text","textarea","email","url","password","wysiwyg"],match:function(t,e){return u(e.val(),t.value)},choices:function(t){return''}});acf.registerConditionType(g);var m=acf.Condition.extend({type:"contains",operator:"==contains",label:i("Value contains"),fieldTypes:["text","textarea","number","email","url","password","wysiwyg","oembed","select"],match:function(t,e){return l(e.val(),t.value)},choices:function(t){return''}});acf.registerConditionType(m);var v=h.extend({type:"trueFalseEqualTo",choiceType:"select",fieldTypes:["true_false"],choices:function(t){return[{id:1,text:i("Checked")}]}});acf.registerConditionType(v);var y=p.extend({type:"trueFalseNotEqualTo",choiceType:"select",fieldTypes:["true_false"],choices:function(t){return[{id:1,text:i("Checked")}]}});acf.registerConditionType(y);var b=acf.Condition.extend({type:"selectEqualTo",operator:"==",label:i("Value is equal to"),fieldTypes:["select","checkbox","radio","button_group"],match:function(t,e){var i=e.val();return i instanceof Array?c(t.value,i):a(t.value,i)},choices:function(e){var n=[],a=e.$setting("choices textarea").val().split("\n");return e.$input("allow_null").prop("checked")&&n.push({id:"",text:i("Null")}),a.map(function(e){(e=e.split(":"))[1]=e[1]||e[0],n.push({id:t.trim(e[0]),text:t.trim(e[1])})}),n}});acf.registerConditionType(b);var w=b.extend({type:"selectNotEqualTo",operator:"!=",label:i("Value is not equal to"),match:function(t,e){return!b.prototype.match.apply(this,arguments)}});acf.registerConditionType(w);var x=acf.Condition.extend({type:"greaterThan",operator:">",label:i("Value is greater than"),fieldTypes:["number","range"],match:function(t,e){var i=e.val();return i instanceof Array&&(i=i.length),o(i,t.value)},choices:function(t){return''}});acf.registerConditionType(x);var _=x.extend({type:"lessThan",operator:"<",label:i("Value is less than"),match:function(t,e){var i=e.val();return i instanceof Array&&(i=i.length),s(i,t.value)},choices:function(t){return''}});acf.registerConditionType(_);var $=x.extend({type:"selectionGreaterThan",label:i("Selection is greater than"),fieldTypes:["checkbox","select","post_object","page_link","relationship","taxonomy","user"]});acf.registerConditionType($);var k=_.extend({type:"selectionLessThan",label:i("Selection is less than"),fieldTypes:["checkbox","select","post_object","page_link","relationship","taxonomy","user"]});acf.registerConditionType(k)}(jQuery),function(t,e){acf.newMediaPopup=function(t){var e=null,t=acf.parseArgs(t,{mode:"select",title:"",button:"",type:"",field:!1,allowedTypes:"",library:"all",multiple:!1,attachment:0,autoOpen:!0,open:function(){},select:function(){},close:function(){}});return e="edit"==t.mode?new acf.models.EditMediaPopup(t):new acf.models.SelectMediaPopup(t),t.autoOpen&&setTimeout(function(){e.open()},1),acf.doAction("new_media_popup",e),e};var i=function(){var e=acf.get("post_id");return t.isNumeric(e)?e:0};acf.getMimeTypes=function(){return this.get("mimeTypes")},acf.getMimeType=function(t){var e=acf.getMimeTypes();if(void 0!==e[t])return e[t];for(var i in e)if(-1!==i.indexOf(t))return e[i];return!1};var n=acf.Model.extend({id:"MediaPopup",data:{},defaults:{},frame:!1,setup:function(e){t.extend(this.data,e)},initialize:function(){var t=this.getFrameOptions();this.addFrameStates(t);var e=wp.media(t);e.acf=this,this.addFrameEvents(e,t),this.frame=e},open:function(){this.frame.open()},close:function(){this.frame.close()},remove:function(){this.frame.detach(),this.frame.remove()},getFrameOptions:function(){var t={title:this.get("title"),multiple:this.get("multiple"),library:{},states:[]};return this.get("type")&&(t.library.type=this.get("type")),"uploadedTo"===this.get("library")&&(t.library.uploadedTo=i()),this.get("attachment")&&(t.library.post__in=[this.get("attachment")]),this.get("button")&&(t.button={text:this.get("button")}),t},addFrameStates:function(t){var e=wp.media.query(t.library);this.get("field")&&acf.isset(e,"mirroring","args")&&(e.mirroring.args._acfuploader=this.get("field")),t.states.push(new wp.media.controller.Library({library:e,multiple:this.get("multiple"),title:this.get("title"),priority:20,filterable:"all",editable:!0,allowLocalEdits:!0})),acf.isset(wp,"media","controller","EditImage")&&t.states.push(new wp.media.controller.EditImage)},addFrameEvents:function(t,e){t.on("open",function(){this.$el.closest(".media-modal").addClass("acf-media-modal -"+this.acf.get("mode"))},t),t.on("content:render:edit-image",function(){var t=this.state().get("image"),e=new wp.media.view.EditImage({model:t,controller:this}).render();this.content.set(e),e.loadEditor()},t),t.on("select",function(){var e=t.state().get("selection");e&&e.each(function(e,i){t.acf.get("select").apply(t.acf,[e,i])})}),t.on("close",function(){setTimeout(function(){t.acf.get("close").apply(t.acf),t.acf.remove()},1)})}});acf.models.SelectMediaPopup=n.extend({id:"SelectMediaPopup",setup:function(t){t.button||(t.button=acf._x("Select","verb")),n.prototype.setup.apply(this,arguments)},addFrameEvents:function(t,e){acf.isset(_wpPluploadSettings,"defaults","multipart_params")&&(_wpPluploadSettings.defaults.multipart_params._acfuploader=this.get("field"),t.on("open",function(){delete _wpPluploadSettings.defaults.multipart_params._acfuploader})),t.on("content:activate:browse",function(){var e=!1;try{e=t.content.get().toolbar}catch(t){return void console.log(t)}t.acf.customizeFilters.apply(t.acf,[e])}),n.prototype.addFrameEvents.apply(this,arguments)},customizeFilters:function(e){var i=e.get("filters"),n;("image"==this.get("type")&&(i.filters.all.text=acf.__("All images"),delete i.filters.audio,delete i.filters.video,delete i.filters.image,t.each(i.filters,function(t,e){e.props.type=e.props.type||"image"})),this.get("allowedTypes"))&&this.get("allowedTypes").split(" ").join("").split(".").join("").split(",").map(function(t){var e=acf.getMimeType(t);if(e){var n={text:e,props:{status:null,type:e,uploadedTo:null,orderby:"date",order:"DESC"},priority:20};i.filters[e]=n}});if("uploadedTo"===this.get("library")){var a=this.frame.options.library.uploadedTo;delete i.filters.unattached,delete i.filters.uploaded,t.each(i.filters,function(t,e){e.text+=" ("+acf.__("Uploaded to this post")+")",e.props.uploadedTo=a})}var r=this.get("field"),o;t.each(i.filters,function(t,e){e.props._acfuploader=r}),e.get("search").model.attributes._acfuploader=r,i.renderFilters&&i.renderFilters()}}),acf.models.EditMediaPopup=n.extend({id:"SelectMediaPopup",setup:function(t){t.button||(t.button=acf._x("Update","verb")),n.prototype.setup.apply(this,arguments)},addFrameEvents:function(t,e){t.on("open",function(){this.$el.closest(".media-modal").addClass("acf-expanded"),"browse"!=this.content.mode()&&this.content.mode("browse");var e,i=this.state().get("selection"),n=wp.media.attachment(t.acf.get("attachment"));i.add(n)},t),n.prototype.addFrameEvents.apply(this,arguments)}});var a=new acf.Model({id:"customizePrototypes",wait:"ready",initialize:function(){if(acf.isset(window,"wp","media","view")){var t=i();t&&acf.isset(wp,"media","view","settings","post")&&(wp.media.view.settings.post.id=t),this.customizeAttachmentsButton(),this.customizeAttachmentsRouter(),this.customizeAttachmentFilters(),this.customizeAttachmentCompat(),this.customizeAttachmentLibrary()}},customizeAttachmentsButton:function(){if(acf.isset(wp,"media","view","Button")){var t=wp.media.view.Button;wp.media.view.Button=t.extend({initialize:function(){var t=_.defaults(this.options,this.defaults);this.model=new Backbone.Model(t),this.listenTo(this.model,"change",this.render)}})}},customizeAttachmentsRouter:function(){if(acf.isset(wp,"media","view","Router")){var e=wp.media.view.Router;wp.media.view.Router=e.extend({addExpand:function(){var e=t(['',''+acf.__("Expand Details")+"",''+acf.__("Collapse Details")+"",""].join(""));e.on("click",function(e){e.preventDefault();var i=t(this).closest(".media-modal");i.hasClass("acf-expanded")?i.removeClass("acf-expanded"):i.addClass("acf-expanded")}),this.$el.append(e)},initialize:function(){return e.prototype.initialize.apply(this,arguments),this.addExpand(),this}})}},customizeAttachmentFilters:function(){var e;acf.isset(wp,"media","view","AttachmentFilters","All")&&(wp.media.view.AttachmentFilters.All.prototype.renderFilters=function(){this.$el.html(_.chain(this.filters).map(function(e,i){return{el:t("").val(i).html(e.text)[0],priority:e.priority||50}},this).sortBy("priority").pluck("el").value())})},customizeAttachmentCompat:function(){if(acf.isset(wp,"media","view","AttachmentCompat")){var e=wp.media.view.AttachmentCompat,i=!1;wp.media.view.AttachmentCompat=e.extend({render:function(){return this.rendered?this:(e.prototype.render.apply(this,arguments),this.$("#acf-form-data").length?(clearTimeout(i),i=setTimeout(t.proxy(function(){this.rendered=!0,acf.doAction("append",this.$el)},this),50),this):this)},save:function(t){var e={};t&&t.preventDefault(),e=acf.serializeForAjax(this.$el),this.controller.trigger("attachment:compat:waiting",["waiting"]),this.model.saveCompat(e).always(_.bind(this.postSave,this))}})}},customizeAttachmentLibrary:function(){if(acf.isset(wp,"media","view","Attachment","Library")){var t=wp.media.view.Attachment.Library;wp.media.view.Attachment.Library=t.extend({render:function(){var e=acf.isget(this,"controller","acf"),i=acf.isget(this,"model","attributes");if(e&&i){i.acf_errors&&this.$el.addClass("acf-disabled");var n=e.get("selected");n&&n.indexOf(i.id)>-1&&this.$el.addClass("acf-selected")}return t.prototype.render.apply(this,arguments)},toggleSelection:function(e){var i=this.collection,n=this.options.selection,a=this.model,r=n.single(),o=this.controller,s=acf.isget(this,"model","attributes","acf_errors"),c=o.$el.find(".media-frame-content .media-sidebar");if(c.children(".acf-selection-error").remove(),c.children().removeClass("acf-hidden"),o&&s){var l=acf.isget(this,"model","attributes","filename");return c.children().addClass("acf-hidden"),c.prepend(['
                  ',''+acf.__("Restricted")+"",''+l+"",''+s+"","
                  "].join("")),n.reset(),void n.single(a)}return t.prototype.toggleSelection.apply(this,arguments)}})}}})}(jQuery),function(t,e){acf.screen=new acf.Model({active:!0,xhr:!1,timeout:!1,wait:"load",events:{"change #page_template":"onChange","change #parent_id":"onChange","change #post-formats-select":"onChange","change .categorychecklist":"onChange","change .tagsdiv":"onChange",'change .acf-taxonomy-field[data-save="1"]':"onChange","change #product-type":"onChange"},isPost:function(){return"post"===acf.get("screen")},isUser:function(){return"user"===acf.get("screen")},isTaxonomy:function(){return"taxonomy"===acf.get("screen")},isAttachment:function(){return"attachment"===acf.get("screen")},isNavMenu:function(){return"nav_menu"===acf.get("screen")},isWidget:function(){return"widget"===acf.get("screen")},isComment:function(){return"comment"===acf.get("screen")},getPageTemplate:function(){var e=t("#page_template");return e.length?e.val():null},getPageParent:function(e,i){var i;return(i=t("#parent_id")).length?i.val():null},getPageType:function(t,e){return this.getPageParent()?"child":"parent"},getPostType:function(){return t("#post_type").val()},getPostFormat:function(e,i){var i;if((i=t("#post-formats-select input:checked")).length){var n=i.val();return"0"==n?"standard":n}return null},getPostCoreTerms:function(){var e={},i=acf.serialize(t(".categorydiv, .tagsdiv"));for(var n in i.tax_input&&(e=i.tax_input),i.post_category&&(e.category=i.post_category),e)acf.isArray(e[n])||(e[n]=e[n].split(/,[\s]?/));return e},getPostTerms:function(){var t=this.getPostCoreTerms();for(var e in acf.getFields({type:"taxonomy"}).map(function(e){if(e.get("save")){var i=e.val(),n=e.get("taxonomy");i&&(t[n]=t[n]||[],i=acf.isArray(i)?i:[i],t[n]=t[n].concat(i))}}),null!==(productType=this.getProductType())&&(t.product_type=[productType]),t)t[e]=acf.uniqueArray(t[e]);return t},getProductType:function(){var e=t("#product-type");return e.length?e.val():null},check:function(){if("post"===acf.get("screen")){this.xhr&&this.xhr.abort();var e=acf.parseArgs(this.data,{action:"acf/ajax/check_screen",screen:acf.get("screen"),exists:[]});this.isPost()&&(e.post_id=acf.get("post_id")),null!==(postType=this.getPostType())&&(e.post_type=postType),null!==(pageTemplate=this.getPageTemplate())&&(e.page_template=pageTemplate),null!==(pageParent=this.getPageParent())&&(e.page_parent=pageParent),null!==(pageType=this.getPageType())&&(e.page_type=pageType),null!==(postFormat=this.getPostFormat())&&(e.post_format=postFormat),null!==(postTerms=this.getPostTerms())&&(e.post_terms=postTerms),acf.getPostboxes().map(function(t){e.exists.push(t.get("key"))}),e=acf.applyFilters("check_screen_args",e);var i=function(t){acf.isAjaxSuccess(t)&&("post"==acf.get("screen")?this.renderPostScreen(t.data):"user"==acf.get("screen")&&this.renderUserScreen(t.data)),acf.doAction("check_screen_complete",t.data,e)};this.xhr=t.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(e),type:"post",dataType:"json",context:this,success:i})}},onChange:function(t,e){this.setTimeout(this.check,1)},renderPostScreen:function(e){var i=[],n=function(e,i){var n=t._data(e[0]).events;for(var a in n)for(var r=0;r=0;a--)if(t("#"+i[a]).length)return t("#"+i[a]).after(t("#"+e));for(var a=n+1;a','",'

                  ',""+r.title+"","

                  ",'
                  ',r.html,"
                  ","
                  "].join(""));if(t("#adv-settings").length){var l=t("#adv-settings .metabox-prefs"),u=t(['"].join(""));n(l.find("input").first(),u.find("input")),l.append(u)}"side"===r.position?t("#"+r.position+"-sortables").append(c):t("#"+r.position+"-sortables").prepend(c);var d=[];if(e.results.map(function(e){r.position===e.position&&t("#"+r.position+"-sortables #"+e.id).length&&d.push(e.id)}),a(r.id,d),e.sorted)for(var f in e.sorted){var d=e.sorted[f].split(",");if(a(r.id,d))break}var h=t("#submitdiv");t("#submitdiv").length&&(n(h.children(".handlediv"),c.children(".handlediv")),n(h.children(".hndle"),c.children(".hndle"))),s=acf.newPostbox(r),acf.doAction("append",c),acf.doAction("append_postbox",s)}s.showEnable(),acf.doAction("show_postbox",s),i.push(r.id)}),acf.getPostboxes().map(function(t){-1===i.indexOf(t.get("id"))&&(t.hideDisable(),acf.doAction("hide_postbox",t))}),t("#acf-style").html(e.style)},renderUserScreen:function(t){}});var i=new acf.Model({wait:"load",initialize:function(){acf.isGutenberg()&&(wp.data.subscribe(this.proxy(this.onChange)),acf.screen.getPageTemplate=this.getPageTemplate,acf.screen.getPageParent=this.getPageParent,acf.screen.getPostType=this.getPostType,acf.screen.getPostFormat=this.getPostFormat,acf.screen.getPostCoreTerms=this.getPostCoreTerms,acf.unload.disable())},onChange:function(){var t=wp.data.select("core/editor").getPostEdits(),e=["template","parent","format"],i;(wp.data.select("core").getTaxonomies()||[]).map(function(t){e.push(t.rest_base)}),(e=e.filter(this.proxy(function(e){return void 0!==t[e]&&t[e]!==this.get(e)}))).length&&this.triggerChange(t)},triggerChange:function(t){void 0!==t&&(this.data=t),acf.screen.check()},getPageTemplate:function(){return wp.data.select("core/editor").getEditedPostAttribute("template")},getPageParent:function(t,e){return wp.data.select("core/editor").getEditedPostAttribute("parent")},getPostType:function(){return wp.data.select("core/editor").getEditedPostAttribute("type")},getPostFormat:function(t,e){return wp.data.select("core/editor").getEditedPostAttribute("format")},getPostCoreTerms:function(){var t={},e;return(wp.data.select("core").getTaxonomies()||[]).map(function(e){var i=wp.data.select("core/editor").getEditedPostAttribute(e.rest_base);i&&(t[e.slug]=i)}),t}});acf.screen.refreshAvailableMetaBoxesPerLocation=function(){var t=wp.data.select("core/edit-post"),e=wp.data.dispatch("core/edit-post"),i={};t.getActiveMetaBoxLocations().map(function(e){i[e]=t.getMetaBoxesPerLocation(e)});var n=[];for(var a in i)n=n.concat(i[a].map(function(t){return t.id}));acf.getPostboxes().map(function(t){if(-1===n.indexOf(t.get("id"))){var e=t.$el.closest("form").attr("class").replace("metabox-location-","");i[e]=i[e]||[],i[e].push({id:t.get("id"),title:t.get("title")})}}),e.setAvailableMetaBoxesPerLocation(i)}}(jQuery),function(t,e){function i(){return acf.isset(window,"jQuery","fn","select2","amd")?4:!!acf.isset(window,"Select2")&&3}acf.newSelect2=function(t,e){if(e=acf.parseArgs(e,{allowNull:!1,placeholder:"",multiple:!1,field:!1,ajax:!1,ajaxAction:"",ajaxData:function(t){return t},ajaxResults:function(t){return t}}),4==i())var n=new a(t,e);else var n=new r(t,e);return acf.doAction("new_select2",n),n};var n=acf.Model.extend({setup:function(e,i){t.extend(this.data,i),this.$el=e},initialize:function(){},selectOption:function(t){var e=this.getOption(t);e.prop("selected")||e.prop("selected",!0).trigger("change")},unselectOption:function(t){var e=this.getOption(t);e.prop("selected")&&e.prop("selected",!1).trigger("change")},getOption:function(t){return this.$('option[value="'+t+'"]')},addOption:function(e){e=acf.parseArgs(e,{id:"",text:"",selected:!1});var i=this.getOption(e.id);return i.length||((i=t("")).html(e.text),i.attr("value",e.id),i.prop("selected",e.selected),this.$el.append(i)),i},getValue:function(){var e=[],i=this.$el.find("option:selected");return i.exists()?((i=i.sort(function(t,e){return+t.getAttribute("data-i")-+e.getAttribute("data-i")})).each(function(){var i=t(this);e.push({$el:i,id:i.attr("value"),text:i.text()})}),e):e},mergeOptions:function(){},getChoices:function(){var e=function(i){var n=[];return i.children().each(function(){var i=t(this);i.is("optgroup")?n.push({text:i.attr("label"),children:e(i)}):n.push({id:i.attr("value"),text:i.text()})}),n};return e(this.$el)},decodeChoices:function(t){var e=function(t){return t.map(function(t){return t.text=acf.decode(t.text),t.children&&(t.children=e(t.children)),t}),t};return e(t)},getAjaxData:function(t){var e={action:this.get("ajaxAction"),s:t.term||"",paged:t.page||1},i=this.get("field");i&&(e.field_key=i.get("key"));var n=this.get("ajaxData");return n&&(e=n.apply(this,[e,t])),e=acf.applyFilters("select2_ajax_data",e,this.data,this.$el,i||!1,this),acf.prepareForAjax(e)},getAjaxResults:function(t,e){(t=acf.parseArgs(t,{results:!1,more:!1})).results&&(t.results=this.decodeChoices(t.results));var i=this.get("ajaxResults");return i&&(t=i.apply(this,[t,e])),t=acf.applyFilters("select2_ajax_results",t,e,this)},processAjaxResults:function(e,i){var e;return(e=this.getAjaxResults(e,i)).more&&(e.pagination={more:!0}),setTimeout(t.proxy(this.mergeOptions,this),1),e},destroy:function(){this.$el.data("select2")&&this.$el.select2("destroy"),this.$el.siblings(".select2-container").remove()}}),a=n.extend({initialize:function(){var e=this.$el,i={width:"100%",allowClear:this.get("allowNull"),placeholder:this.get("placeholder"),multiple:this.get("multiple"),data:[],escapeMarkup:function(t){return t}};i.multiple&&this.getValue().map(function(t){t.$el.detach().appendTo(e)}),e.removeData("ajax"),e.removeAttr("data-ajax"),this.get("ajax")&&(i.ajax={url:acf.get("ajaxurl"),delay:250,dataType:"json",type:"post",cache:!1,data:t.proxy(this.getAjaxData,this),processResults:t.proxy(this.processAjaxResults,this)});var n=this.get("field");i=acf.applyFilters("select2_args",i,e,this.data,n||!1,this),e.select2(i);var a=e.next(".select2-container");if(i.multiple){var r=a.find("ul");r.sortable({stop:function(i){r.find(".select2-selection__choice").each(function(){var i;t(t(this).data("data").element).detach().appendTo(e)}),e.trigger("change")}}),e.on("select2:select",this.proxy(function(t){this.getOption(t.params.data.id).detach().appendTo(this.$el)}))}a.addClass("-acf"),acf.doAction("select2_init",e,i,this.data,n||!1,this)},mergeOptions:function(){var e=!1,i=!1;t('.select2-results__option[role="group"]').each(function(){var n=t(this).children("ul"),a=t(this).children("strong");if(i&&i.text()===a.text())return e.append(n.children()),void t(this).remove();e=n,i=a})}}),r=n.extend({initialize:function(){var e=this.$el,i=this.getValue(),n=this.get("multiple"),a={width:"100%",allowClear:this.get("allowNull"),placeholder:this.get("placeholder"),separator:"||",multiple:this.get("multiple"),data:this.getChoices(),escapeMarkup:function(t){return t},dropdownCss:{"z-index":"999999999"}, +initSelection:function(t,e){e(n?i:i.shift())}},r=e.siblings("input");r.length||(r=t(''),e.before(r)),inputValue=i.map(function(t){return t.id}).join("||"),r.val(inputValue),a.multiple&&i.map(function(t){t.$el.detach().appendTo(e)}),a.allowClear&&(a.data=a.data.filter(function(t){return""!==t.id})),e.removeData("ajax"),e.removeAttr("data-ajax"),this.get("ajax")&&(a.ajax={url:acf.get("ajaxurl"),quietMillis:250,dataType:"json",type:"post",cache:!1,data:t.proxy(this.getAjaxData,this),results:t.proxy(this.processAjaxResults,this)});var o=this.get("field");a=acf.applyFilters("select2_args",a,e,this.data,o||!1,this),r.select2(a);var s=r.select2("container"),c=t.proxy(this.getOption,this);if(a.multiple){var l=s.find("ul");l.sortable({stop:function(){l.find(".select2-search-choice").each(function(){var i=t(this).data("select2Data"),n;c(i.id).detach().appendTo(e)}),e.trigger("change")}})}r.on("select2-selecting",function(i){var n=i.choice,a=c(n.id);a.length||(a=t('")),a.detach().appendTo(e)}),s.addClass("-acf"),acf.doAction("select2_init",e,a,this.data,o||!1,this),r.on("change",function(){var t=r.val();t.indexOf("||")&&(t=t.split("||")),e.val(t).trigger("change")}),e.hide()},mergeOptions:function(){var e=!1,i=!1;t("#select2-drop .select2-result-with-children").each(function(){var n=t(this).children("ul"),a=t(this).children(".select2-result-label");if(i&&i.text()===a.text())return i.append(n.children()),void t(this).remove();e=n,i=a})},getAjaxData:function(t,e){var i={term:t,page:e};return n.prototype.getAjaxData.apply(this,[i])}}),o=new acf.Model({priority:5,wait:"prepare",initialize:function(){var t=acf.get("locale"),e=acf.get("rtl"),n=acf.get("select2L10n"),a=i();return!!n&&(0!==t.indexOf("en")&&void(4==a?this.addTranslations4():3==a&&this.addTranslations3()))},addTranslations4:function(){var t=acf.get("select2L10n"),e=acf.get("locale");e=e.replace("_","-");var i={errorLoading:function(){return t.load_fail},inputTooLong:function(e){var i=e.input.length-e.maximum;return i>1?t.input_too_long_n.replace("%d",i):t.input_too_long_1},inputTooShort:function(e){var i=e.minimum-e.input.length;return i>1?t.input_too_short_n.replace("%d",i):t.input_too_short_1},loadingMore:function(){return t.load_more},maximumSelected:function(e){var i=e.maximum;return i>1?t.selection_too_long_n.replace("%d",i):t.selection_too_long_1},noResults:function(){return t.matches_0},searching:function(){return t.searching}};jQuery.fn.select2.amd.define("select2/i18n/"+e,[],function(){return i})},addTranslations3:function(){var e=acf.get("select2L10n"),i=acf.get("locale");i=i.replace("_","-");var n={formatMatches:function(t){return t>1?e.matches_n.replace("%d",t):e.matches_1},formatNoMatches:function(){return e.matches_0},formatAjaxError:function(){return e.load_fail},formatInputTooShort:function(t,i){var n=i-t.length;return n>1?e.input_too_short_n.replace("%d",n):e.input_too_short_1},formatInputTooLong:function(t,i){var n=t.length-i;return n>1?e.input_too_long_n.replace("%d",n):e.input_too_long_1},formatSelectionTooBig:function(t){return t>1?e.selection_too_long_n.replace("%d",t):e.selection_too_long_1},formatLoadMore:function(){return e.load_more},formatSearching:function(){return e.searching}};t.fn.select2.locales=t.fn.select2.locales||{},t.fn.select2.locales[i]=n,t.extend(t.fn.select2.defaults,n)}})}(jQuery),function(t,e){acf.tinymce={defaults:function(){return"undefined"!=typeof tinyMCEPreInit&&{tinymce:tinyMCEPreInit.mceInit.acf_content,quicktags:tinyMCEPreInit.qtInit.acf_content};var t},initialize:function(t,e){(e=acf.parseArgs(e,{tinymce:!0,quicktags:!0,toolbar:"full",mode:"visual",field:!1})).tinymce&&this.initializeTinymce(t,e),e.quicktags&&this.initializeQuicktags(t,e)},initializeTinymce:function(e,i){var n=t("#"+e),a=this.defaults(),r=acf.get("toolbars"),o=i.field||!1,s=o.$el||!1;if("undefined"==typeof tinymce)return!1;if(!a)return!1;if(tinymce.get(e))return this.enable(e);var c=t.extend({},a.tinymce,i.tinymce);c.id=e,c.selector="#"+e;var l=i.toolbar;if(l&&r&&r[l])for(var u=1;u<=4;u++)c["toolbar"+u]=r[l][u]||"";if(c.setup=function(t){t.on("change",function(e){t.save(),n.trigger("change")}),t.on("mouseup",function(t){var e=new MouseEvent("mouseup");window.dispatchEvent(e)})},c.wp_autoresize_on=!1,c.tadv_noautop||(c.wpautop=!0),c=acf.applyFilters("wysiwyg_tinymce_settings",c,e,o),tinyMCEPreInit.mceInit[e]=c,"visual"==i.mode){var d=tinymce.init(c),f=tinymce.get(e);if(!f)return!1;f.acf=i.field,acf.doAction("wysiwyg_tinymce_init",f,f.id,c,o)}},initializeQuicktags:function(e,i){var n=this.defaults();if("undefined"==typeof quicktags)return!1;if(!n)return!1;var a=t.extend({},n.quicktags,i.quicktags);a.id=e;var r=i.field||!1,o=r.$el||!1;a=acf.applyFilters("wysiwyg_quicktags_settings",a,a.id,r),tinyMCEPreInit.qtInit[e]=a;var s=quicktags(a);if(!s)return!1;this.buildQuicktags(s),acf.doAction("wysiwyg_quicktags_init",s,s.id,a,r)},buildQuicktags:function(t){var e,i,n,a,r,t,o,s,c,l,u=",strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,";for(s in e=t.canvas,i=t.name,n=t.settings,r="",a={},c="",l=t.id,n.buttons&&(c=","+n.buttons+","),edButtons)edButtons[s]&&(o=edButtons[s].id,c&&-1!==u.indexOf(","+o+",")&&-1===c.indexOf(","+o+",")||edButtons[s].instance&&edButtons[s].instance!==l||(a[o]=edButtons[s],edButtons[s].html&&(r+=edButtons[s].html(i+"_"))));c&&-1!==c.indexOf(",dfw,")&&(a.dfw=new QTags.DFWButton,r+=a.dfw.html(i+"_")),"rtl"===document.getElementsByTagName("html")[0].dir&&(a.textdirection=new QTags.TextDirectionButton,r+=a.textdirection.html(i+"_")),t.toolbar.innerHTML=r,t.theButtons=a,"undefined"!=typeof jQuery&&jQuery(document).triggerHandler("quicktags-init",[t])},disable:function(t){this.destroyTinymce(t)},remove:function(t){this.destroyTinymce(t)},destroy:function(t){this.destroyTinymce(t)},destroyTinymce:function(t){if("undefined"==typeof tinymce)return!1;var e=tinymce.get(t);return!!e&&(e.save(),e.destroy(),!0)},enable:function(t){this.enableTinymce(t)},enableTinymce:function(t){return"undefined"!=typeof switchEditors&&(void 0!==tinyMCEPreInit.mceInit[t]&&(switchEditors.go(t,"tmce"),!0))}};var i=new acf.Model({priority:5,actions:{prepare:"onPrepare",ready:"onReady"},onPrepare:function(){var e=t("#acf-hidden-wp-editor");e.exists()&&e.appendTo("body")},onReady:function(){acf.isset(window,"wp","oldEditor")&&(wp.editor.autop=wp.oldEditor.autop,wp.editor.removep=wp.oldEditor.removep),acf.isset(window,"tinymce","on")&&tinymce.on("AddEditor",function(t){var e=t.editor;"acf"===e.id.substr(0,3)&&(e=tinymce.editors.content||e,tinymce.activeEditor=e,wpActiveEditor=e.id)})}})}(jQuery),function(t,e){var i=acf.Model.extend({id:"Validator",data:{errors:[],notice:null,status:""},events:{"changed:status":"onChangeStatus"},addErrors:function(t){t.map(this.addError,this)},addError:function(t){this.data.errors.push(t)},hasErrors:function(){return this.data.errors.length},clearErrors:function(){return this.data.errors=[]},getErrors:function(){return this.data.errors},getFieldErrors:function(){var t=[],e=[];return this.getErrors().map(function(i){if(i.input){var n=e.indexOf(i.input);n>-1?t[n]=i:(t.push(i),e.push(i.input))}}),t},getGlobalErrors:function(){return this.getErrors().filter(function(t){return!t.input})},showErrors:function(){if(this.hasErrors()){var e=this.getFieldErrors(),i=this.getGlobalErrors(),n=0,a=!1;e.map(function(t){var e=this.$('[name="'+t.input+'"]').first();if(e.length||(e=this.$('[name^="'+t.input+'"]').first()),e.length){n++;var i=acf.getClosestField(e);i.showError(t.message),a||(a=i.$el)}},this);var r=acf.__("Validation failed");if(i.map(function(t){r+=". "+t.message}),1==n?r+=". "+acf.__("1 field requires attention"):n>1&&(r+=". "+acf.__("%d fields require attention").replace("%d",n)),this.has("notice"))this.get("notice").update({type:"error",text:r});else{var o=acf.newNotice({type:"error",text:r,target:this.$el});this.set("notice",o)}a||(a=this.get("notice").$el),setTimeout(function(){t("html, body").animate({scrollTop:a.offset().top-t(window).height()/2},500)},10)}},onChangeStatus:function(t,e,i,n){this.$el.removeClass("is-"+n).addClass("is-"+i)},validate:function(e){if(e=acf.parseArgs(e,{event:!1,reset:!1,loading:function(){},complete:function(){},failure:function(){},success:function(t){t.submit()}}),"valid"==this.get("status"))return!0;if("validating"==this.get("status"))return!1;if(!this.$(".acf-field").length)return!0;if(e.event){var i=t.Event(null,e.event);e.success=function(){acf.enableSubmit(t(i.target)).trigger(i)}}acf.doAction("validation_begin",this.$el),acf.lockForm(this.$el),e.loading(this.$el,this),this.set("status","validating");var n=function(t){if(acf.isAjaxSuccess(t)){var e=acf.applyFilters("validation_complete",t.data,this.$el,this);e.valid||this.addErrors(e.errors)}},a=function(){acf.unlockForm(this.$el),this.hasErrors()?(this.set("status","invalid"),acf.doAction("validation_failure",this.$el,this),this.showErrors(),e.failure(this.$el,this)):(this.set("status","valid"),this.has("notice")&&this.get("notice").update({type:"success",text:acf.__("Validation successful"),timeout:1e3}),acf.doAction("validation_success",this.$el,this),acf.doAction("submit",this.$el),e.success(this.$el,this),acf.lockForm(this.$el),e.reset&&this.reset()),e.complete(this.$el,this),this.clearErrors()},r=acf.serialize(this.$el);return r.action="acf/validate_save_post",t.ajax({url:acf.get("ajaxurl"),data:acf.prepareForAjax(r),type:"post",dataType:"json",context:this,success:n,complete:a}),!1},setup:function(t){this.$el=t},reset:function(){this.set("errors",[]),this.set("notice",null),this.set("status",""),acf.unlockForm(this.$el)}}),n=function(t){var e=t.data("acf");return e||(e=new i(t)),e};acf.validateForm=function(t){return n(t.form).validate(t)},acf.enableSubmit=function(t){return t.removeClass("disabled")},acf.disableSubmit=function(t){return t.addClass("disabled")},acf.showSpinner=function(t){return t.addClass("is-active"),t.css("display","inline-block"),t},acf.hideSpinner=function(t){return t.removeClass("is-active"),t.css("display","none"),t},acf.lockForm=function(t){var e=a(t),i=e.find('.button, [type="submit"]'),n=e.find(".spinner, .acf-spinner");return acf.hideSpinner(n),acf.disableSubmit(i),acf.showSpinner(n.last()),t},acf.unlockForm=function(t){var e=a(t),i=e.find('.button, [type="submit"]'),n=e.find(".spinner, .acf-spinner");return acf.enableSubmit(i),acf.hideSpinner(n),t};var a=function(t){var e,e,e,e;return(e=t.find("#submitdiv")).length?e:(e=t.find("#submitpost")).length?e:(e=t.find("p.submit").last()).length?e:(e=t.find(".acf-form-submit")).length?e:t};acf.validation=new acf.Model({id:"validation",active:!0,wait:"prepare",actions:{ready:"addInputEvents",append:"addInputEvents"},events:{'click input[type="submit"]':"onClickSubmit",'click button[type="submit"]':"onClickSubmit","click #save-post":"onClickSave","submit form#post":"onSubmitPost","submit form":"onSubmit"},initialize:function(){acf.get("validation")||(this.active=!1,this.actions={},this.events={})},enable:function(){this.active=!0},disable:function(){this.active=!1},reset:function(t){n(t).reset()},addInputEvents:function(e){var i=t(".acf-field [name]",e);i.length&&this.on(i,"invalid","onInvalid")},onInvalid:function(t,e){t.preventDefault();var i=e.closest("form");i.length&&(n(i).addError({input:e.attr("name"),message:t.target.validationMessage}),i.submit())},onClickSubmit:function(t,e){this.set("originalEvent",t)},onClickSave:function(t,e){this.set("ignore",!0)},onClickSubmitGutenberg:function(e,i){var n;acf.validateForm({form:t("#editor"),event:e,reset:!0,failure:function(t,e){var i=e.get("notice").$el;i.appendTo(".components-notice-list"),i.find(".acf-notice-dismiss").removeClass("small")}})||(e.preventDefault(),e.stopImmediatePropagation())},onSubmitPost:function(e,i){"dopreview"===t("input#wp-preview").val()&&(this.set("ignore",!0),acf.unlockForm(i))},onSubmit:function(t,e){if(!this.active||this.get("ignore")||t.isDefaultPrevented())return this.allowSubmit();var i;acf.validateForm({form:e,event:this.get("originalEvent")})||t.preventDefault()},allowSubmit:function(){return this.set("ignore",!1),this.set("originalEvent",!1),!0}})}(jQuery),function(t,e){var i=new acf.Model({priority:90,timeout:0,actions:{new_field:"refresh",show_field:"refresh",hide_field:"refresh",remove_field:"refresh"},refresh:function(){clearTimeout(this.timeout),this.timeout=setTimeout(function(){acf.doAction("refresh")},0)}}),n=new acf.Model({priority:1,actions:{sortstart:"onSortstart",sortstop:"onSortstop"},onSortstart:function(t){acf.doAction("unmount",t)},onSortstop:function(t){acf.doAction("remount",t)}}),a=new acf.Model({actions:{sortstart:"onSortstart"},onSortstart:function(e,i){e.is("tr")&&(i.html(''),e.addClass("acf-sortable-tr-helper"),e.children().each(function(){t(this).width(t(this).width())}),i.height(e.height()+"px"),e.removeClass("acf-sortable-tr-helper"))}}),r=new acf.Model({actions:{after_duplicate:"onAfterDuplicate"},onAfterDuplicate:function(e,i){var n=[];e.find("select").each(function(e){n.push(t(this).val())}),i.find("select").each(function(e){t(this).val(n[e])})}}),o=new acf.Model({id:"tableHelper",priority:20,actions:{refresh:"renderTables"},renderTables:function(e){var i=this;t(".acf-table:visible").each(function(){i.renderTable(t(this))})},renderTable:function(e){var i=e.find("> thead > tr:visible > th[data-key]"),n=e.find("> tbody > tr:visible > td[data-key]");if(!i.length||!n.length)return!1;i.each(function(e){var i=t(this),a=i.data("key"),r=n.filter('[data-key="'+a+'"]'),o=r.filter(".acf-hidden");r.removeClass("acf-empty"),r.length===o.length?acf.hide(i):(acf.show(i),o.addClass("acf-empty"))}),i.css("width","auto"),i=i.not(".acf-hidden");var a=100,r=i.length,o;i.filter("[data-width]").each(function(){var e=t(this).data("width");t(this).css("width",e+"%"),a-=e});var s=i.not("[data-width]");if(s.length){var c=a/s.length;s.css("width",c+"%"),a=0}a>0&&i.last().css("width","auto"),n.filter(".-collapsed-target").each(function(){var e=t(this);e.parent().hasClass("-collapsed")?e.attr("colspan",i.length):e.removeAttr("colspan")})}}),s=new acf.Model({id:"fieldsHelper",priority:30,actions:{refresh:"renderGroups"},renderGroups:function(){var e=this;t(".acf-fields:visible").each(function(){e.renderGroup(t(this))})},renderGroup:function(e){var i=0,n=0,a=t(),r=e.children(".acf-field[data-width]:visible");return!!r.length&&(e.hasClass("-left")?(r.removeAttr("data-width"),r.css("width","auto"),!1):(r.removeClass("-r0 -c0").css({"min-height":0}),r.each(function(e){var r=t(this),o=r.position(),s=Math.ceil(o.top),c=Math.ceil(o.left);a.length&&s>i&&(a.css({"min-height":n+"px"}),o=r.position(),s=Math.ceil(o.top),c=Math.ceil(o.left),i=0,n=0,a=t()),acf.get("rtl")&&(c=Math.ceil(r.parent().width()-(o.left+r.outerWidth()))),0==s?r.addClass("-r0"):0==c&&r.addClass("-c0");var l=Math.ceil(r.outerHeight())+1;n=Math.max(n,l),i=Math.max(i,s),a=a.add(r)}),void(a.length&&a.css({"min-height":n+"px"}))))}})}(jQuery),function(t,e){acf.newCompatibility=function(t,e){return(e=e||{}).__proto__=t.__proto__,t.__proto__=e,t.compatibility=e,e},acf.getCompatibility=function(t){return t.compatibility||null};var i=acf.newCompatibility(acf,{l10n:{},o:{},fields:{},update:acf.set,add_action:acf.addAction,remove_action:acf.removeAction,do_action:acf.doAction,add_filter:acf.addFilter,remove_filter:acf.removeFilter,apply_filters:acf.applyFilters,parse_args:acf.parseArgs,disable_el:acf.disable,disable_form:acf.disable,enable_el:acf.enable,enable_form:acf.enable,update_user_setting:acf.updateUserSetting,prepare_for_ajax:acf.prepareForAjax,is_ajax_success:acf.isAjaxSuccess,remove_el:acf.remove,remove_tr:acf.remove,str_replace:acf.strReplace,render_select:acf.renderSelect,get_uniqid:acf.uniqid,serialize_form:acf.serialize,esc_html:acf.strEscape,str_sanitize:acf.strSanitize});i._e=function(t,e){t=t||"";var i=(e=e||"")?t+"."+e:t,n={"image.select":"Select Image","image.edit":"Edit Image","image.update":"Update Image"};if(n[i])return acf.__(n[i]);var a=this.l10n[t]||"";return e&&(a=a[e]||""),a},i.get_selector=function(e){var i=".acf-field";if(!e)return i;if(t.isPlainObject(e)){if(t.isEmptyObject(e))return i;for(var n in e){e=e[n];break}}return i+="-"+e,i=acf.strReplace("_","-",i),i=acf.strReplace("field-field-","field-",i)},i.get_fields=function(t,e,i){var n={is:t||"",parent:e||!1,suppressFilters:i||!1};return n.is&&(n.is=this.get_selector(n.is)),acf.findFields(n)},i.get_field=function(t,e){var i=this.get_fields.apply(this,arguments);return!!i.length&&i.first()},i.get_closest_field=function(t,e){return t.closest(this.get_selector(e))},i.get_field_wrap=function(t){return t.closest(this.get_selector())},i.get_field_key=function(t){return t.data("key")},i.get_field_type=function(t){return t.data("type")},i.get_data=function(t,e){return acf.parseArgs(t.data(),e)},i.maybe_get=function(t,e,i){void 0===i&&(i=null),keys=String(e).split(".");for(var n=0;n1){for(var c=0;c0?e.substr(0,a):e,o=a>0?e.substr(a+1):"",s=function(e){e.$el=t(this),acf.field_group&&(e.$field=e.$el.closest(".acf-field-object")),"function"==typeof n.event&&(e=n.event(e)),n[i].apply(n,arguments)};o?t(document).on(r,o,s):t(document).on(r,s)},get:function(t,e){return e=e||null,void 0!==this[t]&&(e=this[t]),e},set:function(t,e){return this[t]=e,"function"==typeof this["_set_"+t]&&this["_set_"+t].apply(this),this}},i.field=acf.model.extend({type:"",o:{},$field:null,_add_action:function(t,e){var i=this;t=t+"_field/type="+i.type,acf.add_action(t,function(t){i.set("$field",t),i[e].apply(i,arguments)})},_add_filter:function(t,e){var i=this;t=t+"_field/type="+i.type,acf.add_filter(t,function(t){i.set("$field",t),i[e].apply(i,arguments)})},_add_event:function(e,i){var n=this,a=e.substr(0,e.indexOf(" ")),r=e.substr(e.indexOf(" ")+1),o=acf.get_selector(n.type);t(document).on(a,o+" "+r,function(e){var a=t(this),r=acf.get_closest_field(a,n.type);r.length&&(r.is(n.$field)||n.set("$field",r),e.$el=a,e.$field=r,n[i].apply(n,[e]))})},_set_$field:function(){"function"==typeof this.focus&&this.focus()},doFocus:function(t){return this.set("$field",t)}});var o=acf.newCompatibility(acf.validation,{remove_error:function(t){acf.getField(t).removeError()},add_warning:function(t,e){acf.getField(t).showNotice({text:e,type:"warning",timeout:1e3})},fetch:acf.validateForm,enableSubmit:acf.enableSubmit,disableSubmit:acf.disableSubmit,showSpinner:acf.showSpinner,hideSpinner:acf.hideSpinner,unlockForm:acf.unlockForm,lockForm:acf.lockForm});i.tooltip={tooltip:function(t,e){var i;return acf.newTooltip({text:t,target:e}).$el},temp:function(t,e){var i=acf.newTooltip({text:t,target:e,timeout:250})},confirm:function(t,e,i,n,a){var r=acf.newTooltip({confirm:!0,text:i,target:t,confirm:function(){e(!0)},cancel:function(){e(!1)}})},confirm_remove:function(t,e){var i=acf.newTooltip({confirmRemove:!0,target:t,confirm:function(){e(!0)},cancel:function(){e(!1)}})}},i.media=new acf.Model({activeFrame:!1,actions:{new_media_popup:"onNewMediaPopup"},frame:function(){return this.activeFrame},onNewMediaPopup:function(t){this.activeFrame=t.frame},popup:function(t){var e;return t.mime_types&&(t.allowedTypes=t.mime_types),t.id&&(t.attachment=t.id),acf.newMediaPopup(t).frame}}),i.select2={init:function(t,e,i){return e.allow_null&&(e.allowNull=e.allow_null),e.ajax_action&&(e.ajaxAction=e.ajax_action),i&&(e.field=acf.getField(i)),acf.newSelect2(t,e)},destroy:function(t){return acf.getInstance(t).destroy()}},i.postbox={render:function(t){return t.edit_url&&(t.editLink=t.edit_url),t.edit_title&&(t.editTitle=t.edit_title),acf.newPostbox(t)}},acf.newCompatibility(acf.screen,{update:function(){return this.set.apply(this,arguments)},fetch:acf.screen.check}),i.ajax=acf.screen}(jQuery); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-data-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-data-functions.php new file mode 100644 index 0000000..89b6878 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-data-functions.php @@ -0,0 +1,106 @@ +switch_site( $site_id, $prev_site_id ); + } +} +add_action( 'switch_blog', 'acf_switch_stores', 10, 2 ); diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-field-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-field-functions.php new file mode 100644 index 0000000..0fb114d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-field-functions.php @@ -0,0 +1,1571 @@ +prop( 'multisite', true ); + +/** + * acf_get_field + * + * Retrieves a field for the given identifier. + * + * @date 17/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @return (array|false) The field array. + */ +function acf_get_field( $id = 0 ) { + + // Allow WP_Post to be passed. + if( is_object($id) ) { + $id = $id->ID; + } + + // Check store. + $store = acf_get_store( 'fields' ); + if( $store->has( $id ) ) { + return $store->get( $id ); + } + + // Check local fields first. + if( acf_is_local_field($id) ) { + $field = acf_get_local_field( $id ); + + // Then check database. + } else { + $field = acf_get_raw_field( $id ); + } + + // Bail early if no field. + if( !$field ) { + return false; + } + + // Validate field. + $field = acf_validate_field( $field ); + + // Set input prefix. + $field['prefix'] = 'acf'; + + /** + * Filters the $field array after it has been loaded. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array The field array. + */ + $field = apply_filters( "acf/load_field", $field ); + + // Store field using aliasses to also find via key, ID and name. + $store->set( $field['key'], $field ); + $store->alias( $field['key'], $field['ID'], $field['name'] ); + + // Return. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/load_field', array('type', 'name', 'key'), 0 ); + +/** + * acf_get_raw_field + * + * Retrieves raw field data for the given identifier. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @return (array|false) The field array. + */ +function acf_get_raw_field( $id = 0 ) { + + // Get raw field from database. + $post = acf_get_field_post( $id ); + if( !$post ) { + return false; + } + + // Bail early if incorrect post type. + if( $post->post_type !== 'acf-field' ) { + return false; + } + + // Unserialize post_content. + $field = (array) maybe_unserialize( $post->post_content ); + + // update attributes + $field['ID'] = $post->ID; + $field['key'] = $post->post_name; + $field['label'] = $post->post_title; + $field['name'] = $post->post_excerpt; + $field['menu_order'] = $post->menu_order; + $field['parent'] = $post->post_parent; + + // Return field. + return $field; +} + +/** + * acf_get_field_post + * + * Retrieves the field's WP_Post object. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @return (array|false) The field array. + */ +function acf_get_field_post( $id = 0 ) { + + // Get post if numeric. + if( is_numeric($id) ) { + return get_post( $id ); + + // Search posts if is string. + } elseif( is_string($id) ) { + + // Determine id type. + $type = acf_is_field_key($id) ? 'key' : 'name'; + + // Try cache. + $cache_key = acf_cache_key( "acf_get_field_post:$type:$id" ); + $post_id = wp_cache_get( $cache_key, 'acf' ); + if( $post_id === false ) { + + // Query posts. + $posts = get_posts(array( + 'posts_per_page' => 1, + 'post_type' => 'acf-field', + 'orderby' => 'menu_order title', + 'order' => 'ASC', + 'suppress_filters' => false, + 'cache_results' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + "acf_field_$type" => $id + )); + + // Update $post_id with a non false value. + $post_id = $posts ? $posts[0]->ID : 0; + + // Update cache. + wp_cache_set( $cache_key, $post_id, 'acf' ); + } + + // Check $post_id and return the post when possible. + if( $post_id ) { + return get_post( $post_id ); + } + } + + // Return false by default. + return false; +} + +/** + * acf_is_field_key + * + * Returns true if the given identifier is a field key. + * + * @date 6/12/2013 + * @since 5.0.0 + * + * @param string $id The identifier. + * @return bool + */ +function acf_is_field_key( $id = '' ) { + + // Check if $id is a string starting with "field_". + if( is_string($id) && substr($id, 0, 6) === 'field_' ) { + return true; + } + + /** + * Filters whether the $id is a field key. + * + * @date 23/1/19 + * @since 5.7.10 + * + * @param bool $bool The result. + * @param string $id The identifier. + */ + return apply_filters( 'acf/is_field_key', false, $id ); +} + +/** + * acf_validate_field + * + * Ensures the given field valid. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @return array + */ +function acf_validate_field( $field = array() ) { + + // Bail early if already valid. + if( is_array($field) && !empty($field['_valid']) ) { + return $field; + } + + // Apply defaults. + $field = wp_parse_args($field, array( + 'ID' => 0, + 'key' => '', + 'label' => '', + 'name' => '', + 'prefix' => '', + 'type' => 'text', + 'value' => null, + 'menu_order' => 0, + 'instructions' => '', + 'required' => false, + 'id' => '', + 'class' => '', + 'conditional_logic' => false, + 'parent' => 0, + 'wrapper' => array() + //'attributes' => array() + )); + + // Add backwards compatibility for wrapper attributes. + // Todo: Remove need for this. + $field['wrapper'] = wp_parse_args($field['wrapper'], array( + 'width' => '', + 'class' => '', + 'id' => '' + )); + + // Store backups. + $field['_name'] = $field['name']; + $field['_valid'] = 1; + + /** + * Filters the $field array to validate settings. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/validate_field", $field ); + + // return + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/validate_field', array('type'), 0 ); + +/** + * acf_get_valid_field + * + * Ensures the given field valid. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param array $field The field array. + * @return array + */ +function acf_get_valid_field( $field = false ) { + return acf_validate_field( $field ); +} + +/** + * acf_translate_field + * + * Translates a field's settings. + * + * @date 8/03/2016 + * @since 5.3.2 + * + * @param array $field The field array. + * @return array + */ +function acf_translate_field( $field = array() ) { + + // Get settings. + $l10n = acf_get_setting('l10n'); + $l10n_textdomain = acf_get_setting('l10n_textdomain'); + + // Translate field settings if textdomain is set. + if( $l10n && $l10n_textdomain ) { + + $field['label'] = acf_translate( $field['label'] ); + $field['instructions'] = acf_translate( $field['instructions'] ); + + /** + * Filters the $field array to translate strings. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/translate_field", $field ); + } + + // Return field. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/translate_field', array('type'), 0 ); + +// Translate fields passing through validation. +add_action('acf/validate_field', 'acf_translate_field'); + +/** + * acf_get_fields + * + * Returns and array of fields for the given $parent. + * + * @date 30/09/13 + * @since 5.0.0 + * + * @param (int|string|array) $parent The field group or field settings. Also accepts the field group ID or key. + * @return array + */ +function acf_get_fields( $parent ) { + + // Allow field group selector as $parent. + if( !is_array($parent) ) { + $parent = acf_get_field_group( $parent ); + if( !$parent ) { + return array(); + } + } + + // Vars. + $fields = array(); + + // Check local fields first. + if( acf_have_local_fields($parent['key']) ) { + $raw_fields = acf_get_local_fields( $parent['key'] ); + foreach( $raw_fields as $raw_field ) { + $fields[] = acf_get_field( $raw_field['key'] ); + } + + // Then check database. + } else { + $raw_fields = acf_get_raw_fields( $parent['ID'] ); + foreach( $raw_fields as $raw_field ) { + $fields[] = acf_get_field( $raw_field['ID'] ); + } + } + + /** + * Filters the $fields array. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $fields The array of fields. + */ + $fields = apply_filters( 'acf/load_fields', $fields, $parent ); + + // Return fields + return $fields; +} + +/** + * acf_get_raw_fields + * + * Returns and array of raw field data for the given parent id. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param int $id The field group or field id. + * @return array + */ +function acf_get_raw_fields( $id = 0 ) { + + // Try cache. + $cache_key = acf_cache_key( "acf_get_field_posts:$id" ); + $post_ids = wp_cache_get( $cache_key, 'acf' ); + if( $post_ids === false ) { + + // Query posts. + $posts = get_posts(array( + 'posts_per_page' => -1, + 'post_type' => 'acf-field', + 'orderby' => 'menu_order', + 'order' => 'ASC', + 'suppress_filters' => true, // DO NOT allow WPML to modify the query + 'cache_results' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'post_parent' => $id, + 'post_status' => array('publish', 'trash'), + )); + + // Update $post_ids with a non false value. + $post_ids = array(); + foreach( $posts as $post ) { + $post_ids[] = $post->ID; + } + + // Update cache. + wp_cache_set( $cache_key, $post_ids, 'acf' ); + } + + // Loop over ids and populate array of fields. + $fields = array(); + foreach( $post_ids as $post_id ) { + $fields[] = acf_get_raw_field( $post_id ); + } + + // Return fields. + return $fields; +} + +/** + * acf_get_field_count + * + * Return the number of fields for the given field group. + * + * @date 17/10/13 + * @since 5.0.0 + * + * @param array $parent The field group or field array. + * @return int + */ +function acf_get_field_count( $parent ) { + + // Check local fields first. + if( acf_have_local_fields($parent['key']) ) { + $raw_fields = acf_get_local_fields( $parent['key'] ); + + // Then check database. + } else { + $raw_fields = acf_get_raw_fields( $parent['ID'] ); + } + + /** + * Filters the counted number of fields. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param int $count The number of fields. + * @param array $parent The field group or field array. + */ + return apply_filters( 'acf/get_field_count', count($raw_fields), $parent ); +} + +/** + * acf_clone_field + * + * Allows customization to a field when it is cloned. Used by the clone field. + * + * @date 8/03/2016 + * @since 5.3.2 + * + * @param array $field The field being cloned. + * @param array $clone_field The clone field. + * @return array + */ +function acf_clone_field( $field, $clone_field ) { + + // Add reference to the clone field. + $field['_clone'] = $clone_field['key']; + + /** + * Filters the $field array when it is being cloned. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + * @param array $clone_field The clone field array. + */ + $field = apply_filters( "acf/clone_field", $field, $clone_field ); + + // Return field. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/clone_field', array('type'), 0 ); + +/** + * acf_prepare_field + * + * Prepare a field for input. + * + * @date 20/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @return array + */ +function acf_prepare_field( $field ) { + + // Bail early if already prepared. + if( !empty($field['_prepare']) ) { + return $field; + } + + // Use field key to override input name. + if( $field['key'] ) { + $field['name'] = $field['key']; + } + + // Use field prefix to modify input name. + if( $field['prefix'] ) { + $field['name'] = "{$field['prefix']}[{$field['name']}]"; + } + + // Generate id attribute from name. + $field['id'] = acf_idify( $field['name'] ); + + // Add state to field. + $field['_prepare'] = true; + + /** + * Filters the $field array. + * + * Allows developers to modify field settings or return false to remove field. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/prepare_field", $field ); + + // return + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/prepare_field', array('type', 'name', 'key'), 0 ); + +/** + * acf_render_fields + * + * Renders an array of fields. Also loads the field's value. + * + * @date 8/10/13 + * @since 5.0.0 + * @since 5.6.9 Changed parameter order. + * + * @param array $fields An array of fields. + * @param (int|string) $post_id The post ID to load values from. + * @param string $element The wrapping element type. + * @param string $instruction The instruction render position (label|field). + * @return void + */ +function acf_render_fields( $fields, $post_id = 0, $el = 'div', $instruction = 'label' ) { + + // Parameter order changed in ACF 5.6.9. + if( is_array($post_id) ) { + $args = func_get_args(); + $fields = $args[1]; + $post_id = $args[0]; + } + + /** + * Filters the $fields array before they are rendered. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $fields An array of fields. + * @param (int|string) $post_id The post ID to load values from. + */ + $fields = apply_filters( 'acf/pre_render_fields', $fields, $post_id ); + + // Filter our false results. + $fields = array_filter( $fields ); + + // Loop over and render fields. + if( $fields ) { + foreach( $fields as $field ) { + + // Load value if not already loaded. + if( $field['value'] === null ) { + $field['value'] = acf_get_value( $post_id, $field ); + } + + // Render wrap. + acf_render_field_wrap( $field, $el, $instruction ); + } + } + + /** + * Fires after fields have been rendered. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $fields An array of fields. + * @param (int|string) $post_id The post ID to load values from. + */ + do_action( 'acf/render_fields', $fields, $post_id ); +} + +/** + * acf_render_field_wrap + * + * Render the wrapping element for a given field. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param array $field The field array. + * @param string $element The wrapping element type. + * @param string $instruction The instruction render position (label|field). + * @return void + */ +function acf_render_field_wrap( $field, $element = 'div', $instruction = 'label' ) { + + // Ensure field is complete (adds all settings). + $field = acf_validate_field( $field ); + + // Prepare field for input (modifies settings). + $field = acf_prepare_field( $field ); + + // Allow filters to cancel render. + if( !$field ) { + return; + } + + // Determine wrapping element. + $elements = array( + 'div' => 'div', + 'tr' => 'td', + 'td' => 'div', + 'ul' => 'li', + 'ol' => 'li', + 'dl' => 'dt', + ); + + if( isset($elements[$element]) ) { + $inner_element = $elements[$element]; + } else { + $element = $inner_element = 'div'; + } + + // Generate wrapper attributes. + $wrapper = array( + 'id' => '', + 'class' => 'acf-field', + 'width' => '', + 'style' => '', + 'data-name' => $field['_name'], + 'data-type' => $field['type'], + 'data-key' => $field['key'], + ); + + // Add field type attributes. + $wrapper['class'] .= " acf-field-{$field['type']}"; + + // add field key attributes + if( $field['key'] ) { + $wrapper['class'] .= " acf-field-{$field['key']}"; + } + + // Add required attributes. + // Todo: Remove data-required + if( $field['required'] ) { + $wrapper['class'] .= ' is-required'; + $wrapper['data-required'] = 1; + } + + // Clean up class attribute. + $wrapper['class'] = str_replace( '_', '-', $wrapper['class'] ); + $wrapper['class'] = str_replace( 'field-field-', 'field-', $wrapper['class'] ); + + // Merge in field 'wrapper' setting without destroying class and style. + if( $field['wrapper'] ) { + $wrapper = acf_merge_attributes( $wrapper, $field['wrapper'] ); + } + + // Extract wrapper width and generate style. + // Todo: Move from $wrapper out into $field. + $width = acf_extract_var( $wrapper, 'width' ); + if( $width ) { + $width = acf_numval( $width ); + if( $element !== 'tr' && $element !== 'td' ) { + $wrapper['data-width'] = $width; + $wrapper['style'] .= " width:{$width}%;"; + } + } + + // Clean up all attributes. + $wrapper = array_map( 'trim', $wrapper ); + $wrapper = array_filter( $wrapper ); + + /** + * Filters the $wrapper array before rendering. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $wrapper The wrapper attributes array. + * @param array $field The field array. + */ + $wrapper = apply_filters( 'acf/field_wrapper_attributes', $wrapper, $field ); + + // Append conditional logic attributes. + if( !empty($field['conditional_logic']) ) { + $wrapper['data-conditions'] = $field['conditional_logic']; + } + if( !empty($field['conditions']) ) { + $wrapper['data-conditions'] = $field['conditions']; + } + + // Vars for render. + $attributes_html = acf_esc_attr( $wrapper ); + + // Render HTML + echo "<$element $attributes_html>" . "\n"; + if( $element !== 'td' ) { + echo "<$inner_element class=\"acf-label\">" . "\n"; + acf_render_field_label( $field ); + if( $instruction == 'label' ) { + acf_render_field_instructions( $field ); + } + echo "" . "\n"; + } + echo "<$inner_element class=\"acf-input\">" . "\n"; + acf_render_field( $field ); + if( $instruction == 'field' ) { + acf_render_field_instructions( $field ); + } + echo "" . "\n"; + echo "" . "\n"; +} + +/** + * acf_render_field + * + * Render the input element for a given field. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @return void + */ +function acf_render_field( $field ) { + + // Ensure field is complete (adds all settings). + $field = acf_validate_field( $field ); + + // Prepare field for input (modifies settings). + $field = acf_prepare_field( $field ); + + // Allow filters to cancel render. + if( !$field ) { + return; + } + + /** + * Fires when rendering a field. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + do_action( "acf/render_field", $field ); +} + +// Register variation. +acf_add_action_variations( 'acf/render_field', array('type', 'name', 'key'), 0 ); + +/** + * acf_render_field_label + * + * Renders the field's label. + * + * @date 19/9/17 + * @since 5.6.3 + * + * @param array $field The field array. + * @return void + */ +function acf_render_field_label( $field ) { + + // Get label. + $label = acf_get_field_label( $field ); + + // Output label. + if( $label ) { + echo '' . acf_esc_html($label) . ''; + } +} + +/** + * acf_get_field_label + * + * Returns the field's label with appropriate required label. + * + * @date 4/11/2013 + * @since 5.0.0 + * + * @param array $field The field array. + * @param string $context The output context (admin). + * @return void + */ +function acf_get_field_label( $field, $context = '' ) { + + // Get label. + $label = $field['label']; + + // Display empty text when editing field. + if( $context == 'admin' && $label === '' ) { + $label = __('(no label)', 'acf'); + } + + // Add required HTML. + if( $field['required'] ) { + $label .= ' *'; + } + + /** + * Filters the field's label HTML. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param string The label HTML. + * @param array $field The field array. + * @param string $context The output context (admin). + */ + $label = apply_filters( "acf/get_field_label", $label, $field, $context ); + + // Return label. + return $label; +} + +/** + * acf_render_field_instructions + * + * Renders the field's instructions. + * + * @date 19/9/17 + * @since 5.6.3 + * + * @param array $field The field array. + * @return void + */ +function acf_render_field_instructions( $field ) { + + // Output instructions. + if( $field['instructions'] ) { + echo '

                  ' . acf_esc_html($field['instructions']) . '

                  '; + } +} + +/** + * acf_render_field_setting + * + * Renders a field setting used in the admin edit screen. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @param array $setting The settings field array. + * @param bool $global Whether this setting is a global or field type specific one. + * @return void + */ +function acf_render_field_setting( $field, $setting, $global = false ) { + + // Validate field. + $setting = acf_validate_field( $setting ); + + // Add custom attributes to setting wrapper. + $setting['wrapper']['data-key'] = $setting['name']; + $setting['wrapper']['class'] .= ' acf-field-setting-' . $setting['name']; + if( !$global ) { + $setting['wrapper']['data-setting'] = $field['type']; + } + + // Copy across prefix. + $setting['prefix'] = $field['prefix']; + + // Find setting value from field. + if( $setting['value'] === null ) { + + // Name. + if( isset($field[ $setting['name'] ]) ) { + $setting['value'] = $field[ $setting['name'] ]; + + // Default value. + } elseif( isset($setting['default_value']) ) { + $setting['value'] = $setting['default_value']; + } + } + + // Add append attribute used by JS to join settings. + if( isset($setting['_append']) ) { + $setting['wrapper']['data-append'] = $setting['_append']; + } + + // Render setting. + acf_render_field_wrap( $setting, 'tr', 'label' ); +} + +/** + * acf_update_field + * + * Updates a field in the database. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @param array $specific An array of specific field attributes to update. + * @return void + */ +function acf_update_field( $field, $specific = array() ) { + + // Validate field. + $field = acf_validate_field( $field ); + + // May have been posted. Remove slashes. + $field = wp_unslash( $field ); + + // Parse types (converts string '0' to int 0). + $field = acf_parse_types( $field ); + + // Clean up conditional logic keys. + if( $field['conditional_logic'] ) { + + // Remove empty values and convert to associated array. + $field['conditional_logic'] = array_filter( $field['conditional_logic'] ); + $field['conditional_logic'] = array_values( $field['conditional_logic'] ); + $field['conditional_logic'] = array_map( 'array_filter', $field['conditional_logic'] ); + $field['conditional_logic'] = array_map( 'array_values', $field['conditional_logic'] ); + } + + // Parent may be provided as a field key. + if( $field['parent'] && !is_numeric($field['parent']) ) { + $parent = acf_get_field_post( $field['parent'] ); + $field['parent'] = $parent ? $parent->ID : 0; + } + + /** + * Filters the $field array before it is updated. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/update_field", $field ); + + // Make a backup of field data and remove some args. + $_field = $field; + acf_extract_vars( $_field, array( 'ID', 'key', 'label', 'name', 'prefix', 'value', 'menu_order', 'id', 'class', 'parent', '_name', '_prepare', '_valid' ) ); + + // Create array of data to save. + $save = array( + 'ID' => $field['ID'], + 'post_status' => 'publish', + 'post_type' => 'acf-field', + 'post_title' => $field['label'], + 'post_name' => $field['key'], + 'post_excerpt' => $field['name'], + 'post_content' => maybe_serialize( $_field ), + 'post_parent' => $field['parent'], + 'menu_order' => $field['menu_order'], + ); + + // Reduce save data if specific key list is provided. + if( $specific ) { + $specific[] = 'ID'; + $save = acf_get_sub_array( $save, $specific ); + } + + // Unhook wp_targeted_link_rel() filter from WP 5.1 corrupting serialized data. + remove_filter( 'content_save_pre', 'wp_targeted_link_rel' ); + + // Slash data. + // WP expects all data to be slashed and will unslash it (fixes '\' character issues). + $save = wp_slash( $save ); + + // Update or Insert. + if( $field['ID'] ) { + wp_update_post( $save ); + } else { + $field['ID'] = wp_insert_post( $save ); + } + + // Flush field cache. + acf_flush_field_cache( $field ); + + /** + * Fires after a field has been updated, and the field cache has been cleaned. + * + * @date 24/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + */ + do_action( "acf/updated_field", $field ); + + // Return field. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/update_field', array('type', 'name', 'key'), 0 ); + +/** + * _acf_apply_unique_field_slug + * + * Allows full control over 'acf-field' slugs. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param string $slug The post slug. + * @param int $post_ID Post ID. + * @param string $post_status The post status. + * @param string $post_type Post type. + * @param int $post_parent Post parent ID + * @param string $original_slug The original post slug. + */ +function _acf_apply_unique_field_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { + + // Check post type and reset to original value. + if( $post_type === 'acf-field' ) { + return $original_slug; + } + + // Return slug. + return $slug; +} + +// Hook into filter. +add_filter( 'wp_unique_post_slug', '_acf_apply_unique_field_slug', 999, 6 ); + +/** + * acf_flush_field_cache + * + * Deletes all caches for this field. + * + * @date 22/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @return void + */ +function acf_flush_field_cache( $field ) { + + // Delete stored data. + acf_get_store( 'fields' )->remove( $field['key'] ); + + // Flush cached post_id for this field's name and key. + wp_cache_delete( acf_cache_key("acf_get_field_post:name:{$field['name']}"), 'acf' ); + wp_cache_delete( acf_cache_key("acf_get_field_post:key:{$field['key']}"), 'acf' ); + + // Flush cached array of post_ids for this field's parent. + wp_cache_delete( acf_cache_key("acf_get_field_posts:{$field['parent']}"), 'acf' ); +} + +/** + * acf_delete_field + * + * Deletes a field from the database. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @return bool True if field was deleted. + */ +function acf_delete_field( $id = 0 ) { + + // Get the field. + $field = acf_get_field( $id ); + + // Bail early if field was not found. + if( !$field || !$field['ID'] ) { + return false; + } + + // Delete post. + wp_delete_post( $field['ID'], true ); + + // Flush field cache. + acf_flush_field_cache( $field ); + + /** + * Fires immediately after a field has been deleted. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + do_action( "acf/delete_field", $field ); + + // Return true. + return true; +} + +// Register variation. +acf_add_action_variations( 'acf/delete_field', array('type', 'name', 'key'), 0 ); + +/** + * acf_trash_field + * + * Trashes a field from the database. + * + * @date 2/10/13 + * @since 5.0.0 + * + * @param (int|string) $id The field ID, key or name. + * @return bool True if field was trashed. + */ +function acf_trash_field( $id = 0 ) { + + // Get the field. + $field = acf_get_field( $id ); + + // Bail early if field was not found. + if( !$field || !$field['ID'] ) { + return false; + } + + // Trash post. + wp_trash_post( $field['ID'], true ); + + /** + * Fires immediately after a field has been trashed. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + do_action( 'acf/trash_field', $field ); + + // Return true. + return true; +} + +/** + * acf_untrash_field + * + * Restores a field from the trash. + * + * @date 2/10/13 + * @since 5.0.0 + * + * @param (int|string) $id The field ID, key or name. + * @return bool True if field was trashed. + */ +function acf_untrash_field( $id = 0 ) { + + // Get the field. + $field = acf_get_field( $id ); + + // Bail early if field was not found. + if( !$field || !$field['ID'] ) { + return false; + } + + // Untrash post. + wp_untrash_post( $field['ID'], true ); + + // Flush field cache. + acf_flush_field_cache( $field ); + + /** + * Fires immediately after a field has been trashed. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + do_action( 'acf/untrash_field', $field ); + + // Return true. + return true; +} + +/** + * acf_prefix_fields + * + * Changes the prefix for an array of fields by reference. + * + * @date 5/9/17 + * @since 5.6.0 + * + * @param array $fields An array of fields. + * @param string $prefix The new prefix. + * @return void + */ +function acf_prefix_fields( &$fields, $prefix = 'acf' ) { + + // Loopover fields. + foreach( $fields as &$field ) { + + // Replace 'acf' with $prefix. + $field['prefix'] = $prefix . substr($field['prefix'], 3); + } +} + +/** + * acf_get_sub_field + * + * Searches a field for sub fields matching the given selector. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @param array $field The parent field array. + * @return (array|false) + */ +function acf_get_sub_field( $id, $field ) { + + // Vars. + $sub_field = false; + + // Search sub fields. + if( isset($field['sub_fields']) ) { + $sub_field = acf_search_fields( $id, $field['sub_fields'] ); + } + + /** + * Filters the $sub_field found. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $sub_field The found sub field array. + * @param string $selector The selector used to search. + * @param array $field The parent field array. + */ + $sub_field = apply_filters( "acf/get_sub_field", $sub_field, $id, $field ); + + // return + return $sub_field; + +} + +// Register variation. +acf_add_filter_variations( 'acf/get_sub_field', array('type'), 2 ); + +/** + * acf_search_fields + * + * Searches an array of fields for one that matches the given identifier. + * + * @date 12/2/19 + * @since 5.7.11 + * + * @param (int|string) $id The field ID, key or name. + * @param array $haystack The array of fields. + * @return (int|false) + */ +function acf_search_fields( $id, $fields ) { + + // Loop over searchable keys in order of priority. + // Important to search "name" on all fields before "_name" backup. + foreach( array( 'key', 'name', '_name', '__name' ) as $key ) { + + // Loop over fields and compare. + foreach( $fields as $field ) { + if( isset($field[$key]) && $field[$key] === $id ) { + return $field; + } + } + } + + // Return not found. + return false; +} + +/** + * acf_is_field + * + * Returns true if the given params match a field. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field The field array. + * @param mixed $id An optional identifier to search for. + * @return bool + */ +function acf_is_field( $field = false, $id = '' ) { + return ( + is_array($field) + && isset($field['key']) + && isset($field['name']) + ); +} + +/** + * acf_get_field_ancestors + * + * Returns an array of ancestor field ID's or keys. + * + * @date 22/06/2016 + * @since 5.3.8 + * + * @param array $field The field array. + * @return array + */ +function acf_get_field_ancestors( $field ) { + + // Vars. + $ancestors = array(); + + // Loop over parents. + while( $field['parent'] && $field = acf_get_field($field['parent']) ) { + $ancestors[] = $field['ID'] ? $field['ID'] : $field['key']; + } + + // return + return $ancestors; +} + +/** + * acf_duplicate_fields + * + * Duplicate an array of fields. + * + * @date 16/06/2014 + * @since 5.0.0 + * + * @param array $fields An array of fields. + * @param int $parent_id The new parent ID. + * @return array + */ +function acf_duplicate_fields( $fields = array(), $parent_id = 0 ) { + + // Vars. + $duplicates = array(); + + // Loop over fields and pre-generate new field keys (needed for conditional logic). + $keys = array(); + foreach( $fields as $field ) { + + // Delay for a microsecond to ensure a unique ID. + usleep(1); + $keys[ $field['key'] ] = uniqid('field_'); + } + + // Store these keys for later use. + acf_set_data( 'duplicates', $keys ); + + // Duplicate fields. + foreach( $fields as $field ) { + $field_id = $field['ID'] ? $field['ID'] : $field['key']; + $duplicates[] = acf_duplicate_field( $field_id, $parent_id ); + } + + // Return. + return $duplicates; +} + +/** + * acf_duplicate_field + * + * Duplicates a field. + * + * @date 16/06/2014 + * @since 5.0.0 + * + * @param (int|string) $id The field ID, key or name. + * @param int $parent_id The new parent ID. + * @return bool True if field was duplicated. + */ +function acf_duplicate_field( $id = 0, $parent_id = 0 ){ + + // Get the field. + $field = acf_get_field( $id ); + + // Bail early if field was not found. + if( !$field ) { + return false; + } + + // Remove ID to avoid update. + $field['ID'] = 0; + + // Generate key. + $keys = acf_get_data( 'duplicates' ); + $field['key'] = isset($keys[ $field['key'] ]) ? $keys[ $field['key'] ] : uniqid('field_'); + + // Set parent. + if( $parent_id ) { + $field['parent'] = $parent_id; + } + + // Update conditional logic references because field keys have changed. + if( $field['conditional_logic'] ) { + + // Loop over groups + foreach( $field['conditional_logic'] as $group_i => $group ) { + + // Loop over rules + foreach( $group as $rule_i => $rule ) { + $field['conditional_logic'][ $group_i ][ $rule_i ]['field'] = isset($keys[ $rule['field'] ]) ? $keys[ $rule['field'] ] : $rule['field']; + } + } + } + + /** + * Filters the $field array after it has been duplicated. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/duplicate_field", $field); + + // Update and return. + return acf_update_field( $field ); +} + +// Register variation. +acf_add_filter_variations( 'acf/duplicate_field', array('type'), 0 ); + +/** + * acf_prepare_fields_for_export + * + * Returns a modified array of fields ready for export. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $fields An array of fields. + * @return array + */ +function acf_prepare_fields_for_export( $fields = array() ) { + + // Map function and return. + return array_map( 'acf_prepare_field_for_export', $fields ); +} + +/** + * acf_prepare_field_for_export + * + * Returns a modified field ready for export. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $field The field array. + * @return array + */ +function acf_prepare_field_for_export( $field ) { + + // Remove args. + acf_extract_vars( $field, array( 'ID', 'prefix', 'value', 'menu_order', 'id', 'class', 'parent', '_name', '_prepare', '_valid' ) ); + + /** + * Filters the $field array before being returned to the export tool. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/prepare_field_for_export", $field ); + + // Return field. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/prepare_field_for_export', array('type'), 0 ); + +/** + * acf_prepare_field_for_import + * + * Returns a modified array of fields ready for import. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $fields An array of fields. + * @return array + */ +function acf_prepare_fields_for_import( $fields = array() ) { + + // Ensure array indexes are clean. + $fields = array_values($fields); + + // Loop through fields allowing for growth. + $i = 0; + while( $i < count($fields) ) { + + // Prepare for import. + $field = acf_prepare_field_for_import( $fields[ $i ] ); + + // Allow multiple fields to be returned (parent + children). + if( is_array($field) && !isset($field['key']) ) { + + // Replace this field ($i) with all returned fields. + array_splice( $fields, $i, 1, $field ); + } + + // Iterate. + $i++; + } + + /** + * Filters the $fields array before being returned to the import tool. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $fields = apply_filters( 'acf/prepare_fields_for_import', $fields ); + + // Return. + return $fields; +} + +/** + * acf_prepare_field_for_import + * + * Returns a modified field ready for import. + * Allows parent fields to modify themselves and also return sub fields. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $field The field array. + * @return array + */ +function acf_prepare_field_for_import( $field ) { + + /** + * Filters the $field array before being returned to the import tool. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field The field array. + */ + $field = apply_filters( "acf/prepare_field_for_import", $field ); + + // Return field. + return $field; +} + +// Register variation. +acf_add_filter_variations( 'acf/prepare_field_for_import', array('type'), 0 ); \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-field-group-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-field-group-functions.php new file mode 100644 index 0000000..23fa259 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-field-group-functions.php @@ -0,0 +1,1068 @@ +prop( 'multisite', true ); + +/** + * acf_get_field_group + * + * Retrieves a field group for the given identifier. + * + * @date 30/09/13 + * @since 5.0.0 + * + * @param (int|string) $id The field group ID, key or name. + * @return (array|false) The field group array. + */ +function acf_get_field_group( $id = 0 ) { + + // Allow WP_Post to be passed. + if( is_object($id) ) { + $id = $id->ID; + } + + // Check store. + $store = acf_get_store( 'field-groups' ); + if( $store->has( $id ) ) { + return $store->get( $id ); + } + + // Check local fields first. + if( acf_is_local_field_group($id) ) { + $field_group = acf_get_local_field_group( $id ); + + // Then check database. + } else { + $field_group = acf_get_raw_field_group( $id ); + } + + // Bail early if no field group. + if( !$field_group ) { + return false; + } + + // Validate field group. + $field_group = acf_validate_field_group( $field_group ); + + /** + * Filters the $field_group array after it has been loaded. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array The field_group array. + */ + $field_group = apply_filters( 'acf/load_field_group', $field_group ); + + // Store field group using aliasses to also find via key, ID and name. + $store->set( $field_group['key'], $field_group ); + $store->alias( $field_group['key'], $field_group['ID'] ); + + // Return. + return $field_group; +} + +/** + * acf_get_raw_field_group + * + * Retrieves raw field group data for the given identifier. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field ID, key or name. + * @return (array|false) The field group array. + */ +function acf_get_raw_field_group( $id = 0 ) { + + // Get raw field group from database. + $post = acf_get_field_group_post( $id ); + if( !$post ) { + return false; + } + + // Bail early if incorrect post type. + if( $post->post_type !== 'acf-field-group' ) { + return false; + } + + // Unserialize post_content. + $field_group = (array) maybe_unserialize( $post->post_content ); + + // update attributes + $field_group['ID'] = $post->ID; + $field_group['title'] = $post->post_title; + $field_group['key'] = $post->post_name; + $field_group['menu_order'] = $post->menu_order; + $field_group['active'] = in_array($post->post_status, array('publish', 'auto-draft')); + + // Return field. + return $field_group; +} + +/** + * acf_get_field_group_post + * + * Retrieves the field group's WP_Post object. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field group's ID, key or name. + * @return (array|false) The field group's array. + */ +function acf_get_field_group_post( $id = 0 ) { + + // Get post if numeric. + if( is_numeric($id) ) { + return get_post( $id ); + + // Search posts if is string. + } elseif( is_string($id) ) { + + // Try cache. + $cache_key = acf_cache_key( "acf_get_field_group_post:key:$id" ); + $post_id = wp_cache_get( $cache_key, 'acf' ); + if( $post_id === false ) { + + // Query posts. + $posts = get_posts(array( + 'posts_per_page' => 1, + 'post_type' => 'acf-field-group', + 'post_status' => array('publish', 'acf-disabled', 'trash'), + 'orderby' => 'menu_order title', + 'order' => 'ASC', + 'suppress_filters' => false, + 'cache_results' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'acf_group_key' => $id + )); + + // Update $post_id with a non false value. + $post_id = $posts ? $posts[0]->ID : 0; + + // Update cache. + wp_cache_set( $cache_key, $post_id, 'acf' ); + } + + // Check $post_id and return the post when possible. + if( $post_id ) { + return get_post( $post_id ); + } + } + + // Return false by default. + return false; +} + +/** + * acf_is_field_group_key + * + * Returns true if the given identifier is a field group key. + * + * @date 6/12/2013 + * @since 5.0.0 + * + * @param string $id The identifier. + * @return bool + */ +function acf_is_field_group_key( $id = '' ) { + + // Check if $id is a string starting with "group_". + if( is_string($id) && substr($id, 0, 6) === 'group_' ) { + return true; + } + + /** + * Filters whether the $id is a field group key. + * + * @date 23/1/19 + * @since 5.7.10 + * + * @param bool $bool The result. + * @param string $id The identifier. + */ + return apply_filters( 'acf/is_field_group_key', false, $id ); +} + +/** + * acf_validate_field_group + * + * Ensures the given field group is valid. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param array $field The field group array. + * @return array + */ +function acf_validate_field_group( $field_group = array() ) { + + // Bail early if already valid. + if( is_array($field_group) && !empty($field_group['_valid']) ) { + return $field_group; + } + + // Apply defaults. + $field_group = wp_parse_args($field_group, array( + 'ID' => 0, + 'key' => '', + 'title' => '', + 'fields' => array(), + 'location' => array(), + 'menu_order' => 0, + 'position' => 'normal', + 'style' => 'default', + 'label_placement' => 'top', + 'instruction_placement' => 'label', + 'hide_on_screen' => array(), + 'active' => true, + 'description' => '', + )); + + // Field group is now valid. + $field_group['_valid'] = 1; + + /** + * Filters the $field_group array to validate settings. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + */ + $field_group = apply_filters( 'acf/validate_field_group', $field_group ); + + // return + return $field_group; +} + +/** + * acf_get_valid_field_group + * + * Ensures the given field group is valid. + * + * @date 28/09/13 + * @since 5.0.0 + * + * @param array $field_group The field group array. + * @return array + */ +function acf_get_valid_field_group( $field_group = false ) { + return acf_validate_field_group( $field_group ); +} + +/** + * acf_translate_field_group + * + * Translates a field group's settings. + * + * @date 8/03/2016 + * @since 5.3.2 + * + * @param array $field_group The field group array. + * @return array + */ +function acf_translate_field_group( $field_group = array() ) { + + // Get settings. + $l10n = acf_get_setting('l10n'); + $l10n_textdomain = acf_get_setting('l10n_textdomain'); + + // Translate field settings if textdomain is set. + if( $l10n && $l10n_textdomain ) { + + $field_group['title'] = acf_translate( $field_group['title'] ); + + /** + * Filters the $field group array to translate strings. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + */ + $field_group = apply_filters( "acf/translate_field_group", $field_group ); + } + + // Return field. + return $field_group; +} + +// Translate field groups passing through validation. +add_action('acf/validate_field_group', 'acf_translate_field_group'); + + +/** + * acf_get_field_groups + * + * Returns and array of field_groups for the given $filter. + * + * @date 30/09/13 + * @since 5.0.0 + * + * @param array $filter An array of args to filter results by. + * @return array + */ +function acf_get_field_groups( $filter = array() ) { + + // Vars. + $field_groups = array(); + + // Check database. + $raw_field_groups = acf_get_raw_field_groups(); + if( $raw_field_groups ) { + foreach( $raw_field_groups as $raw_field_group ) { + $field_groups[] = acf_get_field_group( $raw_field_group['ID'] ); + } + } + + /** + * Filters the $field_groups array. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_groups The array of field_groups. + */ + $field_groups = apply_filters( 'acf/load_field_groups', $field_groups ); + + // Filter results. + if( $filter ) { + return acf_filter_field_groups( $field_groups, $filter ); + } + + // Return field groups. + return $field_groups; +} + +/** + * acf_get_raw_field_groups + * + * Returns and array of raw field_group data. + * + * @date 18/1/19 + * @since 5.7.10 + * + * @param void + * @return array + */ +function acf_get_raw_field_groups() { + + // Try cache. + $cache_key = acf_cache_key( "acf_get_field_group_posts" ); + $post_ids = wp_cache_get( $cache_key, 'acf' ); + if( $post_ids === false ) { + + // Query posts. + $posts = get_posts(array( + 'posts_per_page' => -1, + 'post_type' => 'acf-field-group', + 'orderby' => 'menu_order title', + 'order' => 'ASC', + 'suppress_filters' => false, // Allow WPML to modify the query + 'cache_results' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'post_status' => array('publish', 'acf-disabled'), + )); + + // Update $post_ids with a non false value. + $post_ids = array(); + foreach( $posts as $post ) { + $post_ids[] = $post->ID; + } + + // Update cache. + wp_cache_set( $cache_key, $post_ids, 'acf' ); + } + + // Loop over ids and populate array of field groups. + $field_groups = array(); + foreach( $post_ids as $post_id ) { + $field_groups[] = acf_get_raw_field_group( $post_id ); + } + + // Return field groups. + return $field_groups; +} + +/** + * acf_filter_field_groups + * + * Returns a filtered aray of field groups based on the given $args. + * + * @date 29/11/2013 + * @since 5.0.0 + * + * @param array $field_groups An array of field groups. + * @param array $args An array of location args. + * @return array + */ +function acf_filter_field_groups( $field_groups, $args = array() ) { + + // Loop over field groups and check visibility. + $filtered = array(); + if( $field_groups ) { + foreach( $field_groups as $field_group ) { + if( acf_get_field_group_visibility( $field_group, $args ) ) { + $filtered[] = $field_group; + } + } + } + + // Return filtered. + return $filtered; +} + +/** + * acf_get_field_group_visibility + * + * Returns true if the given field group's location rules match the given $args. + * + * @date 7/10/13 + * @since 5.0.0 + * + * @param array $field_groups An array of field groups. + * @param array $args An array of location args. + * @return bool + */ +function acf_get_field_group_visibility( $field_group, $args = array() ) { + + // Check if active. + if( !$field_group['active'] ) { + return false; + } + + // Check if location rules exist + if( $field_group['location'] ) { + + // Get the current screen. + $screen = acf_get_location_screen( $args ); + + // Loop through location groups. + foreach( $field_group['location'] as $group ) { + + // ignore group if no rules. + if( empty($group) ) { + continue; + } + + // Loop over rules and determine if all rules match. + $match_group = true; + foreach( $group as $rule ) { + if( !acf_match_location_rule( $rule, $screen, $field_group ) ) { + $match_group = false; + break; + } + } + + // If this group matches, show the field group. + if( $match_group ) { + return true; + } + } + } + + // Return default. + return false; +} + +/** + * acf_update_field_group + * + * Updates a field group in the database. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field_group The field group array. + * @return array + */ +function acf_update_field_group( $field_group ) { + + // Validate field group. + $field_group = acf_get_valid_field_group( $field_group ); + + // May have been posted. Remove slashes. + $field_group = wp_unslash( $field_group ); + + // Parse types (converts string '0' to int 0). + $field_group = acf_parse_types( $field_group ); + + // Clean up location keys. + if( $field_group['location'] ) { + + // Remove empty values and convert to associated array. + $field_group['location'] = array_filter( $field_group['location'] ); + $field_group['location'] = array_values( $field_group['location'] ); + $field_group['location'] = array_map( 'array_filter', $field_group['location'] ); + $field_group['location'] = array_map( 'array_values', $field_group['location'] ); + } + + // Make a backup of field group data and remove some args. + $_field_group = $field_group; + acf_extract_vars( $_field_group, array( 'ID', 'key', 'title', 'menu_order', 'fields', 'active', '_valid' ) ); + + // Create array of data to save. + $save = array( + 'ID' => $field_group['ID'], + 'post_status' => $field_group['active'] ? 'publish' : 'acf-disabled', + 'post_type' => 'acf-field-group', + 'post_title' => $field_group['title'], + 'post_name' => $field_group['key'], + 'post_excerpt' => sanitize_title( $field_group['title'] ), + 'post_content' => maybe_serialize( $_field_group ), + 'menu_order' => $field_group['menu_order'], + ); + + // Unhook wp_targeted_link_rel() filter from WP 5.1 corrupting serialized data. + remove_filter( 'content_save_pre', 'wp_targeted_link_rel' ); + + // Slash data. + // WP expects all data to be slashed and will unslash it (fixes '\' character issues). + $save = wp_slash( $save ); + + // Update or Insert. + if( $field_group['ID'] ) { + wp_update_post( $save ); + } else { + $field_group['ID'] = wp_insert_post( $save ); + } + + // Flush field group cache. + acf_flush_field_group_cache( $field_group ); + + /** + * Fires immediately after a field group has been updated. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + */ + do_action( 'acf/update_field_group', $field_group ); + + // Return field group. + return $field_group; +} + +/** + * _acf_apply_unique_field_group_slug + * + * Allows full control over 'acf-field-group' slugs. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param string $slug The post slug. + * @param int $post_ID Post ID. + * @param string $post_status The post status. + * @param string $post_type Post type. + * @param int $post_parent Post parent ID + * @param string $original_slug The original post slug. + */ +function _acf_apply_unique_field_group_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { + + // Check post type and reset to original value. + if( $post_type === 'acf-field-group' ) { + return $original_slug; + } + + // Return slug. + return $slug; +} + +// Hook into filter. +add_filter( 'wp_unique_post_slug', '_acf_apply_unique_field_group_slug', 999, 6 ); + +/** + * acf_flush_field_group_cache + * + * Deletes all caches for this field group. + * + * @date 22/1/19 + * @since 5.7.10 + * + * @param array $field_group The field group array. + * @return void + */ +function acf_flush_field_group_cache( $field_group ) { + + // Delete stored data. + acf_get_store( 'field-groups' )->remove( $field_group['key'] ); + + // Flush cached post_id for this field group's key. + wp_cache_delete( acf_cache_key( "acf_get_field_group_post:key:{$field_group['key']}" ), 'acf' ); + + // Flush cached array of post_ids for collection of field groups. + wp_cache_delete( acf_cache_key( "acf_get_field_group_posts" ), 'acf' ); +} + +/** + * acf_delete_field_group + * + * Deletes a field group from the database. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param (int|string) $id The field group ID, key or name. + * @return bool True if field group was deleted. + */ +function acf_delete_field_group( $id = 0 ) { + + // Disable filters to ensure ACF loads data from DB. + acf_disable_filters(); + + // Get the field_group. + $field_group = acf_get_field_group( $id ); + + // Bail early if field group was not found. + if( !$field_group || !$field_group['ID'] ) { + return false; + } + + // Delete fields. + $fields = acf_get_fields( $field_group ); + if( $fields ) { + foreach( $fields as $field ) { + acf_delete_field( $field['ID'] ); + } + } + + // Delete post. + wp_delete_post( $field_group['ID'], true ); + + // Flush field group cache. + acf_flush_field_group_cache( $field_group ); + + /** + * Fires immediately after a field group has been deleted. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + */ + do_action( 'acf/delete_field_group', $field_group ); + + // Return true. + return true; +} + +/** + * acf_trash_field_group + * + * Trashes a field group from the database. + * + * @date 2/10/13 + * @since 5.0.0 + * + * @param (int|string) $id The field group ID, key or name. + * @return bool True if field group was trashed. + */ +function acf_trash_field_group( $id = 0 ) { + + // Disable filters to ensure ACF loads data from DB. + acf_disable_filters(); + + // Get the field_group. + $field_group = acf_get_field_group( $id ); + + // Bail early if field_group was not found. + if( !$field_group || !$field_group['ID'] ) { + return false; + } + + // Trash fields. + $fields = acf_get_fields( $field_group ); + if( $fields ) { + foreach( $fields as $field ) { + acf_trash_field( $field['ID'] ); + } + } + + // Trash post. + wp_trash_post( $field_group['ID'], true ); + + // Flush field group cache. + acf_flush_field_group_cache( $field_group ); + + /** + * Fires immediately after a field_group has been trashed. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field_group array. + */ + do_action( 'acf/trash_field_group', $field_group ); + + // Return true. + return true; +} + +/** + * acf_untrash_field_group + * + * Restores a field_group from the trash. + * + * @date 2/10/13 + * @since 5.0.0 + * + * @param (int|string) $id The field_group ID, key or name. + * @return bool True if field_group was trashed. + */ +function acf_untrash_field_group( $id = 0 ) { + + // Disable filters to ensure ACF loads data from DB. + acf_disable_filters(); + + // Get the field_group. + $field_group = acf_get_field_group( $id ); + + // Bail early if field_group was not found. + if( !$field_group || !$field_group['ID'] ) { + return false; + } + + // Untrash fields. + $fields = acf_get_fields( $field_group ); + if( $fields ) { + foreach( $fields as $field ) { + acf_untrash_field( $field['ID'] ); + } + } + + // Untrash post. + wp_untrash_post( $field_group['ID'], true ); + + // Flush field group cache. + acf_flush_field_group_cache( $field_group ); + + /** + * Fires immediately after a field_group has been trashed. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field_group array. + */ + do_action( 'acf/untrash_field_group', $field_group ); + + // Return true. + return true; +} + +/** + * acf_is_field_group + * + * Returns true if the given params match a field group. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param array $field_group The field group array. + * @param mixed $id An optional identifier to search for. + * @return bool + */ +function acf_is_field_group( $field_group = false ) { + return ( + is_array($field_group) + && isset($field_group['key']) + && isset($field_group['title']) + ); +} + +/** + * acf_duplicate_field_group + * + * Duplicates a field group. + * + * @date 16/06/2014 + * @since 5.0.0 + * + * @param (int|string) $id The field_group ID, key or name. + * @param int $new_post_id Optional post ID to override. + * @return array The new field group. + */ +function acf_duplicate_field_group( $id = 0, $new_post_id = 0 ){ + + // Disable filters to ensure ACF loads data from DB. + acf_disable_filters(); + + // Get the field_group. + $field_group = acf_get_field_group( $id ); + + // Bail early if field_group was not found. + if( !$field_group || !$field_group['ID'] ) { + return false; + } + + // Get fields. + $fields = acf_get_fields( $field_group ); + + // Update attributes. + $field_group['ID'] = $new_post_id; + $field_group['key'] = uniqid('group_'); + + // Add (copy) to title when apropriate. + if( !$new_post_id ) { + $field_group['title'] .= ' (' . __("copy", 'acf') . ')'; + } + + // When importing a new field group, insert a temporary post and set the field group's ID. + // This allows fields to be updated before the field group (field group ID is needed for field parent setting). + if( !$field_group['ID'] ) { + $field_group['ID'] = wp_insert_post( array( 'post_title' => $field_group['key'] ) ); + } + + // Duplicate fields. + $duplicates = acf_duplicate_fields( $fields, $field_group['ID'] ); + + // Save field group. + $field_group = acf_update_field_group( $field_group ); + + /** + * Fires immediately after a field_group has been duplicated. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field_group array. + */ + do_action( 'acf/duplicate_field_group', $field_group ); + + // return + return $field_group; +} + +/** + * acf_get_field_group_style + * + * Returns the CSS styles generated from field group settings. + * + * @date 20/10/13 + * @since 5.0.0 + * + * @param array $field_group The field group array. + * @return string. + */ +function acf_get_field_group_style( $field_group ) { + + // Vars. + $style = ''; + $elements = array( + 'permalink' => '#edit-slug-box', + 'the_content' => '#postdivrich', + 'excerpt' => '#postexcerpt', + 'custom_fields' => '#postcustom', + 'discussion' => '#commentstatusdiv', + 'comments' => '#commentsdiv', + 'slug' => '#slugdiv', + 'author' => '#authordiv', + 'format' => '#formatdiv', + 'page_attributes' => '#pageparentdiv', + 'featured_image' => '#postimagediv', + 'revisions' => '#revisionsdiv', + 'categories' => '#categorydiv', + 'tags' => '#tagsdiv-post_tag', + 'send-trackbacks' => '#trackbacksdiv' + ); + + // Loop over field group settings and generate list of selectors to hide. + if( is_array($field_group['hide_on_screen']) ) { + $hide = array(); + foreach( $field_group['hide_on_screen'] as $k ) { + if( isset($elements[ $k ]) ) { + $id = $elements[ $k ]; + $hide[] = $id; + $hide[] = '#screen-meta label[for=' . substr($id, 1) . '-hide]'; + } + } + $style = implode(', ', $hide) . ' {display: none;}'; + } + + /** + * Filters the generated CSS styles. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param string $style The CSS styles. + * @param array $field_group The field group array. + */ + return apply_filters('acf/get_field_group_style', $style, $field_group); +} + +/** + * acf_get_field_group_edit_link + * + * Checks if the current user can edit the field group and returns the edit url. + * + * @date 23/9/18 + * @since 5.7.7 + * + * @param int $post_id The field group ID. + * @return string + */ +function acf_get_field_group_edit_link( $post_id ) { + if( $post_id && acf_current_user_can_admin() ) { + return admin_url('post.php?post=' . $post_id . '&action=edit'); + } + return ''; +} + +/** + * acf_prepare_field_group_for_export + * + * Returns a modified field group ready for export. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + * @return array + */ +function acf_prepare_field_group_for_export( $field_group = array() ) { + + // Remove args. + acf_extract_vars( $field_group, array( 'ID', 'local', '_valid' ) ); + + // Prepare fields. + $field_group['fields'] = acf_prepare_fields_for_export( $field_group['fields'] ); + + /** + * Filters the $field_group array before being returned to the export tool. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The $field group array. + */ + return apply_filters( 'acf/prepare_field_group_for_export', $field_group ); +} + +/** + * acf_import_field_group + * + * Imports a field group into the databse. + * + * @date 11/03/2014 + * @since 5.0.0 + * + * @param array $field_group The field group array. + * @return array The new field group. + */ +function acf_import_field_group( $field_group ) { + + // Disable filters to ensure data is not modified by local, clone, etc. + $filters = acf_disable_filters(); + + // Validate field group. + $field_group = acf_get_valid_field_group( $field_group ); + + // Stores a map of field "key" => "ID". + $ids = array(); + + // Stores a map of field "parent_key" => "child_count". + $count = array(); + + // Prepare fields for import. + $fields = acf_prepare_fields_for_import( $field_group['fields'] ); + + // If the field group has an ID, review and delete stale fields in the databse. + if( $field_group['ID'] ) { + + // Load database fields. + $db_fields = acf_get_fields( $field_group ); + $db_fields = acf_prepare_fields_for_import( $db_fields ); + + // Generate map of "index" => "key" data. + $keys = wp_list_pluck( $fields, 'key' ); + + // Loop over db fields and delete those who don't exist in $new_fields. + foreach( $db_fields as $field ) { + + // Add field data to $ids map. + $ids[ $field['key'] ] = $field['ID']; + + // Delete field if not in $keys. + if( !in_array($field['key'], $keys) ) { + acf_delete_field( $field['ID'] ); + } + } + } + + // When importing a new field group, insert a temporary post and set the field group's ID. + // This allows fields to be updated before the field group (field group ID is needed for field parent setting). + if( !$field_group['ID'] ) { + $field_group['ID'] = wp_insert_post( array( 'post_title' => $field_group['key'] ) ); + } + + // Add field group data to $ids map. + $ids[ $field_group['key'] ] = $field_group['ID']; + + // Add count to map. + $count[ $field_group['ID'] ] = 0; + + // Loop over and add fields. + if( $fields ) { + foreach( $fields as $field ) { + + // Check $ids map for existing ID for this key. + if( isset($ids[ $field['key'] ]) ) { + $field['ID'] = $ids[ $field['key'] ]; + } + + // Add field group as parent. + if( empty($field['parent']) ) { + $field['parent'] = $field_group['ID']; + + // Check $ids map for existing parent + } elseif( isset($ids[ $field['parent'] ]) ) { + $field['parent'] = $ids[ $field['parent'] ]; + } + + // Add field menu_order. + if( !isset($count[ $field['parent'] ]) ) { + $count[ $field['parent'] ] = 1; + } else { + $count[ $field['parent'] ]++; + } + + // Only add menu order if doesn't already exist. + // Allows Flexible Content field to set custom order. + if( !isset($field['menu_order']) ) { + $field['menu_order'] = ($count[ $field['parent'] ] - 1); + } + + // Save field. + $field = acf_update_field( $field ); + + // Add field data to $ids map. + $ids[ $field['key'] ] = $field['ID']; + } + } + + // Save field group. + $field_group = acf_update_field_group( $field_group ); + + // Enable filters again. + acf_enable_filters( $filters ); + + /** + * Fires immediately after a field_group has been imported. + * + * @date 12/02/2014 + * @since 5.0.0 + * + * @param array $field_group The field_group array. + */ + do_action( 'acf/import_field_group', $field_group ); + + // return new field group. + return $field_group; +} diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-form-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-form-functions.php new file mode 100644 index 0000000..e430b74 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-form-functions.php @@ -0,0 +1,163 @@ +set( $name, $data ); +} + +/** + * acf_get_form_data + * + * Gets data about the current form. + * + * @date 6/10/13 + * @since 5.0.0 + * + * @param string $name The store name. + * @return mixed + */ +function acf_get_form_data( $name = '' ) { + return acf_get_store( 'form' )->get( $name ); +} + +/** + * acf_form_data + * + * Called within a form to set important information and render hidden inputs. + * + * @date 15/10/13 + * @since 5.0.0 + * + * @param void + * @return void + */ +function acf_form_data( $data = array() ) { + + // Apply defaults. + $data = wp_parse_args($data, array( + + /** @type string The current screen (post, user, taxonomy, etc). */ + 'screen' => 'post', + + /** @type int|string The ID of current post being edited. */ + 'post_id' => 0, + + /** @type bool Enables AJAX validation. */ + 'validation' => true, + )); + + // Create nonce using screen. + $data['nonce'] = wp_create_nonce( $data['screen'] ); + + // Append "changed" input used within "_wp_post_revision_fields" action. + $data['changed'] = 0; + + // Set data. + acf_set_form_data( $data ); + + // Render HTML. + ?> +
                  + $value ) { + acf_hidden_input(array( + 'id' => '_acf_' . $name, + 'name' => '_acf_' . $name, + 'value' => $value + )); + } + + /** + * Fires within the #acf-form-data element to add extra HTML. + * + * @date 15/10/13 + * @since 5.0.0 + * + * @param array $data The form data. + */ + do_action( 'acf/form_data', $data ); + do_action( 'acf/input/form_data', $data ); + + ?> +
                  + $v ) { + $args[ $k ] = isset($_REQUEST[ $k ]) ? $_REQUEST[ $k ] : $args[ $k ]; + } + return $args; +} + +// Register store. +acf_register_store( 'filters' ); + +/** + * acf_enable_filter + * + * Enables a filter with the given name. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param string name The modifer name. + * @return void + */ +function acf_enable_filter( $name = '' ) { + acf_get_store( 'filters' )->set( $name, true ); +} + +/** + * acf_disable_filter + * + * Disables a filter with the given name. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param string name The modifer name. + * @return void + */ +function acf_disable_filter( $name = '' ) { + acf_get_store( 'filters' )->set( $name, false ); +} + +/** + * acf_is_filter_enabled + * + * Returns the state of a filter for the given name. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param string name The modifer name. + * @return array + */ +function acf_is_filter_enabled( $name = '' ) { + return acf_get_store( 'filters' )->get( $name ); +} + +/** + * acf_get_filters + * + * Returns an array of filters in their current state. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param void + * @return array + */ +function acf_get_filters() { + return acf_get_store( 'filters' )->get(); +} + +/** + * acf_set_filters + * + * Sets an array of filter states. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param array $filters An Array of modifers + * @return array + */ +function acf_set_filters( $filters = array() ) { + acf_get_store( 'filters' )->set( $filters ); +} + +/** + * acf_disable_filters + * + * Disables all filters and returns the previous state. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param void + * @return array + */ +function acf_disable_filters() { + + // Get state. + $prev_state = acf_get_filters(); + + // Set all modifers as false. + acf_set_filters( array_map('__return_false', $prev_state) ); + + // Return prev state. + return $prev_state; +} + +/** + * acf_enable_filters + * + * Enables all or an array of specific filters and returns the previous state. + * + * @date 14/7/16 + * @since 5.4.0 + * + * @param array $filters An Array of modifers + * @return array + */ +function acf_enable_filters( $filters = array() ) { + + // Get state. + $prev_state = acf_get_filters(); + + // Allow specific filters to be enabled. + if( $filters ) { + acf_set_filters( $filters ); + + // Set all modifers as true. + } else { + acf_set_filters( array_map('__return_true', $prev_state) ); + } + + // Return prev state. + return $prev_state; +} + +/** + * acf_idval + * + * Parses the provided value for an ID. + * + * @date 29/3/19 + * @since 5.7.14 + * + * @param mixed $value A value to parse. + * @return int + */ +function acf_idval( $value ) { + + // Check if value is numeric. + if( is_numeric($value) ) { + return (int) $value; + + // Check if value is array. + } elseif( is_array($value) ) { + return (int) isset($value['ID']) ? $value['ID'] : 0; + + // Check if value is object. + } elseif( is_object($value) ) { + return (int) isset($value->ID) ? $value->ID : 0; + } + + // Return default. + return 0; +} + +/** + * acf_maybe_idval + * + * Checks value for potential id value. + * + * @date 6/4/19 + * @since 5.7.14 + * + * @param mixed $value A value to parse. + * @return mixed + */ +function acf_maybe_idval( $value ) { + if( $id = acf_idval( $value ) ) { + return $id; + } + return $value; +} + +/** + * acf_numericval + * + * Casts the provided value as eiter an int or float using a simple hack. + * + * @date 11/4/19 + * @since 5.7.14 + * + * @param mixed $value A value to parse. + * @return (int|float) + */ +function acf_numval( $value ) { + return ( intval($value) == floatval($value) ) ? intval($value) : floatval($value); +} + +/** + * acf_idify + * + * Returns an id attribute friendly string. + * + * @date 24/12/17 + * @since 5.6.5 + * + * @param string $str The string to convert. + * @return string + */ +function acf_idify( $str = '' ) { + return str_replace(array('][', '[', ']'), array('-', '-', ''), strtolower($str)); +} + +/** + * acf_slugify + * + * Returns a slug friendly string. + * + * @date 24/12/17 + * @since 5.6.5 + * + * @param string $str The string to convert. + * @return string + */ +function acf_slugify( $str = '' ) { + return str_replace(array('_', '/', ' '), '-', strtolower($str)); +} + +/** + * acf_punctify + * + * Returns a string with correct full stop puctuation. + * + * @date 12/7/19 + * @since 5.8.2 + * + * @param string $str The string to format. + * @return string + */ +function acf_punctify( $str = '' ) { + return trim($str, '.') . '.'; +} + + diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-hook-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-hook-functions.php new file mode 100644 index 0000000..128c3f7 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-hook-functions.php @@ -0,0 +1,220 @@ +set( $filter, array( + 'type' => 'filter', + 'variations' => $variations, + 'index' => $index, + )); + + // Add generic handler. + // Use a priotiry of 10, and accepted args of 10 (ignored by WP). + add_filter( $filter, '_acf_apply_hook_variations', 10, 10 ); +} + +/** + * acf_add_action_variations + * + * Registers variations for the given action. + * + * @date 26/1/19 + * @since 5.7.11 + * + * @param string $action The action name. + * @param array $variations An array variation keys. + * @param int $index The param index to find variation values. + * @return void + */ +function acf_add_action_variations( $action = '', $variations = array(), $index = 0 ) { + + // Store replacement data. + acf_get_store('hook-variations')->set( $action, array( + 'type' => 'action', + 'variations' => $variations, + 'index' => $index, + )); + + // Add generic handler. + // Use a priotiry of 10, and accepted args of 10 (ignored by WP). + add_action( $action, '_acf_apply_hook_variations', 10, 10 ); +} + +/** + * _acf_apply_hook_variations + * + * Applys hook variations during apply_filters() or do_action(). + * + * @date 25/1/19 + * @since 5.7.11 + * + * @param mixed + * @return mixed + */ +function _acf_apply_hook_variations() { + + // Get current filter. + $filter = current_filter(); + + // Get args provided. + $args = func_get_args(); + + // Get variation information. + $variations = acf_get_store('hook-variations')->get( $filter ); + extract( $variations ); + + // Find field in args using index. + $field = $args[ $index ]; + + // Loop over variations and apply filters. + foreach( $variations as $variation ) { + + // Get value from field. + // First look for "backup" value ("_name", "_key"). + if( isset($field[ "_$variation" ]) ) { + $value = $field[ "_$variation" ]; + } elseif( isset($field[ $variation ]) ) { + $value = $field[ $variation ]; + } else { + continue; + } + + // Apply filters. + if( $type === 'filter' ) { + $args[0] = apply_filters_ref_array( "$filter/$variation=$value", $args ); + + // Or do action. + } else { + do_action_ref_array( "$filter/$variation=$value", $args ); + } + } + + // Return first arg. + return $args[0]; +} + +// Register store. +acf_register_store( 'deprecated-hooks' ); + +/** + * acf_add_deprecated_filter + * + * Registers a deprecated filter to run during the replacement. + * + * @date 25/1/19 + * @since 5.7.11 + * + * @param string $deprecated The deprecated hook. + * @param string $version The version this hook was deprecated. + * @param string $replacement The replacement hook. + * @return void + */ +function acf_add_deprecated_filter( $deprecated, $version, $replacement ) { + + // Store replacement data. + acf_get_store('deprecated-hooks')->append(array( + 'type' => 'filter', + 'deprecated' => $deprecated, + 'replacement' => $replacement, + 'version' => $version + )); + + // Add generic handler. + // Use a priotiry of 10, and accepted args of 10 (ignored by WP). + add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 ); +} + +/** + * acf_add_deprecated_action + * + * Registers a deprecated action to run during the replacement. + * + * @date 25/1/19 + * @since 5.7.11 + * + * @param string $deprecated The deprecated hook. + * @param string $version The version this hook was deprecated. + * @param string $replacement The replacement hook. + * @return void + */ +function acf_add_deprecated_action( $deprecated, $version, $replacement ) { + + // Store replacement data. + acf_get_store('deprecated-hooks')->append(array( + 'type' => 'action', + 'deprecated' => $deprecated, + 'replacement' => $replacement, + 'version' => $version + )); + + // Add generic handler. + // Use a priotiry of 10, and accepted args of 10 (ignored by WP). + add_filter( $replacement, '_acf_apply_deprecated_hook', 10, 10 ); +} + +/** + * _acf_apply_deprecated_hook + * + * Applys a deprecated filter during apply_filters() or do_action(). + * + * @date 25/1/19 + * @since 5.7.11 + * + * @param mixed + * @return mixed + */ +function _acf_apply_deprecated_hook() { + + // Get current hook. + $hook = current_filter(); + + // Get args provided. + $args = func_get_args(); + + // Get deprecated items for this hook. + $items = acf_get_store('deprecated-hooks')->query(array( 'replacement' => $hook )); + + // Loop over results. + foreach( $items as $item ) { + + // Extract data. + extract( $item ); + + // Check if anyone is hooked into this deprecated hook. + if( has_filter($deprecated) ) { + + // Log warning. + //_deprecated_hook( $deprecated, $version, $hook ); + + // Apply filters. + if( $type === 'filter' ) { + $args[0] = apply_filters_ref_array( $deprecated, $args ); + + // Or do action. + } else { + do_action_ref_array( $deprecated, $args ); + } + } + } + + // Return first arg. + return $args[0]; +} + diff --git a/wp-content/plugins/advanced-custom-fields/includes/acf-input-functions.php b/wp-content/plugins/advanced-custom-fields/includes/acf-input-functions.php new file mode 100644 index 0000000..702da04 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/acf-input-functions.php @@ -0,0 +1,472 @@ + $v ) { + + // String (but don't trim value). + if( is_string($v) && ($k !== 'value') ) { + $v = trim($v); + + // Boolean + } elseif( is_bool($v) ) { + $v = $v ? 1 : 0; + + // Object + } elseif( is_array($v) || is_object($v) ) { + $v = json_encode($v); + } + + // Generate HTML. + $html .= sprintf( ' %s="%s"', esc_attr($k), esc_attr($v) ); + } + + // Return trimmed. + return trim( $html ); +} + +/** + * acf_esc_html + * + * Encodes +post_type !== 'acf-field-group' ) { + return $post_id; + } + + // only save once! WordPress save's a revision as well. + if( wp_is_post_revision($post_id) ) { + return $post_id; + } + + // verify nonce + if( !acf_verify_nonce('field_group') ) { + return $post_id; + } + + // Bail early if request came from an unauthorised user. + if( !current_user_can(acf_get_setting('capability')) ) { + return $post_id; + } + + + // disable filters to ensure ACF loads raw data from DB + acf_disable_filters(); + + + // save fields + if( !empty($_POST['acf_fields']) ) { + + // loop + foreach( $_POST['acf_fields'] as $field ) { + + // vars + $specific = false; + $save = acf_extract_var( $field, 'save' ); + + + // only saved field if has changed + if( $save == 'meta' ) { + $specific = array( + 'menu_order', + 'post_parent', + ); + } + + // set parent + if( !$field['parent'] ) { + $field['parent'] = $post_id; + } + + // save field + acf_update_field( $field, $specific ); + + } + } + + + // delete fields + if( $_POST['_acf_delete_fields'] ) { + + // clean + $ids = explode('|', $_POST['_acf_delete_fields']); + $ids = array_map( 'intval', $ids ); + + + // loop + foreach( $ids as $id ) { + + // bai early if no id + if( !$id ) continue; + + + // delete + acf_delete_field( $id ); + + } + + } + + + // add args + $_POST['acf_field_group']['ID'] = $post_id; + $_POST['acf_field_group']['title'] = $_POST['post_title']; + + + // save field group + acf_update_field_group( $_POST['acf_field_group'] ); + + + // return + return $post_id; + } + + + /* + * mb_fields + * + * This function will render the HTML for the medtabox 'acf-field-group-fields' + * + * @type function + * @date 28/09/13 + * @since 5.0.0 + * + * @param N/A + * @return N/A + */ + + function mb_fields() { + + // global + global $field_group; + + + // get fields + $view = array( + 'fields' => acf_get_fields( $field_group ), + 'parent' => 0 + ); + + + // load view + acf_get_view('field-group-fields', $view); + + } + + + /* + * mb_options + * + * This function will render the HTML for the medtabox 'acf-field-group-options' + * + * @type function + * @date 28/09/13 + * @since 5.0.0 + * + * @param N/A + * @return N/A + */ + + function mb_options() { + + // global + global $field_group; + + + // field key (leave in for compatibility) + if( !acf_is_field_group_key( $field_group['key']) ) { + + $field_group['key'] = uniqid('group_'); + + } + + + // view + acf_get_view('field-group-options'); + + } + + + /* + * mb_locations + * + * This function will render the HTML for the medtabox 'acf-field-group-locations' + * + * @type function + * @date 28/09/13 + * @since 5.0.0 + * + * @param N/A + * @return N/A + */ + + function mb_locations() { + + // global + global $field_group; + + + // UI needs at lease 1 location rule + if( empty($field_group['location']) ) { + + $field_group['location'] = array( + + // group 0 + array( + + // rule 0 + array( + 'param' => 'post_type', + 'operator' => '==', + 'value' => 'post', + ) + ) + + ); + } + + + // view + acf_get_view('field-group-locations'); + + } + + + /* + * ajax_render_location_rule + * + * This function can be accessed via an AJAX action and will return the result from the render_location_value function + * + * @type function (ajax) + * @date 30/09/13 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function ajax_render_location_rule() { + + // validate + if( !acf_verify_ajax() ) die(); + + // validate rule + $rule = acf_validate_location_rule($_POST['rule']); + + // view + acf_get_view( 'html-location-rule', array( + 'rule' => $rule + )); + + // die + die(); + } + + + /* + * ajax_render_field_settings + * + * This function will return HTML containing the field's settings based on it's new type + * + * @type function (ajax) + * @date 30/09/13 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function ajax_render_field_settings() { + + // validate + if( !acf_verify_ajax() ) die(); + + // vars + $field = acf_maybe_get_POST('field'); + + // check + if( !$field ) die(); + + // set prefix + $field['prefix'] = acf_maybe_get_POST('prefix'); + + // validate + $field = acf_get_valid_field( $field ); + + // render + do_action("acf/render_field_settings/type={$field['type']}", $field); + + // return + die(); + + } + + /* + * ajax_move_field + * + * description + * + * @type function + * @date 20/01/2014 + * @since 5.0.0 + * + * @param $post_id (int) + * @return $post_id (int) + */ + + function ajax_move_field() { + + // disable filters to ensure ACF loads raw data from DB + acf_disable_filters(); + + + $args = acf_parse_args($_POST, array( + 'nonce' => '', + 'post_id' => 0, + 'field_id' => 0, + 'field_group_id' => 0 + )); + + + // verify nonce + if( !wp_verify_nonce($args['nonce'], 'acf_nonce') ) die(); + + + // confirm? + if( $args['field_id'] && $args['field_group_id'] ) { + + // vars + $field = acf_get_field($args['field_id']); + $field_group = acf_get_field_group($args['field_group_id']); + + + // update parent + $field['parent'] = $field_group['ID']; + + + // remove conditional logic + $field['conditional_logic'] = 0; + + + // update field + acf_update_field($field); + + + // message + $a = '' . $field_group['title'] . ''; + echo '

                  ' . __('Move Complete.', 'acf') . '

                  '; + echo '

                  ' . sprintf( __('The %s field can now be found in the %s field group', 'acf'), $field['label'], $a ). '

                  '; + echo '' . __("Close Window",'acf') . ''; + die(); + + } + + + // get all field groups + $field_groups = acf_get_field_groups(); + $choices = array(); + + + // check + if( !empty($field_groups) ) { + + // loop + foreach( $field_groups as $field_group ) { + + // bail early if no ID + if( !$field_group['ID'] ) continue; + + + // bail ealry if is current + if( $field_group['ID'] == $args['post_id'] ) continue; + + + // append + $choices[ $field_group['ID'] ] = $field_group['title']; + + } + + } + + + // render options + $field = acf_get_valid_field(array( + 'type' => 'select', + 'name' => 'acf_field_group', + 'choices' => $choices + )); + + + echo '

                  ' . __('Please select the destination for this field', 'acf') . '

                  '; + + echo '
                  '; + + // render + acf_render_field_wrap( $field ); + + echo ''; + + echo ''; + + + // die + die(); + + } + +} + +// initialize +new acf_admin_field_group(); + +endif; + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/admin-field-groups.php b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-field-groups.php new file mode 100644 index 0000000..f9ac7d7 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-field-groups.php @@ -0,0 +1,830 @@ +url) ); + exit; + } + } + + /* + * current_screen + * + * This function is fired when loading the admin page before HTML has been rendered. + * + * @type action (current_screen) + * @date 21/07/2014 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function current_screen() { + + // validate screen + if( !acf_is_screen('edit-acf-field-group') ) { + return; + } + + + // customize post_status + global $wp_post_statuses; + + + // modify publish post status + $wp_post_statuses['publish']->label_count = _n_noop( 'Active (%s)', 'Active (%s)', 'acf' ); + + + // reorder trash to end + $wp_post_statuses['trash'] = acf_extract_var( $wp_post_statuses, 'trash' ); + + + // check stuff + $this->check_duplicate(); + $this->check_sync(); + + + // actions + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); + add_action('admin_footer', array($this, 'admin_footer')); + + + // columns + add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1); + add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2); + + } + + + /* + * admin_enqueue_scripts + * + * This function will add the already registered css + * + * @type function + * @date 28/09/13 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function admin_enqueue_scripts() { + + wp_enqueue_script('acf-input'); + + } + + + /* + * check_duplicate + * + * This function will check for any $_GET data to duplicate + * + * @type function + * @date 17/10/13 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function check_duplicate() { + + // Display notice + if( $ids = acf_maybe_get_GET('acfduplicatecomplete') ) { + + // explode + $ids = explode(',', $ids); + $total = count($ids); + + // Generate text. + $text = sprintf( _n( 'Field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total ); + + // Add links to text. + $links = array(); + foreach( $ids as $id ) { + $links[] = '' . get_the_title( $id ) . ''; + } + $text .= ' ' . implode( ', ', $links ); + + // Add notice + acf_add_admin_notice( $text, 'success' ); + } + + + // vars + $ids = array(); + + + // check single + if( $id = acf_maybe_get_GET('acfduplicate') ) { + + $ids[] = $id; + + // check multiple + } elseif( acf_maybe_get_GET('action2') === 'acfduplicate' ) { + + $ids = acf_maybe_get_GET('post'); + + } + + + // sync + if( !empty($ids) ) { + + // validate + check_admin_referer('bulk-posts'); + + + // vars + $new_ids = array(); + + + // loop + foreach( $ids as $id ) { + + // duplicate + $field_group = acf_duplicate_field_group( $id ); + + + // increase counter + $new_ids[] = $field_group['ID']; + + } + + + // redirect + wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . implode(',', $new_ids)) ); + exit; + + } + + } + + + /* + * check_sync + * + * This function will check for any $_GET data to sync + * + * @type function + * @date 9/12/2014 + * @since 5.1.5 + * + * @param n/a + * @return n/a + */ + + function check_sync() { + + // Display notice + if( $ids = acf_maybe_get_GET('acfsynccomplete') ) { + + // explode + $ids = explode(',', $ids); + $total = count($ids); + + // Generate text. + $text = sprintf( _n( 'Field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total ); + + // Add links to text. + $links = array(); + foreach( $ids as $id ) { + $links[] = '' . get_the_title( $id ) . ''; + } + $text .= ' ' . implode( ', ', $links ); + + // Add notice + acf_add_admin_notice( $text, 'success' ); + } + + + // vars + $groups = acf_get_field_groups(); + + + // bail early if no field groups + if( empty($groups) ) return; + + + // find JSON field groups which have not yet been imported + foreach( $groups as $group ) { + + // vars + $local = acf_maybe_get($group, 'local', false); + $modified = acf_maybe_get($group, 'modified', 0); + $private = acf_maybe_get($group, 'private', false); + + // Ignore if is private. + if( $private ) { + continue; + + // Ignore not local "json". + } elseif( $local !== 'json' ) { + continue; + + // Append to sync if not yet in database. + } elseif( !$group['ID'] ) { + $this->sync[ $group['key'] ] = $group; + + // Append to sync if "json" modified time is newer than database. + } elseif( $modified && $modified > get_post_modified_time('U', true, $group['ID'], true) ) { + $this->sync[ $group['key'] ] = $group; + } + } + + + // bail if no sync needed + if( empty($this->sync) ) return; + + + // maybe sync + $sync_keys = array(); + + + // check single + if( $key = acf_maybe_get_GET('acfsync') ) { + + $sync_keys[] = $key; + + // check multiple + } elseif( acf_maybe_get_GET('action2') === 'acfsync' ) { + + $sync_keys = acf_maybe_get_GET('post'); + + } + + + // sync + if( !empty($sync_keys) ) { + + // validate + check_admin_referer('bulk-posts'); + + + // disable filters to ensure ACF loads raw data from DB + acf_disable_filters(); + acf_enable_filter('local'); + + + // disable JSON + // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance + acf_update_setting('json', false); + + + // vars + $new_ids = array(); + + + // loop + foreach( $sync_keys as $key ) { + + // Bail early if not found. + if( !isset($this->sync[ $key ]) ) { + continue; + } + + // Get field group. + $field_group = $this->sync[ $key ]; + + // Append fields. + $field_group['fields'] = acf_get_fields( $field_group ); + + // Import field group. + $field_group = acf_import_field_group( $field_group ); + + // Append imported ID. + $new_ids[] = $field_group['ID']; + } + + + // redirect + wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . implode(',', $new_ids)) ); + exit; + + } + + + // filters + add_filter('views_edit-acf-field-group', array($this, 'list_table_views')); + + } + + + /* + * list_table_views + * + * This function will add an extra link for JSON in the field group list table + * + * @type function + * @date 3/12/2014 + * @since 5.1.5 + * + * @param $views (array) + * @return $views + */ + + function list_table_views( $views ) { + + // vars + $class = ''; + $total = count($this->sync); + + // active + if( acf_maybe_get_GET('post_status') === 'sync' ) { + + // actions + add_action('admin_footer', array($this, 'sync_admin_footer'), 5); + + + // set active class + $class = ' class="current"'; + + + // global + global $wp_list_table; + + + // update pagination + $wp_list_table->set_pagination_args( array( + 'total_items' => $total, + 'total_pages' => 1, + 'per_page' => $total + )); + + } + + + // add view + $views['json'] = '' . __('Sync available', 'acf') . ' (' . $total . ')'; + + + // return + return $views; + + } + + + /* + * trashed_post + * + * This function is run when a post object is sent to the trash + * + * @type action (trashed_post) + * @date 8/01/2014 + * @since 5.0.0 + * + * @param $post_id (int) + * @return n/a + */ + + function trashed_post( $post_id ) { + + // validate post type + if( get_post_type($post_id) != 'acf-field-group' ) { + + return; + + } + + + // trash field group + acf_trash_field_group( $post_id ); + + } + + + /* + * untrashed_post + * + * This function is run when a post object is restored from the trash + * + * @type action (untrashed_post) + * @date 8/01/2014 + * @since 5.0.0 + * + * @param $post_id (int) + * @return n/a + */ + + function untrashed_post( $post_id ) { + + // validate post type + if( get_post_type($post_id) != 'acf-field-group' ) { + + return; + + } + + + // trash field group + acf_untrash_field_group( $post_id ); + + } + + + /* + * deleted_post + * + * This function is run when a post object is deleted from the trash + * + * @type action (deleted_post) + * @date 8/01/2014 + * @since 5.0.0 + * + * @param $post_id (int) + * @return n/a + */ + + function deleted_post( $post_id ) { + + // validate post type + if( get_post_type($post_id) != 'acf-field-group' ) { + + return; + + } + + + // trash field group + acf_delete_field_group( $post_id ); + + } + + + /* + * field_group_columns + * + * This function will customize the columns for the field group table + * + * @type filter (manage_edit-acf-field-group_columns) + * @date 28/09/13 + * @since 5.0.0 + * + * @param $columns (array) + * @return $columns (array) + */ + + function field_group_columns( $columns ) { + + return array( + 'cb' => '', + 'title' => __('Title', 'acf'), + 'acf-fg-description' => __('Description', 'acf'), + 'acf-fg-status' => '', + 'acf-fg-count' => __('Fields', 'acf'), + ); + + } + + + /* + * field_group_columns_html + * + * This function will render the HTML for each table cell + * + * @type action (manage_acf-field-group_posts_custom_column) + * @date 28/09/13 + * @since 5.0.0 + * + * @param $column (string) + * @param $post_id (int) + * @return n/a + */ + + function field_group_columns_html( $column, $post_id ) { + + // vars + $field_group = acf_get_field_group( $post_id ); + + + // render + $this->render_column( $column, $field_group ); + + } + + function render_column( $column, $field_group ) { + + // description + if( $column == 'acf-fg-description' ) { + + if( $field_group['description'] ) { + + echo '' . acf_esc_html($field_group['description']) . ''; + + } + + // status + } elseif( $column == 'acf-fg-status' ) { + + if( isset($this->sync[ $field_group['key'] ]) ) { + + echo ' '; + + } + + if( $field_group['active'] ) { + + //echo ' '; + + } else { + + echo ' '; + + } + + // fields + } elseif( $column == 'acf-fg-count' ) { + + echo esc_html( acf_get_field_count( $field_group ) ); + + } + + } + + + /* + * admin_footer + * + * This function will render extra HTML onto the page + * + * @type action (admin_footer) + * @date 23/06/12 + * @since 3.1.8 + * + * @param n/a + * @return n/a + */ + + function admin_footer() { + + // vars + $url_home = 'https://www.advancedcustomfields.com'; + $icon = ''; + +?> + + + + + + + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/admin-notices.php b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-notices.php new file mode 100644 index 0000000..b6ffdf5 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-notices.php @@ -0,0 +1,146 @@ + '', + + /** @type string Optional HTML alternative to text. + 'html' => '', */ + + /** @type string The type of notice (warning, error, success, info). */ + 'type' => 'info', + + /** @type bool If the notice can be dismissed. */ + 'dismissible' => true, + ); + + /** + * render + * + * Renders the notice HTML. + * + * @date 27/12/18 + * @since 5.8.0 + * + * @param void + * @return void + */ + function render() { + + // Ensure text contains punctuation. + // todo: Remove this after updating translations. + $text = $this->get('text'); + if( substr($text, -1) !== '.' && substr($text, -1) !== '>' ) { + $text .= '.'; + } + + // Print HTML. + printf('
                  %s
                  ', + + // Type class. + $this->get('type'), + + // Dismissible class. + $this->get('dismissible') ? 'is-dismissible' : '', + + // InnerHTML + $this->has('html') ? $this->get('html') : wpautop($text) + ); + } +} + +endif; // class_exists check + +/** +* acf_new_admin_notice +* +* Instantiates and returns a new model. +* +* @date 23/12/18 +* @since 5.8.0 +* +* @param array $data Optional data to set. +* @return ACF_Admin_Notice +*/ +function acf_new_admin_notice( $data = false ) { + + // Create notice. + $instance = new ACF_Admin_Notice( $data ); + + // Register notice. + acf_get_store( 'notices' )->set( $instance->cid, $instance ); + + // Return notice. + return $instance; +} + +/** + * acf_render_admin_notices + * + * Renders all admin notices HTML. + * + * @date 10/1/19 + * @since 5.7.10 + * + * @param void + * @return void + */ +function acf_render_admin_notices() { + + // Get notices. + $notices = acf_get_store( 'notices' )->get_data(); + + // Loop over notices and render. + if( $notices ) { + foreach( $notices as $notice ) { + $notice->render(); + } + } +} + +// Render notices during admin action. +add_action('admin_notices', 'acf_render_admin_notices', 99); + +/** + * acf_add_admin_notice + * + * Creates and returns a new notice. + * + * @date 17/10/13 + * @since 5.0.0 + * + * @param string $text The admin notice text. + * @param string $class The type of notice (warning, error, success, info). + * @return ACF_Admin_Notice + */ +function acf_add_admin_notice( $text = '', $type = 'info' ) { + return acf_new_admin_notice( array( 'text' => $text, 'type' => $type ) ); +} \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/admin-tools.php b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-tools.php new file mode 100644 index 0000000..c081fb0 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-tools.php @@ -0,0 +1,354 @@ +tools[ $instance->name ] = $instance; + + } + + + /** + * get_tool + * + * This function will return a tool tool class + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param string $name + * @return n/a + */ + + function get_tool( $name ) { + + return isset( $this->tools[$name] ) ? $this->tools[$name] : null; + + } + + + /** + * get_tools + * + * This function will return an array of all tools + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return array + */ + + function get_tools() { + + return $this->tools; + + } + + + /* + * admin_menu + * + * This function will add the ACF menu item to the WP admin + * + * @type action (admin_menu) + * @date 28/09/13 + * @since 5.0.0 + * + * @param n/a + * @return n/a + */ + + function admin_menu() { + + // bail early if no show_admin + if( !acf_get_setting('show_admin') ) return; + + + // add page + $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Tools','acf'), __('Tools','acf'), acf_get_setting('capability'), 'acf-tools', array($this, 'html')); + + + // actions + add_action('load-' . $page, array($this, 'load')); + + } + + + /** + * load + * + * description + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function load() { + + // disable filters (default to raw data) + acf_disable_filters(); + + + // include tools + $this->include_tools(); + + + // check submit + $this->check_submit(); + + + // load acf scripts + acf_enqueue_scripts(); + + } + + + /** + * include_tools + * + * description + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function include_tools() { + + // include + acf_include('includes/admin/tools/class-acf-admin-tool.php'); + acf_include('includes/admin/tools/class-acf-admin-tool-export.php'); + acf_include('includes/admin/tools/class-acf-admin-tool-import.php'); + + + // action + do_action('acf/include_admin_tools'); + + } + + + /** + * check_submit + * + * description + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function check_submit() { + + // loop + foreach( $this->get_tools() as $tool ) { + + // load + $tool->load(); + + + // submit + if( acf_verify_nonce($tool->name) ) { + $tool->submit(); + } + + } + + } + + + /** + * html + * + * description + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html() { + + // vars + $screen = get_current_screen(); + $active = acf_maybe_get_GET('tool'); + + + // view + $view = array( + 'screen_id' => $screen->id, + 'active' => $active + ); + + + // register metaboxes + foreach( $this->get_tools() as $tool ) { + + // check active + if( $active && $active !== $tool->name ) continue; + + + // add metabox + add_meta_box( 'acf-admin-tool-' . $tool->name, $tool->title, array($this, 'metabox_html'), $screen->id, 'normal', 'default', array('tool' => $tool->name) ); + + } + + + // view + acf_get_view( 'html-admin-tools', $view ); + + } + + + /** + * meta_box_html + * + * description + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function metabox_html( $post, $metabox ) { + + // vars + $tool = $this->get_tool($metabox['args']['tool']); + + + ?> +
                  + html(); ?> + name ); ?> + + admin_tools = new acf_admin_tools(); + +endif; // class_exists check + + +/* +* acf_register_admin_tool +* +* alias of acf()->admin_tools->register_tool() +* +* @type function +* @date 31/5/17 +* @since 5.6.0 +* +* @param n/a +* @return n/a +*/ + +function acf_register_admin_tool( $class ) { + + return acf()->admin_tools->register_tool( $class ); + +} + + +/* +* acf_get_admin_tools_url +* +* This function will return the admin URL to the tools page +* +* @type function +* @date 31/5/17 +* @since 5.6.0 +* +* @param n/a +* @return n/a +*/ + +function acf_get_admin_tools_url() { + + return admin_url('edit.php?post_type=acf-field-group&page=acf-tools'); + +} + + +/* +* acf_get_admin_tool_url +* +* This function will return the admin URL to the tools page +* +* @type function +* @date 31/5/17 +* @since 5.6.0 +* +* @param n/a +* @return n/a +*/ + +function acf_get_admin_tool_url( $tool = '' ) { + + return acf_get_admin_tools_url() . '&tool='.$tool; + +} + + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/admin-upgrade.php b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-upgrade.php new file mode 100644 index 0000000..4e535a9 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/admin-upgrade.php @@ -0,0 +1,225 @@ + __("Upgrade Database", 'acf'), + 'button_url' => admin_url('index.php?page=acf-upgrade'), + 'confirm' => true + ); + + // view + acf_get_view('html-notice-upgrade', $view); + } + + /** + * network_admin_notices + * + * Displays the DB Upgrade prompt on a multi site. + * + * @date 23/8/18 + * @since 5.7.3 + * + * @param void + * @return void + */ + function network_admin_notices() { + + // vars + $view = array( + 'button_text' => __("Review sites & upgrade", 'acf'), + 'button_url' => network_admin_url('index.php?page=acf-upgrade-network'), + 'confirm' => false + ); + + // view + acf_get_view('html-notice-upgrade', $view); + } + + /** + * admin_html + * + * Displays the HTML for the admin page. + * + * @date 24/8/18 + * @since 5.7.4 + * + * @param void + * @return void + */ + function admin_html() { + acf_get_view('html-admin-page-upgrade'); + } + + /** + * network_admin_html + * + * Displays the HTML for the network upgrade admin page. + * + * @date 24/8/18 + * @since 5.7.4 + * + * @param void + * @return void + */ + function network_admin_html() { + acf_get_view('html-admin-page-upgrade-network'); + } +} + +// instantiate +acf_new_instance('ACF_Admin_Upgrade'); + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/admin.php b/wp-content/plugins/advanced-custom-fields/includes/admin/admin.php new file mode 100644 index 0000000..31f147d --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/admin.php @@ -0,0 +1,89 @@ +admin = new acf_admin(); + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/settings-info.php b/wp-content/plugins/advanced-custom-fields/includes/admin/settings-info.php new file mode 100644 index 0000000..563a2d4 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/settings-info.php @@ -0,0 +1,102 @@ + acf_get_setting('version'), + 'have_pro' => acf_get_setting('pro'), + 'tabs' => array( + 'new' => __("What's New", 'acf'), + 'changelog' => __("Changelog", 'acf') + ), + 'active' => 'new' + ); + + + // set active tab + $tab = acf_maybe_get_GET('tab'); + if( $tab && isset($view['tabs'][ $tab ]) ) { + + $view['active'] = $tab; + + } + + + // load view + acf_get_view('settings-info', $view); + + } + +} + + +// initialize +new acf_settings_info(); + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-export.php b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-export.php new file mode 100644 index 0000000..f506dc6 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-export.php @@ -0,0 +1,596 @@ +name = 'export'; + $this->title = __("Export Field Groups", 'acf'); + + + // active + if( $this->is_active() ) { + $this->title .= ' - ' . __('Generate PHP', 'acf'); + } + + } + + + /** + * submit + * + * This function will run when the tool's form has been submit + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function submit() { + + // vars + $action = acf_maybe_get_POST('action'); + + + // download + if( $action === 'download' ) { + + $this->submit_download(); + + // generate + } elseif( $action === 'generate' ) { + + $this->submit_generate(); + + } + + } + + + /** + * submit_download + * + * description + * + * @date 17/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function submit_download() { + + // vars + $json = $this->get_selected(); + + + // validate + if( $json === false ) { + return acf_add_admin_notice( __("No field groups selected", 'acf'), 'warning' ); + } + + + // headers + $file_name = 'acf-export-' . date('Y-m-d') . '.json'; + header( "Content-Description: File Transfer" ); + header( "Content-Disposition: attachment; filename={$file_name}" ); + header( "Content-Type: application/json; charset=utf-8" ); + + + // return + echo acf_json_encode( $json ); + die; + + } + + + /** + * submit_generate + * + * description + * + * @date 17/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function submit_generate() { + + // vars + $keys = $this->get_selected_keys(); + + + // validate + if( !$keys ) { + return acf_add_admin_notice( __("No field groups selected", 'acf'), 'warning' ); + } + + + // url + $url = add_query_arg( 'keys', implode('+', $keys), $this->get_url() ); + + + // redirect + wp_redirect( $url ); + exit; + + } + + + /** + * load + * + * description + * + * @date 21/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function load() { + + // active + if( $this->is_active() ) { + + // get selected keys + $selected = $this->get_selected_keys(); + + + // add notice + if( $selected ) { + $count = count($selected); + $text = sprintf( _n( 'Exported 1 field group.', 'Exported %s field groups.', $count, 'acf' ), $count ); + acf_add_admin_notice( $text, 'success' ); + } + } + + } + + + /** + * html + * + * This function will output the metabox HTML + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html() { + + // single (generate PHP) + if( $this->is_active() ) { + + $this->html_single(); + + // archive + } else { + + $this->html_archive(); + + } + + } + + + /** + * html_field_selection + * + * description + * + * @date 24/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html_field_selection() { + + // vars + $choices = array(); + $selected = $this->get_selected_keys(); + $field_groups = acf_get_field_groups(); + + + // loop + if( $field_groups ) { + foreach( $field_groups as $field_group ) { + $choices[ $field_group['key'] ] = esc_html( $field_group['title'] ); + } + } + + + // render + acf_render_field_wrap(array( + 'label' => __('Select Field Groups', 'acf'), + 'type' => 'checkbox', + 'name' => 'keys', + 'prefix' => false, + 'value' => $selected, + 'toggle' => true, + 'choices' => $choices, + )); + + } + + + /** + * html_panel_selection + * + * description + * + * @date 21/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html_panel_selection() { + + ?> +
                  +

                  +
                  + html_field_selection(); ?> +
                  +
                  + +
                  +

                  +
                  + __('Empty settings', 'acf'), + 'type' => 'select', + 'name' => 'minimal', + 'prefix' => false, + 'value' => '', + 'choices' => array( + 'all' => __('Include all settings', 'acf'), + 'minimal' => __('Ignore empty settings', 'acf'), + ) + )); +*/ + + ?> +
                  +
                  + +

                  +
                  + html_field_selection(); ?> +
                  +

                  + + +

                  + +
                  +
                  + html_generate(); ?> +
                  +
                  + html_panel_selection(); ?> +

                  + +

                  +
                  +
                  + get_selected(); + $str_replace = array( + " " => "\t", + "'!!__(!!\'" => "__('", + "!!\', !!\'" => "', '", + "!!\')!!'" => "')", + "array (" => "array(" + ); + $preg_replace = array( + '/([\t\r\n]+?)array/' => 'array', + '/[0-9]+ => array/' => 'array' + ); + + + ?> +

                  + +

                  + +

                  + + get_selected_keys(); + $json = array(); + + + // bail early if no keys + if( !$selected ) return false; + + + // construct JSON + foreach( $selected as $key ) { + + // load field group + $field_group = acf_get_field_group( $key ); + + + // validate field group + if( empty($field_group) ) continue; + + + // load fields + $field_group['fields'] = acf_get_fields( $field_group ); + + + // prepare for export + $field_group = acf_prepare_field_group_for_export( $field_group ); + + + // add to json array + $json[] = $field_group; + + } + + + // return + return $json; + + } +} + +// initialize +acf_register_admin_tool( 'ACF_Admin_Tool_Export' ); + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-import.php b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-import.php new file mode 100644 index 0000000..1faaccd --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool-import.php @@ -0,0 +1,157 @@ +name = 'import'; + $this->title = __("Import Field Groups", 'acf'); + $this->icon = 'dashicons-upload'; + + } + + + /** + * html + * + * This function will output the metabox HTML + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html() { + + ?> +

                  +
                  + __('Select File', 'acf'), + 'type' => 'file', + 'name' => 'acf_import_file', + 'value' => false, + 'uploader' => 'basic', + )); + + ?> +
                  +

                  + +

                  + ID; + } + + // Import field group. + $field_group = acf_import_field_group( $field_group ); + + // append message + $ids[] = $field_group['ID']; + } + + // Count number of imported field groups. + $total = count($ids); + + // Generate text. + $text = sprintf( _n( 'Imported 1 field group', 'Imported %s field groups', $total, 'acf' ), $total ); + + // Add links to text. + $links = array(); + foreach( $ids as $id ) { + $links[] = '' . get_the_title( $id ) . ''; + } + $text .= ' ' . implode( ', ', $links ); + + // Add notice + acf_add_admin_notice( $text, 'success' ); + } +} + +// initialize +acf_register_admin_tool( 'ACF_Admin_Tool_Import' ); + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool.php b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool.php new file mode 100644 index 0000000..9f4c683 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/tools/class-acf-admin-tool.php @@ -0,0 +1,195 @@ +name; + } + + + /** + * get_title + * + * This function will return the Tool's title + * + * @date 19/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function get_title() { + return $this->title; + } + + + /** + * get_url + * + * This function will return the Tool's title + * + * @date 19/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function get_url() { + return acf_get_admin_tool_url( $this->name ); + } + + + /** + * is_active + * + * This function will return true if the tool is active + * + * @date 19/10/17 + * @since 5.6.3 + * + * @param n/a + * @return bool + */ + + function is_active() { + return acf_maybe_get_GET('tool') === $this->name; + } + + + /* + * __construct + * + * This function will setup the class functionality + * + * @type function + * @date 27/6/17 + * @since 5.6.0 + * + * @param n/a + * @return n/a + */ + + function __construct() { + + // initialize + $this->initialize(); + + } + + + /** + * initialize + * + * This function will initialize the admin tool + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function initialize() { + + /* do nothing */ + + } + + + + /** + * load + * + * This function is called during the admin page load + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function load() { + + /* do nothing */ + + } + + + /** + * html + * + * This function will output the metabox HTML + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function html() { + + + + } + + + /** + * submit + * + * This function will run when the tool's form has been submit + * + * @date 10/10/17 + * @since 5.6.3 + * + * @param n/a + * @return n/a + */ + + function submit() { + + + } + + +} + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field-conditional-logic.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field-conditional-logic.php new file mode 100644 index 0000000..a49f761 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field-conditional-logic.php @@ -0,0 +1,158 @@ + +
                  + + + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field.php new file mode 100644 index 0000000..0c6657e --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-field.php @@ -0,0 +1,184 @@ + 'acf-field-object acf-field-object-' . acf_slugify($field['type']), + 'data-id' => $field['ID'], + 'data-key' => $field['key'], + 'data-type' => $field['type'], +); + +$meta = array( + 'ID' => $field['ID'], + 'key' => $field['key'], + 'parent' => $field['parent'], + 'menu_order' => $i, + 'save' => '' +); + +?> +
                  > + +
                  + $v ): + acf_hidden_input(array( 'name' => $prefix . '[' . $k . ']', 'value' => $v, 'id' => $id . '-' . $k )); + endforeach; ?> +
                  + +
                  + +
                  + +
                  +
                    + + + 'true_false', + 'name' => 'conditional_logic', + 'prefix' => $field['prefix'], + 'value' => $disabled ? 0 : 1, + 'ui' => 1, + 'class' => 'conditions-toggle', + )); + + ?> +
                    style="display:none;"> + + $group ): + + // validate + if( empty($group) ) continue; + + + // vars + // $group_id must be completely different to $rule_id to avoid JS issues + $group_id = "group_{$group_id}"; + $h4 = ($group_id == "group_0") ? __("Show this field if",'acf') : __("or",'acf'); + + ?> +
                    + +

                    + + + + $rule ): + + // valid rule + $rule = wp_parse_args( $rule, array( + 'field' => '', + 'operator' => '', + 'value' => '', + )); + + + // vars + // $group_id must be completely different to $rule_id to avoid JS issues + $rule_id = "rule_{$rule_id}"; + $prefix = "{$field['prefix']}[conditional_logic][{$group_id}][{$rule_id}]"; + + // data attributes + $attributes = array( + 'data-id' => $rule_id, + 'data-field' => $rule['field'], + 'data-operator' => $rule['operator'], + 'data-value' => $rule['value'] + ); + + ?> + > + + + + + + + + +
                    + 'select', + 'prefix' => $prefix, + 'name' => 'field', + 'class' => 'condition-rule-field', + 'disabled' => $disabled, + 'value' => $rule['field'], + 'choices' => array( + $rule['field'] => $rule['field'] + ) + )); + + ?> + + 'select', + 'prefix' => $prefix, + 'name' => 'operator', + 'class' => 'condition-rule-operator', + 'disabled' => $disabled, + 'value' => $rule['operator'], + 'choices' => array( + $rule['operator'] => $rule['operator'] + ) + )); + + ?> + + 'select', + 'prefix' => $prefix, + 'name' => 'value', + 'class' => 'condition-rule-value', + 'disabled' => $disabled, + 'value' => $rule['value'], + 'choices' => array( + $rule['value'] => $rule['value'] + ) + )); + + ?> + + + + +
                    + +
                    + + +

                    + + + +
                    + +
                    + + __('Field Label','acf'), + 'instructions' => __('This is the name which will appear on the EDIT page','acf'), + 'name' => 'label', + 'type' => 'text', + 'class' => 'field-label' + ), true); + + + // name + acf_render_field_setting($field, array( + 'label' => __('Field Name','acf'), + 'instructions' => __('Single word, no spaces. Underscores and dashes allowed','acf'), + 'name' => 'name', + 'type' => 'text', + 'class' => 'field-name' + ), true); + + + // type + acf_render_field_setting($field, array( + 'label' => __('Field Type','acf'), + 'instructions' => '', + 'type' => 'select', + 'name' => 'type', + 'choices' => acf_get_grouped_field_types(), + 'class' => 'field-type' + ), true); + + + // instructions + acf_render_field_setting($field, array( + 'label' => __('Instructions','acf'), + 'instructions' => __('Instructions for authors. Shown when submitting data','acf'), + 'type' => 'textarea', + 'name' => 'instructions', + 'rows' => 5 + ), true); + + + // required + acf_render_field_setting($field, array( + 'label' => __('Required?','acf'), + 'instructions' => '', + 'type' => 'true_false', + 'name' => 'required', + 'ui' => 1, + 'class' => 'field-required' + ), true); + + + // 3rd party settings + do_action('acf/render_field_settings', $field); + + + // type specific settings + do_action("acf/render_field_settings/type={$field['type']}", $field); + + + // conditional logic + acf_get_view('field-group-field-conditional-logic', array( 'field' => $field )); + + + // wrapper + acf_render_field_wrap(array( + 'label' => __('Wrapper Attributes','acf'), + 'instructions' => '', + 'type' => 'number', + 'name' => 'width', + 'prefix' => $field['prefix'] . '[wrapper]', + 'value' => $field['wrapper']['width'], + 'prepend' => __('width', 'acf'), + 'append' => '%', + 'wrapper' => array( + 'data-name' => 'wrapper', + 'class' => 'acf-field-setting-wrapper' + ) + ), 'tr'); + + acf_render_field_wrap(array( + 'label' => '', + 'instructions' => '', + 'type' => 'text', + 'name' => 'class', + 'prefix' => $field['prefix'] . '[wrapper]', + 'value' => $field['wrapper']['class'], + 'prepend' => __('class', 'acf'), + 'wrapper' => array( + 'data-append' => 'wrapper' + ) + ), 'tr'); + + acf_render_field_wrap(array( + 'label' => '', + 'instructions' => '', + 'type' => 'text', + 'name' => 'id', + 'prefix' => $field['prefix'] . '[wrapper]', + 'value' => $field['wrapper']['id'], + 'prepend' => __('id', 'acf'), + 'wrapper' => array( + 'data-append' => 'wrapper' + ) + ), 'tr'); + + ?> + + + + + +
                    + +
                    +
                    + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-fields.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-fields.php new file mode 100644 index 0000000..e4a9e50 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-fields.php @@ -0,0 +1,52 @@ +
                    + + + +
                    + +
                    + + Add Field button to create your first field.",'acf'); ?> +
                    + + $field ): + + acf_get_view('field-group-field', array( 'field' => $field, 'i' => $i )); + + endforeach; + + endif; ?> + +
                    + + + + 'acfcloneindex', + 'key' => 'acfcloneindex', + 'label' => __('New Field','acf'), + 'name' => 'new_field', + 'type' => 'text' + )); + + ?> + + + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-locations.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-locations.php new file mode 100644 index 0000000..12c76a8 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-locations.php @@ -0,0 +1,45 @@ + +
                    +
                    + +

                    +
                    +
                    +
                    + + $group ): + + // bail ealry if no group + if( empty($group) ) return; + + + // view + acf_get_view('html-location-group', array( + 'group' => $group, + 'group_id' => "group_{$i}" + )); + + endforeach; ?> + +

                    + + + +
                    +
                    +
                    + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-options.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-options.php new file mode 100644 index 0000000..e72cd08 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-options.php @@ -0,0 +1,155 @@ + __('Active','acf'), + 'instructions' => '', + 'type' => 'true_false', + 'name' => 'active', + 'prefix' => 'acf_field_group', + 'value' => $field_group['active'], + 'ui' => 1, + //'ui_on_text' => __('Active', 'acf'), + //'ui_off_text' => __('Inactive', 'acf'), +)); + + +// style +acf_render_field_wrap(array( + 'label' => __('Style','acf'), + 'instructions' => '', + 'type' => 'select', + 'name' => 'style', + 'prefix' => 'acf_field_group', + 'value' => $field_group['style'], + 'choices' => array( + 'default' => __("Standard (WP metabox)",'acf'), + 'seamless' => __("Seamless (no metabox)",'acf'), + ) +)); + + +// position +acf_render_field_wrap(array( + 'label' => __('Position','acf'), + 'instructions' => '', + 'type' => 'select', + 'name' => 'position', + 'prefix' => 'acf_field_group', + 'value' => $field_group['position'], + 'choices' => array( + 'acf_after_title' => __("High (after title)",'acf'), + 'normal' => __("Normal (after content)",'acf'), + 'side' => __("Side",'acf'), + ), + 'default_value' => 'normal' +)); + + +// label_placement +acf_render_field_wrap(array( + 'label' => __('Label placement','acf'), + 'instructions' => '', + 'type' => 'select', + 'name' => 'label_placement', + 'prefix' => 'acf_field_group', + 'value' => $field_group['label_placement'], + 'choices' => array( + 'top' => __("Top aligned",'acf'), + 'left' => __("Left aligned",'acf'), + ) +)); + + +// instruction_placement +acf_render_field_wrap(array( + 'label' => __('Instruction placement','acf'), + 'instructions' => '', + 'type' => 'select', + 'name' => 'instruction_placement', + 'prefix' => 'acf_field_group', + 'value' => $field_group['instruction_placement'], + 'choices' => array( + 'label' => __("Below labels",'acf'), + 'field' => __("Below fields",'acf'), + ) +)); + + +// menu_order +acf_render_field_wrap(array( + 'label' => __('Order No.','acf'), + 'instructions' => __('Field groups with a lower order will appear first','acf'), + 'type' => 'number', + 'name' => 'menu_order', + 'prefix' => 'acf_field_group', + 'value' => $field_group['menu_order'], +)); + + +// description +acf_render_field_wrap(array( + 'label' => __('Description','acf'), + 'instructions' => __('Shown in field group list','acf'), + 'type' => 'text', + 'name' => 'description', + 'prefix' => 'acf_field_group', + 'value' => $field_group['description'], +)); + + +// hide on screen +$choices = array( + 'permalink' => __("Permalink", 'acf'), + 'the_content' => __("Content Editor",'acf'), + 'excerpt' => __("Excerpt", 'acf'), + 'custom_fields' => __("Custom Fields", 'acf'), + 'discussion' => __("Discussion", 'acf'), + 'comments' => __("Comments", 'acf'), + 'revisions' => __("Revisions", 'acf'), + 'slug' => __("Slug", 'acf'), + 'author' => __("Author", 'acf'), + 'format' => __("Format", 'acf'), + 'page_attributes' => __("Page Attributes", 'acf'), + 'featured_image' => __("Featured Image", 'acf'), + 'categories' => __("Categories", 'acf'), + 'tags' => __("Tags", 'acf'), + 'send-trackbacks' => __("Send Trackbacks", 'acf'), +); +if( acf_get_setting('remove_wp_meta_box') ) { + unset( $choices['custom_fields'] ); +} + +acf_render_field_wrap(array( + 'label' => __('Hide on screen','acf'), + 'instructions' => __('Select items to hide them from the edit screen.','acf') . '

                    ' . __("If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)",'acf'), + 'type' => 'checkbox', + 'name' => 'hide_on_screen', + 'prefix' => 'acf_field_group', + 'value' => $field_group['hide_on_screen'], + 'toggle' => true, + 'choices' => $choices +)); + + +// 3rd party settings +do_action('acf/render_field_group_settings', $field_group); + +?> +
                    + +
                    + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade-network.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade-network.php new file mode 100644 index 0000000..ae00943 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade-network.php @@ -0,0 +1,216 @@ + + +
                    + +

                    + +

                    +

                    + + + + + + + + + + + + + + + + + + $site ): + + // switch blog + switch_to_blog( $site['blog_id'] ); + + ?> + class="alternate"> + + + + + + +
                    + + + +
                    + + + +
                    + + + + +
                    +
                    + + + + + +
                    + +

                    +

                    Return to network dashboard', 'acf'), network_admin_url() ); ?>

                    + + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade.php new file mode 100644 index 0000000..545c0b0 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade.php @@ -0,0 +1,119 @@ + + +
                    + +

                    + + + +

                    +

                    +

                    +

                    See what\'s new', 'acf' ), admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info') ); ?>

                    + + + + + +

                    + + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-tools.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-tools.php new file mode 100644 index 0000000..145ac6c --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-tools.php @@ -0,0 +1,27 @@ + +
                    + +

                    + +
                    + +
                    + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-group.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-group.php new file mode 100644 index 0000000..14dc961 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-group.php @@ -0,0 +1,25 @@ +
                    + +

                    + + + + $rule ): + + // validate rule + $rule = acf_validate_location_rule($rule); + + // append id and group + $rule['id'] = "rule_{$i}"; + $rule['group'] = $group_id; + + // view + acf_get_view('html-location-rule', array( + 'rule' => $rule + )); + + endforeach; ?> + +
                    + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-rule.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-rule.php new file mode 100644 index 0000000..1171133 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-rule.php @@ -0,0 +1,91 @@ + + + + 'select', + 'name' => 'param', + 'prefix' => $prefix, + 'value' => $rule['param'], + 'choices' => $choices, + 'class' => 'refresh-location-rule' + )); + + } + + ?> + + + 'select', + 'name' => 'operator', + 'prefix' => $prefix, + 'value' => $rule['operator'], + 'choices' => $choices + )); + + // custom + } else { + + echo $choices; + + } + + ?> + + + 'select', + 'name' => 'value', + 'prefix' => $prefix, + 'value' => $rule['value'], + 'choices' => $choices + )); + + // custom + } else { + + echo $choices; + + } + + ?> + + + + + + + + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-notice-upgrade.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-notice-upgrade.php new file mode 100644 index 0000000..11f40fd --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/html-notice-upgrade.php @@ -0,0 +1,43 @@ + +
                    + +
                    + + +

                    +


                    + +

                    + +
                    + +
                    + +
                    + +
                    + + + \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-addons.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-addons.php new file mode 100644 index 0000000..73df28f --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-addons.php @@ -0,0 +1,54 @@ +
                    + +

                    + +
                    + + + + "", + "slug" => "", + "description" => "", + "thumbnail" => "", + "url" => "", + "btn" => __("Download & Install",'acf'), + "btn_color" => "" + )); + + ?> + +
                    + +
                    + + + +
                    +
                    +

                    +

                    +
                    + + +
                    + + + + + +
                    + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-info.php b/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-info.php new file mode 100644 index 0000000..1758c42 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/admin/views/settings-info.php @@ -0,0 +1,160 @@ +
                    + +

                    +
                    + + + + + +
                    +

                    +
                    +
                    +

                    +

                    +

                    +
                    +
                    +

                    +

                    +

                    +
                    +
                    +

                    +

                    +

                    +
                    +
                    +
                    + +
                    + +
                    +

                    👋

                    +
                    +
                    +

                    +

                    +

                    Pro version of ACF. With both personal and developer licenses available, premium functionality is more affordable and accessible than ever before!', 'acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?>

                    +
                    + +
                    +

                    +

                    +

                    ACF PRO features.', 'acf'), esc_url('https://www.advancedcustomfields.com/pro')); ?>

                    +
                    + +
                    +

                    +

                    +

                    upgrade guide to answer any questions, but if you do have one, please contact our support team via the help desk.', 'acf'), esc_url('https://www.advancedcustomfields.com/resources/upgrade-guide-acf-pro/'), esc_url('https://www.advancedcustomfields.com/support/')); ?>

                    +
                    +
                    +
                    + +
                    + +
                    + +

                    🎉

                    + +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    +

                    +

                    +
                    + +
                    + +
                    + +
                    + + + +

                    + + + +
                    \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-check-screen.php b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-check-screen.php new file mode 100644 index 0000000..c56eb56 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-check-screen.php @@ -0,0 +1,98 @@ +request, array( + 'screen' => '', + 'post_id' => 0, + 'ajax' => true, + 'exists' => array() + )); + + // vars + $response = array( + 'results' => array(), + 'style' => '' + ); + + // get field groups + $field_groups = acf_get_field_groups( $args ); + + // loop through field groups + if( $field_groups ) { + foreach( $field_groups as $i => $field_group ) { + + // vars + $item = array( + 'id' => 'acf-' . $field_group['key'], + 'key' => $field_group['key'], + 'title' => $field_group['title'], + 'position' => $field_group['position'], + 'style' => $field_group['style'], + 'label' => $field_group['label_placement'], + 'edit' => acf_get_field_group_edit_link( $field_group['ID'] ), + 'html' => '' + ); + + // append html if doesnt already exist on page + if( !in_array($field_group['key'], $args['exists']) ) { + + // load fields + $fields = acf_get_fields( $field_group ); + + // get field HTML + ob_start(); + + // render + acf_render_fields( $fields, $args['post_id'], 'div', $field_group['instruction_placement'] ); + + $item['html'] = ob_get_clean(); + } + + // append + $response['results'][] = $item; + } + + // Get style from first field group. + $response['style'] = acf_get_field_group_style( $field_groups[0] ); + } + + // Custom metabox order. + if( $this->get('screen') == 'post' ) { + $response['sorted'] = get_user_option('meta-box-order_' . $this->get('post_type')); + } + + // return + return $response; + } +} + +acf_new_instance('ACF_Ajax_Check_Screen'); + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-upgrade.php b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-upgrade.php new file mode 100644 index 0000000..2f08e53 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax-upgrade.php @@ -0,0 +1,54 @@ +has('value') ) { + return acf_update_user_setting( $this->get('name'), $this->get('value') ); + + // get + } else { + return acf_get_user_setting( $this->get('name') ); + } + } +} + +acf_new_instance('ACF_Ajax_User_Setting'); + +endif; // class_exists check diff --git a/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax.php b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax.php new file mode 100644 index 0000000..46b4f5a --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/ajax/class-acf-ajax.php @@ -0,0 +1,184 @@ +initialize(); + $this->add_actions(); + } + + /** + * has + * + * Returns true if the request has data for the given key. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param string $key The data key. + * @return boolean + */ + function has( $key = '' ) { + return isset($this->request[$key]); + } + + /** + * get + * + * Returns request data for the given key. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param string $key The data key. + * @return mixed + */ + function get( $key = '' ) { + return isset($this->request[$key]) ? $this->request[$key] : null; + } + + /** + * set + * + * Sets request data for the given key. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param string $key The data key. + * @param mixed $value The data value. + * @return ACF_Ajax + */ + function set( $key = '', $value ) { + $this->request[$key] = $value; + return $this; + } + + /** + * initialize + * + * Allows easy access to modifying properties without changing constructor. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param void + * @return void + */ + function initialize() { + /* do nothing */ + } + + /** + * add_actions + * + * Adds the ajax actions for this response. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param void + * @return void + */ + function add_actions() { + + // add action for logged-in users + add_action( "wp_ajax_{$this->action}", array($this, 'request') ); + + // add action for non logged-in users + if( $this->public ) { + add_action( "wp_ajax_nopriv_{$this->action}", array($this, 'request') ); + } + } + + /** + * request + * + * Callback for ajax action. Sets up properties and calls the get_response() function. + * + * @date 1/8/18 + * @since 5.7.2 + * + * @param void + * @return void + */ + function request() { + + // Verify ajax request + if( !acf_verify_ajax() ) { + wp_send_json_error(); + } + + // Store data for has() and get() functions. + $this->request = wp_unslash($_REQUEST); + + // Send response. + $this->send( $this->get_response( $this->request ) ); + } + + /** + * get_response + * + * Returns the response data to sent back. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param array $request The request args. + * @return mixed The response data or WP_Error. + */ + function get_response( $request ) { + return true; + } + + /** + * send + * + * Sends back JSON based on the $response as either success or failure. + * + * @date 31/7/18 + * @since 5.7.2 + * + * @param mixed $response The response to send back. + * @return void + */ + function send( $response ) { + + // Return error. + if( is_wp_error($response) ) { + wp_send_json_error(array( 'error' => $response->get_error_message() )); + + // Return success. + } else { + wp_send_json_success($response); + } + } +} + +endif; // class_exists check + +?> \ No newline at end of file diff --git a/wp-content/plugins/advanced-custom-fields/includes/api/api-helpers.php b/wp-content/plugins/advanced-custom-fields/includes/api/api-helpers.php new file mode 100644 index 0000000..1366953 --- /dev/null +++ b/wp-content/plugins/advanced-custom-fields/includes/api/api-helpers.php @@ -0,0 +1,4848 @@ +has_setting() +* +* @date 2/2/18 +* @since 5.6.5 +* +* @param n/a +* @return n/a +*/ + +function acf_has_setting( $name = '' ) { + return acf()->has_setting( $name ); +} + + +/** +* acf_raw_setting +* +* alias of acf()->get_setting() +* +* @date 2/2/18 +* @since 5.6.5 +* +* @param n/a +* @return n/a +*/ + +function acf_raw_setting( $name = '' ) { + return acf()->get_setting( $name ); +} + + +/* +* acf_update_setting +* +* alias of acf()->update_setting() +* +* @type function +* @date 28/09/13 +* @since 5.0.0 +* +* @param $name (string) +* @param $value (mixed) +* @return n/a +*/ + +function acf_update_setting( $name, $value ) { + + // validate name + $name = acf_validate_setting( $name ); + + // update + return acf()->update_setting( $name, $value ); +} + + +/** +* acf_validate_setting +* +* Returns the changed setting name if available. +* +* @date 2/2/18 +* @since 5.6.5 +* +* @param n/a +* @return n/a +*/ + +function acf_validate_setting( $name = '' ) { + return apply_filters( "acf/validate_setting", $name ); +} + + +/* +* acf_get_setting +* +* alias of acf()->get_setting() +* +* @type function +* @date 28/09/13 +* @since 5.0.0 +* +* @param n/a +* @return n/a +*/ + +function acf_get_setting( $name, $value = null ) { + + // validate name + $name = acf_validate_setting( $name ); + + // check settings + if( acf_has_setting($name) ) { + $value = acf_raw_setting( $name ); + } + + // filter + $value = apply_filters( "acf/settings/{$name}", $value ); + + // return + return $value; +} + + +/* +* acf_append_setting +* +* This function will add a value into the settings array found in the acf object +* +* @type function +* @date 28/09/13 +* @since 5.0.0 +* +* @param $name (string) +* @param $value (mixed) +* @return n/a +*/ + +function acf_append_setting( $name, $value ) { + + // vars + $setting = acf_raw_setting( $name ); + + // bail ealry if not array + if( !is_array($setting) ) { + $setting = array(); + } + + // append + $setting[] = $value; + + // update + return acf_update_setting( $name, $setting ); +} + + +/** +* acf_get_data +* +* Returns data. +* +* @date 28/09/13 +* @since 5.0.0 +* +* @param string $name +* @return mixed +*/ + +function acf_get_data( $name ) { + return acf()->get_data( $name ); +} + + +/** +* acf_set_data +* +* Sets data. +* +* @date 28/09/13 +* @since 5.0.0 +* +* @param string $name +* @param mixed $value +* @return n/a +*/ + +function acf_set_data( $name, $value ) { + return acf()->set_data( $name, $value ); +} + +/* +* acf_init +* +* alias of acf()->init() +* +* @type function +* @date 28/09/13 +* @since 5.0.0 +* +* @param n/a +* @return n/a +*/ + +function acf_init() { + + acf()->init(); + +} + + +/* +* acf_has_done +* +* This function will return true if this action has already been done +* +* @type function +* @date 16/12/2015 +* @since 5.3.2 +* +* @param $name (string) +* @return (boolean) +*/ + +function acf_has_done( $name ) { + + // return true if already done + if( acf_raw_setting("has_done_{$name}") ) { + return true; + } + + // update setting and return + acf_update_setting("has_done_{$name}", true); + return false; +} + + + + +/* +* acf_get_external_path +* +* This function will return the path to a file within an external folder +* +* @type function +* @date 22/2/17 +* @since 5.5.8 +* +* @param $file (string) +* @param $path (string) +* @return (string) +*/ + +function acf_get_external_path( $file, $path = '' ) { + + return plugin_dir_path( $file ) . $path; + +} + + +/* +* acf_get_external_dir +* +* This function will return the url to a file within an external folder +* +* @type function +* @date 22/2/17 +* @since 5.5.8 +* +* @param $file (string) +* @param $path (string) +* @return (string) +*/ + +function acf_get_external_dir( $file, $path = '' ) { + + return acf_plugin_dir_url( $file ) . $path; + +} + + +/** +* acf_plugin_dir_url +* +* This function will calculate the url to a plugin folder. +* Different to the WP plugin_dir_url(), this function can calculate for urls outside of the plugins folder (theme include). +* +* @date 13/12/17 +* @since 5.6.8 +* +* @param type $var Description. Default. +* @return type Description. +*/ + +function acf_plugin_dir_url( $file ) { + + // vars + $path = plugin_dir_path( $file ); + $path = wp_normalize_path( $path ); + + + // check plugins + $check_path = wp_normalize_path( realpath(WP_PLUGIN_DIR) ); + if( strpos($path, $check_path) === 0 ) { + return str_replace( $check_path, plugins_url(), $path ); + } + + // check wp-content + $check_path = wp_normalize_path( realpath(WP_CONTENT_DIR) ); + if( strpos($path, $check_path) === 0 ) { + return str_replace( $check_path, content_url(), $path ); + } + + // check root + $check_path = wp_normalize_path( realpath(ABSPATH) ); + if( strpos($path, $check_path) === 0 ) { + return str_replace( $check_path, site_url('/'), $path ); + } + + + // return + return plugin_dir_url( $file ); + +} + + +/* +* acf_parse_args +* +* This function will merge together 2 arrays and also convert any numeric values to ints +* +* @type function +* @date 18/10/13 +* @since 5.0.0 +* +* @param $args (array) +* @param $defaults (array) +* @return $args (array) +*/ + +function acf_parse_args( $args, $defaults = array() ) { + + // parse args + $args = wp_parse_args( $args, $defaults ); + + + // parse types + $args = acf_parse_types( $args ); + + + // return + return $args; + +} + + +/* +* acf_parse_types +* +* This function will convert any numeric values to int and trim strings +* +* @type function +* @date 18/10/13 +* @since 5.0.0 +* +* @param $var (mixed) +* @return $var (mixed) +*/ + +function acf_parse_types( $array ) { + return array_map( 'acf_parse_type', $array ); +} + + +/* +* acf_parse_type +* +* description +* +* @type function +* @date 11/11/2014 +* @since 5.0.9 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_parse_type( $v ) { + + // Check if is string. + if( is_string($v) ) { + + // Trim ("Word " = "Word"). + $v = trim( $v ); + + // Convert int strings to int ("123" = 123). + if( is_numeric($v) && strval(intval($v)) === $v ) { + $v = intval( $v ); + } + } + + // return. + return $v; +} + + +/* +* acf_get_view +* +* This function will load in a file from the 'admin/views' folder and allow variables to be passed through +* +* @type function +* @date 28/09/13 +* @since 5.0.0 +* +* @param $view_name (string) +* @param $args (array) +* @return n/a +*/ + +function acf_get_view( $path = '', $args = array() ) { + + // allow view file name shortcut + if( substr($path, -4) !== '.php' ) { + + $path = acf_get_path("includes/admin/views/{$path}.php"); + + } + + + // include + if( file_exists($path) ) { + + extract( $args ); + include( $path ); + + } + +} + + +/* +* acf_merge_atts +* +* description +* +* @type function +* @date 2/11/2014 +* @since 5.0.9 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_merge_atts( $atts, $extra = array() ) { + + // bail ealry if no $extra + if( empty($extra) ) return $atts; + + + // trim + $extra = array_map('trim', $extra); + $extra = array_filter($extra); + + + // merge in new atts + foreach( $extra as $k => $v ) { + + // append + if( $k == 'class' || $k == 'style' ) { + + $atts[ $k ] .= ' ' . $v; + + // merge + } else { + + $atts[ $k ] = $v; + + } + + } + + + // return + return $atts; + +} + + +/* +* acf_nonce_input +* +* This function will create a basic nonce input +* +* @type function +* @date 24/5/17 +* @since 5.6.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_nonce_input( $nonce = '' ) { + + echo ''; + +} + + +/* +* acf_extract_var +* +* This function will remove the var from the array, and return the var +* +* @type function +* @date 2/10/13 +* @since 5.0.0 +* +* @param $array (array) +* @param $key (string) +* @return (mixed) +*/ + +function acf_extract_var( &$array, $key, $default = null ) { + + // check if exists + // - uses array_key_exists to extract NULL values (isset will fail) + if( is_array($array) && array_key_exists($key, $array) ) { + + // store value + $v = $array[ $key ]; + + + // unset + unset( $array[ $key ] ); + + + // return + return $v; + + } + + + // return + return $default; +} + + +/* +* acf_extract_vars +* +* This function will remove the vars from the array, and return the vars +* +* @type function +* @date 8/10/13 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_extract_vars( &$array, $keys ) { + + $r = array(); + + foreach( $keys as $key ) { + + $r[ $key ] = acf_extract_var( $array, $key ); + + } + + return $r; +} + + +/* +* acf_get_sub_array +* +* This function will return a sub array of data +* +* @type function +* @date 15/03/2016 +* @since 5.3.2 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_get_sub_array( $array, $keys ) { + + $r = array(); + + foreach( $keys as $key ) { + + $r[ $key ] = $array[ $key ]; + + } + + return $r; + +} + + +/** +* acf_get_post_types +* +* Returns an array of post type names. +* +* @date 7/10/13 +* @since 5.0.0 +* +* @param array $args Optional. An array of key => value arguments to match against the post type objects. Default empty array. +* @return array A list of post type names. +*/ + +function acf_get_post_types( $args = array() ) { + + // vars + $post_types = array(); + + // extract special arg + $exclude = acf_extract_var( $args, 'exclude', array() ); + $exclude[] = 'acf-field'; + $exclude[] = 'acf-field-group'; + + // get post type objects + $objects = get_post_types( $args, 'objects' ); + + // loop + foreach( $objects as $i => $object ) { + + // bail early if is exclude + if( in_array($i, $exclude) ) continue; + + // bail early if is builtin (WP) private post type + // - nav_menu_item, revision, customize_changeset, etc + if( $object->_builtin && !$object->public ) continue; + + // append + $post_types[] = $i; + } + + // filter + $post_types = apply_filters('acf/get_post_types', $post_types, $args); + + // return + return $post_types; +} + +function acf_get_pretty_post_types( $post_types = array() ) { + + // get post types + if( empty($post_types) ) { + + // get all custom post types + $post_types = acf_get_post_types(); + + } + + + // get labels + $ref = array(); + $r = array(); + + foreach( $post_types as $post_type ) { + + // vars + $label = acf_get_post_type_label($post_type); + + + // append to r + $r[ $post_type ] = $label; + + + // increase counter + if( !isset($ref[ $label ]) ) { + + $ref[ $label ] = 0; + + } + + $ref[ $label ]++; + } + + + // get slugs + foreach( array_keys($r) as $i ) { + + // vars + $post_type = $r[ $i ]; + + if( $ref[ $post_type ] > 1 ) { + + $r[ $i ] .= ' (' . $i . ')'; + + } + + } + + + // return + return $r; + +} + + + +/* +* acf_get_post_type_label +* +* This function will return a pretty label for a specific post_type +* +* @type function +* @date 5/07/2016 +* @since 5.4.0 +* +* @param $post_type (string) +* @return (string) +*/ + +function acf_get_post_type_label( $post_type ) { + + // vars + $label = $post_type; + + + // check that object exists + // - case exists when importing field group from another install and post type does not exist + if( post_type_exists($post_type) ) { + + $obj = get_post_type_object($post_type); + $label = $obj->labels->singular_name; + + } + + + // return + return $label; + +} + + +/* +* acf_verify_nonce +* +* This function will look at the $_POST['_acf_nonce'] value and return true or false +* +* @type function +* @date 15/10/13 +* @since 5.0.0 +* +* @param $nonce (string) +* @return (boolean) +*/ + +function acf_verify_nonce( $value) { + + // vars + $nonce = acf_maybe_get_POST('_acf_nonce'); + + + // bail early nonce does not match (post|user|comment|term) + if( !$nonce || !wp_verify_nonce($nonce, $value) ) return false; + + + // reset nonce (only allow 1 save) + $_POST['_acf_nonce'] = false; + + + // return + return true; + +} + + +/* +* acf_verify_ajax +* +* This function will return true if the current AJAX request is valid +* It's action will also allow WPML to set the lang and avoid AJAX get_posts issues +* +* @type function +* @date 7/08/2015 +* @since 5.2.3 +* +* @param n/a +* @return (boolean) +*/ + +function acf_verify_ajax() { + + // vars + $nonce = isset($_REQUEST['nonce']) ? $_REQUEST['nonce'] : ''; + + // bail early if not acf nonce + if( !$nonce || !wp_verify_nonce($nonce, 'acf_nonce') ) { + return false; + } + + // action for 3rd party customization + do_action('acf/verify_ajax'); + + // return + return true; +} + + +/* +* acf_get_image_sizes +* +* This function will return an array of available image sizes +* +* @type function +* @date 23/10/13 +* @since 5.0.0 +* +* @param n/a +* @return (array) +*/ + +function acf_get_image_sizes() { + + // vars + $sizes = array( + 'thumbnail' => __("Thumbnail",'acf'), + 'medium' => __("Medium",'acf'), + 'large' => __("Large",'acf') + ); + + + // find all sizes + $all_sizes = get_intermediate_image_sizes(); + + + // add extra registered sizes + if( !empty($all_sizes) ) { + + foreach( $all_sizes as $size ) { + + // bail early if already in array + if( isset($sizes[ $size ]) ) { + + continue; + + } + + + // append to array + $label = str_replace('-', ' ', $size); + $label = ucwords( $label ); + $sizes[ $size ] = $label; + + } + + } + + + // add sizes + foreach( array_keys($sizes) as $s ) { + + // vars + $data = acf_get_image_size($s); + + + // append + if( $data['width'] && $data['height'] ) { + + $sizes[ $s ] .= ' (' . $data['width'] . ' x ' . $data['height'] . ')'; + + } + + } + + + // add full end + $sizes['full'] = __("Full Size",'acf'); + + + // filter for 3rd party customization + $sizes = apply_filters( 'acf/get_image_sizes', $sizes ); + + + // return + return $sizes; + +} + +function acf_get_image_size( $s = '' ) { + + // global + global $_wp_additional_image_sizes; + + + // rename for nicer code + $_sizes = $_wp_additional_image_sizes; + + + // vars + $data = array( + 'width' => isset($_sizes[$s]['width']) ? $_sizes[$s]['width'] : get_option("{$s}_size_w"), + 'height' => isset($_sizes[$s]['height']) ? $_sizes[$s]['height'] : get_option("{$s}_size_h") + ); + + + // return + return $data; + +} + +/** + * acf_version_compare + * + * Similar to the version_compare() function but with extra functionality. + * + * @date 21/11/16 + * @since 5.5.0 + * + * @param string $left The left version number. + * @param string $compare The compare operator. + * @param string $right The right version number. + * @return bool + */ +function acf_version_compare( $left = '', $compare = '>', $right = '' ) { + + // Detect 'wp' placeholder. + if( $left === 'wp' ) { + global $wp_version; + $left = $wp_version; + } + + // Return result. + return version_compare( $left, $right, $compare ); +} + + +/* +* acf_get_full_version +* +* This function will remove any '-beta1' or '-RC1' strings from a version +* +* @type function +* @date 24/11/16 +* @since 5.5.0 +* +* @param $version (string) +* @return (string) +*/ + +function acf_get_full_version( $version = '1' ) { + + // remove '-beta1' or '-RC1' + if( $pos = strpos($version, '-') ) { + + $version = substr($version, 0, $pos); + + } + + + // return + return $version; + +} + + +/* +* acf_get_terms +* +* This function is a wrapper for the get_terms() function +* +* @type function +* @date 28/09/2016 +* @since 5.4.0 +* +* @param $args (array) +* @return (array) +*/ + +function acf_get_terms( $args ) { + + // defaults + $args = wp_parse_args($args, array( + 'taxonomy' => null, + 'hide_empty' => false, + 'update_term_meta_cache' => false, + )); + + // parameters changed in version 4.5 + if( acf_version_compare('wp', '<', '4.5') ) { + return get_terms( $args['taxonomy'], $args ); + } + + // return + return get_terms( $args ); +} + + +/* +* acf_get_taxonomy_terms +* +* This function will return an array of available taxonomy terms +* +* @type function +* @date 7/10/13 +* @since 5.0.0 +* +* @param $taxonomies (array) +* @return (array) +*/ + +function acf_get_taxonomy_terms( $taxonomies = array() ) { + + // force array + $taxonomies = acf_get_array( $taxonomies ); + + + // get pretty taxonomy names + $taxonomies = acf_get_pretty_taxonomies( $taxonomies ); + + + // vars + $r = array(); + + + // populate $r + foreach( array_keys($taxonomies) as $taxonomy ) { + + // vars + $label = $taxonomies[ $taxonomy ]; + $is_hierarchical = is_taxonomy_hierarchical( $taxonomy ); + $terms = acf_get_terms(array( + 'taxonomy' => $taxonomy, + 'hide_empty' => false + )); + + + // bail early i no terms + if( empty($terms) ) continue; + + + // sort into hierachial order! + if( $is_hierarchical ) { + + $terms = _get_term_children( 0, $terms, $taxonomy ); + + } + + + // add placeholder + $r[ $label ] = array(); + + + // add choices + foreach( $terms as $term ) { + + $k = "{$taxonomy}:{$term->slug}"; + $r[ $label ][ $k ] = acf_get_term_title( $term ); + + } + + } + + + // return + return $r; + +} + + +/* +* acf_decode_taxonomy_terms +* +* This function decodes the $taxonomy:$term strings into a nested array +* +* @type function +* @date 27/02/2014 +* @since 5.0.0 +* +* @param $terms (array) +* @return (array) +*/ + +function acf_decode_taxonomy_terms( $strings = false ) { + + // bail early if no terms + if( empty($strings) ) return false; + + + // vars + $terms = array(); + + + // loop + foreach( $strings as $string ) { + + // vars + $data = acf_decode_taxonomy_term( $string ); + $taxonomy = $data['taxonomy']; + $term = $data['term']; + + + // create empty array + if( !isset($terms[ $taxonomy ]) ) { + + $terms[ $taxonomy ] = array(); + + } + + + // append + $terms[ $taxonomy ][] = $term; + + } + + + // return + return $terms; + +} + + +/* +* acf_decode_taxonomy_term +* +* This function will return the taxonomy and term slug for a given value +* +* @type function +* @date 31/03/2014 +* @since 5.0.0 +* +* @param $string (string) +* @return (array) +*/ + +function acf_decode_taxonomy_term( $value ) { + + // vars + $data = array( + 'taxonomy' => '', + 'term' => '' + ); + + + // int + if( is_numeric($value) ) { + + $data['term'] = $value; + + // string + } elseif( is_string($value) ) { + + $value = explode(':', $value); + $data['taxonomy'] = isset($value[0]) ? $value[0] : ''; + $data['term'] = isset($value[1]) ? $value[1] : ''; + + // error + } else { + + return false; + + } + + + // allow for term_id (Used by ACF v4) + if( is_numeric($data['term']) ) { + + // global + global $wpdb; + + + // find taxonomy + if( !$data['taxonomy'] ) { + + $data['taxonomy'] = $wpdb->get_var( $wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $data['term']) ); + + } + + + // find term (may have numeric slug '123') + $term = get_term_by( 'slug', $data['term'], $data['taxonomy'] ); + + + // attempt get term via ID (ACF4 uses ID) + if( !$term ) $term = get_term( $data['term'], $data['taxonomy'] ); + + + // bail early if no term + if( !$term ) return false; + + + // update + $data['taxonomy'] = $term->taxonomy; + $data['term'] = $term->slug; + + } + + + // return + return $data; + +} + +/** + * acf_array + * + * Casts the value into an array. + * + * @date 9/1/19 + * @since 5.7.10 + * + * @param mixed $val The value to cast. + * @return array + */ +function acf_array( $val = array() ) { + return (array) $val; +} + +/* +* acf_get_array +* +* This function will force a variable to become an array +* +* @type function +* @date 4/02/2014 +* @since 5.0.0 +* +* @param $var (mixed) +* @return (array) +*/ + +function acf_get_array( $var = false, $delimiter = '' ) { + + // array + if( is_array($var) ) { + return $var; + } + + + // bail early if empty + if( acf_is_empty($var) ) { + return array(); + } + + + // string + if( is_string($var) && $delimiter ) { + return explode($delimiter, $var); + } + + + // place in array + return (array) $var; + +} + + +/* +* acf_get_numeric +* +* This function will return numeric values +* +* @type function +* @date 15/07/2016 +* @since 5.4.0 +* +* @param $value (mixed) +* @return (mixed) +*/ + +function acf_get_numeric( $value = '' ) { + + // vars + $numbers = array(); + $is_array = is_array($value); + + + // loop + foreach( (array) $value as $v ) { + + if( is_numeric($v) ) $numbers[] = (int) $v; + + } + + + // bail early if is empty + if( empty($numbers) ) return false; + + + // convert array + if( !$is_array ) $numbers = $numbers[0]; + + + // return + return $numbers; + +} + + +/** + * acf_get_posts + * + * Similar to the get_posts() function but with extra functionality. + * + * @date 3/03/15 + * @since 5.1.5 + * + * @param array $args The query args. + * @return array + */ +function acf_get_posts( $args = array() ) { + + // Vars. + $posts = array(); + + // Apply default args. + $args = wp_parse_args($args, array( + 'posts_per_page' => -1, + 'post_type' => '', + 'post_status' => 'any', + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false + )); + + // Avoid default 'post' post_type by providing all public types. + if( !$args['post_type'] ) { + $args['post_type'] = acf_get_post_types(); + } + + // Check if specifc post ID's have been provided. + if( $args['post__in'] ) { + + // Clean value into an array of IDs. + $args['post__in'] = array_map('intval', acf_array($args['post__in'])); + } + + // Query posts. + $posts = get_posts( $args ); + + // Remove any potential empty results. + $posts = array_filter( $posts ); + + // Manually order results. + if( $posts && $args['post__in'] ) { + $order = array(); + foreach( $posts as $i => $post ) { + $order[ $i ] = array_search( $post->ID, $args['post__in'] ); + } + array_multisort($order, $posts); + } + + // Return posts. + return $posts; +} + + +/* +* _acf_query_remove_post_type +* +* This function will remove the 'wp_posts.post_type' WHERE clause completely +* When using 'post__in', this clause is unneccessary and slow. +* +* @type function +* @date 4/03/2015 +* @since 5.1.5 +* +* @param $sql (string) +* @return $sql +*/ + +function _acf_query_remove_post_type( $sql ) { + + // global + global $wpdb; + + + // bail ealry if no 'wp_posts.ID IN' + if( strpos($sql, "$wpdb->posts.ID IN") === false ) { + + return $sql; + + } + + + // get bits + $glue = 'AND'; + $bits = explode($glue, $sql); + + + // loop through $where and remove any post_type queries + foreach( $bits as $i => $bit ) { + + if( strpos($bit, "$wpdb->posts.post_type") !== false ) { + + unset( $bits[ $i ] ); + + } + + } + + + // join $where back together + $sql = implode($glue, $bits); + + + // return + return $sql; + +} + + +/* +* acf_get_grouped_posts +* +* This function will return all posts grouped by post_type +* This is handy for select settings +* +* @type function +* @date 27/02/2014 +* @since 5.0.0 +* +* @param $args (array) +* @return (array) +*/ + +function acf_get_grouped_posts( $args ) { + + // vars + $data = array(); + + + // defaults + $args = wp_parse_args( $args, array( + 'posts_per_page' => -1, + 'paged' => 0, + 'post_type' => 'post', + 'orderby' => 'menu_order title', + 'order' => 'ASC', + 'post_status' => 'any', + 'suppress_filters' => false, + 'update_post_meta_cache' => false, + )); + + + // find array of post_type + $post_types = acf_get_array( $args['post_type'] ); + $post_types_labels = acf_get_pretty_post_types($post_types); + $is_single_post_type = ( count($post_types) == 1 ); + + + // attachment doesn't work if it is the only item in an array + if( $is_single_post_type ) { + $args['post_type'] = reset($post_types); + } + + + // add filter to orderby post type + if( !$is_single_post_type ) { + add_filter('posts_orderby', '_acf_orderby_post_type', 10, 2); + } + + + // get posts + $posts = get_posts( $args ); + + + // remove this filter (only once) + if( !$is_single_post_type ) { + remove_filter('posts_orderby', '_acf_orderby_post_type', 10, 2); + } + + + // loop + foreach( $post_types as $post_type ) { + + // vars + $this_posts = array(); + $this_group = array(); + + + // populate $this_posts + foreach( $posts as $post ) { + if( $post->post_type == $post_type ) { + $this_posts[] = $post; + } + } + + + // bail early if no posts for this post type + if( empty($this_posts) ) continue; + + + // sort into hierachial order! + // this will fail if a search has taken place because parents wont exist + if( is_post_type_hierarchical($post_type) && empty($args['s'])) { + + // vars + $post_id = $this_posts[0]->ID; + $parent_id = acf_maybe_get($args, 'post_parent', 0); + $offset = 0; + $length = count($this_posts); + + + // get all posts from this post type + $all_posts = get_posts(array_merge($args, array( + 'posts_per_page' => -1, + 'paged' => 0, + 'post_type' => $post_type + ))); + + + // find starting point (offset) + foreach( $all_posts as $i => $post ) { + if( $post->ID == $post_id ) { + $offset = $i; + break; + } + } + + + // order posts + $ordered_posts = get_page_children($parent_id, $all_posts); + + + // compare aray lengths + // if $ordered_posts is smaller than $all_posts, WP has lost posts during the get_page_children() function + // this is possible when get_post( $args ) filter out parents (via taxonomy, meta and other search parameters) + if( count($ordered_posts) == count($all_posts) ) { + $this_posts = array_slice($ordered_posts, $offset, $length); + } + + } + + + // populate $this_posts + foreach( $this_posts as $post ) { + $this_group[ $post->ID ] = $post; + } + + + // group by post type + $label = $post_types_labels[ $post_type ]; + $data[ $label ] = $this_group; + + } + + + // return + return $data; + +} + + +function _acf_orderby_post_type( $ordeby, $wp_query ) { + + // global + global $wpdb; + + + // get post types + $post_types = $wp_query->get('post_type'); + + + // prepend SQL + if( is_array($post_types) ) { + + $post_types = implode("','", $post_types); + $ordeby = "FIELD({$wpdb->posts}.post_type,'$post_types')," . $ordeby; + + } + + + // return + return $ordeby; + +} + + +function acf_get_post_title( $post = 0, $is_search = false ) { + + // vars + $post = get_post($post); + $title = ''; + $prepend = ''; + $append = ''; + + + // bail early if no post + if( !$post ) return ''; + + + // title + $title = get_the_title( $post->ID ); + + + // empty + if( $title === '' ) { + + $title = __('(no title)', 'acf'); + + } + + + // status + if( get_post_status( $post->ID ) != "publish" ) { + + $append .= ' (' . get_post_status( $post->ID ) . ')'; + + } + + + // ancestors + if( $post->post_type !== 'attachment' ) { + + // get ancestors + $ancestors = get_ancestors( $post->ID, $post->post_type ); + $prepend .= str_repeat('- ', count($ancestors)); + + + // add parent +/* + removed in 5.6.5 as not used by the UI + if( $is_search && !empty($ancestors) ) { + + // reverse + $ancestors = array_reverse($ancestors); + + + // convert id's into titles + foreach( $ancestors as $i => $id ) { + + $ancestors[ $i ] = get_the_title( $id ); + + } + + + // append + $append .= ' | ' . __('Parent', 'acf') . ': ' . implode(' / ', $ancestors); + + } +*/ + + } + + + // merge + $title = $prepend . $title . $append; + + + // return + return $title; + +} + + +function acf_order_by_search( $array, $search ) { + + // vars + $weights = array(); + $needle = strtolower( $search ); + + + // add key prefix + foreach( array_keys($array) as $k ) { + + $array[ '_' . $k ] = acf_extract_var( $array, $k ); + + } + + + // add search weight + foreach( $array as $k => $v ) { + + // vars + $weight = 0; + $haystack = strtolower( $v ); + $strpos = strpos( $haystack, $needle ); + + + // detect search match + if( $strpos !== false ) { + + // set eright to length of match + $weight = strlen( $search ); + + + // increase weight if match starts at begining of string + if( $strpos == 0 ) { + + $weight++; + + } + + } + + + // append to wights + $weights[ $k ] = $weight; + + } + + + // sort the array with menu_order ascending + array_multisort( $weights, SORT_DESC, $array ); + + + // remove key prefix + foreach( array_keys($array) as $k ) { + + $array[ substr($k,1) ] = acf_extract_var( $array, $k ); + + } + + + // return + return $array; +} + + +/* +* acf_get_pretty_user_roles +* +* description +* +* @type function +* @date 23/02/2016 +* @since 5.3.2 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_get_pretty_user_roles( $allowed = false ) { + + // vars + $editable_roles = get_editable_roles(); + $allowed = acf_get_array($allowed); + $roles = array(); + + + // loop + foreach( $editable_roles as $role_name => $role_details ) { + + // bail early if not allowed + if( !empty($allowed) && !in_array($role_name, $allowed) ) continue; + + + // append + $roles[ $role_name ] = translate_user_role( $role_details['name'] ); + + } + + + // return + return $roles; + +} + + +/* +* acf_get_grouped_users +* +* This function will return all users grouped by role +* This is handy for select settings +* +* @type function +* @date 27/02/2014 +* @since 5.0.0 +* +* @param $args (array) +* @return (array) +*/ + +function acf_get_grouped_users( $args = array() ) { + + // vars + $r = array(); + + + // defaults + $args = wp_parse_args( $args, array( + 'users_per_page' => -1, + 'paged' => 0, + 'role' => '', + 'orderby' => 'login', + 'order' => 'ASC', + )); + + + // offset + $i = 0; + $min = 0; + $max = 0; + $users_per_page = acf_extract_var($args, 'users_per_page'); + $paged = acf_extract_var($args, 'paged'); + + if( $users_per_page > 0 ) { + + // prevent paged from being -1 + $paged = max(0, $paged); + + + // set min / max + $min = (($paged-1) * $users_per_page) + 1; // 1, 11 + $max = ($paged * $users_per_page); // 10, 20 + + } + + + // find array of post_type + $user_roles = acf_get_pretty_user_roles($args['role']); + + + // fix role + if( is_array($args['role']) ) { + + // global + global $wp_version, $wpdb; + + + // vars + $roles = acf_extract_var($args, 'role'); + + + // new WP has role__in + if( version_compare($wp_version, '4.4', '>=' ) ) { + + $args['role__in'] = $roles; + + // old WP doesn't have role__in + } else { + + // vars + $blog_id = get_current_blog_id(); + $meta_query = array( 'relation' => 'OR' ); + + + // loop + foreach( $roles as $role ) { + + $meta_query[] = array( + 'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities', + 'value' => '"' . $role . '"', + 'compare' => 'LIKE', + ); + + } + + + // append + $args['meta_query'] = $meta_query; + + } + + } + + + // get posts + $users = get_users( $args ); + + + // loop + foreach( $user_roles as $user_role_name => $user_role_label ) { + + // vars + $this_users = array(); + $this_group = array(); + + + // populate $this_posts + foreach( array_keys($users) as $key ) { + + // bail ealry if not correct role + if( !in_array($user_role_name, $users[ $key ]->roles) ) continue; + + + // extract user + $user = acf_extract_var( $users, $key ); + + + // increase + $i++; + + + // bail ealry if too low + if( $min && $i < $min ) continue; + + + // bail early if too high (don't bother looking at any more users) + if( $max && $i > $max ) break; + + + // group by post type + $this_users[ $user->ID ] = $user; + + + } + + + // bail early if no posts for this post type + if( empty($this_users) ) continue; + + + // append + $r[ $user_role_label ] = $this_users; + + } + + + // return + return $r; + +} + +/** + * acf_json_encode + * + * Returns json_encode() ready for file / database use. + * + * @date 29/4/19 + * @since 5.0.0 + * + * @param array $json The array of data to encode. + * @return string + */ +function acf_json_encode( $json ) { + return json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); +} + + +/* +* acf_str_exists +* +* This function will return true if a sub string is found +* +* @type function +* @date 1/05/2014 +* @since 5.0.0 +* +* @param $needle (string) +* @param $haystack (string) +* @return (boolean) +*/ + +function acf_str_exists( $needle, $haystack ) { + + // return true if $haystack contains the $needle + if( is_string($haystack) && strpos($haystack, $needle) !== false ) { + + return true; + + } + + + // return + return false; +} + + +/* +* acf_debug +* +* description +* +* @type function +* @date 2/05/2014 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_debug() { + + // vars + $args = func_get_args(); + $s = array_shift($args); + $o = ''; + $nl = "\r\n"; + + + // start script + $o .= '' . $nl; + + + // echo + echo $o; +} + +function acf_debug_start() { + + acf_update_setting( 'debug_start', memory_get_usage()); + +} + +function acf_debug_end() { + + $start = acf_get_setting( 'debug_start' ); + $end = memory_get_usage(); + + return $end - $start; + +} + + +/* +* acf_encode_choices +* +* description +* +* @type function +* @date 4/06/2014 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_encode_choices( $array = array(), $show_keys = true ) { + + // bail early if not array (maybe a single string) + if( !is_array($array) ) return $array; + + + // bail early if empty array + if( empty($array) ) return ''; + + + // vars + $string = ''; + + + // if allowed to show keys (good for choices, not for default values) + if( $show_keys ) { + + // loop + foreach( $array as $k => $v ) { + + // ignore if key and value are the same + if( strval($k) == strval($v) ) continue; + + + // show key in the value + $array[ $k ] = $k . ' : ' . $v; + + } + + } + + + // implode + $string = implode("\n", $array); + + + // return + return $string; + +} + +function acf_decode_choices( $string = '', $array_keys = false ) { + + // bail early if already array + if( is_array($string) ) { + + return $string; + + // allow numeric values (same as string) + } elseif( is_numeric($string) ) { + + // do nothing + + // bail early if not a string + } elseif( !is_string($string) ) { + + return array(); + + // bail early if is empty string + } elseif( $string === '' ) { + + return array(); + + } + + + // vars + $array = array(); + + + // explode + $lines = explode("\n", $string); + + + // key => value + foreach( $lines as $line ) { + + // vars + $k = trim($line); + $v = trim($line); + + + // look for ' : ' + if( acf_str_exists(' : ', $line) ) { + + $line = explode(' : ', $line); + + $k = trim($line[0]); + $v = trim($line[1]); + + } + + + // append + $array[ $k ] = $v; + + } + + + // return only array keys? (good for checkbox default_value) + if( $array_keys ) { + + return array_keys($array); + + } + + + // return + return $array; + +} + + +/* +* acf_str_replace +* +* This function will replace an array of strings much like str_replace +* The difference is the extra logic to avoid replacing a string that has alread been replaced +* This is very useful for replacing date characters as they overlap with eachother +* +* @type function +* @date 21/06/2016 +* @since 5.3.8 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_str_replace( $string = '', $search_replace = array() ) { + + // vars + $ignore = array(); + + + // remove potential empty search to avoid PHP error + unset($search_replace['']); + + + // loop over conversions + foreach( $search_replace as $search => $replace ) { + + // ignore this search, it was a previous replace + if( in_array($search, $ignore) ) continue; + + + // bail early if subsctring not found + if( strpos($string, $search) === false ) continue; + + + // replace + $string = str_replace($search, $replace, $string); + + + // append to ignore + $ignore[] = $replace; + + } + + + // return + return $string; + +} + + +/* +* date & time formats +* +* These settings contain an association of format strings from PHP => JS +* +* @type function +* @date 21/06/2016 +* @since 5.3.8 +* +* @param n/a +* @return n/a +*/ + +acf_update_setting('php_to_js_date_formats', array( + + // Year + 'Y' => 'yy', // Numeric, 4 digits 1999, 2003 + 'y' => 'y', // Numeric, 2 digits 99, 03 + + + // Month + 'm' => 'mm', // Numeric, with leading zeros 01–12 + 'n' => 'm', // Numeric, without leading zeros 1–12 + 'F' => 'MM', // Textual full January – December + 'M' => 'M', // Textual three letters Jan - Dec + + + // Weekday + 'l' => 'DD', // Full name (lowercase 'L') Sunday – Saturday + 'D' => 'D', // Three letter name Mon – Sun + + + // Day of Month + 'd' => 'dd', // Numeric, with leading zeros 01–31 + 'j' => 'd', // Numeric, without leading zeros 1–31 + 'S' => '', // The English suffix for the day of the month st, nd or th in the 1st, 2nd or 15th. + +)); + +acf_update_setting('php_to_js_time_formats', array( + + 'a' => 'tt', // Lowercase Ante meridiem and Post meridiem am or pm + 'A' => 'TT', // Uppercase Ante meridiem and Post meridiem AM or PM + 'h' => 'hh', // 12-hour format of an hour with leading zeros 01 through 12 + 'g' => 'h', // 12-hour format of an hour without leading zeros 1 through 12 + 'H' => 'HH', // 24-hour format of an hour with leading zeros 00 through 23 + 'G' => 'H', // 24-hour format of an hour without leading zeros 0 through 23 + 'i' => 'mm', // Minutes with leading zeros 00 to 59 + 's' => 'ss', // Seconds, with leading zeros 00 through 59 + +)); + + +/* +* acf_split_date_time +* +* This function will split a format string into seperate date and time +* +* @type function +* @date 26/05/2016 +* @since 5.3.8 +* +* @param $date_time (string) +* @return $formats (array) +*/ + +function acf_split_date_time( $date_time = '' ) { + + // vars + $php_date = acf_get_setting('php_to_js_date_formats'); + $php_time = acf_get_setting('php_to_js_time_formats'); + $chars = str_split($date_time); + $type = 'date'; + + + // default + $data = array( + 'date' => '', + 'time' => '' + ); + + + // loop + foreach( $chars as $i => $c ) { + + // find type + // - allow misc characters to append to previous type + if( isset($php_date[ $c ]) ) { + + $type = 'date'; + + } elseif( isset($php_time[ $c ]) ) { + + $type = 'time'; + + } + + + // append char + $data[ $type ] .= $c; + + } + + + // trim + $data['date'] = trim($data['date']); + $data['time'] = trim($data['time']); + + + // return + return $data; + +} + + +/* +* acf_convert_date_to_php +* +* This fucntion converts a date format string from JS to PHP +* +* @type function +* @date 20/06/2014 +* @since 5.0.0 +* +* @param $date (string) +* @return (string) +*/ + +function acf_convert_date_to_php( $date = '' ) { + + // vars + $php_to_js = acf_get_setting('php_to_js_date_formats'); + $js_to_php = array_flip($php_to_js); + + + // return + return acf_str_replace( $date, $js_to_php ); + +} + +/* +* acf_convert_date_to_js +* +* This fucntion converts a date format string from PHP to JS +* +* @type function +* @date 20/06/2014 +* @since 5.0.0 +* +* @param $date (string) +* @return (string) +*/ + +function acf_convert_date_to_js( $date = '' ) { + + // vars + $php_to_js = acf_get_setting('php_to_js_date_formats'); + + + // return + return acf_str_replace( $date, $php_to_js ); + +} + + +/* +* acf_convert_time_to_php +* +* This fucntion converts a time format string from JS to PHP +* +* @type function +* @date 20/06/2014 +* @since 5.0.0 +* +* @param $time (string) +* @return (string) +*/ + +function acf_convert_time_to_php( $time = '' ) { + + // vars + $php_to_js = acf_get_setting('php_to_js_time_formats'); + $js_to_php = array_flip($php_to_js); + + + // return + return acf_str_replace( $time, $js_to_php ); + +} + + +/* +* acf_convert_time_to_js +* +* This fucntion converts a date format string from PHP to JS +* +* @type function +* @date 20/06/2014 +* @since 5.0.0 +* +* @param $time (string) +* @return (string) +*/ + +function acf_convert_time_to_js( $time = '' ) { + + // vars + $php_to_js = acf_get_setting('php_to_js_time_formats'); + + + // return + return acf_str_replace( $time, $php_to_js ); + +} + + +/* +* acf_update_user_setting +* +* description +* +* @type function +* @date 15/07/2014 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_update_user_setting( $name, $value ) { + + // get current user id + $user_id = get_current_user_id(); + + + // get user settings + $settings = get_user_meta( $user_id, 'acf_user_settings', true ); + + + // ensure array + $settings = acf_get_array($settings); + + + // delete setting (allow 0 to save) + if( acf_is_empty($value) ) { + + unset($settings[ $name ]); + + // append setting + } else { + + $settings[ $name ] = $value; + + } + + + // update user data + return update_metadata('user', $user_id, 'acf_user_settings', $settings); + +} + + +/* +* acf_get_user_setting +* +* description +* +* @type function +* @date 15/07/2014 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_get_user_setting( $name = '', $default = false ) { + + // get current user id + $user_id = get_current_user_id(); + + + // get user settings + $settings = get_user_meta( $user_id, 'acf_user_settings', true ); + + + // ensure array + $settings = acf_get_array($settings); + + + // bail arly if no settings + if( !isset($settings[$name]) ) return $default; + + + // return + return $settings[$name]; + +} + + +/* +* acf_in_array +* +* description +* +* @type function +* @date 22/07/2014 +* @since 5.0.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_in_array( $value = '', $array = false ) { + + // bail early if not array + if( !is_array($array) ) return false; + + + // find value in array + return in_array($value, $array); + +} + + +/* +* acf_get_valid_post_id +* +* This function will return a valid post_id based on the current screen / parameter +* +* @type function +* @date 8/12/2013 +* @since 5.0.0 +* +* @param $post_id (mixed) +* @return $post_id (mixed) +*/ + +function acf_get_valid_post_id( $post_id = 0 ) { + + // allow filter to short-circuit load_value logic + $preload = apply_filters( "acf/pre_load_post_id", null, $post_id ); + if( $preload !== null ) { + return $preload; + } + + // vars + $_post_id = $post_id; + + + // if not $post_id, load queried object + if( !$post_id ) { + + // try for global post (needed for setup_postdata) + $post_id = (int) get_the_ID(); + + + // try for current screen + if( !$post_id ) { + + $post_id = get_queried_object(); + + } + + } + + + // $post_id may be an object + if( is_object($post_id) ) { + + // post + if( isset($post_id->post_type, $post_id->ID) ) { + + $post_id = $post_id->ID; + + // user + } elseif( isset($post_id->roles, $post_id->ID) ) { + + $post_id = 'user_' . $post_id->ID; + + // term + } elseif( isset($post_id->taxonomy, $post_id->term_id) ) { + + $post_id = acf_get_term_post_id( $post_id->taxonomy, $post_id->term_id ); + + // comment + } elseif( isset($post_id->comment_ID) ) { + + $post_id = 'comment_' . $post_id->comment_ID; + + // default + } else { + + $post_id = 0; + + } + + } + + + // allow for option == options + if( $post_id === 'option' ) { + + $post_id = 'options'; + + } + + + // append language code + if( $post_id == 'options' ) { + + $dl = acf_get_setting('default_language'); + $cl = acf_get_setting('current_language'); + + if( $cl && $cl !== $dl ) { + + $post_id .= '_' . $cl; + + } + + } + + + + // filter for 3rd party + $post_id = apply_filters('acf/validate_post_id', $post_id, $_post_id); + + + // return + return $post_id; + +} + + + +/* +* acf_get_post_id_info +* +* This function will return the type and id for a given $post_id string +* +* @type function +* @date 2/07/2016 +* @since 5.4.0 +* +* @param $post_id (mixed) +* @return $info (array) +*/ + +function acf_get_post_id_info( $post_id = 0 ) { + + // vars + $info = array( + 'type' => 'post', + 'id' => 0 + ); + + // bail early if no $post_id + if( !$post_id ) return $info; + + + // check cache + // - this function will most likely be called multiple times (saving loading fields from post) + //$cache_key = "get_post_id_info/post_id={$post_id}"; + + //if( acf_isset_cache($cache_key) ) return acf_get_cache($cache_key); + + + // numeric + if( is_numeric($post_id) ) { + + $info['id'] = (int) $post_id; + + // string + } elseif( is_string($post_id) ) { + + // vars + $glue = '_'; + $type = explode($glue, $post_id); + $id = array_pop($type); + $type = implode($glue, $type); + $meta = array('post', 'user', 'comment', 'term'); + + + // check if is taxonomy (ACF < 5.5) + // - avoid scenario where taxonomy exists with name of meta type + if( !in_array($type, $meta) && acf_isset_termmeta($type) ) $type = 'term'; + + + // meta + if( is_numeric($id) && in_array($type, $meta) ) { + + $info['type'] = $type; + $info['id'] = (int) $id; + + // option + } else { + + $info['type'] = 'option'; + $info['id'] = $post_id; + + } + + } + + + // update cache + //acf_set_cache($cache_key, $info); + + + // filter + $info = apply_filters("acf/get_post_id_info", $info, $post_id); + + // return + return $info; + +} + + +/* + +acf_log( acf_get_post_id_info(4) ); + +acf_log( acf_get_post_id_info('post_4') ); + +acf_log( acf_get_post_id_info('user_123') ); + +acf_log( acf_get_post_id_info('term_567') ); + +acf_log( acf_get_post_id_info('category_204') ); + +acf_log( acf_get_post_id_info('comment_6') ); + +acf_log( acf_get_post_id_info('options_lol!') ); + +acf_log( acf_get_post_id_info('option') ); + +acf_log( acf_get_post_id_info('options') ); + +*/ + + +/* +* acf_isset_termmeta +* +* This function will return true if the termmeta table exists +* https://developer.wordpress.org/reference/functions/get_term_meta/ +* +* @type function +* @date 3/09/2016 +* @since 5.4.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_isset_termmeta( $taxonomy = '' ) { + + // bail ealry if no table + if( get_option('db_version') < 34370 ) return false; + + + // check taxonomy + if( $taxonomy && !taxonomy_exists($taxonomy) ) return false; + + + // return + return true; + +} + + +/* +* acf_get_term_post_id +* +* This function will return a valid post_id string for a given term and taxonomy +* +* @type function +* @date 6/2/17 +* @since 5.5.6 +* +* @param $taxonomy (string) +* @param $term_id (int) +* @return (string) +*/ + +function acf_get_term_post_id( $taxonomy, $term_id ) { + + // WP < 4.4 + if( !acf_isset_termmeta() ) { + + return $taxonomy . '_' . $term_id; + + } + + + // return + return 'term_' . $term_id; + +} + + +/* +* acf_upload_files +* +* This function will walk througfh the $_FILES data and upload each found +* +* @type function +* @date 25/10/2014 +* @since 5.0.9 +* +* @param $ancestors (array) an internal parameter, not required +* @return n/a +*/ + +function acf_upload_files( $ancestors = array() ) { + + // vars + $file = array( + 'name' => '', + 'type' => '', + 'tmp_name' => '', + 'error' => '', + 'size' => '' + ); + + + // populate with $_FILES data + foreach( array_keys($file) as $k ) { + + $file[ $k ] = $_FILES['acf'][ $k ]; + + } + + + // walk through ancestors + if( !empty($ancestors) ) { + + foreach( $ancestors as $a ) { + + foreach( array_keys($file) as $k ) { + + $file[ $k ] = $file[ $k ][ $a ]; + + } + + } + + } + + + // is array? + if( is_array($file['name']) ) { + + foreach( array_keys($file['name']) as $k ) { + + $_ancestors = array_merge($ancestors, array($k)); + + acf_upload_files( $_ancestors ); + + } + + return; + + } + + + // bail ealry if file has error (no file uploaded) + if( $file['error'] ) { + + return; + + } + + + // assign global _acfuploader for media validation + $_POST['_acfuploader'] = end($ancestors); + + + // file found! + $attachment_id = acf_upload_file( $file ); + + + // update $_POST + array_unshift($ancestors, 'acf'); + acf_update_nested_array( $_POST, $ancestors, $attachment_id ); + +} + + +/* +* acf_upload_file +* +* This function will uploade a $_FILE +* +* @type function +* @date 27/10/2014 +* @since 5.0.9 +* +* @param $uploaded_file (array) array found from $_FILE data +* @return $id (int) new attachment ID +*/ + +function acf_upload_file( $uploaded_file ) { + + // required + //require_once( ABSPATH . "/wp-load.php" ); // WP should already be loaded + require_once( ABSPATH . "/wp-admin/includes/media.php" ); // video functions + require_once( ABSPATH . "/wp-admin/includes/file.php" ); + require_once( ABSPATH . "/wp-admin/includes/image.php" ); + + + // required for wp_handle_upload() to upload the file + $upload_overrides = array( 'test_form' => false ); + + + // upload + $file = wp_handle_upload( $uploaded_file, $upload_overrides ); + + + // bail ealry if upload failed + if( isset($file['error']) ) { + + return $file['error']; + + } + + + // vars + $url = $file['url']; + $type = $file['type']; + $file = $file['file']; + $filename = basename($file); + + + // Construct the object array + $object = array( + 'post_title' => $filename, + 'post_mime_type' => $type, + 'guid' => $url + ); + + // Save the data + $id = wp_insert_attachment($object, $file); + + // Add the meta-data + wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); + + /** This action is documented in wp-admin/custom-header.php */ + do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication + + // return new ID + return $id; + +} + + +/* +* acf_update_nested_array +* +* This function will update a nested array value. Useful for modifying the $_POST array +* +* @type function +* @date 27/10/2014 +* @since 5.0.9 +* +* @param $array (array) target array to be updated +* @param $ancestors (array) array of keys to navigate through to find the child +* @param $value (mixed) The new value +* @return (boolean) +*/ + +function acf_update_nested_array( &$array, $ancestors, $value ) { + + // if no more ancestors, update the current var + if( empty($ancestors) ) { + + $array = $value; + + // return + return true; + + } + + + // shift the next ancestor from the array + $k = array_shift( $ancestors ); + + + // if exists + if( isset($array[ $k ]) ) { + + return acf_update_nested_array( $array[ $k ], $ancestors, $value ); + + } + + + // return + return false; +} + + +/* +* acf_is_screen +* +* This function will return true if all args are matched for the current screen +* +* @type function +* @date 9/12/2014 +* @since 5.1.5 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_is_screen( $id = '' ) { + + // bail early if not defined + if( !function_exists('get_current_screen') ) { + return false; + } + + // vars + $current_screen = get_current_screen(); + + // no screen + if( !$current_screen ) { + return false; + + // array + } elseif( is_array($id) ) { + return in_array($current_screen->id, $id); + + // string + } else { + return ($id === $current_screen->id); + } +} + + +/* +* acf_maybe_get +* +* This function will return a var if it exists in an array +* +* @type function +* @date 9/12/2014 +* @since 5.1.5 +* +* @param $array (array) the array to look within +* @param $key (key) the array key to look for. Nested values may be found using '/' +* @param $default (mixed) the value returned if not found +* @return $post_id (int) +*/ + +function acf_maybe_get( $array = array(), $key = 0, $default = null ) { + + return isset( $array[$key] ) ? $array[$key] : $default; + +} + +function acf_maybe_get_POST( $key = '', $default = null ) { + + return isset( $_POST[$key] ) ? $_POST[$key] : $default; + +} + +function acf_maybe_get_GET( $key = '', $default = null ) { + + return isset( $_GET[$key] ) ? $_GET[$key] : $default; + +} + + +/* +* acf_get_attachment +* +* This function will return an array of attachment data +* +* @type function +* @date 5/01/2015 +* @since 5.1.5 +* +* @param $post (mixed) either post ID or post object +* @return (array) +*/ + +function acf_get_attachment( $attachment ) { + + // get post + if( !$attachment = get_post($attachment) ) { + return false; + } + + // validate post_type + if( $attachment->post_type !== 'attachment' ) { + return false; + } + + // vars + $sizes_id = 0; + $meta = wp_get_attachment_metadata( $attachment->ID ); + $attached_file = get_attached_file( $attachment->ID ); + $attachment_url = wp_get_attachment_url( $attachment->ID ); + + // get mime types + if( strpos( $attachment->post_mime_type, '/' ) !== false ) { + list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); + } else { + list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); + } + + // vars + $response = array( + 'ID' => $attachment->ID, + 'id' => $attachment->ID, + 'title' => $attachment->post_title, + 'filename' => wp_basename( $attached_file ), + 'filesize' => 0, + 'url' => $attachment_url, + 'link' => get_attachment_link( $attachment->ID ), + 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), + 'author' => $attachment->post_author, + 'description' => $attachment->post_content, + 'caption' => $attachment->post_excerpt, + 'name' => $attachment->post_name, + 'status' => $attachment->post_status, + 'uploaded_to' => $attachment->post_parent, + 'date' => $attachment->post_date_gmt, + 'modified' => $attachment->post_modified_gmt, + 'menu_order' => $attachment->menu_order, + 'mime_type' => $attachment->post_mime_type, + 'type' => $type, + 'subtype' => $subtype, + 'icon' => wp_mime_type_icon( $attachment->ID ) + ); + + // filesize + if( isset($meta['filesize']) ) { + $response['filesize'] = $meta['filesize']; + } elseif( file_exists($attached_file) ) { + $response['filesize'] = filesize( $attached_file ); + } + + // image + if( $type === 'image' ) { + + $sizes_id = $attachment->ID; + $src = wp_get_attachment_image_src( $attachment->ID, 'full' ); + + $response['url'] = $src[0]; + $response['width'] = $src[1]; + $response['height'] = $src[2]; + + // video + } elseif( $type === 'video' ) { + + // dimentions + $response['width'] = acf_maybe_get($meta, 'width', 0); + $response['height'] = acf_maybe_get($meta, 'height', 0); + + // featured image + if( $featured_id = get_post_thumbnail_id($attachment->ID) ) { + $sizes_id = $featured_id; + } + + // audio + } elseif( $type === 'audio' ) { + + // featured image + if( $featured_id = get_post_thumbnail_id($attachment->ID) ) { + $sizes_id = $featured_id; + } + } + + + // sizes + if( $sizes_id ) { + + // vars + $sizes = get_intermediate_image_sizes(); + $data = array(); + + // loop + foreach( $sizes as $size ) { + $src = wp_get_attachment_image_src( $sizes_id, $size ); + $data[ $size ] = $src[0]; + $data[ $size . '-width' ] = $src[1]; + $data[ $size . '-height' ] = $src[2]; + } + + // append + $response['sizes'] = $data; + } + + // return + return $response; + +} + + +/* +* acf_get_truncated +* +* This function will truncate and return a string +* +* @type function +* @date 8/08/2014 +* @since 5.0.0 +* +* @param $text (string) +* @param $length (int) +* @return (string) +*/ + +function acf_get_truncated( $text, $length = 64 ) { + + // vars + $text = trim($text); + $the_length = strlen( $text ); + + + // cut + $return = substr( $text, 0, ($length - 3) ); + + + // ... + if( $the_length > ($length - 3) ) { + + $return .= '...'; + + } + + + // return + return $return; + +} + + +/* +* acf_get_current_url +* +* This function will return the current URL. +* +* @date 23/01/2015 +* @since 5.1.5 +* +* @param void +* @return string +*/ + +function acf_get_current_url() { + return ( is_ssl() ? 'https' : 'http' ) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; +} + +/* +* acf_current_user_can_admin +* +* This function will return true if the current user can administrate the ACF field groups +* +* @type function +* @date 9/02/2015 +* @since 5.1.5 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_current_user_can_admin() { + + if( acf_get_setting('show_admin') && current_user_can(acf_get_setting('capability')) ) { + + return true; + + } + + + // return + return false; + +} + + +/* +* acf_get_filesize +* +* This function will return a numeric value of bytes for a given filesize string +* +* @type function +* @date 18/02/2015 +* @since 5.1.5 +* +* @param $size (mixed) +* @return (int) +*/ + +function acf_get_filesize( $size = 1 ) { + + // vars + $unit = 'MB'; + $units = array( + 'TB' => 4, + 'GB' => 3, + 'MB' => 2, + 'KB' => 1, + ); + + + // look for $unit within the $size parameter (123 KB) + if( is_string($size) ) { + + // vars + $custom = strtoupper( substr($size, -2) ); + + foreach( $units as $k => $v ) { + + if( $custom === $k ) { + + $unit = $k; + $size = substr($size, 0, -2); + + } + + } + + } + + + // calc bytes + $bytes = floatval($size) * pow(1024, $units[$unit]); + + + // return + return $bytes; + +} + + +/* +* acf_format_filesize +* +* This function will return a formatted string containing the filesize and unit +* +* @type function +* @date 18/02/2015 +* @since 5.1.5 +* +* @param $size (mixed) +* @return (int) +*/ + +function acf_format_filesize( $size = 1 ) { + + // convert + $bytes = acf_get_filesize( $size ); + + + // vars + $units = array( + 'TB' => 4, + 'GB' => 3, + 'MB' => 2, + 'KB' => 1, + ); + + + // loop through units + foreach( $units as $k => $v ) { + + $result = $bytes / pow(1024, $v); + + if( $result >= 1 ) { + + return $result . ' ' . $k; + + } + + } + + + // return + return $bytes . ' B'; + +} + + +/* +* acf_get_valid_terms +* +* This function will replace old terms with new split term ids +* +* @type function +* @date 27/02/2015 +* @since 5.1.5 +* +* @param $terms (int|array) +* @param $taxonomy (string) +* @return $terms +*/ + +function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) { + + // force into array + $terms = acf_get_array($terms); + + + // force ints + $terms = array_map('intval', $terms); + + + // bail early if function does not yet exist or + if( !function_exists('wp_get_split_term') || empty($terms) ) { + + return $terms; + + } + + + // attempt to find new terms + foreach( $terms as $i => $term_id ) { + + $new_term_id = wp_get_split_term($term_id, $taxonomy); + + if( $new_term_id ) { + + $terms[ $i ] = $new_term_id; + + } + + } + + + // return + return $terms; + +} + + +/* +* acf_esc_html_deep +* +* Navigates through an array and escapes html from the values. +* +* @type function +* @date 10/06/2015 +* @since 5.2.7 +* +* @param $value (mixed) +* @return $value +*/ + +/* +function acf_esc_html_deep( $value ) { + + // array + if( is_array($value) ) { + + $value = array_map('acf_esc_html_deep', $value); + + // object + } elseif( is_object($value) ) { + + $vars = get_object_vars( $value ); + + foreach( $vars as $k => $v ) { + + $value->{$k} = acf_esc_html_deep( $v ); + + } + + // string + } elseif( is_string($value) ) { + + $value = esc_html($value); + + } + + + // return + return $value; + +} +*/ + + +/* +* acf_validate_attachment +* +* This function will validate an attachment based on a field's resrictions and return an array of errors +* +* @type function +* @date 3/07/2015 +* @since 5.2.3 +* +* @param $attachment (array) attachment data. Cahnges based on context +* @param $field (array) field settings containing restrictions +* @param $context (string) $file is different when uploading / preparing +* @return $errors (array) +*/ + +function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) { + + // vars + $errors = array(); + $file = array( + 'type' => '', + 'width' => 0, + 'height' => 0, + 'size' => 0 + ); + + + // upload + if( $context == 'upload' ) { + + // vars + $file['type'] = pathinfo($attachment['name'], PATHINFO_EXTENSION); + $file['size'] = filesize($attachment['tmp_name']); + + if( strpos($attachment['type'], 'image') !== false ) { + + $size = getimagesize($attachment['tmp_name']); + $file['width'] = acf_maybe_get($size, 0); + $file['height'] = acf_maybe_get($size, 1); + + } + + // prepare + } elseif( $context == 'prepare' ) { + + $file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION); + $file['size'] = acf_maybe_get($attachment, 'filesizeInBytes', 0); + $file['width'] = acf_maybe_get($attachment, 'width', 0); + $file['height'] = acf_maybe_get($attachment, 'height', 0); + + // custom + } else { + + $file = array_merge($file, $attachment); + $file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION); + + } + + + // image + if( $file['width'] || $file['height'] ) { + + // width + $min_width = (int) acf_maybe_get($field, 'min_width', 0); + $max_width = (int) acf_maybe_get($field, 'max_width', 0); + + if( $file['width'] ) { + + if( $min_width && $file['width'] < $min_width ) { + + // min width + $errors['min_width'] = sprintf(__('Image width must be at least %dpx.', 'acf'), $min_width ); + + } elseif( $max_width && $file['width'] > $max_width ) { + + // min width + $errors['max_width'] = sprintf(__('Image width must not exceed %dpx.', 'acf'), $max_width ); + + } + + } + + + // height + $min_height = (int) acf_maybe_get($field, 'min_height', 0); + $max_height = (int) acf_maybe_get($field, 'max_height', 0); + + if( $file['height'] ) { + + if( $min_height && $file['height'] < $min_height ) { + + // min height + $errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height ); + + } elseif( $max_height && $file['height'] > $max_height ) { + + // min height + $errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height ); + + } + + } + + } + + + // file size + if( $file['size'] ) { + + $min_size = acf_maybe_get($field, 'min_size', 0); + $max_size = acf_maybe_get($field, 'max_size', 0); + + if( $min_size && $file['size'] < acf_get_filesize($min_size) ) { + + // min width + $errors['min_size'] = sprintf(__('File size must be at least %s.', 'acf'), acf_format_filesize($min_size) ); + + } elseif( $max_size && $file['size'] > acf_get_filesize($max_size) ) { + + // min width + $errors['max_size'] = sprintf(__('File size must must not exceed %s.', 'acf'), acf_format_filesize($max_size) ); + + } + + } + + + // file type + if( $file['type'] ) { + + $mime_types = acf_maybe_get($field, 'mime_types', ''); + + // lower case + $file['type'] = strtolower($file['type']); + $mime_types = strtolower($mime_types); + + + // explode + $mime_types = str_replace(array(' ', '.'), '', $mime_types); + $mime_types = explode(',', $mime_types); // split pieces + $mime_types = array_filter($mime_types); // remove empty pieces + + if( !empty($mime_types) && !in_array($file['type'], $mime_types) ) { + + // glue together last 2 types + if( count($mime_types) > 1 ) { + + $last1 = array_pop($mime_types); + $last2 = array_pop($mime_types); + + $mime_types[] = $last2 . ' ' . __('or', 'acf') . ' ' . $last1; + + } + + $errors['mime_types'] = sprintf(__('File type must be %s.', 'acf'), implode(', ', $mime_types) ); + + } + + } + + + /** + * Filters the errors for a file before it is uploaded or displayed in the media modal. + * + * @date 3/07/2015 + * @since 5.2.3 + * + * @param array $errors An array of errors. + * @param array $file An array of data for a single file. + * @param array $attachment An array of attachment data which differs based on the context. + * @param array $field The field array. + * @param string $context The curent context (uploading, preparing) + */ + $errors = apply_filters( "acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field, $context ); + $errors = apply_filters( "acf/validate_attachment/name={$field['_name']}", $errors, $file, $attachment, $field, $context ); + $errors = apply_filters( "acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field, $context ); + $errors = apply_filters( "acf/validate_attachment", $errors, $file, $attachment, $field, $context ); + + + // return + return $errors; + +} + + +/* +* _acf_settings_uploader +* +* Dynamic logic for uploader setting +* +* @type function +* @date 7/05/2015 +* @since 5.2.3 +* +* @param $uploader (string) +* @return $uploader +*/ + +add_filter('acf/settings/uploader', '_acf_settings_uploader'); + +function _acf_settings_uploader( $uploader ) { + + // if can't upload files + if( !current_user_can('upload_files') ) { + + $uploader = 'basic'; + + } + + + // return + return $uploader; +} + + +/* +* acf_translate_keys +* +* description +* +* @type function +* @date 7/12/2015 +* @since 5.3.2 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +/* +function acf_translate_keys( $array, $keys ) { + + // bail early if no keys + if( empty($keys) ) return $array; + + + // translate + foreach( $keys as $k ) { + + // bail ealry if not exists + if( !isset($array[ $k ]) ) continue; + + + // translate + $array[ $k ] = acf_translate( $array[ $k ] ); + + } + + + // return + return $array; + +} +*/ + + +/* +* acf_translate +* +* This function will translate a string using the new 'l10n_textdomain' setting +* Also works for arrays which is great for fields - select -> choices +* +* @type function +* @date 4/12/2015 +* @since 5.3.2 +* +* @param $string (mixed) string or array containins strings to be translated +* @return $string +*/ + +function acf_translate( $string ) { + + // vars + $l10n = acf_get_setting('l10n'); + $textdomain = acf_get_setting('l10n_textdomain'); + + + // bail early if not enabled + if( !$l10n ) return $string; + + + // bail early if no textdomain + if( !$textdomain ) return $string; + + + // is array + if( is_array($string) ) { + + return array_map('acf_translate', $string); + + } + + + // bail early if not string + if( !is_string($string) ) return $string; + + + // bail early if empty + if( $string === '' ) return $string; + + + // allow for var_export export + if( acf_get_setting('l10n_var_export') ){ + + // bail early if already translated + if( substr($string, 0, 7) === '!!__(!!' ) return $string; + + + // return + return "!!__(!!'" . $string . "!!', !!'" . $textdomain . "!!')!!"; + + } + + + // vars + return __( $string, $textdomain ); + +} + + +/* +* acf_maybe_add_action +* +* This function will determine if the action has already run before adding / calling the function +* +* @type function +* @date 13/01/2016 +* @since 5.3.2 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_maybe_add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) { + + // if action has already run, execute it + // - if currently doing action, allow $tag to be added as per usual to allow $priority ordering needed for 3rd party asset compatibility + if( did_action($tag) && !doing_action($tag) ) { + + call_user_func( $function_to_add ); + + // if action has not yet run, add it + } else { + + add_action( $tag, $function_to_add, $priority, $accepted_args ); + + } + +} + + +/* +* acf_is_row_collapsed +* +* This function will return true if the field's row is collapsed +* +* @type function +* @date 2/03/2016 +* @since 5.3.2 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_is_row_collapsed( $field_key = '', $row_index = 0 ) { + + // collapsed + $collapsed = acf_get_user_setting('collapsed_' . $field_key, ''); + + + // cookie fallback ( version < 5.3.2 ) + if( $collapsed === '' ) { + + $collapsed = acf_extract_var($_COOKIE, "acf_collapsed_{$field_key}", ''); + $collapsed = str_replace('|', ',', $collapsed); + + + // update + acf_update_user_setting( 'collapsed_' . $field_key, $collapsed ); + + } + + + // explode + $collapsed = explode(',', $collapsed); + $collapsed = array_filter($collapsed, 'is_numeric'); + + + // collapsed class + return in_array($row_index, $collapsed); + +} + + +/* +* acf_get_attachment_image +* +* description +* +* @type function +* @date 24/10/16 +* @since 5.5.0 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_get_attachment_image( $attachment_id = 0, $size = 'thumbnail' ) { + + // vars + $url = wp_get_attachment_image_src($attachment_id, 'thumbnail'); + $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); + + + // bail early if no url + if( !$url ) return ''; + + + // return + $value = '' . $alt . ''; + +} + + +/* +* acf_get_post_thumbnail +* +* This function will return a thumbail image url for a given post +* +* @type function +* @date 3/05/2016 +* @since 5.3.8 +* +* @param $post (obj) +* @param $size (mixed) +* @return (string) +*/ + +function acf_get_post_thumbnail( $post = null, $size = 'thumbnail' ) { + + // vars + $data = array( + 'url' => '', + 'type' => '', + 'html' => '' + ); + + + // post + $post = get_post($post); + + + // bail early if no post + if( !$post ) return $data; + + + // vars + $thumb_id = $post->ID; + $mime_type = acf_maybe_get(explode('/', $post->post_mime_type), 0); + + + // attachment + if( $post->post_type === 'attachment' ) { + + // change $thumb_id + if( $mime_type === 'audio' || $mime_type === 'video' ) { + + $thumb_id = get_post_thumbnail_id($post->ID); + + } + + // post + } else { + + $thumb_id = get_post_thumbnail_id($post->ID); + + } + + + // try url + $data['url'] = wp_get_attachment_image_src($thumb_id, $size); + $data['url'] = acf_maybe_get($data['url'], 0); + + + // default icon + if( !$data['url'] && $post->post_type === 'attachment' ) { + + $data['url'] = wp_mime_type_icon($post->ID); + $data['type'] = 'icon'; + + } + + + // html + $data['html'] = ''; + + + // return + return $data; + +} + +/** + * acf_get_browser + * + * Returns the name of the current browser. + * + * @date 17/01/2014 + * @since 5.0.0 + * + * @param void + * @return string + */ +function acf_get_browser() { + + // Check server var. + if( isset($_SERVER['HTTP_USER_AGENT']) ) { + $agent = $_SERVER['HTTP_USER_AGENT']; + + // Loop over search terms. + $browsers = array( + 'Firefox' => 'firefox', + 'Trident' => 'msie', + 'MSIE' => 'msie', + 'Edge' => 'edge', + 'Chrome' => 'chrome', + 'Safari' => 'safari', + ); + foreach( $browsers as $k => $v ) { + if( strpos($agent, $k) !== false ) { + return $v; + } + } + } + + // Return default. + return ''; +} + + +/* +* acf_is_ajax +* +* This function will reutrn true if performing a wp ajax call +* +* @type function +* @date 7/06/2016 +* @since 5.3.8 +* +* @param n/a +* @return (boolean) +*/ + +function acf_is_ajax( $action = '' ) { + + // vars + $is_ajax = false; + + + // check if is doing ajax + if( defined('DOING_AJAX') && DOING_AJAX ) { + + $is_ajax = true; + + } + + + // check $action + if( $action && acf_maybe_get($_POST, 'action') !== $action ) { + + $is_ajax = false; + + } + + + // return + return $is_ajax; + +} + + + + +/* +* acf_format_date +* +* This function will accept a date value and return it in a formatted string +* +* @type function +* @date 16/06/2016 +* @since 5.3.8 +* +* @param $value (string) +* @return $format (string) +*/ + +function acf_format_date( $value, $format ) { + + // bail early if no value + if( !$value ) return $value; + + + // vars + $unixtimestamp = 0; + + + // numeric (either unix or YYYYMMDD) + if( is_numeric($value) && strlen($value) !== 8 ) { + + $unixtimestamp = $value; + + } else { + + $unixtimestamp = strtotime($value); + + } + + + // return + return date_i18n($format, $unixtimestamp); + +} + +/** + * acf_clear_log + * + * Deletes the debug.log file. + * + * @date 21/1/19 + * @since 5.7.10 + * + * @param type $var Description. Default. + * @return type Description. + */ +function acf_clear_log() { + unlink( WP_CONTENT_DIR . '/debug.log' ); +} + +/* +* acf_log +* +* description +* +* @type function +* @date 24/06/2016 +* @since 5.3.8 +* +* @param $post_id (int) +* @return $post_id (int) +*/ + +function acf_log() { + + // vars + $args = func_get_args(); + + // loop + foreach( $args as $i => $arg ) { + + // array | object + if( is_array($arg) || is_object($arg) ) { + $arg = print_r($arg, true); + + // bool + } elseif( is_bool($arg) ) { + $arg = 'bool(' . ( $arg ? 'true' : 'false' ) . ')'; + } + + // update + $args[ $i ] = $arg; + } + + // log + error_log( implode(' ', $args) ); +} + +/** +* acf_dev_log +* +* Used to log variables only if ACF_DEV is defined +* +* @date 25/8/18 +* @since 5.7.4 +* +* @param mixed +* @return void +*/ +function acf_dev_log() { + if( defined('ACF_DEV') && ACF_DEV ) { + call_user_func_array('acf_log', func_get_args()); + } +} + +/* +* acf_doing +* +* This function will tell ACF what task it is doing +* +* @type function +* @date 28/06/2016 +* @since 5.3.8 +* +* @param $event (string) +* @param context (string) +* @return n/a +*/ + +function acf_doing( $event = '', $context = '' ) { + + acf_update_setting( 'doing', $event ); + acf_update_setting( 'doing_context', $context ); + +} + + +/* +* acf_is_doing +* +* This function can be used to state what ACF is doing, or to check +* +* @type function +* @date 28/06/2016 +* @since 5.3.8 +* +* @param $event (string) +* @param context (string) +* @return (boolean) +*/ + +function acf_is_doing( $event = '', $context = '' ) { + + // vars + $doing = false; + + + // task + if( acf_get_setting('doing') === $event ) { + + $doing = true; + + } + + + // context + if( $context && acf_get_setting('doing_context') !== $context ) { + + $doing = false; + + } + + + // return + return $doing; + +} + + +/* +* acf_is_plugin_active +* +* This function will return true if the ACF plugin is active +* - May be included within a theme or other plugin +* +* @type function +* @date 13/07/2016 +* @since 5.4.0 +* +* @param $basename (int) +* @return $post_id (int) +*/ + + +function acf_is_plugin_active() { + + // vars + $basename = acf_get_setting('basename'); + + + // ensure is_plugin_active() exists (not on frontend) + if( !function_exists('is_plugin_active') ) { + + include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); + + } + + + // return + return is_plugin_active($basename); + +} + +/* +* acf_send_ajax_results +* +* This function will print JSON data for a Select2 AJAX query +* +* @type function +* @date 19/07/2016 +* @since 5.4.0 +* +* @param $response (array) +* @return n/a +*/ + +function acf_send_ajax_results( $response ) { + + // validate + $response = wp_parse_args($response, array( + 'results' => array(), + 'more' => false, + 'limit' => 0 + )); + + + // limit + if( $response['limit'] && $response['results']) { + + // vars + $total = 0; + + foreach( $response['results'] as $result ) { + + // parent + $total++; + + + // children + if( !empty($result['children']) ) { + + $total += count( $result['children'] ); + + } + + } + + + // calc + if( $total >= $response['limit'] ) { + + $response['more'] = true; + + } + + } + + + // return + wp_send_json( $response ); + +} + + +/* +* acf_is_sequential_array +* +* This function will return true if the array contains only numeric keys +* +* @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential +* @type function +* @date 9/09/2016 +* @since 5.4.0 +* +* @param $array (array) +* @return (boolean) +*/ + +function acf_is_sequential_array( $array ) { + + // bail ealry if not array + if( !is_array($array) ) return false; + + + // loop + foreach( $array as $key => $value ) { + + // bail ealry if is string + if( is_string($key) ) return false; + + } + + + // return + return true; + +} + + +/* +* acf_is_associative_array +* +* This function will return true if the array contains one or more string keys +* +* @source http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential +* @type function +* @date 9/09/2016 +* @since 5.4.0 +* +* @param $array (array) +* @return (boolean) +*/ + +function acf_is_associative_array( $array ) { + + // bail ealry if not array + if( !is_array($array) ) return false; + + + // loop + foreach( $array as $key => $value ) { + + // bail ealry if is string + if( is_string($key) ) return true; + + } + + + // return + return false; + +} + + +/* +* acf_add_array_key_prefix +* +* This function will add a prefix to all array keys +* Useful to preserve numeric keys when performing array_multisort +* +* @type function +* @date 15/09/2016 +* @since 5.4.0 +* +* @param $array (array) +* @param $prefix (string) +* @return (array) +*/ + +function acf_add_array_key_prefix( $array, $prefix ) { + + // vars + $array2 = array(); + + + // loop + foreach( $array as $k => $v ) { + + $k2 = $prefix . $k; + $array2[ $k2 ] = $v; + + } + + + // return + return $array2; + +} + + +/* +* acf_remove_array_key_prefix +* +* This function will remove a prefix to all array keys +* Useful to preserve numeric keys when performing array_multisort +* +* @type function +* @date 15/09/2016 +* @since 5.4.0 +* +* @param $array (array) +* @param $prefix (string) +* @return (array) +*/ + +function acf_remove_array_key_prefix( $array, $prefix ) { + + // vars + $array2 = array(); + $l = strlen($prefix); + + + // loop + foreach( $array as $k => $v ) { + + $k2 = (substr($k, 0, $l) === $prefix) ? substr($k, $l) : $k; + $array2[ $k2 ] = $v; + + } + + + // return + return $array2; + +} + + +/* +* acf_strip_protocol +* +* This function will remove the proticol from a url +* Used to allow licences to remain active if a site is switched to https +* +* @type function +* @date 10/01/2017 +* @since 5.5.4 +* @author Aaron +* +* @param $url (string) +* @return (string) +*/ + +function acf_strip_protocol( $url ) { + + // strip the protical + return str_replace(array('http://','https://'), '', $url); + +} + + +/* +* acf_connect_attachment_to_post +* +* This function will connect an attacment (image etc) to the post +* Used to connect attachements uploaded directly to media that have not been attaced to a post +* +* @type function +* @date 11/01/2017 +* @since 5.8.0 Added filter to prevent connection. +* @since 5.5.4 +* +* @param int $attachment_id The attachment ID. +* @param int $post_id The post ID. +* @return bool True if attachment was connected. +*/ +function acf_connect_attachment_to_post( $attachment_id = 0, $post_id = 0 ) { + + // Bail ealry if $attachment_id is not valid. + if( !$attachment_id || !is_numeric($attachment_id) ) { + return false; + } + + // Bail ealry if $post_id is not valid. + if( !$post_id || !is_numeric($post_id) ) { + return false; + } + + /** + * Filters whether or not to connect the attachment. + * + * @date 8/11/18 + * @since 5.8.0 + * + * @param bool $bool Returning false will prevent the connection. Default true. + * @param int $attachment_id The attachment ID. + * @param int $post_id The post ID. + */ + if( !apply_filters('acf/connect_attachment_to_post', true, $attachment_id, $post_id) ) { + return false; + } + + // vars + $post = get_post( $attachment_id ); + + // Check if is valid post. + if( $post && $post->post_type == 'attachment' && $post->post_parent == 0 ) { + + // update + wp_update_post( array('ID' => $post->ID, 'post_parent' => $post_id) ); + + // return + return true; + } + + // return + return true; +} + + +/* +* acf_encrypt +* +* This function will encrypt a string using PHP +* https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/ +* +* @type function +* @date 27/2/17 +* @since 5.5.8 +* +* @param $data (string) +* @return (string) +*/ + + +function acf_encrypt( $data = '' ) { + + // bail ealry if no encrypt function + if( !function_exists('openssl_encrypt') ) return base64_encode($data); + + + // generate a key + $key = wp_hash('acf_encrypt'); + + + // Generate an initialization vector + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc')); + + + // Encrypt the data using AES 256 encryption in CBC mode using our encryption key and initialization vector. + $encrypted_data = openssl_encrypt($data, 'aes-256-cbc', $key, 0, $iv); + + + // The $iv is just as important as the key for decrypting, so save it with our encrypted data using a unique separator (::) + return base64_encode($encrypted_data . '::' . $iv); + +} + + +/* +* acf_decrypt +* +* This function will decrypt an encrypted string using PHP +* https://bhoover.com/using-php-openssl_encrypt-openssl_decrypt-encrypt-decrypt-data/ +* +* @type function +* @date 27/2/17 +* @since 5.5.8 +* +* @param $data (string) +* @return (string) +*/ + +function acf_decrypt( $data = '' ) { + + // bail ealry if no decrypt function + if( !function_exists('openssl_decrypt') ) return base64_decode($data); + + + // generate a key + $key = wp_hash('acf_encrypt'); + + + // To decrypt, split the encrypted data from our IV - our unique separator used was "::" + list($encrypted_data, $iv) = explode('::', base64_decode($data), 2); + + + // decrypt + return openssl_decrypt($encrypted_data, 'aes-256-cbc', $key, 0, $iv); + +} + +/** +* acf_parse_markdown +* +* A very basic regex-based Markdown parser function based off [slimdown](https://gist.github.com/jbroadway/2836900). +* +* @date 6/8/18 +* @since 5.7.2 +* +* @param string $text The string to parse. +* @return string +*/ + +function acf_parse_markdown( $text = '' ) { + + // trim + $text = trim($text); + + // rules + $rules = array ( + '/=== (.+?) ===/' => '

                    $1

                    ', // headings + '/== (.+?) ==/' => '

                    $1

                    ', // headings + '/= (.+?) =/' => '

                    $1

                    ', // headings + '/\[([^\[]+)\]\(([^\)]+)\)/' => '$1', // links + '/(\*\*)(.*?)\1/' => '$2', // bold + '/(\*)(.*?)\1/' => '$2', // intalic + '/`(.*?)`/' => '$1', // inline code + '/\n\*(.*)/' => "\n", // ul lists + '/\n[0-9]+\.(.*)/' => "\n
                      \n\t
                    1. $1
                    2. \n
                    ", // ol lists + '/<\/ul>\s?'; + } + +function amr_ical_submit_buttons ($resettext='') { + + if (empty($resettext)) + $resettext=__('Reset all listing options', 'amr-ical-events-list'); + + echo '
                    + + '; + + echo '     +
                    '; + +} + +function amrical_listing_options_page() { + global $amr_options; + + if (isset ($_POST['reset'])) + $amr_options = amr_getset_options (true); + else + $amr_options = amr_getset_options(false); /* options will be set to defaults here if not already existing */ + + if (!isset($_REQUEST["list"]) ) { + amrical_admin_heading(__('Manage Event List Types', 'amr-ical-events-list') ) ; + + if (!empty($_POST['delete']) ) /* Validate the input and save */ + amrical_delete_listings(); + elseif ((isset ($_POST['action']) and ($_POST['action'] == "save")) and !isset($_POST['reset'])) /* Validate the input and save */ + amrical_validate_manage_listings(); + + amr_ical_submit_buttons (); + amrical_manage_listings(); + amrical_admin_footer(); + return; + } + else { + $listtype = intval( $_REQUEST["list"]); + + amrical_admin_heading(__('Configure event list type: ', 'amr-ical-events-list'). $listtype ) ; + amrical_admin_navigation(); + + $calendar_preview_url = get_option('amr-ical-calendar_preview_url' ); + if ($calendar_preview_url) { + echo '' + .__('Preview','amr-ical-events-list').''; + } + + + if ((isset ($_POST['action']) and ($_POST['action'] == "save")) and !isset($_POST['reset'])) {/* Validate the input and save */ + echo '

                    '; + _e('Saving....','amr-ical-events-list'); + $result = amr_ical_validate_list_options($listtype); /* messages are in the function */ + if ($result) _e('Lists saved','amr-ical-events-list'); + else _e('No change to options or unexpected error in saving','amr-ical-events-list'); + echo '

                    '; + + } + amr_ical_submit_buttons (); + amr_configure_list($listtype); + amrical_admin_footer(); + } +} //end amrical_option_page + +function amrical_delete_listings () { +global $amr_options; + + $nonce = $_REQUEST['_wpnonce']; + if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); + + echo '

                    '.__('Check for lists to delete','amr-ical-events-list').'

                    '; +// ------------------- deleted lists + if (!empty($_POST['deletelist'])) { + foreach ($_POST['deletelist'] as $i=>$del) { + $d = (int) $del; + unset ($amr_options['listtypes'][$d]); + echo '

                    ' + .sprintf(__('List %s will be deleted','amr-ical-events-list'),$d) + .'

                    '; + } + } + update_option('amr-ical-events-list', $amr_options); + +} + +function amrical_col_headings($i) { + /* for component properties only */ + global $amr_options; + global $amr_csize; + $listtype = $amr_options['listtypes'][$i]; + echo '
                    +

                    '; + _e('Column Headings:','amr-ical-events-list'); + echo '

                    +
                    '; + $j = 0; + while ($j < 8) { + $j = $j + 1; + if (isset ( $listtype['heading'][$j] )) { + $h = $listtype['heading'][$j]; + } + else $h = ''; + + echo ''; + } + echo "\n\t".'
                    '; + return; +} + +function amrical_calpropsoption($i) { + global $amr_options; + global $amr_csize; + $listtype = $amr_options['listtypes'][$i]; + echo '
                    +

                    '; + _e('Calendar properties' , 'amr-ical-events-list'); + echo '

                    +
                    '; + + foreach ( $listtype['calprop'] as $c => $v ) + { + echo "\n\t\t".'
                    '.$c.''; + foreach ( $v as $si => $sv ) /* for each specification */ + { echo '' + .''; + } + echo "\n\t\t".'
                    '; + } + echo "\n\t".'
                    '; + return; + } + +function amrical_compropsoption($i) { + global $amr_options; + global $amr_csize; + + $inuse = amr_whats_in_use(); + $listtype = $amr_options['listtypes'][$i]; + $desc = amr_set_helpful_descriptions(); + + echo '
                    +

                    '; + _e('Specify fields to show:' , 'amr-ical-events-list'); + echo '

                    +

                    '; + _e('Note: a 0 (zero) in column = do not show that field.', 'amr-ical-events-list'); + echo '

                    '; + _e('Uppercase fields are those defined in the iCal specification.', 'amr-ical-events-list'); + echo ' + RFC 5545

                    +

                    '; + _e('Lowercase fields are additional fields added by this plugin and derived from the iCal fields for your convenience.' , 'amr-ical-events-list'); + _e('Fields show if "column" > 0 and if there is data available in your event or ics file.', 'amr-ical-events-list'); + echo '

                    '; + + echo ''; + $thead = '' + .'' + .'' + .'' + .'' + .'' + .''; + echo ''.$thead.''; + echo ''.$thead.''; + echo ''; + + + + $listtype['compprop'] = apply_filters('amr_ics_component_properties', $listtype['compprop']); + // add arrays of field array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => ''); + + foreach ($inuse as $f=> $bool) { + if (!isset($listtype['compprop'][$f])) { // we got a new field + $listtype['compprop'][$f] + = array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => ''); + } + } + + foreach ( $listtype['compprop'] as $p => $pv ) {/* for each specification, eg: p= SUMMARY */ + if (!empty($inuse[$p])) { + $text = ''.(!empty($desc[$p])? $desc[$p] : '').''; + echo "\n\t\t".''; + } + echo ''; + echo "\n\t\t".''; + } + } + echo "\n".'
                    '.__('Field','amr-ical-events-list').''.__('Column','amr-ical-events-list').'
                    ' + .__('(0 to hide)', 'amr-ical-events-list') + .'
                    '.__('Order','amr-ical-events-list').''.__('Before','amr-ical-events-list').''.__('After','amr-ical-events-list').'
                    '.$p.''; + + foreach ( $pv as $s => $sv ) {/* for each specification eg $s = column*/ + + echo '' + .'' + .'
                    '.$text.'
                    '; + return; + } + +function amrical_groupingsoption($i) { + global $amr_options; + $listtype = $amr_options['listtypes'][$i]; + + $groupings = amr_define_possible_groupings (); + $taxonomies = amr_define_possible_taxonomies (); + + echo '
                    +

                    '; + _e('Define grouping:', 'amr-ical-events-list'); + echo '

                    '; + + + echo ''; + $nolevel1 = false; + $nolevel2 = false; + if (empty($listtype['grouping'])) { echo 'No groupings ?'; + $nolevel1 = true; + $nolevel2 = true; + } + else { + if (count($listtype['grouping']) < 2) $nolevel2 = true; + } + + + echo ''; + $sel = checked($nolevel1,true, false); + echo ""; + $sel = checked($nolevel2,true, false); + echo ""; + echo ''; + + echo ''; + foreach ( $taxonomies as $i => $taxonomy ) { + $taxo = get_taxonomy($taxonomy); + $c = $taxo->label; + if (!empty($listtype['grouping'][$taxonomy])) + $v= $listtype['grouping'][$taxonomy]; + else + $v = false; + + echo ''; + $sel = checked($v,1, false); + echo ""; + $sel = checked($v,2, false); + echo ""; + echo ''; + + } + echo ''; + foreach ( $groupings as $c => $tmp ) { + if (in_array($c,$taxonomies )) continue; // don't repeat + if (!empty($listtype['grouping'][$c])) + $v= $listtype['grouping'][$c]; + else + $v = false; + echo ''; + $sel = checked($v,1, false); + echo ""; + $sel = checked($v,2, false); + echo ""; + echo ''; + } + echo "\n\t".'
                    '.__('Possible Groupings', 'amr-ical-events-list').''.__('Level','amr-ical-events-list').' 1 '.__('Level','amr-ical-events-list').' 2
                    '.__('No grouping','amr-ical-events-list').'
                    '.__('Taxonomies','amr-ical-events-list').''.__('(Requires amr-events)','amr-ical-events-list').'
                    '.$c.'
                    '.__('Date based','amr-ical-events-list').''.__('(See also date and time formats)','amr-ical-events-list').'
                    '.$c.'
                    '; + return; + } + +function amrical_componentsoption($i) { + global $amr_options; + + + $listtype = $amr_options['listtypes'][$i]; + echo '
                    +

                    '; + _e('Select components to show:', 'amr-ical-events-list'); + echo ' ?

                    +
                    '; + + $desc = amr_set_helpful_descriptions (); + + if (! isset($listtype['component'])) echo 'No default components set'; + else { + foreach ( $listtype['component'] as $c => $v ) { + echo '
                    '.$desc[$c].''; + } + } + echo "\n\t".'
                    '; + return ; + } + +function amrical_limits($i) { + global $amr_options; + $listtype = $amr_options['listtypes'][$i]; + echo '

                    ' + . __('Define maximums:', 'amr-ical-events-list') + .'

                    +

                    '. + __('Note cache times are in hours','amr-ical-events-list') + .'

                    '; + if (! isset($listtype['limit'])) echo 'No default limits set'; + else { + + foreach ( $listtype['limit'] as $c => $v ) { + + echo ''; + echo ''; + } + } + echo "\n\t".'
                    '; + return ; + } + +function amrical_admin_heading($title) { + echo '
                    +

                    +
                    +

                    '.$title.' v'.AMR_ICAL_LIST_VERSION.'

                    +
                    '; + wp_nonce_field('amr-ical-events-list'); /* outputs hidden field */ + ; +} + +function amrical_admin_footer() { + echo '
                    +
                    '; +} + +function amrical_admin_navigation() { + global $amr_options; + echo '
                    '; + if (!isset($_REQUEST["list"]) ) { $list = '';} + else $list = intval( $_REQUEST["list"]); + $url = remove_query_arg('list'); + + _e('Configure another list type: ','amr-ical-events-list'); + + foreach ($amr_options['listtypes'] as $i => $listtype) { + if ($i > 1) echo ' '; + $text = ' '.$i +// .$listtype['general']['name'] + .''; + if ($list==$i) echo ''.$text.''; + else echo $text; + } + + if (isset($_GET["list"]) ) { + echo ''.__('Return to manage list types','amr-ical-events-list' ).''; + } + echo '
                    '; +} + +function amrical_validate_manage_listings() { + global $amr_options; + + $nonce = $_REQUEST['_wpnonce']; + if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); + + if (!empty($_POST['calendar_preview_url'])) { + if (!filter_var($_POST['calendar_preview_url'],FILTER_VALIDATE_URL)) { + amr_invalid_url(); + } + else { + $url = filter_var($_POST['calendar_preview_url'],FILTER_SANITIZE_URL); + $sticky_url = amr_make_sticky_url($url); + if (!$sticky_url) + $calendar_preview_url = $url ; //might be external + else + $calendar_preview_url = $sticky_url ; + update_option('amr-ical-calendar_preview_url', $calendar_preview_url); + } + } + else { + update_option('amr-ical-calendar_preview_url', ''); + } + +//----- list numbers + $dupcheck = array(); // clear it out + if (!empty($_POST['listnumber'])) { + foreach ($_POST['listnumber'] as $i=> $n) { + if ($n === '') break; + $nn = abs (intval ( $n)); + + if ($nn === 0){ + echo '
                    '.__('Please use numbers > 1','amr-ical-events-list').'
                    '; + return; + } + + if (in_array($nn, $dupcheck)) + echo 'Duplicate List Number was entered - please ensure all list numbers are unique.'; + else { + $listnumber[$i] = $nn; + $dupcheck[$nn] = $nn; // keep a record of the numbers + + if (empty ($_POST['prevnumber'][$i]) or ($_POST['prevnumber'][$i] === '')) { // if we have no listtype for the existing number, then must be new + $amr_options['listtypes'][$nn] = new_listtype(); + $amr_options['listtypes'][$nn]['Id'] = $nn; + $amr_options['listtypes'][$nn]['general']['name'] .= $nn; + $amr_options['listtypes'][$nn] = customise_listtype($nn); // includes the fix, need till we drop away old compatibility + echo '
                    Create new '.$nn; + } + else {// we are changing a list number, copy the list type to the new number + $prev = $_POST['prevnumber'][$i]; + if (!($prev == $nn)) { + + $amr_options['listtypes'][$nn] = $amr_options['listtypes'][$prev]; + $amr_options['listtypes'][$nn]['Id'] = $nn; + unset($amr_options['listtypes'][$prev]); + } + } + } + } + + ksort ($amr_options['listtypes']); + } +// ---------------------- imported lists + if (isset($_POST['import'])) { + $import = $_POST['import']; + foreach ($import as $i=>$il) { + + if (!empty($il)) { + //var_dump($il); + $importedlist = unserialize(base64_decode($il)); + $importedlist['Id'] = $i; // use the id just pasted into + + if ((!is_array($importedlist)) or empty($importedlist['general'])) + echo '

                    ' + .sprintf(__('Imported settings for list %s invalid - not saved','amr-ical-events-list'),$i) + .'

                    ' + .sprintf(__('List %s will be saved with imported data','amr-ical-events-list'),$i) + .'

                    '; + echo ''; + echo ''; + echo ''; + echo ''; + + + echo ''; + echo ''; + + echo ''; + + if (!empty($listtype['general']) ) { + echo ''; + echo '' + .$listtype['general']['name'].'' + .'
                    '; + echo '' + .__('Configure', 'amr-ical-events-list').' | '; + if ($calendar_preview_url) { + echo '' + .__('Preview','amr-ical-events-list').''; + } + else { + echo '' + .__('n/a','amr-ical-events-list').''; + } + + echo '
                    '; + echo ''; + echo ''.$listtype['general']['ListHTMLStyle']; + echo ''; + echo ''; + echo ''; + } + else { + echo ''; + _e('Enter a list number to start a list type with new default settings.','amr-ical-events-list'); + echo '' + .__('After that, cut and paste from the list type closest to what you want to get you started','amr-ical-events-list') + .''; + } + + echo ''; +} + +function amrical_option_page() { + global $amr_options; + //$nonce = wp_create_nonce('amr-ical-events-list'); /* used for security to verify that any action request comes from this plugin's forms */ + amrical_admin_heading(__('iCal Events List ', 'amr-ical-events-list')); + + if (isset ($_POST['reset'])) + $amr_options = amr_getset_options (true); + else + $amr_options = amr_getset_options(false); /* options will be set to defaults here if not already existing */ + + if (!(isset ($_POST['reset'])) and (isset ($_POST['action']) and ($_POST['action'] == "save"))) {/* Validate the input and save */ + echo '

                    '; + _e('Saving....','amr-ical-events-list'); + if (!isset($_REQUEST['list'])) { + if (! amr_ical_validate_general_options() ) + {echo '

                    Error validating general options

                    ';} + else _e('List saved','amr-ical-events-list'); + } + echo '

                    '; + } + + //amr_request_acknowledgement(); + amr_ical_support_links (); + //amrical_mimic_meta_box('acknowledge', 'About', 'amr_request_acknowledgement' , true); + + //if (!(is_plugin_active('amr-events/amr-events.php'))) {amr_getting_started();} + amr_ical_submit_buttons (); + amr_ical_general_form(); + echo '
                    '; +} //end amrical_option_page + +function amrical_add_options_panel() { + + global $wp_version, + $current_user, + $events_menu_added; + + /* add the options page at admin level of access */ + $parent_slug = 'amr-events'; + $capability = 'manage_event_settings'; + + + + $menu_title = $page_title = __('iCal Events List', 'amr-ical-events-list'); + + $function = 'amrical_option_page'; + + $menu_slug = 'manage_amr_ical'; + + if (function_exists('amr_events_settings_menu')) { + $menu_title = $page_title = __('Listing Events', 'amr-ical-events-list'); + + if (empty($events_menu_added) or (!$events_menu_added)) { + amr_events_settings_menu(); + $events_menu_added = true; + } + add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); + if (!(current_user_can('manage_event_settings'))) + add_submenu_page( $parent_slug, $page_title, $menu_title, 'manage_options', $menu_slug, $function); // some sites need this + } + + else { + $capability = 'manage_options'; + add_menu_page($page_title, $menu_title , $capability, $menu_slug, $function); + $parent_slug = $menu_slug; +// $page = add_options_page($page_title, $menu_title , 'manage_options', $menu_slug, $function); + + } + $function = 'amrical_choose_fields'; + $menu_slug = 'manage_event_fields'; + $page_title = __('iCal Fields', 'amr-ical-events-list'); + $menu_title = __('Fields for lists', 'amr-ical-events-list'); + add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); + + + $function = 'amrical_listing_options_page'; + $menu_slug = 'manage_event_listing'; + $page_title = __('iCal Events Lists', 'amr-ical-events-list'); + $menu_title = __('List types', 'amr-ical-events-list'); + add_submenu_page( $parent_slug, $page_title, $menu_title,$capability, $menu_slug, $function); + + + amr_ical_updates_menu($parent_slug); +} + +//build admin interface ======================================================= +function amr_ical_validate_general_options(){ + global + $amr_options, + $amr_calprop, + $amr_limits, + $amr_compprop, + $amr_groupings, + $amr_components; + + $nonce = $_REQUEST['_wpnonce']; + if (! wp_verify_nonce($nonce, 'amr-ical-events-list')) die ("Cancelled due to failed security check"); + + if (isset($_POST['ngiyabonga'])) + $amr_options['ngiyabonga'] = true; + else + $amr_options['ngiyabonga'] = false; + foreach (array( + 'noeventsmessage', + 'lookmoremessage', + 'lookprevmessage', + 'resetmessage', + 'freebusymessage' // was missing 20141119 + ) as $message) { + if (isset($_POST[$message])) + $amr_options[$message] = $_POST[$message]; + else + $amr_options[$message] = ''; + + } + if (isset($_POST["usehumantime"])) + $amr_options['usehumantime'] = true; + else + $amr_options['usehumantime'] = false; + + if (isset($_POST["do_grouping_js"])) + $amr_options['do_grouping_js'] = true; + else + $amr_options['do_grouping_js'] = false; + + if (isset($_POST["js_only_these_pages"])) { + $tmp = explode (',',$_POST["js_only_these_pages"]); + foreach ($tmp as $i) {$i = (int) $i;} + $amr_options['js_only_these_pages'] = $tmp; + } + else + $amr_options['js_only_these_pages'] = false; + + if (isset($_POST["own_css"])) + $amr_options['own_css'] = true; + else + $amr_options['own_css'] = false; + if ((isset($_POST["date_localise"])) and (in_array($_POST["date_localise"], array('none', 'wp', 'wpgmt', 'amr')) )) $amr_options['date_localise'] = $_POST["date_localise"]; /* from dropdown */ + else $amr_options['date_localise'] = 'none'; + if (isset($_POST["cssfile"])) $amr_options['cssfile'] = $_POST["cssfile"]; /* from dropdown */ + else $amr_options['cssfile'] = ''; + if (isset($_POST["no_images"])) $amr_options['no_images'] = true; /* from dropdown */ + else $amr_options['no_images'] = false; + + if (isset($_POST['images_size'])) { + $amr_ical_image_settings['images_size'] = (int) ($_POST['images_size']) ; /* from dropdown */ + } + else + $amr_ical_image_settings['images_size'] = '16'; + + if (isset($_POST['timeout'])) { + $amr_options['timeout'] = (int) ($_POST['timeout']) ; /* from dropdown */ + } + else + $amr_options['timeout'] = '5'; + + update_option('amr-ical-events-list', $amr_options); + update_option('amr-ical-images-to-use', $amr_ical_image_settings); + amr_ical_events_list_record_version(); + + return(true); + } + +function amr_ical_validate_list_options($i) { +global $amr_options; + + if (isset($_POST['general'])) { + if (is_array($_POST['general'][$i])){ + foreach ($_POST['general'][$i] as $c => $v) { + if (!empty($_POST['general'][$i][$c])) { + switch ($c) { + case 'Default Event URL' : { + if (!filter_var($_POST['general'][$i][$c],FILTER_VALIDATE_URL)) { + amr_invalid_url(); + } + else { + $url = filter_var($_POST['general'][$i][$c],FILTER_SANITIZE_URL); + $sticky_url = amr_make_sticky_url($url); + if (!$sticky_url) + $amr_options['listtypes'][$i]['general'][$c] = $url ; //might be external + else + $amr_options['listtypes'][$i]['general'][$c] = $sticky_url ; + } + break; + } + case 'customHTMLstylefile': { + $custom_htmlstyle_file = esc_attr($_POST['general'][$i]['customHTMLstylefile']); + + if (!($custom_htmlstyle_file[0] === '/')) + $custom_htmlstyle_file = '/'.$custom_htmlstyle_file; + $uploads = wp_upload_dir(); + if (!file_exists($uploads['basedir'].$custom_htmlstyle_file)) { + amr_invalid_file(); + $amr_options['listtypes'][$i]['general']['customHTMLstylefile'] = ' '; + } + else { + $amr_options['listtypes'][$i]['general']['customHTMLstylefile'] + = $custom_htmlstyle_file; + } + break; + } + + default: { + $amr_options['listtypes'][$i]['general'][$c] + = filter_var($_POST['general'][$i][$c],FILTER_SANITIZE_STRING) ; + } + } + } + else $amr_options['listtypes'][$i]['general'][$c] = ''; + } + } + else echo 'Error in form - general array not found'; + } + + if (isset($_POST['limit'])) + { if (is_array($_POST['limit'][$i])) + { foreach ($_POST['limit'][$i] as $c => $v) + { + $amr_options['listtypes'][$i]['limit'][$c] = + (isset($_POST['limit'][$i][$c])) ? $_POST['limit'][$i][$c] :11; + } + } + else echo 'Error in form - limit array not found'; + } + if (isset($_POST['format'])){ + if (is_array($_POST['format'][$i])) + { foreach ($_POST['format'][$i] as $c => $v) + { /* amr - how should we validate this ? accepting any input for now */ + $amr_options['listtypes'][$i]['format'][$c] = + (isset($_POST['format'][$i][$c])) ? stripslashes_deep($_POST['format'][$i][$c]) :''; + } + } + else echo 'Error in form - format array not found'; + } + + foreach ($amr_options['listtypes'][$i]['component'] as $k => $c) { + if (isset($_POST['component'][$i][$k])) { + $amr_options['listtypes'][$i]['component'][$k] = true; + } + else { + $amr_options['listtypes'][$i]['component'][$k] = false; + } + } + unset ($amr_options['listtypes'][$i]['grouping']); + + if (isset($_POST['level'][1])) { + $k = esc_attr($_POST['level']['1']); + if (!($k === 'none')) $amr_options['listtypes'][$i]['grouping'][$k] = '1'; + } + if (isset($_POST['level'][2])) { + $k = esc_attr($_POST['level']['2']); + if (!($k === 'none')) $amr_options['listtypes'][$i]['grouping'][$k] = '2'; + } + + + if (isset($_POST['ColH'])) + { if (is_array($_POST['ColH'][$i])) { + foreach ($_POST['ColH'][$i] as $c => $v) { + $amr_options['listtypes'][$i]['heading'][$c] = $v; + } + } + // else echo 'Error in form - grouping array not found'; /* May not want any groupings ? + } + if (isset($_POST['CalP'])) { + if (is_array($_POST['CalP'][$i])) { + foreach ($_POST['CalP'][$i] as $c => $v) { + if (is_array($v)) + foreach ($v as $p => $pv){ + /*need to validate these */ + switch ($p): + case 'Column': + if (function_exists( 'filter_var') ) + { if (filter_var($pv, FILTER_VALIDATE_INT, + array("options" => array("min_range"=>0, "max_range"=>20)))) + $amr_options['listtypes'][$i]['calprop'][$c][$p]= $pv; + else + $amr_options['listtypes'][$i]['calprop'][$c][$p]= 0; + } + else $amr_options['listtypes'][$i]['calprop'][$c][$p]= $pv; + break; + + case 'Order': + if (function_exists( 'filter_var') ) + { if (filter_var($pv, FILTER_VALIDATE_INT, + array("options" => array("min_range"=>0, "max_range"=>99)))) + $amr_options['listtypes'][$i]['calprop'][$c][$p] = $pv;break; + } + else + $amr_options['listtypes'][$i]['calprop'][$c][$p] = $pv;break; + case 'Before': $amr_options['listtypes'][$i]['calprop'][$c][$p] = wp_kses($pv, amr_allowed_html()); + break; + case 'After': $amr_options['listtypes'][$i]['calprop'][$c][$p] = wp_kses($pv, amr_allowed_html()); + break; + endswitch; + } + } + } + else _e('Error in form - calprop array not found', 'amr-ical-events-list'); + + } + + if (isset($_POST['ComP'])) { + if (is_array($_POST['ComP'])) { + foreach ($_POST['ComP'] as $c => $v) { /* eg c= summary */ + if (is_array($v)) { + foreach ($v as $p => $pv) { + /*need to validate these */ + switch ($p): + case 'Column': + if (function_exists( 'filter_var') ) + { if (filter_var($pv, FILTER_VALIDATE_INT, + array("options" => array("min_range"=>0, "max_range"=>20)))) + $amr_options['listtypes'][$i]['compprop'][$c][$p]= $pv; + else + $amr_options['listtypes'][$i]['compprop'][$c][$p]= 0; + break; + } + else $amr_options['listtypes'][$i]['compprop'][$c][$p]= $pv; + break; + case 'Order': + if (function_exists( 'filter_var') ) + { if (filter_var($pv, FILTER_VALIDATE_INT, + array("options" => array("min_range"=>0, "max_range"=>99)))) + $amr_options['listtypes'][$i]['compprop'][$c][$p] = $pv; + else + $amr_options['listtypes'][$i]['compprop'][$c][$p]= 0; + break; + } + else $amr_options['listtypes'][$i]['compprop'][$c][$p] = $pv; + break; + case 'Before': + $bef = wp_kses($pv, amr_allowed_html()); + $bef = wp_kses_stripslashes($bef); + //if (stripos($bef, '\\"')) echo 'YES still there'; + $bef = str_replace('\\"', '"', $bef); + $amr_options['listtypes'][$i]['compprop'][$c][$p] = $bef; + //if ($c == 'URL') echo 'TEST:'. $bef.' else '.$amr_options['listtypes'][$i]['compprop'][$c][$p]; + + + break; + case 'After': + $amr_options['listtypes'][$i]['compprop'][$c][$p] = wp_kses_stripslashes(wp_kses($pv, amr_allowed_html())); + break; + endswitch; + } + } + } + $amr_options['listtypes'][$i]['compprop'] + = amr_sort_by_two_cols_asc('Column','Order',$amr_options['listtypes'][$i]['compprop']); + } + else echo 'Error in form - compprop array not found'; + } + $result = update_option( 'amr-ical-events-list', $amr_options); + return($result); +} + +function amrical_general_form ($i) { + global $amr_options; + + //http://localhost/wpbeta/wp-admin/post-new.php?post_type=page + + $listtype = $amr_options['listtypes'][$i]; + + ?>
                    +
                    + +
                    +
                    +
                    +
                    +
                    +

                    ' + . __('Other:', 'amr-ical-events-list') + .'

                    '; + + if (! isset($listtype['general'])) echo 'No general specifications set'; + else {?> + + +

                    + + + + + + +
                    + + + +
                    + + ' + .$gentext.' | ' + .'' + .$styletext.' | ' + .'' + .$advtext + .' | ' + .'' + .$managetext + .' + +

                    '.$gentext.'

                    '; + echo '
                    + +
                    + /> +
                    +
                    + /> +
                    +
                    + /> +
                    +
                    + /> +
                    +
                    + /> +
                    + + + + + +
                    +
                    +

                    +
                    + +
                    + + +
                    + +
                    +
                    + + + + + +

                    +

                    +

                    + */?> +

                    + +

                    + +
                    +
                    +

                    +

                    +

                    +')) { + echo( '

                    '.__('Minimum Php version 5.3 required for events cacheing. ','amr-ical-events-list'). ''); + _e('Cacheing of generated events for re-use on same page (eg: widget plus list) will not be attempted. ','amr-ical-events-list') ; + _e('Apparently objects do not serialise correctly in php < 5.3.','amr-ical-events-list') ; + echo '

                    '; + } + + echo '

                    '; + _e('Http timeout for external ics files:', 'amr-ical-events-list'); + $options = array('5','8','10','20','30','1'); + if (!isset($amr_options['timeout'])) + $amr_options['timeout'] = 5; + ?>
                    + +
                    +


                    + +

                    ?
                    +
                    +
                    +
                    +
                    +


                    + +
                    +
                    + +'; + + echo '
                    '; + + + $url = remove_query_arg('list'); + echo '

                    '.__('Click the name of each list type below to configure that list.','amr-ical-events-list').'

                    '; + echo '

                    ' + .'' + .__('Configuration help','amr-ical-events-list' ).' ' + .__('Be careful when editing or deleting - some listtypes are defaults for shortcodes and widgets. ','amr-ical-events-list' ) + .'
                    '.__('Add listtype=n in the parameters of the shortcode or widget to use another list type.','amr-ical-events-list' ) + .'

                    '; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + echo ''; + echo ''; + echo ''; + + foreach ($amr_options['listtypes'] as $i=>$listtype) { + amr_manage_listtypes_row ($listtype, $i); + } + amr_manage_listtypes_row ($listtype=null, ''); + echo '
                    X'.__('List','amr-ical-events-list').''.__('Name','amr-ical-events-list').''.__('List HTML Style','amr-ical-events-list').''.__('To export or copy a list type','amr-ical-events-list') + .'
                    '.__('Select ALL the content, and COPY.','amr-ical-events-list') + .' '.__('Why encode?','amr-ical-events-list').'' + + .'' + .'
                    '.__('To import or paste a list type','amr-ical-events-list') + .'
                    '.__('PASTE list type string','amr-ical-events-list') + .' '.__('Test decode','amr-ical-events-list').'' + .'' + .'
                    '; +/*?> + */ +?> + +
                    +

                    +

                    +

                    ' + .__('See php date function format strings' , 'amr-ical-events-list').'' + .__(' (will localise) ' , 'amr-ical-events-list') +// . ' ' +// .__('strftime' , 'amr-ical-events-list').'' + ;?>

                    '; + foreach ( $amr_options['listtypes'][$i]['format'] as $c => $v ) { + $l = str_replace(' ','', $c).$i; + echo '
                  • '; + echo ' '; + echo amr_format_date( $v, $date); //a* amr ***/ + echo '
                  • '; + } + echo ''; + } ?>
                    +
                    ' ; +// echo ''. __('List Type ', 'amr-ical-events-list').$i.''; + echo ''.__('Expand/Contract all', 'amr-ical-events-list').''; + +// echo ''.__('go back','amr-ical-events-list').''; + if (!(isset($amr_options['listtypes'])) ) echo 'Error in saved options'; + else { + + amrical_general_form($i); + amrical_compropsoption($i); + amrical_limits ($i); + amrical_formats ($i); + if (!(in_array($amr_options['listtypes'][$i]['general']['ListHTMLStyle'], + array('smallcalendar','largecalendar', 'weekscalendar')))) { + amrical_groupingsoption($i); + amrical_col_headings($i); + } + // + + + amrical_calpropsoption($i); + amrical_componentsoption($i); + amrical_other_form($i); + + } + echo "\n\t".' '; + ?> + \ No newline at end of file diff --git a/wp-content/plugins/amr-ical-events-list/includes/amr-ical-plugin-form-html.php b/wp-content/plugins/amr-ical-events-list/includes/amr-ical-plugin-form-html.php new file mode 100755 index 0000000..4e1c33d --- /dev/null +++ b/wp-content/plugins/amr-ical-events-list/includes/amr-ical-plugin-form-html.php @@ -0,0 +1,189 @@ +hook) { + wp_enqueue_style('dashboard'); + wp_enqueue_style('thickbox'); + wp_enqueue_style('global'); + wp_enqueue_style('wp-admin'); + wp_enqueue_style('blogicons-admin-css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname(__FILE__)). '/amr_plugin_tools.css'); + } + } + function register_settings_page() { + add_submenu_page( $this->parent_slug, $this->shortname, $this->shortname, $this->accesslvl, $this->hook, array(&$this,'config_page')); + } + function plugin_options_url() { + return admin_url( 'options-general.php?page='.$this->hook ); + } + /** + * Add a link to the settings page to the plugins list + */ + function add_action_link( $links, $file ) { + static $this_plugin; + if( empty($this_plugin) ) $this_plugin = $this->filename; + if ( $file == $this_plugin ) { + $settings_link = '' . __('Settings') . ''; + array_unshift( $links, $settings_link ); + } + return $links; + } + function config_page() { + + } + function config_page_scripts() { + if (isset($_GET['page']) && $_GET['page'] == $this->hook) { + wp_enqueue_script('postbox'); + wp_enqueue_script('dashboard'); + wp_enqueue_script('thickbox'); + wp_enqueue_script('media-upload'); + } + } + /** + * Create a Checkbox input field + */ + function radiobutton($id, $label, $value, $selected) { + $sel = checked($value,$selected, false); + return " ".$label."
                    "; + } + /** + * Create a Checkbox input field + */ + function checkbox($id, $label, $value) { + return ' 
                    '; + } + /** + * Create a Dropdown input field + */ + function dropdown($id, $label, $options, $selected) { +// + $html = '
                    ' + .''; + return ($html); + } + /** + * Create a Text input field + */ + function textinput($id, $label, $value, $length='45') { + return '


                    '; + } + /** + * Create a Text area field + */ + function textarea($id, $label, $value, $cols='45', $rows='10') { + return '
                    ' + .'

                    '; + } + /** + * Create a postbox widget + */ + function postbox($id, $title, $content) { + ?> +
                    +

                    +

                    +
                    + +
                    +
                    + '; + foreach ($rows as $row) { + $content .= ''; + if (isset($row['id']) && $row['id'] != '') + $content .= ''; + else + $content .= $row['label']; + if (isset($row['desc']) && $row['desc'] != '') + $content .= '
                    '.$row['desc'].''; + $content .= ''; + $content .= $row['content']; + $content .= ''; + } + $content .= ''; + return $content; + } + /** + * Create a "plugin like" box. + */ + function plugin_like() { + $content = '

                    '.__('Why not do any or all of the following:','amr-ical-events-list').'

                    '; + $content .= ''; + $this->postbox($this->hook.'like', 'Like this plugin?', $content); + } + /** + * Info box with link to the support forums. + */ + function plugin_support() { + $content = '

                    '.__('If you have any problems with this plugin or good ideas for improvements or new features, please talk about them in the','amr-ical-events-list').' '.__("Support forums",'amr-ical-events-list').'.

                    '; + $this->postbox($this->hook.'support', 'Need support?', $content); + } + /** + * Box with latest news from amr.com + */ + function news() { + require_once(ABSPATH.WPINC.'/rss.php'); + if ( $rss = fetch_rss( 'http://icalevents.com/feed' ) ) { + $content = ''; + return ($text); +} + +function amr_get_widgets_sidebar($wid) { +/* walk through the registered sidebars with a name and find the id - will be something like sidebar-integer. +take the first one that matches */ +global $_wp_sidebars_widgets; + + foreach ($_wp_sidebars_widgets as $sidebarid => $sidebar) { + + if (is_array($sidebar) ) { // ignore the 'array version' sidebarid that isnt actually a sidebar + foreach ($sidebar as $i=> $w) { + if ($w == $wid) { + return $sidebarid; + } + }; + } + } + return (false); // widget id not in any sidebar +} + +function amr_get_sidebar_id ($name) { +/* walk through the registered sidebars with a name and find the id - will be something like sidebar-integer. +take the first one that matches */ +global $wp_registered_sidebars; + + foreach ($wp_registered_sidebars as $i => $a) { + if ((isset ($a['name'])) and ( $a['name'] === $name)) + return ($i); + } + return (false); +} + +function amr_get_sidebar_name ($id) { /* dont need anymore ? or at least temporarily */ +/* walk through the registered sidebars with a name and find the id - will be something like sidebar-integer. take the first one */ +global $wp_registered_sidebars; + foreach ($wp_registered_sidebars as $i => $a) { + if ((isset ($a['id'])) and ( $a['id'] === $id)) { + if (isset($a['name'])) return ($a['name']); + else return ($id); + } + } + return (false); +} + +function amr_check_if_widget_debug() { +global $said; + // only do these debug if we are logged in and are the administrator + + if (is_admin()) return false; // if running in backend, then do not do debug. 20151217 + + if ((!is_user_logged_in()) or (!current_user_can('administrator'))) + return false; + + if (isset($_REQUEST['do_widget_debug'])) { + if (empty($said)) { + $said = true; + } + else return true; + + $url_without_debug_query = esc_url(remove_query_arg( 'do_widget_debug')); + $eek = 'Remove debug'; + echo '
                    Note: Debug help is only shown to a logged-in Administrator.' + .$eek + .'
                    '; + $text = amr_show_shortcode_widget_possibilities () ; + echo $text; + return true; + } + else + return false; +} + +function amr_show_widget_debug($type='', $name, $id, $sidebar) { +global $wp_registered_sidebars, $wp_registered_widgets, $_wp_sidebars_widgets, $debugcount; +// only do these debug if we are logged in and are the administrator + + $debug = amr_check_if_widget_debug(); + $text = amr_show_shortcode_widget_possibilities () ; + + if ($type=='empty') { + if (current_user_can('administrator')) + $text = '

                    Problem with do_widget shortcode? Try one of the following:

                    '.$text; + } + elseif (($type=='which one') and ($debug)) { + $text = '

                    Debug help is on: Is your widget in the widgets_for_shortcodes sidebar?

                    ' + .$text; + } + + return ($text); +} + +function amr_save_shortcodes_sidebar() { // when switching a theme, save the widgets we use for the shortcodes as they are getting overwritten + $sidebars_widgets = wp_get_sidebars_widgets(); + if (!empty($sidebars_widgets['widgets_for_shortcodes'])) + update_option('sidebars_widgets_for_shortcodes_saved',$sidebars_widgets['widgets_for_shortcodes']); + else { // our shortcodes sidebar is empty but when to fix ? + + } +} + +function amr_restore_shortcodes_sidebar() { // when switching a theme, restore the widgets we use for the shortcodes as they are getting overwritten +global $_wp_sidebars_widgets; + + $sidebars_widgets = wp_get_sidebars_widgets(); + if (empty($sidebars_widgets['widgets_for_shortcodes'])) { + $sidebars_widgets['widgets_for_shortcodes'] = get_option('sidebars_widgets_for_shortcodes_saved'); + update_option('sidebars_widgets',$sidebars_widgets); + + } + +} + +function amr_upgrade_sidebar() { // added in 2014 February for compatibility.. keep for how long. till no sites running older versions.? + $sidebars_widgets = wp_get_sidebars_widgets(); + if (!empty($sidebars_widgets['Shortcodes']) and empty($sidebars_widgets['widgets_for_shortcodes'])) { // we need to upgrade + $sidebars_widgets['widgets_for_shortcodes'] = $sidebars_widgets['Shortcodes']; + unset ($sidebars_widgets['Shortcodes']); + update_option('sidebars_widgets',$sidebars_widgets ); + add_action( 'admin_notices', 'widgets_shortcode_admin_notice' ); + } +} + +function widgets_shortcode_admin_notice() { + ?> +
                    +

                    Please go to widgets page and check your "widgets for shortcodes" sidebar. It will hopefully have been corrected upgraded with your widgets and all should be fine.

                    +
                    + \ No newline at end of file diff --git a/wp-content/plugins/amr-shortcode-any-widget/index.php b/wp-content/plugins/amr-shortcode-any-widget/index.php new file mode 100644 index 0000000..4e6c07c --- /dev/null +++ b/wp-content/plugins/amr-shortcode-any-widget/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-id_ID.po b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-id_ID.po new file mode 100644 index 0000000..e4b235f --- /dev/null +++ b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-id_ID.po @@ -0,0 +1,118 @@ +msgid "" +msgstr "" +"Project-Id-Version: amr shortcode any widget v2.4\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2017-04-03 07:36:42+0000\n" +"Last-Translator: Jordan Silaen \n" +"Language-Team:ChameleonJohn.com \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: CSL v1.x\n" +"X-Poedit-Language: Indonesian\n" +"X-Poedit-Country: Indonesia\n" +"X-Poedit-SourceCharset: utf-8\n" +"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n" +"X-Poedit-Basepath: ../\n" +"X-Poedit-Bookmarks: \n" +"X-Poedit-SearchPath-0: .\n" +"X-Textdomain-Support: yes" + +#: amr-admin-form-html.php:37 +# +msgid "Settings" +msgstr "pengaturan" + +#: amr-admin-form-html.php:63 +# +msgid "Drag the widgets you want to use to the shortcodes sidebar." +msgstr "Tarik widget yang ingin Anda gunakan ke shortcode sidebar." + +#: amr-admin-form-html.php:67 +# +msgid "Set the widgets parameters if there are any." +msgstr "Mengatur parameter widget jika ada." + +#: amr-admin-form-html.php:70 +# +msgid "You could test the widgets out in a displayable widget area (sidebar/footer), then drag them to the widgets_for_shortcodes sidebar." +msgstr "Anda bisa menguji widget di area widget dapat ditampilkan (sidebar / footer), kemudian menyeret mereka ke widgets_for_shortcodes sidebar." + +#: amr-admin-form-html.php:75 +# +msgid "Go to widgets" +msgstr "Pergi ke widget" + +#: amr-admin-form-html.php:81 +# +msgid "To add a widget area - all widgets in the widget area:" +msgstr "Untuk menambahkan area widget - widget semua di daerah widget:" + +#: amr-admin-form-html.php:89 +# +msgid "Create a page with do_widget_area shortcode without the widget_area class" +msgstr "Buat halaman dengan do_widget_area shortcode tanpa kelas widget_area" + +#: amr-admin-form-html.php:96 +# +msgid "Create a page with do_widget_area shortcode" +msgstr "Buat halaman dengan do_widget_area shortcode" + +#: amr-admin-form-html.php:100 +#: amr-admin-form-html.php:117 +# +msgid "Examples:" +msgstr "contoh:" + +#: amr-admin-form-html.php:103 +# +msgid "[do_widget_area] or [do_widget_area widget_area=sidebar-1]" +msgstr "[Do_widget_area] atau [do_widget_area widget_area = sidebar-1]" + +#: amr-admin-form-html.php:106 +# +msgid "NB: Using something like the twenty-fourteen theme? you might end up with white text on a white background. Tweak the widget classes or the html of the wrap or title. If that fails, adjust your css." +msgstr "NB: Menggunakan sesuatu seperti 20-14 tema? Anda mungkin berakhir dengan teks putih pada latar belakang putih. Tweak kelas widget atau html dari bungkus atau judul. Jika itu gagal, menyesuaikan css Anda." + +#: amr-admin-form-html.php:112 +# +msgid "To add a single widget to a page" +msgstr "Untuk menambahkan widget tunggal ke halaman" + +#: amr-admin-form-html.php:116 +# +msgid "Add the shortcode [do_widget widgetname] to a page." +msgstr "Tambahkan shortcode [do_widget widgetname] ke halaman." + +#: amr-admin-form-html.php:120 +# +msgid "[do_widget \"tag cloud\"] or [do_widget id=widgetid]" +msgstr "[Do_widget \ "tag cloud \"] atau [do_widget id = widgetid]" + +#: amr-admin-form-html.php:126 +# +msgid "Create a page with do_widget shortcode and remove widget_classes" +msgstr "Buat halaman dengan do_widget shortcode dan menghapus widget_classes" + +#: amr-admin-form-html.php:133 +# +msgid "Create a page with do_widget shortcode" +msgstr "Buat halaman dengan do_widget shortcode" + +#: amr-admin-form-html.php:174 +# +msgid "If you have any problems with this plugin or good ideas for improvements or new features, please talk about them in the" +msgstr "Jika Anda memiliki masalah dengan plugin ini atau ide-ide yang baik untuk perbaikan atau fitur baru, silakan berbicara tentang mereka dalam" + +#: amr-admin-form-html.php:174 +# +msgid "Support forums" +msgstr "forum dukungan" + +#: amr-shortcode-any-widget.php:306 +# +msgid "Sidebar to hold widgets and their settings. These widgets will be used in a shortcode. This sidebars widgets should be saved with your theme settings now." +msgstr "Sidebar untuk menahan widget dan pengaturan mereka. Widget ini akan digunakan dalam shortcode. Ini sidebars widget harus disimpan dengan pengaturan tema Anda sekarang." + diff --git a/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.mo b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.mo new file mode 100644 index 0000000..972bad8 Binary files /dev/null and b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.mo differ diff --git a/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.po b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.po new file mode 100644 index 0000000..9cbbbc1 --- /dev/null +++ b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget-sr_RS.po @@ -0,0 +1,113 @@ +msgid "" +msgstr "" +"Project-Id-Version: amr shortcode any widget v2.4\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/amr-shortcode-any-widget\n" +"POT-Creation-Date: 2014-09-10 04:32:05+00:00\n" +"PO-Revision-Date: 2015-02-05 07:22:13+0000\n" +"Last-Translator: Borisa Djuraskovic \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Poedit 1.5.7\n" +"X-Poedit-Language: \n" +"X-Poedit-Country: \n" +"X-Poedit-SourceCharset: utf-8\n" +"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n" +"X-Poedit-Basepath: \n" +"X-Poedit-Bookmarks: \n" +"X-Poedit-SearchPath-0: .\n" +"X-Textdomain-Support: yes" + +#: amr-admin-form-html.php:37 +#@ amr-shortcode-any-widget +msgid "Settings" +msgstr "PodeÅ¡avanja" + +#: amr-admin-form-html.php:63 +#@ amr-shortcode-any-widget +msgid "Drag the widgets you want to use to the shortcodes sidebar." +msgstr "Prevucite widget-e koje želite da koristite u shortcode boÄni meni. " + +#: amr-admin-form-html.php:67 +#@ amr-shortcode-any-widget +msgid "Set the widgets parameters if there are any." +msgstr "Podesite parametre widget-a ako ih ima." + +#: amr-admin-form-html.php:70 +#@ amr-shortcode-any-widget +msgid "You could test the widgets out in a displayable widget area (sidebar/footer), then drag them to the widgets_for_shortcodes sidebar." +msgstr "Možete da testirate widget-e u widget oblasti za prikazivanje (boÄni meni/podnožje), a zatim ih prevucite u widgets_for_shortcodes boÄni meni. " + +#: amr-admin-form-html.php:75 +#@ amr-shortcode-any-widget +msgid "Go to widgets" +msgstr "Idite na widget-e" + +#: amr-admin-form-html.php:81 +#@ amr-shortcode-any-widget +msgid "To add a widget area - all widgets in the widget area:" +msgstr "Da biste sve widget-e dodali u widget oblast:" + +#: amr-admin-form-html.php:89 +#@ amr-shortcode-any-widget +msgid "Create a page with do_widget_area shortcode without the widget_area class" +msgstr "Kreirajte stranicu uz shortcode do_widget_area, ali bez widget_area klase" + +#: amr-admin-form-html.php:96 +#@ amr-shortcode-any-widget +msgid "Create a page with do_widget_area shortcode" +msgstr "Kreirajte stranicu uz do_widget_area shortcode" + +#: amr-admin-form-html.php:100 +#: amr-admin-form-html.php:117 +#@ amr-shortcode-any-widget +msgid "Examples:" +msgstr "Primeri:" + +#: amr-admin-form-html.php:103 +#@ amr-shortcode-any-widget +msgid "[do_widget_area] or [do_widget_area widget_area=sidebar-1]" +msgstr "[do_widget_area] ili [do_widget_area widget_area=sidebar-1]" + +#: amr-admin-form-html.php:106 +#@ amr-shortcode-any-widget +msgid "NB: Using something like the twenty-fourteen theme? you might end up with white text on a white background. Tweak the widget classes or the html of the wrap or title. If that fails, adjust your css." +msgstr "Zapamtite: Koristite li neÅ¡to poput 2014 teme? Možete zavrÅ¡iti sa belim tekstom na beloj pozadini. Uzmite klase widget-a ili html sa preloma ili iz naslova. Ako to ne uspe, prilagodite svoj css." + +#: amr-admin-form-html.php:112 +#@ amr-shortcode-any-widget +msgid "To add a single widget to a page" +msgstr "Da biste dodali pojedinaÄni widget stranici" + +#: amr-admin-form-html.php:116 +#@ amr-shortcode-any-widget +msgid "Add the shortcode [do_widget widgetname] to a page." +msgstr "Dodajte shortcode [do_widget widgetname] stranici." + +#: amr-admin-form-html.php:120 +#@ amr-shortcode-any-widget +msgid "[do_widget \"tag cloud\"] or [do_widget id=widgetid]" +msgstr "[do_widget \"tag cloud\"] ili [do_widget id=widgetid]" + +#: amr-admin-form-html.php:126 +#@ amr-shortcode-any-widget +msgid "Create a page with do_widget shortcode and remove widget_classes" +msgstr "Kreirajte stranicu uz pomoć do_widget shortcode i remove widget_classes" + +#: amr-admin-form-html.php:133 +#@ amr-shortcode-any-widget +msgid "Create a page with do_widget shortcode" +msgstr "Kreirajte stranicu koristeći do_widget shortcode" + +#: amr-admin-form-html.php:174 +#@ amr-shortcode-any-widget +msgid "If you have any problems with this plugin or good ideas for improvements or new features, please talk about them in the" +msgstr "Ako imate bilo kakvih problema s ovim plugin-om ili dobre ideje za poboljÅ¡anja, odnosno, nove funkcionalnosti, priÄajte o njima na" + +#: amr-admin-form-html.php:174 +#@ amr-shortcode-any-widget +msgid "Support forums" +msgstr "Forumima za podrÅ¡ku" + diff --git a/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget.pot b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget.pot new file mode 100644 index 0000000..9aa2fa2 --- /dev/null +++ b/wp-content/plugins/amr-shortcode-any-widget/languages/amr-shortcode-any-widget.pot @@ -0,0 +1,138 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: amr shortcode any widget 3.3\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/amr-shortcode-any-" +"widget\n" +"POT-Creation-Date: 2017-04-18 13:56+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION\n" +"X-Generator: Loco - https://localise.biz/" + +#: amr-admin-form-html.php:37 +msgid "Settings" +msgstr "" + +#: amr-admin-form-html.php:63 +msgid "Test your widget in a normal sidebar first." +msgstr "" + +#: amr-admin-form-html.php:65 +msgid "Go to widgets" +msgstr "" + +#: amr-admin-form-html.php:68 +msgid "Drag the widgets you want to use to the shortcodes sidebar." +msgstr "" + +#: amr-admin-form-html.php:71 +msgid "Add a do_widget or do_widget_area shortcode to a page." +msgstr "" + +#: amr-admin-form-html.php:75 +msgid "Create a page with example do_widget shortcode" +msgstr "" + +#: amr-admin-form-html.php:82 +msgid "To add a single widget to a page" +msgstr "" + +#: amr-admin-form-html.php:86 +msgid "Add the shortcode [do_widget widgetname] to a page:" +msgstr "" + +#: amr-admin-form-html.php:93 +msgid "[do_widget \"tag cloud\"] or [do_widget id=widgetid]" +msgstr "" + +#: amr-admin-form-html.php:102 +msgid "More advanced options:" +msgstr "" + +#: amr-admin-form-html.php:111 +msgid "To change the style, change the html:" +msgstr "" + +#: amr-admin-form-html.php:151 +msgid "To add multiple instances of the same widget:" +msgstr "" + +#: amr-admin-form-html.php:161 +msgid "To add a widget area - all widgets in the widget area:" +msgstr "" + +#: amr-admin-form-html.php:169 +msgid "Create a page with do_widget_area shortcode" +msgstr "" + +#: amr-admin-form-html.php:177 +msgid "" +"Create a page with do_widget_area shortcode without the widget_area class" +msgstr "" + +#: amr-admin-form-html.php:181 +msgid "Examples:" +msgstr "" + +#: amr-admin-form-html.php:184 +msgid "[do_widget_area] or [do_widget_area widget_area=sidebar-1]" +msgstr "" + +#: amr-admin-form-html.php:187 +msgid "" +"NB: Using something like the twenty-fourteen theme? you might end up with " +"white text on a white background. Tweak the widget classes or the html of " +"the wrap or title. If that fails, adjust your css." +msgstr "" + +#: amr-admin-form-html.php:199 +msgid "" +"If you have any problems with this plugin or good ideas for improvements or " +"new features, please talk about them in the" +msgstr "" + +#: amr-admin-form-html.php:199 +msgid "Support forums" +msgstr "" + +#: amr-shortcode-any-widget.php:330 +msgid "Widgets for Shortcodes" +msgstr "" + +#: amr-shortcode-any-widget.php:332 +msgid "" +"Sidebar to hold widgets and their settings. These widgets will be used in a " +"shortcode. This sidebars widgets should be saved with your theme settings " +"now." +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "amr shortcode any widget" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"Include any widget in a page for any theme. [do_widget widgetname ] or " +"[do_widget \"widget name\" ] [do_widget id=widgetnamedashed-n ]or include a " +"whole widget area [do_widget_area]. Please read: Installation and FAQ." +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://webdesign.anmari.com/shortcode-any-widget/" +msgstr "" + +#. Author of the plugin/theme +msgid "anmari" +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://webdesign.anmari.com" +msgstr "" diff --git a/wp-content/plugins/amr-shortcode-any-widget/languages/amr_shortcode_any_widget_id_ID.mo b/wp-content/plugins/amr-shortcode-any-widget/languages/amr_shortcode_any_widget_id_ID.mo new file mode 100644 index 0000000..c78b64e Binary files /dev/null and b/wp-content/plugins/amr-shortcode-any-widget/languages/amr_shortcode_any_widget_id_ID.mo differ diff --git a/wp-content/plugins/amr-shortcode-any-widget/readme.txt b/wp-content/plugins/amr-shortcode-any-widget/readme.txt new file mode 100644 index 0000000..2e303ee --- /dev/null +++ b/wp-content/plugins/amr-shortcode-any-widget/readme.txt @@ -0,0 +1,285 @@ +=== amr shortcode any widget === +Contributors: anmari +Tags: shortcode, widget, page, templates, page template, widget_area, sidebar +Tested up to: 5.0.3 +Version: 3.7 +Stable tag: trunk + +== Description == +Insert a widget or multiple widgets or a entire widget area (sidebar) into a page using a shortcode. + +Set up your widget first in a normal sidebar. Check it works. +THEN Drag your chosen widgets to the sidebar called "widgets for shortcode". + +Add the do_widget shortcode to the page where you would like the widget to appear (or the do_widget_area) + +To use in the block editor, add a shortcode block, then type in (including the square brackets [do_widget widgetname] or copy the do_widget tip from the widget in the 'Widgets for Shortcodes' sidebar. + +Please see detailed info on shortcodes and parameters under the installation tab (depending what the plugin directory developers have most recently done, this may be under the FAQ, or at the very least under the readme.) + +Using a widget more than once? + +Reference a specific widget instance from the do_widget shortcode, or the chosen sidebar from the do_widget_area shortcode. Eg: [do_widget id=widget-n] + +For example: You could use the query posts widget in the page to create a archive within a page, or the rss widget to list feed content from other sites. For more details see [anmari.com](http://webdesign.anmari.com/category/plugins/shortcode-any-widget/) + +The plugins default action is that it will magically find the settings for your themes sidebar and use the sidebar html to control the widgets output. In most cases this means the widget will be styled as per the rest of your theme. If that does not look good, parameters exist to try override this behaviour. + +EG: in twenty-fourteen theme widget text ends up being white on white! widget_classes=none fixes that. Eg: [do_widget widget_classes=none yourwidget] + +Changed your theme and worried about losing the sidebar settings ? + +No problem, the plugin will save and restore the widgets_for_shortcode settings. On display it will then pick up the new themes sidebar settings. + +**Note:** + +PLEASE get your widgets working in a sidebar BEFORE activating this plugin, and please read https://wordpress.org/plugins/amr-shortcode-any-widget/installation/ and https://wordpress.org/plugins/amr-shortcode-any-widget/faq/ and/or see the settings page. To see a list of your widgets in their sidebars, add ?do_widget_debug to the page with the do_widget shortcode. + +== Installation == + +1. Test your chosen widget in a normal sidebar or widget area first. +2. Then activate this plugin +3. Go to Appearance > widgets and find the " widgets for shortcode" sidebar or widget area +4. Drag your chosen widget from your normal sidebar to the shortcodes sidebar. Save. +5. Now go to a page and enter a do_widget shortcode The shortcode any widget settings page has some helpful (hopefully) examples and links. + +* [do_widget widgetname] eg: [do_widget calendar] +* [do_widget "widget name"]. eg: [do_widget "tag cloud"] +* [do_widget id=widgetid] . eg: [do_widget id=tag-cloud-3] + +* [do_widget_area] (will use the "widgets in shortcodes" widget area / sidebar +* [do_widget_area sidebarid] or [do_widget_area widget_area=sidebarid] for another sidebar or widget area - eg: to maximise likelihood of getting your theme's widget css to apply. + +**[do_widget ...] Parameters:** + +* *nameofwidget* or name="*nameofwidget*" This is NOT the title of the widget. THis is the name that you see in the widgets menu page even when unassigned to a sidebar. For existing users , you can also use just the name of the widget without name=. It must be the first parameter then. You can only do this with the name, not the id. +* id=*wordpress assigned id of widget*. Examples: id=meta-3, id=tag-cloud-9 etc +* title=false to hide the widgets title OR to override your themes first sidebar html settings for widget titles, use title=*htmltag* where *htmltag* is one of h1,h2,h3,h4,h5,header,strong,em. +* wrap=*htmltag* where *htmltag* is one of div,p,main,aside,section. This will override your themes first sidebar widget wrapping html. +* widget_classes=none This will remove the class "widget" from the wrapping html and the class "widget_title" from the title html. This may be enough to remove any unwanted css caused by your theme. +* class=*yourclassname* By default the plugin will add a class of amr-widget to the wrapping html. You can use this to add any special css. Add css either by editing your themes stylesheet if it is a custom theme, or using something like the wordpress custom css plugin. +* sidebar="*sidebarname*" will default to widgets_for_shortcode sidebar. Only use if you want to re-use a widget already being used in another sidebar. THis is theme dependent and WILL break if you change themes. Safer to use the widget_id. + +**[do_widget_area ...] Parameters:** + +* widget_area=*yourwidgetarea* defaults to 'widgets_for_shortcodes' if nothing entered +* widget_area_class=none /* option to remove theme styling by removing the widget_area class from the sidebar html */ +* widget_classes=none /* option to remove the widget class from the widget wrappinghtml +* class=*yourclassname* default is amr_widget_area. This will affect the widget area NOT the individual widgets. At the moment can only remove the widget classes, not replace them when using do_widget_area. + +Advanced users WARNING: using do_widget_area with a widget area other than the shortcode one means that if you changes themes and the new theme has different sidebars, then this shortcode with a named widget area will not work. + +See the settings page for links to help your create the shortcodes in a page. + +The plugin has been tested with most standard widgets (rss feeds, tag cloud, pages, meta, search, and of course my own plugins widgets - upcoming events list, calendar and user lists. + +If you use a widget more than once for different reasons, you may need to use the widget id to isolate which widget instance and it's settings to use. ie: [do_widget id=categories-6] . If you just use the name, it will display all widgets in the shortcode sidebar with that name (all instances). + + +**If you liked this plugin, you might also like my other plugins:** + +* [icalevents.com](http://icalevents.com) - a ics compliant events plugin fully integrated with wordpress, so it will work with many other plugins (seo, maps, social) +* [wpusersplugin.com](http://wpusersplugin.com) - a suite of plugins to help with membership sites. Major plugin is [amr users](http://wordpress.org/extend/plugins/amr-users/) + +== Frequently Asked Questions == + +PLEASE get your widgets working in a sidebar BEFORE activating this plugin, and PLEASE read the installation instructions (?is the plugin directory showing them!?) and the settings page before asking any questions. + +**Widget help, the widget is doing this, when it should do that** + +Please get the widget working first in a normal sidebar without this plugin and ask for support on the widgets forum it is does not work in a normal sidebar. + +**How to identify widget** + +To identify your widget in the shortcode, use the NAME or the ID. + +The name is the generic NAME like "tag cloud". + +The id is how wordpress identifies the instance of the widget. The id is visible at the bottom of the widget settings box. + +**Styling, your theme, css, overriding** + +Yes anything could happen wrt the appearance.(There are tens of 1000s of themes and widgets. Multiply out the possible combinations. Add in css specifity, inheritance and cascading rules. Consider you are moving the widget out of the sidebar where the the theme and widget plugin expect it to be. ) The effects are very dependent on how your theme has specified the css that may apply to widgets and sidebars/widget areas. + +It may work beautifully and have the content looking like it belongs with your theme. + +This plugin tries to help encourage that 'belonging' look. If it fails then it offers ways to switch the html and/or the classes being generated. + + +Examples: +* you may have undesired effects applying that do not work in the main content area +* You may have desired effects not applying because the css is specific to a themes sidebar and does not apply to the html in a page. + +The plugin can help a bit - Via the plugin you can do the following to affect styling: + +* Remove the general wordpress 'widget' class from the widgets wrapping html and the 'widget_title' from the title html. ([do_widget *widgetname* widget_classes=none] + +* Change the 'wrap' html and the title html with parameters wrap=div title=h3. See the settings page. + +* Apply an existing class in your theme. Use [do_widget *widgetname* class=*yourclass*]. + +* Use the additional class 'amr-widget' provided to specify alternate css in your themes stylesheet or with something like wordpress custom css. + +One of the new features is as a default setting is that the plugin will try have your current themes first sidebar styling apply to the widgets inserted into a page via the shortcode. + +Many folks requested this, insisting that absolutely this is what should be happening and why didn't it? Well..This could be great - Imagine: a plugin that can pick up the theme styling and change it as your theme changes. + +The success of this depends very much on how your theme specifies it's css. Does it always use classes ? - more css will apply. Does it lock the css down by sidebar-id: that css will not apply. + +It also depends on what the original widget plugin does with css and js. It may have done something thinking that the widget will always be inside a sidebar and not anticipated being in a page. This the shortcde-any-widget plugin has no control over. + +For example: An unwanted effect could be white text on a white background as in the twenty fourteen theme. + +**If you have an undesired styling effect with the default settings:** + +You need to learn the joys of the 'inspect element' tools in various browsers or browser web developer, firebug add-ons, so you can see what css is applying to what html. Then you can either change some of the html or override or change the css. + +Options if you don't like the default result: + +Use the 'amr-widget' class that has been added to the widget wrapping html to override any css. + +eg: +.amr-widget [ +color: #000000; +} + +Tap into a class you already have in your theme: + +[do_widget class=yourclass] + +Change the html that the shortcode-any-widget plugin will use. + +eg: don't like the h3.widget-title styling ? change the title html to h2 in the shotcode parameters + +[do_widget title=h2] + +eg: don't like the 'aside' wrapping html styling? change the wrapping html: + +[do_widget wrap=div] + +If you only using widget, maybe inserting the whole sidebar or widgertarea would give an interesting effect. Sidebar background css may apply. + +[do_widget_area] + +== Changelog == += Version 3.6 = +* Found a mixed line ending. Updated. +* Tested on 5.0.3 and 5.1beta, with php 7.3.1 + += Version 3.6 = +* Basically forcing an update in the hope that the third party php7compatibility checker sort itself out. It's complaining about mixed line endings, but they're not. +* Added indonesian translation provided by Jordan Silaen. + += Version 3.5 = +* Adds info showing you on which pages, posts etc you are using a do_widget or do_widget_area shortcode, just in case you forget. + += Version 3.4 = +* Retested on wordpres 4.7 and 4.8 alpha and forcing update because of plugin directory needs trigger temporarily to show the installation instructions + += Version 3.3 = +* Retested on wordpres 4.5 and 4.5.1-alpha +* Re-instated the saving of widgets in the shortcode sidebar on theme switch and the reloading of these saved widgets when theme is reactivated (Was commented out for awhile back in 2014, but appears to be working well and very useful when you changing a theme but maybe forgotten about this page that has widget on it - yeah that could be bad ! + += Version 3.2 = +* tweaked some error messages and handle situation better where there are no widgets or possibly empty sidebars. + += Version 3.1 = +* added code for the widget-id to appear in the widget settings window. +* removed lots of the 'debug' as it will hopefully no longer be needed. +* most error messages will now be returned in the shortcode, not echoed at top of page. +* the do_widget_debug lists less, but hopefully more usefully a list of the do_widget and do_widget_area options based on your sidebars and the widgets in them. + += Version 3 = +* added code to not output anything if in admin (eg: in edit/save mode) in case something has forced application of content filters when saving (and not all widget stuff is active, so errors are output. +* prefixed unprefixed function names to avoid conflicts + += Version 2.9 = +* in debug help, the link to the installation page help was not properly setup. Fixed. + += Version 2.8 = +* Tested on 4.3.1 +* No real functional change. +* Tweaked debug info to look a little prettier. Also some error messages will not show unless you haev requested debug (?do_widiet_debug) to try to avoid the message that some genesis theme users are experiencing. I have not been able to recreate this with the genesis theme myself - it might be a plugin that they are using. + + += Version 2.6 = +* Tested on 4.2 +* Removed from admin settings area the use of add_query_arg (unnecessary) +* Added esc_url to widget id 'debug' oage just in case (it is only accessed by logged in admin, but lets be safe and keep everyone happy if the see the add_query_arg and remove_query_arg + += Version 2.5 = +* Tested on 4.1.1, Linked to the settings help page from the plugin action menu. +* Changed the readme a bit to try further aid understanding and reduce support issues +* Updated some screenshots. + += Version 2.4 = +* Tested on 4.1, Cleaned up the readme, Lang file for info page - most texts. + += Version 2.3 = +* Fixed some widget area class options that were not working. +* Added a widget area debug option to make it easier to find how your theme has stored it's widget area / sidebar ids. They are not always easy to find. +* Tested on 3.9.1 +* Updated readme + += Version 2.2 = +* Attempt to add more styling control. +* Add widget_classes=none to reverse out widget type class. NOte to totally override wordpress widget +* Add widget_area_class=none + += Version 2.1 = +* Bug Fix - last sidebar registered by theme was being overwritten by the attempt to copy the themes sidebar arguments so that cleverly (hopefully) the shortcode widgets would pick up the same styling. Fixed now. Now it really does pickup the first sidebars styling - with devasting consquence in twenty-fourteen theme - yes white text on white background is not fun to read. But on other themes it works a treat. + + += Version 2 = +* Shortcode widget id changed so that wordpress will save the shortcode settings per theme. +* Added Code to auto upgrade, but just in case please check your widgets page. Look at the inactive widgets if the widgets are not in your widgets for shortcodes sidebar. +* Logic added on theme switching to save shortcode widget settings and restore them after the theme switch, so you can play with themes and not have to set up your widgets again. WP kept putting them into an 'inactive sidebar'. +* Added, as requested by a few of you, the ability to add a class and control the html around the widget without having to enter html around the shortcode has been added. See the settings page for instructions. +* Added the ability to specify what html should be used for the title and the widget wrap, so that you can more easily either match your theme or get away from your thesmes widget styling. +* Added ability to insert a whole widget area into the page. The default will be the "widgets for shortcode" sidebar/widget area. You can specify others. Note Specifying other widget areas may be theme dependent, ie: switch and you'll lose that page. +* Added classes amr-widget and amr-widget-area so one can target the widgets in the page to adjust css. + += Version 1.8 = +* Whoops - had renamed the main file and forgot to delete it from the svn. Forcing a version number change to ensure files get cleaned up for everyone + += Version 1.7 = +* Change: Changed so that debugs and debug prompt will only show to a logged in administrator. + += Version 1.6 = +* Add: added a settings page to help people out (not really settings) +* Fix: changed a clashing function name + += Version 1.5 = +* Fixed: a small bug which caused a warning if you had not saved the widgets in your shortcode sidebar + += Version 1.4 = +* Updated readme - made very detailed steps and added some screen shots. +* Tested on wp 3.3.1 and fixed some notices when bad parameters entered. + += Version 1.3 = +* Added debug link and retested. Added readme. + += 1.12 = +* Changed dummy shortcode sidebar so it appears after the theme sidebars to avoid taking over their widgets (this happened in numbered sidebars) PLEASE note if you have upgraded, you may appear to have "lost" your widgets due to this sidebar change. You have not - they will be in your "inactive widgets" - please drag them to the new sidebar. You may also find that you have 2 versions of the plugin, with slightly different folder names. This will allow you to go back to the previous one to check what you had there if you need to. Deactivate the old one and activate the new one. Move your widgets back in. Test then Delete the old one. In one theme it also appeared that somehow due to this change, one of the sidebar widgets "moved" down to another sidebar. I think that this may have had something to do with the fact that sidebars can be numbered or named, so please check all your sidebars before continuing. As always make sure thath you know how to restore from a backup before doing any upgrades of any kind. +* Tested in 2.9.2, can still use either the widget name "Categories" or id=categories-6. Note widget must have been created in the dummy shortcode sidebar. + += 1.1 = + +* Allow for lowercase use of widget names for the those challenged by attention to detail! +* Cleaned up debug mode to make it easier for people to identify which instance of a widget they are using. Add &do_widget_debug to url string. + += 1.0 = +* Launch of the plugin + +== Screenshots == + +1. setting up widgets in the widgets for shortcode sidebar. The widget's user interface (UI) is used to provide a UI for the do_widget shortcode. +2. add shortcode for widgets in a page (must be in the widgets for shortcode sidebar) +3. widgets in a page +4. with the default widget class and with widget_classes=none +two rss feed widgets in shortcode sidebar - both will show if just name used +5. The widget id is now visible in the widget window +6. After clicking on debug message - scroll down till you see the shortcodes sidebar - the widgets and their ids will be listed. Find the id of the widget you want. +7. Shortcode parameters to remove widget-classes in theme like the twenty-fourteen theme (avoid white text on white background) +8. Example of multiple rss widgets in twenty-fourteen theme + \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/LICENSE.txt b/wp-content/plugins/antispam-bee/LICENSE.txt new file mode 100644 index 0000000..23cb790 --- /dev/null +++ b/wp-content/plugins/antispam-bee/LICENSE.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/wp-content/plugins/antispam-bee/antispam_bee.php b/wp-content/plugins/antispam-bee/antispam_bee.php new file mode 100755 index 0000000..f1a0c16 --- /dev/null +++ b/wp-content/plugins/antispam-bee/antispam_bee.php @@ -0,0 +1,2852 @@ +query( 'OPTIMIZE TABLE `' . $wpdb->options . '`' ); + + //phpcs:disable WordPress.WP.PreparedSQL.NotPrepared + $sql = 'delete from `' . $wpdb->commentmeta . '` where `meta_key` IN ("antispam_bee_iphash", "antispam_bee_reason")'; + $wpdb->query( $sql ); + //phpcs:enable WordPress.WP.PreparedSQL.NotPrepared + } + + + + /* + * ############################ + * ######## INTERNAL ######## + * ############################ + */ + + /** + * Initialization of the internal variables + * + * @since 2.4 + * @change 2.7.0 + */ + private static function _init_internal_vars() { + self::$_base = plugin_basename( __FILE__ ); + + $salt = defined( 'NONCE_SALT' ) ? NONCE_SALT : ABSPATH; + self::$_salt = substr( sha1( $salt ), 0, 10 ); + + self::$defaults = array( + 'options' => array( + 'advanced_check' => 1, + 'regexp_check' => 1, + 'spam_ip' => 1, + 'already_commented' => 1, + 'gravatar_check' => 0, + 'time_check' => 0, + 'ignore_pings' => 0, + 'always_allowed' => 0, + + 'dashboard_chart' => 0, + 'dashboard_count' => 0, + + 'country_code' => 0, + 'country_black' => '', + 'country_white' => '', + + 'translate_api' => 0, + 'translate_lang' => array(), + + 'bbcode_check' => 1, + + 'flag_spam' => 1, + 'email_notify' => 0, + 'no_notice' => 0, + 'cronjob_enable' => 0, + 'cronjob_interval' => 0, + + 'ignore_filter' => 0, + 'ignore_type' => 0, + + 'reasons_enable' => 0, + 'ignore_reasons' => array(), + + 'delete_data_on_uninstall' => 1, + ), + 'reasons' => array( + 'css' => esc_attr__( 'Honeypot', 'antispam-bee' ), + 'time' => esc_attr__( 'Comment time', 'antispam-bee' ), + 'empty' => esc_attr__( 'Empty Data', 'antispam-bee' ), + 'server' => esc_attr__( 'Fake IP', 'antispam-bee' ), + 'localdb' => esc_attr__( 'Local DB Spam', 'antispam-bee' ), + 'country' => esc_attr__( 'Country Check', 'antispam-bee' ), + 'bbcode' => esc_attr__( 'BBCode', 'antispam-bee' ), + 'lang' => esc_attr__( 'Comment Language', 'antispam-bee' ), + 'regexp' => esc_attr__( 'Regular Expression', 'antispam-bee' ), + 'title_is_name' => esc_attr__( 'Identical Post title and blog title', 'antispam-bee' ), + ), + ); + } + + /** + * Check and return an array key + * + * @since 2.4.2 + * @change 2.4.2 + * + * @param array $array Array with values. + * @param string $key Name of the key. + * @return mixed Value of the requested key. + */ + public static function get_key( $array, $key ) { + if ( empty( $array ) || empty( $key ) || empty( $array[ $key ] ) ) { + return null; + } + + return $array[ $key ]; + } + + + /** + * Localization of the admin pages + * + * @since 0.1 + * @change 2.4 + * + * @param string $page Mark the page. + * @return boolean True on success. + */ + private static function _current_page( $page ) { + // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification + switch ( $page ) { + case 'dashboard': + return ( empty( $GLOBALS['pagenow'] ) || ( ! empty( $GLOBALS['pagenow'] ) && 'index.php' === $GLOBALS['pagenow'] ) ); + + case 'options': + return ( ! empty( $_GET['page'] ) && 'antispam_bee' === $_GET['page'] ); + + case 'plugins': + return ( ! empty( $GLOBALS['pagenow'] ) && 'plugins.php' === $GLOBALS['pagenow'] ); + + case 'admin-post': + return ( ! empty( $GLOBALS['pagenow'] ) && 'admin-post.php' === $GLOBALS['pagenow'] ); + + case 'edit-comments': + return ( ! empty( $GLOBALS['pagenow'] ) && 'edit-comments.php' === $GLOBALS['pagenow'] ); + + default: + return false; + } + // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification + } + + + /** + * Integration of the localization file + * + * @since 0.1 + * @change 2.4 + */ + public static function load_plugin_lang() { + load_plugin_textdomain( + 'antispam-bee' + ); + } + + + /** + * Add the link to the settings + * + * @since 1.1 + * @change 1.1 + * + * @param array $data The action link array. + * @return array $data The action link array. + */ + public static function init_action_links( $data ) { + if ( ! current_user_can( 'manage_options' ) ) { + return $data; + } + + return array_merge( + $data, + array( + sprintf( + '%s', + add_query_arg( + array( + 'page' => 'antispam_bee', + ), + admin_url( 'options-general.php' ) + ), + esc_attr__( 'Settings', 'antispam-bee' ) + ), + ) + ); + } + + /** + * Meta links of the plugin + * + * @since 0.1 + * @change 2.6.2 + * + * @param array $input Existing links. + * @param string $file Current page. + * @return array $data Modified links. + */ + public static function init_row_meta( $input, $file ) { + if ( $file !== self::$_base ) { + return $input; + } + + return array_merge( + $input, + array( + '' . esc_html__( 'Donate', 'antispam-bee' ) . '', + '' . esc_html__( 'Support', 'antispam-bee' ) . '', + ) + ); + } + + /* + * ############################ + * ####### RESOURCES ######## + * ############################ + */ + + /** + * Registration of resources (CSS & JS) + * + * @since 1.6 + * @change 2.4.5 + */ + public static function init_plugin_sources() { + $plugin = get_plugin_data( __FILE__ ); + + wp_register_script( + 'ab_script', + plugins_url( 'js/scripts.min.js', __FILE__ ), + array( 'jquery' ), + $plugin['Version'] + ); + + wp_register_style( + 'ab_style', + plugins_url( 'css/styles.min.css', __FILE__ ), + array( 'dashicons' ), + $plugin['Version'] + ); + } + + + /** + * Initialization of the option page + * + * @since 0.1 + * @change 2.4.3 + */ + public static function add_sidebar_menu() { + $page = add_options_page( + 'Antispam Bee', + 'Antispam Bee', + 'manage_options', + 'antispam_bee', + array( + 'Antispam_Bee_GUI', + 'options_page', + ) + ); + + add_action( + 'admin_print_scripts-' . $page, + array( + __CLASS__, + 'add_options_script', + ) + ); + + add_action( + 'admin_print_styles-' . $page, + array( + __CLASS__, + 'add_options_style', + ) + ); + + add_action( + 'load-' . $page, + array( + __CLASS__, + 'init_options_page', + ) + ); + } + + + /** + * Initialization of JavaScript + * + * @since 1.6 + * @change 2.4 + */ + public static function add_options_script() { + wp_enqueue_script( 'ab_script' ); + } + + + /** + * Initialization of Stylesheets + * + * @since 1.6 + * @change 2.4 + */ + public static function add_options_style() { + wp_enqueue_style( 'ab_style' ); + } + + + /** + * Integration of the GUI + * + * @since 2.4 + * @change 2.4 + */ + public static function init_options_page() { + require_once dirname( __FILE__ ) . '/inc/gui.class.php'; + } + + + + /* + * ############################ + * ####### DASHBOARD ######## + * ############################ + */ + + /** + * Display the spam counter on the dashboard + * + * @since 0.1 + * @change 2.6.5 + * + * @param array $items Initial array with dashboard items. + * @return array $items Merged array with dashboard items. + */ + public static function add_dashboard_count( $items = array() ) { + if ( ! current_user_can( 'manage_options' ) || ! self::get_option( 'dashboard_count' ) ) { + return $items; + } + + echo ''; + + $items[] = '' . esc_html( + sprintf( + // translators: The number of spam comments Antispam Bee blocked so far. + __( '%d Blocked', 'antispam-bee' ), + self::_get_spam_count() + ) + ) . ''; + + return $items; + } + + /** + * Initialize the dashboard chart + * + * @since 1.9 + * @change 2.5.6 + */ + public static function add_dashboard_chart() { + if ( ! current_user_can( 'publish_posts' ) || ! self::get_option( 'dashboard_chart' ) ) { + return; + } + + wp_add_dashboard_widget( + 'ab_widget', + 'Antispam Bee', + array( + __CLASS__, + 'show_spam_chart', + ) + ); + + add_action( + 'admin_head', + array( + __CLASS__, + 'add_dashboard_style', + ) + ); + } + + /** + * Print dashboard styles + * + * @since 1.9.0 + * @change 2.5.8 + */ + public static function add_dashboard_style() { + $plugin = get_plugin_data( __FILE__ ); + + wp_register_style( + 'ab_chart', + plugins_url( 'css/dashboard.min.css', __FILE__ ), + array(), + $plugin['Version'] + ); + + wp_print_styles( 'ab_chart' ); + } + + + /** + * Print dashboard scripts + * + * @since 1.9.0 + * @change 2.5.8 + */ + public static function add_dashboard_script() { + if ( ! self::get_option( 'daily_stats' ) ) { + return; + } + + $plugin = get_plugin_data( __FILE__ ); + + wp_enqueue_script( + 'raphael', + plugins_url( 'js/raphael.min.js', __FILE__ ), + array(), + '2.1.0', + true + ); + + wp_enqueue_script( + 'ab-raphael', + plugins_url( 'js/raphael.helper.min.js', __FILE__ ), + array( 'raphael' ), + $plugin['Version'], + true + ); + + wp_enqueue_script( + 'ab_chart_js', + plugins_url( 'js/dashboard.min.js', __FILE__ ), + array( 'jquery', 'ab-raphael' ), + $plugin['Version'], + true + ); + } + + /** + * Print dashboard html + * + * @since 1.9.0 + * @change 2.5.8 + */ + public static function show_spam_chart() { + $items = (array) self::get_option( 'daily_stats' ); + + if ( empty( $items ) ) { + echo sprintf( + '

                    %s

                    ', + esc_html__( 'No data available.', 'antispam-bee' ) + ); + + return; + } + + self::add_dashboard_script(); + + ksort( $items, SORT_NUMERIC ); + + $html = "\n"; + + $html .= "\n"; + foreach ( $items as $date => $count ) { + $html .= '\n"; + } + $html .= "\n"; + + $html .= "\n"; + foreach ( $items as $date => $count ) { + $html .= '\n"; + } + $html .= "\n"; + + $html .= "
                    ' . date_i18n( 'j. F Y', $date ) . "
                    ' . (int) $count . "
                    \n"; + + echo wp_kses_post( '
                    ' . $html . '
                    ' ); + } + + /* + * ############################ + * ######## OPTIONS ######### + * ############################ + */ + + /** + * Get all plugin options + * + * @since 2.4 + * @change 2.6.1 + * + * @return array $options Array with option fields. + */ + public static function get_options() { + $options = wp_cache_get( 'antispam_bee' ); + if ( ! $options ) { + wp_cache_set( + 'antispam_bee', + $options = get_option( 'antispam_bee' ) + ); + } + + return wp_parse_args( + $options, + self::$defaults['options'] + ); + } + + /** + * Get single option field + * + * @since 0.1 + * @change 2.4.2 + * + * @param string $field Field name. + * @return mixed Field value. + */ + public static function get_option( $field ) { + $options = self::get_options(); + + return self::get_key( $options, $field ); + } + + + /** + * Update single option field + * + * @since 0.1 + * @change 2.4 + * + * @param string $field Field name. + * @param mixed $value The Field value. + */ + private static function _update_option( $field, $value ) { + self::update_options( + array( + $field => $value, + ) + ); + } + + + /** + * Update multiple option fields + * + * @since 0.1 + * @change 2.6.1 + * + * @param array $data Array with plugin option fields. + */ + public static function update_options( $data ) { + $options = get_option( 'antispam_bee' ); + + if ( is_array( $options ) ) { + $options = array_merge( + $options, + $data + ); + } else { + $options = $data; + } + + update_option( + 'antispam_bee', + $options + ); + + wp_cache_set( + 'antispam_bee', + $options + ); + } + + + + /* + * ############################ + * ######## CRONJOBS ######## + * ############################ + */ + + /** + * Execution of the daily cronjobs + * + * @since 0.1 + * @change 2.4 + */ + public static function start_daily_cronjob() { + if ( ! self::get_option( 'cronjob_enable' ) ) { + return; + } + + self::_update_option( + 'cronjob_timestamp', + time() + ); + + self::_delete_old_spam(); + } + + + /** + * Delete old spam comments + * + * @since 0.1 + * @change 2.4 + */ + private static function _delete_old_spam() { + $days = (int) self::get_option( 'cronjob_interval' ); + + if ( empty( $days ) ) { + return false; + } + + global $wpdb; + + $wpdb->query( + $wpdb->prepare( + "DELETE FROM `$wpdb->comments` WHERE `comment_approved` = 'spam' AND SUBDATE(NOW(), %d) > comment_date_gmt", + $days + ) + ); + + $wpdb->query( "OPTIMIZE TABLE `$wpdb->comments`" ); + } + + + /** + * Initialization of the cronjobs + * + * @since 0.1 + * @change 2.4 + */ + public static function init_scheduled_hook() { + if ( ! wp_next_scheduled( 'antispam_bee_daily_cronjob' ) ) { + wp_schedule_event( + time(), + 'daily', + 'antispam_bee_daily_cronjob' + ); + } + } + + + /** + * Deletion of the cronjobs + * + * @since 0.1 + * @change 2.4 + */ + public static function clear_scheduled_hook() { + if ( wp_next_scheduled( 'antispam_bee_daily_cronjob' ) ) { + wp_clear_scheduled_hook( 'antispam_bee_daily_cronjob' ); + } + } + + + + /* + * ############################ + * ###### SPAM CHECK ######## + * ############################ + */ + + /** + * Check POST values + * + * @since 0.1 + * @change 2.6.3 + */ + public static function precheck_incoming_request() { + // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification + if ( is_feed() || is_trackback() || empty( $_POST ) || self::_is_mobile() ) { + return; + } + + $request_uri = self::get_key( $_SERVER, 'REQUEST_URI' ); + $request_path = self::parse_url( $request_uri, 'path' ); + + if ( strpos( $request_path, 'wp-comments-post.php' ) === false ) { + return; + } + + $post_id = (int) self::get_key( $_POST, 'comment_post_ID' ); + $hidden_field = self::get_key( $_POST, 'comment' ); + $plugin_field = self::get_key( $_POST, self::get_secret_name_for_post( $post_id ) ); + + if ( empty( $hidden_field ) && ! empty( $plugin_field ) ) { + $_POST['comment'] = $plugin_field; + unset( $_POST[ self::get_secret_name_for_post( $post_id ) ] ); + } else { + $_POST['ab_spam__hidden_field'] = 1; + } + // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification + } + + + /** + * Check incoming requests for spam + * + * @since 0.1 + * @change 2.6.3 + * + * @param array $comment Untreated comment. + * @return array $comment Treated comment. + */ + public static function handle_incoming_request( $comment ) { + $comment['comment_author_IP'] = self::get_client_ip(); + + $request_uri = self::get_key( $_SERVER, 'REQUEST_URI' ); + $request_path = self::parse_url( $request_uri, 'path' ); + + if ( empty( $request_path ) ) { + return self::_handle_spam_request( + $comment, + 'empty' + ); + } + + $ping = array( + 'types' => array( 'pingback', 'trackback', 'pings' ), + 'allowed' => ! self::get_option( 'ignore_pings' ), + ); + + // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification + // Everybody can post. + if ( strpos( $request_path, 'wp-comments-post.php' ) !== false && ! empty( $_POST ) ) { + // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification + $status = self::_verify_comment_request( $comment ); + + if ( ! empty( $status['reason'] ) ) { + return self::_handle_spam_request( + $comment, + $status['reason'] + ); + } + } elseif ( in_array( self::get_key( $comment, 'comment_type' ), $ping['types'], true ) && $ping['allowed'] ) { + $status = self::_verify_trackback_request( $comment ); + + if ( ! empty( $status['reason'] ) ) { + return self::_handle_spam_request( + $comment, + $status['reason'], + true + ); + } + } + + return $comment; + } + + + /** + * Prepares the replacement of the comment field + * + * @since 0.1 + * @change 2.4 + */ + public static function prepare_comment_field() { + if ( is_feed() || is_trackback() || is_robots() || self::_is_mobile() ) { + return; + } + + if ( ! is_singular() && ! self::get_option( 'always_allowed' ) ) { + return; + } + + ob_start( + array( + 'Antispam_Bee', + 'replace_comment_field', + ) + ); + } + + + /** + * Replaces the comment field + * + * @since 2.4 + * @change 2.6.4 + * + * @param string $data HTML code of the website. + * @return string Treated HTML code. + */ + public static function replace_comment_field( $data ) { + if ( empty( $data ) ) { + return; + } + + if ( ! preg_match( '# (?# match the whole textarea tag ) + '; + + $output .= $id_script; + $output .= $init_time_field; + + return $output; + } + + + /** + * Check the trackbacks + * + * @since 2.4 + * @change 2.7.0 + * + * @param array $comment Trackback data. + * @return array Array with suspected reason. + */ + private static function _verify_trackback_request( $comment ) { + $ip = self::get_key( $comment, 'comment_author_IP' ); + $url = self::get_key( $comment, 'comment_author_url' ); + $body = self::get_key( $comment, 'comment_content' ); + $post_id = self::get_key( $comment, 'comment_post_ID' ); + $type = self::get_key( $comment, 'comment_type' ); + $blog_name = self::get_key( $comment, 'comment_author' ); + + if ( empty( $url ) || empty( $body ) ) { + return array( + 'reason' => 'empty', + ); + } + + if ( empty( $ip ) ) { + return array( + 'reason' => 'empty', + ); + } + + if ( 'pingback' === $type && self::_pingback_from_myself( $url, $post_id ) ) { + return; + } + + if ( self::is_trackback_post_title_blog_name_spam( $body, $blog_name ) ) { + return array( + 'reason' => 'title_is_name', + ); + } + + $options = self::get_options(); + + if ( $options['bbcode_check'] && self::_is_bbcode_spam( $body ) ) { + return array( + 'reason' => 'bbcode', + ); + } + + if ( $options['advanced_check'] && self::_is_fake_ip( $ip, self::parse_url( $url, 'host' ) ) ) { + return array( + 'reason' => 'server', + ); + } + + if ( $options['spam_ip'] && self::_is_db_spam( $ip, $url ) ) { + return array( + 'reason' => 'localdb', + ); + } + + if ( $options['country_code'] && self::_is_country_spam( $ip ) ) { + return array( + 'reason' => 'country', + ); + } + + if ( $options['translate_api'] && self::_is_lang_spam( $body ) ) { + return array( + 'reason' => 'lang', + ); + } + + if ( $options['regexp_check'] && self::_is_regexp_spam( + array( + 'ip' => $ip, + 'rawurl' => $url, + 'host' => self::parse_url( $url, 'host' ), + 'body' => $body, + 'email' => '', + 'author' => '', + ) + ) ) { + return array( + 'reason' => 'regexp', + ); + } + } + + /** + * Check, if I pinged myself. + * + * @since 2.8.2 + * + * @param string $url The URL from where the ping came. + * @param int $target_post_id The post ID which has been pinged. + * + * @return bool + */ + private static function _pingback_from_myself( $url, $target_post_id ) { + + if ( 0 !== strpos( $url, home_url() ) ) { + return false; + } + + $original_post_id = (int) url_to_postid( $url ); + if ( ! $original_post_id ) { + return false; + } + + $post = get_post( $original_post_id ); + if ( ! $post ) { + return false; + } + + $urls = wp_extract_urls( $post->post_content ); + $url_to_find = get_permalink( $target_post_id ); + if ( ! $url_to_find ) { + return false; + } + foreach ( $urls as $url ) { + if ( strpos( $url, $url_to_find ) === 0 ) { + return true; + } + } + return false; + } + + /** + * Check the comment + * + * @since 2.4 + * @change 2.7.0 + * + * @param array $comment Data of the comment. + * @return array|void Array with suspected reason + */ + private static function _verify_comment_request( $comment ) { + $ip = self::get_key( $comment, 'comment_author_IP' ); + $url = self::get_key( $comment, 'comment_author_url' ); + $body = self::get_key( $comment, 'comment_content' ); + $email = self::get_key( $comment, 'comment_author_email' ); + $author = self::get_key( $comment, 'comment_author' ); + + if ( empty( $body ) ) { + return array( + 'reason' => 'empty', + ); + } + + if ( empty( $ip ) ) { + return array( + 'reason' => 'empty', + ); + } + + if ( get_option( 'require_name_email' ) && ( empty( $email ) || empty( $author ) ) ) { + return array( + 'reason' => 'empty', + ); + } + + $options = self::get_options(); + + if ( $options['already_commented'] && ! empty( $email ) && self::_is_approved_email( $email ) ) { + return; + } + + if ( $options['gravatar_check'] && ! empty( $email ) && 1 === (int) get_option( 'show_avatars', 0 ) && self::_has_valid_gravatar( $email ) ) { + return; + } + + // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification + if ( ! empty( $_POST['ab_spam__hidden_field'] ) ) { + return array( + 'reason' => 'css', + ); + } + // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification + + if ( $options['time_check'] && self::_is_shortest_time() ) { + return array( + 'reason' => 'time', + ); + } + + if ( $options['bbcode_check'] && self::_is_bbcode_spam( $body ) ) { + return array( + 'reason' => 'bbcode', + ); + } + + if ( $options['advanced_check'] && self::_is_fake_ip( $ip ) ) { + return array( + 'reason' => 'server', + ); + } + + if ( $options['regexp_check'] && self::_is_regexp_spam( + array( + 'ip' => $ip, + 'rawurl' => $url, + 'host' => self::parse_url( $url, 'host' ), + 'body' => $body, + 'email' => $email, + 'author' => $author, + ) + ) ) { + return array( + 'reason' => 'regexp', + ); + } + + if ( $options['spam_ip'] && self::_is_db_spam( $ip, $url, $email ) ) { + return array( + 'reason' => 'localdb', + ); + } + + if ( $options['country_code'] && self::_is_country_spam( $ip ) ) { + return array( + 'reason' => 'country', + ); + } + + if ( $options['translate_api'] && self::_is_lang_spam( $body ) ) { + return array( + 'reason' => 'lang', + ); + } + } + + + /** + * Check for a Gravatar image + * + * @since 2.6.5 + * @change 2.6.5 + * + * @param string $email Input email. + * @return boolean Check status (true = Gravatar available). + */ + private static function _has_valid_gravatar( $email ) { + $response = wp_safe_remote_get( + sprintf( + 'https://www.gravatar.com/avatar/%s?d=404', + md5( strtolower( trim( $email ) ) ) + ) + ); + + if ( is_wp_error( $response ) ) { + return null; + } + + if ( wp_remote_retrieve_response_code( $response ) === 200 ) { + return true; + } + + return false; + } + + + /** + * Check for comment action time + * + * @since 2.6.4 + * @change 2.6.4 + * + * @return boolean TRUE if the action time is less than 5 seconds + */ + private static function _is_shortest_time() { + // phpcs:disable WordPress.CSRF.NonceVerification.NoNonceVerification + // Everybody can Post. + $init_time = (int) self::get_key( $_POST, 'ab_init_time' ); + // phpcs:enable WordPress.CSRF.NonceVerification.NoNonceVerification + if ( 0 === $init_time ) { + return false; + } + + if ( time() - $init_time < apply_filters( 'ab_action_time_limit', 5 ) ) { + return true; + } + + return false; + } + + /** + * Check if the blog name and the title of the blog post from which the trackback originates are equal. + * + * @since 2.6.4 + * + * @param string $body The comment body. + * @param string $blog_name The name of the blog. + * + * @return bool + */ + private static function is_trackback_post_title_blog_name_spam( $body, $blog_name ) { + preg_match( '/(.*)<\/strong>\\n\\n/', $body, $matches ); + if ( ! isset( $matches[1] ) ) { + return false; + } + return trim( $matches[1] ) === trim( $blog_name ); + } + + + /** + * Usage of regexp, also custom + * + * @since 2.5.2 + * @change 2.5.6 + * + * @param array $comment Array with commentary data. + * @return boolean True for suspicious comment. + */ + private static function _is_regexp_spam( $comment ) { + $fields = array( + 'ip', + 'host', + 'body', + 'email', + 'author', + ); + + $patterns = array( + array( + 'host' => '^(www\.)?\d+\w+\.com$', + 'body' => '^\w+\s\d+$', + 'email' => '@gmail.com$', + ), + array( + 'body' => '\<\!.+?mfunc.+?\>', + ), + array( + 'author' => 'moncler|north face|vuitton|handbag|burberry|outlet|prada|cialis|viagra|maillot|oakley|ralph lauren|ray ban|iphone|プラダ', + ), + array( + 'host' => '^(www\.)?fkbook\.co\.uk$|^(www\.)?nsru\.net$|^(www\.)?goo\.gl$|^(www\.)?bit\.ly$', + ), + array( + 'body' => 'target[t]?ed (visitors|traffic)|viagra|cialis', + ), + array( + 'body' => 'purchase amazing|buy amazing', + ), + array( + 'body' => 'dating|sex|lotto|pharmacy', + 'email' => '@mail\.ru|@yandex\.', + ), + ); + + $quoted_author = preg_quote( $comment['author'], '/' ); + if ( $quoted_author ) { + $patterns[] = array( + 'body' => sprintf( + '%s<\/a>$', + $quoted_author + ), + ); + $patterns[] = array( + 'body' => sprintf( + '%s https?:.+?$', + $quoted_author + ), + ); + $patterns[] = array( + 'email' => '@gmail.com$', + 'author' => '^[a-z0-9-\.]+\.[a-z]{2,6}$', + 'host' => sprintf( + '^%s$', + $quoted_author + ), + ); + } + + $patterns = apply_filters( + 'antispam_bee_patterns', + $patterns + ); + + if ( ! $patterns ) { + return false; + } + + foreach ( $patterns as $pattern ) { + $hits = array(); + + foreach ( $pattern as $field => $regexp ) { + if ( empty( $field ) || ! in_array( $field, $fields, true ) || empty( $regexp ) ) { + continue; + } + + $comment[ $field ] = ( function_exists( 'iconv' ) ? iconv( 'utf-8', 'utf-8//TRANSLIT', $comment[ $field ] ) : $comment[ $field ] ); + + if ( empty( $comment[ $field ] ) ) { + continue; + } + + if ( preg_match( '/' . $regexp . '/isu', $comment[ $field ] ) ) { + $hits[ $field ] = true; + } + } + + if ( count( $hits ) === count( $pattern ) ) { + return true; + } + } + + return false; + } + + + /** + * Review a comment on its existence in the local spam + * + * @since 2.0.0 + * @change 2.5.4 + * + * @param string $ip Comment IP. + * @param string $url Comment URL (optional). + * @param string $email Comment Email (optional). + * @return boolean True for suspicious comment. + */ + private static function _is_db_spam( $ip, $url = '', $email = '' ) { + global $wpdb; + + $params = array(); + $filter = array(); + if ( ! empty( $url ) ) { + $filter[] = '`comment_author_url` = %s'; + $params[] = wp_unslash( $url ); + } + if ( ! empty( $ip ) ) { + $filter[] = '`comment_author_IP` = %s'; + $params[] = wp_unslash( $ip ); + } + + if ( ! empty( $email ) ) { + $filter[] = '`comment_author_email` = %s'; + $params[] = wp_unslash( $email ); + } + if ( empty( $params ) ) { + return false; + } + + // phpcs:disable WordPress.WP.PreparedSQL.NotPrepared + // phpcs:disable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber + $filter_sql = implode( ' OR ', $filter ); + + $result = $wpdb->get_var( + $wpdb->prepare( + sprintf( + "SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = 'spam' AND (%s) LIMIT 1", + $filter_sql + ), + $params + ) + ); + // phpcs:enable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber + // phpcs:enable WordPress.WP.PreparedSQL.NotPrepared + + return ! empty( $result ); + } + + + /** + * Check for country spam by (anonymized) IP + * + * @since 2.6.9 + * @change 2.6.9 + * + * @param string $ip IP address. + * @return boolean True if the comment is spam based on country filter. + */ + private static function _is_country_spam( $ip ) { + $options = self::get_options(); + + $white = preg_split( + '/[\s,;]+/', + $options['country_white'], + -1, + PREG_SPLIT_NO_EMPTY + ); + $black = preg_split( + '/[\s,;]+/', + $options['country_black'], + -1, + PREG_SPLIT_NO_EMPTY + ); + + if ( empty( $white ) && empty( $black ) ) { + return false; + } + + $response = wp_safe_remote_head( + esc_url_raw( + sprintf( + 'https://api.ip2country.info/ip?%s', + self::_anonymize_ip( $ip ) + ), + 'https' + ) + ); + + if ( is_wp_error( $response ) ) { + return false; + } + + if ( wp_remote_retrieve_response_code( $response ) !== 200 ) { + return false; + } + + $country = (string) wp_remote_retrieve_header( $response, 'x-country-code' ); + + if ( empty( $country ) || strlen( $country ) !== 2 ) { + return false; + } + + if ( ! empty( $black ) ) { + return ( in_array( $country, $black, true ) ); + } + + return ( ! in_array( $country, $white, true ) ); + } + + + /** + * Check for BBCode spam + * + * @since 2.5.1 + * @change 2.5.1 + * + * @param string $body Content of a comment. + * @return boolean True for BBCode in content + */ + private static function _is_bbcode_spam( $body ) { + return (bool) preg_match( '/\[url[=\]].*\[\/url\]/is', $body ); + } + + + /** + * Check for an already approved e-mail address + * + * @since 2.0 + * @change 2.5.1 + * + * @param string $email E-mail address. + * @return boolean True for a found entry. + */ + private static function _is_approved_email( $email ) { + global $wpdb; + + $result = $wpdb->get_var( + $wpdb->prepare( + "SELECT `comment_ID` FROM `$wpdb->comments` WHERE `comment_approved` = '1' AND `comment_author_email` = %s LIMIT 1", + wp_unslash( $email ) + ) + ); + + if ( $result ) { + return true; + } + + return false; + } + + + /** + * Check for a fake IP + * + * @since 2.0 + * @change 2.6.2 + * + * @param string $client_ip Client IP. + * @param string $client_host Client Host (optional). + * @return boolean True if fake IP. + */ + private static function _is_fake_ip( $client_ip, $client_host = '' ) { + $host_by_ip = gethostbyaddr( $client_ip ); + + if ( self::_is_ipv6( $client_ip ) ) { + return $client_ip !== $host_by_ip; + } + + if ( empty( $client_host ) ) { + $ip_by_host = gethostbyname( $host_by_ip ); + + if ( $ip_by_host === $host_by_ip ) { + return false; + } + } else { + if ( $host_by_ip === $client_ip ) { + return true; + } + + $ip_by_host = gethostbyname( $client_host ); + } + + if ( strpos( $client_ip, self::_cut_ip( $ip_by_host ) ) === false ) { + return true; + } + + return false; + } + + /** + * Check for unwanted languages + * + * @since 2.0 + * @change 2.6.6 + * @change 2.8.2 + * + * @param string $comment_content Content of the comment. + * + * @return boolean TRUE if it is spam. + */ + private static function _is_lang_spam( $comment_content ) { + $allowed_lang = (array) self::get_option( 'translate_lang' ); + + $comment_text = wp_strip_all_tags( $comment_content ); + + if ( empty( $allowed_lang ) || empty( $comment_text ) ) { + return false; + } + + /** + * Filters the detected language. With this filter, other detection methods can skip in and detect the language. + * + * @since 2.8.2 + * + * @param null $detected_lang The detected language. + * @param string $comment_text The text, to detect the language. + * + * @return null|string The detected language or null. + */ + $detected_lang = apply_filters( 'antispam_bee_detected_lang', null, $comment_text ); + if ( null !== $detected_lang ) { + return ! in_array( $detected_lang, $allowed_lang, true ); + } + + $word_count = 0; + $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $comment_text ), ' ' ); + + /* + * translators: If your word count is based on single characters (e.g. East Asian characters), + * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. + * Do not translate into your own language. + */ + if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { + preg_match_all( '/./u', $text, $words_array ); + if ( isset( $words_array[0] ) ) { + $word_count = count( $words_array[0] ); + } + } else { + $words_array = preg_split( "/[\n\r\t ]+/", $text, -1, PREG_SPLIT_NO_EMPTY ); + $word_count = count( $words_array ); + } + + if ( $word_count < 10 ) { + return false; + } + + $response = wp_safe_remote_post( + 'https://api.pluginkollektiv.org/language/v1/', + array( 'body' => wp_json_encode( array( 'body' => $comment_text ) ) ) + ); + + if ( is_wp_error( $response ) + || wp_remote_retrieve_response_code( $response ) !== 200 ) { + return false; + } + + $detected_lang = wp_remote_retrieve_body( $response ); + if ( ! $detected_lang ) { + return false; + } + + $detected_lang = json_decode( $detected_lang ); + if ( ! $detected_lang || ! isset( $detected_lang->code ) ) { + return false; + } + + return ! in_array( self::_map_lang_code( $detected_lang->code ), $allowed_lang, true ); + } + + /** + * Map franc language codes + * + * @since 2.9.0 + * + * @param string $franc_code The franc code, received from the service. + * + * @return string Mapped ISO code + */ + private static function _map_lang_code( $franc_code ) { + $codes = array( + 'zha' => 'za', + 'zho' => 'zh', + 'zul' => 'zu', + 'yid' => 'yi', + 'yor' => 'yo', + 'xho' => 'xh', + 'wln' => 'wa', + 'wol' => 'wo', + 'ven' => 've', + 'vie' => 'vi', + 'vol' => 'vo', + 'uig' => 'ug', + 'ukr' => 'uk', + 'urd' => 'ur', + 'uzb' => 'uz', + 'tah' => 'ty', + 'tam' => 'ta', + 'tat' => 'tt', + 'tel' => 'te', + 'tgk' => 'tg', + 'tgl' => 'tl', + 'tha' => 'th', + 'tir' => 'ti', + 'ton' => 'to', + 'tsn' => 'tn', + 'tso' => 'ts', + 'tuk' => 'tk', + 'tur' => 'tr', + 'twi' => 'tw', + 'sag' => 'sg', + 'san' => 'sa', + 'sin' => 'si', + 'slk' => 'sk', + 'slv' => 'sl', + 'sme' => 'se', + 'smo' => 'sm', + 'sna' => 'sn', + 'snd' => 'sd', + 'som' => 'so', + 'sot' => 'st', + 'spa' => 'es', + 'sqi' => 'sq', + 'srd' => 'sc', + 'srp' => 'sr', + 'ssw' => 'ss', + 'sun' => 'su', + 'swa' => 'sw', + 'swe' => 'sv', + 'roh' => 'rm', + 'ron' => 'ro', + 'run' => 'rn', + 'rus' => 'ru', + 'que' => 'qu', + 'pan' => 'pa', + 'pli' => 'pi', + 'pol' => 'pl', + 'por' => 'pt', + 'pus' => 'ps', + 'oci' => 'oc', + 'oji' => 'oj', + 'ori' => 'or', + 'orm' => 'om', + 'oss' => 'os', + 'nau' => 'na', + 'nav' => 'nv', + 'nbl' => 'nr', + 'nde' => 'nd', + 'ndo' => 'ng', + 'nep' => 'ne', + 'nld' => 'nl', + 'nno' => 'nn', + 'nob' => 'nb', + 'nor' => 'no', + 'nya' => 'ny', + 'mah' => 'mh', + 'mal' => 'ml', + 'mar' => 'mr', + 'mkd' => 'mk', + 'mlg' => 'mg', + 'mlt' => 'mt', + 'mon' => 'mn', + 'mri' => 'mi', + 'msa' => 'ms', + 'mya' => 'my', + 'lao' => 'lo', + 'lat' => 'la', + 'lav' => 'lv', + 'lim' => 'li', + 'lin' => 'ln', + 'lit' => 'lt', + 'ltz' => 'lb', + 'lub' => 'lu', + 'lug' => 'lg', + 'kal' => 'kl', + 'kan' => 'kn', + 'kas' => 'ks', + 'kat' => 'ka', + 'kau' => 'kr', + 'kaz' => 'kk', + 'khm' => 'km', + 'kik' => 'ki', + 'kin' => 'rw', + 'kir' => 'ky', + 'kom' => 'kv', + 'kon' => 'kg', + 'kor' => 'ko', + 'kua' => 'kj', + 'kur' => 'ku', + 'jav' => 'jv', + 'jpn' => 'ja', + 'ibo' => 'ig', + 'ido' => 'io', + 'iii' => 'ii', + 'iku' => 'iu', + 'ile' => 'ie', + 'ina' => 'ia', + 'ind' => 'id', + 'ipk' => 'ik', + 'isl' => 'is', + 'ita' => 'it', + 'hat' => 'ht', + 'hau' => 'ha', + 'hbs' => 'sh', + 'heb' => 'he', + 'her' => 'hz', + 'hin' => 'hi', + 'hmo' => 'ho', + 'hrv' => 'hr', + 'hun' => 'hu', + 'hye' => 'hy', + 'gla' => 'gd', + 'gle' => 'ga', + 'glg' => 'gl', + 'glv' => 'gv', + 'grn' => 'gn', + 'guj' => 'gu', + 'fao' => 'fo', + 'fas' => 'fa', + 'fij' => 'fj', + 'fin' => 'fi', + 'fra' => 'fr', + 'fry' => 'fy', + 'ful' => 'ff', + 'ell' => 'el', + 'eng' => 'en', + 'epo' => 'eo', + 'est' => 'et', + 'eus' => 'eu', + 'ewe' => 'ee', + 'dan' => 'da', + 'deu' => 'de', + 'div' => 'dv', + 'dzo' => 'dz', + 'cat' => 'ca', + 'ces' => 'cs', + 'cha' => 'ch', + 'che' => 'ce', + 'chu' => 'cu', + 'chv' => 'cv', + 'cor' => 'kw', + 'cos' => 'co', + 'cre' => 'cr', + 'cym' => 'cy', + 'bak' => 'ba', + 'bam' => 'bm', + 'bel' => 'be', + 'ben' => 'bn', + 'bis' => 'bi', + 'bod' => 'bo', + 'bos' => 'bs', + 'bre' => 'br', + 'bul' => 'bg', + 'aar' => 'aa', + 'abk' => 'ab', + 'afr' => 'af', + 'aka' => 'ak', + 'amh' => 'am', + 'ara' => 'ar', + 'arg' => 'an', + 'asm' => 'as', + 'ava' => 'av', + 'ave' => 'ae', + 'aym' => 'ay', + 'aze' => 'az', + 'nds' => 'de', + ); + + if ( array_key_exists( $franc_code, $codes ) ) { + return $codes[ $franc_code ]; + } + + return $franc_code; + } + + /** + * Trim IP addresses + * + * @since 0.1 + * @change 2.5.1 + * + * @param string $ip Original IP. + * @param boolean $cut_end Shortening the end. + * @return string Shortened IP. + */ + private static function _cut_ip( $ip, $cut_end = true ) { + $separator = ( self::_is_ipv4( $ip ) ? '.' : ':' ); + + return str_replace( + ( $cut_end ? strrchr( $ip, $separator ) : strstr( $ip, $separator ) ), + '', + $ip + ); + } + + + /** + * Anonymize the IP addresses + * + * @since 2.5.1 + * @change 2.5.1 + * + * @param string $ip Original IP. + * @return string Anonymous IP. + */ + private static function _anonymize_ip( $ip ) { + if ( self::_is_ipv4( $ip ) ) { + return self::_cut_ip( $ip ) . '.0'; + } + + return self::_cut_ip( $ip, false ) . ':0:0:0:0:0:0:0'; + } + + + /** + * Rotates the IP address + * + * @since 2.4.5 + * @change 2.4.5 + * + * @param string $ip IP address. + * @return string Turned IP address. + */ + private static function _reverse_ip( $ip ) { + return implode( + '.', + array_reverse( + explode( + '.', + $ip + ) + ) + ); + } + + + /** + * Check for an IPv4 address + * + * @since 2.4 + * @change 2.6.4 + * + * @param string $ip IP to validate. + * @return integer TRUE if IPv4. + */ + private static function _is_ipv4( $ip ) { + if ( function_exists( 'filter_var' ) ) { + return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) !== false; + } else { + return preg_match( '/^\d{1,3}(\.\d{1,3}){3,3}$/', $ip ); + } + } + + + /** + * Check for an IPv6 address + * + * @since 2.6.2 + * @change 2.6.4 + * + * @param string $ip IP to validate. + * @return boolean TRUE if IPv6. + */ + private static function _is_ipv6( $ip ) { + if ( function_exists( 'filter_var' ) ) { + return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) !== false; + } else { + return ! self::_is_ipv4( $ip ); + } + } + + + /** + * Testing on mobile devices + * + * @since 0.1 + * @change 2.4 + * + * @return boolean TRUE if "wptouch" is active + */ + private static function _is_mobile() { + return strpos( get_template_directory(), 'wptouch' ); + } + + + + /* + * ############################ + * ##### SPAM-TREATMENT ##### + * ############################ + */ + + /** + * Execution of the delete/marking process + * + * @since 0.1 + * @change 2.6.0 + * + * @param array $comment Untreated commentary data. + * @param string $reason Reason for suspicion. + * @param boolean $is_ping Ping (optional). + * @return array $comment Treated commentary data. + */ + private static function _handle_spam_request( $comment, $reason, $is_ping = false ) { + + $options = self::get_options(); + + $spam_remove = ! $options['flag_spam']; + $spam_notice = ! $options['no_notice']; + + // Filter settings. + $ignore_filter = $options['ignore_filter']; + $ignore_type = $options['ignore_type']; + $ignore_reason = in_array( $reason, (array) $options['ignore_reasons'], true ); + + // Remember spam. + self::_update_spam_log( $comment ); + self::_update_spam_count(); + self::_update_daily_stats(); + + // Delete spam. + if ( $spam_remove ) { + self::_go_in_peace(); + } + + if ( $ignore_filter && ( ( 1 === (int) $ignore_type && $is_ping ) || ( 2 === (int) $ignore_type && ! $is_ping ) ) ) { + self::_go_in_peace(); + } + + // Spam reason. + if ( $ignore_reason ) { + self::_go_in_peace(); + } + self::$_reason = $reason; + + // Mark spam. + add_filter( + 'pre_comment_approved', + array( + __CLASS__, + 'return_spam', + ) + ); + + // Send e-mail. + add_action( + 'comment_post', + array( + __CLASS__, + 'send_mail_notification', + ) + ); + + // Spam reason as comment meta. + if ( $spam_notice ) { + add_action( + 'comment_post', + array( + __CLASS__, + 'add_spam_reason_to_comment', + ) + ); + } + + return $comment; + } + + + /** + * Logfile with detected spam + * + * @since 2.5.7 + * @change 2.6.1 + * + * @param array $comment Array with commentary data. + * @return mixed FALSE in case of error + */ + private static function _update_spam_log( $comment ) { + if ( ! defined( 'ANTISPAM_BEE_LOG_FILE' ) || ! ANTISPAM_BEE_LOG_FILE || ! is_writable( ANTISPAM_BEE_LOG_FILE ) || validate_file( ANTISPAM_BEE_LOG_FILE ) === 1 ) { + return false; + } + + $entry = sprintf( + '%s comment for post=%d from host=%s marked as spam%s', + current_time( 'mysql' ), + $comment['comment_post_ID'], + $comment['comment_author_IP'], + PHP_EOL + ); + + file_put_contents( + ANTISPAM_BEE_LOG_FILE, + $entry, + FILE_APPEND | LOCK_EX + ); + } + + + /** + * Sends the 403 header and terminates the connection + * + * @since 2.5.6 + * @change 2.5.6 + */ + private static function _go_in_peace() { + status_header( 403 ); + die( 'Spam deleted.' ); + } + + + /** + * Return real client IP + * + * @since 2.6.1 + * @change 2.6.1 + * + * @return mixed $ip Client IP + */ + public static function get_client_ip() { + // phpcs:disable WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized + // Sanitization of $ip takes place further down. + if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) { + $ip = wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ); + } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { + $ip = wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ); + } elseif ( isset( $_SERVER['HTTP_X_FORWARDED'] ) ) { + $ip = wp_unslash( $_SERVER['HTTP_X_FORWARDED'] ); + } elseif ( isset( $_SERVER['HTTP_FORWARDED_FOR'] ) ) { + $ip = wp_unslash( $_SERVER['HTTP_FORWARDED_FOR'] ); + } elseif ( isset( $_SERVER['HTTP_FORWARDED'] ) ) { + $ip = wp_unslash( $_SERVER['HTTP_FORWARDED'] ); + } elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) { + $ip = wp_unslash( $_SERVER['REMOTE_ADDR'] ); + } else { + return ''; + } + // phpcs:enable WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized + + if ( strpos( $ip, ',' ) !== false ) { + $ips = explode( ',', $ip ); + $ip = trim( $ips[0] ); + } + + if ( function_exists( 'filter_var' ) ) { + return filter_var( + $ip, + FILTER_VALIDATE_IP + ); + } + + return preg_replace( + '/[^0-9a-f:\., ]/si', + '', + $ip + ); + } + + /** + * Add spam reason as comment data + * + * @since 2.6.0 + * @change 2.6.0 + * + * @param integer $comment_id Comment ID. + */ + public static function add_spam_reason_to_comment( $comment_id ) { + add_comment_meta( + $comment_id, + 'antispam_bee_reason', + self::$_reason + ); + } + + /** + * Saves the IP address. + * + * @param int $comment_id The ID of the comment. + */ + public static function save_ip_hash( $comment_id ) { + $hashed_ip = self::hash_ip( self::get_client_ip() ); + add_comment_meta( + $comment_id, + 'antispam_bee_iphash', + $hashed_ip + ); + } + + /** + * Hashes an IP address + * + * @param string $ip The IP address to hash. + * + * @return string + */ + public static function hash_ip( $ip ) { + return wp_hash_password( $ip ); + } + + + /** + * Delete spam reason as comment data + * + * @since 2.6.0 + * @change 2.6.0 + * + * @param integer $comment_id Comment ID. + */ + public static function delete_spam_reason_by_comment( $comment_id ) { + delete_comment_meta( + $comment_id, + 'antispam_bee_reason' + ); + } + + /** + * Get the current post ID. + * + * @since 2.7.1 + */ + public static function populate_post_id() { + + if ( null === self::$_current_post_id ) { + self::$_current_post_id = get_the_ID(); + } + } + + + /** + * Send notification via e-mail + * + * @since 0.1 + * @change 2.5.7 + * + * @hook string antispam_bee_notification_subject Custom subject for notification mails + * + * @param int $id ID of the comment. + * @return int $id ID of the comment. + */ + public static function send_mail_notification( $id ) { + $options = self::get_options(); + + if ( ! $options['email_notify'] ) { + return $id; + } + + $comment = get_comment( $id, ARRAY_A ); + + if ( empty( $comment ) ) { + return $id; + } + + $post = get_post( $comment['comment_post_ID'] ); + if ( ! $post ) { + return $id; + } + + self::load_plugin_lang(); + + $subject = sprintf( + '[%s] %s', + stripslashes_deep( + html_entity_decode( + get_bloginfo( 'name' ), + ENT_QUOTES + ) + ), + esc_html__( 'Comment marked as spam', 'antispam-bee' ) + ); + + // Content. + $content = strip_tags( stripslashes( $comment['comment_content'] ) ); + if ( ! $content ) { + $content = sprintf( + '-- %s --', + esc_html__( 'Content removed by Antispam Bee', 'antispam-bee' ) + ); + } + + // Body. + $body = sprintf( + "%s \"%s\"\r\n\r\n", + esc_html__( 'New spam comment on your post', 'antispam-bee' ), + strip_tags( $post->post_title ) + ) . sprintf( + "%s: %s\r\n", + esc_html__( 'Author', 'antispam-bee' ), + ( empty( $comment['comment_author'] ) ? '' : strip_tags( $comment['comment_author'] ) ) + ) . sprintf( + "URL: %s\r\n", + // empty check exists. + esc_url( $comment['comment_author_url'] ) + ) . sprintf( + "%s: %s\r\n", + esc_html__( 'Type', 'antispam-bee' ), + esc_html( ( empty( $comment['comment_type'] ) ? __( 'Comment', 'antispam-bee' ) : __( 'Trackback', 'antispam-bee' ) ) ) + ) . sprintf( + "Whois: http://whois.arin.net/rest/ip/%s\r\n", + $comment['comment_author_IP'] + ) . sprintf( + "%s: %s\r\n\r\n", + esc_html__( 'Spam Reason', 'antispam-bee' ), + esc_html( self::$defaults['reasons'][ self::$_reason ] ) + ) . sprintf( + "%s\r\n\r\n\r\n", + $content + ) . ( + EMPTY_TRASH_DAYS ? ( + sprintf( + "%s: %s\r\n", + esc_html__( 'Trash it', 'antispam-bee' ), + admin_url( 'comment.php?action=trash&c=' . $id ) + ) + ) : ( + sprintf( + "%s: %s\r\n", + esc_html__( 'Delete it', 'antispam-bee' ), + admin_url( 'comment.php?action=delete&c=' . $id ) + ) + ) + ) . sprintf( + "%s: %s\r\n", + esc_html__( 'Approve it', 'antispam-bee' ), + admin_url( 'comment.php?action=approve&c=' . $id ) + ) . sprintf( + "%s: %s\r\n\r\n", + esc_html__( 'Spam list', 'antispam-bee' ), + admin_url( 'edit-comments.php?comment_status=spam' ) + ) . sprintf( + "%s\r\n%s\r\n", + esc_html__( 'Notify message by Antispam Bee', 'antispam-bee' ), + esc_html__( 'http://antispambee.com', 'antispam-bee' ) + ); + + wp_mail( + /** + * Filters the recipients of the spam notification. + * + * @param array The recipients array. + */ + apply_filters( + 'antispam_bee_notification_recipients', + array( get_bloginfo( 'admin_email' ) ) + ), + /** + * Filters the subject of the spam notification. + * + * @param string $subject subject line. + */ + apply_filters( + 'antispam_bee_notification_subject', + $subject + ), + $body + ); + + return $id; + } + + + + /* + * ############################ + * ####### STATISTICS ####### + * ############################ + */ + + /** + * Return the number of spam comments + * + * @since 0.1 + * @change 2.4 + */ + private static function _get_spam_count() { + // Init. + $count = self::get_option( 'spam_count' ); + + // Fire. + return ( get_locale() === 'de_DE' ? number_format( $count, 0, '', '.' ) : number_format_i18n( $count ) ); + } + + + /** + * Output the number of spam comments + * + * @since 0.1 + * @change 2.4 + */ + public static function the_spam_count() { + echo esc_html( self::_get_spam_count() ); + } + + + /** + * Update the number of spam comments + * + * @since 0.1 + * @change 2.6.1 + */ + private static function _update_spam_count() { + // Skip if not enabled. + if ( ! self::get_option( 'dashboard_count' ) ) { + return; + } + + self::_update_option( + 'spam_count', + intval( self::get_option( 'spam_count' ) + 1 ) + ); + } + + /** + * Update statistics + * + * @since 1.9 + * @change 2.6.1 + */ + private static function _update_daily_stats() { + // Skip if not enabled. + if ( ! self::get_option( 'dashboard_chart' ) ) { + return; + } + + // Init. + $stats = (array) self::get_option( 'daily_stats' ); + $today = (int) strtotime( 'today' ); + + // Count up. + if ( array_key_exists( $today, $stats ) ) { + $stats[ $today ] ++; + } else { + $stats[ $today ] = 1; + } + + // Sort. + krsort( $stats, SORT_NUMERIC ); + + // Save. + self::_update_option( + 'daily_stats', + array_slice( $stats, 0, 31, true ) + ); + } + + /** + * Returns the secret of a post used in the textarea name attribute. + * + * @param int $post_id The Post ID. + * + * @return string + */ + public static function get_secret_name_for_post( $post_id ) { + + if ( self::get_option( 'always_allowed' ) ) { + $secret = substr( sha1( md5( 'comment-id' . self::$_salt ) ), 0, 10 ); + } else { + $secret = substr( sha1( md5( 'comment-id' . self::$_salt . (int) $post_id ) ), 0, 10 ); + } + + $secret = self::ensure_secret_starts_with_letter( $secret ); + + /** + * Filters the secret for a post, which is used in the textarea name attribute. + * + * @param string $secret The secret. + * @param int $post_id The post ID. + * @param bool $always_allowed Whether the comment form is used outside of the single post view or not. + */ + return apply_filters( + 'ab_get_secret_name_for_post', + $secret, + (int) $post_id, + (bool) self::get_option( 'always_allowed' ) + ); + + } + + /** + * Returns the secret of a post used in the textarea id attribute. + * + * @param int $post_id The post ID. + * + * @return string + */ + public static function get_secret_id_for_post( $post_id ) { + + if ( self::get_option( 'always_allowed' ) ) { + $secret = substr( sha1( md5( 'comment-id' . self::$_salt ) ), 0, 10 ); + } else { + $secret = substr( sha1( md5( 'comment-id' . self::$_salt . (int) $post_id ) ), 0, 10 ); + } + + $secret = self::ensure_secret_starts_with_letter( $secret ); + + /** + * Filters the secret for a post, which is used in the textarea id attribute. + * + * @param string $secret The secret. + * @param int $post_id The post ID. + * @param bool $always_allowed Whether the comment form is used outside of the single post view or not. + */ + return apply_filters( + 'ab_get_secret_id_for_post', + $secret, + (int) $post_id, + (bool) self::get_option( 'always_allowed' ) + ); + } + + /** + * Ensures that the secret starts with a letter. + * + * @param string $secret The secret. + * + * @return string + */ + public static function ensure_secret_starts_with_letter( $secret ) { + + $first_char = substr( $secret, 0, 1 ); + if ( is_numeric( $first_char ) ) { + return chr( $first_char + 97 ) . substr( $secret, 1 ); + } else { + return $secret; + } + } + + /** + * Returns 'spam' + * + * @since 2.7.3 + * + * @return string + */ + public static function return_spam() { + + return 'spam'; + } + + /** + * A wrapper around wp_parse_url(). + * + * @since 2.8.2 + * + * @param string $url The URL to parse. + * @param string $component The component to get back. + * + * @return string + */ + private static function parse_url( $url, $component = 'host' ) { + + $parts = wp_parse_url( $url ); + return ( is_array( $parts ) && isset( $parts[ $component ] ) ) ? $parts[ $component ] : ''; + } + + /** + * Updates the database structure if necessary + */ + public static function update_database() { + if ( self::db_version_is_current() ) { + return; + } + + global $wpdb; + + /** + * In Version 2.9 the IP of the commenter was saved as a hash. We reverted this solution. + * Therefore, we need to delete this unused data. + */ + //phpcs:disable WordPress.WP.PreparedSQL.NotPrepared + $sql = 'delete from `' . $wpdb->commentmeta . '` where `meta_key` IN ("antispam_bee_iphash")'; + $wpdb->query( $sql ); + //phpcs:enable WordPress.WP.PreparedSQL.NotPrepared + + update_option( 'antispambee_db_version', self::$db_version ); + } + + /** + * Whether the database structure is up to date. + * + * @return bool + */ + private static function db_version_is_current() { + + $current_version = absint( get_option( 'antispambee_db_version', 0 ) ); + return $current_version === self::$db_version; + + } +} + + +// Fire. +add_action( + 'plugins_loaded', + array( + 'Antispam_Bee', + 'init', + ) +); + +// Activation. +register_activation_hook( + __FILE__, + array( + 'Antispam_Bee', + 'activate', + ) +); + +// Deactivation. +register_deactivation_hook( + __FILE__, + array( + 'Antispam_Bee', + 'deactivate', + ) +); + +// Uninstall. +register_uninstall_hook( + __FILE__, + array( + 'Antispam_Bee', + 'uninstall', + ) +); diff --git a/wp-content/plugins/antispam-bee/css/dashboard.css b/wp-content/plugins/antispam-bee/css/dashboard.css new file mode 100644 index 0000000..92b9c85 --- /dev/null +++ b/wp-content/plugins/antispam-bee/css/dashboard.css @@ -0,0 +1,18 @@ +#ab_chart { + color: #a0a5aa; + height: 140px; + margin: 0 -4px; + text-align: center; +} +#ab_chart_data { + display: none; +} + +#ab_widget .inside { + height: 1%; + margin: 0; + padding-bottom: 0; + overflow: hidden; + position: relative; + white-space: nowrap; +} diff --git a/wp-content/plugins/antispam-bee/css/dashboard.min.css b/wp-content/plugins/antispam-bee/css/dashboard.min.css new file mode 100644 index 0000000..9a416e1 --- /dev/null +++ b/wp-content/plugins/antispam-bee/css/dashboard.min.css @@ -0,0 +1 @@ +#ab_chart{color:#a0a5aa;height:140px;margin:0 -4px;text-align:center;}#ab_chart_data{display:none;}#ab_widget .inside{height:1%;margin:0;padding-bottom:0;overflow:hidden;position:relative;white-space:nowrap;} \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/css/styles.css b/wp-content/plugins/antispam-bee/css/styles.css new file mode 100644 index 0000000..7a86c43 --- /dev/null +++ b/wp-content/plugins/antispam-bee/css/styles.css @@ -0,0 +1,268 @@ +/* @group General */ + +.ab-main *, +.ab-main *:after, +.ab-main *:before { + border: 0; + margin: 0; + padding: 0; + outline: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* @end group */ + +/* @group Browse Happy */ + +.browsehappy { + margin: 0 0 20px; + padding: 10px; + border: 1px solid #e66f00; + text-align: center; +} + +/* @end group */ + +/* @group Columns */ + +.ab-wrap { + margin: 0 0 0 -10px; + padding: 20px 0 0 0; + text-rendering: optimizeLegibility; +} + +.ab-column { + float: left; + margin: 0 0 0 10px; + position: relative; +} + +/* @end group */ + +/* @group Headlines + Icons */ + +.ab-column h3 { + margin: 0; + font-size: 18px; + font-weight: normal; + line-height: 20px; + color: #23282d; +} + +.ab-column h3.icon:before { + font: normal 30px/30px Dashicons; + top: 4px; + right: 20px; + speak: none; + width: 1em; + color: #8e959c; + position: absolute; + text-align: center; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.ab-column.ab-arrow h3.icon:before { + content: '\f536'; +} + +.ab-column.ab-join h3.icon:before { + content: '\f108'; +} + +.ab-column.ab-diff h3.icon:before { + content: '\f237'; +} + +.ab-column h6 { + clear: both; + color: #555d66; + margin: 0 0 20px; + font-weight: normal; + font-size: 13px; +} + +/* @end group */ + +/* @group Form */ + +.ab-column input[type="text"], +.ab-column input[type="number"], +.ab-column select { + font-size: 13px; + text-align: center; + background: #f8f8f9; +} + +.ab-column input[type="number"] { + padding: 0; +} + +.ab-column select[multiple] { + width: 175px; + min-height: 60px; +} + +.ab-column input.ab-mini-field { + width: 40px; +} + +.ab-column .ab-medium-field { + width: 100%; + max-width: 285px; +} + +.ab-column input[type="text"] + label, +.ab-column select + label { + color: #8e959c; + margin: 0 0 0 7px; + display: inline-block; + text-transform: uppercase; +} + +/* @end group */ + +/* @group Column contents */ + +.ab-column > ul { + padding: 0 20px 0 0; +} + +.ab-column:last-of-type > ul { + border: 0; +} + +.ab-column > ul > li { + width: 330px; + margin: 0 0 36px; + padding: 10px 0 12px 12px; + position: relative; + background: #fff; +} + +.ab-column > ul > li a { + text-decoration: underline; +} + +.ab-column > ul > li a:hover { + border-color: inherit; +} + +.ab-column > ul > li label { + cursor: default; + display: inline-block; + font-size: 14px; + max-width: 286px; + color: #23282d; +} + +.ab-column > ul > li label span { + color: #555d66; + display: block; + font-size: 13px; + line-height: 16px; + margin-top: 5px; +} + +/* @end group */ + +/* @group Separator */ + +.ab-column > ul > li:after, +.ab-column > ul > li:before { + width: 0; + content: ''; + position: absolute; +} + +.ab-column.ab-arrow > ul > li:before, +.ab-column.ab-arrow > ul > li:after { + left: 157px; + border-width: 10px 10px 0; + border-style: solid; +} + +.ab-column.ab-arrow > ul > li:before { + bottom: -24px; + border-color: #fff transparent; +} + +.ab-column.ab-arrow > ul > li:after { + bottom: -22px; + border-color: #f1f1f1 transparent; +} + +.ab-column.ab-join > ul > li:before { + left: 171px; + bottom: -27px; + height: 18px; + border-right: 2px solid #fff; +} + +.ab-column.ab-diff > ul > li:before { + left: 162px; + bottom: -19px; + width: 18px; + height: 0; + border-bottom: 2px solid #fff; +} + +/* @end group */ + +/* @group Submit & Service */ + +.ab-column--submit-service { + width: 342px; + margin-top: 20px; + padding-right: 20px; +} + +.ab-column--submit-service p { + padding: 5px 0; + margin: 0; + text-align: center; + width: 100%; +} + +.ab-column--submit-service p:first-of-type { + border-top: 1px solid #e0e5e9; +} + +.ab-column--submit-service p:last-of-type { + border-bottom: 1px solid #e0e5e9; +} + +.ab-column--submit-service .button { + width: 100%; + margin: 35px 0 10px; +} + +/* @end group */ + +/* @group 2nd level */ + +.ab-column > ul > li:last-of-type:after, +.ab-column > ul > li:last-of-type:before { + display: none; +} + +.ab-column > ul > li > ul { + margin: 10px 10px 0 26px; + display: none; +} + +.ab-column > ul > li > ul li { + padding: 2px 0; +} + +.ab-column > ul > li > ul label { + margin: 0 0 0 7px; +} + +.ab-column > ul > li > input[type="checkbox"]:checked ~ ul { + display: block; +} + +/* @end group */ diff --git a/wp-content/plugins/antispam-bee/css/styles.min.css b/wp-content/plugins/antispam-bee/css/styles.min.css new file mode 100755 index 0000000..676ba1f --- /dev/null +++ b/wp-content/plugins/antispam-bee/css/styles.min.css @@ -0,0 +1 @@ +.ab-main *,.ab-main :after,.ab-main :before{border:0;margin:0;padding:0;outline:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.browsehappy{margin:0 0 20px;padding:10px;border:1px solid #e66f00;text-align:center}.ab-wrap{margin:0 0 0 -10px;padding:20px 0 0;text-rendering:optimizeLegibility}.ab-column{float:left;margin:0 0 0 10px;position:relative}.ab-column h3{margin:0;font-size:18px;font-weight:400;line-height:20px;color:#23282d}.ab-column h3.icon:before{font:400 30px/30px Dashicons;top:4px;right:20px;speak:none;width:1em;color:#8e959c;position:absolute;text-align:center;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ab-column.ab-arrow h3.icon:before{content:'\f536'}.ab-column.ab-join h3.icon:before{content:'\f108'}.ab-column.ab-diff h3.icon:before{content:'\f237'}.ab-column h6{clear:both;color:#555d66;margin:0 0 20px;font-weight:400;font-size:13px}.ab-column input[type=text],.ab-column input[type=number],.ab-column select{font-size:13px;text-align:center;background:#f8f8f9}.ab-column input[type=number]{padding:0}.ab-column select[multiple]{width:175px;min-height:60px}.ab-column input.ab-mini-field{width:40px}.ab-column .ab-medium-field{width:100%;max-width:285px}.ab-column input[type=text]+label,.ab-column select+label{color:#8e959c;margin:0 0 0 7px;display:inline-block;text-transform:uppercase}.ab-column>ul{padding:0 20px 0 0}.ab-column:last-of-type>ul{border:0}.ab-column>ul>li{width:330px;margin:0 0 36px;padding:10px 0 12px 12px;position:relative;background:#fff}.ab-column>ul>li a{text-decoration:underline}.ab-column>ul>li a:hover{border-color:inherit}.ab-column>ul>li label{cursor:default;display:inline-block;font-size:14px;max-width:286px;color:#23282d}.ab-column>ul>li label span{color:#555d66;display:block;font-size:13px;line-height:16px;margin-top:5px}.ab-column>ul>li:after,.ab-column>ul>li:before{width:0;content:'';position:absolute}.ab-column.ab-arrow>ul>li:after,.ab-column.ab-arrow>ul>li:before{left:157px;border-width:10px 10px 0;border-style:solid}.ab-column.ab-arrow>ul>li:before{bottom:-24px;border-color:#fff transparent}.ab-column.ab-arrow>ul>li:after{bottom:-22px;border-color:#f1f1f1 transparent}.ab-column.ab-join>ul>li:before{left:171px;bottom:-27px;height:18px;border-right:2px solid #fff}.ab-column.ab-diff>ul>li:before{left:162px;bottom:-19px;width:18px;height:0;border-bottom:2px solid #fff}.ab-column--submit-service{width:342px;margin-top:20px;padding-right:20px}.ab-column--submit-service p{padding:5px 0;margin:0;text-align:center;width:100%}.ab-column--submit-service p:first-of-type{border-top:1px solid #e0e5e9}.ab-column--submit-service p:last-of-type{border-bottom:1px solid #e0e5e9}.ab-column--submit-service .button{width:100%;margin:35px 0 10px}.ab-column>ul>li:last-of-type:after,.ab-column>ul>li:last-of-type:before{display:none}.ab-column>ul>li>ul{margin:10px 10px 0 26px;display:none}.ab-column>ul>li>ul li{padding:2px 0}.ab-column>ul>li>ul label{margin:0 0 0 7px}.ab-column>ul>li>input[type=checkbox]:checked~ul{display:block} \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/inc/columns.class.php b/wp-content/plugins/antispam-bee/inc/columns.class.php new file mode 100644 index 0000000..e87d79f --- /dev/null +++ b/wp-content/plugins/antispam-bee/inc/columns.class.php @@ -0,0 +1,105 @@ + esc_html__( 'Spam Reason', 'antispam-bee' ), + ) + ); + } + + /** + * Display plugin column values on comments screen + * + * @since 2.6.0 + * @change 2.6.0 + * + * @param string $column Currently selected column. + * @param integer $comment_id Comment ID. + */ + public static function print_plugin_column( $column, $comment_id ) { + if ( 'antispam_bee_reason' !== $column ) { + return; + } + + $spam_reason = get_comment_meta( $comment_id, $column, true ); + $spam_reasons = Antispam_Bee::$defaults['reasons']; + + if ( empty( $spam_reason ) || empty( $spam_reasons[ $spam_reason ] ) ) { + return; + } + + echo esc_html( $spam_reasons[ $spam_reason ] ); + } + + /** + * Register plugin sortable columns on comments screen + * + * @since 2.6.3 + * @change 2.6.3 + * + * @param array $columns Registered columns. + * @return array $columns Columns with AB field. + */ + public static function register_sortable_columns( $columns ) { + $columns['antispam_bee_reason'] = 'antispam_bee_reason'; + + return $columns; + } + + /** + * Adjust orderby query + * + * @since 2.6.3 + * @change 2.6.3 + * + * @param \WP_Query $query Current WordPress query. + */ + public static function set_orderby_query( $query ) { + $orderby = $query->get( 'orderby' ); + + if ( empty( $orderby ) || 'antispam_bee_reason' !== $orderby ) { + return; + } + + $query->set( 'meta_key', 'antispam_bee_reason' ); + $query->set( 'orderby', 'meta_value' ); + } + + /** + * Print CSS for the plugin column + * + * @since 2.6.1 + * @change 2.6.1 + */ + public static function print_column_styles() { ?> + + (int) ( ! empty( $_POST['ab_flag_spam'] ) ), + 'email_notify' => (int) ( ! empty( $_POST['ab_email_notify'] ) ), + 'cronjob_enable' => (int) ( ! empty( $_POST['ab_cronjob_enable'] ) ), + 'cronjob_interval' => (int) self::get_key( $_POST, 'ab_cronjob_interval' ), + + 'no_notice' => (int) ( ! empty( $_POST['ab_no_notice'] ) ), + + 'dashboard_count' => (int) ( ! empty( $_POST['ab_dashboard_count'] ) ), + 'dashboard_chart' => (int) ( ! empty( $_POST['ab_dashboard_chart'] ) ), + 'advanced_check' => (int) ( ! empty( $_POST['ab_advanced_check'] ) ), + 'regexp_check' => (int) ( ! empty( $_POST['ab_regexp_check'] ) ), + 'spam_ip' => (int) ( ! empty( $_POST['ab_spam_ip'] ) ), + 'already_commented' => (int) ( ! empty( $_POST['ab_already_commented'] ) ), + 'time_check' => (int) ( ! empty( $_POST['ab_time_check'] ) ), + 'always_allowed' => (int) ( ! empty( $_POST['ab_always_allowed'] ) ), + + 'ignore_pings' => (int) ( ! empty( $_POST['ab_ignore_pings'] ) ), + 'ignore_filter' => (int) ( ! empty( $_POST['ab_ignore_filter'] ) ), + 'ignore_type' => (int) self::get_key( $_POST, 'ab_ignore_type' ), + + 'reasons_enable' => (int) ( ! empty( $_POST['ab_reasons_enable'] ) ), + 'ignore_reasons' => (array) self::get_key( $_POST, 'ab_ignore_reasons' ), + + 'bbcode_check' => (int) ( ! empty( $_POST['ab_bbcode_check'] ) ), + 'gravatar_check' => (int) ( ! empty( $_POST['ab_gravatar_check'] ) ), + 'country_code' => (int) ( ! empty( $_POST['ab_country_code'] ) ), + 'country_black' => sanitize_text_field( wp_unslash( self::get_key( $_POST, 'ab_country_black' ) ) ), + 'country_white' => sanitize_text_field( wp_unslash( self::get_key( $_POST, 'ab_country_white' ) ) ), + + 'translate_api' => (int) ( ! empty( $_POST['ab_translate_api'] ) ), + 'translate_lang' => $selected_languages, + + 'delete_data_on_uninstall' => (int) ( ! empty( $_POST['delete_data_on_uninstall'] ) ), + + ); + + foreach ( $options['ignore_reasons'] as $key => $val ) { + if ( ! isset( self::$defaults['reasons'][ $val ] ) ) { + unset( $options['ignore_reasons'][ $key ] ); + } + } + + if ( empty( $options['cronjob_interval'] ) ) { + $options['cronjob_enable'] = 0; + } + + if ( empty( $options['translate_lang'] ) ) { + $options['translate_api'] = 0; + } + + if ( empty( $options['reasons_enable'] ) ) { + $options['ignore_reasons'] = array(); + } + + if ( ! empty( $options['country_black'] ) ) { + $options['country_black'] = preg_replace( + '/[^A-Z ,;]/', + '', + strtoupper( $options['country_black'] ) + ); + } + + if ( ! empty( $options['country_white'] ) ) { + $options['country_white'] = preg_replace( + '/[^A-Z ,;]/', + '', + strtoupper( $options['country_white'] ) + ); + } + + if ( empty( $options['country_black'] ) && empty( $options['country_white'] ) ) { + $options['country_code'] = 0; + } + + if ( $options['cronjob_enable'] && ! self::get_option( 'cronjob_enable' ) ) { + self::init_scheduled_hook(); + } elseif ( ! $options['cronjob_enable'] && self::get_option( 'cronjob_enable' ) ) { + self::clear_scheduled_hook(); + } + + self::update_options( $options ); + + wp_safe_redirect( + add_query_arg( + array( + 'updated' => 'true', + ), + wp_get_referer() + ) + ); + + die(); + } + + /** + * Generation of a selectbox + * + * @since 2.4.5 + * @change 2.4.5 + * + * @param string $name Name of the Selectbox. + * @param array $data Array with values. + * @param string $selected Selected value. + * @return string $html Generated HTML. + */ + private static function _build_select( $name, $data, $selected ) { + $html = ''; + + return $html; + } + + + /** + * Display the GUI + * + * @since 0.1 + * @change 2.7.0 + */ + public static function options_page() { ?> +
                    +

                    + Antispam Bee +

                    + + + + + + + +
                    + + +
                    +

                    + +

                    +
                    + +
                    + +
                      +
                    • + /> + +
                    • + + +
                    • + /> + +
                    • + + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + + +
                        + ', + esc_url( + __( 'https://www.iso.org/iso/country_names_and_code_elements', 'antispam-bee' ), + 'https' + ) + ); + ?> +
                      • + + +
                      • +
                      • + + +
                      • +
                      +
                    • + +
                    • + /> + + +
                        +
                      • + + +
                      • +
                      +
                    • +
                    +
                    + +
                    +

                    + +

                    +
                    + +
                    + +
                      +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + + +
                        +
                      • + + +
                      • +
                      +
                    • + +
                    • + /> + +
                    • +
                    + +
                    + + +
                    +

                    + +

                    +
                    + +
                    + +
                      +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • + +
                    • + /> + +
                    • +
                    +
                    + +
                    +

                    + +

                    +

                    + +

                    +

                    + +

                    +

                    + +

                    + + +
                    +
                    + +
                    + __( 'German', 'antispam-bee' ), + 'en' => __( 'English', 'antispam-bee' ), + 'fr' => __( 'French', 'antispam-bee' ), + 'it' => __( 'Italian', 'antispam-bee' ), + 'es' => __( 'Spanish', 'antispam-bee' ), + ); + + /** + * Filter the possible languages for the language spam test + * + * @since 2.7.1 + * @param (array) $lang The languages + * @return (array) + */ + return apply_filters( 'ab_get_allowed_translate_languages', $lang ); + } +} diff --git a/wp-content/plugins/antispam-bee/js/dashboard.js b/wp-content/plugins/antispam-bee/js/dashboard.js new file mode 100644 index 0000000..baf41ec --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/dashboard.js @@ -0,0 +1,111 @@ +(function () { + + // Grab the data + var labels = [], + data = []; + jQuery("#ab_chart_data tfoot th").each(function () { + labels.push(jQuery(this).text()); + }); + jQuery("#ab_chart_data tbody td").each(function () { + data.push(jQuery(this).text()); + }); + + // Draw + var width = jQuery('#ab_chart').parent().width() + 8, + height = 140, + leftgutter = 0, + bottomgutter = 22, + topgutter = 22, + color = '#0073aa', + r = Raphael("ab_chart", width, height), + txt = {font: 'bold 12px "Open Sans", sans-serif', fill: "#32373c"}, + X = (width - leftgutter * 2) / labels.length, + max = Math.max.apply(Math, data), + Y = (height - bottomgutter - topgutter) / max; + + // Max value + r + .text(16, 16, max) + .attr( + { + 'font': 'normal 10px "Open Sans", sans-serif', + fill: "#b4b9be" + } + ); + + var path = r.path().attr({stroke: color, "stroke-width": 2, "stroke-linejoin": "round"}), + bgp = r.path().attr({stroke: "none", opacity: .3, fill: color}), + label = r.set(), + lx = 0, ly = 0, + is_label_visible = false, + leave_timer, + blanket = r.set(); + label.push(r.text(60, 12, "").attr(txt)); + label.push(r.text(60, 27, "").attr(txt).attr({fill: color})); + label.hide(); + var frame = r.popup(100, 100, label, "right").attr({fill: "#fff", stroke: "#444", "stroke-width": 1}).hide(); + + var p, bgpp; + for (var i = 0, ii = labels.length; i < ii; i++) { + var y = Math.round(height - bottomgutter - Y * data[i]), + x = Math.round(leftgutter + X * (i + .5)); + if (!i) { + p = ["M", x, y, "C", x, y]; + bgpp = ["M", leftgutter + X * .5, height - bottomgutter, "L", x, y, "C", x, y]; + } + if (i && i < ii - 1) { + var Y0 = Math.round(height - bottomgutter - Y * data[i - 1]), + X0 = Math.round(leftgutter + X * (i - .5)), + Y2 = Math.round(height - bottomgutter - Y * data[i + 1]), + X2 = Math.round(leftgutter + X * (i + 1.5)); + var a = getAnchors(X0, Y0, x, y, X2, Y2); + p = p.concat([a.x1, a.y1, x, y, a.x2, a.y2]); + bgpp = bgpp.concat([a.x1, a.y1, x, y, a.x2, a.y2]); + } + var dot = r.circle(x, y, 4).attr({fill: "#fff", stroke: color, "stroke-width": 1}); + blanket.push(r.rect(leftgutter + X * i, 0, X, height - bottomgutter).attr({stroke: "none", fill: '#fff', opacity: .2})); + var rect = blanket[blanket.length - 1]; + (function (x, y, data, date, dot) { + var timer, i = 0; + rect.hover(function () { + clearTimeout(leave_timer); + var side = "right"; + if (x + frame.getBBox().width > width) { + side = "left"; + } + // set label content to determine correct dimensions + label[0].attr({text: date }); + label[1].attr({text: data + "× Spam"}); + var ppp = r.popup(x, y, label, side, 1), + anim = Raphael.animation({ + path: ppp.path, + transform: ["t", ppp.dx, ppp.dy] + }, 200 * is_label_visible); + lx = label[0].transform()[0][1] + ppp.dx; + ly = label[0].transform()[0][2] + ppp.dy; + frame.show().stop().animate(anim); + + label[0].show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible); + label[1].show().stop().animateWith(frame, anim, {transform: ["t", lx, ly]}, 200 * is_label_visible); + dot.attr("r", 6); + is_label_visible = true; + }, function () { + dot.attr("r", 4); + leave_timer = setTimeout(function () { + frame.hide(); + label[0].hide(); + label[1].hide(); + is_label_visible = false; + }, 1); + }); + })(x, y, data[i], labels[i], dot); + } + p = p.concat([x, y, x, y]); + bgpp = bgpp.concat([x, y, x, y, "L", x, height - bottomgutter, "z"]); + path.attr({path: p}); + bgp.attr({path: bgpp}); + frame.toFront(); + label[0].toFront(); + label[1].toFront(); + blanket.toFront(); +})(); diff --git a/wp-content/plugins/antispam-bee/js/dashboard.min.js b/wp-content/plugins/antispam-bee/js/dashboard.min.js new file mode 100644 index 0000000..9355cf8 --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/dashboard.min.js @@ -0,0 +1,5 @@ +(function(){var labels=[],data=[];jQuery("#ab_chart_data tfoot th").each(function(){labels.push(jQuery(this).text())});jQuery("#ab_chart_data tbody td").each(function(){data.push(jQuery(this).text())});var width=jQuery('#ab_chart').parent().width()+8,height=140,leftgutter=0,bottomgutter=22,topgutter=22,color='#0073aa',r=Raphael("ab_chart",width,height),txt={font:'bold 12px "Open Sans", sans-serif',fill:"#32373c"},X=(width-leftgutter*2)/labels.length,max=Math.max.apply(Math,data),Y=(height-bottomgutter-topgutter)/max;r.text(16,16,max).attr({'font':'normal 10px "Open Sans", sans-serif',fill:"#b4b9be"});var path=r.path().attr({stroke:color,"stroke-width":2,"stroke-linejoin":"round"}),bgp=r.path().attr({stroke:"none",opacity:.3,fill:color}),label=r.set(),lx=0,ly=0,is_label_visible=!1,leave_timer,blanket=r.set();label.push(r.text(60,12,"").attr(txt));label.push(r.text(60,27,"").attr(txt).attr({fill:color}));label.hide();var frame=r.popup(100,100,label,"right").attr({fill:"#fff",stroke:"#444","stroke-width":1}).hide();var p,bgpp;for(var i=0,ii=labels.length;iwidth){side="left"} +label[0].attr({text:date});label[1].attr({text:data+"× Spam"});var ppp=r.popup(x,y,label,side,1),anim=Raphael.animation({path:ppp.path,transform:["t",ppp.dx,ppp.dy]},200*is_label_visible);lx=label[0].transform()[0][1]+ppp.dx;ly=label[0].transform()[0][2]+ppp.dy;frame.show().stop().animate(anim);label[0].show().stop().animateWith(frame,anim,{transform:["t",lx,ly]},200*is_label_visible);label[1].show().stop().animateWith(frame,anim,{transform:["t",lx,ly]},200*is_label_visible);dot.attr("r",6);is_label_visible=!0},function(){dot.attr("r",4);leave_timer=setTimeout(function(){frame.hide();label[0].hide();label[1].hide();is_label_visible=!1},1)})})(x,y,data[i],labels[i],dot)} +p=p.concat([x,y,x,y]);bgpp=bgpp.concat([x,y,x,y,"L",x,height-bottomgutter,"z"]);path.attr({path:p});bgp.attr({path:bgpp});frame.toFront();label[0].toFront();label[1].toFront();blanket.toFront()})() \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/js/raphael.helper.js b/wp-content/plugins/antispam-bee/js/raphael.helper.js new file mode 100644 index 0000000..842a645 --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/raphael.helper.js @@ -0,0 +1,142 @@ +var tokenRegex = /\{([^\}]+)\}/g, + objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, + replacer = function (all, key, obj) { + var res = obj; + key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) { + name = name || quotedName; + if (res) { + if (name in res) { + res = res[name]; + } + typeof res == "function" && isFunc && (res = res()); + } + }); + res = (res == null || res == obj ? all : res) + ""; + return res; + }, + fill = function (str, obj) { + return String(str).replace(tokenRegex, function (all, key) { + return replacer(all, key, obj); + }); + }; + + +Raphael.fn.popup = function (X, Y, set, pos, ret) { + pos = String(pos || "top-middle").split("-"); + pos[1] = pos[1] || "middle"; + var r = 5, + bb = set.getBBox(), + w = Math.round(bb.width), + h = Math.round(bb.height), + x = Math.round(bb.x) - r, + y = Math.round(bb.y) - r, + gap = Math.min(h / 2, w / 2, 10), + shapes = { + top: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}l-{right},0-{gap},{gap}-{gap}-{gap}-{left},0a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z", + bottom: "M{x},{y}l{left},0,{gap}-{gap},{gap},{gap},{right},0a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z", + right: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}l0-{bottom}-{gap}-{gap},{gap}-{gap},0-{top}a{r},{r},0,0,1,{r}-{r}z", + left: "M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}l0,{top},{gap},{gap}-{gap},{gap},0,{bottom}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z" + }, + offset = { + hx0: X - (x + r + w - gap * 2), + hx1: X - (x + r + w / 2 - gap), + hx2: X - (x + r + gap), + vhy: Y - (y + r + h + r + gap), + "^hy": Y - (y - gap) + + }, + mask = [{ + x: x + r, + y: y, + w: w, + w4: w / 4, + h4: h / 4, + right: 0, + left: w - gap * 2, + bottom: 0, + top: h - gap * 2, + r: r, + h: h, + gap: gap + }, { + x: x + r, + y: y, + w: w, + w4: w / 4, + h4: h / 4, + left: w / 2 - gap, + right: w / 2 - gap, + top: h / 2 - gap, + bottom: h / 2 - gap, + r: r, + h: h, + gap: gap + }, { + x: x + r, + y: y, + w: w, + w4: w / 4, + h4: h / 4, + left: 0, + right: w - gap * 2, + top: 0, + bottom: h - gap * 2, + r: r, + h: h, + gap: gap + }][pos[1] == "middle" ? 1 : (pos[1] == "top" || pos[1] == "left") * 2]; + var dx = 0, + dy = 0, + out = this.path(fill(shapes[pos[0]], mask)).insertBefore(set); + switch (pos[0]) { + case "top": + dx = X - (x + r + mask.left + gap); + dy = Y - (y + r + h + r + gap); + break; + case "bottom": + dx = X - (x + r + mask.left + gap); + dy = Y - (y - gap); + break; + case "left": + dx = X - (x + r + w + r + gap); + dy = Y - (y + r + mask.top + gap); + break; + case "right": + dx = X - (x - gap); + dy = Y - (y + r + mask.top + gap); + break; + } + out.translate(dx, dy); + if (ret) { + ret = out.attr("path"); + out.remove(); + return { + path: ret, + dx: dx, + dy: dy + }; + } + set.translate(dx, dy); + return out; +}; + + +function getAnchors(p1x, p1y, p2x, p2y, p3x, p3y) { + var l1 = (p2x - p1x) / 2, + l2 = (p3x - p2x) / 2, + a = Math.atan((p2x - p1x) / Math.abs(p2y - p1y)), + b = Math.atan((p3x - p2x) / Math.abs(p2y - p3y)); + a = p1y < p2y ? Math.PI - a : a; + b = p3y < p2y ? Math.PI - b : b; + var alpha = Math.PI / 2 - ((a + b) % (Math.PI * 2)) / 2, + dx1 = l1 * Math.sin(alpha + a), + dy1 = l1 * Math.cos(alpha + a), + dx2 = l2 * Math.sin(alpha + b), + dy2 = l2 * Math.cos(alpha + b); + return { + x1: p2x - dx1, + y1: p2y + dy1, + x2: p2x + dx2, + y2: p2y + dy2 + }; +} \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/js/raphael.helper.min.js b/wp-content/plugins/antispam-bee/js/raphael.helper.min.js new file mode 100644 index 0000000..7a20fdd --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/raphael.helper.min.js @@ -0,0 +1,5 @@ +var tokenRegex=/\{([^\}]+)\}/g,objNotationRegex=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,replacer=function(c,h,g){var a=g;h.replace(objNotationRegex,function(c,b,f,d,g){b=b||d;a&&(b in a&&(a=a[b]),"function"==typeof a&&g&&(a=a()))});return a=(null==a||a==g?c:a)+""},fill=function(c,h){return String(c).replace(tokenRegex,function(c,a){return replacer(c,a,h)})}; +Raphael.fn.popup=function(c,h,g,a,k){a=String(a||"top-middle").split("-");a[1]=a[1]||"middle";var b=g.getBBox(),f=Math.round(b.width),d=Math.round(b.height),l=Math.round(b.x)-5,b=Math.round(b.y)-5,e=Math.min(d/2,f/2,10),p=[{x:l+5,y:b,w:f,w4:f/4,h4:d/4,right:0,left:f-2*e,bottom:0,top:d-2*e,r:5,h:d,gap:e},{x:l+5,y:b,w:f,w4:f/4,h4:d/4,left:f/2-e,right:f/2-e,top:d/2-e,bottom:d/2-e,r:5,h:d,gap:e},{x:l+5,y:b,w:f,w4:f/4,h4:d/4,left:0,right:f-2*e,top:0,bottom:d-2*e,r:5,h:d,gap:e}]["middle"==a[1]?1:2*("top"== +a[1]||"left"==a[1])],m=0,n=0,q=this.path(fill({top:"M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}l-{right},0-{gap},{gap}-{gap}-{gap}-{left},0a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",bottom:"M{x},{y}l{left},0,{gap}-{gap},{gap},{gap},{right},0a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z",right:"M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}v{h4},{h4},{h4},{h4}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}l0-{bottom}-{gap}-{gap},{gap}-{gap},0-{top}a{r},{r},0,0,1,{r}-{r}z", +left:"M{x},{y}h{w4},{w4},{w4},{w4}a{r},{r},0,0,1,{r},{r}l0,{top},{gap},{gap}-{gap},{gap},0,{bottom}a{r},{r},0,0,1,-{r},{r}h-{w4}-{w4}-{w4}-{w4}a{r},{r},0,0,1-{r}-{r}v-{h4}-{h4}-{h4}-{h4}a{r},{r},0,0,1,{r}-{r}z"}[a[0]],p)).insertBefore(g);switch(a[0]){case "top":m=c-(l+5+p.left+e);n=h-(b+5+d+5+e);break;case "bottom":m=c-(l+5+p.left+e);n=h-(b-e);break;case "left":m=c-(l+5+f+5+e);n=h-(b+5+p.top+e);break;case "right":m=c-(l-e),n=h-(b+5+p.top+e)}q.translate(m,n);if(k)return k=q.attr("path"),q.remove(), +{path:k,dx:m,dy:n};g.translate(m,n);return q};function getAnchors(c,h,g,a,k,b){var f=(g-c)/2,d=(k-g)/2;c=Math.atan((g-c)/Math.abs(a-h));k=Math.atan((k-g)/Math.abs(a-b));c=h=1e3&&delete o[l.shift()],l.push(s),o[s]=t[z](e,a),r?r(o[s]):o[s])}return n}function a(){return this.hex}function s(t,e){for(var r=[],i=0,n=t.length;n-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?n-4==i?a[3]={x:+t[0],y:+t[1]}:n-2==i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[n-2],y:+t[n-1]}:n-4==i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}function o(t,e,r,i,n){var a=-3*e+9*r-9*i+3*n,s=t*a+6*e-12*r+6*i;return t*s-3*e+3*r}function l(t,e,r,i,n,a,s,l,h){null==h&&(h=1),h=h>1?1:h<0?0:h;for(var u=h/2,c=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;gd;)c/=2,f+=(pW(n,s)||W(e,i)W(a,o))){var l=(t*i-e*r)*(n-s)-(t-r)*(n*o-a*s),h=(t*i-e*r)*(a-o)-(e-i)*(n*o-a*s),u=(t-r)*(a-o)-(e-i)*(n-s);if(u){var c=l/u,f=h/u,p=+c.toFixed(2),d=+f.toFixed(2);if(!(p<+G(t,r).toFixed(2)||p>+W(t,r).toFixed(2)||p<+G(n,s).toFixed(2)||p>+W(n,s).toFixed(2)||d<+G(e,i).toFixed(2)||d>+W(e,i).toFixed(2)||d<+G(a,o).toFixed(2)||d>+W(a,o).toFixed(2)))return{x:c,y:f}}}}function c(t,e){return p(t,e)}function f(t,e){return p(t,e,1)}function p(t,r,i){var n=e.bezierBBox(t),a=e.bezierBBox(r);if(!e.isBBoxIntersect(n,a))return i?0:[];for(var s=l.apply(0,t),o=l.apply(0,r),h=W(~~(s/5),1),c=W(~~(o/5),1),f=[],p=[],d={},g=i?0:[],v=0;v=0&&S<=1.001&&A>=0&&A<=1.001&&(i?g++:g.push({x:C.x,y:C.y,t1:G(S,1),t2:G(A,1)}))}}return g}function d(t,r,i){t=e._path2curve(t),r=e._path2curve(r);for(var n,a,s,o,l,h,u,c,f,d,g=i?0:[],v=0,x=t.length;vi)return i;for(;ra?r=n:i=n,n=(i-r)/2+r}return n}var h=3*e,u=3*(i-e)-h,c=1-h-u,f=3*r,p=3*(n-r)-f,d=1-f-p;return o(t,1/(200*a))}function m(t,e){var r=[],i={};if(this.ms=e,this.times=1,t){for(var n in t)t[A](n)&&(i[ht(n)]=t[n],r.push(ht(n)));r.sort(Bt)}this.anim=i,this.top=r[r.length-1],this.percents=r}function b(r,i,n,a,s,o){n=ht(n);var l,h,u,c=[],f,p,d,v=r.ms,x={},m={},b={};if(a)for(w=0,B=Ee.length;wa*r.top){n=r.percents[w],p=r.percents[w-1]||0,v=v/r.top*(n-p),f=r.percents[w+1],l=r.anim[n];break}a&&i.attr(r.anim[r.percents[w]])}if(l){if(h)h.initstatus=a,h.start=new Date-h.ms*a;else{for(var C in l)if(l[A](C)&&(pt[A](C)||i.paper.customAttributes[A](C)))switch(x[C]=i.attr(C),null==x[C]&&(x[C]=ft[C]),m[C]=l[C],pt[C]){case $:b[C]=(m[C]-x[C])/v;break;case"colour":x[C]=e.getRGB(x[C]);var S=e.getRGB(m[C]);b[C]={r:(S.r-x[C].r)/v,g:(S.g-x[C].g)/v,b:(S.b-x[C].b)/v};break;case"path":var T=Qt(x[C],m[C]),E=T[1];for(x[C]=T[0],b[C]=[],w=0,B=x[C].length;w',Lt=Nt.firstChild,Lt.style.behavior="url(#default#VML)",!Lt||"object"!=typeof Lt.adj)return e.type=R;Nt=null}e.svg=!(e.vml="VML"==e.type),e._Paper=M,e.fn=N=M.prototype=e.prototype,e._id=0,e.is=function(t,e){return e=O.call(e),"finite"==e?!at[A](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||tt.call(t).slice(8,-1).toLowerCase()==e},e.angle=function(t,r,i,n,a,s){if(null==a){var o=t-i,l=r-n;return o||l?(180+180*Y.atan2(-l,-o)/U+360)%360:0}return e.angle(t,r,a,s)-e.angle(i,n,a,s)},e.rad=function(t){return t%360*U/180},e.deg=function(t){return Math.round(180*t/U%360*1e3)/1e3},e.snapTo=function(t,r,i){if(i=e.is(i,"finite")?i:10,e.is(t,Q)){for(var n=t.length;n--;)if(H(t[n]-r)<=i)return t[n]}else{t=+t;var a=r%t;if(at-i)return r-a+t}return r};var zt=e.createUUID=function(t,e){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(t,e).toUpperCase()}}(/[xy]/g,function(t){var e=16*Y.random()|0,r="x"==t?e:3&e|8;return r.toString(16)});e.setWindow=function(r){t("raphael.setWindow",e,T.win,r),T.win=r,T.doc=T.win.document,e._engine.initWin&&e._engine.initWin(T.win)};var Pt=function(t){if(e.vml){var r=/^\s+|\s+$/g,i;try{var a=new ActiveXObject("htmlfile");a.write(""),a.close(),i=a.body}catch(s){i=createPopup().document.body}var o=i.createTextRange();Pt=n(function(t){try{i.style.color=I(t).replace(r,R);var e=o.queryCommandValue("ForeColor");return e=(255&e)<<16|65280&e|(16711680&e)>>>16,"#"+("000000"+e.toString(16)).slice(-6)}catch(n){return"none"}})}else{var l=T.doc.createElement("i");l.title="Raphaël Colour Picker",l.style.display="none",T.doc.body.appendChild(l),Pt=n(function(t){return l.style.color=t,T.doc.defaultView.getComputedStyle(l,R).getPropertyValue("color")})}return Pt(t)},Ft=function(){return"hsb("+[this.h,this.s,this.b]+")"},Rt=function(){return"hsl("+[this.h,this.s,this.l]+")"},jt=function(){return this.hex},It=function(t,r,i){if(null==r&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(i=t.b,r=t.g,t=t.r),null==r&&e.is(t,Z)){var n=e.getRGB(t);t=n.r,r=n.g,i=n.b}return(t>1||r>1||i>1)&&(t/=255,r/=255,i/=255),[t,r,i]},qt=function(t,r,i,n){t*=255,r*=255,i*=255;var a={r:t,g:r,b:i,hex:e.rgb(t,r,i),toString:jt};return e.is(n,"finite")&&(a.opacity=n),a};e.color=function(t){var r;return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(r=e.hsb2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(r=e.hsl2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):(e.is(t,"string")&&(t=e.getRGB(t)),e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(r=e.rgb2hsl(t),t.h=r.h,t.s=r.s,t.l=r.l,r=e.rgb2hsb(t),t.v=r.b):(t={hex:"none"},t.r=t.g=t.b=t.h=t.s=t.v=t.l=-1)),t.toString=jt,t},e.hsb2rgb=function(t,e,r,i){this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,i=t.o,t=t.h),t*=360;var n,a,s,o,l;return t=t%360/60,l=r*e,o=l*(1-H(t%2-1)),n=a=s=r-l,t=~~t,n+=[l,o,0,0,o,l][t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],qt(n,a,s,i)},e.hsl2rgb=function(t,e,r,i){this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),t*=360;var n,a,s,o,l;return t=t%360/60,l=2*e*(r<.5?r:1-r),o=l*(1-H(t%2-1)),n=a=s=r-l/2,t=~~t,n+=[l,o,0,0,o,l][t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],qt(n,a,s,i)},e.rgb2hsb=function(t,e,r){r=It(t,e,r),t=r[0],e=r[1],r=r[2];var i,n,a,s;return a=W(t,e,r),s=a-G(t,e,r),i=0==s?null:a==t?(e-r)/s:a==e?(r-t)/s+2:(t-e)/s+4,i=(i+360)%6*60/360,n=0==s?0:s/a,{h:i,s:n,b:a,toString:Ft}},e.rgb2hsl=function(t,e,r){r=It(t,e,r),t=r[0],e=r[1],r=r[2];var i,n,a,s,o,l;return s=W(t,e,r),o=G(t,e,r),l=s-o,i=0==l?null:s==t?(e-r)/l:s==e?(r-t)/l+2:(t-e)/l+4,i=(i+360)%6*60/360,a=(s+o)/2,n=0==l?0:a<.5?l/(2*a):l/(2-2*a),{h:i,s:n,l:a,toString:Rt}},e._path2string=function(){return this.join(",").replace(xt,"$1")};var Dt=e._preload=function(t,e){var r=T.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,T.doc.body.removeChild(this)},r.onerror=function(){T.doc.body.removeChild(this)},T.doc.body.appendChild(r),r.src=t};e.getRGB=n(function(t){if(!t||(t=I(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:a};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:a};!(vt[A](t.toLowerCase().substring(0,2))||"#"==t.charAt())&&(t=Pt(t));var r,i,n,s,o,l,h,u=t.match(nt);return u?(u[2]&&(s=ut(u[2].substring(5),16),n=ut(u[2].substring(3,5),16),i=ut(u[2].substring(1,3),16)),u[3]&&(s=ut((l=u[3].charAt(3))+l,16),n=ut((l=u[3].charAt(2))+l,16),i=ut((l=u[3].charAt(1))+l,16)),u[4]&&(h=u[4][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),"rgba"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100)),u[5]?(h=u[5][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),("deg"==h[0].slice(-3)||"°"==h[0].slice(-1))&&(i/=360),"hsba"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100),e.hsb2rgb(i,n,s,o)):u[6]?(h=u[6][q](gt),i=ht(h[0]),"%"==h[0].slice(-1)&&(i*=2.55),n=ht(h[1]),"%"==h[1].slice(-1)&&(n*=2.55),s=ht(h[2]),"%"==h[2].slice(-1)&&(s*=2.55),("deg"==h[0].slice(-3)||"°"==h[0].slice(-1))&&(i/=360),"hsla"==u[1].toLowerCase().slice(0,4)&&(o=ht(h[3])),h[3]&&"%"==h[3].slice(-1)&&(o/=100),e.hsl2rgb(i,n,s,o)):(u={r:i,g:n,b:s,toString:a},u.hex="#"+(16777216|s|n<<8|i<<16).toString(16).slice(1),e.is(o,"finite")&&(u.opacity=o),u)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:a}},e),e.hsb=n(function(t,r,i){return e.hsb2rgb(t,r,i).hex}),e.hsl=n(function(t,r,i){return e.hsl2rgb(t,r,i).hex}),e.rgb=n(function(t,e,r){function i(t){return t+.5|0}return"#"+(16777216|i(r)|i(e)<<8|i(t)<<16).toString(16).slice(1)}),e.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=function(t){if(!t)return null;var r=Vt(t);if(r.arr)return Yt(r.arr);var i={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},n=[];return e.is(t,Q)&&e.is(t[0],Q)&&(n=Yt(t)),n.length||I(t).replace(yt,function(t,e,r){var a=[],s=e.toLowerCase();if(r.replace(bt,function(t,e){e&&a.push(+e)}),"m"==s&&a.length>2&&(n.push([e][P](a.splice(0,2))),s="l",e="m"==e?"l":"L"),"r"==s)n.push([e][P](a));else for(;a.length>=i[s]&&(n.push([e][P](a.splice(0,i[s]))),i[s]););}),n.toString=e._path2string,r.arr=Yt(n),n},e.parseTransformString=n(function(t){if(!t)return null;var r={r:3,s:4,t:2,m:6},i=[];return e.is(t,Q)&&e.is(t[0],Q)&&(i=Yt(t)),i.length||I(t).replace(mt,function(t,e,r){var n=[],a=O.call(e);r.replace(bt,function(t,e){e&&n.push(+e)}),i.push([e][P](n))}),i.toString=e._path2string,i});var Vt=function(t){var e=Vt.ps=Vt.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[A](r)&&r!=t&&(e[r].sleep--,!e[r].sleep&&delete e[r])}),e[t]};e.findDotsAtSegment=function(t,e,r,i,n,a,s,o,l){var h=1-l,u=X(h,3),c=X(h,2),f=l*l,p=f*l,d=u*t+3*c*l*r+3*h*l*l*n+p*s,g=u*e+3*c*l*i+3*h*l*l*a+p*o,v=t+2*l*(r-t)+f*(n-2*r+t),x=e+2*l*(i-e)+f*(a-2*i+e),y=r+2*l*(n-r)+f*(s-2*n+r),m=i+2*l*(a-i)+f*(o-2*a+i),b=h*t+l*r,_=h*e+l*i,w=h*n+l*s,k=h*a+l*o,B=90-180*Y.atan2(v-y,x-m)/U;return(v>y||x=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},e.isBBoxIntersect=function(t,r){var i=e.isPointInsideBBox;return i(r,t.x,t.y)||i(r,t.x2,t.y)||i(r,t.x,t.y2)||i(r,t.x2,t.y2)||i(t,r.x,r.y)||i(t,r.x2,r.y)||i(t,r.x,r.y2)||i(t,r.x2,r.y2)||(t.xr.x||r.xt.x)&&(t.yr.y||r.yt.y)},e.pathIntersection=function(t,e){return d(t,e)},e.pathIntersectionNumber=function(t,e){return d(t,e,1)},e.isPointInsidePath=function(t,r,i){var n=e.pathBBox(t);return e.isPointInsideBBox(n,r,i)&&d(t,[["M",r,i],["H",n.x2+10]],1)%2==1},e._removedFactory=function(e){return function(){t("raphael.log",null,"Raphaël: you are calling to method “"+e+"†of removed object",e)}};var Ot=e.pathBBox=function(t){var e=Vt(t);if(e.bbox)return r(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};t=Qt(t);for(var i=0,n=0,a=[],s=[],o,l=0,h=t.length;l1&&(b=Y.sqrt(b),r=b*r,i=b*i);var _=r*r,w=i*i,k=(s==o?-1:1)*Y.sqrt(H((_*w-_*m*m-w*y*y)/(_*m*m+w*y*y))),B=k*r*m/i+(t+l)/2,C=k*-i*y/r+(e+h)/2,S=Y.asin(((e-C)/i).toFixed(9)),A=Y.asin(((h-C)/i).toFixed(9));S=tA&&(S-=2*U),!o&&A>S&&(A-=2*U)}var T=A-S;if(H(T)>c){var E=A,M=l,N=h;A=S+c*(o&&A>S?1:-1),l=B+r*Y.cos(A),h=C+i*Y.sin(A),p=Ut(l,h,r,i,a,0,o,M,N,[A,E,B,C])}T=A-S;var L=Y.cos(S),z=Y.sin(S),F=Y.cos(A),R=Y.sin(A),j=Y.tan(T/4),I=4/3*r*j,D=4/3*i*j,V=[t,e],O=[t+I*z,e-D*L],W=[l+I*R,h-D*F],G=[l,h];if(O[0]=2*V[0]-O[0],O[1]=2*V[1]-O[1],u)return[O,W,G][P](p);p=[O,W,G][P](p).join()[q](",");for(var X=[],$=0,Z=p.length;$"1e12"&&(c=.5),H(f)>"1e12"&&(f=.5),c>0&&c<1&&(g=$t(t,e,r,i,n,a,s,o,c),d.push(g.x),p.push(g.y)),f>0&&f<1&&(g=$t(t,e,r,i,n,a,s,o,f),d.push(g.x),p.push(g.y)),l=a-2*i+e-(o-2*a+i),h=2*(i-e)-2*(a-i),u=e-i,c=(-h+Y.sqrt(h*h-4*l*u))/2/l,f=(-h-Y.sqrt(h*h-4*l*u))/2/l,H(c)>"1e12"&&(c=.5),H(f)>"1e12"&&(f=.5),c>0&&c<1&&(g=$t(t,e,r,i,n,a,s,o,c),d.push(g.x),p.push(g.y)),f>0&&f<1&&(g=$t(t,e,r,i,n,a,s,o,f),d.push(g.x),p.push(g.y)),{min:{x:G[z](0,d),y:G[z](0,p)},max:{x:W[z](0,d),y:W[z](0,p)}}}),Qt=e._path2curve=n(function(t,e){var r=!e&&Vt(t);if(!e&&r.curve)return Yt(r.curve);for(var i=Gt(t),n=e&&Gt(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=(function(t,e,r){var i,n,a={T:1,Q:1};if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in a)&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][P](Ut[z](0,[e.x,e.y][P](t.slice(1))));break;case"S":"C"==r||"S"==r?(i=2*e.x-e.bx,n=2*e.y-e.by):(i=e.x,n=e.y),t=["C",i,n][P](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][P](Xt(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][P](Xt(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][P](Ht(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][P](Ht(e.x,e.y,t[1],e.y));break;case"V":t=["C"][P](Ht(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][P](Ht(e.x,e.y,e.X,e.Y))}return t}),l=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)u[e]="A",n&&(c[e]="A"),t.splice(e++,0,["C"][P](r.splice(0,6)));t.splice(e,1),g=W(i.length,n&&n.length||0)}},h=function(t,e,r,a,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),r.bx=0,r.by=0,r.x=t[s][1],r.y=t[s][2],g=W(i.length,n&&n.length||0))},u=[],c=[],f="",p="",d=0,g=W(i.length,n&&n.length||0);dn){if(r&&!c.start){if(f=ke(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p),u+=["C"+f.start.x,f.start.y,f.m.x,f.m.y,f.x,f.y],a)return u;c.start=u,u=["M"+f.x,f.y+"C"+f.n.x,f.n.y,f.end.x,f.end.y,l[5],l[6]].join(),p+=h,s=+l[5],o=+l[6];continue}if(!t&&!r)return f=ke(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p),{x:f.x,y:f.y,alpha:f.alpha}}p+=h,s=+l[5],o=+l[6]}u+=l.shift()+l}return c.end=u,f=t?p:r?c:e.findDotsAtSegment(s,o,l[0],l[1],l[2],l[3],l[4],l[5],1),f.alpha&&(f={x:f.x,y:f.y,alpha:f.alpha}),f}},Ce=Be(1),Se=Be(),Ae=Be(0,1);e.getTotalLength=Ce,e.getPointAtLength=Se,e.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return Ae(t,e).end;var i=Ae(t,r,1);return e?Ae(i,e).end:i},ye.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():Ce(t)},ye.getPointAtLength=function(t){var e=this.getPath();if(e)return Se(e,t)},ye.getPath=function(){var t,r=e._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(t=r(this)),t},ye.getSubpath=function(t,r){var i=this.getPath();if(i)return e.getSubpath(i,t,r)};var Te=e.easing_formulas={linear:function(t){return t},"<":function(t){return X(t,1.7)},">":function(t){return X(t,.48)},"<>":function(t){var e=.48-t/1.04,r=Y.sqrt(.1734+e*e),i=r-e,n=X(H(i),1/3)*(i<0?-1:1),a=-r-e,s=X(H(a),1/3)*(a<0?-1:1),o=n+s+.5;return 3*(1-o)*o*o+o*o*o},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){t-=1;var e=1.70158;return t*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:X(2,-10*t)*Y.sin((t-.075)*(2*U)/.3)+1},bounce:function(t){var e=7.5625,r=2.75,i;return t<1/r?i=e*t*t:t<2/r?(t-=1.5/r,i=e*t*t+.75):t<2.5/r?(t-=2.25/r,i=e*t*t+.9375):(t-=2.625/r,i=e*t*t+.984375),i}};Te.easeIn=Te["ease-in"]=Te["<"],Te.easeOut=Te["ease-out"]=Te[">"],Te.easeInOut=Te["ease-in-out"]=Te["<>"],Te["back-in"]=Te.backIn,Te["back-out"]=Te.backOut;var Ee=[],Me=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,16)},Ne=function(){for(var r=+new Date,i=0;i1&&!n.next){for(v in u)u[A](v)&&(g[v]=n.totalOrigin[v]);n.el.attr(g),b(n.anim,n.el,n.anim.percents[0],null,n.totalOrigin,n.repeat-1)}n.next&&!n.stop&&b(n.anim,n.el,n.next,null,n.totalOrigin,n.repeat)}}}Ee.length&&Me(Ne)},Le=function(t){return t>255?255:t<0?0:t};ye.animateWith=function(t,r,i,n,a,s){var o=this;if(o.removed)return s&&s.call(o),o;var l=i instanceof m?i:e.animation(i,n,a,s),h,u;b(l,o,l.percents[0],null,o.attr());for(var c=0,f=Ee.length;cl&&(l=u)}l+="%",!t[l].callback&&(t[l].callback=n)}return new m(t,r)},ye.animate=function(t,r,i,n){var a=this;if(a.removed)return n&&n.call(a),a;var s=t instanceof m?t:e.animation(t,r,i,n);return b(s,a,s.percents[0],null,a.attr()),a},ye.setTime=function(t,e){return t&&null!=e&&this.status(t,G(e,t.ms)/t.ms),this},ye.status=function(t,e){var r=[],i=0,n,a;if(null!=e)return b(t,this,-1,G(e,1)),this;for(n=Ee.length;i1)for(var i=0,n=r.length;i.5)-1;l(f-.5,2)+l(p-.5,2)>.25&&(p=a.sqrt(.25-l(f-.5,2))*n+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*n)}return c}),n=n.split(/\s*\-\s*/),"linear"==h){var b=n.shift();if(b=-i(b),isNaN(b))return null;var _=[0,0,a.cos(t.rad(b)),a.sin(t.rad(b))],w=1/(s(o(_[2]),o(_[3]))||1);_[2]*=w,_[3]*=w,_[2]<0&&(_[0]=-_[2],_[2]=0),_[3]<0&&(_[1]=-_[3],_[3]=0)}var k=t._parseDots(n);if(!k)return null;if(u=u.replace(/[\(\)\s,\xb0#]/g,"_"),e.gradient&&u!=e.gradient.id&&(g.defs.removeChild(e.gradient),delete e.gradient),!e.gradient){y=v(h+"Gradient",{id:u}),e.gradient=y,v(y,"radial"==h?{fx:f,fy:p}:{x1:_[0],y1:_[1],x2:_[2],y2:_[3],gradientTransform:e.matrix.invert()}),g.defs.appendChild(y);for(var B=0,C=k.length;B1?z.opacity/100:z.opacity});case"stroke":z=t.getRGB(g),l.setAttribute(d,z.hex),"stroke"==d&&z[e]("opacity")&&v(l,{"stroke-opacity":z.opacity>1?z.opacity/100:z.opacity}),"stroke"==d&&i._.arrows&&("startString"in i._.arrows&&_(i,i._.arrows.startString),"endString"in i._.arrows&&_(i,i._.arrows.endString,1));break;case"gradient":("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&x(i,g);break;case"opacity":u.gradient&&!u[e]("stroke-opacity")&&v(l,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){P=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g,c)),P&&(F=P.getElementsByTagName("stop"),v(F[F.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=n(g,10)+"px");var R=d.replace(/(\-.)/g,function(t){return t.substring(1).toUpperCase()});l.style[R]=g,i._.dirty=1,l.setAttribute(d,g)}}S(i,a),l.style.visibility=f},C=1.2,S=function(i,a){if("text"==i.type&&(a[e]("text")||a[e]("font")||a[e]("font-size")||a[e]("x")||a[e]("y"))){var s=i.attrs,o=i.node,l=o.firstChild?n(t._g.doc.defaultView.getComputedStyle(o.firstChild,c).getPropertyValue("font-size"),10):10;if(a[e]("text")){for(s.text=a.text;o.firstChild;)o.removeChild(o.firstChild);for(var h=r(a.text).split("\n"),u=[],f,p=0,d=h.length;p"));var Z=X.getBoundingClientRect();m.W=f.w=(Z.right-Z.left)/U,m.H=f.h=(Z.bottom-Z.top)/U,m.X=f.x,m.Y=f.y+m.H/2,("x"in l||"y"in l)&&(m.path.v=t.format("m{0},{1}l{2},{1}",a(f.x*b),a(f.y*b),a(f.x*b)+1));for(var Q=["x","y","text","font","font-family","font-weight","font-style","font-size"],J=0,K=Q.length;J.25&&(r=n.sqrt(.25-l(e-.5,2))*(2*(r>.5)-1)+.5),f=e+p+r),d}),a=a.split(/\s*\-\s*/),"linear"==c){var g=a.shift();if(g=-i(g),isNaN(g))return null}var v=t._parseDots(a);if(!v)return null;if(e=e.shape||e.node,v.length){e.removeChild(s),s.on=!0,s.method="none",s.color=v[0].color,s.color2=v[v.length-1].color;for(var x=[],y=0,m=v.length;y')}}catch(r){N=function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},t._engine.initWin(t._g.win),t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e.container,i=e.height,n,a=e.width,s=e.x,o=e.y;if(!r)throw new Error("VML container not found.");var l=new t._Paper,h=l.canvas=t._g.doc.createElement("div"),u=h.style;return s=s||0,o=o||0,a=a||512,i=i||342,l.width=a,l.height=i,a==+a&&(a+="px"),i==+i&&(i+="px"),l.coordsize=1e3*b+p+1e3*b,l.coordorigin="0 0",l.span=t._g.doc.createElement("span"),l.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",h.appendChild(l.span),u.cssText=t.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",a,i),1==r?(t._g.doc.body.appendChild(h),u.left=s+"px",u.top=o+"px",u.position="absolute"):r.firstChild?r.insertBefore(h,r.firstChild):r.appendChild(h),l.renderfix=function(){},l},t.prototype.clear=function(){t.eve("raphael.clear",this),this.canvas.innerHTML=d,this.span=t._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},t.prototype.remove=function(){t.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;return!0};var L=t.st;for(var z in M)M[e](z)&&!L[e](z)&&(L[z]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(z))}}.apply(e,i),!(void 0!==n&&(t.exports=n))}])}); \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/js/scripts.js b/wp-content/plugins/antispam-bee/js/scripts.js new file mode 100644 index 0000000..f1ef4ea --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/scripts.js @@ -0,0 +1,20 @@ +jQuery(document).ready( + function($) { + function ab_flag_spam() { + var $$ = $('#ab_flag_spam'), + nextAll = $$.parent('li').nextAll( '.ab_flag_spam_child' ); + + nextAll.css( + 'display', + ( $$.is(':checked') ? 'list-item' : 'none' ) + ); + } + + $('#ab_flag_spam').on( + 'change', + ab_flag_spam + ); + + ab_flag_spam(); + } +); diff --git a/wp-content/plugins/antispam-bee/js/scripts.min.js b/wp-content/plugins/antispam-bee/js/scripts.min.js new file mode 100644 index 0000000..62d49cb --- /dev/null +++ b/wp-content/plugins/antispam-bee/js/scripts.min.js @@ -0,0 +1 @@ +jQuery(document).ready(function(a){function b(){var b=a("#ab_flag_spam"),c=b.parent("li").nextAll(".ab_flag_spam_child");c.css("display",b.is(":checked")?"list-item":"none")}a("#ab_flag_spam").on("change",b),b()}); \ No newline at end of file diff --git a/wp-content/plugins/antispam-bee/readme.txt b/wp-content/plugins/antispam-bee/readme.txt new file mode 100755 index 0000000..45ed497 --- /dev/null +++ b/wp-content/plugins/antispam-bee/readme.txt @@ -0,0 +1,209 @@ +# Antispam Bee # +* Contributors: pluginkollektiv +* Tags: anti-spam, antispam, block spam, comment, comments, comment spam, pingback, spam, spam filter, trackback, GDPR +* Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW +* Requires at least: 4.5 +* Tested up to: 5.1 +* Stable tag: 2.9.1 +* License: GPLv2 or later +* License URI: https://www.gnu.org/licenses/gpl-2.0.html + +Antispam plugin with a sophisticated tool set for effective day to day comment and trackback spam-fighting. Build with data protection and privacy in mind. + +## Description ## +Say Goodbye to comment spam on your WordPress blog or website. *Antispam Bee* blocks spam comments and trackbacks effectively, without captchas and without sending personal information to third party services. It is free of charge, ad-free and 100% GDPR compliant. + +[](http://coderisk.com/wp/plugin/antispam-bee/RIPS-J23dtT1_jC) + +### Feature/Settings Overview ### +* Trust approved commenters. +* Trust commenters with a Gravatar. +* Consider the comment time. +* Allow comments only in a certain language. +* Block or allow commenters from certain countries. +* Treat BBCode as spam. +* Validate the IP address of commenters. +* Use regular expressions. +* Search local spam database for commenters previously marked as spammers. +* Notify admins by e-mail about incoming spam. +* Delete existing spam after n days. +* Limit approval to comments/pings (will delete other comment types). +* Select spam indicators to send comments to deletion directly. +* Optionally exclude trackbacks and pingbacks from spam detection. +* Optionally spam-check comment forms on archive pages. +* Display spam statistics on the dashboard, including daily updates of spam detection rate and a total of blocked spam comments. + +### Support ### +* Community support via the [support forums on wordpress.org](https://wordpress.org/support/plugin/antispam-bee) +* Read [the documentation](https://github.com/pluginkollektiv/antispam-bee/wiki/en-Documentation) +* We don’t handle support via e-mail, Twitter, GitHub issues etc. + +### Contribute ### +* Active development of this plugin is handled [on GitHub](https://github.com/pluginkollektiv/antispam-bee). +* Pull requests for documented bugs are highly appreciated. +* If you think you’ve found a bug (e.g. you’re experiencing unexpected behavior), please post at the [support forums](https://wordpress.org/support/plugin/antispam-bee) first. +* If you want to help us translate this plugin you can do so [on WordPress Translate](https://translate.wordpress.org/projects/wp-plugins/antispam-bee). + +### Credits ### +* Author: [Sergej Müller](https://sergejmueller.github.io/) +* Maintainers: [pluginkollektiv](https://pluginkollektiv.org) + +## Installation ## +* If you don’t know how to install a plugin for WordPress, [here’s how](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins). + +### Requirements ### +* PHP 5.2.4 or greater +* WordPress 3.8 or greater + +### Settings ### +After you have activated *Antispam Bee* the plugin will block spam comments out of the box. However, you may want to visit *Settings → Antispam Bee* to configure your custom set of anti-spam options that works best for your site. + +## Frequently Asked Questions ## + +### Does Antispam Bee work with Jetpack, Disqus Comments and other comment plugins? ### +Antispam Bee works best with default WordPress comments. It is not compatible with Jetpack or Disqus Comments as those plugins load the comment form within an iframe. Thus Antispam Bee can not access the comment form directly. +It also won’t work with any AJAX-powered comment forms. + +### Does Antispam Bee store any private user data, and is it compliant with GDPR? ### +Antispam Bee is developed in Europe. You might have heard we can be a bit nitpicky over here when it comes to privacy. The plugin does not save private user data and is 100% compliant with GDPR. + +### Will I have to edit any theme templates to get Antispam Bee to work? ### +No, the plugin works as is. You may want to configure your favorite settings, though. + +### Does Antispam Bee work with shortened IPs? ### +Generally yes. However, commissioning the Antispam Bee plugin for canceled or shortened IP addresses in comment metadata is not recommended. Because the name and the e-mail address of the comments are not unique, an IP address is the only reliable measure. The more complete the stored IP addresses, the more reliable the assignment or detection of spam. + +### How can I submit undetected spam? ### +If the antispam plugin has passed some spam comments, these comments can be reported for analysis. A [Google table](http://goo.gl/forms/ITzVHXkLVL) was created for this purpose. + +### Antispam Bee with Varnish? ### +If WordPress is operated with Apache + Varnish, the actual IP address of the visitors does not appear in WordPress. Accordingly the Antispam-Plugin lacks the base for the correct functionality. An adaptation in the Varnish configuration file /etc/varnish/default.vcl provides a remedy and forwards the original (not from Apache) IP address in the HTTP header X-Forwarded-For: + +``` +if (req.restarts == 0) { + set req.http.X-Forwarded-For = client.ip; +} +``` + +### Are there some paid services or limitations? ### +No, Antispam Bee is free forever, for both private and commercial projects. You can use it on as many sites as you want. There is no limitation to the number of sites you use the plugin on. + +A complete documentation is available in the [GitHub repository Wiki](https://github.com/pluginkollektiv/antispam-bee/wiki). + +## Changelog ## + +### 2.9.1 ### + * Improved backend accessibility + * Prefilled comment textareas do now work with the honeypot + * AMP compatibility + * Improved dashboard tooltips + * Improvements for the language detection API + * Scalable IP look up for local spam database + +### 2.9.0 ### + * Introduction of coding standards. + * Switch to franc language detection API for the language check. + * Do not longer overwrite the IP address WordPress saves with the comment by using `pre_comment_user_ip`. + * Do not show "Trust commenters with a Gravatar" if the "Show Gravatar" option is not set. + * Skip the checks, when I ping myself. + * Fixes some wrong usages of the translation functions. + * Use the regular expressions check also for trackbacks. + * Add option to delete Antispam Bee related data when plugin gets deleted via the admin interface. + * Save a hashed + salted IP for every comment + * New check for incoming trackbacks. + * Introduction of behat tests. + * Updates the used JavaScript library for the statistics widget. + * Bugfix in the "Comment form used outside of posts" option. + +### 2.8.1 ### + * PHP 5.3 compatibility + * Bugfix where a spam trackback produced a fatal error + * For more details see https://github.com/pluginkollektiv/antispam-bee/milestone/8?closed=1 + +### 2.8.0 ### + * Removed stopforumspam.com to avoid potential GDPR violation + * Improves IP handling to comply with GDPR + * Improves PHP7.2 compatibility + * Fixes small bug on mobile views + * Allow more than one language in language check + * Minor interface improvements + * Remove old russian and Dutch translation files + * For more details see https://github.com/pluginkollektiv/antispam-bee/milestone/4?closed=1 + +### 2.7.1 ### + * Fixes an incompatibility with Chrome autofill + * Fixes some incompatibilities with other plugins/themes where the comment field was left empty + * Support for RTL + * Solve some translation/language issues + * A new filter to add languages to the language check + * For more details see https://github.com/pluginkollektiv/antispam-bee/milestone/6?closed=1 + +### 2.7.0 ### + * Country check is back again (thanks to Sergej Müller for his amazing work and the service page) + * Improved Honeypot + * Language check through Google Translate API is back again (thanks to Simon Kraft of https://moenus.net/ for offering to cover the costs) + * More default Regexes + * Unit Test Framework + * Accessibility and GUI improvements + * An [english documentation](https://github.com/pluginkollektiv/antispam-bee/wiki) is now available, too. Some corrections in the german documentation. + * Some bugfixes - Among other things for WPML compatibility + * For more details see https://github.com/pluginkollektiv/antispam-bee/milestone/3?closed=1 + +### 2.6.9 ### + * Updates donation links throughout the plugin + * Fixes an error were JavaScript on the dashboard was erroneously being enqueued + * Ensures compatibility with the latest WordPress version + +### 2.6.8 ### + * added a POT file + * updated German translation, added formal version + * updated plugin text domain to include a dash instead of an underscore + * updated, translated + formatted README.md + * updated expired link URLs in plugin and languages files + * updated [plugin authors](https://gist.github.com/glueckpress/f058c0ab973d45a72720) + +### 2.6.7 ### + * Removal of functions *Block comments from specific countries* and *Allow comments only in certain language* for financial reasons - [more information](https://plus.google.com/u/0/+SergejMüller/posts/ZyquhoYjUyF) (only german) + +### 2.6.6 ### + * Switch to the official Google Translation API - [more information](https://plus.google.com/u/0/+SergejMüller/posts/ZyquhoYjUyF) (only german) + * *Release time investment (Development & QA): 2.5 h* + +### 2.6.5 ### + * Fix: Return parameters on `dashboard_glance_items` callback / thx [@toscho](https://twitter.com/toscho) + * New function: Trust commenters with a Gravatar / thx [@glueckpress](https://twitter.com/glueckpress) + * Additional plausibility checks and filters + * *Release time investment (Development & QA): 12 h* + +### 2.6.4 ### + * Consideration of the comment time (Spam if a comment was written in less than 5 seconds) - [more information on Google+](https://plus.google.com/+SergejMüller/posts/73EbP6F1BgC) (only german) + * *Release time investment (Development & QA): 6.25 h* + +### 2.6.3 ### + * Sorting for the Antispam Bee column in the spam comments overview + * Code refactoring around the use of REQUEST_URI + * *Release time investment (Development & QA): 2.75 h* + +### 2.6.2 ### + * Improving detection of fake IPs + * *Release time investment (Development & QA): 11 h* + +### 2.6.1 ### + * Code refactoring of options management + * Support for `HTTP_FORWARDED_FOR` header + * *Release time investment (Development & QA): 8.5 h* + +### 2.6.0 ### + * Optimizations for WordPress 3.8 + * Clear invalid UTF-8 characters in comment fields + * Spam reason as a column in the table with spam comments + +For the complete changelog, check out our [GitHub repository](https://github.com/pluginkollektiv/antispam-bee). + +== Upgrade Notice == + += 2.8.0 = +This update makes sure your spam check is GDPR compliant, no matter the options you choose. Please make sure to update before May 25th! + +## Screenshots ## +1. Antispam Bee settings diff --git a/wp-content/plugins/classic-editor/LICENSE.md b/wp-content/plugins/classic-editor/LICENSE.md new file mode 100644 index 0000000..7918e38 --- /dev/null +++ b/wp-content/plugins/classic-editor/LICENSE.md @@ -0,0 +1,400 @@ +### WordPress - Web publishing software + + Copyright 2011-2019 by the contributors + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +This program incorporates work covered by the following copyright and +permission notices: + + b2 is (c) 2001, 2002 Michel Valdrighi - m@tidakada.com - + http://tidakada.com + + Wherever third party code has been used, credit has been given in the code's + comments. + + b2 is released under the GPL + +and + + WordPress - Web publishing software + + Copyright 2003-2010 by the contributors + + WordPress is released under the GPL + +--- + +### GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +### Preamble + +The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, +we want its recipients to know that what they have is not the +original, so that any problems introduced by others will not reflect +on the original authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at +all. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +**0.** This License applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work +based on the Program" means either the Program or any derivative work +under copyright law: that is to say, a work containing the Program or +a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is +included without limitation in the term "modification".) Each licensee +is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +**1.** You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a +fee. + +**2.** You may modify your copy or copies of the Program or any +portion of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + +**a)** You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + + +**b)** You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any part +thereof, to be licensed as a whole at no charge to all third parties +under the terms of this License. + + +**c)** If the modified program normally reads commands interactively +when run, you must cause it, when started running for such interactive +use in the most ordinary way, to print or display an announcement +including an appropriate copyright notice and a notice that there is +no warranty (or else, saying that you provide a warranty) and that +users may redistribute the program under these conditions, and telling +the user how to view a copy of this License. (Exception: if the +Program itself is interactive but does not normally print such an +announcement, your work based on the Program is not required to print +an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +**3.** You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + +**a)** Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections 1 +and 2 above on a medium customarily used for software interchange; or, + + +**b)** Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your cost of +physically performing source distribution, a complete machine-readable +copy of the corresponding source code, to be distributed under the +terms of Sections 1 and 2 above on a medium customarily used for +software interchange; or, + + +**c)** Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is allowed +only for noncommercial distribution and only if you received the +program in object code or executable form with such an offer, in +accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +**4.** You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and +will automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +**5.** You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +**6.** Each time you redistribute the Program (or any work based on +the Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +**7.** If, as a consequence of a court judgment or allegation of +patent infringement or for any other reason (not limited to patent +issues), conditions are imposed on you (whether by court order, +agreement or otherwise) that contradict the conditions of this +License, they do not excuse you from the conditions of this License. +If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, +then as a consequence you may not distribute the Program at all. For +example, if a patent license would not permit royalty-free +redistribution of the Program by all those who receive copies directly +or indirectly through you, then the only way you could satisfy both it +and this License would be to refrain entirely from distribution of the +Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +**8.** If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +**9.** The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a +version number of this License, you may choose any version ever +published by the Free Software Foundation. + +**10.** If you wish to incorporate parts of the Program into other +free programs whose distribution conditions are different, write to +the author to ask for permission. For software which is copyrighted by +the Free Software Foundation, write to the Free Software Foundation; +we sometimes make exceptions for this. Our decision will be guided by +the two goals of preserving the free status of all derivatives of our +free software and of promoting the sharing and reuse of software +generally. + +**NO WARRANTY** + +**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. + Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper +mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details + type `show w'. This is free software, and you are welcome + to redistribute it under certain conditions; type `show c' + for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than \`show w' and +\`show c'; they could even be mouse-clicks or menu items--whatever +suits your program. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the program, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright + interest in the program `Gnomovision' + (which makes passes at compilers) written + by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, +you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +[GNU Lesser General Public +License](http://www.gnu.org/licenses/lgpl.html) instead of this +License. diff --git a/wp-content/plugins/classic-editor/classic-editor.php b/wp-content/plugins/classic-editor/classic-editor.php new file mode 100644 index 0000000..3e6e242 --- /dev/null +++ b/wp-content/plugins/classic-editor/classic-editor.php @@ -0,0 +1,941 @@ + 'classic', // Accepted values: 'classic', 'block'. + * 'allow-users' => false, + * + * @param boolean To override the settings return an array with the above keys. + */ + $settings = apply_filters( 'classic_editor_plugin_settings', false ); + + if ( is_array( $settings ) ) { + return array( + 'editor' => ( isset( $settings['editor'] ) && $settings['editor'] === 'block' ) ? 'block' : 'classic', + 'allow-users' => ! empty( $settings['allow-users'] ), + 'hide-settings-ui' => true, + ); + } + + if ( ! empty( self::$settings ) && $refresh === 'no' ) { + return self::$settings; + } + + if ( is_multisite() ) { + $defaults = array( + 'editor' => get_network_option( null, 'classic-editor-replace' ) === 'block' ? 'block' : 'classic', + 'allow-users' => false, + ); + + /** + * Filters the default network options. + * + * @param array $defaults The default options array. See `classic_editor_plugin_settings` for supported keys and values. + */ + $defaults = apply_filters( 'classic_editor_network_default_settings', $defaults ); + + if ( get_network_option( null, 'classic-editor-allow-sites' ) !== 'allow' ) { + // Per-site settings are disabled. Return default network options nad hide the settings UI. + $defaults['hide-settings-ui'] = true; + return $defaults; + } + + // Override with the site options. + $editor_option = get_option( 'classic-editor-replace' ); + $allow_users_option = get_option( 'classic-editor-allow-users' ); + + if ( $editor_option ) { + $defaults['editor'] = $editor_option; + } + if ( $allow_users_option ) { + $defaults['allow-users'] = ( $allow_users_option === 'allow' ); + } + + $editor = ( isset( $defaults['editor'] ) && $defaults['editor'] === 'block' ) ? 'block' : 'classic'; + $allow_users = ! empty( $defaults['allow-users'] ); + } else { + $allow_users = ( get_option( 'classic-editor-allow-users' ) === 'allow' ); + $option = get_option( 'classic-editor-replace' ); + + // Normalize old options. + if ( $option === 'block' || $option === 'no-replace' ) { + $editor = 'block'; + } else { + // empty( $option ) || $option === 'classic' || $option === 'replace'. + $editor = 'classic'; + } + } + + // Override the defaults with the user options. + if ( ( ! isset( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'options-writing.php' ) && $allow_users ) { + $user_options = get_user_option( 'classic-editor-settings' ); + + if ( $user_options === 'block' || $user_options === 'classic' ) { + $editor = $user_options; + } + } + + self::$settings = array( + 'editor' => $editor, + 'hide-settings-ui' => false, + 'allow-users' => $allow_users, + ); + + return self::$settings; + } + + private static function is_classic( $post_id = 0 ) { + if ( ! $post_id ) { + $post_id = self::get_edited_post_id(); + } + + if ( $post_id ) { + $settings = self::get_settings(); + + if ( $settings['allow-users'] && ! isset( $_GET['classic-editor__forget'] ) ) { + $which = get_post_meta( $post_id, 'classic-editor-remember', true ); + + if ( $which ) { + // The editor choice will be "remembered" when the post is opened in either Classic or Block editor. + if ( 'classic-editor' === $which ) { + return true; + } elseif ( 'block-editor' === $which ) { + return false; + } + } + + return ( ! self::has_blocks( $post_id ) ); + } + } + + if ( isset( $_GET['classic-editor'] ) ) { + return true; + } + + return false; + } + + /** + * Get the edited post ID (early) when loading the Edit Post screen. + */ + private static function get_edited_post_id() { + if ( + ! empty( $_GET['post'] ) && + ! empty( $_GET['action'] ) && + $_GET['action'] === 'edit' && + ! empty( $GLOBALS['pagenow'] ) && + $GLOBALS['pagenow'] === 'post.php' + ) { + return (int) $_GET['post']; // post_ID + } + + return 0; + } + + public static function register_settings() { + // Add an option to Settings -> Writing + register_setting( 'writing', 'classic-editor-replace', array( + 'sanitize_callback' => array( __CLASS__, 'validate_option_editor' ), + ) ); + + register_setting( 'writing', 'classic-editor-allow-users', array( + 'sanitize_callback' => array( __CLASS__, 'validate_option_allow_users' ), + ) ); + + add_option_whitelist( array( + 'writing' => array( 'classic-editor-replace', 'classic-editor-allow-users' ), + ) ); + + $heading_1 = __( 'Default editor for all users', 'classic-editor' ); + $heading_2 = __( 'Allow users to switch editors', 'classic-editor' ); + + add_settings_field( 'classic-editor-1', $heading_1, array( __CLASS__, 'settings_1' ), 'writing' ); + add_settings_field( 'classic-editor-2', $heading_2, array( __CLASS__, 'settings_2' ), 'writing' ); + } + + public static function save_user_settings( $user_id ) { + if ( + isset( $_POST['classic-editor-user-settings'] ) && + isset( $_POST['classic-editor-replace'] ) && + wp_verify_nonce( $_POST['classic-editor-user-settings'], 'allow-user-settings' ) + ) { + $user_id = (int) $user_id; + + if ( $user_id !== get_current_user_id() && ! current_user_can( 'edit_user', $user_id ) ) { + return; + } + + $editor = self::validate_option_editor( $_POST['classic-editor-replace'] ); + update_user_option( $user_id, 'classic-editor-settings', $editor ); + } + } + + /** + * Validate + */ + public static function validate_option_editor( $value ) { + if ( $value === 'block' ) { + return 'block'; + } + + return 'classic'; + } + + public static function validate_option_allow_users( $value ) { + if ( $value === 'allow' ) { + return 'allow'; + } + + return 'disallow'; + } + + public static function settings_1() { + $settings = self::get_settings( 'refresh' ); + + ?> +
                    +

                    + /> + +

                    +

                    + /> + +

                    +
                    + + +
                    +

                    + /> + +

                    +

                    + /> + +

                    +
                    + + + + + + +
                    + + +
                    + + +

                    + + + + + + + + + + +
                    +

                    + /> + +

                    +

                    + /> + +

                    +
                    + > + +

                    +
                    + + + ID, 'classic-editor' ); + } + } + + /** + * Remember when the Block Editor was used to edit a post. + */ + public static function remember_block_editor( $editor_settings, $post ) { + $post_type = get_post_type( $post ); + + if ( $post_type && self::can_edit_post_type( $post_type ) ) { + self::remember( $post->ID, 'block-editor' ); + } + + return $editor_settings; + } + + private static function remember( $post_id, $editor ) { + if ( get_post_meta( $post_id, 'classic-editor-remember', true ) !== $editor ) { + update_post_meta( $post_id, 'classic-editor-remember', $editor ); + } + } + + /** + * Choose which editor to use for a post. + * + * Passes through `$which_editor` for Block Editor (it's sets to `true` but may be changed by another plugin). + * + * @uses `use_block_editor_for_post` filter. + * + * @param boolean $use_block_editor True for Block Editor, false for Classic Editor. + * @param WP_Post $post The post being edited. + * @return boolean True for Block Editor, false for Classic Editor. + */ + public static function choose_editor( $use_block_editor, $post ) { + $settings = self::get_settings(); + $editors = self::get_enabled_editors_for_post( $post ); + + // If no editor is supported, pass through `$use_block_editor`. + if ( ! $editors['block_editor'] && ! $editors['classic_editor'] ) { + return $use_block_editor; + } + + // Open the default editor when no $post and for "Add New" links, + // or the alternate editor when the user is switching editors. + if ( empty( $post->ID ) || $post->post_status === 'auto-draft' ) { + if ( + ( $settings['editor'] === 'classic' && ! isset( $_GET['classic-editor__forget'] ) ) || // Add New + ( isset( $_GET['classic-editor'] ) && isset( $_GET['classic-editor__forget'] ) ) // Switch to Classic Editor when no draft post. + ) { + $use_block_editor = false; + } + } elseif ( self::is_classic( $post->ID ) ) { + $use_block_editor = false; + } + + // Enforce the editor if set by plugins. + if ( $use_block_editor && ! $editors['block_editor'] ) { + $use_block_editor = false; + } elseif ( ! $use_block_editor && ! $editors['classic_editor'] && $editors['block_editor'] ) { + $use_block_editor = true; + } + + return $use_block_editor; + } + + /** + * Keep the `classic-editor` query arg through redirects when saving posts. + */ + public static function redirect_location( $location ) { + if ( + isset( $_REQUEST['classic-editor'] ) || + ( isset( $_POST['_wp_http_referer'] ) && strpos( $_POST['_wp_http_referer'], '&classic-editor' ) !== false ) + ) { + $location = add_query_arg( 'classic-editor', '', $location ); + } + + return $location; + } + + /** + * Keep the `classic-editor` query arg when looking at revisions. + */ + public static function get_edit_post_link( $url ) { + $settings = self::get_settings(); + + if ( isset( $_REQUEST['classic-editor'] ) || $settings['editor'] === 'classic' ) { + $url = add_query_arg( 'classic-editor', '', $url ); + } + + return $url; + } + + public static function add_meta_box( $post_type, $post ) { + $editors = self::get_enabled_editors_for_post( $post ); + + if ( ! $editors['block_editor'] || ! $editors['classic_editor'] ) { + // Editors cannot be switched. + return; + } + + $id = 'classic-editor-switch-editor'; + $title = __( 'Editor', 'classic-editor' ); + $callback = array( __CLASS__, 'do_meta_box' ); + $args = array( + '__back_compat_meta_box' => true, + ); + + add_meta_box( $id, $title, $callback, null, 'side', 'default', $args ); + } + + public static function do_meta_box( $post ) { + $edit_url = get_edit_post_link( $post->ID, 'raw' ); + + // Switching to Block Editor. + $edit_url = remove_query_arg( 'classic-editor', $edit_url ); + // Forget the previous value when going to a specific editor. + $edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url ); + + ?> +

                    + +

                    + __( 'Switch to Classic Editor', 'classic-editor' ) ) + ); + } + + /** + * Add a link to the settings on the Plugins screen. + */ + public static function add_settings_link( $links, $file ) { + $settings = self::get_settings(); + + if ( $file === 'classic-editor/classic-editor.php' && ! $settings['hide-settings-ui'] && current_user_can( 'manage_options' ) ) { + if ( current_filter() === 'plugin_action_links' ) { + $url = admin_url( 'options-writing.php#classic-editor-options' ); + } else { + $url = admin_url( '/network/settings.php#classic-editor-options' ); + } + + // Prevent warnings in PHP 7.0+ when a plugin uses this filter incorrectly. + $links = (array) $links; + $links[] = sprintf( '%s', $url, __( 'Settings', 'classic-editor' ) ); + } + + return $links; + } + + private static function can_edit_post_type( $post_type ) { + $can_edit = false; + + if ( function_exists( 'gutenberg_can_edit_post_type' ) ) { + $can_edit = gutenberg_can_edit_post_type( $post_type ); + } elseif ( function_exists( 'use_block_editor_for_post_type' ) ) { + $can_edit = use_block_editor_for_post_type( $post_type ); + } + + return $can_edit; + } + + /** + * Checks which editors are enabled for the post type. + * + * @param string $post_type The post type. + * @return array Associative array of the editors and whether they are enabled for the post type. + */ + private static function get_enabled_editors_for_post_type( $post_type ) { + if ( isset( self::$supported_post_types[ $post_type ] ) ) { + return self::$supported_post_types[ $post_type ]; + } + + $classic_editor = post_type_supports( $post_type, 'editor' ); + $block_editor = self::can_edit_post_type( $post_type ); + + $editors = array( + 'classic_editor' => $classic_editor, + 'block_editor' => $block_editor, + ); + + /** + * Filters the editors that are enabled for the post type. + * + * @param array $editors Associative array of the editors and whether they are enabled for the post type. + * @param string $post_type The post type. + */ + $editors = apply_filters( 'classic_editor_enabled_editors_for_post_type', $editors, $post_type ); + self::$supported_post_types[ $post_type ] = $editors; + + return $editors; + } + + /** + * Checks which editors are enabled for the post. + * + * @param WP_Post $post The post object. + * @return array Associative array of the editors and whether they are enabled for the post. + */ + private static function get_enabled_editors_for_post( $post ) { + $post_type = get_post_type( $post ); + + if ( ! $post_type ) { + return array( + 'classic_editor' => false, + 'block_editor' => false, + ); + } + + $editors = self::get_enabled_editors_for_post_type( $post_type ); + + /** + * Filters the editors that are enabled for the post. + * + * @param array $editors Associative array of the editors and whether they are enabled for the post. + * @param WP_Post $post The post object. + */ + return apply_filters( 'classic_editor_enabled_editors_for_post', $editors, $post ); + } + + /** + * Adds links to the post/page screens to edit any post or page in + * the Classic Editor or Block Editor. + * + * @param array $actions Post actions. + * @param WP_Post $post Edited post. + * @return array Updated post actions. + */ + public static function add_edit_links( $actions, $post ) { + // This is in Gutenberg, don't duplicate it. + if ( array_key_exists( 'classic', $actions ) ) { + unset( $actions['classic'] ); + } + + if ( ! array_key_exists( 'edit', $actions ) ) { + return $actions; + } + + $edit_url = get_edit_post_link( $post->ID, 'raw' ); + + if ( ! $edit_url ) { + return $actions; + } + + $editors = self::get_enabled_editors_for_post( $post ); + + // Do not show the links if only one editor is available. + if ( ! $editors['classic_editor'] || ! $editors['block_editor'] ) { + return $actions; + } + + // Forget the previous value when going to a specific editor. + $edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url ); + + // Build the edit actions. See also: WP_Posts_List_Table::handle_row_actions(). + $title = _draft_or_post_title( $post->ID ); + + // Link to the Block Editor. + $url = remove_query_arg( 'classic-editor', $edit_url ); + $text = _x( 'Edit (Block Editor)', 'Editor Name', 'classic-editor' ); + /* translators: %s: post title */ + $label = sprintf( __( 'Edit “%s” in the Block Editor', 'classic-editor' ), $title ); + $edit_block = sprintf( '%s', esc_url( $url ), esc_attr( $label ), $text ); + + // Link to the Classic Editor. + $url = add_query_arg( 'classic-editor', '', $edit_url ); + $text = _x( 'Edit (Classic Editor)', 'Editor Name', 'classic-editor' ); + /* translators: %s: post title */ + $label = sprintf( __( 'Edit “%s” in the Classic Editor', 'classic-editor' ), $title ); + $edit_classic = sprintf( '%s', esc_url( $url ), esc_attr( $label ), $text ); + + $edit_actions = array( + 'classic-editor-block' => $edit_block, + 'classic-editor-classic' => $edit_classic, + ); + + // Insert the new Edit actions instead of the Edit action. + $edit_offset = array_search( 'edit', array_keys( $actions ), true ); + array_splice( $actions, $edit_offset, 1, $edit_actions ); + + return $actions; + } + + /** + * Show the editor that will be used in a "post state" in the Posts list table. + */ + public static function add_post_state( $post_states, $post ) { + if ( get_post_status( $post ) === 'trash' ) { + return $post_states; + } + + $editors = self::get_enabled_editors_for_post( $post ); + + if ( ! $editors['classic_editor'] && ! $editors['block_editor'] ) { + return $post_states; + } elseif ( $editors['classic_editor'] && ! $editors['block_editor'] ) { + // Forced to Classic Editor. + $state = '' . _x( 'Classic Editor', 'Editor Name', 'classic-editor' ) . ''; + } elseif ( ! $editors['classic_editor'] && $editors['block_editor'] ) { + // Forced to Block Editor. + $state = '' . _x( 'Block Editor', 'Editor Name', 'classic-editor' ) . ''; + } else { + $last_editor = get_post_meta( $post->ID, 'classic-editor-remember', true ); + + if ( $last_editor ) { + $is_classic = ( $last_editor === 'classic-editor' ); + } elseif ( ! empty( $post->post_content ) ) { + $is_classic = ! self::has_blocks( $post->post_content ); + } else { + $settings = self::get_settings(); + $is_classic = ( $settings['editor'] === 'classic' ); + } + + $state = $is_classic ? _x( 'Classic Editor', 'Editor Name', 'classic-editor' ) : _x( 'Block Editor', 'Editor Name', 'classic-editor' ); + } + + // Fix PHP 7+ warnings if another plugin returns unexpected type. + $post_states = (array) $post_states; + $post_states['classic-editor-plugin'] = $state; + + return $post_states; + } + + public static function add_edit_php_inline_style() { + ?> + + post_content; + } + } + + return false !== strpos( (string) $post, ' + +
                    +initial() ) : +?> +

                    + + +

                    +shortcode( array( 'use_old_format' => true ) ) ) : +?> +

                    + + +

                    + +
                    + + + +
                    + +
                    +

                    +
                    +
                    + +
                    + + + +initial() ) : + $copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id ); +?> + /> + +
                    + +
                    + +
                    + +
                    + +initial() ) : + $delete_nonce = wp_create_nonce( 'wpcf7-delete-contact-form_' . $post_id ); +?> +
                    + /> +
                    + + +
                    + + +
                    +
                    +
                    +
                    +
                    +
                    + + +
                    +

                    +
                    +

                    +
                      +
                    1. +
                    2. +
                    3. +
                    +
                    +
                    + +
                    + +
                    +
                    +
                    ', + sprintf( + '%s', + /* translators: screen reader text */ + esc_html( __( '(left and right arrow)', 'contact-form-7' ) ) + ) + ); +?>
                    + + array( + 'title' => __( 'Form', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_form', + ), + 'mail-panel' => array( + 'title' => __( 'Mail', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_mail', + ), + 'messages-panel' => array( + 'title' => __( 'Messages', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_messages', + ), + ); + + $additional_settings = trim( $post->prop( 'additional_settings' ) ); + $additional_settings = explode( "\n", $additional_settings ); + $additional_settings = array_filter( $additional_settings ); + $additional_settings = count( $additional_settings ); + + $panels['additional-settings-panel'] = array( + 'title' => $additional_settings + /* translators: %d: number of additional settings */ + ? sprintf( + __( 'Additional Settings (%d)', 'contact-form-7' ), + $additional_settings ) + : __( 'Additional Settings', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_additional_settings', + ); + } + + $panels = apply_filters( 'wpcf7_editor_panels', $panels ); + + foreach ( $panels as $id => $panel ) { + $editor->add_panel( $id, $panel['title'], $panel['callback'] ); + } + + $editor->display(); +?> +
                    + + +

                    + + +
                    + + +
                    + + + + + + + +print_panels( $post ); + + do_action( 'wpcf7_admin_footer', $post ); diff --git a/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php b/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php new file mode 100644 index 0000000..ba55018 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php @@ -0,0 +1,22 @@ +add( $name, $title, $callback, $options ); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/class-contact-forms-list-table.php b/wp-content/plugins/contact-form-7/admin/includes/class-contact-forms-list-table.php new file mode 100644 index 0000000..8f731d0 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/class-contact-forms-list-table.php @@ -0,0 +1,253 @@ + '', + 'title' => __( 'Title', 'contact-form-7' ), + 'shortcode' => __( 'Shortcode', 'contact-form-7' ), + 'author' => __( 'Author', 'contact-form-7' ), + 'date' => __( 'Date', 'contact-form-7' ), + ); + + return $columns; + } + + public function __construct() { + parent::__construct( array( + 'singular' => 'post', + 'plural' => 'posts', + 'ajax' => false, + ) ); + } + + public function prepare_items() { + $current_screen = get_current_screen(); + $per_page = $this->get_items_per_page( 'cfseven_contact_forms_per_page' ); + + $args = array( + 'posts_per_page' => $per_page, + 'orderby' => 'title', + 'order' => 'ASC', + 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, + ); + + if ( ! empty( $_REQUEST['s'] ) ) { + $args['s'] = $_REQUEST['s']; + } + + if ( ! empty( $_REQUEST['orderby'] ) ) { + if ( 'title' == $_REQUEST['orderby'] ) { + $args['orderby'] = 'title'; + } elseif ( 'author' == $_REQUEST['orderby'] ) { + $args['orderby'] = 'author'; + } elseif ( 'date' == $_REQUEST['orderby'] ) { + $args['orderby'] = 'date'; + } + } + + if ( ! empty( $_REQUEST['order'] ) ) { + if ( 'asc' == strtolower( $_REQUEST['order'] ) ) { + $args['order'] = 'ASC'; + } elseif ( 'desc' == strtolower( $_REQUEST['order'] ) ) { + $args['order'] = 'DESC'; + } + } + + $this->items = WPCF7_ContactForm::find( $args ); + + $total_items = WPCF7_ContactForm::count(); + $total_pages = ceil( $total_items / $per_page ); + + $this->set_pagination_args( array( + 'total_items' => $total_items, + 'total_pages' => $total_pages, + 'per_page' => $per_page, + ) ); + } + + public function get_columns() { + return get_column_headers( get_current_screen() ); + } + + protected function get_sortable_columns() { + $columns = array( + 'title' => array( 'title', true ), + 'author' => array( 'author', false ), + 'date' => array( 'date', false ), + ); + + return $columns; + } + + protected function get_bulk_actions() { + $actions = array( + 'delete' => __( 'Delete', 'contact-form-7' ), + ); + + return $actions; + } + + protected function column_default( $item, $column_name ) { + return ''; + } + + public function column_cb( $item ) { + return sprintf( + '', + $this->_args['singular'], + $item->id() + ); + } + + public function column_title( $item ) { + $edit_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'edit', + ), + menu_page_url( 'wpcf7', false ) + ); + + $output = sprintf( + '%3$s', + esc_url( $edit_link ), + /* translators: %s: title of contact form */ + esc_attr( sprintf( __( 'Edit “%s”', 'contact-form-7' ), + $item->title() ) ), + esc_html( $item->title() ) + ); + + $output = sprintf( '%s', $output ); + + if ( wpcf7_validate_configuration() + and current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { + $config_validator = new WPCF7_ConfigValidator( $item ); + $config_validator->restore(); + + if ( $count_errors = $config_validator->count_errors() ) { + $error_notice = sprintf( + /* translators: %s: number of errors detected */ + _n( + '%s configuration error detected', + '%s configuration errors detected', + $count_errors, 'contact-form-7' ), + number_format_i18n( $count_errors ) + ); + + $output .= sprintf( + '
                    %s
                    ', + $error_notice + ); + } + } + + return $output; + } + + protected function handle_row_actions( $item, $column_name, $primary ) { + if ( $column_name !== $primary ) { + return ''; + } + + $edit_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'edit', + ), + menu_page_url( 'wpcf7', false ) + ); + + $actions = array( + 'edit' => wpcf7_link( $edit_link, __( 'Edit', 'contact-form-7' ) ), + ); + + if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { + $copy_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'copy', + ), + menu_page_url( 'wpcf7', false ) + ); + + $copy_link = wp_nonce_url( + $copy_link, + 'wpcf7-copy-contact-form_' . absint( $item->id() ) + ); + + $actions = array_merge( $actions, array( + 'copy' => wpcf7_link( $copy_link, __( 'Duplicate', 'contact-form-7' ) ), + ) ); + } + + return $this->row_actions( $actions ); + } + + public function column_author( $item ) { + $post = get_post( $item->id() ); + + if ( ! $post ) { + return; + } + + $author = get_userdata( $post->post_author ); + + if ( false === $author ) { + return; + } + + return esc_html( $author->display_name ); + } + + public function column_shortcode( $item ) { + $shortcodes = array( $item->shortcode() ); + + $output = ''; + + foreach ( $shortcodes as $shortcode ) { + $output .= "\n" . ''; + } + + return trim( $output ); + } + + public function column_date( $item ) { + $post = get_post( $item->id() ); + + if ( ! $post ) { + return; + } + + $t_time = mysql2date( __( 'Y/m/d g:i:s A', 'contact-form-7' ), + $post->post_date, true ); + $m_time = $post->post_date; + $time = mysql2date( 'G', $post->post_date ) + - get_option( 'gmt_offset' ) * 3600; + + $time_diff = time() - $time; + + if ( $time_diff > 0 and $time_diff < 24*60*60 ) { + $h_time = sprintf( + /* translators: %s: time since the creation of the contact form */ + __( '%s ago', 'contact-form-7' ), + human_time_diff( $time ) + ); + } else { + $h_time = mysql2date( __( 'Y/m/d', 'contact-form-7' ), $m_time ); + } + + return sprintf( '%1$s', + esc_html( $h_time ), + esc_attr( $t_time ) + ); + } +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/config-validator.php b/wp-content/plugins/contact-form-7/admin/includes/config-validator.php new file mode 100644 index 0000000..ba93e89 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/config-validator.php @@ -0,0 +1,135 @@ + 'validate' ), + menu_page_url( 'wpcf7', false ) + ), + __( 'Validate Contact Form 7 Configuration', 'contact-form-7' ) + ); + + $message = __( "Misconfiguration leads to mail delivery failure or other troubles. Validate your contact forms now.", 'contact-form-7' ); + + echo sprintf( + '

                    %1$s » %2$s

                    ', + esc_html( $message ), + $link + ); +} + +add_action( 'wpcf7_admin_load', 'wpcf7_load_bulk_validate_page', 10, 2 ); + +function wpcf7_load_bulk_validate_page( $page, $action ) { + if ( 'wpcf7' != $page + or 'validate' != $action + or ! wpcf7_validate_configuration() + or 'POST' != $_SERVER['REQUEST_METHOD'] ) { + return; + } + + check_admin_referer( 'wpcf7-bulk-validate' ); + + if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { + wp_die( __( "You are not allowed to validate configuration.", 'contact-form-7' ) ); + } + + $contact_forms = WPCF7_ContactForm::find(); + + $result = array( + 'timestamp' => current_time( 'timestamp' ), + 'version' => WPCF7_VERSION, + 'count_valid' => 0, + 'count_invalid' => 0, + ); + + foreach ( $contact_forms as $contact_form ) { + $config_validator = new WPCF7_ConfigValidator( $contact_form ); + $config_validator->validate(); + $config_validator->save(); + + if ( $config_validator->is_valid() ) { + $result['count_valid'] += 1; + } else { + $result['count_invalid'] += 1; + } + } + + WPCF7::update_option( 'bulk_validate', $result ); + + $redirect_to = add_query_arg( + array( + 'message' => 'validated', + ), + menu_page_url( 'wpcf7', false ) + ); + + wp_safe_redirect( $redirect_to ); + exit(); +} + +function wpcf7_admin_bulk_validate_page() { + $contact_forms = WPCF7_ContactForm::find(); + $count = WPCF7_ContactForm::count(); + + $submit_text = sprintf( + /* translators: %s: number of contact forms */ + _n( + "Validate %s Contact Form Now", + "Validate %s Contact Forms Now", + $count, 'contact-form-7' ), + number_format_i18n( $count ) ); + +?> +
                    + +

                    + +
                    + + +

                    +
                    + + + +
                    +contact_form = $contact_form; + } + + public function add_panel( $id, $title, $callback ) { + if ( wpcf7_is_name( $id ) ) { + $this->panels[$id] = array( + 'title' => $title, + 'callback' => $callback, + ); + } + } + + public function display() { + if ( empty( $this->panels ) ) { + return; + } + + echo '
                      '; + + foreach ( $this->panels as $id => $panel ) { + echo sprintf( '
                    • %2$s
                    • ', + esc_attr( $id ), esc_html( $panel['title'] ) ); + } + + echo '
                    '; + + foreach ( $this->panels as $id => $panel ) { + echo sprintf( '
                    ', + esc_attr( $id ) ); + + if ( is_callable( $panel['callback'] ) ) { + $this->notice( $id, $panel ); + call_user_func( $panel['callback'], $this->contact_form ); + } + + echo '
                    '; + } + } + + public function notice( $id, $panel ) { + echo '
                    '; + } +} + +function wpcf7_editor_panel_form( $post ) { + $desc_link = wpcf7_link( + __( 'https://contactform7.com/editing-form-template/', 'contact-form-7' ), + __( 'Editing Form Template', 'contact-form-7' ) ); + $description = __( "You can edit the form template here. For details, see %s.", 'contact-form-7' ); + $description = sprintf( esc_html( $description ), $desc_link ); +?> + +

                    + +
                    + + +print_buttons(); +?> + + +
                    +'; + + wpcf7_editor_box_mail( $post, array( + 'id' => 'wpcf7-mail-2', + 'name' => 'mail_2', + 'title' => __( 'Mail (2)', 'contact-form-7' ), + 'use' => __( 'Use Mail (2)', 'contact-form-7' ), + ) ); +} + +function wpcf7_editor_box_mail( $post, $args = '' ) { + $args = wp_parse_args( $args, array( + 'id' => 'wpcf7-mail', + 'name' => 'mail', + 'title' => __( 'Mail', 'contact-form-7' ), + 'use' => null, + ) ); + + $id = esc_attr( $args['id'] ); + + $mail = wp_parse_args( $post->prop( $args['name'] ), array( + 'active' => false, + 'recipient' => '', + 'sender' => '', + 'subject' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) ); + +?> +
                    +

                    + + + +

                    + + +
                    + +'; + + echo esc_html( __( "In the following fields, you can use these mail-tags:", + 'contact-form-7' ) ); + echo '
                    '; + $post->suggest_mail_tags( $args['name'] ); +?> +
                    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                    + + + +
                    + + + +
                    + + + +
                    + + + +
                    + + + + +

                    + +

                    +
                    + + + +
                    +
                    +
                    + +

                    +
                    + + $arr ) { + $field_id = sprintf( 'wpcf7-message-%s', strtr( $key, '_', '-' ) ); + $field_name = sprintf( 'wpcf7-messages[%s]', $key ); + +?> +

                    + +

                    + +
                    + +

                    +
                    + + +
                    +screen = $screen; + } + + public function set_help_tabs( $type ) { + switch ( $type ) { + case 'list': + $this->screen->add_help_tab( array( + 'id' => 'list_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'list_overview' ) ) ); + + $this->screen->add_help_tab( array( + 'id' => 'list_available_actions', + 'title' => __( 'Available Actions', 'contact-form-7' ), + 'content' => $this->content( 'list_available_actions' ) ) ); + + $this->sidebar(); + + return; + case 'edit': + $this->screen->add_help_tab( array( + 'id' => 'edit_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'edit_overview' ) ) ); + + $this->screen->add_help_tab( array( + 'id' => 'edit_form_tags', + 'title' => __( 'Form-tags', 'contact-form-7' ), + 'content' => $this->content( 'edit_form_tags' ) ) ); + + $this->screen->add_help_tab( array( + 'id' => 'edit_mail_tags', + 'title' => __( 'Mail-tags', 'contact-form-7' ), + 'content' => $this->content( 'edit_mail_tags' ) ) ); + + $this->sidebar(); + + return; + case 'integration': + $this->screen->add_help_tab( array( + 'id' => 'integration_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'integration_overview' ) ) ); + + $this->sidebar(); + + return; + } + } + + private function content( $name ) { + $content = array(); + + $content['list_overview'] = '

                    ' . __( "On this screen, you can manage contact forms provided by Contact Form 7. You can manage an unlimited number of contact forms. Each contact form has a unique ID and Contact Form 7 shortcode ([contact-form-7 ...]). To insert a contact form into a post or a text widget, insert the shortcode into the target.", 'contact-form-7' ) . '

                    '; + + $content['list_available_actions'] = '

                    ' . __( "Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:", 'contact-form-7' ) . '

                    '; + $content['list_available_actions'] .= '

                    ' . __( "Edit - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.", 'contact-form-7' ) . '

                    '; + $content['list_available_actions'] .= '

                    ' . __( "Duplicate - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.", 'contact-form-7' ) . '

                    '; + + $content['edit_overview'] = '

                    ' . __( "On this screen, you can edit a contact form. A contact form is comprised of the following components:", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "Title is the title of a contact form. This title is only used for labeling a contact form, and can be edited.", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "Form is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7’s form-tags here.", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "Mail manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7’s mail-tags here.", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "Mail (2) is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "In Messages, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.", 'contact-form-7' ) . '

                    '; + $content['edit_overview'] .= '

                    ' . __( "Additional Settings provides a place where you can customize the behavior of this contact form by adding code snippets.", 'contact-form-7' ) . '

                    '; + + $content['edit_form_tags'] = '

                    ' . __( "A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.", 'contact-form-7' ) . '

                    '; + $content['edit_form_tags'] .= '

                    ' . __( "While form-tags have a comparatively complex syntax, you don’t need to know the syntax to add form-tags because you can use the straightforward tag generator (Generate Tag button on this screen).", 'contact-form-7' ) . '

                    '; + + $content['edit_mail_tags'] = '

                    ' . __( "A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.", 'contact-form-7' ) . '

                    '; + $content['edit_mail_tags'] .= '

                    ' . __( "There are also special mail-tags that have specific names, but don’t have corresponding form-tags. They are used to represent meta information of form submissions like the submitter’s IP address or the URL of the page.", 'contact-form-7' ) . '

                    '; + + $content['integration_overview'] = '

                    ' . __( "On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.", 'contact-form-7' ) . '

                    '; + $content['integration_overview'] .= '

                    ' . __( "You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.", 'contact-form-7' ) . '

                    '; + $content['integration_overview'] .= '

                    ' . __( "Any information you provide will not be shared with service providers without your authorization.", 'contact-form-7' ) . '

                    '; + + if ( ! empty( $content[$name] ) ) { + return $content[$name]; + } + } + + public function sidebar() { + $content = '

                    ' . __( 'For more information:', 'contact-form-7' ) . '

                    '; + $content .= '

                    ' . wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'Docs', 'contact-form-7' ) ) . '

                    '; + $content .= '

                    ' . wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ) . '

                    '; + $content .= '

                    ' . wpcf7_link( __( 'https://contactform7.com/support/', 'contact-form-7' ), __( 'Support', 'contact-form-7' ) ) . '

                    '; + + $this->screen->set_help_sidebar( $content ); + } +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php b/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php new file mode 100644 index 0000000..c8ab50f --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php @@ -0,0 +1,80 @@ +panels[$id] = array( + 'title' => $title, + 'content' => 'tag-generator-panel-' . $id, + 'options' => $options, + 'callback' => $callback, + ); + + return true; + } + + public function print_buttons() { + echo ''; + + foreach ( (array) $this->panels as $panel ) { + echo sprintf( + '%3$s', + esc_attr( $panel['content'] ), + /* translators: %s: title of form-tag like 'email' or 'checkboxes' */ + esc_attr( sprintf( + __( 'Form-tag Generator: %s', 'contact-form-7' ), + $panel['title'] ) ), + esc_html( $panel['title'] ) + ); + } + + echo ''; + } + + public function print_panels( WPCF7_ContactForm $contact_form ) { + foreach ( (array) $this->panels as $id => $panel ) { + $callback = $panel['callback']; + + $options = wp_parse_args( $panel['options'], array() ); + $options = array_merge( $options, array( + 'id' => $id, + 'title' => $panel['title'], + 'content' => $panel['content'], + ) ); + + if ( is_callable( $callback ) ) { + echo sprintf( ''; + } + } + } + +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/welcome-panel.php b/wp-content/plugins/contact-form-7/admin/includes/welcome-panel.php new file mode 100644 index 0000000..fddf138 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/welcome-panel.php @@ -0,0 +1,78 @@ + +
                    + + + +
                    +
                    + +
                    +

                    + +

                    + +

                    +
                    + + +
                    +

                    + +

                    + +

                    + +

                    +
                    + +
                    +

                    + +

                    + +

                    +
                    + + +
                    +
                    +
                    +' ).attr( { + 'role': 'alert', + 'class': 'config-error' + } ); + + $.each( errors[ section ], function( i, val ) { + var $li = $( '
                  • ' ).append( + wpcf7.iconInCircle( '!' ) + ).append( + $( '' ).text( wpcf7.configValidator.iconAlt ) + ).append( ' ' ); + + if ( val.link ) { + $li.append( + $( '' ).attr( 'href', val.link ).text( val.message ) + ); + } else { + $li.text( val.message ); + } + + $li.appendTo( $list ); + + var tab = section + .replace( /^mail_\d+\./, 'mail.' ).replace( /\..*$/, '' ); + + if ( ! errorCount[ tab ] ) { + errorCount[ tab ] = 0; + } + + errorCount[ tab ] += 1; + + errorCount.total += 1; + } ); + + $( this ).after( $list ).attr( { 'aria-invalid': 'true' } ); + } + } ); + + $( '#contact-form-editor-tabs > li' ).each( function() { + var $item = $( this ); + $item.find( '.icon-in-circle' ).remove(); + var tab = $item.attr( 'id' ).replace( /-panel-tab$/, '' ); + + $.each( errors, function( key, val ) { + key = key.replace( /^mail_\d+\./, 'mail.' ); + + if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) { + var $mark = wpcf7.iconInCircle( '!' ); + $item.find( 'a.ui-tabs-anchor' ).first().append( $mark ); + return false; + } + } ); + + var $tabPanelError = $( '#' + tab + '-panel > div.config-error:first' ); + $tabPanelError.empty(); + + if ( errorCount[ tab.replace( '-', '_' ) ] ) { + $tabPanelError.append( wpcf7.iconInCircle( '!' ) ); + + if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) { + var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab + .replace( '%d', errorCount[ tab.replace( '-', '_' ) ] ); + $tabPanelError.append( manyErrorsInTab ); + } else { + $tabPanelError.append( wpcf7.configValidator.oneErrorInTab ); + } + } + } ); + + $( '#misc-publishing-actions .misc-pub-section.config-error' ).remove(); + + if ( errorCount.total ) { + var $warning = $( '
                    ' ) + .addClass( 'misc-pub-section config-error' ) + .append( wpcf7.iconInCircle( '!' ) ); + + if ( 1 < errorCount.total ) { + $warning.append( + wpcf7.configValidator.manyErrors.replace( '%d', errorCount.total ) + ); + } else { + $warning.append( wpcf7.configValidator.oneError ); + } + + $warning.append( '
                    ' ).append( + $( '' ) + .attr( 'href', wpcf7.configValidator.docUrl ) + .text( wpcf7.configValidator.howToCorrect ) + ); + + $( '#misc-publishing-actions' ).append( $warning ); + } + }; + + /** + * Copied from wptitlehint() in wp-admin/js/post.js + */ + wpcf7.titleHint = function() { + var $title = $( '#title' ); + var $titleprompt = $( '#title-prompt-text' ); + + if ( '' === $title.val() ) { + $titleprompt.removeClass( 'screen-reader-text' ); + } + + $titleprompt.click( function() { + $( this ).addClass( 'screen-reader-text' ); + $title.focus(); + } ); + + $title.blur( function() { + if ( '' === $(this).val() ) { + $titleprompt.removeClass( 'screen-reader-text' ); + } + } ).focus( function() { + $titleprompt.addClass( 'screen-reader-text' ); + } ).keydown( function( e ) { + $titleprompt.addClass( 'screen-reader-text' ); + $( this ).unbind( e ); + } ); + }; + + wpcf7.iconInCircle = function( icon ) { + var $span = $( '' ); + return $span.text( icon ); + }; + + wpcf7.apiSettings.getRoute = function( path ) { + var url = wpcf7.apiSettings.root; + + url = url.replace( + wpcf7.apiSettings.namespace, + wpcf7.apiSettings.namespace + path ); + + return url; + }; + +} )( jQuery ); diff --git a/wp-content/plugins/contact-form-7/admin/js/tag-generator.js b/wp-content/plugins/contact-form-7/admin/js/tag-generator.js new file mode 100644 index 0000000..029e6f6 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/js/tag-generator.js @@ -0,0 +1,249 @@ +( function( $ ) { + + 'use strict'; + + if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) { + return; + } + + wpcf7.taggen = {}; + + $( function() { + $( 'form.tag-generator-panel' ).each( function() { + wpcf7.taggen.update( $( this ) ); + } ); + } ); + + $( 'form.tag-generator-panel' ).submit( function() { + return false; + } ); + + $( 'form.tag-generator-panel .control-box :input' ).change( function() { + var $form = $( this ).closest( 'form.tag-generator-panel' ); + wpcf7.taggen.normalize( $( this ) ); + wpcf7.taggen.update( $form ); + } ); + + $( 'input.insert-tag' ).click( function() { + var $form = $( this ).closest( 'form.tag-generator-panel' ); + var tag = $form.find( 'input.tag' ).val(); + wpcf7.taggen.insert( tag ); + tb_remove(); // close thickbox + return false; + } ); + + wpcf7.taggen.update = function( $form ) { + var id = $form.attr( 'data-id' ); + var name = ''; + var name_fields = $form.find( 'input[name="name"]' ); + + if ( name_fields.length ) { + name = name_fields.val(); + + if ( '' === name ) { + name = id + '-' + Math.floor( Math.random() * 1000 ); + name_fields.val( name ); + } + } + + if ( $.isFunction( wpcf7.taggen.update[ id ] ) ) { + return wpcf7.taggen.update[ id ].call( this, $form ); + } + + $form.find( 'input.tag' ).each( function() { + var tag_type = $( this ).attr( 'name' ); + + if ( $form.find( ':input[name="tagtype"]' ).length ) { + tag_type = $form.find( ':input[name="tagtype"]' ).val(); + } + + if ( $form.find( ':input[name="required"]' ).is( ':checked' ) ) { + tag_type += '*'; + } + + var components = wpcf7.taggen.compose( tag_type, $form ); + $( this ).val( components ); + } ); + + $form.find( 'span.mail-tag' ).text( '[' + name + ']' ); + + $form.find( 'input.mail-tag' ).each( function() { + $( this ).val( '[' + name + ']' ); + } ); + }; + + wpcf7.taggen.update.captcha = function( $form ) { + var captchac = wpcf7.taggen.compose( 'captchac', $form ); + var captchar = wpcf7.taggen.compose( 'captchar', $form ); + + $form.find( 'input.tag' ).val( captchac + ' ' + captchar ); + }; + + wpcf7.taggen.compose = function( tagType, $form ) { + var name = $form.find( 'input[name="name"]' ).val(); + var scope = $form.find( '.scope.' + tagType ); + + if ( ! scope.length ) { + scope = $form; + } + + var options = []; + + scope.find( 'input.option' ).not( ':checkbox,:radio' ).each( function( i ) { + var val = $( this ).val(); + + if ( ! val ) { + return; + } + + if ( $( this ).hasClass( 'filetype' ) ) { + val = val.split( /[,|\s]+/ ).join( '|' ); + } + + if ( $( this ).hasClass( 'color' ) ) { + val = '#' + val; + } + + if ( 'class' == $( this ).attr( 'name' ) ) { + $.each( val.split( ' ' ), function( i, n ) { + options.push( 'class:' + n ); + } ); + } else { + options.push( $( this ).attr( 'name' ) + ':' + val ); + } + } ); + + scope.find( 'input:checkbox.option' ).each( function( i ) { + if ( $( this ).is( ':checked' ) ) { + options.push( $( this ).attr( 'name' ) ); + } + } ); + + scope.find( 'input:radio.option' ).each( function( i ) { + if ( $( this ).is( ':checked' ) && ! $( this ).hasClass( 'default' ) ) { + options.push( $( this ).attr( 'name' ) + ':' + $( this ).val() ); + } + } ); + + if ( 'radio' == tagType ) { + options.push( 'default:1' ); + } + + options = ( options.length > 0 ) ? options.join( ' ' ) : ''; + + var value = ''; + + if ( scope.find( ':input[name="values"]' ).val() ) { + $.each( + scope.find( ':input[name="values"]' ).val().split( "\n" ), + function( i, n ) { + value += ' "' + n.replace( /["]/g, '"' ) + '"'; + } + ); + } + + var components = []; + + $.each( [ tagType, name, options, value ], function( i, v ) { + v = $.trim( v ); + + if ( '' != v ) { + components.push( v ); + } + } ); + + components = $.trim( components.join( ' ' ) ); + components = '[' + components + ']'; + + var content = scope.find( ':input[name="content"]' ).val(); + content = $.trim( content ); + + if ( content ) { + components += ' ' + content + ' [/' + tagType + ']'; + } + + return components; + }; + + wpcf7.taggen.normalize = function( $input ) { + var val = $input.val(); + + if ( $input.is( 'input[name="name"]' ) ) { + val = val.replace( /[^0-9a-zA-Z:._-]/g, '' ).replace( /^[^a-zA-Z]+/, '' ); + } + + if ( $input.is( '.numeric' ) ) { + val = val.replace( /[^0-9.-]/g, '' ); + } + + if ( $input.is( '.idvalue' ) ) { + val = val.replace( /[^-0-9a-zA-Z_]/g, '' ); + } + + if ( $input.is( '.classvalue' ) ) { + val = $.map( val.split( ' ' ), function( n ) { + return n.replace( /[^-0-9a-zA-Z_]/g, '' ); + } ).join( ' ' ); + + val = $.trim( val.replace( /\s+/g, ' ' ) ); + } + + if ( $input.is( '.color' ) ) { + val = val.replace( /[^0-9a-fA-F]/g, '' ); + } + + if ( $input.is( '.filesize' ) ) { + val = val.replace( /[^0-9kKmMbB]/g, '' ); + } + + if ( $input.is( '.filetype' ) ) { + val = val.replace( /[^0-9a-zA-Z.,|\s]/g, '' ); + } + + if ( $input.is( '.date' ) ) { + // 'yyyy-mm-dd' ISO 8601 format + if ( ! val.match( /^\d{4}-\d{2}-\d{2}$/ ) ) { + val = ''; + } + } + + if ( $input.is( ':input[name="values"]' ) ) { + val = $.trim( val ); + } + + $input.val( val ); + + if ( $input.is( ':checkbox.exclusive' ) ) { + wpcf7.taggen.exclusiveCheckbox( $input ); + } + }; + + wpcf7.taggen.exclusiveCheckbox = function( $cb ) { + if ( $cb.is( ':checked' ) ) { + $cb.siblings( ':checkbox.exclusive' ).prop( 'checked', false ); + } + }; + + wpcf7.taggen.insert = function( content ) { + $( 'textarea#wpcf7-form' ).each( function() { + this.focus(); + + if ( document.selection ) { // IE + var selection = document.selection.createRange(); + selection.text = content; + } else if ( this.selectionEnd || 0 === this.selectionEnd ) { + var val = $( this ).val(); + var end = this.selectionEnd; + $( this ).val( val.substring( 0, end ) + + content + val.substring( end, val.length ) ); + this.selectionStart = end + content.length; + this.selectionEnd = end + content.length; + } else { + $( this ).val( $( this ).val() + content ); + } + + this.focus(); + } ); + }; + +} )( jQuery ); diff --git a/wp-content/plugins/contact-form-7/images/ajax-loader.gif b/wp-content/plugins/contact-form-7/images/ajax-loader.gif new file mode 100644 index 0000000..f2cfafd Binary files /dev/null and b/wp-content/plugins/contact-form-7/images/ajax-loader.gif differ diff --git a/wp-content/plugins/contact-form-7/includes/capabilities.php b/wp-content/plugins/contact-form-7/includes/capabilities.php new file mode 100644 index 0000000..09a478b --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/capabilities.php @@ -0,0 +1,26 @@ + WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_read_contact_form' => WPCF7_ADMIN_READ_CAPABILITY, + 'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY, + 'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_delete_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_manage_integration' => 'manage_options', + 'wpcf7_submit' => 'read', + ); + + $meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps ); + + $caps = array_diff( $caps, array_keys( $meta_caps ) ); + + if ( isset( $meta_caps[$cap] ) ) { + $caps[] = $meta_caps[$cap]; + } + + return $caps; +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator.php b/wp-content/plugins/contact-form-7/includes/config-validator.php new file mode 100644 index 0000000..a3c55cd --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator.php @@ -0,0 +1,647 @@ +contact_form = $contact_form; + } + + public function contact_form() { + return $this->contact_form; + } + + public function is_valid() { + return ! $this->count_errors(); + } + + public function count_errors( $args = '' ) { + $args = wp_parse_args( $args, array( + 'section' => '', + 'code' => '', + ) ); + + $count = 0; + + foreach ( $this->errors as $key => $errors ) { + if ( preg_match( '/^mail_[0-9]+\.(.*)$/', $key, $matches ) ) { + $key = sprintf( 'mail.%s', $matches[1] ); + } + + if ( $args['section'] + and $key != $args['section'] + and preg_replace( '/\..*$/', '', $key, 1 ) != $args['section'] ) { + continue; + } + + foreach ( $errors as $error ) { + if ( empty( $error ) ) { + continue; + } + + if ( $args['code'] and $error['code'] != $args['code'] ) { + continue; + } + + $count += 1; + } + } + + return $count; + } + + public function collect_error_messages() { + $error_messages = array(); + + foreach ( $this->errors as $section => $errors ) { + $error_messages[$section] = array(); + + foreach ( $errors as $error ) { + if ( empty( $error['args']['message'] ) ) { + $message = $this->get_default_message( $error['code'] ); + } elseif ( empty( $error['args']['params'] ) ) { + $message = $error['args']['message']; + } else { + $message = $this->build_message( + $error['args']['message'], + $error['args']['params'] ); + } + + $link = ''; + + if ( ! empty( $error['args']['link'] ) ) { + $link = $error['args']['link']; + } + + $error_messages[$section][] = array( + 'message' => $message, + 'link' => esc_url( $link ), + ); + } + } + + return $error_messages; + } + + public function build_message( $message, $params = '' ) { + $params = wp_parse_args( $params, array() ); + + foreach ( $params as $key => $val ) { + if ( ! preg_match( '/^[0-9A-Za-z_]+$/', $key ) ) { // invalid key + continue; + } + + $placeholder = '%' . $key . '%'; + + if ( false !== stripos( $message, $placeholder ) ) { + $message = str_ireplace( $placeholder, $val, $message ); + } + } + + return $message; + } + + public function get_default_message( $code ) { + switch ( $code ) { + case self::error_maybe_empty: + return __( "There is a possible empty field.", 'contact-form-7' ); + case self::error_invalid_mailbox_syntax: + return __( "Invalid mailbox syntax is used.", 'contact-form-7' ); + case self::error_email_not_in_site_domain: + return __( "Sender email address does not belong to the site domain.", 'contact-form-7' ); + case self::error_html_in_message: + return __( "HTML tags are used in a message.", 'contact-form-7' ); + case self::error_multiple_controls_in_label: + return __( "Multiple form controls are in a single label element.", 'contact-form-7' ); + case self::error_invalid_mail_header: + return __( "There are invalid mail header fields.", 'contact-form-7' ); + case self::error_deprecated_settings: + return __( "Deprecated settings are used.", 'contact-form-7' ); + default: + return ''; + } + } + + public function add_error( $section, $code, $args = '' ) { + $args = wp_parse_args( $args, array( + 'message' => '', + 'params' => array(), + ) ); + + if ( ! isset( $this->errors[$section] ) ) { + $this->errors[$section] = array(); + } + + $this->errors[$section][] = array( 'code' => $code, 'args' => $args ); + + return true; + } + + public function remove_error( $section, $code ) { + if ( empty( $this->errors[$section] ) ) { + return; + } + + foreach ( (array) $this->errors[$section] as $key => $error ) { + if ( isset( $error['code'] ) + and $error['code'] == $code ) { + unset( $this->errors[$section][$key] ); + } + } + + if ( empty( $this->errors[$section] ) ) { + unset( $this->errors[$section] ); + } + } + + public function validate() { + $this->errors = array(); + + $this->validate_form(); + $this->validate_mail( 'mail' ); + $this->validate_mail( 'mail_2' ); + $this->validate_messages(); + $this->validate_additional_settings(); + + do_action( 'wpcf7_config_validator_validate', $this ); + + return $this->is_valid(); + } + + public function save() { + if ( $this->contact_form->initial() ) { + return; + } + + delete_post_meta( $this->contact_form->id(), '_config_errors' ); + + if ( $this->errors ) { + update_post_meta( $this->contact_form->id(), '_config_errors', + $this->errors ); + } + } + + public function restore() { + $config_errors = get_post_meta( + $this->contact_form->id(), '_config_errors', true ); + + foreach ( (array) $config_errors as $section => $errors ) { + if ( empty( $errors ) ) { + continue; + } + + if ( ! is_array( $errors ) ) { // for back-compat + $code = $errors; + $this->add_error( $section, $code ); + } else { + foreach ( (array) $errors as $error ) { + if ( ! empty( $error['code'] ) ) { + $code = $error['code']; + $args = isset( $error['args'] ) ? $error['args'] : ''; + $this->add_error( $section, $code, $args ); + } + } + } + } + } + + public function replace_mail_tags_with_minimum_input( $matches ) { + // allow [[foo]] syntax for escaping a tag + if ( $matches[1] == '[' && $matches[4] == ']' ) { + return substr( $matches[0], 1, -1 ); + } + + $tag = $matches[0]; + $tagname = $matches[2]; + $values = $matches[3]; + + $mail_tag = new WPCF7_MailTag( $tag, $tagname, $values ); + $field_name = $mail_tag->field_name(); + + $example_email = 'example@example.com'; + $example_text = 'example'; + $example_blank = ''; + + $form_tags = $this->contact_form->scan_form_tags( + array( 'name' => $field_name ) ); + + if ( $form_tags ) { + $form_tag = new WPCF7_FormTag( $form_tags[0] ); + + $is_required = ( $form_tag->is_required() || 'radio' == $form_tag->type ); + + if ( ! $is_required ) { + return $example_blank; + } + + if ( wpcf7_form_tag_supports( $form_tag->type, 'selectable-values' ) ) { + if ( $form_tag->pipes instanceof WPCF7_Pipes ) { + if ( $mail_tag->get_option( 'do_not_heat' ) ) { + $before_pipes = $form_tag->pipes->collect_befores(); + $last_item = array_pop( $before_pipes ); + } else { + $after_pipes = $form_tag->pipes->collect_afters(); + $last_item = array_pop( $after_pipes ); + } + } else { + $last_item = array_pop( $form_tag->values ); + } + + if ( $last_item and wpcf7_is_mailbox_list( $last_item ) ) { + return $example_email; + } else { + return $example_text; + } + } + + if ( 'email' == $form_tag->basetype ) { + return $example_email; + } else { + return $example_text; + } + + } else { // maybe special mail tag + // for back-compat + $field_name = preg_replace( '/^wpcf7\./', '_', $field_name ); + + if ( '_site_admin_email' == $field_name ) { + return get_bloginfo( 'admin_email', 'raw' ); + + } elseif ( '_user_agent' == $field_name ) { + return $example_text; + + } elseif ( '_user_email' == $field_name ) { + return $this->contact_form->is_true( 'subscribers_only' ) + ? $example_email + : $example_blank; + + } elseif ( '_user_' == substr( $field_name, 0, 6 ) ) { + return $this->contact_form->is_true( 'subscribers_only' ) + ? $example_text + : $example_blank; + + } elseif ( '_' == substr( $field_name, 0, 1 ) ) { + return '_email' == substr( $field_name, -6 ) + ? $example_email + : $example_text; + + } + } + + return $tag; + } + + public function validate_form() { + $section = 'form.body'; + $form = $this->contact_form->prop( 'form' ); + $this->detect_multiple_controls_in_label( $section, $form ); + $this->detect_unavailable_names( $section, $form ); + } + + public function detect_multiple_controls_in_label( $section, $content ) { + $pattern = '%(.+?)%s'; + + if ( preg_match_all( $pattern, $content, $matches ) ) { + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + foreach ( $matches[1] as $insidelabel ) { + $tags = $form_tags_manager->scan( $insidelabel ); + $fields_count = 0; + + foreach ( $tags as $tag ) { + $is_multiple_controls_container = wpcf7_form_tag_supports( + $tag->type, 'multiple-controls-container' ); + $is_zero_controls_container = wpcf7_form_tag_supports( + $tag->type, 'zero-controls-container' ); + + if ( $is_multiple_controls_container ) { + $fields_count += count( $tag->values ); + + if ( $tag->has_option( 'free_text' ) ) { + $fields_count += 1; + } + } elseif ( $is_zero_controls_container ) { + $fields_count += 0; + } elseif ( ! empty( $tag->name ) ) { + $fields_count += 1; + } + + if ( 1 < $fields_count ) { + return $this->add_error( $section, + self::error_multiple_controls_in_label, array( + 'link' => self::get_doc_link( 'multiple_controls_in_label' ), + ) + ); + } + } + } + } + + return false; + } + + public function detect_unavailable_names( $section, $content ) { + $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', + 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', + 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', + 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', + 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', + 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', + 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', + 'cpage', 'post_type', 'embed' ); + + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + $ng_named_tags = $form_tags_manager->filter( $content, + array( 'name' => $public_query_vars ) ); + + $ng_names = array(); + + foreach ( $ng_named_tags as $tag ) { + $ng_names[] = sprintf( '"%s"', $tag->name ); + } + + if ( $ng_names ) { + $ng_names = array_unique( $ng_names ); + + return $this->add_error( $section, + self::error_unavailable_names, + array( + 'message' => + /* translators: %names%: a list of form control names */ + __( "Unavailable names (%names%) are used for form controls.", 'contact-form-7' ), + 'params' => array( 'names' => implode( ', ', $ng_names ) ), + 'link' => self::get_doc_link( 'unavailable_names' ), + ) + ); + } + + return false; + } + + public function validate_mail( $template = 'mail' ) { + $components = (array) $this->contact_form->prop( $template ); + + if ( ! $components ) { + return; + } + + if ( 'mail' != $template + and empty( $components['active'] ) ) { + return; + } + + $components = wp_parse_args( $components, array( + 'subject' => '', + 'sender' => '', + 'recipient' => '', + 'additional_headers' => '', + 'body' => '', + 'attachments' => '', + ) ); + + $callback = array( $this, 'replace_mail_tags_with_minimum_input' ); + + $subject = $components['subject']; + $subject = new WPCF7_MailTaggedText( $subject, + array( 'callback' => $callback ) ); + $subject = $subject->replace_tags(); + $subject = wpcf7_strip_newline( $subject ); + $this->detect_maybe_empty( sprintf( '%s.subject', $template ), $subject ); + + $sender = $components['sender']; + $sender = new WPCF7_MailTaggedText( $sender, + array( 'callback' => $callback ) ); + $sender = $sender->replace_tags(); + $sender = wpcf7_strip_newline( $sender ); + + if ( ! $this->detect_invalid_mailbox_syntax( sprintf( '%s.sender', $template ), $sender ) + and ! wpcf7_is_email_in_site_domain( $sender ) ) { + $this->add_error( sprintf( '%s.sender', $template ), + self::error_email_not_in_site_domain, array( + 'link' => self::get_doc_link( 'email_not_in_site_domain' ), + ) + ); + } + + $recipient = $components['recipient']; + $recipient = new WPCF7_MailTaggedText( $recipient, + array( 'callback' => $callback ) ); + $recipient = $recipient->replace_tags(); + $recipient = wpcf7_strip_newline( $recipient ); + + $this->detect_invalid_mailbox_syntax( + sprintf( '%s.recipient', $template ), $recipient ); + + $additional_headers = $components['additional_headers']; + $additional_headers = new WPCF7_MailTaggedText( $additional_headers, + array( 'callback' => $callback ) ); + $additional_headers = $additional_headers->replace_tags(); + $additional_headers = explode( "\n", $additional_headers ); + $mailbox_header_types = array( 'reply-to', 'cc', 'bcc' ); + $invalid_mail_header_exists = false; + + foreach ( $additional_headers as $header ) { + $header = trim( $header ); + + if ( '' === $header ) { + continue; + } + + if ( ! preg_match( '/^([0-9A-Za-z-]+):(.*)$/', $header, $matches ) ) { + $invalid_mail_header_exists = true; + } else { + $header_name = $matches[1]; + $header_value = trim( $matches[2] ); + + if ( in_array( strtolower( $header_name ), $mailbox_header_types ) ) { + $this->detect_invalid_mailbox_syntax( + sprintf( '%s.additional_headers', $template ), + $header_value, array( + 'message' => + __( "Invalid mailbox syntax is used in the %name% field.", 'contact-form-7' ), + 'params' => array( 'name' => $header_name ) ) ); + } elseif ( empty( $header_value ) ) { + $invalid_mail_header_exists = true; + } + } + } + + if ( $invalid_mail_header_exists ) { + $this->add_error( sprintf( '%s.additional_headers', $template ), + self::error_invalid_mail_header, array( + 'link' => self::get_doc_link( 'invalid_mail_header' ), + ) + ); + } + + $body = $components['body']; + $body = new WPCF7_MailTaggedText( $body, + array( 'callback' => $callback ) ); + $body = $body->replace_tags(); + $this->detect_maybe_empty( sprintf( '%s.body', $template ), $body ); + + if ( '' !== $components['attachments'] ) { + $has_file_not_found = false; + $has_file_not_in_content_dir = false; + + foreach ( explode( "\n", $components['attachments'] ) as $line ) { + $line = trim( $line ); + + if ( '' === $line + or '[' == substr( $line, 0, 1 ) ) { + continue; + } + + $has_file_not_found = $this->detect_file_not_found( + sprintf( '%s.attachments', $template ), $line + ); + + if ( ! $has_file_not_found + and ! $has_file_not_in_content_dir ) { + $has_file_not_in_content_dir = $this->detect_file_not_in_content_dir( + sprintf( '%s.attachments', $template ), $line + ); + } + } + } + } + + public function detect_invalid_mailbox_syntax( $section, $content, $args = '' ) { + $args = wp_parse_args( $args, array( + 'link' => self::get_doc_link( 'invalid_mailbox_syntax' ), + 'message' => '', + 'params' => array(), + ) ); + + if ( ! wpcf7_is_mailbox_list( $content ) ) { + return $this->add_error( $section, + self::error_invalid_mailbox_syntax, $args ); + } + + return false; + } + + public function detect_maybe_empty( $section, $content ) { + if ( '' === $content ) { + return $this->add_error( $section, + self::error_maybe_empty, array( + 'link' => self::get_doc_link( 'maybe_empty' ), + ) + ); + } + + return false; + } + + public function detect_file_not_found( $section, $content ) { + $path = path_join( WP_CONTENT_DIR, $content ); + + if ( ! is_readable( $path ) + or ! is_file( $path ) ) { + return $this->add_error( $section, + self::error_file_not_found, + array( + 'message' => + __( "Attachment file does not exist at %path%.", 'contact-form-7' ), + 'params' => array( 'path' => $content ), + 'link' => self::get_doc_link( 'file_not_found' ), + ) + ); + } + + return false; + } + + public function detect_file_not_in_content_dir( $section, $content ) { + $path = path_join( WP_CONTENT_DIR, $content ); + + if ( ! wpcf7_is_file_path_in_content_dir( $path ) ) { + return $this->add_error( $section, + self::error_file_not_in_content_dir, + array( + 'message' => + __( "It is not allowed to use files outside the wp-content directory.", 'contact-form-7' ), + 'link' => self::get_doc_link( 'file_not_in_content_dir' ), + ) + ); + } + + return false; + } + + public function validate_messages() { + $messages = (array) $this->contact_form->prop( 'messages' ); + + if ( ! $messages ) { + return; + } + + if ( isset( $messages['captcha_not_match'] ) + and ! wpcf7_use_really_simple_captcha() ) { + unset( $messages['captcha_not_match'] ); + } + + foreach ( $messages as $key => $message ) { + $section = sprintf( 'messages.%s', $key ); + $this->detect_html_in_message( $section, $message ); + } + } + + public function detect_html_in_message( $section, $content ) { + $stripped = wp_strip_all_tags( $content ); + + if ( $stripped != $content ) { + return $this->add_error( $section, + self::error_html_in_message, + array( + 'link' => self::get_doc_link( 'html_in_message' ), + ) + ); + } + + return false; + } + + public function validate_additional_settings() { + $deprecated_settings_used = + $this->contact_form->additional_setting( 'on_sent_ok' ) || + $this->contact_form->additional_setting( 'on_submit' ); + + if ( $deprecated_settings_used ) { + return $this->add_error( 'additional_settings.body', + self::error_deprecated_settings, + array( + 'link' => self::get_doc_link( 'deprecated_settings' ), + ) + ); + } + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form-functions.php b/wp-content/plugins/contact-form-7/includes/contact-form-functions.php new file mode 100644 index 0000000..4f1ead9 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form-functions.php @@ -0,0 +1,270 @@ +postmeta WHERE meta_key = '_old_cf7_unit_id'" + . $wpdb->prepare( " AND meta_value = %d", $old_id ); + + if ( $new_id = $wpdb->get_var( $q ) ) { + return wpcf7_contact_form( $new_id ); + } +} + +function wpcf7_get_contact_form_by_title( $title ) { + $page = get_page_by_title( $title, OBJECT, WPCF7_ContactForm::post_type ); + + if ( $page ) { + return wpcf7_contact_form( $page->ID ); + } + + return null; +} + +function wpcf7_get_current_contact_form() { + if ( $current = WPCF7_ContactForm::get_current() ) { + return $current; + } +} + +function wpcf7_is_posted() { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return false; + } + + return $contact_form->is_posted(); +} + +function wpcf7_get_hangover( $name, $default = null ) { + if ( ! wpcf7_is_posted() ) { + return $default; + } + + $submission = WPCF7_Submission::get_instance(); + + if ( ! $submission + or $submission->is( 'mail_sent' ) ) { + return $default; + } + + return isset( $_POST[$name] ) ? wp_unslash( $_POST[$name] ) : $default; +} + +function wpcf7_get_validation_error( $name ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return ''; + } + + return $contact_form->validation_error( $name ); +} + +function wpcf7_get_message( $status ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return ''; + } + + return $contact_form->message( $status ); +} + +function wpcf7_form_controls_class( $type, $default = '' ) { + $type = trim( $type ); + $default = array_filter( explode( ' ', $default ) ); + + $classes = array_merge( array( 'wpcf7-form-control' ), $default ); + + $typebase = rtrim( $type, '*' ); + $required = ( '*' == substr( $type, -1 ) ); + + $classes[] = 'wpcf7-' . $typebase; + + if ( $required ) { + $classes[] = 'wpcf7-validates-as-required'; + } + + $classes = array_unique( $classes ); + + return implode( ' ', $classes ); +} + +function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { + if ( is_feed() ) { + return '[contact-form-7]'; + } + + if ( 'contact-form-7' == $code ) { + $atts = shortcode_atts( + array( + 'id' => 0, + 'title' => '', + 'html_id' => '', + 'html_name' => '', + 'html_class' => '', + 'output' => 'form', + ), + $atts, 'wpcf7' + ); + + $id = (int) $atts['id']; + $title = trim( $atts['title'] ); + + if ( ! $contact_form = wpcf7_contact_form( $id ) ) { + $contact_form = wpcf7_get_contact_form_by_title( $title ); + } + + } else { + if ( is_string( $atts ) ) { + $atts = explode( ' ', $atts, 2 ); + } + + $id = (int) array_shift( $atts ); + $contact_form = wpcf7_get_contact_form_by_old_id( $id ); + } + + if ( ! $contact_form ) { + return '[contact-form-7 404 "Not Found"]'; + } + + return $contact_form->form_html( $atts ); +} + +function wpcf7_save_contact_form( $args = '', $context = 'save' ) { + $args = wp_parse_args( $args, array( + 'id' => -1, + 'title' => null, + 'locale' => null, + 'form' => null, + 'mail' => null, + 'mail_2' => null, + 'messages' => null, + 'additional_settings' => null, + ) ); + + $args = wp_unslash( $args ); + + $args['id'] = (int) $args['id']; + + if ( -1 == $args['id'] ) { + $contact_form = WPCF7_ContactForm::get_template(); + } else { + $contact_form = wpcf7_contact_form( $args['id'] ); + } + + if ( empty( $contact_form ) ) { + return false; + } + + if ( null !== $args['title'] ) { + $contact_form->set_title( $args['title'] ); + } + + if ( null !== $args['locale'] ) { + $contact_form->set_locale( $args['locale'] ); + } + + $properties = $contact_form->get_properties(); + + $properties['form'] = wpcf7_sanitize_form( + $args['form'], $properties['form'] ); + + $properties['mail'] = wpcf7_sanitize_mail( + $args['mail'], $properties['mail'] ); + + $properties['mail']['active'] = true; + + $properties['mail_2'] = wpcf7_sanitize_mail( + $args['mail_2'], $properties['mail_2'] ); + + $properties['messages'] = wpcf7_sanitize_messages( + $args['messages'], $properties['messages'] ); + + $properties['additional_settings'] = wpcf7_sanitize_additional_settings( + $args['additional_settings'], $properties['additional_settings'] ); + + $contact_form->set_properties( $properties ); + + do_action( 'wpcf7_save_contact_form', $contact_form, $args, $context ); + + if ( 'save' == $context ) { + $contact_form->save(); + } + + return $contact_form; +} + +function wpcf7_sanitize_form( $input, $default = '' ) { + if ( null === $input ) { + return $default; + } + + $output = trim( $input ); + return $output; +} + +function wpcf7_sanitize_mail( $input, $defaults = array() ) { + $input = wp_parse_args( $input, array( + 'active' => false, + 'subject' => '', + 'sender' => '', + 'recipient' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) ); + + $input = wp_parse_args( $input, $defaults ); + + $output = array(); + $output['active'] = (bool) $input['active']; + $output['subject'] = trim( $input['subject'] ); + $output['sender'] = trim( $input['sender'] ); + $output['recipient'] = trim( $input['recipient'] ); + $output['body'] = trim( $input['body'] ); + $output['additional_headers'] = ''; + + $headers = str_replace( "\r\n", "\n", $input['additional_headers'] ); + $headers = explode( "\n", $headers ); + + foreach ( $headers as $header ) { + $header = trim( $header ); + + if ( '' !== $header ) { + $output['additional_headers'] .= $header . "\n"; + } + } + + $output['additional_headers'] = trim( $output['additional_headers'] ); + $output['attachments'] = trim( $input['attachments'] ); + $output['use_html'] = (bool) $input['use_html']; + $output['exclude_blank'] = (bool) $input['exclude_blank']; + + return $output; +} + +function wpcf7_sanitize_messages( $input, $defaults = array() ) { + $output = array(); + + foreach ( wpcf7_messages() as $key => $val ) { + if ( isset( $input[$key] ) ) { + $output[$key] = trim( $input[$key] ); + } elseif ( isset( $defaults[$key] ) ) { + $output[$key] = $defaults[$key]; + } + } + + return $output; +} + +function wpcf7_sanitize_additional_settings( $input, $default = '' ) { + if ( null === $input ) { + return $default; + } + + $output = trim( $input ); + return $output; +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form-template.php b/wp-content/plugins/contact-form-7/includes/contact-form-template.php new file mode 100644 index 0000000..e2b8140 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form-template.php @@ -0,0 +1,201 @@ + %2$s %1$s + [text* your-name] + + + + + + + +[submit "%6$s"]', + __( '(required)', 'contact-form-7' ), + __( 'Your Name', 'contact-form-7' ), + __( 'Your Email', 'contact-form-7' ), + __( 'Subject', 'contact-form-7' ), + __( 'Your Message', 'contact-form-7' ), + __( 'Send', 'contact-form-7' ) ); + + return trim( $template ); + } + + public static function mail() { + $template = array( + 'subject' => + /* translators: 1: blog name, 2: [your-subject] */ + sprintf( + _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), + get_bloginfo( 'name' ), '[your-subject]' ), + 'sender' => sprintf( '%s <%s>', + get_bloginfo( 'name' ), self::from_email() ), + 'body' => + /* translators: %s: [your-name] <[your-email]> */ + sprintf( __( 'From: %s', 'contact-form-7' ), + '[your-name] <[your-email]>' ) . "\n" + /* translators: %s: [your-subject] */ + . sprintf( __( 'Subject: %s', 'contact-form-7' ), + '[your-subject]' ) . "\n\n" + . __( 'Message Body:', 'contact-form-7' ) + . "\n" . '[your-message]' . "\n\n" + . '-- ' . "\n" + /* translators: 1: blog name, 2: blog URL */ + . sprintf( + __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ), + get_bloginfo( 'name' ), + get_bloginfo( 'url' ) ), + 'recipient' => get_option( 'admin_email' ), + 'additional_headers' => 'Reply-To: [your-email]', + 'attachments' => '', + 'use_html' => 0, + 'exclude_blank' => 0, + ); + + return $template; + } + + public static function mail_2() { + $template = array( + 'active' => false, + 'subject' => + /* translators: 1: blog name, 2: [your-subject] */ + sprintf( + _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), + get_bloginfo( 'name' ), '[your-subject]' ), + 'sender' => sprintf( '%s <%s>', + get_bloginfo( 'name' ), self::from_email() ), + 'body' => + __( 'Message Body:', 'contact-form-7' ) + . "\n" . '[your-message]' . "\n\n" + . '-- ' . "\n" + /* translators: 1: blog name, 2: blog URL */ + . sprintf( + __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ), + get_bloginfo( 'name' ), + get_bloginfo( 'url' ) ), + 'recipient' => '[your-email]', + 'additional_headers' => sprintf( 'Reply-To: %s', + get_option( 'admin_email' ) ), + 'attachments' => '', + 'use_html' => 0, + 'exclude_blank' => 0, + ); + + return $template; + } + + public static function from_email() { + $admin_email = get_option( 'admin_email' ); + $sitename = strtolower( $_SERVER['SERVER_NAME'] ); + + if ( wpcf7_is_localhost() ) { + return $admin_email; + } + + if ( substr( $sitename, 0, 4 ) == 'www.' ) { + $sitename = substr( $sitename, 4 ); + } + + if ( strpbrk( $admin_email, '@' ) == '@' . $sitename ) { + return $admin_email; + } + + return 'wordpress@' . $sitename; + } + + public static function messages() { + $messages = array(); + + foreach ( wpcf7_messages() as $key => $arr ) { + $messages[$key] = $arr['default']; + } + + return $messages; + } +} + +function wpcf7_messages() { + $messages = array( + 'mail_sent_ok' => array( + 'description' + => __( "Sender's message was sent successfully", 'contact-form-7' ), + 'default' + => __( "Thank you for your message. It has been sent.", 'contact-form-7' ), + ), + + 'mail_sent_ng' => array( + 'description' + => __( "Sender's message failed to send", 'contact-form-7' ), + 'default' + => __( "There was an error trying to send your message. Please try again later.", 'contact-form-7' ), + ), + + 'validation_error' => array( + 'description' + => __( "Validation errors occurred", 'contact-form-7' ), + 'default' + => __( "One or more fields have an error. Please check and try again.", 'contact-form-7' ), + ), + + 'spam' => array( + 'description' + => __( "Submission was referred to as spam", 'contact-form-7' ), + 'default' + => __( "There was an error trying to send your message. Please try again later.", 'contact-form-7' ), + ), + + 'accept_terms' => array( + 'description' + => __( "There are terms that the sender must accept", 'contact-form-7' ), + 'default' + => __( "You must accept the terms and conditions before sending your message.", 'contact-form-7' ), + ), + + 'invalid_required' => array( + 'description' + => __( "There is a field that the sender must fill in", 'contact-form-7' ), + 'default' + => __( "The field is required.", 'contact-form-7' ), + ), + + 'invalid_too_long' => array( + 'description' + => __( "There is a field with input that is longer than the maximum allowed length", 'contact-form-7' ), + 'default' + => __( "The field is too long.", 'contact-form-7' ), + ), + + 'invalid_too_short' => array( + 'description' + => __( "There is a field with input that is shorter than the minimum allowed length", 'contact-form-7' ), + 'default' + => __( "The field is too short.", 'contact-form-7' ), + ) + ); + + return apply_filters( 'wpcf7_messages', $messages ); +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form.php b/wp-content/plugins/contact-form-7/includes/contact-form.php new file mode 100644 index 0000000..dfcc766 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form.php @@ -0,0 +1,946 @@ + array( + 'name' => __( 'Contact Forms', 'contact-form-7' ), + 'singular_name' => __( 'Contact Form', 'contact-form-7' ), + ), + 'rewrite' => false, + 'query_var' => false, + 'public' => false, + 'capability_type' => 'page', + 'capabilities' => array( + 'edit_post' => 'wpcf7_edit_contact_form', + 'read_post' => 'wpcf7_read_contact_form', + 'delete_post' => 'wpcf7_delete_contact_form', + 'edit_posts' => 'wpcf7_edit_contact_forms', + 'edit_others_posts' => 'wpcf7_edit_contact_forms', + 'publish_posts' => 'wpcf7_edit_contact_forms', + 'read_private_posts' => 'wpcf7_edit_contact_forms', + ), + ) ); + } + + public static function find( $args = '' ) { + $defaults = array( + 'post_status' => 'any', + 'posts_per_page' => -1, + 'offset' => 0, + 'orderby' => 'ID', + 'order' => 'ASC', + ); + + $args = wp_parse_args( $args, $defaults ); + + $args['post_type'] = self::post_type; + + $q = new WP_Query(); + $posts = $q->query( $args ); + + self::$found_items = $q->found_posts; + + $objs = array(); + + foreach ( (array) $posts as $post ) { + $objs[] = new self( $post ); + } + + return $objs; + } + + public static function get_template( $args = '' ) { + global $l10n; + + $defaults = array( 'locale' => null, 'title' => '' ); + $args = wp_parse_args( $args, $defaults ); + + $locale = $args['locale']; + $title = $args['title']; + + if ( $locale ) { + $mo_orig = $l10n['contact-form-7']; + wpcf7_load_textdomain( $locale ); + } + + self::$current = $contact_form = new self; + $contact_form->title = + ( $title ? $title : __( 'Untitled', 'contact-form-7' ) ); + $contact_form->locale = ( $locale ? $locale : get_user_locale() ); + + $properties = $contact_form->get_properties(); + + foreach ( $properties as $key => $value ) { + $properties[$key] = WPCF7_ContactFormTemplate::get_default( $key ); + } + + $contact_form->properties = $properties; + + $contact_form = apply_filters( 'wpcf7_contact_form_default_pack', + $contact_form, $args ); + + if ( isset( $mo_orig ) ) { + $l10n['contact-form-7'] = $mo_orig; + } + + return $contact_form; + } + + public static function get_instance( $post ) { + $post = get_post( $post ); + + if ( ! $post + or self::post_type != get_post_type( $post ) ) { + return false; + } + + return self::$current = new self( $post ); + } + + private static function generate_unit_tag( $id = 0 ) { + static $global_count = 0; + + $global_count += 1; + + if ( in_the_loop() ) { + $unit_tag = sprintf( 'wpcf7-f%1$d-p%2$d-o%3$d', + absint( $id ), + get_the_ID(), + $global_count + ); + } else { + $unit_tag = sprintf( 'wpcf7-f%1$d-o%2$d', + absint( $id ), + $global_count + ); + } + + return $unit_tag; + } + + private function __construct( $post = null ) { + $post = get_post( $post ); + + if ( $post + and self::post_type == get_post_type( $post ) ) { + $this->id = $post->ID; + $this->name = $post->post_name; + $this->title = $post->post_title; + $this->locale = get_post_meta( $post->ID, '_locale', true ); + + $properties = $this->get_properties(); + + foreach ( $properties as $key => $value ) { + if ( metadata_exists( 'post', $post->ID, '_' . $key ) ) { + $properties[$key] = get_post_meta( $post->ID, '_' . $key, true ); + } elseif ( metadata_exists( 'post', $post->ID, $key ) ) { + $properties[$key] = get_post_meta( $post->ID, $key, true ); + } + } + + $this->properties = $properties; + $this->upgrade(); + } + + do_action( 'wpcf7_contact_form', $this ); + } + + public function __get( $name ) { + $message = __( '%1$s property of a WPCF7_ContactForm object is no longer accessible. Use %2$s method instead.', 'contact-form-7' ); + + if ( 'id' == $name ) { + if ( WP_DEBUG ) { + trigger_error( sprintf( $message, 'id', 'id()' ) ); + } + + return $this->id; + } elseif ( 'title' == $name ) { + if ( WP_DEBUG ) { + trigger_error( sprintf( $message, 'title', 'title()' ) ); + } + + return $this->title; + } elseif ( $prop = $this->prop( $name ) ) { + if ( WP_DEBUG ) { + trigger_error( + sprintf( $message, $name, 'prop(\'' . $name . '\')' ) ); + } + + return $prop; + } + } + + public function initial() { + return empty( $this->id ); + } + + public function prop( $name ) { + $props = $this->get_properties(); + return isset( $props[$name] ) ? $props[$name] : null; + } + + public function get_properties() { + $properties = (array) $this->properties; + + $properties = wp_parse_args( $properties, array( + 'form' => '', + 'mail' => array(), + 'mail_2' => array(), + 'messages' => array(), + 'additional_settings' => '', + ) ); + + $properties = (array) apply_filters( 'wpcf7_contact_form_properties', + $properties, $this ); + + return $properties; + } + + public function set_properties( $properties ) { + $defaults = $this->get_properties(); + + $properties = wp_parse_args( $properties, $defaults ); + $properties = array_intersect_key( $properties, $defaults ); + + $this->properties = $properties; + } + + public function id() { + return $this->id; + } + + public function unit_tag() { + return $this->unit_tag; + } + + public function name() { + return $this->name; + } + + public function title() { + return $this->title; + } + + public function set_title( $title ) { + $title = strip_tags( $title ); + $title = trim( $title ); + + if ( '' === $title ) { + $title = __( 'Untitled', 'contact-form-7' ); + } + + $this->title = $title; + } + + public function locale() { + if ( wpcf7_is_valid_locale( $this->locale ) ) { + return $this->locale; + } else { + return ''; + } + } + + public function set_locale( $locale ) { + $locale = trim( $locale ); + + if ( wpcf7_is_valid_locale( $locale ) ) { + $this->locale = $locale; + } else { + $this->locale = 'en_US'; + } + } + + public function shortcode_attr( $name ) { + if ( isset( $this->shortcode_atts[$name] ) ) { + return (string) $this->shortcode_atts[$name]; + } + } + + // Return true if this form is the same one as currently POSTed. + public function is_posted() { + if ( ! WPCF7_Submission::get_instance() ) { + return false; + } + + if ( empty( $_POST['_wpcf7_unit_tag'] ) ) { + return false; + } + + return $this->unit_tag() === $_POST['_wpcf7_unit_tag']; + } + + /* Generating Form HTML */ + + public function form_html( $args = '' ) { + $args = wp_parse_args( $args, array( + 'html_id' => '', + 'html_name' => '', + 'html_class' => '', + 'output' => 'form', + ) ); + + $this->shortcode_atts = $args; + + if ( 'raw_form' == $args['output'] ) { + return '
                    '
                    +				. esc_html( $this->prop( 'form' ) ) . '
                    '; + } + + if ( $this->is_true( 'subscribers_only' ) + and ! current_user_can( 'wpcf7_submit', $this->id() ) ) { + $notice = __( + "This contact form is available only for logged in users.", + 'contact-form-7' ); + $notice = sprintf( + '

                    %s

                    ', + esc_html( $notice ) ); + + return apply_filters( 'wpcf7_subscribers_only_notice', $notice, $this ); + } + + $this->unit_tag = self::generate_unit_tag( $this->id ); + + $lang_tag = str_replace( '_', '-', $this->locale ); + + if ( preg_match( '/^([a-z]+-[a-z]+)-/i', $lang_tag, $matches ) ) { + $lang_tag = $matches[1]; + } + + $html = sprintf( '
                    ', + wpcf7_format_atts( array( + 'role' => 'form', + 'class' => 'wpcf7', + 'id' => $this->unit_tag(), + ( get_option( 'html_type' ) == 'text/html' ) ? 'lang' : 'xml:lang' + => $lang_tag, + 'dir' => wpcf7_is_rtl( $this->locale ) ? 'rtl' : 'ltr', + ) ) + ); + + $html .= "\n" . $this->screen_reader_response() . "\n"; + + $url = wpcf7_get_request_uri(); + + if ( $frag = strstr( $url, '#' ) ) { + $url = substr( $url, 0, -strlen( $frag ) ); + } + + $url .= '#' . $this->unit_tag(); + + $url = apply_filters( 'wpcf7_form_action_url', $url ); + + $id_attr = apply_filters( 'wpcf7_form_id_attr', + preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_id'] ) ); + + $name_attr = apply_filters( 'wpcf7_form_name_attr', + preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_name'] ) ); + + $class = 'wpcf7-form'; + + if ( $this->is_posted() ) { + $submission = WPCF7_Submission::get_instance(); + + switch ( $submission->get_status() ) { + case 'validation_failed': + $class .= ' invalid'; + break; + case 'acceptance_missing': + $class .= ' unaccepted'; + break; + case 'spam': + $class .= ' spam'; + break; + case 'aborted': + $class .= ' aborted'; + break; + case 'mail_sent': + $class .= ' sent'; + break; + case 'mail_failed': + $class .= ' failed'; + break; + default: + $class .= sprintf( ' custom-%s', + preg_replace( '/[^0-9a-z]+/i', '-', $submission->get_status() ) + ); + } + } + + if ( $args['html_class'] ) { + $class .= ' ' . $args['html_class']; + } + + if ( $this->in_demo_mode() ) { + $class .= ' demo'; + } + + $class = explode( ' ', $class ); + $class = array_map( 'sanitize_html_class', $class ); + $class = array_filter( $class ); + $class = array_unique( $class ); + $class = implode( ' ', $class ); + $class = apply_filters( 'wpcf7_form_class_attr', $class ); + + $enctype = apply_filters( 'wpcf7_form_enctype', '' ); + $autocomplete = apply_filters( 'wpcf7_form_autocomplete', '' ); + + $novalidate = apply_filters( 'wpcf7_form_novalidate', + wpcf7_support_html5() ); + + $atts = array( + 'action' => esc_url( $url ), + 'method' => 'post', + 'class' => $class, + 'enctype' => wpcf7_enctype_value( $enctype ), + 'autocomplete' => $autocomplete, + 'novalidate' => $novalidate ? 'novalidate' : '', + ); + + if ( '' !== $id_attr ) { + $atts['id'] = $id_attr; + } + + if ( '' !== $name_attr ) { + $atts['name'] = $name_attr; + } + + $atts = wpcf7_format_atts( $atts ); + + $html .= sprintf( '
                    ', $atts ) . "\n"; + $html .= $this->form_hidden_fields(); + $html .= $this->form_elements(); + + if ( ! $this->responses_count ) { + $html .= $this->form_response_output(); + } + + $html .= '
                    '; + $html .= '
                    '; + + return $html; + } + + private function form_hidden_fields() { + $hidden_fields = array( + '_wpcf7' => $this->id(), + '_wpcf7_version' => WPCF7_VERSION, + '_wpcf7_locale' => $this->locale(), + '_wpcf7_unit_tag' => $this->unit_tag(), + '_wpcf7_container_post' => 0, + ); + + if ( in_the_loop() ) { + $hidden_fields['_wpcf7_container_post'] = (int) get_the_ID(); + } + + if ( $this->nonce_is_active() && is_user_logged_in() ) { + $hidden_fields['_wpnonce'] = wpcf7_create_nonce(); + } + + $hidden_fields += (array) apply_filters( + 'wpcf7_form_hidden_fields', array() ); + + $content = ''; + + foreach ( $hidden_fields as $name => $value ) { + $content .= sprintf( + '', + esc_attr( $name ), esc_attr( $value ) ) . "\n"; + } + + return '
                    ' . "\n" . $content . '
                    ' . "\n"; + } + + public function form_response_output() { + $status = 'init'; + $class = 'wpcf7-response-output'; + $role = ''; + $content = ''; + + if ( $this->is_posted() ) { // Post response output for non-AJAX + $role = 'alert'; + + $submission = WPCF7_Submission::get_instance(); + $status = $submission->get_status(); + $content = $submission->get_response(); + + switch ( $status ) { + case 'validation_failed': + $class .= ' wpcf7-validation-errors'; + break; + case 'acceptance_missing': + $class .= ' wpcf7-acceptance-missing'; + break; + case 'spam': + $class .= ' wpcf7-spam-blocked'; + break; + case 'aborted': + $class .= ' wpcf7-aborted'; + break; + case 'mail_sent': + $class .= ' wpcf7-mail-sent-ok'; + break; + case 'mail_failed': + $class .= ' wpcf7-mail-sent-ng'; + break; + default: + $class .= sprintf( ' wpcf7-custom-%s', + preg_replace( '/[^0-9a-z]+/i', '-', $status ) + ); + } + } else { + $class .= ' wpcf7-display-none'; + } + + $atts = array( + 'class' => trim( $class ), + 'role' => trim( $role ), + ); + + $atts = wpcf7_format_atts( $atts ); + + $output = sprintf( '
                    %2$s
                    ', + $atts, esc_html( $content ) ); + + $output = apply_filters( 'wpcf7_form_response_output', + $output, $class, $content, $this, $status ); + + $this->responses_count += 1; + + return $output; + } + + public function screen_reader_response() { + $class = 'screen-reader-response'; + $role = ''; + $content = ''; + + if ( $this->is_posted() ) { // Post response output for non-AJAX + $role = 'alert'; + + $submission = WPCF7_Submission::get_instance(); + + if ( $response = $submission->get_response() ) { + $content = esc_html( $response ); + } + + if ( $invalid_fields = $submission->get_invalid_fields() ) { + $content .= "\n" . '
                      ' . "\n"; + + foreach ( (array) $invalid_fields as $name => $field ) { + if ( $field['idref'] ) { + $link = sprintf( '%2$s', + esc_attr( $field['idref'] ), + esc_html( $field['reason'] ) ); + $content .= sprintf( '
                    • %s
                    • ', $link ); + } else { + $content .= sprintf( '
                    • %s
                    • ', + esc_html( $field['reason'] ) ); + } + + $content .= "\n"; + } + + $content .= '
                    ' . "\n"; + } + } + + $atts = array( + 'class' => trim( $class ), + 'role' => trim( $role ) ); + + $atts = wpcf7_format_atts( $atts ); + + $output = sprintf( '
                    %2$s
                    ', + $atts, $content ); + + return $output; + } + + public function validation_error( $name ) { + $error = ''; + + if ( $this->is_posted() ) { + $submission = WPCF7_Submission::get_instance(); + + if ( $invalid_field = $submission->get_invalid_field( $name ) ) { + $error = trim( $invalid_field['reason'] ); + } + } + + if ( ! $error ) { + return $error; + } + + $error = sprintf( + '%s', + esc_html( $error ) ); + + return apply_filters( 'wpcf7_validation_error', $error, $name, $this ); + } + + /* Form Elements */ + + public function replace_all_form_tags() { + $manager = WPCF7_FormTagsManager::get_instance(); + $form = $this->prop( 'form' ); + + if ( wpcf7_autop_or_not() ) { + $form = $manager->normalize( $form ); + $form = wpcf7_autop( $form ); + } + + $form = $manager->replace_all( $form ); + $this->scanned_form_tags = $manager->get_scanned_tags(); + + return $form; + } + + public function form_do_shortcode() { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_ContactForm::replace_all_form_tags' ); + + return $this->replace_all_form_tags(); + } + + public function scan_form_tags( $cond = null ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + if ( empty( $this->scanned_form_tags ) ) { + $this->scanned_form_tags = $manager->scan( $this->prop( 'form' ) ); + } + + $tags = $this->scanned_form_tags; + + return $manager->filter( $tags, $cond ); + } + + public function form_scan_shortcode( $cond = null ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_ContactForm::scan_form_tags' ); + + return $this->scan_form_tags( $cond ); + } + + public function form_elements() { + return apply_filters( 'wpcf7_form_elements', + $this->replace_all_form_tags() ); + } + + public function collect_mail_tags( $args = '' ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + $args = wp_parse_args( $args, array( + 'include' => array(), + 'exclude' => $manager->collect_tag_types( 'not-for-mail' ), + ) ); + + $tags = $this->scan_form_tags(); + $mailtags = array(); + + foreach ( (array) $tags as $tag ) { + $type = $tag->basetype; + + if ( empty( $type ) ) { + continue; + } elseif ( ! empty( $args['include'] ) ) { + if ( ! in_array( $type, $args['include'] ) ) { + continue; + } + } elseif ( ! empty( $args['exclude'] ) ) { + if ( in_array( $type, $args['exclude'] ) ) { + continue; + } + } + + $mailtags[] = $tag->name; + } + + $mailtags = array_unique( array_filter( $mailtags ) ); + + return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $args, $this ); + } + + public function suggest_mail_tags( $for = 'mail' ) { + $mail = wp_parse_args( $this->prop( $for ), + array( + 'active' => false, + 'recipient' => '', + 'sender' => '', + 'subject' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) + ); + + $mail = array_filter( $mail ); + + foreach ( (array) $this->collect_mail_tags() as $mail_tag ) { + $pattern = sprintf( '/\[(_[a-z]+_)?%s([ \t]+[^]]+)?\]/', + preg_quote( $mail_tag, '/' ) ); + $used = preg_grep( $pattern, $mail ); + + echo sprintf( + '[%2$s]', + 'mailtag code ' . ( $used ? 'used' : 'unused' ), + esc_html( $mail_tag ) ); + } + } + + public function submit( $args = '' ) { + $args = wp_parse_args( $args, array( + 'skip_mail' => + ( $this->in_demo_mode() + || $this->is_true( 'skip_mail' ) + || ! empty( $this->skip_mail ) ), + ) ); + + if ( $this->is_true( 'subscribers_only' ) + and ! current_user_can( 'wpcf7_submit', $this->id() ) ) { + $result = array( + 'contact_form_id' => $this->id(), + 'status' => 'error', + 'message' => __( + "This contact form is available only for logged in users.", + 'contact-form-7' ), + ); + + return $result; + } + + $submission = WPCF7_Submission::get_instance( $this, array( + 'skip_mail' => $args['skip_mail'], + ) ); + + $result = array( + 'contact_form_id' => $this->id(), + 'status' => $submission->get_status(), + 'message' => $submission->get_response(), + 'demo_mode' => $this->in_demo_mode(), + ); + + if ( $submission->is( 'validation_failed' ) ) { + $result['invalid_fields'] = $submission->get_invalid_fields(); + } + + do_action( 'wpcf7_submit', $this, $result ); + + return $result; + } + + /* Message */ + + public function message( $status, $filter = true ) { + $messages = $this->prop( 'messages' ); + $message = isset( $messages[$status] ) ? $messages[$status] : ''; + + if ( $filter ) { + $message = $this->filter_message( $message, $status ); + } + + return $message; + } + + public function filter_message( $message, $status = '' ) { + $message = wp_strip_all_tags( $message ); + $message = wpcf7_mail_replace_tags( $message, array( 'html' => true ) ); + $message = apply_filters( 'wpcf7_display_message', $message, $status ); + + return $message; + } + + /* Additional settings */ + + public function additional_setting( $name, $max = 1 ) { + $settings = (array) explode( "\n", $this->prop( 'additional_settings' ) ); + + $pattern = '/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/'; + $count = 0; + $values = array(); + + foreach ( $settings as $setting ) { + if ( preg_match( $pattern, $setting, $matches ) ) { + if ( $matches[1] != $name ) { + continue; + } + + if ( ! $max or $count < (int) $max ) { + $values[] = trim( $matches[2] ); + $count += 1; + } + } + } + + return $values; + } + + public function is_true( $name ) { + $settings = $this->additional_setting( $name, false ); + + foreach ( $settings as $setting ) { + if ( in_array( $setting, array( 'on', 'true', '1' ) ) ) { + return true; + } + } + + return false; + } + + public function in_demo_mode() { + return $this->is_true( 'demo_mode' ); + } + + public function nonce_is_active() { + $is_active = WPCF7_VERIFY_NONCE; + + if ( $this->is_true( 'subscribers_only' ) ) { + $is_active = true; + } + + return (bool) apply_filters( 'wpcf7_verify_nonce', $is_active, $this ); + } + + /* Upgrade */ + + private function upgrade() { + $mail = $this->prop( 'mail' ); + + if ( is_array( $mail ) + and ! isset( $mail['recipient'] ) ) { + $mail['recipient'] = get_option( 'admin_email' ); + } + + $this->properties['mail'] = $mail; + + $messages = $this->prop( 'messages' ); + + if ( is_array( $messages ) ) { + foreach ( wpcf7_messages() as $key => $arr ) { + if ( ! isset( $messages[$key] ) ) { + $messages[$key] = $arr['default']; + } + } + } + + $this->properties['messages'] = $messages; + } + + /* Save */ + + public function save() { + $props = $this->get_properties(); + + $post_content = implode( "\n", wpcf7_array_flatten( $props ) ); + + if ( $this->initial() ) { + $post_id = wp_insert_post( array( + 'post_type' => self::post_type, + 'post_status' => 'publish', + 'post_title' => $this->title, + 'post_content' => trim( $post_content ), + ) ); + } else { + $post_id = wp_update_post( array( + 'ID' => (int) $this->id, + 'post_status' => 'publish', + 'post_title' => $this->title, + 'post_content' => trim( $post_content ), + ) ); + } + + if ( $post_id ) { + foreach ( $props as $prop => $value ) { + update_post_meta( $post_id, '_' . $prop, + wpcf7_normalize_newline_deep( $value ) ); + } + + if ( wpcf7_is_valid_locale( $this->locale ) ) { + update_post_meta( $post_id, '_locale', $this->locale ); + } + + if ( $this->initial() ) { + $this->id = $post_id; + do_action( 'wpcf7_after_create', $this ); + } else { + do_action( 'wpcf7_after_update', $this ); + } + + do_action( 'wpcf7_after_save', $this ); + } + + return $post_id; + } + + public function copy() { + $new = new self; + $new->title = $this->title . '_copy'; + $new->locale = $this->locale; + $new->properties = $this->properties; + + return apply_filters( 'wpcf7_copy', $new, $this ); + } + + public function delete() { + if ( $this->initial() ) { + return; + } + + if ( wp_delete_post( $this->id, true ) ) { + $this->id = 0; + return true; + } + + return false; + } + + public function shortcode( $args = '' ) { + $args = wp_parse_args( $args, array( + 'use_old_format' => false ) ); + + $title = str_replace( array( '"', '[', ']' ), '', $this->title ); + + if ( $args['use_old_format'] ) { + $old_unit_id = (int) get_post_meta( $this->id, '_old_cf7_unit_id', true ); + + if ( $old_unit_id ) { + $shortcode = sprintf( '[contact-form %1$d "%2$s"]', $old_unit_id, $title ); + } else { + $shortcode = ''; + } + } else { + $shortcode = sprintf( '[contact-form-7 id="%1$d" title="%2$s"]', + $this->id, $title ); + } + + return apply_filters( 'wpcf7_contact_form_shortcode', + $shortcode, $args, $this ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/controller.php b/wp-content/plugins/contact-form-7/includes/controller.php new file mode 100644 index 0000000..0f3c5e9 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/controller.php @@ -0,0 +1,104 @@ +submit(); + } + } +} + +add_action( 'wp_enqueue_scripts', 'wpcf7_do_enqueue_scripts', 10, 0 ); + +function wpcf7_do_enqueue_scripts() { + if ( wpcf7_load_js() ) { + wpcf7_enqueue_scripts(); + } + + if ( wpcf7_load_css() ) { + wpcf7_enqueue_styles(); + } +} + +function wpcf7_enqueue_scripts() { + $in_footer = true; + + if ( 'header' === wpcf7_load_js() ) { + $in_footer = false; + } + + wp_enqueue_script( 'contact-form-7', + wpcf7_plugin_url( 'includes/js/scripts.js' ), + array( 'jquery' ), WPCF7_VERSION, $in_footer ); + + $wpcf7 = array( + 'apiSettings' => array( + 'root' => esc_url_raw( rest_url( 'contact-form-7/v1' ) ), + 'namespace' => 'contact-form-7/v1', + ), + ); + + if ( defined( 'WP_CACHE' ) and WP_CACHE ) { + $wpcf7['cached'] = 1; + } + + if ( wpcf7_support_html5_fallback() ) { + $wpcf7['jqueryUi'] = 1; + } + + wp_localize_script( 'contact-form-7', 'wpcf7', $wpcf7 ); + + do_action( 'wpcf7_enqueue_scripts' ); +} + +function wpcf7_script_is() { + return wp_script_is( 'contact-form-7' ); +} + +function wpcf7_enqueue_styles() { + wp_enqueue_style( 'contact-form-7', + wpcf7_plugin_url( 'includes/css/styles.css' ), + array(), WPCF7_VERSION, 'all' ); + + if ( wpcf7_is_rtl() ) { + wp_enqueue_style( 'contact-form-7-rtl', + wpcf7_plugin_url( 'includes/css/styles-rtl.css' ), + array(), WPCF7_VERSION, 'all' ); + } + + do_action( 'wpcf7_enqueue_styles' ); +} + +function wpcf7_style_is() { + return wp_style_is( 'contact-form-7' ); +} + +/* HTML5 Fallback */ + +add_action( 'wp_enqueue_scripts', 'wpcf7_html5_fallback', 20, 0 ); + +function wpcf7_html5_fallback() { + if ( ! wpcf7_support_html5_fallback() ) { + return; + } + + if ( wpcf7_script_is() ) { + wp_enqueue_script( 'jquery-ui-datepicker' ); + wp_enqueue_script( 'jquery-ui-spinner' ); + } + + if ( wpcf7_style_is() ) { + wp_enqueue_style( 'jquery-ui-smoothness', + wpcf7_plugin_url( + 'includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css' ), + array(), '1.11.4', 'screen' ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css b/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css new file mode 100644 index 0000000..411d5b0 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css @@ -0,0 +1,12 @@ +span.wpcf7-not-valid-tip { + direction: rtl; +} + +.use-floating-validation-tip span.wpcf7-not-valid-tip { + left: auto; + right: 20%; +} + +span.wpcf7-list-item { + margin: 0 1em 0 0; +} diff --git a/wp-content/plugins/contact-form-7/includes/css/styles.css b/wp-content/plugins/contact-form-7/includes/css/styles.css new file mode 100644 index 0000000..e2f11cc --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/css/styles.css @@ -0,0 +1,110 @@ +div.wpcf7 { + margin: 0; + padding: 0; +} + +div.wpcf7 .screen-reader-response { + position: absolute; + overflow: hidden; + clip: rect(1px, 1px, 1px, 1px); + height: 1px; + width: 1px; + margin: 0; + padding: 0; + border: 0; +} + +div.wpcf7-response-output { + margin: 2em 0.5em 1em; + padding: 0.2em 1em; + border: 2px solid #ff0000; +} + +div.wpcf7-mail-sent-ok { + border: 2px solid #398f14; +} + +div.wpcf7-mail-sent-ng, +div.wpcf7-aborted { + border: 2px solid #ff0000; +} + +div.wpcf7-spam-blocked { + border: 2px solid #ffa500; +} + +div.wpcf7-validation-errors, +div.wpcf7-acceptance-missing { + border: 2px solid #f7e700; +} + +.wpcf7-form-control-wrap { + position: relative; +} + +span.wpcf7-not-valid-tip { + color: #f00; + font-size: 1em; + font-weight: normal; + display: block; +} + +.use-floating-validation-tip span.wpcf7-not-valid-tip { + position: absolute; + top: 20%; + left: 20%; + z-index: 100; + border: 1px solid #ff0000; + background: #fff; + padding: .2em .8em; +} + +span.wpcf7-list-item { + display: inline-block; + margin: 0 0 0 1em; +} + +span.wpcf7-list-item-label::before, +span.wpcf7-list-item-label::after { + content: " "; +} + +.wpcf7-display-none { + display: none; +} + +div.wpcf7 .ajax-loader { + visibility: hidden; + display: inline-block; + background-image: url('../../images/ajax-loader.gif'); + width: 16px; + height: 16px; + border: none; + padding: 0; + margin: 0 0 0 4px; + vertical-align: middle; +} + +div.wpcf7 .ajax-loader.is-active { + visibility: visible; +} + +div.wpcf7 div.ajax-error { + display: none; +} + +div.wpcf7 .placeheld { + color: #888; +} + +div.wpcf7 input[type="file"] { + cursor: pointer; +} + +div.wpcf7 input[type="file"]:disabled { + cursor: default; +} + +div.wpcf7 .wpcf7-submit:disabled { + cursor: not-allowed; +} diff --git a/wp-content/plugins/contact-form-7/includes/form-tag.php b/wp-content/plugins/contact-form-7/includes/form-tag.php new file mode 100644 index 0000000..30144e2 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/form-tag.php @@ -0,0 +1,367 @@ + $value ) { + if ( property_exists( __CLASS__, $key ) ) { + $this->{$key} = $value; + } + } + } + } + + public function is_required() { + return ( '*' == substr( $this->type, -1 ) ); + } + + public function has_option( $opt ) { + $pattern = sprintf( '/^%s(:.+)?$/i', preg_quote( $opt, '/' ) ); + return (bool) preg_grep( $pattern, $this->options ); + } + + public function get_option( $opt, $pattern = '', $single = false ) { + $preset_patterns = array( + 'date' => '([0-9]{4}-[0-9]{2}-[0-9]{2}|today(.*))', + 'int' => '[0-9]+', + 'signed_int' => '-?[0-9]+', + 'class' => '[-0-9a-zA-Z_]+', + 'id' => '[-0-9a-zA-Z_]+', + ); + + if ( isset( $preset_patterns[$pattern] ) ) { + $pattern = $preset_patterns[$pattern]; + } + + if ( '' == $pattern ) { + $pattern = '.+'; + } + + $pattern = sprintf( '/^%s:%s$/i', preg_quote( $opt, '/' ), $pattern ); + + if ( $single ) { + $matches = $this->get_first_match_option( $pattern ); + + if ( ! $matches ) { + return false; + } + + return substr( $matches[0], strlen( $opt ) + 1 ); + } else { + $matches_a = $this->get_all_match_options( $pattern ); + + if ( ! $matches_a ) { + return false; + } + + $results = array(); + + foreach ( $matches_a as $matches ) { + $results[] = substr( $matches[0], strlen( $opt ) + 1 ); + } + + return $results; + } + } + + public function get_id_option() { + return $this->get_option( 'id', 'id', true ); + } + + public function get_class_option( $default = '' ) { + if ( is_string( $default ) ) { + $default = explode( ' ', $default ); + } + + $options = array_merge( + (array) $default, + (array) $this->get_option( 'class', 'class' ) ); + + $options = array_filter( array_unique( $options ) ); + + return implode( ' ', $options ); + } + + public function get_size_option( $default = '' ) { + $option = $this->get_option( 'size', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( '%^([0-9]*)/[0-9]*$%' ); + + foreach ( (array) $matches_a as $matches ) { + if ( isset( $matches[1] ) + and '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default; + } + + public function get_maxlength_option( $default = '' ) { + $option = $this->get_option( 'maxlength', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^(?:[0-9]*x?[0-9]*)?/([0-9]+)$%' ); + + foreach ( (array) $matches_a as $matches ) { + if ( isset( $matches[1] ) && '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default; + } + + public function get_minlength_option( $default = '' ) { + $option = $this->get_option( 'minlength', 'int', true ); + + if ( $option ) { + return $option; + } else { + return $default; + } + } + + public function get_cols_option( $default = '' ) { + $option = $this->get_option( 'cols', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' ); + + foreach ( (array) $matches_a as $matches ) { + if ( isset( $matches[1] ) && '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default; + } + + public function get_rows_option( $default = '' ) { + $option = $this->get_option( 'rows', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' ); + + foreach ( (array) $matches_a as $matches ) { + if ( isset( $matches[2] ) + and '' !== $matches[2] ) { + return $matches[2]; + } + } + + return $default; + } + + public function get_date_option( $opt ) { + $option = $this->get_option( $opt, 'date', true ); + + if ( preg_match( '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $option ) ) { + return $option; + } + + if ( preg_match( '/^today(?:([+-][0-9]+)([a-z]*))?/', $option, $matches ) ) { + $number = isset( $matches[1] ) ? (int) $matches[1] : 0; + $unit = isset( $matches[2] ) ? $matches[2] : ''; + + if ( ! preg_match( '/^(day|month|year|week)s?$/', $unit ) ) { + $unit = 'days'; + } + + $date = gmdate( 'Y-m-d', + strtotime( sprintf( 'today %1$s %2$s', $number, $unit ) ) ); + return $date; + } + + return false; + } + + public function get_default_option( $default = '', $args = '' ) { + $args = wp_parse_args( $args, array( + 'multiple' => false, + 'shifted' => false, + ) ); + + $options = (array) $this->get_option( 'default' ); + $values = array(); + + if ( empty( $options ) ) { + return $args['multiple'] ? $values : $default; + } + + foreach ( $options as $opt ) { + $opt = sanitize_key( $opt ); + + if ( 'user_' == substr( $opt, 0, 5 ) + and is_user_logged_in() ) { + $primary_props = array( 'user_login', 'user_email', 'user_url' ); + $opt = in_array( $opt, $primary_props ) ? $opt : substr( $opt, 5 ); + + $user = wp_get_current_user(); + $user_prop = $user->get( $opt ); + + if ( ! empty( $user_prop ) ) { + if ( $args['multiple'] ) { + $values[] = $user_prop; + } else { + return $user_prop; + } + } + + } elseif ( 'post_meta' == $opt and in_the_loop() ) { + if ( $args['multiple'] ) { + $values = array_merge( $values, + get_post_meta( get_the_ID(), $this->name ) ); + } else { + $val = (string) get_post_meta( get_the_ID(), $this->name, true ); + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( 'get' == $opt and isset( $_GET[$this->name] ) ) { + $vals = (array) $_GET[$this->name]; + $vals = array_map( 'wpcf7_sanitize_query_var', $vals ); + + if ( $args['multiple'] ) { + $values = array_merge( $values, $vals ); + } else { + $val = isset( $vals[0] ) ? (string) $vals[0] : ''; + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( 'post' == $opt and isset( $_POST[$this->name] ) ) { + $vals = (array) $_POST[$this->name]; + $vals = array_map( 'wpcf7_sanitize_query_var', $vals ); + + if ( $args['multiple'] ) { + $values = array_merge( $values, $vals ); + } else { + $val = isset( $vals[0] ) ? (string) $vals[0] : ''; + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( 'shortcode_attr' == $opt ) { + if ( $contact_form = WPCF7_ContactForm::get_current() ) { + $val = $contact_form->shortcode_attr( $this->name ); + + if ( strlen( $val ) ) { + if ( $args['multiple'] ) { + $values[] = $val; + } else { + return $val; + } + } + } + + } elseif ( preg_match( '/^[0-9_]+$/', $opt ) ) { + $nums = explode( '_', $opt ); + + foreach ( $nums as $num ) { + $num = absint( $num ); + $num = $args['shifted'] ? $num : $num - 1; + + if ( isset( $this->values[$num] ) ) { + if ( $args['multiple'] ) { + $values[] = $this->values[$num]; + } else { + return $this->values[$num]; + } + } + } + } + } + + if ( $args['multiple'] ) { + $values = array_unique( $values ); + return $values; + } else { + return $default; + } + } + + public function get_data_option( $args = '' ) { + $options = (array) $this->get_option( 'data' ); + + return apply_filters( 'wpcf7_form_tag_data_option', null, $options, $args ); + } + + public function get_first_match_option( $pattern ) { + foreach( (array) $this->options as $option ) { + if ( preg_match( $pattern, $option, $matches ) ) { + return $matches; + } + } + + return false; + } + + public function get_all_match_options( $pattern ) { + $result = array(); + + foreach( (array) $this->options as $option ) { + if ( preg_match( $pattern, $option, $matches ) ) { + $result[] = $matches; + } + } + + return $result; + } + + public function offsetSet( $offset, $value ) { + if ( property_exists( __CLASS__, $offset ) ) { + $this->{$offset} = $value; + } + } + + public function offsetGet( $offset ) { + if ( property_exists( __CLASS__, $offset ) ) { + return $this->{$offset}; + } + + return null; + } + + public function offsetExists( $offset ) { + return property_exists( __CLASS__, $offset ); + } + + public function offsetUnset( $offset ) { + } +} diff --git a/wp-content/plugins/contact-form-7/includes/form-tags-manager.php b/wp-content/plugins/contact-form-7/includes/form-tags-manager.php new file mode 100644 index 0000000..cf9d99d --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/form-tags-manager.php @@ -0,0 +1,368 @@ +add( $tag, $func, $features ); +} + +function wpcf7_remove_form_tag( $tag ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->remove( $tag ); +} + +function wpcf7_replace_all_form_tags( $content ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->replace_all( $content ); +} + +function wpcf7_scan_form_tags( $cond = null ) { + $contact_form = WPCF7_ContactForm::get_current(); + + if ( $contact_form ) { + return $contact_form->scan_form_tags( $cond ); + } + + return array(); +} + +function wpcf7_form_tag_supports( $tag, $feature ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->tag_type_supports( $tag, $feature ); +} + +class WPCF7_FormTagsManager { + + private static $instance; + + private $tag_types = array(); + private $scanned_tags = null; // Tags scanned at the last time of scan() + + private function __construct() {} + + public static function get_instance() { + if ( empty( self::$instance ) ) { + self::$instance = new self; + } + + return self::$instance; + } + + public function get_scanned_tags() { + return $this->scanned_tags; + } + + public function add( $tag, $func, $features = '' ) { + if ( ! is_callable( $func ) ) { + return; + } + + if ( true === $features ) { // for back-compat + $features = array( 'name-attr' => true ); + } + + $features = wp_parse_args( $features, array() ); + + $tags = array_filter( array_unique( (array) $tag ) ); + + foreach ( $tags as $tag ) { + $tag = $this->sanitize_tag_type( $tag ); + + if ( ! $this->tag_type_exists( $tag ) ) { + $this->tag_types[$tag] = array( + 'function' => $func, + 'features' => $features, + ); + } + } + } + + public function tag_type_exists( $tag ) { + return isset( $this->tag_types[$tag] ); + } + + public function tag_type_supports( $tag, $feature ) { + $feature = array_filter( (array) $feature ); + + if ( isset( $this->tag_types[$tag]['features'] ) ) { + return (bool) array_intersect( + array_keys( array_filter( $this->tag_types[$tag]['features'] ) ), + $feature ); + } + + return false; + } + + public function collect_tag_types( $feature = null, $invert = false ) { + $tag_types = array_keys( $this->tag_types ); + + if ( empty( $feature ) ) { + return $tag_types; + } + + $output = array(); + + foreach ( $tag_types as $tag ) { + if ( ! $invert && $this->tag_type_supports( $tag, $feature ) + || $invert && ! $this->tag_type_supports( $tag, $feature ) ) { + $output[] = $tag; + } + } + + return $output; + } + + private function sanitize_tag_type( $tag ) { + $tag = preg_replace( '/[^a-zA-Z0-9_*]+/', '_', $tag ); + $tag = rtrim( $tag, '_' ); + $tag = strtolower( $tag ); + return $tag; + } + + public function remove( $tag ) { + unset( $this->tag_types[$tag] ); + } + + public function normalize( $content ) { + if ( empty( $this->tag_types ) ) { + return $content; + } + + $content = preg_replace_callback( + '/' . $this->tag_regex() . '/s', + array( $this, 'normalize_callback' ), + $content ); + + return $content; + } + + private function normalize_callback( $m ) { + // allow [[foo]] syntax for escaping a tag + if ( $m[1] == '[' + and $m[6] == ']' ) { + return $m[0]; + } + + $tag = $m[2]; + + $attr = trim( preg_replace( '/[\r\n\t ]+/', ' ', $m[3] ) ); + $attr = strtr( $attr, array( '<' => '<', '>' => '>' ) ); + + $content = trim( $m[5] ); + $content = str_replace( "\n", '', $content ); + + $result = $m[1] . '[' . $tag + . ( $attr ? ' ' . $attr : '' ) + . ( $m[4] ? ' ' . $m[4] : '' ) + . ']' + . ( $content ? $content . '[/' . $tag . ']' : '' ) + . $m[6]; + + return $result; + } + + public function replace_all( $content ) { + return $this->scan( $content, true ); + } + + public function scan( $content, $replace = false ) { + $this->scanned_tags = array(); + + if ( empty( $this->tag_types ) ) { + if ( $replace ) { + return $content; + } else { + return $this->scanned_tags; + } + } + + if ( $replace ) { + $content = preg_replace_callback( + '/' . $this->tag_regex() . '/s', + array( $this, 'replace_callback' ), + $content ); + + return $content; + } else { + preg_replace_callback( + '/' . $this->tag_regex() . '/s', + array( $this, 'scan_callback' ), + $content ); + + return $this->scanned_tags; + } + } + + public function filter( $input, $cond ) { + if ( is_array( $input ) ) { + $tags = $input; + } elseif ( is_string( $input ) ) { + $tags = $this->scan( $input ); + } else { + $tags = $this->scanned_tags; + } + + if ( empty( $tags ) ) { + return array(); + } + + $cond = wp_parse_args( $cond, array( + 'type' => array(), + 'name' => array(), + 'feature' => '', + ) ); + + $type = array_filter( (array) $cond['type'] ); + $name = array_filter( (array) $cond['name'] ); + $feature = is_string( $cond['feature'] ) ? trim( $cond['feature'] ) : ''; + + if ( '!' == substr( $feature, 0, 1 ) ) { + $feature_negative = true; + $feature = trim( substr( $feature, 1 ) ); + } else { + $feature_negative = false; + } + + $output = array(); + + foreach ( $tags as $tag ) { + $tag = new WPCF7_FormTag( $tag ); + + if ( $type and ! in_array( $tag->type, $type, true ) ) { + continue; + } + + if ( $name and ! in_array( $tag->name, $name, true ) ) { + continue; + } + + if ( $feature ) { + if ( ! $this->tag_type_supports( $tag->type, $feature ) + and ! $feature_negative ) { + continue; + } elseif ( $this->tag_type_supports( $tag->type, $feature ) + and $feature_negative ) { + continue; + } + } + + $output[] = $tag; + } + + return $output; + } + + private function tag_regex() { + $tagnames = array_keys( $this->tag_types ); + $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) ); + + return '(\[?)' + . '\[(' . $tagregexp . ')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]' + . '(?:([^[]*?)\[\/\2\])?' + . '(\]?)'; + } + + private function replace_callback( $m ) { + return $this->scan_callback( $m, true ); + } + + private function scan_callback( $m, $replace = false ) { + // allow [[foo]] syntax for escaping a tag + if ( $m[1] == '[' + and $m[6] == ']' ) { + return substr( $m[0], 1, -1 ); + } + + $tag = $m[2]; + $attr = $this->parse_atts( $m[3] ); + + $scanned_tag = array( + 'type' => $tag, + 'basetype' => trim( $tag, '*' ), + 'name' => '', + 'options' => array(), + 'raw_values' => array(), + 'values' => array(), + 'pipes' => null, + 'labels' => array(), + 'attr' => '', + 'content' => '', + ); + + if ( is_array( $attr ) ) { + if ( is_array( $attr['options'] ) ) { + if ( $this->tag_type_supports( $tag, 'name-attr' ) + and ! empty( $attr['options'] ) ) { + $scanned_tag['name'] = array_shift( $attr['options'] ); + + if ( ! wpcf7_is_name( $scanned_tag['name'] ) ) { + return $m[0]; // Invalid name is used. Ignore this tag. + } + } + + $scanned_tag['options'] = (array) $attr['options']; + } + + $scanned_tag['raw_values'] = (array) $attr['values']; + + if ( WPCF7_USE_PIPE ) { + $pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] ); + $scanned_tag['values'] = $pipes->collect_befores(); + $scanned_tag['pipes'] = $pipes; + } else { + $scanned_tag['values'] = $scanned_tag['raw_values']; + } + + $scanned_tag['labels'] = $scanned_tag['values']; + + } else { + $scanned_tag['attr'] = $attr; + } + + $scanned_tag['values'] = array_map( 'trim', $scanned_tag['values'] ); + $scanned_tag['labels'] = array_map( 'trim', $scanned_tag['labels'] ); + + $content = trim( $m[5] ); + $content = preg_replace( "/$/m", '', $content ); + $scanned_tag['content'] = $content; + + $scanned_tag = apply_filters( 'wpcf7_form_tag', $scanned_tag, $replace ); + + $scanned_tag = new WPCF7_FormTag( $scanned_tag ); + + $this->scanned_tags[] = $scanned_tag; + + if ( $replace ) { + $func = $this->tag_types[$tag]['function']; + return $m[1] . call_user_func( $func, $scanned_tag ) . $m[6]; + } else { + return $m[0]; + } + } + + private function parse_atts( $text ) { + $atts = array( 'options' => array(), 'values' => array() ); + $text = preg_replace( "/[\x{00a0}\x{200b}]+/u", " ", $text ); + $text = stripcslashes( trim( $text ) ); + + $pattern = '%^([-+*=0-9a-zA-Z:.!?#$&@_/|\%\r\n\t ]*?)((?:[\r\n\t ]*"[^"]*"|[\r\n\t ]*\'[^\']*\')*)$%'; + + if ( preg_match( $pattern, $text, $match ) ) { + if ( ! empty( $match[1] ) ) { + $atts['options'] = preg_split( '/[\r\n\t ]+/', trim( $match[1] ) ); + } + + if ( ! empty( $match[2] ) ) { + preg_match_all( '/"[^"]*"|\'[^\']*\'/', $match[2], $matched_values ); + $atts['values'] = wpcf7_strip_quote_deep( $matched_values[0] ); + } + } else { + $atts = $text; + } + + return $atts; + } +} diff --git a/wp-content/plugins/contact-form-7/includes/formatting.php b/wp-content/plugins/contact-form-7/includes/formatting.php new file mode 100644 index 0000000..97daa6b --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/formatting.php @@ -0,0 +1,381 @@ +\s*
                    |', "\n\n", $pee ); + // Space things out a little + /* wpcf7: remove select and input */ + $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; + $pee = preg_replace( '!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee ); + $pee = preg_replace( '!()!', "$1\n\n", $pee ); + + /* wpcf7: take care of [response], [recaptcha], and [hidden] tags */ + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + $block_hidden_form_tags = $form_tags_manager->collect_tag_types( + array( 'display-block', 'display-hidden' ) ); + $block_hidden_form_tags = sprintf( '(?:%s)', + implode( '|', $block_hidden_form_tags ) ); + + $pee = preg_replace( '!(\[' . $block_hidden_form_tags . '[^]]*\])!', + "\n$1\n\n", $pee ); + + $pee = str_replace( array( "\r\n", "\r" ), "\n", $pee ); // cross-platform newlines + + if ( strpos( $pee, ']*)>\s*|', "", $pee ); // no pee inside object/embed + $pee = preg_replace( '|\s*\s*|', '', $pee ); + } + + $pee = preg_replace( "/\n\n+/", "\n\n", $pee ); // take care of duplicates + // make paragraphs, including one at the end + $pees = preg_split( '/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY ); + $pee = ''; + + foreach ( $pees as $tinkle ) { + $pee .= '

                    ' . trim( $tinkle, "\n" ) . "

                    \n"; + } + + $pee = preg_replace( '|

                    \s*

                    |', '', $pee ); // under certain strange conditions it could create a P of entirely whitespace + $pee = preg_replace( '!

                    ([^<]+)!', "

                    $1

                    ", $pee ); + $pee = preg_replace( '!

                    \s*(]*>)\s*

                    !', "$1", $pee ); // don't pee all over a tag + $pee = preg_replace( "|

                    (|", "$1", $pee ); // problem with nested lists + $pee = preg_replace( '|

                    ]*)>|i', "

                    ", $pee ); + $pee = str_replace( '

                    ', '

                    ', $pee ); + $pee = preg_replace( '!

                    \s*(]*>)!', "$1", $pee ); + $pee = preg_replace( '!(]*>)\s*

                    !', "$1", $pee ); + + /* wpcf7: take care of [response], [recaptcha], and [hidden] tag */ + $pee = preg_replace( '!

                    \s*(\[' . $block_hidden_form_tags . '[^]]*\])!', + "$1", $pee ); + $pee = preg_replace( '!(\[' . $block_hidden_form_tags . '[^]]*\])\s*

                    !', + "$1", $pee ); + + if ( $br ) { + /* wpcf7: add textarea */ + $pee = preg_replace_callback( + '/<(script|style|textarea).*?<\/\\1>/s', + 'wpcf7_autop_preserve_newline_callback', $pee ); + $pee = preg_replace( '|(?)\s*\n|', "
                    \n", $pee ); // optionally make line breaks + $pee = str_replace( '', "\n", $pee ); + + /* wpcf7: remove extra
                    just added before [response], [recaptcha], and [hidden] tags */ + $pee = preg_replace( '!
                    \n(\[' . $block_hidden_form_tags . '[^]]*\])!', + "\n$1", $pee ); + } + + $pee = preg_replace( '!(]*>)\s*
                    !', "$1", $pee ); + $pee = preg_replace( '!
                    (\s*]*>)!', '$1', $pee ); + + if ( strpos( $pee, ']*>)(.*?)!is', + 'clean_pre', $pee ); + } + + $pee = preg_replace( "|\n

                    $|", '

                    ', $pee ); + + return $pee; +} + +function wpcf7_autop_preserve_newline_callback( $matches ) { + return str_replace( "\n", '', $matches[0] ); +} + +function wpcf7_sanitize_query_var( $text ) { + $text = wp_unslash( $text ); + $text = wp_check_invalid_utf8( $text ); + + if ( false !== strpos( $text, '<' ) ) { + $text = wp_pre_kses_less_than( $text ); + $text = wp_strip_all_tags( $text ); + } + + $text = preg_replace( '/%[a-f0-9]{2}/i', '', $text ); + $text = preg_replace( '/ +/', ' ', $text ); + $text = trim( $text, ' ' ); + + return $text; +} + +function wpcf7_strip_quote( $text ) { + $text = trim( $text ); + + if ( preg_match( '/^"(.*)"$/s', $text, $matches ) ) { + $text = $matches[1]; + } elseif ( preg_match( "/^'(.*)'$/s", $text, $matches ) ) { + $text = $matches[1]; + } + + return $text; +} + +function wpcf7_strip_quote_deep( $arr ) { + if ( is_string( $arr ) ) { + return wpcf7_strip_quote( $arr ); + } + + if ( is_array( $arr ) ) { + $result = array(); + + foreach ( $arr as $key => $text ) { + $result[$key] = wpcf7_strip_quote_deep( $text ); + } + + return $result; + } +} + +function wpcf7_normalize_newline( $text, $to = "\n" ) { + if ( ! is_string( $text ) ) { + return $text; + } + + $nls = array( "\r\n", "\r", "\n" ); + + if ( ! in_array( $to, $nls ) ) { + return $text; + } + + return str_replace( $nls, $to, $text ); +} + +function wpcf7_normalize_newline_deep( $arr, $to = "\n" ) { + if ( is_array( $arr ) ) { + $result = array(); + + foreach ( $arr as $key => $text ) { + $result[$key] = wpcf7_normalize_newline_deep( $text, $to ); + } + + return $result; + } + + return wpcf7_normalize_newline( $arr, $to ); +} + +function wpcf7_strip_newline( $str ) { + $str = (string) $str; + $str = str_replace( array( "\r", "\n" ), '', $str ); + return trim( $str ); +} + +function wpcf7_canonicalize( $text, $strto = 'lower' ) { + if ( function_exists( 'mb_convert_kana' ) + and 'UTF-8' == get_option( 'blog_charset' ) ) { + $text = mb_convert_kana( $text, 'asKV', 'UTF-8' ); + } + + if ( 'lower' == $strto ) { + $text = strtolower( $text ); + } elseif ( 'upper' == $strto ) { + $text = strtoupper( $text ); + } + + $text = trim( $text ); + return $text; +} + +/** + * Check whether a string is a valid NAME token. + * + * ID and NAME tokens must begin with a letter ([A-Za-z]) + * and may be followed by any number of letters, digits ([0-9]), + * hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). + * + * @see http://www.w3.org/TR/html401/types.html#h-6.2 + * + * @return bool True if it is a valid name, false if not. + */ +function wpcf7_is_name( $string ) { + return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string ); +} + +function wpcf7_sanitize_unit_tag( $tag ) { + $tag = preg_replace( '/[^A-Za-z0-9_-]/', '', $tag ); + return $tag; +} + +function wpcf7_is_email( $email ) { + $result = is_email( $email ); + return apply_filters( 'wpcf7_is_email', $result, $email ); +} + +function wpcf7_is_url( $url ) { + $result = ( false !== filter_var( $url, FILTER_VALIDATE_URL ) ); + return apply_filters( 'wpcf7_is_url', $result, $url ); +} + +function wpcf7_is_tel( $tel ) { + $result = preg_match( '%^[+]?[0-9()/ -]*$%', $tel ); + return apply_filters( 'wpcf7_is_tel', $result, $tel ); +} + +function wpcf7_is_number( $number ) { + $result = is_numeric( $number ); + return apply_filters( 'wpcf7_is_number', $result, $number ); +} + +function wpcf7_is_date( $date ) { + $result = preg_match( '/^([0-9]{4,})-([0-9]{2})-([0-9]{2})$/', $date, $matches ); + + if ( $result ) { + $result = checkdate( $matches[2], $matches[3], $matches[1] ); + } + + return apply_filters( 'wpcf7_is_date', $result, $date ); +} + +function wpcf7_is_mailbox_list( $mailbox_list ) { + if ( ! is_array( $mailbox_list ) ) { + $mailbox_text = (string) $mailbox_list; + $mailbox_text = wp_unslash( $mailbox_text ); + + $mailbox_text = preg_replace( '/\\\\(?:\"|\')/', 'esc-quote', + $mailbox_text ); + + $mailbox_text = preg_replace( '/(?:\".*?\"|\'.*?\')/', 'quoted-string', + $mailbox_text ); + + $mailbox_list = explode( ',', $mailbox_text ); + } + + $addresses = array(); + + foreach ( $mailbox_list as $mailbox ) { + if ( ! is_string( $mailbox ) ) { + return false; + } + + $mailbox = trim( $mailbox ); + + if ( preg_match( '/<(.+)>$/', $mailbox, $matches ) ) { + $addr_spec = $matches[1]; + } else { + $addr_spec = $mailbox; + } + + if ( ! wpcf7_is_email( $addr_spec ) ) { + return false; + } + + $addresses[] = $addr_spec; + } + + return $addresses; +} + +function wpcf7_is_email_in_domain( $email, $domain ) { + $email_list = wpcf7_is_mailbox_list( $email ); + $domain = strtolower( $domain ); + + foreach ( $email_list as $email ) { + $email_domain = substr( $email, strrpos( $email, '@' ) + 1 ); + $email_domain = strtolower( $email_domain ); + $domain_parts = explode( '.', $domain ); + + do { + $site_domain = implode( '.', $domain_parts ); + + if ( $site_domain == $email_domain ) { + continue 2; + } + + array_shift( $domain_parts ); + } while ( $domain_parts ); + + return false; + } + + return true; +} + +function wpcf7_is_email_in_site_domain( $email ) { + if ( wpcf7_is_localhost() ) { + return true; + } + + $site_domain = strtolower( $_SERVER['SERVER_NAME'] ); + + if ( preg_match( '/^[0-9.]+$/', $site_domain ) ) { // 123.456.789.012 + return true; + } + + if ( wpcf7_is_email_in_domain( $email, $site_domain ) ) { + return true; + } + + $home_url = home_url(); + + // for interoperability with WordPress MU Domain Mapping plugin + if ( is_multisite() + and function_exists( 'domain_mapping_siteurl' ) ) { + $domain_mapping_siteurl = domain_mapping_siteurl( false ); + + if ( $domain_mapping_siteurl ) { + $home_url = $domain_mapping_siteurl; + } + } + + if ( preg_match( '%^https?://([^/]+)%', $home_url, $matches ) ) { + $site_domain = strtolower( $matches[1] ); + + if ( $site_domain != strtolower( $_SERVER['SERVER_NAME'] ) + and wpcf7_is_email_in_domain( $email, $site_domain ) ) { + return true; + } + } + + return false; +} + +function wpcf7_antiscript_file_name( $filename ) { + $filename = basename( $filename ); + $parts = explode( '.', $filename ); + + if ( count( $parts ) < 2 ) { + return $filename; + } + + $script_pattern = '/^(php|phtml|pl|py|rb|cgi|asp|aspx)\d?$/i'; + + $filename = array_shift( $parts ); + $extension = array_pop( $parts ); + + foreach ( (array) $parts as $part ) { + if ( preg_match( $script_pattern, $part ) ) { + $filename .= '.' . $part . '_'; + } else { + $filename .= '.' . $part; + } + } + + if ( preg_match( $script_pattern, $extension ) ) { + $filename .= '.' . $extension . '_.txt'; + } else { + $filename .= '.' . $extension; + } + + return $filename; +} + +function wpcf7_mask_password( $text, $length_unmasked = 0 ) { + $length = strlen( $text ); + $length_unmasked = absint( $length_unmasked ); + + if ( 0 == $length_unmasked ) { + if ( 9 < $length ) { + $length_unmasked = 4; + } elseif ( 3 < $length ) { + $length_unmasked = 2; + } else { + $length_unmasked = $length; + } + } + + $text = substr( $text, 0 - $length_unmasked ); + $text = str_pad( $text, $length, '*', STR_PAD_LEFT ); + return $text; +} diff --git a/wp-content/plugins/contact-form-7/includes/functions.php b/wp-content/plugins/contact-form-7/includes/functions.php new file mode 100644 index 0000000..d9a7a56 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/functions.php @@ -0,0 +1,434 @@ + $uploads['basedir'], + 'url' => $uploads['baseurl'], + ) ); + + if ( 'dir' == $type ) { + return $uploads['dir']; + } if ( 'url' == $type ) { + return $uploads['url']; + } + + return $uploads; +} + +function wpcf7_verify_nonce( $nonce, $action = 'wp_rest' ) { + return wp_verify_nonce( $nonce, $action ); +} + +function wpcf7_create_nonce( $action = 'wp_rest' ) { + return wp_create_nonce( $action ); +} + +function wpcf7_blacklist_check( $target ) { + $mod_keys = trim( get_option( 'blacklist_keys' ) ); + + if ( empty( $mod_keys ) ) { + return false; + } + + $words = explode( "\n", $mod_keys ); + + foreach ( (array) $words as $word ) { + $word = trim( $word ); + + if ( empty( $word ) + or 256 < strlen( $word ) ) { + continue; + } + + $pattern = sprintf( '#%s#i', preg_quote( $word, '#' ) ); + + if ( preg_match( $pattern, $target ) ) { + return true; + } + } + + return false; +} + +function wpcf7_array_flatten( $input ) { + if ( ! is_array( $input ) ) { + return array( $input ); + } + + $output = array(); + + foreach ( $input as $value ) { + $output = array_merge( $output, wpcf7_array_flatten( $value ) ); + } + + return $output; +} + +function wpcf7_flat_join( $input ) { + $input = wpcf7_array_flatten( $input ); + $output = array(); + + foreach ( (array) $input as $value ) { + $output[] = trim( (string) $value ); + } + + return implode( ', ', $output ); +} + +function wpcf7_support_html5() { + return (bool) apply_filters( 'wpcf7_support_html5', true ); +} + +function wpcf7_support_html5_fallback() { + return (bool) apply_filters( 'wpcf7_support_html5_fallback', false ); +} + +function wpcf7_use_really_simple_captcha() { + return apply_filters( 'wpcf7_use_really_simple_captcha', + WPCF7_USE_REALLY_SIMPLE_CAPTCHA ); +} + +function wpcf7_validate_configuration() { + return apply_filters( 'wpcf7_validate_configuration', + WPCF7_VALIDATE_CONFIGURATION ); +} + +function wpcf7_autop_or_not() { + return (bool) apply_filters( 'wpcf7_autop_or_not', WPCF7_AUTOP ); +} + +function wpcf7_load_js() { + return apply_filters( 'wpcf7_load_js', WPCF7_LOAD_JS ); +} + +function wpcf7_load_css() { + return apply_filters( 'wpcf7_load_css', WPCF7_LOAD_CSS ); +} + +function wpcf7_format_atts( $atts ) { + $html = ''; + + $prioritized_atts = array( 'type', 'name', 'value' ); + + foreach ( $prioritized_atts as $att ) { + if ( isset( $atts[$att] ) ) { + $value = trim( $atts[$att] ); + $html .= sprintf( ' %s="%s"', $att, esc_attr( $value ) ); + unset( $atts[$att] ); + } + } + + foreach ( $atts as $key => $value ) { + $key = strtolower( trim( $key ) ); + + if ( ! preg_match( '/^[a-z_:][a-z_:.0-9-]*$/', $key ) ) { + continue; + } + + $value = trim( $value ); + + if ( '' !== $value ) { + $html .= sprintf( ' %s="%s"', $key, esc_attr( $value ) ); + } + } + + $html = trim( $html ); + + return $html; +} + +function wpcf7_link( $url, $anchor_text, $args = '' ) { + $defaults = array( + 'id' => '', + 'class' => '', + ); + + $args = wp_parse_args( $args, $defaults ); + $args = array_intersect_key( $args, $defaults ); + $atts = wpcf7_format_atts( $args ); + + $link = sprintf( '%2$s', + esc_url( $url ), + esc_html( $anchor_text ), + $atts ? ( ' ' . $atts ) : '' ); + + return $link; +} + +function wpcf7_get_request_uri() { + static $request_uri = ''; + + if ( empty( $request_uri ) ) { + $request_uri = add_query_arg( array() ); + } + + return esc_url_raw( $request_uri ); +} + +function wpcf7_register_post_types() { + if ( class_exists( 'WPCF7_ContactForm' ) ) { + WPCF7_ContactForm::register_post_type(); + return true; + } else { + return false; + } +} + +function wpcf7_version( $args = '' ) { + $defaults = array( + 'limit' => -1, + 'only_major' => false, + ); + + $args = wp_parse_args( $args, $defaults ); + + if ( $args['only_major'] ) { + $args['limit'] = 2; + } + + $args['limit'] = (int) $args['limit']; + + $ver = WPCF7_VERSION; + $ver = strtr( $ver, '_-+', '...' ); + $ver = preg_replace( '/[^0-9.]+/', ".$0.", $ver ); + $ver = preg_replace( '/[.]+/', ".", $ver ); + $ver = trim( $ver, '.' ); + $ver = explode( '.', $ver ); + + if ( -1 < $args['limit'] ) { + $ver = array_slice( $ver, 0, $args['limit'] ); + } + + $ver = implode( '.', $ver ); + + return $ver; +} + +function wpcf7_version_grep( $version, array $input ) { + $pattern = '/^' . preg_quote( (string) $version, '/' ) . '(?:\.|$)/'; + + return preg_grep( $pattern, $input ); +} + +function wpcf7_enctype_value( $enctype ) { + $enctype = trim( $enctype ); + + if ( empty( $enctype ) ) { + return ''; + } + + $valid_enctypes = array( + 'application/x-www-form-urlencoded', + 'multipart/form-data', + 'text/plain', + ); + + if ( in_array( $enctype, $valid_enctypes ) ) { + return $enctype; + } + + $pattern = '%^enctype="(' . implode( '|', $valid_enctypes ) . ')"$%'; + + if ( preg_match( $pattern, $enctype, $matches ) ) { + return $matches[1]; // for back-compat + } + + return ''; +} + +function wpcf7_rmdir_p( $dir ) { + if ( is_file( $dir ) ) { + $file = $dir; + + if ( @unlink( $file ) ) { + return true; + } + + $stat = stat( $file ); + + if ( @chmod( $file, $stat['mode'] | 0200 ) ) { // add write for owner + if ( @unlink( $file ) ) { + return true; + } + + @chmod( $file, $stat['mode'] ); + } + + return false; + } + + if ( ! is_dir( $dir ) ) { + return false; + } + + if ( $handle = opendir( $dir ) ) { + while ( false !== ( $file = readdir( $handle ) ) ) { + if ( $file == "." + or $file == ".." ) { + continue; + } + + wpcf7_rmdir_p( path_join( $dir, $file ) ); + } + + closedir( $handle ); + } + + if ( false !== ( $files = scandir( $dir ) ) + and ! array_diff( $files, array( '.', '..' ) ) ) { + return rmdir( $dir ); + } + + return false; +} + +/* From _http_build_query in wp-includes/functions.php */ +function wpcf7_build_query( $args, $key = '' ) { + $sep = '&'; + $ret = array(); + + foreach ( (array) $args as $k => $v ) { + $k = urlencode( $k ); + + if ( ! empty( $key ) ) { + $k = $key . '%5B' . $k . '%5D'; + } + + if ( null === $v ) { + continue; + } elseif ( false === $v ) { + $v = '0'; + } + + if ( is_array( $v ) or is_object( $v ) ) { + array_push( $ret, wpcf7_build_query( $v, $k ) ); + } else { + array_push( $ret, $k . '=' . urlencode( $v ) ); + } + } + + return implode( $sep, $ret ); +} + +/** + * Returns the number of code units in a string. + * + * @see http://www.w3.org/TR/html5/infrastructure.html#code-unit-length + * + * @return int|bool The number of code units, or false if mb_convert_encoding is not available. + */ +function wpcf7_count_code_units( $string ) { + static $use_mb = null; + + if ( is_null( $use_mb ) ) { + $use_mb = function_exists( 'mb_convert_encoding' ); + } + + if ( ! $use_mb ) { + return false; + } + + $string = (string) $string; + $string = str_replace( "\r\n", "\n", $string ); + + $encoding = mb_detect_encoding( $string, mb_detect_order(), true ); + + if ( $encoding ) { + $string = mb_convert_encoding( $string, 'UTF-16', $encoding ); + } else { + $string = mb_convert_encoding( $string, 'UTF-16', 'UTF-8' ); + } + + $byte_count = mb_strlen( $string, '8bit' ); + + return floor( $byte_count / 2 ); +} + +function wpcf7_is_localhost() { + $server_name = strtolower( $_SERVER['SERVER_NAME'] ); + return in_array( $server_name, array( 'localhost', '127.0.0.1' ) ); +} + +function wpcf7_deprecated_function( $function, $version, $replacement ) { + $trigger_error = apply_filters( 'deprecated_function_trigger_error', true ); + + if ( WP_DEBUG and $trigger_error ) { + if ( function_exists( '__' ) ) { + trigger_error( sprintf( __( '%1$s is deprecated since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ), $function, $version, $replacement ) ); + } else { + trigger_error( sprintf( '%1$s is deprecated since Contact Form 7 version %2$s! Use %3$s instead.', $function, $version, $replacement ) ); + } + } +} + +function wpcf7_log_remote_request( $url, $request, $response ) { + $log = sprintf( + /* translators: 1: response code, 2: message, 3: body, 4: URL */ + __( 'HTTP Response: %1$s %2$s %3$s from %4$s', 'contact-form-7' ), + (int) wp_remote_retrieve_response_code( $response ), + wp_remote_retrieve_response_message( $response ), + wp_remote_retrieve_body( $response ), + $url + ); + + $log = apply_filters( 'wpcf7_log_remote_request', + $log, $url, $request, $response + ); + + if ( $log ) { + trigger_error( $log ); + } +} + +function wpcf7_anonymize_ip_addr( $ip_addr ) { + if ( ! function_exists( 'inet_ntop' ) + or ! function_exists( 'inet_pton' ) ) { + return $ip_addr; + } + + $packed = inet_pton( $ip_addr ); + + if ( false === $packed ) { + return $ip_addr; + } + + if ( 4 == strlen( $packed ) ) { // IPv4 + $mask = '255.255.255.0'; + } elseif ( 16 == strlen( $packed ) ) { // IPv6 + $mask = 'ffff:ffff:ffff:0000:0000:0000:0000:0000'; + } else { + return $ip_addr; + } + + return inet_ntop( $packed & inet_pton( $mask ) ); +} + +function wpcf7_is_file_path_in_content_dir( $path ) { + if ( 0 === strpos( realpath( $path ), realpath( WP_CONTENT_DIR ) ) ) { + return true; + } + + if ( defined( 'UPLOADS' ) + and 0 === strpos( realpath( $path ), realpath( ABSPATH . UPLOADS ) ) ) { + return true; + } + + return false; +} diff --git a/wp-content/plugins/contact-form-7/includes/integration.php b/wp-content/plugins/contact-form-7/includes/integration.php new file mode 100644 index 0000000..61ab258 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/integration.php @@ -0,0 +1,345 @@ +services[$name] ) ) { + return false; + } + + $this->services[$name] = $service; + } + + public function add_category( $name, $title ) { + $name = sanitize_key( $name ); + + if ( empty( $name ) + or isset( $this->categories[$name] ) ) { + return false; + } + + $this->categories[$name] = $title; + } + + public function service_exists( $name = '' ) { + if ( '' == $name ) { + return (bool) count( $this->services ); + } else { + return isset( $this->services[$name] ); + } + } + + public function get_service( $name ) { + if ( $this->service_exists( $name ) ) { + return $this->services[$name]; + } else { + return false; + } + } + + public function list_services( $args = '' ) { + $args = wp_parse_args( $args, array( + 'include' => array(), + ) ); + + $singular = false; + $services = (array) $this->services; + + if ( ! empty( $args['include'] ) ) { + $services = array_intersect_key( $services, + array_flip( (array) $args['include'] ) ); + + if ( 1 == count( $services ) ) { + $singular = true; + } + } + + if ( empty( $services ) ) { + return; + } + + $action = wpcf7_current_action(); + + foreach ( $services as $name => $service ) { + $cats = array_intersect_key( $this->categories, + array_flip( $service->get_categories() ) ); +?> +
                    +icon(); ?> +

                    get_title() ); ?>

                    +
                    + +
                    +link(); ?> +
                    +
                    + +
                    +display( $action ); + } else { + $service->display(); + } +?> +
                    +
                    +refresh_token ); + } + + protected function save_data() { + } + + protected function reset_data() { + } + + protected function get_redirect_uri() { + return admin_url(); + } + + protected function menu_page_url( $args = '' ) { + return menu_page_url( 'wpcf7-integration', false ); + } + + public function load( $action = '' ) { + if ( 'auth_redirect' == $action ) { + $code = isset( $_GET['code'] ) ? $_GET['code'] : ''; + + if ( $code ) { + $this->request_token( $code ); + } + + if ( ! empty( $this->access_token ) ) { + $message = 'success'; + } else { + $message = 'failed'; + } + + wp_safe_redirect( $this->menu_page_url( + array( + 'action' => 'setup', + 'message' => $message, + ) + ) ); + + exit(); + } + } + + protected function authorize( $scope = '' ) { + $endpoint = add_query_arg( + array( + 'response_type' => 'code', + 'client_id' => $this->client_id, + 'redirect_uri' => urlencode( $this->get_redirect_uri() ), + 'scope' => $scope, + ), + $this->authorization_endpoint + ); + + if ( wp_redirect( esc_url_raw( $endpoint ) ) ) { + exit(); + } + } + + protected function get_http_authorization_header( $scheme = 'basic' ) { + $scheme = strtolower( trim( $scheme ) ); + + switch ( $scheme ) { + case 'bearer': + return sprintf( 'Bearer %s', $this->access_token ); + case 'basic': + default: + return sprintf( 'Basic %s', + base64_encode( $this->client_id . ':' . $this->client_secret ) + ); + } + } + + protected function request_token( $authorization_code ) { + $endpoint = add_query_arg( + array( + 'code' => $authorization_code, + 'redirect_uri' => urlencode( $this->get_redirect_uri() ), + 'grant_type' => 'authorization_code', + ), + $this->token_endpoint + ); + + $request = array( + 'headers' => array( + 'Authorization' => $this->get_http_authorization_header( 'basic' ), + ), + ); + + $response = wp_remote_post( esc_url_raw( $endpoint ), $request ); + $response_code = (int) wp_remote_retrieve_response_code( $response ); + $response_body = wp_remote_retrieve_body( $response ); + $response_body = json_decode( $response_body, true ); + + if ( WP_DEBUG and 400 <= $response_code ) { + $this->log( $endpoint, $request, $response ); + } + + if ( 401 == $response_code ) { // Unauthorized + $this->access_token = null; + $this->refresh_token = null; + } else { + if ( isset( $response_body['access_token'] ) ) { + $this->access_token = $response_body['access_token']; + } else { + $this->access_token = null; + } + + if ( isset( $response_body['refresh_token'] ) ) { + $this->refresh_token = $response_body['refresh_token']; + } else { + $this->refresh_token = null; + } + } + + $this->save_data(); + + return $response; + } + + protected function refresh_token() { + $endpoint = add_query_arg( + array( + 'refresh_token' => $this->refresh_token, + 'grant_type' => 'refresh_token', + ), + $this->token_endpoint + ); + + $request = array( + 'headers' => array( + 'Authorization' => $this->get_http_authorization_header( 'basic' ), + ), + ); + + $response = wp_remote_post( esc_url_raw( $endpoint ), $request ); + $response_code = (int) wp_remote_retrieve_response_code( $response ); + $response_body = wp_remote_retrieve_body( $response ); + $response_body = json_decode( $response_body, true ); + + if ( WP_DEBUG and 400 <= $response_code ) { + $this->log( $endpoint, $request, $response ); + } + + if ( 401 == $response_code ) { // Unauthorized + $this->access_token = null; + $this->refresh_token = null; + } else { + if ( isset( $response_body['access_token'] ) ) { + $this->access_token = $response_body['access_token']; + } else { + $this->access_token = null; + } + + if ( isset( $response_body['refresh_token'] ) ) { + $this->refresh_token = $response_body['refresh_token']; + } + } + + $this->save_data(); + + return $response; + } + + protected function remote_request( $url, $request = array() ) { + static $refreshed = false; + + $request = wp_parse_args( $request, array() ); + + $request['headers'] = array_merge( + $request['headers'], + array( + 'Authorization' => $this->get_http_authorization_header( 'bearer' ), + ) + ); + + $response = wp_remote_request( esc_url_raw( $url ), $request ); + + if ( 401 === wp_remote_retrieve_response_code( $response ) + and ! $refreshed ) { + $this->refresh_token(); + $refreshed = true; + + $response = $this->remote_request( $url, $request ); + } + + return $response; + } + + protected function log( $url, $request, $response ) { + wpcf7_log_remote_request( $url, $request, $response ); + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 0000000..2991f73 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 0000000..eacaf60 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 0000000..a7d19c4 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 0000000..f89e88c Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 0000000..bf5c20d Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 0000000..3e4e6ec Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 0000000..d6f3392 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 0000000..0071c4d Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_222222_256x240.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 0000000..82fad68 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 0000000..429489e Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_454545_256x240.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 0000000..2df9132 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_888888_256x240.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 0000000..ad48782 Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 0000000..f51e31d Binary files /dev/null and b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.css b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.css new file mode 100644 index 0000000..1c22746 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.css @@ -0,0 +1,1225 @@ +/*! jQuery UI - v1.11.4 - 2015-03-11 +* http://jqueryui.com +* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { + display: none; +} +.ui-helper-hidden-accessible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.ui-helper-reset { + margin: 0; + padding: 0; + border: 0; + outline: 0; + line-height: 1.3; + text-decoration: none; + font-size: 100%; + list-style: none; +} +.ui-helper-clearfix:before, +.ui-helper-clearfix:after { + content: ""; + display: table; + border-collapse: collapse; +} +.ui-helper-clearfix:after { + clear: both; +} +.ui-helper-clearfix { + min-height: 0; /* support: IE7 */ +} +.ui-helper-zfix { + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + opacity: 0; + filter:Alpha(Opacity=0); /* support: IE8 */ +} + +.ui-front { + z-index: 100; +} + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { + cursor: default !important; +} + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + display: block; + text-indent: -99999px; + overflow: hidden; + background-repeat: no-repeat; +} + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-accordion .ui-accordion-header { + display: block; + cursor: pointer; + position: relative; + margin: 2px 0 0 0; + padding: .5em .5em .5em .7em; + min-height: 0; /* support: IE7 */ + font-size: 100%; +} +.ui-accordion .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-icons .ui-accordion-icons { + padding-left: 2.2em; +} +.ui-accordion .ui-accordion-header .ui-accordion-header-icon { + position: absolute; + left: .5em; + top: 50%; + margin-top: -8px; +} +.ui-accordion .ui-accordion-content { + padding: 1em 2.2em; + border-top: 0; + overflow: auto; +} +.ui-autocomplete { + position: absolute; + top: 0; + left: 0; + cursor: default; +} +.ui-button { + display: inline-block; + position: relative; + padding: 0; + line-height: normal; + margin-right: .1em; + cursor: pointer; + vertical-align: middle; + text-align: center; + overflow: visible; /* removes extra width in IE */ +} +.ui-button, +.ui-button:link, +.ui-button:visited, +.ui-button:hover, +.ui-button:active { + text-decoration: none; +} +/* to make room for the icon, a width needs to be set here */ +.ui-button-icon-only { + width: 2.2em; +} +/* button elements seem to need a little more width */ +button.ui-button-icon-only { + width: 2.4em; +} +.ui-button-icons-only { + width: 3.4em; +} +button.ui-button-icons-only { + width: 3.7em; +} + +/* button text element */ +.ui-button .ui-button-text { + display: block; + line-height: normal; +} +.ui-button-text-only .ui-button-text { + padding: .4em 1em; +} +.ui-button-icon-only .ui-button-text, +.ui-button-icons-only .ui-button-text { + padding: .4em; + text-indent: -9999999px; +} +.ui-button-text-icon-primary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 1em .4em 2.1em; +} +.ui-button-text-icon-secondary .ui-button-text, +.ui-button-text-icons .ui-button-text { + padding: .4em 2.1em .4em 1em; +} +.ui-button-text-icons .ui-button-text { + padding-left: 2.1em; + padding-right: 2.1em; +} +/* no icon support for input elements, provide padding by default */ +input.ui-button { + padding: .4em 1em; +} + +/* button icon element(s) */ +.ui-button-icon-only .ui-icon, +.ui-button-text-icon-primary .ui-icon, +.ui-button-text-icon-secondary .ui-icon, +.ui-button-text-icons .ui-icon, +.ui-button-icons-only .ui-icon { + position: absolute; + top: 50%; + margin-top: -8px; +} +.ui-button-icon-only .ui-icon { + left: 50%; + margin-left: -8px; +} +.ui-button-text-icon-primary .ui-button-icon-primary, +.ui-button-text-icons .ui-button-icon-primary, +.ui-button-icons-only .ui-button-icon-primary { + left: .5em; +} +.ui-button-text-icon-secondary .ui-button-icon-secondary, +.ui-button-text-icons .ui-button-icon-secondary, +.ui-button-icons-only .ui-button-icon-secondary { + right: .5em; +} + +/* button sets */ +.ui-buttonset { + margin-right: 7px; +} +.ui-buttonset .ui-button { + margin-left: 0; + margin-right: -.3em; +} + +/* workarounds */ +/* reset extra padding in Firefox, see h5bp.com/l */ +input.ui-button::-moz-focus-inner, +button.ui-button::-moz-focus-inner { + border: 0; + padding: 0; +} +.ui-datepicker { + width: 17em; + padding: .2em .2em 0; + display: none; +} +.ui-datepicker .ui-datepicker-header { + position: relative; + padding: .2em 0; +} +.ui-datepicker .ui-datepicker-prev, +.ui-datepicker .ui-datepicker-next { + position: absolute; + top: 2px; + width: 1.8em; + height: 1.8em; +} +.ui-datepicker .ui-datepicker-prev-hover, +.ui-datepicker .ui-datepicker-next-hover { + top: 1px; +} +.ui-datepicker .ui-datepicker-prev { + left: 2px; +} +.ui-datepicker .ui-datepicker-next { + right: 2px; +} +.ui-datepicker .ui-datepicker-prev-hover { + left: 1px; +} +.ui-datepicker .ui-datepicker-next-hover { + right: 1px; +} +.ui-datepicker .ui-datepicker-prev span, +.ui-datepicker .ui-datepicker-next span { + display: block; + position: absolute; + left: 50%; + margin-left: -8px; + top: 50%; + margin-top: -8px; +} +.ui-datepicker .ui-datepicker-title { + margin: 0 2.3em; + line-height: 1.8em; + text-align: center; +} +.ui-datepicker .ui-datepicker-title select { + font-size: 1em; + margin: 1px 0; +} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { + width: 45%; +} +.ui-datepicker table { + width: 100%; + font-size: .9em; + border-collapse: collapse; + margin: 0 0 .4em; +} +.ui-datepicker th { + padding: .7em .3em; + text-align: center; + font-weight: bold; + border: 0; +} +.ui-datepicker td { + border: 0; + padding: 1px; +} +.ui-datepicker td span, +.ui-datepicker td a { + display: block; + padding: .2em; + text-align: right; + text-decoration: none; +} +.ui-datepicker .ui-datepicker-buttonpane { + background-image: none; + margin: .7em 0 0 0; + padding: 0 .2em; + border-left: 0; + border-right: 0; + border-bottom: 0; +} +.ui-datepicker .ui-datepicker-buttonpane button { + float: right; + margin: .5em .2em .4em; + cursor: pointer; + padding: .2em .6em .3em .6em; + width: auto; + overflow: visible; +} +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { + float: left; +} + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { + width: auto; +} +.ui-datepicker-multi .ui-datepicker-group { + float: left; +} +.ui-datepicker-multi .ui-datepicker-group table { + width: 95%; + margin: 0 auto .4em; +} +.ui-datepicker-multi-2 .ui-datepicker-group { + width: 50%; +} +.ui-datepicker-multi-3 .ui-datepicker-group { + width: 33.3%; +} +.ui-datepicker-multi-4 .ui-datepicker-group { + width: 25%; +} +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { + border-left-width: 0; +} +.ui-datepicker-multi .ui-datepicker-buttonpane { + clear: left; +} +.ui-datepicker-row-break { + clear: both; + width: 100%; + font-size: 0; +} + +/* RTL support */ +.ui-datepicker-rtl { + direction: rtl; +} +.ui-datepicker-rtl .ui-datepicker-prev { + right: 2px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next { + left: 2px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-prev:hover { + right: 1px; + left: auto; +} +.ui-datepicker-rtl .ui-datepicker-next:hover { + left: 1px; + right: auto; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane { + clear: right; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button { + float: left; +} +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, +.ui-datepicker-rtl .ui-datepicker-group { + float: right; +} +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { + border-right-width: 0; + border-left-width: 1px; +} +.ui-dialog { + overflow: hidden; + position: absolute; + top: 0; + left: 0; + padding: .2em; + outline: 0; +} +.ui-dialog .ui-dialog-titlebar { + padding: .4em 1em; + position: relative; +} +.ui-dialog .ui-dialog-title { + float: left; + margin: .1em 0; + white-space: nowrap; + width: 90%; + overflow: hidden; + text-overflow: ellipsis; +} +.ui-dialog .ui-dialog-titlebar-close { + position: absolute; + right: .3em; + top: 50%; + width: 20px; + margin: -10px 0 0 0; + padding: 1px; + height: 20px; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; +} +.ui-dialog .ui-dialog-buttonpane { + text-align: left; + border-width: 1px 0 0 0; + background-image: none; + margin-top: .5em; + padding: .3em 1em .5em .4em; +} +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { + float: right; +} +.ui-dialog .ui-dialog-buttonpane button { + margin: .5em .4em .5em 0; + cursor: pointer; +} +.ui-dialog .ui-resizable-se { + width: 12px; + height: 12px; + right: -5px; + bottom: -5px; + background-position: 16px 16px; +} +.ui-draggable .ui-dialog-titlebar { + cursor: move; +} +.ui-draggable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-menu { + list-style: none; + padding: 0; + margin: 0; + display: block; + outline: none; +} +.ui-menu .ui-menu { + position: absolute; +} +.ui-menu .ui-menu-item { + position: relative; + margin: 0; + padding: 3px 1em 3px .4em; + cursor: pointer; + min-height: 0; /* support: IE7 */ + /* support: IE10, see #8844 */ + list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); +} +.ui-menu .ui-menu-divider { + margin: 5px 0; + height: 0; + font-size: 0; + line-height: 0; + border-width: 1px 0 0 0; +} +.ui-menu .ui-state-focus, +.ui-menu .ui-state-active { + margin: -1px; +} + +/* icon support */ +.ui-menu-icons { + position: relative; +} +.ui-menu-icons .ui-menu-item { + padding-left: 2em; +} + +/* left-aligned */ +.ui-menu .ui-icon { + position: absolute; + top: 0; + bottom: 0; + left: .2em; + margin: auto 0; +} + +/* right-aligned */ +.ui-menu .ui-menu-icon { + left: auto; + right: 0; +} +.ui-progressbar { + height: 2em; + text-align: left; + overflow: hidden; +} +.ui-progressbar .ui-progressbar-value { + margin: -1px; + height: 100%; +} +.ui-progressbar .ui-progressbar-overlay { + background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw=="); + height: 100%; + filter: alpha(opacity=25); /* support: IE8 */ + opacity: 0.25; +} +.ui-progressbar-indeterminate .ui-progressbar-value { + background-image: none; +} +.ui-resizable { + position: relative; +} +.ui-resizable-handle { + position: absolute; + font-size: 0.1px; + display: block; + -ms-touch-action: none; + touch-action: none; +} +.ui-resizable-disabled .ui-resizable-handle, +.ui-resizable-autohide .ui-resizable-handle { + display: none; +} +.ui-resizable-n { + cursor: n-resize; + height: 7px; + width: 100%; + top: -5px; + left: 0; +} +.ui-resizable-s { + cursor: s-resize; + height: 7px; + width: 100%; + bottom: -5px; + left: 0; +} +.ui-resizable-e { + cursor: e-resize; + width: 7px; + right: -5px; + top: 0; + height: 100%; +} +.ui-resizable-w { + cursor: w-resize; + width: 7px; + left: -5px; + top: 0; + height: 100%; +} +.ui-resizable-se { + cursor: se-resize; + width: 12px; + height: 12px; + right: 1px; + bottom: 1px; +} +.ui-resizable-sw { + cursor: sw-resize; + width: 9px; + height: 9px; + left: -5px; + bottom: -5px; +} +.ui-resizable-nw { + cursor: nw-resize; + width: 9px; + height: 9px; + left: -5px; + top: -5px; +} +.ui-resizable-ne { + cursor: ne-resize; + width: 9px; + height: 9px; + right: -5px; + top: -5px; +} +.ui-selectable { + -ms-touch-action: none; + touch-action: none; +} +.ui-selectable-helper { + position: absolute; + z-index: 100; + border: 1px dotted black; +} +.ui-selectmenu-menu { + padding: 0; + margin: 0; + position: absolute; + top: 0; + left: 0; + display: none; +} +.ui-selectmenu-menu .ui-menu { + overflow: auto; + /* Support: IE7 */ + overflow-x: hidden; + padding-bottom: 1px; +} +.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup { + font-size: 1em; + font-weight: bold; + line-height: 1.5; + padding: 2px 0.4em; + margin: 0.5em 0 0 0; + height: auto; + border: 0; +} +.ui-selectmenu-open { + display: block; +} +.ui-selectmenu-button { + display: inline-block; + overflow: hidden; + position: relative; + text-decoration: none; + cursor: pointer; +} +.ui-selectmenu-button span.ui-icon { + right: 0.5em; + left: auto; + margin-top: -8px; + position: absolute; + top: 50%; +} +.ui-selectmenu-button span.ui-selectmenu-text { + text-align: left; + padding: 0.4em 2.1em 0.4em 1em; + display: block; + line-height: 1.4; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.ui-slider { + position: relative; + text-align: left; +} +.ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + width: 1.2em; + height: 1.2em; + cursor: default; + -ms-touch-action: none; + touch-action: none; +} +.ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: .7em; + display: block; + border: 0; + background-position: 0 0; +} + +/* support: IE8 - See #6727 */ +.ui-slider.ui-state-disabled .ui-slider-handle, +.ui-slider.ui-state-disabled .ui-slider-range { + filter: inherit; +} + +.ui-slider-horizontal { + height: .8em; +} +.ui-slider-horizontal .ui-slider-handle { + top: -.3em; + margin-left: -.6em; +} +.ui-slider-horizontal .ui-slider-range { + top: 0; + height: 100%; +} +.ui-slider-horizontal .ui-slider-range-min { + left: 0; +} +.ui-slider-horizontal .ui-slider-range-max { + right: 0; +} + +.ui-slider-vertical { + width: .8em; + height: 100px; +} +.ui-slider-vertical .ui-slider-handle { + left: -.3em; + margin-left: 0; + margin-bottom: -.6em; +} +.ui-slider-vertical .ui-slider-range { + left: 0; + width: 100%; +} +.ui-slider-vertical .ui-slider-range-min { + bottom: 0; +} +.ui-slider-vertical .ui-slider-range-max { + top: 0; +} +.ui-sortable-handle { + -ms-touch-action: none; + touch-action: none; +} +.ui-spinner { + position: relative; + display: inline-block; + overflow: hidden; + padding: 0; + vertical-align: middle; +} +.ui-spinner-input { + border: none; + background: none; + color: inherit; + padding: 0; + margin: .2em 0; + vertical-align: middle; + margin-left: .4em; + margin-right: 22px; +} +.ui-spinner-button { + width: 16px; + height: 50%; + font-size: .5em; + padding: 0; + margin: 0; + text-align: center; + position: absolute; + cursor: default; + display: block; + overflow: hidden; + right: 0; +} +/* more specificity required here to override default borders */ +.ui-spinner a.ui-spinner-button { + border-top: none; + border-bottom: none; + border-right: none; +} +/* vertically center icon */ +.ui-spinner .ui-icon { + position: absolute; + margin-top: -8px; + top: 50%; + left: 0; +} +.ui-spinner-up { + top: 0; +} +.ui-spinner-down { + bottom: 0; +} + +/* TR overrides */ +.ui-spinner .ui-icon-triangle-1-s { + /* need to fix icons sprite */ + background-position: -65px -16px; +} +.ui-tabs { + position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ + padding: .2em; +} +.ui-tabs .ui-tabs-nav { + margin: 0; + padding: .2em .2em 0; +} +.ui-tabs .ui-tabs-nav li { + list-style: none; + float: left; + position: relative; + top: 0; + margin: 1px .2em 0 0; + border-bottom-width: 0; + padding: 0; + white-space: nowrap; +} +.ui-tabs .ui-tabs-nav .ui-tabs-anchor { + float: left; + padding: .5em 1em; + text-decoration: none; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active { + margin-bottom: -1px; + padding-bottom: 1px; +} +.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, +.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { + cursor: text; +} +.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { + cursor: pointer; +} +.ui-tabs .ui-tabs-panel { + display: block; + border-width: 0; + padding: 1em 1.4em; + background: none; +} +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; + -webkit-box-shadow: 0 0 5px #aaa; + box-shadow: 0 0 5px #aaa; +} +body .ui-tooltip { + border-width: 2px; +} + +/* Component containers +----------------------------------*/ +.ui-widget { + font-family: Verdana,Arial,sans-serif; + font-size: 1.1em; +} +.ui-widget .ui-widget { + font-size: 1em; +} +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family: Verdana,Arial,sans-serif; + font-size: 1em; +} +.ui-widget-content { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x; + color: #222222; +} +.ui-widget-content a { + color: #222222; +} +.ui-widget-header { + border: 1px solid #aaaaaa; + background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x; + color: #222222; + font-weight: bold; +} +.ui-widget-header a { + color: #222222; +} + +/* Interaction states +----------------------------------*/ +.ui-state-default, +.ui-widget-content .ui-state-default, +.ui-widget-header .ui-state-default { + border: 1px solid #d3d3d3; + background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #555555; +} +.ui-state-default a, +.ui-state-default a:link, +.ui-state-default a:visited { + color: #555555; + text-decoration: none; +} +.ui-state-hover, +.ui-widget-content .ui-state-hover, +.ui-widget-header .ui-state-hover, +.ui-state-focus, +.ui-widget-content .ui-state-focus, +.ui-widget-header .ui-state-focus { + border: 1px solid #999999; + background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-hover a, +.ui-state-hover a:hover, +.ui-state-hover a:link, +.ui-state-hover a:visited, +.ui-state-focus a, +.ui-state-focus a:hover, +.ui-state-focus a:link, +.ui-state-focus a:visited { + color: #212121; + text-decoration: none; +} +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-active a, +.ui-state-active a:link, +.ui-state-active a:visited { + color: #212121; + text-decoration: none; +} + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, +.ui-widget-content .ui-state-highlight, +.ui-widget-header .ui-state-highlight { + border: 1px solid #fcefa1; + background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x; + color: #363636; +} +.ui-state-highlight a, +.ui-widget-content .ui-state-highlight a, +.ui-widget-header .ui-state-highlight a { + color: #363636; +} +.ui-state-error, +.ui-widget-content .ui-state-error, +.ui-widget-header .ui-state-error { + border: 1px solid #cd0a0a; + background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x; + color: #cd0a0a; +} +.ui-state-error a, +.ui-widget-content .ui-state-error a, +.ui-widget-header .ui-state-error a { + color: #cd0a0a; +} +.ui-state-error-text, +.ui-widget-content .ui-state-error-text, +.ui-widget-header .ui-state-error-text { + color: #cd0a0a; +} +.ui-priority-primary, +.ui-widget-content .ui-priority-primary, +.ui-widget-header .ui-priority-primary { + font-weight: bold; +} +.ui-priority-secondary, +.ui-widget-content .ui-priority-secondary, +.ui-widget-header .ui-priority-secondary { + opacity: .7; + filter:Alpha(Opacity=70); /* support: IE8 */ + font-weight: normal; +} +.ui-state-disabled, +.ui-widget-content .ui-state-disabled, +.ui-widget-header .ui-state-disabled { + opacity: .35; + filter:Alpha(Opacity=35); /* support: IE8 */ + background-image: none; +} +.ui-state-disabled .ui-icon { + filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ +} + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + width: 16px; + height: 16px; +} +.ui-icon, +.ui-widget-content .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-widget-header .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-state-default .ui-icon { + background-image: url("images/ui-icons_888888_256x240.png"); +} +.ui-state-hover .ui-icon, +.ui-state-focus .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-active .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-highlight .ui-icon { + background-image: url("images/ui-icons_2e83ff_256x240.png"); +} +.ui-state-error .ui-icon, +.ui-state-error-text .ui-icon { + background-image: url("images/ui-icons_cd0a0a_256x240.png"); +} + +/* positioning */ +.ui-icon-blank { background-position: 16px 16px; } +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-on { background-position: -96px -144px; } +.ui-icon-radio-off { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, +.ui-corner-top, +.ui-corner-left, +.ui-corner-tl { + border-top-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-top, +.ui-corner-right, +.ui-corner-tr { + border-top-right-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-left, +.ui-corner-bl { + border-bottom-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-right, +.ui-corner-br { + border-bottom-right-radius: 4px; +} + +/* Overlays */ +.ui-widget-overlay { + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ +} +.ui-widget-shadow { + margin: -8px 0 0 -8px; + padding: 8px; + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ + border-radius: 8px; +} diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css new file mode 100644 index 0000000..f2903ea --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css @@ -0,0 +1,7 @@ +/*! jQuery UI - v1.11.4 - 2015-03-11 +* http://jqueryui.com +* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px +* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ + +.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_888888_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cd0a0a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px} \ No newline at end of file diff --git a/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/theme.css b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/theme.css new file mode 100755 index 0000000..47cb233 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/js/jquery-ui/themes/smoothness/theme.css @@ -0,0 +1,410 @@ +/*! + * jQuery UI CSS Framework 1.11.4 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/category/theming/ + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { + font-family: Verdana,Arial,sans-serif; + font-size: 1.1em; +} +.ui-widget .ui-widget { + font-size: 1em; +} +.ui-widget input, +.ui-widget select, +.ui-widget textarea, +.ui-widget button { + font-family: Verdana,Arial,sans-serif; + font-size: 1em; +} +.ui-widget-content { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x; + color: #222222; +} +.ui-widget-content a { + color: #222222; +} +.ui-widget-header { + border: 1px solid #aaaaaa; + background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x; + color: #222222; + font-weight: bold; +} +.ui-widget-header a { + color: #222222; +} + +/* Interaction states +----------------------------------*/ +.ui-state-default, +.ui-widget-content .ui-state-default, +.ui-widget-header .ui-state-default { + border: 1px solid #d3d3d3; + background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #555555; +} +.ui-state-default a, +.ui-state-default a:link, +.ui-state-default a:visited { + color: #555555; + text-decoration: none; +} +.ui-state-hover, +.ui-widget-content .ui-state-hover, +.ui-widget-header .ui-state-hover, +.ui-state-focus, +.ui-widget-content .ui-state-focus, +.ui-widget-header .ui-state-focus { + border: 1px solid #999999; + background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-hover a, +.ui-state-hover a:hover, +.ui-state-hover a:link, +.ui-state-hover a:visited, +.ui-state-focus a, +.ui-state-focus a:hover, +.ui-state-focus a:link, +.ui-state-focus a:visited { + color: #212121; + text-decoration: none; +} +.ui-state-active, +.ui-widget-content .ui-state-active, +.ui-widget-header .ui-state-active { + border: 1px solid #aaaaaa; + background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x; + font-weight: normal; + color: #212121; +} +.ui-state-active a, +.ui-state-active a:link, +.ui-state-active a:visited { + color: #212121; + text-decoration: none; +} + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, +.ui-widget-content .ui-state-highlight, +.ui-widget-header .ui-state-highlight { + border: 1px solid #fcefa1; + background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x; + color: #363636; +} +.ui-state-highlight a, +.ui-widget-content .ui-state-highlight a, +.ui-widget-header .ui-state-highlight a { + color: #363636; +} +.ui-state-error, +.ui-widget-content .ui-state-error, +.ui-widget-header .ui-state-error { + border: 1px solid #cd0a0a; + background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x; + color: #cd0a0a; +} +.ui-state-error a, +.ui-widget-content .ui-state-error a, +.ui-widget-header .ui-state-error a { + color: #cd0a0a; +} +.ui-state-error-text, +.ui-widget-content .ui-state-error-text, +.ui-widget-header .ui-state-error-text { + color: #cd0a0a; +} +.ui-priority-primary, +.ui-widget-content .ui-priority-primary, +.ui-widget-header .ui-priority-primary { + font-weight: bold; +} +.ui-priority-secondary, +.ui-widget-content .ui-priority-secondary, +.ui-widget-header .ui-priority-secondary { + opacity: .7; + filter:Alpha(Opacity=70); /* support: IE8 */ + font-weight: normal; +} +.ui-state-disabled, +.ui-widget-content .ui-state-disabled, +.ui-widget-header .ui-state-disabled { + opacity: .35; + filter:Alpha(Opacity=35); /* support: IE8 */ + background-image: none; +} +.ui-state-disabled .ui-icon { + filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */ +} + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { + width: 16px; + height: 16px; +} +.ui-icon, +.ui-widget-content .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-widget-header .ui-icon { + background-image: url("images/ui-icons_222222_256x240.png"); +} +.ui-state-default .ui-icon { + background-image: url("images/ui-icons_888888_256x240.png"); +} +.ui-state-hover .ui-icon, +.ui-state-focus .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-active .ui-icon { + background-image: url("images/ui-icons_454545_256x240.png"); +} +.ui-state-highlight .ui-icon { + background-image: url("images/ui-icons_2e83ff_256x240.png"); +} +.ui-state-error .ui-icon, +.ui-state-error-text .ui-icon { + background-image: url("images/ui-icons_cd0a0a_256x240.png"); +} + +/* positioning */ +.ui-icon-blank { background-position: 16px 16px; } +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-on { background-position: -96px -144px; } +.ui-icon-radio-off { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, +.ui-corner-top, +.ui-corner-left, +.ui-corner-tl { + border-top-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-top, +.ui-corner-right, +.ui-corner-tr { + border-top-right-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-left, +.ui-corner-bl { + border-bottom-left-radius: 4px; +} +.ui-corner-all, +.ui-corner-bottom, +.ui-corner-right, +.ui-corner-br { + border-bottom-right-radius: 4px; +} + +/* Overlays */ +.ui-widget-overlay { + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ +} +.ui-widget-shadow { + margin: -8px 0 0 -8px; + padding: 8px; + background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x; + opacity: .3; + filter: Alpha(Opacity=30); /* support: IE8 */ + border-radius: 8px; +} diff --git a/wp-content/plugins/contact-form-7/includes/js/scripts.js b/wp-content/plugins/contact-form-7/includes/js/scripts.js new file mode 100644 index 0000000..f8faddd --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/js/scripts.js @@ -0,0 +1,526 @@ +( function( $ ) { + + 'use strict'; + + if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) { + return; + } + + wpcf7 = $.extend( { + cached: 0, + inputs: [] + }, wpcf7 ); + + $( function() { + wpcf7.supportHtml5 = ( function() { + var features = {}; + var input = document.createElement( 'input' ); + + features.placeholder = 'placeholder' in input; + + var inputTypes = [ 'email', 'url', 'tel', 'number', 'range', 'date' ]; + + $.each( inputTypes, function( index, value ) { + input.setAttribute( 'type', value ); + features[ value ] = input.type !== 'text'; + } ); + + return features; + } )(); + + $( 'div.wpcf7 > form' ).each( function() { + var $form = $( this ); + wpcf7.initForm( $form ); + + if ( wpcf7.cached ) { + wpcf7.refill( $form ); + } + } ); + } ); + + wpcf7.getId = function( form ) { + return parseInt( $( 'input[name="_wpcf7"]', form ).val(), 10 ); + }; + + wpcf7.initForm = function( form ) { + var $form = $( form ); + + $form.submit( function( event ) { + if ( ! wpcf7.supportHtml5.placeholder ) { + $( '[placeholder].placeheld', $form ).each( function( i, n ) { + $( n ).val( '' ).removeClass( 'placeheld' ); + } ); + } + + if ( typeof window.FormData === 'function' ) { + wpcf7.submit( $form ); + event.preventDefault(); + } + } ); + + $( '.wpcf7-submit', $form ).after( '' ); + + wpcf7.toggleSubmit( $form ); + + $form.on( 'click', '.wpcf7-acceptance', function() { + wpcf7.toggleSubmit( $form ); + } ); + + // Exclusive Checkbox + $( '.wpcf7-exclusive-checkbox', $form ).on( 'click', 'input:checkbox', function() { + var name = $( this ).attr( 'name' ); + $form.find( 'input:checkbox[name="' + name + '"]' ).not( this ).prop( 'checked', false ); + } ); + + // Free Text Option for Checkboxes and Radio Buttons + $( '.wpcf7-list-item.has-free-text', $form ).each( function() { + var $freetext = $( ':input.wpcf7-free-text', this ); + var $wrap = $( this ).closest( '.wpcf7-form-control' ); + + if ( $( ':checkbox, :radio', this ).is( ':checked' ) ) { + $freetext.prop( 'disabled', false ); + } else { + $freetext.prop( 'disabled', true ); + } + + $wrap.on( 'change', ':checkbox, :radio', function() { + var $cb = $( '.has-free-text', $wrap ).find( ':checkbox, :radio' ); + + if ( $cb.is( ':checked' ) ) { + $freetext.prop( 'disabled', false ).focus(); + } else { + $freetext.prop( 'disabled', true ); + } + } ); + } ); + + // Placeholder Fallback + if ( ! wpcf7.supportHtml5.placeholder ) { + $( '[placeholder]', $form ).each( function() { + $( this ).val( $( this ).attr( 'placeholder' ) ); + $( this ).addClass( 'placeheld' ); + + $( this ).focus( function() { + if ( $( this ).hasClass( 'placeheld' ) ) { + $( this ).val( '' ).removeClass( 'placeheld' ); + } + } ); + + $( this ).blur( function() { + if ( '' === $( this ).val() ) { + $( this ).val( $( this ).attr( 'placeholder' ) ); + $( this ).addClass( 'placeheld' ); + } + } ); + } ); + } + + if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.date ) { + $form.find( 'input.wpcf7-date[type="date"]' ).each( function() { + $( this ).datepicker( { + dateFormat: 'yy-mm-dd', + minDate: new Date( $( this ).attr( 'min' ) ), + maxDate: new Date( $( this ).attr( 'max' ) ) + } ); + } ); + } + + if ( wpcf7.jqueryUi && ! wpcf7.supportHtml5.number ) { + $form.find( 'input.wpcf7-number[type="number"]' ).each( function() { + $( this ).spinner( { + min: $( this ).attr( 'min' ), + max: $( this ).attr( 'max' ), + step: $( this ).attr( 'step' ) + } ); + } ); + } + + // Character Count + $( '.wpcf7-character-count', $form ).each( function() { + var $count = $( this ); + var name = $count.attr( 'data-target-name' ); + var down = $count.hasClass( 'down' ); + var starting = parseInt( $count.attr( 'data-starting-value' ), 10 ); + var maximum = parseInt( $count.attr( 'data-maximum-value' ), 10 ); + var minimum = parseInt( $count.attr( 'data-minimum-value' ), 10 ); + + var updateCount = function( target ) { + var $target = $( target ); + var length = $target.val().length; + var count = down ? starting - length : length; + $count.attr( 'data-current-value', count ); + $count.text( count ); + + if ( maximum && maximum < length ) { + $count.addClass( 'too-long' ); + } else { + $count.removeClass( 'too-long' ); + } + + if ( minimum && length < minimum ) { + $count.addClass( 'too-short' ); + } else { + $count.removeClass( 'too-short' ); + } + }; + + $( ':input[name="' + name + '"]', $form ).each( function() { + updateCount( this ); + + $( this ).keyup( function() { + updateCount( this ); + } ); + } ); + } ); + + // URL Input Correction + $form.on( 'change', '.wpcf7-validates-as-url', function() { + var val = $.trim( $( this ).val() ); + + if ( val + && ! val.match( /^[a-z][a-z0-9.+-]*:/i ) + && -1 !== val.indexOf( '.' ) ) { + val = val.replace( /^\/+/, '' ); + val = 'http://' + val; + } + + $( this ).val( val ); + } ); + }; + + wpcf7.submit = function( form ) { + if ( typeof window.FormData !== 'function' ) { + return; + } + + var $form = $( form ); + + $( '.ajax-loader', $form ).addClass( 'is-active' ); + + wpcf7.clearResponse( $form ); + + var formData = new FormData( $form.get( 0 ) ); + + var detail = { + id: $form.closest( 'div.wpcf7' ).attr( 'id' ), + status: 'init', + inputs: [], + formData: formData + }; + + $.each( $form.serializeArray(), function( i, field ) { + if ( '_wpcf7' == field.name ) { + detail.contactFormId = field.value; + } else if ( '_wpcf7_version' == field.name ) { + detail.pluginVersion = field.value; + } else if ( '_wpcf7_locale' == field.name ) { + detail.contactFormLocale = field.value; + } else if ( '_wpcf7_unit_tag' == field.name ) { + detail.unitTag = field.value; + } else if ( '_wpcf7_container_post' == field.name ) { + detail.containerPostId = field.value; + } else if ( field.name.match( /^_wpcf7_\w+_free_text_/ ) ) { + var owner = field.name.replace( /^_wpcf7_\w+_free_text_/, '' ); + detail.inputs.push( { + name: owner + '-free-text', + value: field.value + } ); + } else if ( field.name.match( /^_/ ) ) { + // do nothing + } else { + detail.inputs.push( field ); + } + } ); + + wpcf7.triggerEvent( $form.closest( 'div.wpcf7' ), 'beforesubmit', detail ); + + var ajaxSuccess = function( data, status, xhr, $form ) { + detail.id = $( data.into ).attr( 'id' ); + detail.status = data.status; + detail.apiResponse = data; + + var $message = $( '.wpcf7-response-output', $form ); + + switch ( data.status ) { + case 'validation_failed': + $.each( data.invalidFields, function( i, n ) { + $( n.into, $form ).each( function() { + wpcf7.notValidTip( this, n.message ); + $( '.wpcf7-form-control', this ).addClass( 'wpcf7-not-valid' ); + $( '[aria-invalid]', this ).attr( 'aria-invalid', 'true' ); + } ); + } ); + + $message.addClass( 'wpcf7-validation-errors' ); + $form.addClass( 'invalid' ); + + wpcf7.triggerEvent( data.into, 'invalid', detail ); + break; + case 'acceptance_missing': + $message.addClass( 'wpcf7-acceptance-missing' ); + $form.addClass( 'unaccepted' ); + + wpcf7.triggerEvent( data.into, 'unaccepted', detail ); + break; + case 'spam': + $message.addClass( 'wpcf7-spam-blocked' ); + $form.addClass( 'spam' ); + + wpcf7.triggerEvent( data.into, 'spam', detail ); + break; + case 'aborted': + $message.addClass( 'wpcf7-aborted' ); + $form.addClass( 'aborted' ); + + wpcf7.triggerEvent( data.into, 'aborted', detail ); + break; + case 'mail_sent': + $message.addClass( 'wpcf7-mail-sent-ok' ); + $form.addClass( 'sent' ); + + wpcf7.triggerEvent( data.into, 'mailsent', detail ); + break; + case 'mail_failed': + $message.addClass( 'wpcf7-mail-sent-ng' ); + $form.addClass( 'failed' ); + + wpcf7.triggerEvent( data.into, 'mailfailed', detail ); + break; + default: + var customStatusClass = 'custom-' + + data.status.replace( /[^0-9a-z]+/i, '-' ); + $message.addClass( 'wpcf7-' + customStatusClass ); + $form.addClass( customStatusClass ); + } + + wpcf7.refill( $form, data ); + + wpcf7.triggerEvent( data.into, 'submit', detail ); + + if ( 'mail_sent' == data.status ) { + $form.each( function() { + this.reset(); + } ); + + wpcf7.toggleSubmit( $form ); + } + + if ( ! wpcf7.supportHtml5.placeholder ) { + $form.find( '[placeholder].placeheld' ).each( function( i, n ) { + $( n ).val( $( n ).attr( 'placeholder' ) ); + } ); + } + + $message.html( '' ).append( data.message ).slideDown( 'fast' ); + $message.attr( 'role', 'alert' ); + + $( '.screen-reader-response', $form.closest( '.wpcf7' ) ).each( function() { + var $response = $( this ); + $response.html( '' ).attr( 'role', '' ).append( data.message ); + + if ( data.invalidFields ) { + var $invalids = $( '
                      ' ); + + $.each( data.invalidFields, function( i, n ) { + if ( n.idref ) { + var $li = $( '
                    • ' ).append( $( '' ).attr( 'href', '#' + n.idref ).append( n.message ) ); + } else { + var $li = $( '
                    • ' ).append( n.message ); + } + + $invalids.append( $li ); + } ); + + $response.append( $invalids ); + } + + $response.attr( 'role', 'alert' ).focus(); + } ); + }; + + $.ajax( { + type: 'POST', + url: wpcf7.apiSettings.getRoute( + '/contact-forms/' + wpcf7.getId( $form ) + '/feedback' ), + data: formData, + dataType: 'json', + processData: false, + contentType: false + } ).done( function( data, status, xhr ) { + ajaxSuccess( data, status, xhr, $form ); + $( '.ajax-loader', $form ).removeClass( 'is-active' ); + } ).fail( function( xhr, status, error ) { + var $e = $( '
                      ' ).text( error.message ); + $form.after( $e ); + } ); + }; + + wpcf7.triggerEvent = function( target, name, detail ) { + var $target = $( target ); + + /* DOM event */ + var event = new CustomEvent( 'wpcf7' + name, { + bubbles: true, + detail: detail + } ); + + $target.get( 0 ).dispatchEvent( event ); + + /* jQuery event */ + $target.trigger( 'wpcf7:' + name, detail ); + $target.trigger( name + '.wpcf7', detail ); // deprecated + }; + + wpcf7.toggleSubmit = function( form, state ) { + var $form = $( form ); + var $submit = $( 'input:submit', $form ); + + if ( typeof state !== 'undefined' ) { + $submit.prop( 'disabled', ! state ); + return; + } + + if ( $form.hasClass( 'wpcf7-acceptance-as-validation' ) ) { + return; + } + + $submit.prop( 'disabled', false ); + + $( '.wpcf7-acceptance', $form ).each( function() { + var $span = $( this ); + var $input = $( 'input:checkbox', $span ); + + if ( ! $span.hasClass( 'optional' ) ) { + if ( $span.hasClass( 'invert' ) && $input.is( ':checked' ) + || ! $span.hasClass( 'invert' ) && ! $input.is( ':checked' ) ) { + $submit.prop( 'disabled', true ); + return false; + } + } + } ); + }; + + wpcf7.notValidTip = function( target, message ) { + var $target = $( target ); + $( '.wpcf7-not-valid-tip', $target ).remove(); + $( '' ) + .text( message ).appendTo( $target ); + + if ( $target.is( '.use-floating-validation-tip *' ) ) { + var fadeOut = function( target ) { + $( target ).not( ':hidden' ).animate( { + opacity: 0 + }, 'fast', function() { + $( this ).css( { 'z-index': -100 } ); + } ); + }; + + $target.on( 'mouseover', '.wpcf7-not-valid-tip', function() { + fadeOut( this ); + } ); + + $target.on( 'focus', ':input', function() { + fadeOut( $( '.wpcf7-not-valid-tip', $target ) ); + } ); + } + }; + + wpcf7.refill = function( form, data ) { + var $form = $( form ); + + var refillCaptcha = function( $form, items ) { + $.each( items, function( i, n ) { + $form.find( ':input[name="' + i + '"]' ).val( '' ); + $form.find( 'img.wpcf7-captcha-' + i ).attr( 'src', n ); + var match = /([0-9]+)\.(png|gif|jpeg)$/.exec( n ); + $form.find( 'input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]' ).attr( 'value', match[ 1 ] ); + } ); + }; + + var refillQuiz = function( $form, items ) { + $.each( items, function( i, n ) { + $form.find( ':input[name="' + i + '"]' ).val( '' ); + $form.find( ':input[name="' + i + '"]' ).siblings( 'span.wpcf7-quiz-label' ).text( n[ 0 ] ); + $form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[ 1 ] ); + } ); + }; + + if ( typeof data === 'undefined' ) { + $.ajax( { + type: 'GET', + url: wpcf7.apiSettings.getRoute( + '/contact-forms/' + wpcf7.getId( $form ) + '/refill' ), + beforeSend: function( xhr ) { + var nonce = $form.find( ':input[name="_wpnonce"]' ).val(); + + if ( nonce ) { + xhr.setRequestHeader( 'X-WP-Nonce', nonce ); + } + }, + dataType: 'json' + } ).done( function( data, status, xhr ) { + if ( data.captcha ) { + refillCaptcha( $form, data.captcha ); + } + + if ( data.quiz ) { + refillQuiz( $form, data.quiz ); + } + } ); + + } else { + if ( data.captcha ) { + refillCaptcha( $form, data.captcha ); + } + + if ( data.quiz ) { + refillQuiz( $form, data.quiz ); + } + } + }; + + wpcf7.clearResponse = function( form ) { + var $form = $( form ); + $form.removeClass( 'invalid spam sent failed' ); + $form.siblings( '.screen-reader-response' ).html( '' ).attr( 'role', '' ); + + $( '.wpcf7-not-valid-tip', $form ).remove(); + $( '[aria-invalid]', $form ).attr( 'aria-invalid', 'false' ); + $( '.wpcf7-form-control', $form ).removeClass( 'wpcf7-not-valid' ); + + $( '.wpcf7-response-output', $form ) + .hide().empty().removeAttr( 'role' ) + .removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked' ); + }; + + wpcf7.apiSettings.getRoute = function( path ) { + var url = wpcf7.apiSettings.root; + + url = url.replace( + wpcf7.apiSettings.namespace, + wpcf7.apiSettings.namespace + path ); + + return url; + }; + +} )( jQuery ); + +/* + * Polyfill for Internet Explorer + * See https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent + */ +( function () { + if ( typeof window.CustomEvent === "function" ) return false; + + function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, + params.bubbles, params.cancelable, params.detail ); + return evt; + } + + CustomEvent.prototype = window.Event.prototype; + + window.CustomEvent = CustomEvent; +} )(); diff --git a/wp-content/plugins/contact-form-7/includes/l10n.php b/wp-content/plugins/contact-form-7/includes/l10n.php new file mode 100644 index 0000000..5026ef0 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/l10n.php @@ -0,0 +1,98 @@ + 'contact-form-7', + 'version' => WPCF7_VERSION, + ) ); + + if ( is_wp_error( $api ) + or empty( $api['translations'] ) ) { + return $l10n; + } + + foreach ( (array) $api['translations'] as $translation ) { + if ( ! empty( $translation['language'] ) + and ! empty( $translation['english_name'] ) ) { + $l10n[$translation['language']] = $translation['english_name']; + } + } + + return $l10n; +} + +function wpcf7_is_valid_locale( $locale ) { + $pattern = '/^[a-z]{2,3}(?:_[a-zA-Z_]{2,})?$/'; + return (bool) preg_match( $pattern, $locale ); +} + +function wpcf7_is_rtl( $locale = '' ) { + static $rtl_locales = array( + 'ar' => 'Arabic', + 'ary' => 'Moroccan Arabic', + 'azb' => 'South Azerbaijani', + 'fa_IR' => 'Persian', + 'haz' => 'Hazaragi', + 'he_IL' => 'Hebrew', + 'ps' => 'Pashto', + 'ug_CN' => 'Uighur', + ); + + if ( empty( $locale ) + and function_exists( 'is_rtl' ) ) { + return is_rtl(); + } + + if ( empty( $locale ) ) { + $locale = get_locale(); + } + + return isset( $rtl_locales[$locale] ); +} + +function wpcf7_load_textdomain( $locale = null ) { + global $l10n; + + $domain = 'contact-form-7'; + + if ( ( is_admin() ? get_user_locale() : get_locale() ) === $locale ) { + $locale = null; + } + + if ( empty( $locale ) ) { + if ( is_textdomain_loaded( $domain ) ) { + return true; + } else { + return load_plugin_textdomain( $domain, false, $domain . '/languages' ); + } + } else { + $mo_orig = $l10n[$domain]; + unload_textdomain( $domain ); + + $mofile = $domain . '-' . $locale . '.mo'; + $path = WP_PLUGIN_DIR . '/' . $domain . '/languages'; + + if ( $loaded = load_textdomain( $domain, $path . '/'. $mofile ) ) { + return $loaded; + } else { + $mofile = WP_LANG_DIR . '/plugins/' . $mofile; + return load_textdomain( $domain, $mofile ); + } + + $l10n[$domain] = $mo_orig; + } + + return false; +} diff --git a/wp-content/plugins/contact-form-7/includes/mail.php b/wp-content/plugins/contact-form-7/includes/mail.php new file mode 100644 index 0000000..0d9f01c --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/mail.php @@ -0,0 +1,448 @@ +compose(); + } + + private function __construct( $name, $template ) { + $this->name = trim( $name ); + $this->use_html = ! empty( $template['use_html'] ); + $this->exclude_blank = ! empty( $template['exclude_blank'] ); + + $this->template = wp_parse_args( $template, array( + 'subject' => '', + 'sender' => '', + 'body' => '', + 'recipient' => '', + 'additional_headers' => '', + 'attachments' => '', + ) ); + + if ( $submission = WPCF7_Submission::get_instance() ) { + $contact_form = $submission->get_contact_form(); + $this->locale = $contact_form->locale(); + } + } + + public function name() { + return $this->name; + } + + public function get( $component, $replace_tags = false ) { + $use_html = ( $this->use_html && 'body' == $component ); + $exclude_blank = ( $this->exclude_blank && 'body' == $component ); + + $template = $this->template; + $component = isset( $template[$component] ) ? $template[$component] : ''; + + if ( $replace_tags ) { + $component = $this->replace_tags( $component, array( + 'html' => $use_html, + 'exclude_blank' => $exclude_blank, + ) ); + + if ( $use_html + and ! preg_match( '%\s].*%is', $component ) ) { + $component = $this->htmlize( $component ); + } + } + + return $component; + } + + private function htmlize( $body ) { + if ( $this->locale ) { + $lang_atts = sprintf( ' %s', + wpcf7_format_atts( array( + 'dir' => wpcf7_is_rtl( $this->locale ) ? 'rtl' : 'ltr', + 'lang' => str_replace( '_', '-', $this->locale ), + ) ) + ); + } else { + $lang_atts = ''; + } + + $header = apply_filters( 'wpcf7_mail_html_header', + ' + + +' . esc_html( $this->get( 'subject', true ) ) . ' + + +', $this ); + + $footer = apply_filters( 'wpcf7_mail_html_footer', + ' +', $this ); + + $html = $header . wpautop( $body ) . $footer; + return $html; + } + + private function compose( $send = true ) { + $components = array( + 'subject' => $this->get( 'subject', true ), + 'sender' => $this->get( 'sender', true ), + 'body' => $this->get( 'body', true ), + 'recipient' => $this->get( 'recipient', true ), + 'additional_headers' => $this->get( 'additional_headers', true ), + 'attachments' => $this->attachments(), + ); + + $components = apply_filters( 'wpcf7_mail_components', + $components, wpcf7_get_current_contact_form(), $this ); + + if ( ! $send ) { + return $components; + } + + $subject = wpcf7_strip_newline( $components['subject'] ); + $sender = wpcf7_strip_newline( $components['sender'] ); + $recipient = wpcf7_strip_newline( $components['recipient'] ); + $body = $components['body']; + $additional_headers = trim( $components['additional_headers'] ); + $attachments = $components['attachments']; + + $headers = "From: $sender\n"; + + if ( $this->use_html ) { + $headers .= "Content-Type: text/html\n"; + $headers .= "X-WPCF7-Content-Type: text/html\n"; + } else { + $headers .= "X-WPCF7-Content-Type: text/plain\n"; + } + + if ( $additional_headers ) { + $headers .= $additional_headers . "\n"; + } + + return wp_mail( $recipient, $subject, $body, $headers, $attachments ); + } + + public function replace_tags( $content, $args = '' ) { + if ( true === $args ) { + $args = array( 'html' => true ); + } + + $args = wp_parse_args( $args, array( + 'html' => false, + 'exclude_blank' => false, + ) ); + + return wpcf7_mail_replace_tags( $content, $args ); + } + + private function attachments( $template = null ) { + if ( ! $template ) { + $template = $this->get( 'attachments' ); + } + + $attachments = array(); + + if ( $submission = WPCF7_Submission::get_instance() ) { + $uploaded_files = $submission->uploaded_files(); + + foreach ( (array) $uploaded_files as $name => $path ) { + if ( false !== strpos( $template, "[${name}]" ) + and ! empty( $path ) ) { + $attachments[] = $path; + } + } + } + + foreach ( explode( "\n", $template ) as $line ) { + $line = trim( $line ); + + if ( '[' == substr( $line, 0, 1 ) ) { + continue; + } + + $path = path_join( WP_CONTENT_DIR, $line ); + + if ( ! wpcf7_is_file_path_in_content_dir( $path ) ) { + // $path is out of WP_CONTENT_DIR + continue; + } + + if ( is_readable( $path ) + and is_file( $path ) ) { + $attachments[] = $path; + } + } + + return $attachments; + } +} + +function wpcf7_mail_replace_tags( $content, $args = '' ) { + $args = wp_parse_args( $args, array( + 'html' => false, + 'exclude_blank' => false, + ) ); + + if ( is_array( $content ) ) { + foreach ( $content as $key => $value ) { + $content[$key] = wpcf7_mail_replace_tags( $value, $args ); + } + + return $content; + } + + $content = explode( "\n", $content ); + + foreach ( $content as $num => $line ) { + $line = new WPCF7_MailTaggedText( $line, $args ); + $replaced = $line->replace_tags(); + + if ( $args['exclude_blank'] ) { + $replaced_tags = $line->get_replaced_tags(); + + if ( empty( $replaced_tags ) + or array_filter( $replaced_tags, 'strlen' ) ) { + $content[$num] = $replaced; + } else { + unset( $content[$num] ); // Remove a line. + } + } else { + $content[$num] = $replaced; + } + } + + $content = implode( "\n", $content ); + + return $content; +} + +add_action( 'phpmailer_init', 'wpcf7_phpmailer_init', 10, 1 ); + +function wpcf7_phpmailer_init( $phpmailer ) { + $custom_headers = $phpmailer->getCustomHeaders(); + $phpmailer->clearCustomHeaders(); + $wpcf7_content_type = false; + + foreach ( (array) $custom_headers as $custom_header ) { + $name = $custom_header[0]; + $value = $custom_header[1]; + + if ( 'X-WPCF7-Content-Type' === $name ) { + $wpcf7_content_type = trim( $value ); + } else { + $phpmailer->addCustomHeader( $name, $value ); + } + } + + if ( 'text/html' === $wpcf7_content_type ) { + $phpmailer->msgHTML( $phpmailer->Body ); + } elseif ( 'text/plain' === $wpcf7_content_type ) { + $phpmailer->AltBody = ''; + } +} + +class WPCF7_MailTaggedText { + + private $html = false; + private $callback = null; + private $content = ''; + private $replaced_tags = array(); + + public function __construct( $content, $args = '' ) { + $args = wp_parse_args( $args, array( + 'html' => false, + 'callback' => null, + ) ); + + $this->html = (bool) $args['html']; + + if ( null !== $args['callback'] + and is_callable( $args['callback'] ) ) { + $this->callback = $args['callback']; + } elseif ( $this->html ) { + $this->callback = array( $this, 'replace_tags_callback_html' ); + } else { + $this->callback = array( $this, 'replace_tags_callback' ); + } + + $this->content = $content; + } + + public function get_replaced_tags() { + return $this->replaced_tags; + } + + public function replace_tags() { + $regex = '/(\[?)\[[\t ]*' + . '([a-zA-Z_][0-9a-zA-Z:._-]*)' // [2] = name + . '((?:[\t ]+"[^"]*"|[\t ]+\'[^\']*\')*)' // [3] = values + . '[\t ]*\](\]?)/'; + + return preg_replace_callback( $regex, $this->callback, $this->content ); + } + + private function replace_tags_callback_html( $matches ) { + return $this->replace_tags_callback( $matches, true ); + } + + private function replace_tags_callback( $matches, $html = false ) { + // allow [[foo]] syntax for escaping a tag + if ( $matches[1] == '[' + and $matches[4] == ']' ) { + return substr( $matches[0], 1, -1 ); + } + + $tag = $matches[0]; + $tagname = $matches[2]; + $values = $matches[3]; + + $mail_tag = new WPCF7_MailTag( $tag, $tagname, $values ); + $field_name = $mail_tag->field_name(); + + $submission = WPCF7_Submission::get_instance(); + $submitted = $submission + ? $submission->get_posted_data( $field_name ) + : null; + + if ( null !== $submitted ) { + + if ( $mail_tag->get_option( 'do_not_heat' ) ) { + $submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : ''; + } + + $replaced = $submitted; + + if ( $format = $mail_tag->get_option( 'format' ) ) { + $replaced = $this->format( $replaced, $format ); + } + + $replaced = wpcf7_flat_join( $replaced ); + + if ( $html ) { + $replaced = esc_html( $replaced ); + $replaced = wptexturize( $replaced ); + } + + if ( $form_tag = $mail_tag->corresponding_form_tag() ) { + $type = $form_tag->type; + + $replaced = apply_filters( + "wpcf7_mail_tag_replaced_{$type}", $replaced, + $submitted, $html, $mail_tag ); + } + + $replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced, + $submitted, $html, $mail_tag ); + + $replaced = wp_unslash( trim( $replaced ) ); + + $this->replaced_tags[$tag] = $replaced; + return $replaced; + } + + $special = apply_filters( 'wpcf7_special_mail_tags', null, + $mail_tag->tag_name(), $html, $mail_tag ); + + if ( null !== $special ) { + $this->replaced_tags[$tag] = $special; + return $special; + } + + return $tag; + } + + public function format( $original, $format ) { + $original = (array) $original; + + foreach ( $original as $key => $value ) { + if ( preg_match( '/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value ) ) { + $original[$key] = mysql2date( $format, $value ); + } + } + + return $original; + } +} + +class WPCF7_MailTag { + + private $tag; + private $tagname = ''; + private $name = ''; + private $options = array(); + private $values = array(); + private $form_tag = null; + + public function __construct( $tag, $tagname, $values ) { + $this->tag = $tag; + $this->name = $this->tagname = $tagname; + + $this->options = array( + 'do_not_heat' => false, + 'format' => '', + ); + + if ( ! empty( $values ) ) { + preg_match_all( '/"[^"]*"|\'[^\']*\'/', $values, $matches ); + $this->values = wpcf7_strip_quote_deep( $matches[0] ); + } + + if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) { + $this->name = trim( $matches[1] ); + $this->options['do_not_heat'] = true; + } + + if ( preg_match( '/^_format_(.+)$/', $tagname, $matches ) ) { + $this->name = trim( $matches[1] ); + $this->options['format'] = $this->values[0]; + } + } + + public function tag_name() { + return $this->tagname; + } + + public function field_name() { + return $this->name; + } + + public function get_option( $option ) { + return $this->options[$option]; + } + + public function values() { + return $this->values; + } + + public function corresponding_form_tag() { + if ( $this->form_tag instanceof WPCF7_FormTag ) { + return $this->form_tag; + } + + if ( $submission = WPCF7_Submission::get_instance() ) { + $contact_form = $submission->get_contact_form(); + $tags = $contact_form->scan_form_tags( array( + 'name' => $this->name, + 'feature' => '! zero-controls-container', + ) ); + + if ( $tags ) { + $this->form_tag = $tags[0]; + } + } + + return $this->form_tag; + } +} diff --git a/wp-content/plugins/contact-form-7/includes/pipe.php b/wp-content/plugins/contact-form-7/includes/pipe.php new file mode 100644 index 0000000..96eff54 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/pipe.php @@ -0,0 +1,78 @@ +before = $this->after = trim( $text ); + } else { + $this->before = trim( substr( $text, 0, $pipe_pos ) ); + $this->after = trim( substr( $text, $pipe_pos + 1 ) ); + } + } +} + +class WPCF7_Pipes { + + private $pipes = array(); + + public function __construct( array $texts ) { + foreach ( $texts as $text ) { + $this->add_pipe( $text ); + } + } + + private function add_pipe( $text ) { + $pipe = new WPCF7_Pipe( $text ); + $this->pipes[] = $pipe; + } + + public function do_pipe( $before ) { + foreach ( $this->pipes as $pipe ) { + if ( $pipe->before == $before ) { + return $pipe->after; + } + } + + return $before; + } + + public function collect_befores() { + $befores = array(); + + foreach ( $this->pipes as $pipe ) { + $befores[] = $pipe->before; + } + + return $befores; + } + + public function collect_afters() { + $afters = array(); + + foreach ( $this->pipes as $pipe ) { + $afters[] = $pipe->after; + } + + return $afters; + } + + public function zero() { + return empty( $this->pipes ); + } + + public function random_pipe() { + if ( $this->zero() ) { + return null; + } + + return $this->pipes[array_rand( $this->pipes )]; + } +} diff --git a/wp-content/plugins/contact-form-7/includes/rest-api.php b/wp-content/plugins/contact-form-7/includes/rest-api.php new file mode 100644 index 0000000..59da477 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/rest-api.php @@ -0,0 +1,323 @@ + WP_REST_Server::READABLE, + 'callback' => 'wpcf7_rest_get_contact_forms', + ), + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => 'wpcf7_rest_create_contact_form', + ), + ) + ); + + register_rest_route( $namespace, + '/contact-forms/(?P\d+)', + array( + array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => 'wpcf7_rest_get_contact_form', + ), + array( + 'methods' => WP_REST_Server::EDITABLE, + 'callback' => 'wpcf7_rest_update_contact_form', + ), + array( + 'methods' => WP_REST_Server::DELETABLE, + 'callback' => 'wpcf7_rest_delete_contact_form', + ), + ) + ); + + register_rest_route( $namespace, + '/contact-forms/(?P\d+)/feedback', + array( + array( + 'methods' => WP_REST_Server::CREATABLE, + 'callback' => 'wpcf7_rest_create_feedback', + ), + ) + ); + + register_rest_route( $namespace, + '/contact-forms/(?P\d+)/refill', + array( + array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => 'wpcf7_rest_get_refill', + ), + ) + ); +} + +function wpcf7_rest_get_contact_forms( WP_REST_Request $request ) { + if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) { + return new WP_Error( 'wpcf7_forbidden', + __( "You are not allowed to access contact forms.", 'contact-form-7' ), + array( 'status' => 403 ) ); + } + + $args = array(); + + $per_page = $request->get_param( 'per_page' ); + + if ( null !== $per_page ) { + $args['posts_per_page'] = (int) $per_page; + } + + $offset = $request->get_param( 'offset' ); + + if ( null !== $offset ) { + $args['offset'] = (int) $offset; + } + + $order = $request->get_param( 'order' ); + + if ( null !== $order ) { + $args['order'] = (string) $order; + } + + $orderby = $request->get_param( 'orderby' ); + + if ( null !== $orderby ) { + $args['orderby'] = (string) $orderby; + } + + $search = $request->get_param( 'search' ); + + if ( null !== $search ) { + $args['s'] = (string) $search; + } + + $items = WPCF7_ContactForm::find( $args ); + + $response = array(); + + foreach ( $items as $item ) { + $response[] = array( + 'id' => $item->id(), + 'slug' => $item->name(), + 'title' => $item->title(), + 'locale' => $item->locale(), + ); + } + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_create_contact_form( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + + if ( $id ) { + return new WP_Error( 'wpcf7_post_exists', + __( "Cannot create existing contact form.", 'contact-form-7' ), + array( 'status' => 400 ) ); + } + + if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { + return new WP_Error( 'wpcf7_forbidden', + __( "You are not allowed to create a contact form.", 'contact-form-7' ), + array( 'status' => 403 ) ); + } + + $args = $request->get_params(); + $args['id'] = -1; // Create + $context = $request->get_param( 'context' ); + $item = wpcf7_save_contact_form( $args, $context ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_cannot_save', + __( "There was an error saving the contact form.", 'contact-form-7' ), + array( 'status' => 500 ) ); + } + + $response = array( + 'id' => $item->id(), + 'slug' => $item->name(), + 'title' => $item->title(), + 'locale' => $item->locale(), + 'properties' => $item->get_properties(), + 'config_errors' => array(), + ); + + if ( wpcf7_validate_configuration() ) { + $config_validator = new WPCF7_ConfigValidator( $item ); + $config_validator->validate(); + + $response['config_errors'] = $config_validator->collect_error_messages(); + + if ( 'save' == $context ) { + $config_validator->save(); + } + } + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_get_contact_form( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + $item = wpcf7_contact_form( $id ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_not_found', + __( "The requested contact form was not found.", 'contact-form-7' ), + array( 'status' => 404 ) ); + } + + if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { + return new WP_Error( 'wpcf7_forbidden', + __( "You are not allowed to access the requested contact form.", 'contact-form-7' ), + array( 'status' => 403 ) ); + } + + $response = array( + 'id' => $item->id(), + 'slug' => $item->name(), + 'title' => $item->title(), + 'locale' => $item->locale(), + 'properties' => $item->get_properties(), + ); + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_update_contact_form( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + $item = wpcf7_contact_form( $id ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_not_found', + __( "The requested contact form was not found.", 'contact-form-7' ), + array( 'status' => 404 ) ); + } + + if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { + return new WP_Error( 'wpcf7_forbidden', + __( "You are not allowed to access the requested contact form.", 'contact-form-7' ), + array( 'status' => 403 ) ); + } + + $args = $request->get_params(); + $context = $request->get_param( 'context' ); + $item = wpcf7_save_contact_form( $args, $context ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_cannot_save', + __( "There was an error saving the contact form.", 'contact-form-7' ), + array( 'status' => 500 ) ); + } + + $response = array( + 'id' => $item->id(), + 'slug' => $item->name(), + 'title' => $item->title(), + 'locale' => $item->locale(), + 'properties' => $item->get_properties(), + 'config_errors' => array(), + ); + + if ( wpcf7_validate_configuration() ) { + $config_validator = new WPCF7_ConfigValidator( $item ); + $config_validator->validate(); + + $response['config_errors'] = $config_validator->collect_error_messages(); + + if ( 'save' == $context ) { + $config_validator->save(); + } + } + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_delete_contact_form( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + $item = wpcf7_contact_form( $id ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_not_found', + __( "The requested contact form was not found.", 'contact-form-7' ), + array( 'status' => 404 ) ); + } + + if ( ! current_user_can( 'wpcf7_delete_contact_form', $id ) ) { + return new WP_Error( 'wpcf7_forbidden', + __( "You are not allowed to access the requested contact form.", 'contact-form-7' ), + array( 'status' => 403 ) ); + } + + $result = $item->delete(); + + if ( ! $result ) { + return new WP_Error( 'wpcf7_cannot_delete', + __( "There was an error deleting the contact form.", 'contact-form-7' ), + array( 'status' => 500 ) ); + } + + $response = array( 'deleted' => true ); + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_create_feedback( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + $item = wpcf7_contact_form( $id ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_not_found', + __( "The requested contact form was not found.", 'contact-form-7' ), + array( 'status' => 404 ) ); + } + + $result = $item->submit(); + + $unit_tag = $request->get_param( '_wpcf7_unit_tag' ); + + $response = array( + 'into' => '#' . wpcf7_sanitize_unit_tag( $unit_tag ), + 'status' => $result['status'], + 'message' => $result['message'], + ); + + if ( 'validation_failed' == $result['status'] ) { + $invalid_fields = array(); + + foreach ( (array) $result['invalid_fields'] as $name => $field ) { + $invalid_fields[] = array( + 'into' => 'span.wpcf7-form-control-wrap.' + . sanitize_html_class( $name ), + 'message' => $field['reason'], + 'idref' => $field['idref'], + ); + } + + $response['invalidFields'] = $invalid_fields; + } + + $response = apply_filters( 'wpcf7_ajax_json_echo', $response, $result ); + + return rest_ensure_response( $response ); +} + +function wpcf7_rest_get_refill( WP_REST_Request $request ) { + $id = (int) $request->get_param( 'id' ); + $item = wpcf7_contact_form( $id ); + + if ( ! $item ) { + return new WP_Error( 'wpcf7_not_found', + __( "The requested contact form was not found.", 'contact-form-7' ), + array( 'status' => 404 ) ); + } + + $response = apply_filters( 'wpcf7_ajax_onload', array() ); + + return rest_ensure_response( $response ); +} diff --git a/wp-content/plugins/contact-form-7/includes/shortcodes.php b/wp-content/plugins/contact-form-7/includes/shortcodes.php new file mode 100644 index 0000000..f097ff4 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/shortcodes.php @@ -0,0 +1,101 @@ +get_scanned_tags(); + } + + public function add_shortcode( $tag, $func, $has_name = false ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_FormTagsManager::add' ); + + return self::$form_tags_manager->add( $tag, $func, $has_name ); + } + + public function remove_shortcode( $tag ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_FormTagsManager::remove' ); + + return self::$form_tags_manager->remove( $tag ); + } + + public function normalize_shortcode( $content ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_FormTagsManager::normalize' ); + + return self::$form_tags_manager->normalize( $content ); + } + + public function do_shortcode( $content, $exec = true ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_FormTagsManager::replace_all' ); + + if ( $exec ) { + return self::$form_tags_manager->replace_all( $content ); + } else { + return self::$form_tags_manager->scan( $content ); + } + } + + public function scan_shortcode( $content ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_FormTagsManager::scan' ); + + return self::$form_tags_manager->scan( $content ); + } +} + +class WPCF7_Shortcode extends WPCF7_FormTag { + + public function __construct( $tag ) { + wpcf7_deprecated_function( 'WPCF7_Shortcode', '4.6', 'WPCF7_FormTag' ); + + parent::__construct( $tag ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/special-mail-tags.php b/wp-content/plugins/contact-form-7/includes/special-mail-tags.php new file mode 100644 index 0000000..b0188d7 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/special-mail-tags.php @@ -0,0 +1,168 @@ +get_meta( 'remote_ip' ) ) { + return $remote_ip; + } else { + return ''; + } + } + + if ( '_user_agent' == $name ) { + if ( $user_agent = $submission->get_meta( 'user_agent' ) ) { + return $html ? esc_html( $user_agent ) : $user_agent; + } else { + return ''; + } + } + + if ( '_url' == $name ) { + if ( $url = $submission->get_meta( 'url' ) ) { + return esc_url( $url ); + } else { + return ''; + } + } + + if ( '_date' == $name + or '_time' == $name ) { + if ( $timestamp = $submission->get_meta( 'timestamp' ) ) { + if ( '_date' == $name ) { + return date_i18n( get_option( 'date_format' ), $timestamp ); + } + + if ( '_time' == $name ) { + return date_i18n( get_option( 'time_format' ), $timestamp ); + } + } + + return ''; + } + + if ( '_invalid_fields' == $name ) { + return count( $submission->get_invalid_fields() ); + } + + return $output; +} + +add_filter( 'wpcf7_special_mail_tags', 'wpcf7_post_related_smt', 10, 3 ); + +function wpcf7_post_related_smt( $output, $name, $html ) { + if ( '_post_' != substr( $name, 0, 6 ) ) { + return $output; + } + + $submission = WPCF7_Submission::get_instance(); + + if ( ! $submission ) { + return $output; + } + + $post_id = (int) $submission->get_meta( 'container_post_id' ); + + if ( ! $post_id + or ! $post = get_post( $post_id ) ) { + return ''; + } + + if ( '_post_id' == $name ) { + return (string) $post->ID; + } + + if ( '_post_name' == $name ) { + return $post->post_name; + } + + if ( '_post_title' == $name ) { + return $html ? esc_html( $post->post_title ) : $post->post_title; + } + + if ( '_post_url' == $name ) { + return get_permalink( $post->ID ); + } + + $user = new WP_User( $post->post_author ); + + if ( '_post_author' == $name ) { + return $user->display_name; + } + + if ( '_post_author_email' == $name ) { + return $user->user_email; + } + + return $output; +} + +add_filter( 'wpcf7_special_mail_tags', 'wpcf7_site_related_smt', 10, 3 ); + +function wpcf7_site_related_smt( $output, $name, $html ) { + $filter = $html ? 'display' : 'raw'; + + if ( '_site_title' == $name ) { + return get_bloginfo( 'name', $filter ); + } + + if ( '_site_description' == $name ) { + return get_bloginfo( 'description', $filter ); + } + + if ( '_site_url' == $name ) { + return get_bloginfo( 'url', $filter ); + } + + if ( '_site_admin_email' == $name ) { + return get_bloginfo( 'admin_email', $filter ); + } + + return $output; +} + +add_filter( 'wpcf7_special_mail_tags', 'wpcf7_user_related_smt', 10, 3 ); + +function wpcf7_user_related_smt( $output, $name, $html ) { + if ( '_user_' != substr( $name, 0, 6 ) + or '_user_agent' == $name ) { + return $output; + } + + $submission = WPCF7_Submission::get_instance(); + + if ( ! $submission ) { + return $output; + } + + $user_id = (int) $submission->get_meta( 'current_user_id' ); + + if ( ! $user_id ) { + return ''; + } + + $primary_props = array( 'user_login', 'user_email', 'user_url' ); + $opt = ltrim( $name, '_' ); + $opt = in_array( $opt, $primary_props ) ? $opt : substr( $opt, 5 ); + + $user = new WP_User( $user_id ); + + if ( $user->has_prop( $opt ) ) { + return $user->get( $opt ); + } + + return ''; +} diff --git a/wp-content/plugins/contact-form-7/includes/submission.php b/wp-content/plugins/contact-form-7/includes/submission.php new file mode 100644 index 0000000..1c991fb --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/submission.php @@ -0,0 +1,441 @@ + false, + ) ); + + if ( empty( self::$instance ) ) { + if ( null == $contact_form ) { + return null; + } + + self::$instance = new self; + self::$instance->contact_form = $contact_form; + self::$instance->skip_mail = (bool) $args['skip_mail']; + self::$instance->setup_posted_data(); + self::$instance->submit(); + } elseif ( null != $contact_form ) { + return null; + } + + return self::$instance; + } + + public static function is_restful() { + return defined( 'REST_REQUEST' ) && REST_REQUEST; + } + + public function get_status() { + return $this->status; + } + + public function set_status( $status ) { + if ( preg_match( '/^[a-z][0-9a-z_]+$/', $status ) ) { + $this->status = $status; + return true; + } + + return false; + } + + public function is( $status ) { + return $this->status == $status; + } + + public function get_response() { + return $this->response; + } + + public function set_response( $response ) { + $this->response = $response; + return true; + } + + public function get_contact_form() { + return $this->contact_form; + } + + public function get_invalid_field( $name ) { + if ( isset( $this->invalid_fields[$name] ) ) { + return $this->invalid_fields[$name]; + } else { + return false; + } + } + + public function get_invalid_fields() { + return $this->invalid_fields; + } + + public function get_posted_data( $name = '' ) { + if ( ! empty( $name ) ) { + if ( isset( $this->posted_data[$name] ) ) { + return $this->posted_data[$name]; + } else { + return null; + } + } + + return $this->posted_data; + } + + private function setup_posted_data() { + $posted_data = (array) $_POST; + $posted_data = array_diff_key( $posted_data, array( '_wpnonce' => '' ) ); + $posted_data = $this->sanitize_posted_data( $posted_data ); + + $tags = $this->contact_form->scan_form_tags(); + + foreach ( (array) $tags as $tag ) { + if ( empty( $tag->name ) ) { + continue; + } + + $type = $tag->type; + $name = $tag->name; + $pipes = $tag->pipes; + + $value_orig = $value = ''; + + if ( isset( $posted_data[$name] ) ) { + $value_orig = $value = $posted_data[$name]; + } + + if ( WPCF7_USE_PIPE + and $pipes instanceof WPCF7_Pipes + and ! $pipes->zero() ) { + if ( is_array( $value_orig ) ) { + $value = array(); + + foreach ( $value_orig as $v ) { + $value[] = $pipes->do_pipe( wp_unslash( $v ) ); + } + } else { + $value = $pipes->do_pipe( wp_unslash( $value_orig ) ); + } + } + + $value = apply_filters( "wpcf7_posted_data_{$type}", $value, + $value_orig, $tag ); + + $posted_data[$name] = $value; + + if ( $tag->has_option( 'consent_for:storage' ) + and empty( $posted_data[$name] ) ) { + $this->meta['do_not_store'] = true; + } + } + + $this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data ); + + return $this->posted_data; + } + + private function sanitize_posted_data( $value ) { + if ( is_array( $value ) ) { + $value = array_map( array( $this, 'sanitize_posted_data' ), $value ); + } elseif ( is_string( $value ) ) { + $value = wp_check_invalid_utf8( $value ); + $value = wp_kses_no_null( $value ); + } + + return $value; + } + + private function submit() { + if ( ! $this->is( 'init' ) ) { + return $this->status; + } + + $this->meta = array_merge( $this->meta, array( + 'remote_ip' => $this->get_remote_ip_addr(), + 'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) + ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '', + 'url' => $this->get_request_url(), + 'timestamp' => current_time( 'timestamp' ), + 'unit_tag' => + isset( $_POST['_wpcf7_unit_tag'] ) ? $_POST['_wpcf7_unit_tag'] : '', + 'container_post_id' => isset( $_POST['_wpcf7_container_post'] ) + ? (int) $_POST['_wpcf7_container_post'] : 0, + 'current_user_id' => get_current_user_id(), + ) ); + + $contact_form = $this->contact_form; + + if ( $contact_form->is_true( 'do_not_store' ) ) { + $this->meta['do_not_store'] = true; + } + + if ( ! $this->validate() ) { // Validation error occured + $this->set_status( 'validation_failed' ); + $this->set_response( $contact_form->message( 'validation_error' ) ); + + } elseif ( ! $this->accepted() ) { // Not accepted terms + $this->set_status( 'acceptance_missing' ); + $this->set_response( $contact_form->message( 'accept_terms' ) ); + + } elseif ( $this->spam() ) { // Spam! + $this->set_status( 'spam' ); + $this->set_response( $contact_form->message( 'spam' ) ); + + } elseif ( ! $this->before_send_mail() ) { + if ( 'init' == $this->get_status() ) { + $this->set_status( 'aborted' ); + } + + if ( '' === $this->get_response() ) { + $this->set_response( $contact_form->filter_message( + __( "Sending mail has been aborted.", 'contact-form-7' ) ) + ); + } + + } elseif ( $this->mail() ) { + $this->set_status( 'mail_sent' ); + $this->set_response( $contact_form->message( 'mail_sent_ok' ) ); + + do_action( 'wpcf7_mail_sent', $contact_form ); + + } else { + $this->set_status( 'mail_failed' ); + $this->set_response( $contact_form->message( 'mail_sent_ng' ) ); + + do_action( 'wpcf7_mail_failed', $contact_form ); + } + + $this->remove_uploaded_files(); + + return $this->status; + } + + private function get_remote_ip_addr() { + $ip_addr = ''; + + if ( isset( $_SERVER['REMOTE_ADDR'] ) + and WP_Http::is_ip_address( $_SERVER['REMOTE_ADDR'] ) ) { + $ip_addr = $_SERVER['REMOTE_ADDR']; + } + + return apply_filters( 'wpcf7_remote_ip_addr', $ip_addr ); + } + + private function get_request_url() { + $home_url = untrailingslashit( home_url() ); + + if ( self::is_restful() ) { + $referer = isset( $_SERVER['HTTP_REFERER'] ) + ? trim( $_SERVER['HTTP_REFERER'] ) : ''; + + if ( $referer + and 0 === strpos( $referer, $home_url ) ) { + return esc_url_raw( $referer ); + } + } + + $url = preg_replace( '%(?invalid_fields ) { + return false; + } + + require_once WPCF7_PLUGIN_DIR . '/includes/validation.php'; + $result = new WPCF7_Validation(); + + $tags = $this->contact_form->scan_form_tags(); + + foreach ( $tags as $tag ) { + $type = $tag->type; + $result = apply_filters( "wpcf7_validate_{$type}", $result, $tag ); + } + + $result = apply_filters( 'wpcf7_validate', $result, $tags ); + + $this->invalid_fields = $result->get_invalid_fields(); + + return $result->is_valid(); + } + + private function accepted() { + return apply_filters( 'wpcf7_acceptance', true, $this ); + } + + public function add_consent( $name, $conditions ) { + $this->consent[$name] = $conditions; + return true; + } + + public function collect_consent() { + return (array) $this->consent; + } + + private function spam() { + $spam = false; + + if ( $this->contact_form->is_true( 'subscribers_only' ) + and current_user_can( 'wpcf7_submit', $this->contact_form->id() ) ) { + return $spam; + } + + $user_agent = (string) $this->get_meta( 'user_agent' ); + + if ( strlen( $user_agent ) < 2 ) { + $spam = true; + + $this->add_spam_log( array( + 'agent' => 'wpcf7', + 'reason' => __( "User-Agent string is unnaturally short.", 'contact-form-7' ), + ) ); + } + + if ( ! $this->verify_nonce() ) { + $spam = true; + + $this->add_spam_log( array( + 'agent' => 'wpcf7', + 'reason' => __( "Submitted nonce is invalid.", 'contact-form-7' ), + ) ); + } + + if ( $this->is_blacklisted() ) { + $spam = true; + + $this->add_spam_log( array( + 'agent' => 'wpcf7', + 'reason' => __( "Blacklisted words are used.", 'contact-form-7' ), + ) ); + } + + return apply_filters( 'wpcf7_spam', $spam ); + } + + public function add_spam_log( $args = '' ) { + $args = wp_parse_args( $args, array( + 'agent' => '', + 'reason' => '', + ) ); + + $this->spam_log[] = $args; + } + + public function get_spam_log() { + return $this->spam_log; + } + + private function verify_nonce() { + if ( ! $this->contact_form->nonce_is_active() ) { + return true; + } + + return wpcf7_verify_nonce( $_POST['_wpnonce'] ); + } + + private function is_blacklisted() { + $target = wpcf7_array_flatten( $this->posted_data ); + $target[] = $this->get_meta( 'remote_ip' ); + $target[] = $this->get_meta( 'user_agent' ); + $target = implode( "\n", $target ); + + return (bool) apply_filters( 'wpcf7_submission_is_blacklisted', + wpcf7_blacklist_check( $target ), $this ); + } + + /* Mail */ + + private function before_send_mail() { + $abort = false; + + do_action_ref_array( 'wpcf7_before_send_mail', array( + $this->contact_form, + &$abort, + $this, + ) ); + + return ! $abort; + } + + private function mail() { + $contact_form = $this->contact_form; + + $skip_mail = apply_filters( 'wpcf7_skip_mail', + $this->skip_mail, $contact_form ); + + if ( $skip_mail ) { + return true; + } + + $result = WPCF7_Mail::send( $contact_form->prop( 'mail' ), 'mail' ); + + if ( $result ) { + $additional_mail = array(); + + if ( $mail_2 = $contact_form->prop( 'mail_2' ) + and $mail_2['active'] ) { + $additional_mail['mail_2'] = $mail_2; + } + + $additional_mail = apply_filters( 'wpcf7_additional_mail', + $additional_mail, $contact_form ); + + foreach ( $additional_mail as $name => $template ) { + WPCF7_Mail::send( $template, $name ); + } + + return true; + } + + return false; + } + + public function uploaded_files() { + return $this->uploaded_files; + } + + public function add_uploaded_file( $name, $file_path ) { + $this->uploaded_files[$name] = $file_path; + + if ( empty( $this->posted_data[$name] ) ) { + $this->posted_data[$name] = basename( $file_path ); + } + } + + public function remove_uploaded_files() { + foreach ( (array) $this->uploaded_files as $name => $path ) { + wpcf7_rmdir_p( $path ); + + if ( $dir = dirname( $path ) + and false !== ( $files = scandir( $dir ) ) + and ! array_diff( $files, array( '.', '..' ) ) ) { + // remove parent dir if it's empty. + rmdir( $dir ); + } + } + } + + public function get_meta( $name ) { + if ( isset( $this->meta[$name] ) ) { + return $this->meta[$name]; + } + } +} diff --git a/wp-content/plugins/contact-form-7/includes/upgrade.php b/wp-content/plugins/contact-form-7/includes/upgrade.php new file mode 100644 index 0000000..2e575df --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/upgrade.php @@ -0,0 +1,85 @@ +prefix . "contact_form_7"; + + if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) ) { + $old_rows = $wpdb->get_results( "SELECT * FROM $table_name" ); + } elseif ( $opt = get_option( 'wpcf7' ) + and ! empty( $opt['contact_forms'] ) ) { + foreach ( (array) $opt['contact_forms'] as $key => $value ) { + $old_rows[] = (object) array_merge( + $value, + array( 'cf7_unit_id' => $key ) + ); + } + } + + foreach ( (array) $old_rows as $row ) { + $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" + . $wpdb->prepare( " AND meta_value = %d", $row->cf7_unit_id ); + + if ( $wpdb->get_var( $q ) ) { + continue; + } + + $postarr = array( + 'post_type' => 'wpcf7_contact_form', + 'post_status' => 'publish', + 'post_title' => maybe_unserialize( $row->title ), + ); + + $post_id = wp_insert_post( $postarr ); + + if ( $post_id ) { + update_post_meta( $post_id, '_old_cf7_unit_id', $row->cf7_unit_id ); + + $metas = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ); + + foreach ( $metas as $meta ) { + update_post_meta( $post_id, '_' . $meta, + wpcf7_normalize_newline_deep( maybe_unserialize( $row->{$meta} ) ) ); + } + } + } +} + +add_action( 'wpcf7_upgrade', 'wpcf7_prepend_underscore', 10, 2 ); + +function wpcf7_prepend_underscore( $new_ver, $old_ver ) { + if ( version_compare( $old_ver, '3.0-dev', '<' ) ) { + return; + } + + if ( ! version_compare( $old_ver, '3.3-dev', '<' ) ) { + return; + } + + $posts = WPCF7_ContactForm::find( array( + 'post_status' => 'any', + 'posts_per_page' => -1, + ) ); + + foreach ( $posts as $post ) { + $props = $post->get_properties(); + + foreach ( $props as $prop => $value ) { + if ( metadata_exists( 'post', $post->id(), '_' . $prop ) ) { + continue; + } + + update_post_meta( $post->id(), '_' . $prop, $value ); + delete_post_meta( $post->id(), $prop ); + } + } +} diff --git a/wp-content/plugins/contact-form-7/includes/validation.php b/wp-content/plugins/contact-form-7/includes/validation.php new file mode 100644 index 0000000..09cde6b --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/validation.php @@ -0,0 +1,84 @@ +container = array( + 'valid' => true, + 'reason' => array(), + 'idref' => array(), + ); + } + + public function invalidate( $context, $message ) { + if ( $context instanceof WPCF7_FormTag ) { + $tag = $context; + } elseif ( is_array( $context ) ) { + $tag = new WPCF7_FormTag( $context ); + } elseif ( is_string( $context ) ) { + $tags = wpcf7_scan_form_tags( array( 'name' => trim( $context ) ) ); + $tag = $tags ? new WPCF7_FormTag( $tags[0] ) : null; + } + + $name = ! empty( $tag ) ? $tag->name : null; + + if ( empty( $name ) + or ! wpcf7_is_name( $name ) ) { + return; + } + + if ( $this->is_valid( $name ) ) { + $id = $tag->get_id_option(); + + if ( empty( $id ) + or ! wpcf7_is_name( $id ) ) { + $id = null; + } + + $this->invalid_fields[$name] = array( + 'reason' => (string) $message, + 'idref' => $id, + ); + } + } + + public function is_valid( $name = null ) { + if ( ! empty( $name ) ) { + return ! isset( $this->invalid_fields[$name] ); + } else { + return empty( $this->invalid_fields ); + } + } + + public function get_invalid_fields() { + return $this->invalid_fields; + } + + public function offsetSet( $offset, $value ) { + if ( isset( $this->container[$offset] ) ) { + $this->container[$offset] = $value; + } + + if ( 'reason' == $offset + and is_array( $value ) ) { + foreach ( $value as $k => $v ) { + $this->invalidate( $k, $v ); + } + } + } + + public function offsetGet( $offset ) { + if ( isset( $this->container[$offset] ) ) { + return $this->container[$offset]; + } + } + + public function offsetExists( $offset ) { + return isset( $this->container[$offset] ); + } + + public function offsetUnset( $offset ) { + } +} diff --git a/wp-content/plugins/contact-form-7/languages/readme.txt b/wp-content/plugins/contact-form-7/languages/readme.txt new file mode 100644 index 0000000..a9bda89 --- /dev/null +++ b/wp-content/plugins/contact-form-7/languages/readme.txt @@ -0,0 +1,4 @@ +Translations have moved to +https://translate.wordpress.org/projects/wp-plugins/contact-form-7 + +Thank you for your contribution. diff --git a/wp-content/plugins/contact-form-7/license.txt b/wp-content/plugins/contact-form-7/license.txt new file mode 100644 index 0000000..32fab13 --- /dev/null +++ b/wp-content/plugins/contact-form-7/license.txt @@ -0,0 +1,358 @@ +Contact Form 7 WordPress Plugin, 2007-2019 Takayuki Miyoshi +Contact Form 7 is distributed under the terms of the GNU GPL + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/wp-content/plugins/contact-form-7/modules/acceptance.php b/wp-content/plugins/contact-form-7/modules/acceptance.php new file mode 100644 index 0000000..3b89513 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/acceptance.php @@ -0,0 +1,294 @@ + true, + ) + ); +} + +function wpcf7_acceptance_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + if ( $tag->has_option( 'invert' ) ) { + $class .= ' invert'; + } + + if ( $tag->has_option( 'optional' ) ) { + $class .= ' optional'; + } + + $atts = array( + 'class' => trim( $class ), + ); + + $item_atts = array(); + + $item_atts['type'] = 'checkbox'; + $item_atts['name'] = $tag->name; + $item_atts['value'] = '1'; + $item_atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + $item_atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + if ( $tag->has_option( 'default:on' ) ) { + $item_atts['checked'] = 'checked'; + } + + $item_atts['class'] = $tag->get_class_option(); + $item_atts['id'] = $tag->get_id_option(); + + $item_atts = wpcf7_format_atts( $item_atts ); + + $content = empty( $tag->content ) + ? (string) reset( $tag->values ) + : $tag->content; + + $content = trim( $content ); + + if ( $content ) { + if ( $tag->has_option( 'label_first' ) ) { + $html = sprintf( + '%2$s', + $item_atts, $content ); + } else { + $html = sprintf( + '%2$s', + $item_atts, $content ); + } + + $html = sprintf( + '', + $html + ); + + } else { + $html = sprintf( + '', + $item_atts ); + } + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s%4$s', + sanitize_html_class( $tag->name ), $atts, $html, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_acceptance', + 'wpcf7_acceptance_validation_filter', 10, 2 ); + +function wpcf7_acceptance_validation_filter( $result, $tag ) { + if ( ! wpcf7_acceptance_as_validation() ) { + return $result; + } + + if ( $tag->has_option( 'optional' ) ) { + return $result; + } + + $name = $tag->name; + $value = ( ! empty( $_POST[$name] ) ? 1 : 0 ); + + $invert = $tag->has_option( 'invert' ); + + if ( $invert and $value + or ! $invert and ! $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'accept_terms' ) ); + } + + return $result; +} + + +/* Acceptance filter */ + +add_filter( 'wpcf7_acceptance', 'wpcf7_acceptance_filter', 10, 2 ); + +function wpcf7_acceptance_filter( $accepted, $submission ) { + $tags = wpcf7_scan_form_tags( array( 'type' => 'acceptance' ) ); + + foreach ( $tags as $tag ) { + $name = $tag->name; + + if ( empty( $name ) ) { + continue; + } + + $value = ( ! empty( $_POST[$name] ) ? 1 : 0 ); + + $content = empty( $tag->content ) + ? (string) reset( $tag->values ) + : $tag->content; + + $content = trim( $content ); + + if ( $value and $content ) { + $submission->add_consent( $name, $content ); + } + + if ( $tag->has_option( 'optional' ) ) { + continue; + } + + $invert = $tag->has_option( 'invert' ); + + if ( $invert and $value + or ! $invert and ! $value ) { + $accepted = false; + } + } + + return $accepted; +} + +add_filter( 'wpcf7_form_class_attr', + 'wpcf7_acceptance_form_class_attr', 10, 1 ); + +function wpcf7_acceptance_form_class_attr( $class ) { + if ( wpcf7_acceptance_as_validation() ) { + return $class . ' wpcf7-acceptance-as-validation'; + } + + return $class; +} + +function wpcf7_acceptance_as_validation() { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return false; + } + + return $contact_form->is_true( 'acceptance_as_validation' ); +} + +add_filter( 'wpcf7_mail_tag_replaced_acceptance', + 'wpcf7_acceptance_mail_tag', 10, 4 ); + +function wpcf7_acceptance_mail_tag( $replaced, $submitted, $html, $mail_tag ) { + $form_tag = $mail_tag->corresponding_form_tag(); + + if ( ! $form_tag ) { + return $replaced; + } + + if ( ! empty( $submitted ) ) { + $replaced = __( 'Consented', 'contact-form-7' ); + } else { + $replaced = __( 'Not consented', 'contact-form-7' ); + } + + $content = empty( $form_tag->content ) + ? (string) reset( $form_tag->values ) + : $form_tag->content; + + if ( ! $html ) { + $content = wp_strip_all_tags( $content ); + } + + $content = trim( $content ); + + if ( $content ) { + /* translators: 1: 'Consented' or 'Not consented', 2: conditions */ + $replaced = sprintf( + _x( '%1$s: %2$s', 'mail output for acceptance checkboxes', + 'contact-form-7' ), + $replaced, + $content ); + } + + return $replaced; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_acceptance', 35, 0 ); + +function wpcf7_add_tag_generator_acceptance() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'acceptance', __( 'acceptance', 'contact-form-7' ), + 'wpcf7_tag_generator_acceptance' ); +} + +function wpcf7_tag_generator_acceptance( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'acceptance'; + + $description = __( "Generate a form-tag for an acceptance checkbox. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/acceptance-checkbox/', 'contact-form-7' ), __( 'Acceptance Checkbox', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      +
                      + $value ) { + if ( ! in_array( $key, (array) $ignore ) ) { + $c["$key"] = $value; + } + } + + if ( wpcf7_akismet_comment_check( $c ) ) { + $spam = true; + + $submission = WPCF7_Submission::get_instance(); + + $submission->add_spam_log( array( + 'agent' => 'akismet', + 'reason' => __( "Akismet returns a spam response.", 'contact-form-7' ), + ) ); + } else { + $spam = false; + } + + return $spam; +} + +function wpcf7_akismet_is_available() { + if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { + return (bool) Akismet::get_api_key(); + } + + return false; +} + +function wpcf7_akismet_submitted_params() { + $params = array( + 'author' => '', + 'author_email' => '', + 'author_url' => '', + 'content' => '', + ); + + $has_akismet_option = false; + + foreach ( (array) $_POST as $key => $val ) { + if ( '_wpcf7' == substr( $key, 0, 6 ) + or '_wpnonce' == $key ) { + continue; + } + + if ( is_array( $val ) ) { + $val = implode( ', ', wpcf7_array_flatten( $val ) ); + } + + $val = trim( $val ); + + if ( 0 == strlen( $val ) ) { + continue; + } + + if ( $tags = wpcf7_scan_form_tags( array( 'name' => $key ) ) ) { + $tag = $tags[0]; + + $akismet = $tag->get_option( 'akismet', + '(author|author_email|author_url)', true ); + + if ( $akismet ) { + $has_akismet_option = true; + + if ( 'author' == $akismet ) { + $params[$akismet] = trim( $params[$akismet] . ' ' . $val ); + continue; + } elseif ( '' == $params[$akismet] ) { + $params[$akismet] = $val; + continue; + } + } + } + + $params['content'] .= "\n\n" . $val; + } + + if ( ! $has_akismet_option ) { + return false; + } + + $params['content'] = trim( $params['content'] ); + + return $params; +} + +function wpcf7_akismet_comment_check( $comment ) { + $spam = false; + $query_string = wpcf7_build_query( $comment ); + + if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { + $response = Akismet::http_post( $query_string, 'comment-check' ); + } else { + return $spam; + } + + if ( 'true' == $response[1] ) { + $spam = true; + } + + if ( $submission = WPCF7_Submission::get_instance() ) { + $submission->akismet = array( 'comment' => $comment, 'spam' => $spam ); + } + + return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment ); +} diff --git a/wp-content/plugins/contact-form-7/modules/checkbox.php b/wp-content/plugins/contact-form-7/modules/checkbox.php new file mode 100644 index 0000000..003e954 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/checkbox.php @@ -0,0 +1,349 @@ + true, + 'selectable-values' => true, + 'multiple-controls-container' => true, + ) + ); +} + +function wpcf7_checkbox_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $label_first = $tag->has_option( 'label_first' ); + $use_label_element = $tag->has_option( 'use_label_element' ); + $exclusive = $tag->has_option( 'exclusive' ); + $free_text = $tag->has_option( 'free_text' ); + $multiple = false; + + if ( 'checkbox' == $tag->basetype ) { + $multiple = ! $exclusive; + } else { // radio + $exclusive = false; + } + + if ( $exclusive ) { + $class .= ' wpcf7-exclusive-checkbox'; + } + + $atts = array(); + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + + $tabindex = $tag->get_option( 'tabindex', 'signed_int', true ); + + if ( false !== $tabindex ) { + $tabindex = (int) $tabindex; + } + + $html = ''; + $count = 0; + + if ( $data = (array) $tag->get_data_option() ) { + if ( $free_text ) { + $tag->values = array_merge( + array_slice( $tag->values, 0, -1 ), + array_values( $data ), + array_slice( $tag->values, -1 ) ); + $tag->labels = array_merge( + array_slice( $tag->labels, 0, -1 ), + array_values( $data ), + array_slice( $tag->labels, -1 ) ); + } else { + $tag->values = array_merge( $tag->values, array_values( $data ) ); + $tag->labels = array_merge( $tag->labels, array_values( $data ) ); + } + } + + $values = $tag->values; + $labels = $tag->labels; + + $default_choice = $tag->get_default_option( null, array( + 'multiple' => $multiple, + ) ); + + $hangover = wpcf7_get_hangover( $tag->name, $multiple ? array() : '' ); + + foreach ( $values as $key => $value ) { + if ( $hangover ) { + $checked = in_array( $value, (array) $hangover, true ); + } else { + $checked = in_array( $value, (array) $default_choice, true ); + } + + if ( isset( $labels[$key] ) ) { + $label = $labels[$key]; + } else { + $label = $value; + } + + $item_atts = array( + 'type' => $tag->basetype, + 'name' => $tag->name . ( $multiple ? '[]' : '' ), + 'value' => $value, + 'checked' => $checked ? 'checked' : '', + 'tabindex' => false !== $tabindex ? $tabindex : '', + ); + + $item_atts = wpcf7_format_atts( $item_atts ); + + if ( $label_first ) { // put label first, input last + $item = sprintf( + '%1$s', + esc_html( $label ), $item_atts ); + } else { + $item = sprintf( + '%1$s', + esc_html( $label ), $item_atts ); + } + + if ( $use_label_element ) { + $item = ''; + } + + if ( false !== $tabindex + and 0 < $tabindex ) { + $tabindex += 1; + } + + $class = 'wpcf7-list-item'; + $count += 1; + + if ( 1 == $count ) { + $class .= ' first'; + } + + if ( count( $values ) == $count ) { // last round + $class .= ' last'; + + if ( $free_text ) { + $free_text_name = sprintf( + '_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name ); + + $free_text_atts = array( + 'name' => $free_text_name, + 'class' => 'wpcf7-free-text', + 'tabindex' => false !== $tabindex ? $tabindex : '', + ); + + if ( wpcf7_is_posted() + and isset( $_POST[$free_text_name] ) ) { + $free_text_atts['value'] = wp_unslash( + $_POST[$free_text_name] ); + } + + $free_text_atts = wpcf7_format_atts( $free_text_atts ); + + $item .= sprintf( ' ', $free_text_atts ); + + $class .= ' has-free-text'; + } + } + + $item = '' . $item . ''; + $html .= $item; + } + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s%4$s', + sanitize_html_class( $tag->name ), $atts, $html, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_checkbox', + 'wpcf7_checkbox_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_checkbox*', + 'wpcf7_checkbox_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_radio', + 'wpcf7_checkbox_validation_filter', 10, 2 ); + +function wpcf7_checkbox_validation_filter( $result, $tag ) { + $name = $tag->name; + $is_required = $tag->is_required() || 'radio' == $tag->type; + $value = isset( $_POST[$name] ) ? (array) $_POST[$name] : array(); + + if ( $is_required and empty( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } + + return $result; +} + + +/* Adding free text field */ + +add_filter( 'wpcf7_posted_data', 'wpcf7_checkbox_posted_data', 10, 1 ); + +function wpcf7_checkbox_posted_data( $posted_data ) { + $tags = wpcf7_scan_form_tags( + array( 'type' => array( 'checkbox', 'checkbox*', 'radio' ) ) ); + + if ( empty( $tags ) ) { + return $posted_data; + } + + foreach ( $tags as $tag ) { + if ( ! isset( $posted_data[$tag->name] ) ) { + continue; + } + + $posted_items = (array) $posted_data[$tag->name]; + + if ( $tag->has_option( 'free_text' ) ) { + if ( WPCF7_USE_PIPE ) { + $values = $tag->pipes->collect_afters(); + } else { + $values = $tag->values; + } + + $last = array_pop( $values ); + $last = html_entity_decode( $last, ENT_QUOTES, 'UTF-8' ); + + if ( in_array( $last, $posted_items ) ) { + $posted_items = array_diff( $posted_items, array( $last ) ); + + $free_text_name = sprintf( + '_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name ); + + $free_text = $posted_data[$free_text_name]; + + if ( ! empty( $free_text ) ) { + $posted_items[] = trim( $last . ' ' . $free_text ); + } else { + $posted_items[] = $last; + } + } + } + + $posted_data[$tag->name] = $posted_items; + } + + return $posted_data; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', + 'wpcf7_add_tag_generator_checkbox_and_radio', 30, 0 ); + +function wpcf7_add_tag_generator_checkbox_and_radio() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'checkbox', __( 'checkboxes', 'contact-form-7' ), + 'wpcf7_tag_generator_checkbox' ); + $tag_generator->add( 'radio', __( 'radio buttons', 'contact-form-7' ), + 'wpcf7_tag_generator_checkbox' ); +} + +function wpcf7_tag_generator_checkbox( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = $args['id']; + + if ( 'radio' != $type ) { + $type = 'checkbox'; + } + + if ( 'checkbox' == $type ) { + $description = __( "Generate a form-tag for a group of checkboxes. For more details, see %s.", 'contact-form-7' ); + } elseif ( 'radio' == $type ) { + $description = __( "Generate a form-tag for a group of radio buttons. For more details, see %s.", 'contact-form-7' ); + } + + $desc_link = wpcf7_link( __( 'https://contactform7.com/checkboxes-radio-buttons-and-menus/', 'contact-form-7' ), __( 'Checkboxes, Radio Buttons and Menus', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +
                      +
                      + + +
                      +
                      + + +
                      + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      ' ); ?>

                      +
                      +add_category( 'email_marketing', + __( 'Email Marketing', 'contact-form-7' ) ); + + $service = WPCF7_ConstantContact::get_instance(); + $integration->add_service( 'constant_contact', $service ); +} + +add_action( 'wpcf7_save_contact_form', + 'wpcf7_constant_contact_save_contact_form', 10, 1 ); + +function wpcf7_constant_contact_save_contact_form( $contact_form ) { + $service = WPCF7_ConstantContact::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + $additional_settings = $contact_form->additional_setting( + 'constant_contact', + false + ); + + $list_names = array(); + + $pattern = '/[\t ]*(' + . "'[^']*'" + . '|' + . '"[^"]*"' + . '|' + . '[^,]*?' + . ')[\t ]*(?:[,]+|$)/'; + + foreach ( $additional_settings as $setting ) { + if ( preg_match_all( $pattern, $setting, $matches ) ) { + foreach ( $matches[1] as $match ) { + $name = trim( wpcf7_strip_quote( $match ) ); + + if ( '' !== $name ) { + $list_names[] = $name; + } + } + } + } + + $list_names = array_unique( $list_names ); + + $key = sprintf( 'wpcf7_contact_form:%d', $contact_form->id() ); + + $service->update_contact_lists( array( $key => $list_names ) ); +} + +add_action( 'wpcf7_submit', 'wpcf7_constant_contact_submit', 10, 2 ); + +function wpcf7_constant_contact_submit( $contact_form, $result ) { + $service = WPCF7_ConstantContact::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + if ( $contact_form->in_demo_mode() ) { + return; + } + + $do_submit = true; + + if ( empty( $result['status'] ) + or ! in_array( $result['status'], array( 'mail_sent' ) ) ) { + $do_submit = false; + } + + $additional_settings = $contact_form->additional_setting( + 'constant_contact', + false + ); + + foreach ( $additional_settings as $setting ) { + if ( in_array( $setting, array( 'off', 'false', '0' ), true ) ) { + $do_submit = false; + break; + } + } + + $do_submit = apply_filters( 'wpcf7_constant_contact_submit', + $do_submit, $contact_form, $result ); + + if ( ! $do_submit ) { + return; + } + + $submission = WPCF7_Submission::get_instance(); + + $consented = true; + + foreach ( $contact_form->scan_form_tags( 'feature=name-attr' ) as $tag ) { + if ( $tag->has_option( 'consent_for:constant_contact' ) + and null == $submission->get_posted_data( $tag->name ) ) { + $consented = false; + break; + } + } + + if ( ! $consented ) { + return; + } + + $request_builder_class_name = apply_filters( + 'wpcf7_constant_contact_contact_post_request_builder', + 'WPCF7_ConstantContact_ContactPostRequest' + ); + + if ( ! class_exists( $request_builder_class_name ) ) { + return; + } + + $request_builder = new $request_builder_class_name; + $request_builder->build( $submission ); + + if ( ! $request_builder->is_valid() ) { + return; + } + + if ( $email = $request_builder->get_email_address() + and $service->email_exists( $email ) ) { + return; + } + + $service->create_contact( $request_builder->to_array() ); +} + +if ( ! class_exists( 'WPCF7_Service_OAuth2' ) ) { + return; +} + +class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 { + + const service_name = 'constant_contact'; + const authorization_endpoint = 'https://api.cc.email/v3/idfed'; + const token_endpoint = 'https://idfed.constantcontact.com/as/token.oauth2'; + + private static $instance; + protected $contact_lists = array(); + + public static function get_instance() { + if ( empty( self::$instance ) ) { + self::$instance = new self; + } + + return self::$instance; + } + + private function __construct() { + $this->authorization_endpoint = self::authorization_endpoint; + $this->token_endpoint = self::token_endpoint; + + $option = (array) WPCF7::get_option( self::service_name ); + + if ( isset( $option['client_id'] ) ) { + $this->client_id = $option['client_id']; + } + + if ( isset( $option['client_secret'] ) ) { + $this->client_secret = $option['client_secret']; + } + + if ( isset( $option['access_token'] ) ) { + $this->access_token = $option['access_token']; + } + + if ( isset( $option['refresh_token'] ) ) { + $this->refresh_token = $option['refresh_token']; + } + + if ( $this->is_active() ) { + if ( isset( $option['contact_lists'] ) ) { + $this->contact_lists = $option['contact_lists']; + } + } + + add_action( 'wpcf7_admin_init', array( $this, 'auth_redirect' ) ); + } + + public function auth_redirect() { + $auth = isset( $_GET['auth'] ) ? trim( $_GET['auth'] ) : ''; + $code = isset( $_GET['code'] ) ? trim( $_GET['code'] ) : ''; + + if ( self::service_name === $auth and $code + and current_user_can( 'wpcf7_manage_integration' ) ) { + $redirect_to = add_query_arg( + array( + 'service' => self::service_name, + 'action' => 'auth_redirect', + 'code' => $code, + ), + menu_page_url( 'wpcf7-integration', false ) + ); + + wp_safe_redirect( $redirect_to ); + exit(); + } + } + + protected function save_data() { + $option = array_merge( + (array) WPCF7::get_option( self::service_name ), + array( + 'client_id' => $this->client_id, + 'client_secret' => $this->client_secret, + 'access_token' => $this->access_token, + 'refresh_token' => $this->refresh_token, + 'contact_lists' => $this->contact_lists, + ) + ); + + WPCF7::update_option( self::service_name, $option ); + } + + protected function reset_data() { + $this->client_id = ''; + $this->client_secret = ''; + $this->access_token = ''; + $this->refresh_token = ''; + $this->contact_lists = array(); + + $this->save_data(); + } + + public function get_title() { + return __( 'Constant Contact', 'contact-form-7' ); + } + + public function get_categories() { + return array( 'email_marketing' ); + } + + public function icon() { + } + + public function link() { + echo sprintf( '%2$s', + 'https://constant-contact.evyy.net/c/1293104/205991/3411', + 'constantcontact.com' + ); + } + + protected function get_redirect_uri() { + return admin_url( '/?auth=' . self::service_name ); + } + + protected function menu_page_url( $args = '' ) { + $args = wp_parse_args( $args, array() ); + + $url = menu_page_url( 'wpcf7-integration', false ); + $url = add_query_arg( array( 'service' => self::service_name ), $url ); + + if ( ! empty( $args) ) { + $url = add_query_arg( $args, $url ); + } + + return $url; + } + + public function load( $action = '' ) { + parent::load( $action ); + + if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) { + check_admin_referer( 'wpcf7-constant-contact-setup' ); + + if ( ! empty( $_POST['reset'] ) ) { + $this->reset_data(); + } else { + $this->client_id = isset( $_POST['client_id'] ) + ? trim( $_POST['client_id'] ) : ''; + + $this->client_secret = isset( $_POST['client_secret'] ) + ? trim( $_POST['client_secret'] ) : ''; + + $this->save_data(); + $this->authorize( 'contact_data' ); + } + + wp_safe_redirect( $this->menu_page_url( 'action=setup' ) ); + exit(); + } + + if ( 'edit' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) { + check_admin_referer( 'wpcf7-constant-contact-edit' ); + + $list_ids = isset( $_POST['contact_lists'] ) + ? (array) $_POST['contact_lists'] + : array(); + + $this->update_contact_lists( array( 'default' => $list_ids ) ); + + wp_safe_redirect( $this->menu_page_url( + array( + 'action' => 'setup', + 'message' => 'updated', + ) + ) ); + + exit(); + } + + if ( $this->is_active() ) { + $this->update_contact_lists(); + } + } + + public function email_exists( $email ) { + $endpoint = add_query_arg( + array( 'email' => $email ), + 'https://api.cc.email/v3/contacts' + ); + + $request = array( + 'method' => 'GET', + 'headers' => array( + 'Accept' => 'application/json', + 'Content-Type' => 'application/json; charset=utf-8', + ), + ); + + $response = $this->remote_request( $endpoint, $request ); + + if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) { + if ( WP_DEBUG ) { + $this->log( $endpoint, $request, $response ); + } + + return false; + } + + $response_body = wp_remote_retrieve_body( $response ); + + if ( empty( $response_body ) ) { + return false; + } + + $response_body = json_decode( $response_body, true ); + + return ! empty( $response_body['contacts'] ); + } + + public function create_contact( $properties ) { + $endpoint = 'https://api.cc.email/v3/contacts'; + + $request = array( + 'method' => 'POST', + 'headers' => array( + 'Accept' => 'application/json', + 'Content-Type' => 'application/json; charset=utf-8', + ), + 'body' => json_encode( $properties ), + ); + + $response = $this->remote_request( $endpoint, $request ); + + if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) { + if ( WP_DEBUG ) { + $this->log( $endpoint, $request, $response ); + } + + return false; + } + } + + public function get_contact_lists() { + $endpoint = 'https://api.cc.email/v3/contact_lists'; + + $request = array( + 'method' => 'GET', + 'headers' => array( + 'Accept' => 'application/json', + 'Content-Type' => 'application/json; charset=utf-8', + ), + ); + + $response = $this->remote_request( $endpoint, $request ); + + if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) { + if ( WP_DEBUG ) { + $this->log( $endpoint, $request, $response ); + } + + return false; + } + + $response_body = wp_remote_retrieve_body( $response ); + + if ( empty( $response_body ) ) { + return false; + } + + $response_body = json_decode( $response_body, true ); + + if ( ! empty( $response_body['lists'] ) ) { + return (array) $response_body['lists']; + } else { + return array(); + } + } + + public function update_contact_lists( $selection = array() ) { + $contact_lists = array(); + $contact_lists_on_api = $this->get_contact_lists(); + + if ( false !== $contact_lists_on_api ) { + foreach ( (array) $contact_lists_on_api as $list ) { + if ( isset( $list['list_id'] ) ) { + $list_id = trim( $list['list_id'] ); + } else { + continue; + } + + if ( isset( $this->contact_lists[$list_id]['selected'] ) ) { + $list['selected'] = $this->contact_lists[$list_id]['selected']; + } else { + $list['selected'] = array(); + } + + $contact_lists[$list_id] = $list; + } + } else { + $contact_lists = $this->contact_lists; + } + + foreach ( (array) $selection as $key => $ids_or_names ) { + foreach( $contact_lists as $list_id => $list ) { + if ( in_array( $list['list_id'], (array) $ids_or_names, true ) + or in_array( $list['name'], (array) $ids_or_names, true ) ) { + $contact_lists[$list_id]['selected'][$key] = true; + } else { + unset( $contact_lists[$list_id]['selected'][$key] ); + } + } + } + + $this->contact_lists = $contact_lists; + + if ( $selection ) { + $this->save_data(); + } + + return $this->contact_lists; + } + + public function admin_notice( $message = '' ) { + switch ( $message ) { + case 'success': + echo sprintf( + '

                      %s

                      ', + esc_html( __( "Connection established.", 'contact-form-7' ) ) + ); + break; + case 'failed': + echo sprintf( + '

                      %1$s: %2$s

                      ', + esc_html( __( "ERROR", 'contact-form-7' ) ), + esc_html( __( "Failed to establish connection. Please double-check your configuration.", 'contact-form-7' ) ) + ); + break; + case 'updated': + echo sprintf( + '

                      %s

                      ', + esc_html( __( "Configuration updated.", 'contact-form-7' ) ) + ); + break; + } + } + + public function display( $action = '' ) { + echo '

                      ' . sprintf( + esc_html( __( 'The Constant Contact integration module allows you to send contact data collected through your contact forms to the Constant Contact API. You can create reliable email subscription services in a few easy steps. For details, see %s.', 'contact-form-7' ) ), + wpcf7_link( + __( + 'https://contactform7.com/constant-contact-integration/', + 'contact-form-7' + ), + __( 'Constant Contact Integration', 'contact-form-7' ) + ) + ) . '

                      '; + + if ( $this->is_active() ) { + echo sprintf( + '

                      %s

                      ', + esc_html( __( "This site is connected to the Constant Contact API.", 'contact-form-7' ) ) + ); + } + + if ( 'setup' == $action ) { + $this->display_setup(); + } else { + echo sprintf( + '

                      %2$s

                      ', + esc_url( $this->menu_page_url( 'action=setup' ) ), + esc_html( __( 'Setup Integration', 'contact-form-7' ) ) + ); + } + } + + private function display_setup() { +?> +
                      + + + + + + + + + + + + + + + + +
                      is_active() ) { + echo esc_html( $this->client_id ); + echo sprintf( + '', + esc_attr( $this->client_id ) + ); + } else { + echo sprintf( + '', + esc_attr( $this->client_id ) + ); + } + ?>
                      is_active() ) { + echo esc_html( wpcf7_mask_password( $this->client_secret ) ); + echo sprintf( + '', + esc_attr( $this->client_secret ) + ); + } else { + echo sprintf( + '', + esc_attr( $this->client_secret ) + ); + } + ?>
                      ', + $this->get_redirect_uri() + ); + ?> +

                      +
                      +is_active() ) { + submit_button( + _x( 'Reset Keys', 'API keys', 'contact-form-7' ), + 'small', 'reset' + ); + } else { + submit_button( + __( 'Connect to the Constant Contact API', 'contact-form-7' ) + ); + } +?> +
                      + +is_active() and ! empty( $this->contact_lists ) ) { +?> +
                      + + + + + + + + +
                      +
                      + +

                      +
                        contact_lists as $list ) { + echo sprintf( + '
                      • ', + wpcf7_format_atts( array( + 'type' => 'checkbox', + 'name' => 'contact_lists[]', + 'value' => $list['list_id'], + 'id' => 'contact_list_' . $list['list_id'], + 'checked' => empty( $list['selected']['default'] ) + ? '' + : 'checked', + ) ), + esc_attr( 'contact_list_' . $list['list_id'] ), + esc_html( $list['name'] ) + ); + } + ?>
                      +
                      +
                      + +
                      +set_create_source( 'Contact' ); + + $posted_data = (array) $submission->get_posted_data(); + + if ( isset( $posted_data['your-first-name'] ) ) { + $this->set_first_name( $posted_data['your-first-name'] ); + } + + if ( isset( $posted_data['your-last-name'] ) ) { + $this->set_last_name( $posted_data['your-last-name'] ); + } + + if ( ! ( $this->first_name || $this->last_name ) + and isset( $posted_data['your-name'] ) ) { + $your_name = preg_split( '/[\s]+/', $posted_data['your-name'], 2 ); + $this->set_first_name( array_shift( $your_name ) ); + $this->set_last_name( array_shift( $your_name ) ); + } + + if ( isset( $posted_data['your-email'] ) ) { + $this->set_email_address( $posted_data['your-email'], 'implicit' ); + } + + if ( isset( $posted_data['your-job-title'] ) ) { + $this->set_job_title( $posted_data['your-job-title'] ); + } + + if ( isset( $posted_data['your-company-name'] ) ) { + $this->set_company_name( $posted_data['your-company-name'] ); + } + + if ( isset( $posted_data['your-birthday-month'] ) + and isset( $posted_data['your-birthday-day'] ) ) { + $this->set_birthday( + $posted_data['your-birthday-month'], + $posted_data['your-birthday-day'] + ); + } elseif ( isset( $posted_data['your-birthday'] ) ) { + $date = trim( $posted_data['your-birthday'] ); + + if ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})$/', $date, $matches ) ) { + $this->set_birthday( $matches[2], $matches[3] ); + } + } + + if ( isset( $posted_data['your-anniversary'] ) ) { + $this->set_anniversary( $posted_data['your-anniversary'] ); + } + + if ( isset( $posted_data['your-phone-number'] ) ) { + $this->add_phone_number( $posted_data['your-phone-number'] ); + } + + $this->add_street_address( + isset( $posted_data['your-address-street'] ) + ? $posted_data['your-address-street'] : '', + isset( $posted_data['your-address-city'] ) + ? $posted_data['your-address-city'] : '', + isset( $posted_data['your-address-state'] ) + ? $posted_data['your-address-state'] : '', + isset( $posted_data['your-address-postal-code'] ) + ? $posted_data['your-address-postal-code'] : '', + isset( $posted_data['your-address-country'] ) + ? $posted_data['your-address-country'] : '' + ); + + $service_option = (array) WPCF7::get_option( 'constant_contact' ); + + $contact_lists = isset( $service_option['contact_lists'] ) + ? $service_option['contact_lists'] : array(); + + $contact_form = $submission->get_contact_form(); + + if ( $contact_form->additional_setting( 'constant_contact' ) ) { + $key = sprintf( 'wpcf7_contact_form:%d', $contact_form->id() ); + } else { + $key = 'default'; + } + + foreach ( (array) $contact_lists as $list ) { + if ( ! empty( $list['selected'][$key] ) ) { + $this->add_list_membership( $list['list_id'] ); + } + } + } + + public function is_valid() { + return $this->create_source + && ( $this->email_address || $this->first_name || $this->last_name ); + } + + public function to_array() { + $output = array( + 'email_address' => $this->email_address, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'job_title' => $this->job_title, + 'company_name' => $this->company_name, + 'create_source' => $this->create_source, + 'birthday_month' => $this->birthday_month, + 'birthday_day' => $this->birthday_day, + 'anniversary' => $this->anniversary, + 'custom_fields' => $this->custom_fields, + 'phone_numbers' => $this->phone_numbers, + 'street_addresses' => $this->street_addresses, + 'list_memberships' => $this->list_memberships, + ); + + return array_filter( $output ); + } + + public function get_email_address() { + if ( isset( $this->email_address['address'] ) ) { + return $this->email_address['address']; + } + + return ''; + } + + public function set_email_address( $address, $permission_to_send = '' ) { + if ( ! wpcf7_is_email( $address ) + or 80 < $this->strlen( $address ) ) { + return false; + } + + $types_of_permission = array( + 'implicit', 'explicit', 'deprecate', 'pending', + 'unsubscribe', 'temp_hold', 'not_set', + ); + + if ( ! in_array( $permission_to_send, $types_of_permission ) ) { + $permission_to_send = 'implicit'; + } + + return $this->email_address = array( + 'address' => $address, + 'permission_to_send' => $permission_to_send, + ); + } + + public function set_first_name( $first_name ) { + $first_name = trim( $first_name ); + + if ( empty( $first_name ) + or 50 < $this->strlen( $first_name ) ) { + return false; + } + + return $this->first_name = $first_name; + } + + public function set_last_name( $last_name ) { + $last_name = trim( $last_name ); + + if ( empty( $last_name ) + or 50 < $this->strlen( $last_name ) ) { + return false; + } + + return $this->last_name = $last_name; + } + + public function set_job_title( $job_title ) { + $job_title = trim( $job_title ); + + if ( empty( $job_title ) + or 50 < $this->strlen( $job_title ) ) { + return false; + } + + return $this->job_title = $job_title; + } + + public function set_company_name( $company_name ) { + $company_name = trim( $company_name ); + + if ( empty( $company_name ) + or 50 < $this->strlen( $company_name ) ) { + return false; + } + + return $this->company_name = $company_name; + } + + public function set_create_source( $create_source ) { + if ( ! in_array( $create_source, array( 'Contact', 'Account' ) ) ) { + return false; + } + + return $this->create_source = $create_source; + } + + public function set_birthday( $month, $day ) { + $month = (int) $month; + $day = (int) $day; + + if ( $month < 1 || 12 < $month + or $day < 1 || 31 < $day ) { + return false; + } + + $this->birthday_month = $month; + $this->birthday_day = $day; + + return array( $this->birthday_month, $this->birthday_day ); + } + + public function set_anniversary( $anniversary ) { + $pattern = sprintf( + '#^(%s)$#', + implode( '|', array( + '\d{1,2}/\d{1,2}/\d{4}', + '\d{4}/\d{1,2}/\d{1,2}', + '\d{4}-\d{1,2}-\d{1,2}', + '\d{1,2}-\d{1,2}-\d{4}', + ) ) + ); + + if ( ! preg_match( $pattern, $anniversary ) ) { + return false; + } + + return $this->anniversary = $anniversary; + } + + public function add_custom_field( $custom_field_id, $value ) { + $uuid_pattern = '/^[0-9a-f-]+$/i'; + + $value = trim( $value ); + + if ( 25 <= count( $this->custom_fields ) + or ! preg_match( $uuid_pattern, $custom_field_id ) + or 255 < $this->strlen( $value ) ) { + return false; + } + + return $this->custom_fields[] = array( + 'custom_field_id' => $custom_field_id, + 'value' => $value, + ); + } + + public function add_phone_number( $phone_number, $kind = 'home' ) { + $phone_number = trim( $phone_number ); + + if ( 2 <= count( $this->phone_numbers ) + or ! wpcf7_is_tel( $phone_number ) + or 25 < $this->strlen( $phone_number ) + or ! in_array( $kind, array( 'home', 'work', 'other' ) ) ) { + return false; + } + + return $this->phone_numbers[] = array( + 'phone_number' => $phone_number, + 'kind' => $kind, + ); + } + + public function add_street_address( $street, $city, $state, $postal_code, $country, $kind = 'home' ) { + $street = trim( $street ); + $city = trim( $city ); + $state = trim( $state ); + $postal_code = trim( $postal_code ); + $country = trim( $country ); + + if ( ! ( $street || $city || $state || $postal_code || $country ) + or 1 <= count( $this->street_addresses ) + or ! in_array( $kind, array( 'home', 'work', 'other' ) ) + or 255 < $this->strlen( $street ) + or 50 < $this->strlen( $city ) + or 50 < $this->strlen( $state ) + or 50 < $this->strlen( $postal_code ) + or 50 < $this->strlen( $country ) ) { + return false; + } + + return $this->street_addresses[] = array( + 'kind' => $kind, + 'street' => $street, + 'city' => $city, + 'state' => $state, + 'postal_code' => $postal_code, + 'country' => $country, + ); + } + + public function add_list_membership( $list_id ) { + $uuid_pattern = '/^[0-9a-f-]+$/i'; + + if ( 50 <= count( $this->list_memberships ) + or ! preg_match( $uuid_pattern, $list_id ) ) { + return false; + } + + return $this->list_memberships[] = $list_id; + } + + protected function strlen( $string ) { + return wpcf7_count_code_units( stripslashes( $string ) ); + } + +} diff --git a/wp-content/plugins/contact-form-7/modules/count.php b/wp-content/plugins/contact-form-7/modules/count.php new file mode 100644 index 0000000..878585f --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/count.php @@ -0,0 +1,65 @@ + true, + 'zero-controls-container' => true, + 'not-for-mail' => true, + ) + ); +} + +function wpcf7_count_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $targets = wpcf7_scan_form_tags( array( 'name' => $tag->name ) ); + $maxlength = $minlength = null; + + while ( $targets ) { + $target = array_shift( $targets ); + + if ( 'count' != $target->type ) { + $maxlength = $target->get_maxlength_option(); + $minlength = $target->get_minlength_option(); + break; + } + } + + if ( $maxlength and $minlength + and $maxlength < $minlength ) { + $maxlength = $minlength = null; + } + + if ( $tag->has_option( 'down' ) ) { + $value = (int) $maxlength; + $class = 'wpcf7-character-count down'; + } else { + $value = '0'; + $class = 'wpcf7-character-count up'; + } + + $atts = array(); + $atts['id'] = $tag->get_id_option(); + $atts['class'] = $tag->get_class_option( $class ); + $atts['data-target-name'] = $tag->name; + $atts['data-starting-value'] = $value; + $atts['data-current-value'] = $value; + $atts['data-maximum-value'] = $maxlength; + $atts['data-minimum-value'] = $minlength; + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( '%2$s', $atts, $value ); + + return $html; +} diff --git a/wp-content/plugins/contact-form-7/modules/date.php b/wp-content/plugins/contact-form-7/modules/date.php new file mode 100644 index 0000000..0161d78 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/date.php @@ -0,0 +1,225 @@ + true ) ); +} + +function wpcf7_date_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + $class .= ' wpcf7-validates-as-date'; + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + $atts['min'] = $tag->get_date_option( 'min' ); + $atts['max'] = $tag->get_date_option( 'max' ); + $atts['step'] = $tag->get_option( 'step', 'int', true ); + + if ( $tag->has_option( 'readonly' ) ) { + $atts['readonly'] = 'readonly'; + } + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $value = (string) reset( $tag->values ); + + if ( $tag->has_option( 'placeholder' ) + or $tag->has_option( 'watermark' ) ) { + $atts['placeholder'] = $value; + $value = ''; + } + + $value = $tag->get_default_option( $value ); + + $value = wpcf7_get_hangover( $tag->name, $value ); + + $atts['value'] = $value; + + if ( wpcf7_support_html5() ) { + $atts['type'] = $tag->basetype; + } else { + $atts['type'] = 'text'; + } + + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s', + sanitize_html_class( $tag->name ), $atts, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_date', 'wpcf7_date_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_date*', 'wpcf7_date_validation_filter', 10, 2 ); + +function wpcf7_date_validation_filter( $result, $tag ) { + $name = $tag->name; + + $min = $tag->get_date_option( 'min' ); + $max = $tag->get_date_option( 'max' ); + + $value = isset( $_POST[$name] ) + ? trim( strtr( (string) $_POST[$name], "\n", " " ) ) + : ''; + + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } elseif ( '' != $value and ! wpcf7_is_date( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_date' ) ); + } elseif ( '' != $value and ! empty( $min ) and $value < $min ) { + $result->invalidate( $tag, wpcf7_get_message( 'date_too_early' ) ); + } elseif ( '' != $value and ! empty( $max ) and $max < $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'date_too_late' ) ); + } + + return $result; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_date_messages', 10, 1 ); + +function wpcf7_date_messages( $messages ) { + return array_merge( $messages, array( + 'invalid_date' => array( + 'description' => __( "Date format that the sender entered is invalid", 'contact-form-7' ), + 'default' => __( "The date format is incorrect.", 'contact-form-7' ) + ), + + 'date_too_early' => array( + 'description' => __( "Date is earlier than minimum limit", 'contact-form-7' ), + 'default' => __( "The date is before the earliest one allowed.", 'contact-form-7' ) + ), + + 'date_too_late' => array( + 'description' => __( "Date is later than maximum limit", 'contact-form-7' ), + 'default' => __( "The date is after the latest one allowed.", 'contact-form-7' ) + ), + ) ); +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_date', 19, 0 ); + +function wpcf7_add_tag_generator_date() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'date', __( 'date', 'contact-form-7' ), + 'wpcf7_tag_generator_date' ); +} + +function wpcf7_tag_generator_date( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'date'; + + $description = __( "Generate a form-tag for a date input field. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/date-field/', 'contact-form-7' ), __( 'Date Field', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +

                      +
                      +
                      + + + – + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      ' ); ?>

                      +
                      + true ) ); +} + +function wpcf7_file_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['size'] = $tag->get_size_option( '40' ); + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + + $atts['accept'] = wpcf7_acceptable_filetypes( + $tag->get_option( 'filetypes' ), 'attr' ); + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $atts['type'] = 'file'; + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s', + sanitize_html_class( $tag->name ), $atts, $validation_error ); + + return $html; +} + + +/* Encode type filter */ + +add_filter( 'wpcf7_form_enctype', 'wpcf7_file_form_enctype_filter', 10, 1 ); + +function wpcf7_file_form_enctype_filter( $enctype ) { + $multipart = (bool) wpcf7_scan_form_tags( + array( 'type' => array( 'file', 'file*' ) ) ); + + if ( $multipart ) { + $enctype = 'multipart/form-data'; + } + + return $enctype; +} + + +/* Validation + upload handling filter */ + +add_filter( 'wpcf7_validate_file', 'wpcf7_file_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_file*', 'wpcf7_file_validation_filter', 10, 2 ); + +function wpcf7_file_validation_filter( $result, $tag ) { + $name = $tag->name; + $id = $tag->get_id_option(); + + $file = isset( $_FILES[$name] ) ? $_FILES[$name] : null; + + if ( $file['error'] and UPLOAD_ERR_NO_FILE != $file['error'] ) { + $result->invalidate( $tag, wpcf7_get_message( 'upload_failed_php_error' ) ); + return $result; + } + + if ( empty( $file['tmp_name'] ) and $tag->is_required() ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + return $result; + } + + if ( ! is_uploaded_file( $file['tmp_name'] ) ) { + return $result; + } + + /* File type validation */ + + $file_type_pattern = wpcf7_acceptable_filetypes( + $tag->get_option( 'filetypes' ), 'regex' ); + + $file_type_pattern = '/\.(' . $file_type_pattern . ')$/i'; + + if ( ! preg_match( $file_type_pattern, $file['name'] ) ) { + $result->invalidate( $tag, + wpcf7_get_message( 'upload_file_type_invalid' ) ); + return $result; + } + + /* File size validation */ + + $allowed_size = 1048576; // default size 1 MB + + if ( $file_size_a = $tag->get_option( 'limit' ) ) { + $limit_pattern = '/^([1-9][0-9]*)([kKmM]?[bB])?$/'; + + foreach ( $file_size_a as $file_size ) { + if ( preg_match( $limit_pattern, $file_size, $matches ) ) { + $allowed_size = (int) $matches[1]; + + if ( ! empty( $matches[2] ) ) { + $kbmb = strtolower( $matches[2] ); + + if ( 'kb' == $kbmb ) { + $allowed_size *= 1024; + } elseif ( 'mb' == $kbmb ) { + $allowed_size *= 1024 * 1024; + } + } + + break; + } + } + } + + if ( $file['size'] > $allowed_size ) { + $result->invalidate( $tag, wpcf7_get_message( 'upload_file_too_large' ) ); + return $result; + } + + wpcf7_init_uploads(); // Confirm upload dir + $uploads_dir = wpcf7_upload_tmp_dir(); + $uploads_dir = wpcf7_maybe_add_random_dir( $uploads_dir ); + + $filename = $file['name']; + $filename = wpcf7_canonicalize( $filename, 'as-is' ); + $filename = wpcf7_antiscript_file_name( $filename ); + + $filename = apply_filters( 'wpcf7_upload_file_name', $filename, + $file['name'], $tag ); + + $filename = wp_unique_filename( $uploads_dir, $filename ); + $new_file = path_join( $uploads_dir, $filename ); + + if ( false === @move_uploaded_file( $file['tmp_name'], $new_file ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'upload_failed' ) ); + return $result; + } + + // Make sure the uploaded file is only readable for the owner process + chmod( $new_file, 0400 ); + + if ( $submission = WPCF7_Submission::get_instance() ) { + $submission->add_uploaded_file( $name, $new_file ); + } + + return $result; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_file_messages', 10, 1 ); + +function wpcf7_file_messages( $messages ) { + return array_merge( $messages, array( + 'upload_failed' => array( + 'description' => __( "Uploading a file fails for any reason", 'contact-form-7' ), + 'default' => __( "There was an unknown error uploading the file.", 'contact-form-7' ) + ), + + 'upload_file_type_invalid' => array( + 'description' => __( "Uploaded file is not allowed for file type", 'contact-form-7' ), + 'default' => __( "You are not allowed to upload files of this type.", 'contact-form-7' ) + ), + + 'upload_file_too_large' => array( + 'description' => __( "Uploaded file is too large", 'contact-form-7' ), + 'default' => __( "The file is too big.", 'contact-form-7' ) + ), + + 'upload_failed_php_error' => array( + 'description' => __( "Uploading a file fails for PHP error", 'contact-form-7' ), + 'default' => __( "There was an error uploading the file.", 'contact-form-7' ) + ) + ) ); +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_file', 50, 0 ); + +function wpcf7_add_tag_generator_file() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'file', __( 'file', 'contact-form-7' ), + 'wpcf7_tag_generator_file' ); +} + +function wpcf7_tag_generator_file( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'file'; + + $description = __( "Generate a form-tag for a file uploading field. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/file-uploading-and-attachment/', 'contact-form-7' ), __( 'File Uploading and Attachment', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      +
                      +scan_form_tags( + array( 'type' => array( 'file', 'file*' ) ) ); + + if ( ! $has_tags ) { + return; + } + + $uploads_dir = wpcf7_upload_tmp_dir(); + wpcf7_init_uploads(); + + if ( ! is_dir( $uploads_dir ) + or ! wp_is_writable( $uploads_dir ) ) { + $message = sprintf( __( 'This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), $uploads_dir ); + + echo sprintf( '

                      %s

                      ', + esc_html( $message ) ); + } +} + + +/* File uploading functions */ + +function wpcf7_acceptable_filetypes( $types = 'default', $format = 'regex' ) { + if ( 'default' === $types + or empty( $types ) ) { + $types = array( + 'jpg', + 'jpeg', + 'png', + 'gif', + 'pdf', + 'doc', + 'docx', + 'ppt', + 'pptx', + 'odt', + 'avi', + 'ogg', + 'm4a', + 'mov', + 'mp3', + 'mp4', + 'mpg', + 'wav', + 'wmv', + ); + } else { + $types_tmp = (array) $types; + $types = array(); + + foreach ( $types_tmp as $val ) { + if ( is_string( $val ) ) { + $val = preg_split( '/[\s|,]+/', $val ); + } + + $types = array_merge( $types, (array) $val ); + } + } + + $types = array_unique( array_filter( $types ) ); + + $output = ''; + + foreach ( $types as $type ) { + $type = trim( $type, ' ,.|' ); + $type = str_replace( + array( '.', '+', '*', '?' ), + array( '\.', '\+', '\*', '\?' ), + $type ); + + if ( '' === $type ) { + continue; + } + + if ( 'attr' === $format + or 'attribute' === $format ) { + $output .= sprintf( '.%s', $type ); + $output .= ','; + } else { + $output .= $type; + $output .= '|'; + } + } + + return trim( $output, ' ,|' ); +} + +function wpcf7_init_uploads() { + $dir = wpcf7_upload_tmp_dir(); + wp_mkdir_p( $dir ); + + $htaccess_file = path_join( $dir, '.htaccess' ); + + if ( file_exists( $htaccess_file ) ) { + return; + } + + if ( $handle = fopen( $htaccess_file, 'w' ) ) { + fwrite( $handle, "Deny from all\n" ); + fclose( $handle ); + } +} + +function wpcf7_maybe_add_random_dir( $dir ) { + do { + $rand_max = mt_getrandmax(); + $rand = zeroise( mt_rand( 0, $rand_max ), strlen( $rand_max ) ); + $dir_new = path_join( $dir, $rand ); + } while ( file_exists( $dir_new ) ); + + if ( wp_mkdir_p( $dir_new ) ) { + return $dir_new; + } + + return $dir; +} + +function wpcf7_upload_tmp_dir() { + if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) ) { + return WPCF7_UPLOADS_TMP_DIR; + } else { + return path_join( wpcf7_upload_dir( 'dir' ), 'wpcf7_uploads' ); + } +} + +add_action( 'template_redirect', 'wpcf7_cleanup_upload_files', 20, 0 ); + +function wpcf7_cleanup_upload_files( $seconds = 60, $max = 100 ) { + if ( is_admin() + or 'GET' != $_SERVER['REQUEST_METHOD'] + or is_robots() + or is_feed() + or is_trackback() ) { + return; + } + + $dir = trailingslashit( wpcf7_upload_tmp_dir() ); + + if ( ! is_dir( $dir ) + or ! is_readable( $dir ) + or ! wp_is_writable( $dir ) ) { + return; + } + + $seconds = absint( $seconds ); + $max = absint( $max ); + $count = 0; + + if ( $handle = opendir( $dir ) ) { + while ( false !== ( $file = readdir( $handle ) ) ) { + if ( '.' == $file + or '..' == $file + or '.htaccess' == $file ) { + continue; + } + + $mtime = @filemtime( path_join( $dir, $file ) ); + + if ( $mtime and time() < $mtime + $seconds ) { // less than $seconds old + continue; + } + + wpcf7_rmdir_p( path_join( $dir, $file ) ); + $count += 1; + + if ( $max <= $count ) { + break; + } + } + + closedir( $handle ); + } +} diff --git a/wp-content/plugins/contact-form-7/modules/flamingo.php b/wp-content/plugins/contact-form-7/modules/flamingo.php new file mode 100644 index 0000000..de1e9e1 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/flamingo.php @@ -0,0 +1,278 @@ +in_demo_mode() ) { + return; + } + + $cases = (array) apply_filters( 'wpcf7_flamingo_submit_if', + array( 'spam', 'mail_sent', 'mail_failed' ) ); + + if ( empty( $result['status'] ) + or ! in_array( $result['status'], $cases ) ) { + return; + } + + $submission = WPCF7_Submission::get_instance(); + + if ( ! $submission + or ! $posted_data = $submission->get_posted_data() ) { + return; + } + + if ( $submission->get_meta( 'do_not_store' ) ) { + return; + } + + $fields_senseless = + $contact_form->scan_form_tags( array( 'feature' => 'do-not-store' ) ); + + $exclude_names = array(); + + foreach ( $fields_senseless as $tag ) { + $exclude_names[] = $tag['name']; + } + + $exclude_names[] = 'g-recaptcha-response'; + + foreach ( $posted_data as $key => $value ) { + if ( '_' == substr( $key, 0, 1 ) + or in_array( $key, $exclude_names ) ) { + unset( $posted_data[$key] ); + } + } + + $email = wpcf7_flamingo_get_value( 'email', $contact_form ); + $name = wpcf7_flamingo_get_value( 'name', $contact_form ); + $subject = wpcf7_flamingo_get_value( 'subject', $contact_form ); + + $meta = array(); + + $special_mail_tags = array( 'serial_number', 'remote_ip', + 'user_agent', 'url', 'date', 'time', 'post_id', 'post_name', + 'post_title', 'post_url', 'post_author', 'post_author_email', + 'site_title', 'site_description', 'site_url', 'site_admin_email', + 'user_login', 'user_email', 'user_display_name' ); + + foreach ( $special_mail_tags as $smt ) { + $meta[$smt] = apply_filters( 'wpcf7_special_mail_tags', '', + sprintf( '_%s', $smt ), false ); + } + + $akismet = isset( $submission->akismet ) + ? (array) $submission->akismet : null; + + if ( 'mail_sent' == $result['status'] ) { + $flamingo_contact = Flamingo_Contact::add( array( + 'email' => $email, + 'name' => $name, + ) ); + } + + $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); + + $channel_id = isset( $post_meta['channel'] ) + ? (int) $post_meta['channel'] + : wpcf7_flamingo_add_channel( + $contact_form->name(), $contact_form->title() ); + + if ( $channel_id ) { + if ( ! isset( $post_meta['channel'] ) + or $post_meta['channel'] !== $channel_id ) { + $post_meta = empty( $post_meta ) ? array() : (array) $post_meta; + $post_meta = array_merge( $post_meta, array( + 'channel' => $channel_id, + ) ); + + update_post_meta( $contact_form->id(), '_flamingo', $post_meta ); + } + + $channel = get_term( $channel_id, + Flamingo_Inbound_Message::channel_taxonomy ); + + if ( ! $channel or is_wp_error( $channel ) ) { + $channel = 'contact-form-7'; + } else { + $channel = $channel->slug; + } + } else { + $channel = 'contact-form-7'; + } + + $args = array( + 'channel' => $channel, + 'subject' => $subject, + 'from' => trim( sprintf( '%s <%s>', $name, $email ) ), + 'from_name' => $name, + 'from_email' => $email, + 'fields' => $posted_data, + 'meta' => $meta, + 'akismet' => $akismet, + 'spam' => ( 'spam' == $result['status'] ), + 'consent' => $submission->collect_consent(), + ); + + if ( $args['spam'] ) { + $args['spam_log'] = $submission->get_spam_log(); + } + + if ( isset( $submission->recaptcha ) ) { + $args['recaptcha'] = $submission->recaptcha; + } + + $flamingo_inbound = Flamingo_Inbound_Message::add( $args ); + + $result += array( + 'flamingo_contact_id' => + empty( $flamingo_contact ) ? 0 : absint( $flamingo_contact->id ), + 'flamingo_inbound_id' => + empty( $flamingo_inbound ) ? 0 : absint( $flamingo_inbound->id ), + ); + + do_action( 'wpcf7_after_flamingo', $result ); +} + +function wpcf7_flamingo_get_value( $field, $contact_form ) { + if ( empty( $field ) + or empty( $contact_form ) ) { + return false; + } + + $value = ''; + + if ( in_array( $field, array( 'email', 'name', 'subject' ) ) ) { + $templates = $contact_form->additional_setting( 'flamingo_' . $field ); + + if ( empty( $templates[0] ) ) { + $template = sprintf( '[your-%s]', $field ); + } else { + $template = trim( wpcf7_strip_quote( $templates[0] ) ); + } + + $value = wpcf7_mail_replace_tags( $template ); + } + + $value = apply_filters( 'wpcf7_flamingo_get_value', $value, + $field, $contact_form ); + + return $value; +} + +function wpcf7_flamingo_add_channel( $slug, $name = '' ) { + if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) { + return false; + } + + $parent = term_exists( 'contact-form-7', + Flamingo_Inbound_Message::channel_taxonomy ); + + if ( ! $parent ) { + $parent = wp_insert_term( __( 'Contact Form 7', 'contact-form-7' ), + Flamingo_Inbound_Message::channel_taxonomy, + array( 'slug' => 'contact-form-7' ) ); + + if ( is_wp_error( $parent ) ) { + return false; + } + } + + $parent = (int) $parent['term_id']; + + if ( ! is_taxonomy_hierarchical( Flamingo_Inbound_Message::channel_taxonomy ) ) { + // backward compat for Flamingo 1.0.4 and lower + return $parent; + } + + if ( empty( $name ) ) { + $name = $slug; + } + + $channel = term_exists( $slug, + Flamingo_Inbound_Message::channel_taxonomy, + $parent ); + + if ( ! $channel ) { + $channel = wp_insert_term( $name, + Flamingo_Inbound_Message::channel_taxonomy, + array( 'slug' => $slug, 'parent' => $parent ) ); + + if ( is_wp_error( $channel ) ) { + return false; + } + } + + return (int) $channel['term_id']; +} + +add_action( 'wpcf7_after_update', 'wpcf7_flamingo_update_channel', 10, 1 ); + +function wpcf7_flamingo_update_channel( $contact_form ) { + if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) { + return false; + } + + $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); + + $channel = isset( $post_meta['channel'] ) + ? get_term( $post_meta['channel'], + Flamingo_Inbound_Message::channel_taxonomy ) + : get_term_by( 'slug', $contact_form->name(), + Flamingo_Inbound_Message::channel_taxonomy ); + + if ( ! $channel or is_wp_error( $channel ) ) { + return; + } + + if ( $channel->name !== wp_unslash( $contact_form->title() ) ) { + wp_update_term( $channel->term_id, + Flamingo_Inbound_Message::channel_taxonomy, + array( + 'name' => $contact_form->title(), + 'slug' => $contact_form->name(), + 'parent' => $channel->parent, + ) + ); + } +} + +add_filter( 'wpcf7_special_mail_tags', 'wpcf7_flamingo_serial_number', 10, 3 ); + +function wpcf7_flamingo_serial_number( $output, $name, $html ) { + if ( '_serial_number' != $name ) { + return $output; + } + + if ( ! class_exists( 'Flamingo_Inbound_Message' ) + or ! method_exists( 'Flamingo_Inbound_Message', 'count' ) ) { + return $output; + } + + if ( ! $contact_form = WPCF7_ContactForm::get_current() ) { + return $output; + } + + $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); + + $channel_id = isset( $post_meta['channel'] ) + ? (int) $post_meta['channel'] + : wpcf7_flamingo_add_channel( + $contact_form->name(), $contact_form->title() ); + + if ( $channel_id ) { + return 1 + (int) Flamingo_Inbound_Message::count( + array( 'channel_id' => $channel_id ) ); + } + + return 0; +} diff --git a/wp-content/plugins/contact-form-7/modules/hidden.php b/wp-content/plugins/contact-form-7/modules/hidden.php new file mode 100644 index 0000000..d927559 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/hidden.php @@ -0,0 +1,36 @@ + true, + 'display-hidden' => true, + ) + ); +} + +function wpcf7_hidden_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $atts = array(); + + $class = wpcf7_form_controls_class( $tag->type ); + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + + $value = (string) reset( $tag->values ); + $value = $tag->get_default_option( $value ); + $atts['value'] = $value; + + $atts['type'] = 'hidden'; + $atts['name'] = $tag->name; + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( '', $atts ); + return $html; +} diff --git a/wp-content/plugins/contact-form-7/modules/listo.php b/wp-content/plugins/contact-form-7/modules/listo.php new file mode 100644 index 0000000..eabfb7f --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/listo.php @@ -0,0 +1,30 @@ +locale(); + + foreach ( (array) $options as $option ) { + $option = explode( '.', $option ); + $type = $option[0]; + $args['group'] = isset( $option[1] ) ? $option[1] : null; + + if ( $list = listo( $type, $args ) ) { + $data = array_merge( (array) $data, $list ); + } + } + + return $data; +} diff --git a/wp-content/plugins/contact-form-7/modules/number.php b/wp-content/plugins/contact-form-7/modules/number.php new file mode 100644 index 0000000..0285bc5 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/number.php @@ -0,0 +1,233 @@ + true ) ); +} + +function wpcf7_number_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + $class .= ' wpcf7-validates-as-number'; + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + $atts['min'] = $tag->get_option( 'min', 'signed_int', true ); + $atts['max'] = $tag->get_option( 'max', 'signed_int', true ); + $atts['step'] = $tag->get_option( 'step', 'int', true ); + + if ( $tag->has_option( 'readonly' ) ) { + $atts['readonly'] = 'readonly'; + } + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $value = (string) reset( $tag->values ); + + if ( $tag->has_option( 'placeholder' ) + or $tag->has_option( 'watermark' ) ) { + $atts['placeholder'] = $value; + $value = ''; + } + + $value = $tag->get_default_option( $value ); + + $value = wpcf7_get_hangover( $tag->name, $value ); + + $atts['value'] = $value; + + if ( wpcf7_support_html5() ) { + $atts['type'] = $tag->basetype; + } else { + $atts['type'] = 'text'; + } + + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s', + sanitize_html_class( $tag->name ), $atts, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_number', 'wpcf7_number_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_number*', 'wpcf7_number_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_range', 'wpcf7_number_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_range*', 'wpcf7_number_validation_filter', 10, 2 ); + +function wpcf7_number_validation_filter( $result, $tag ) { + $name = $tag->name; + + $value = isset( $_POST[$name] ) + ? trim( strtr( (string) $_POST[$name], "\n", " " ) ) + : ''; + + $min = $tag->get_option( 'min', 'signed_int', true ); + $max = $tag->get_option( 'max', 'signed_int', true ); + + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } elseif ( '' != $value and ! wpcf7_is_number( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_number' ) ); + } elseif ( '' != $value and '' != $min and (float) $value < (float) $min ) { + $result->invalidate( $tag, wpcf7_get_message( 'number_too_small' ) ); + } elseif ( '' != $value and '' != $max and (float) $max < (float) $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'number_too_large' ) ); + } + + return $result; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_number_messages', 10, 1 ); + +function wpcf7_number_messages( $messages ) { + return array_merge( $messages, array( + 'invalid_number' => array( + 'description' => __( "Number format that the sender entered is invalid", 'contact-form-7' ), + 'default' => __( "The number format is invalid.", 'contact-form-7' ) + ), + + 'number_too_small' => array( + 'description' => __( "Number is smaller than minimum limit", 'contact-form-7' ), + 'default' => __( "The number is smaller than the minimum allowed.", 'contact-form-7' ) + ), + + 'number_too_large' => array( + 'description' => __( "Number is larger than maximum limit", 'contact-form-7' ), + 'default' => __( "The number is larger than the maximum allowed.", 'contact-form-7' ) + ), + ) ); +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_number', 18, 0 ); + +function wpcf7_add_tag_generator_number() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'number', __( 'number', 'contact-form-7' ), + 'wpcf7_tag_generator_number' ); +} + +function wpcf7_tag_generator_number( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'number'; + + $description = __( "Generate a form-tag for a field for numeric value input. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/number-fields/', 'contact-form-7' ), __( 'Number Fields', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      + +
                      +

                      +
                      +
                      + + + – + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      +
                      + true, + 'do-not-store' => true, + 'not-for-mail' => true, + ) + ); +} + +function wpcf7_quiz_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['size'] = $tag->get_size_option( '40' ); + $atts['maxlength'] = $tag->get_maxlength_option(); + $atts['minlength'] = $tag->get_minlength_option(); + + if ( $atts['maxlength'] and $atts['minlength'] + and $atts['maxlength'] < $atts['minlength'] ) { + unset( $atts['maxlength'], $atts['minlength'] ); + } + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + $atts['autocomplete'] = 'off'; + $atts['aria-required'] = 'true'; + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $pipes = $tag->pipes; + + if ( $pipes instanceof WPCF7_Pipes + and ! $pipes->zero() ) { + $pipe = $pipes->random_pipe(); + $question = $pipe->before; + $answer = $pipe->after; + } else { + // default quiz + $question = '1+1=?'; + $answer = '2'; + } + + $answer = wpcf7_canonicalize( $answer ); + + $atts['type'] = 'text'; + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%6$s', + sanitize_html_class( $tag->name ), + esc_html( $question ), $atts, $tag->name, + wp_hash( $answer, 'wpcf7_quiz' ), $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 ); + +function wpcf7_quiz_validation_filter( $result, $tag ) { + $name = $tag->name; + + $answer = isset( $_POST[$name] ) ? wpcf7_canonicalize( $_POST[$name] ) : ''; + $answer = wp_unslash( $answer ); + + $answer_hash = wp_hash( $answer, 'wpcf7_quiz' ); + + $expected_hash = isset( $_POST['_wpcf7_quiz_answer_' . $name] ) + ? (string) $_POST['_wpcf7_quiz_answer_' . $name] + : ''; + + if ( $answer_hash != $expected_hash ) { + $result->invalidate( $tag, wpcf7_get_message( 'quiz_answer_not_correct' ) ); + } + + return $result; +} + + +/* Ajax echo filter */ + +add_filter( 'wpcf7_ajax_onload', 'wpcf7_quiz_ajax_refill', 10, 1 ); +add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_quiz_ajax_refill', 10, 1 ); + +function wpcf7_quiz_ajax_refill( $items ) { + if ( ! is_array( $items ) ) { + return $items; + } + + $fes = wpcf7_scan_form_tags( array( 'type' => 'quiz' ) ); + + if ( empty( $fes ) ) { + return $items; + } + + $refill = array(); + + foreach ( $fes as $fe ) { + $name = $fe['name']; + $pipes = $fe['pipes']; + + if ( empty( $name ) ) { + continue; + } + + if ( $pipes instanceof WPCF7_Pipes + and ! $pipes->zero() ) { + $pipe = $pipes->random_pipe(); + $question = $pipe->before; + $answer = $pipe->after; + } else { + // default quiz + $question = '1+1=?'; + $answer = '2'; + } + + $answer = wpcf7_canonicalize( $answer ); + + $refill[$name] = array( $question, wp_hash( $answer, 'wpcf7_quiz' ) ); + } + + if ( ! empty( $refill ) ) { + $items['quiz'] = $refill; + } + + return $items; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 ); + +function wpcf7_quiz_messages( $messages ) { + $messages = array_merge( $messages, array( + 'quiz_answer_not_correct' => array( + 'description' => + __( "Sender doesn't enter the correct answer to the quiz", 'contact-form-7' ), + 'default' => + __( "The answer to the quiz is incorrect.", 'contact-form-7' ), + ), + ) ); + + return $messages; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_quiz', 40, 0 ); + +function wpcf7_add_tag_generator_quiz() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'quiz', __( 'quiz', 'contact-form-7' ), + 'wpcf7_tag_generator_quiz' ); +} + +function wpcf7_tag_generator_quiz( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'quiz'; + + $description = __( "Generate a form-tag for a question-answer pair. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/quiz/', 'contact-form-7' ), __( 'Quiz', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + +
                      + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      +
                      + true, + 'zero-controls-container' => true, + 'not-for-mail' => true, + ) + ); + + // CAPTCHA-Response (input) + wpcf7_add_form_tag( 'captchar', + 'wpcf7_captchar_form_tag_handler', + array( + 'name-attr' => true, + 'do-not-store' => true, + 'not-for-mail' => true, + ) + ); +} + +function wpcf7_captchac_form_tag_handler( $tag ) { + if ( ! class_exists( 'ReallySimpleCaptcha' ) ) { + $error = sprintf( + /* translators: %s: link labeled 'Really Simple CAPTCHA' */ + esc_html( __( "To use CAPTCHA, you need %s plugin installed.", 'contact-form-7' ) ), + wpcf7_link( 'https://wordpress.org/plugins/really-simple-captcha/', 'Really Simple CAPTCHA' ) ); + + return sprintf( '%s', $error ); + } + + if ( empty( $tag->name ) ) { + return ''; + } + + $class = wpcf7_form_controls_class( $tag->type ); + $class .= ' wpcf7-captcha-' . $tag->name; + + $atts = array(); + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + + $op = array( // Default + 'img_size' => array( 72, 24 ), + 'base' => array( 6, 18 ), + 'font_size' => 14, + 'font_char_width' => 15, + ); + + $op = array_merge( $op, wpcf7_captchac_options( $tag->options ) ); + + if ( ! $filename = wpcf7_generate_captcha( $op ) ) { + return ''; + } + + if ( ! empty( $op['img_size'] ) ) { + if ( isset( $op['img_size'][0] ) ) { + $atts['width'] = $op['img_size'][0]; + } + + if ( isset( $op['img_size'][1] ) ) { + $atts['height'] = $op['img_size'][1]; + } + } + + $atts['alt'] = 'captcha'; + $atts['src'] = wpcf7_captcha_url( $filename ); + + $atts = wpcf7_format_atts( $atts ); + + $prefix = substr( $filename, 0, strrpos( $filename, '.' ) ); + + $html = sprintf( + '', + $tag->name, esc_attr( $prefix ), $atts ); + + return $html; +} + +function wpcf7_captchar_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['size'] = $tag->get_size_option( '40' ); + $atts['maxlength'] = $tag->get_maxlength_option(); + $atts['minlength'] = $tag->get_minlength_option(); + + if ( $atts['maxlength'] and $atts['minlength'] + and $atts['maxlength'] < $atts['minlength'] ) { + unset( $atts['maxlength'], $atts['minlength'] ); + } + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + $atts['autocomplete'] = 'off'; + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $value = (string) reset( $tag->values ); + + if ( wpcf7_is_posted() ) { + $value = ''; + } + + if ( $tag->has_option( 'placeholder' ) + or $tag->has_option( 'watermark' ) ) { + $atts['placeholder'] = $value; + $value = ''; + } + + $atts['value'] = $value; + $atts['type'] = 'text'; + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s', + sanitize_html_class( $tag->name ), $atts, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_captchar', + 'wpcf7_captcha_validation_filter', 10, 2 ); + +function wpcf7_captcha_validation_filter( $result, $tag ) { + $type = $tag->type; + $name = $tag->name; + + $captchac = '_wpcf7_captcha_challenge_' . $name; + + $prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : ''; + $response = isset( $_POST[$name] ) ? (string) $_POST[$name] : ''; + $response = wpcf7_canonicalize( $response ); + + if ( 0 == strlen( $prefix ) + or ! wpcf7_check_captcha( $prefix, $response ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) ); + } + + if ( 0 != strlen( $prefix ) ) { + wpcf7_remove_captcha( $prefix ); + } + + return $result; +} + + +/* Ajax echo filter */ + +add_filter( 'wpcf7_ajax_onload', 'wpcf7_captcha_ajax_refill', 10, 1 ); +add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_captcha_ajax_refill', 10, 1 ); + +function wpcf7_captcha_ajax_refill( $items ) { + if ( ! is_array( $items ) ) { + return $items; + } + + $tags = wpcf7_scan_form_tags( array( 'type' => 'captchac' ) ); + + if ( empty( $tags ) ) { + return $items; + } + + $refill = array(); + + foreach ( $tags as $tag ) { + $name = $tag->name; + $options = $tag->options; + + if ( empty( $name ) ) { + continue; + } + + $op = wpcf7_captchac_options( $options ); + + if ( $filename = wpcf7_generate_captcha( $op ) ) { + $captcha_url = wpcf7_captcha_url( $filename ); + $refill[$name] = $captcha_url; + } + } + + if ( ! empty( $refill ) ) { + $items['captcha'] = $refill; + } + + return $items; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_captcha_messages', 10, 1 ); + +function wpcf7_captcha_messages( $messages ) { + $messages = array_merge( $messages, array( + 'captcha_not_match' => array( + 'description' => + __( "The code that sender entered does not match the CAPTCHA", 'contact-form-7' ), + 'default' => + __( 'Your entered code is incorrect.', 'contact-form-7' ), + ), + ) ); + + return $messages; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_captcha', 46, 0 ); + +function wpcf7_add_tag_generator_captcha() { + if ( ! wpcf7_use_really_simple_captcha() ) { + return; + } + + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'captcha', + __( 'CAPTCHA (Really Simple CAPTCHA)', 'contact-form-7' ), + 'wpcf7_tag_generator_captcha' ); +} + +function wpcf7_tag_generator_captcha( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + + if ( ! class_exists( 'ReallySimpleCaptcha' ) ) { +?> +
                      +
                      + +
                      +
                      + +
                      +
                      + + + + + + + + + +
                      + + + + + + + + + + + + + + +
                      + + + + + + + + + + + + + + +
                      +
                      +
                      + +
                      + + +
                      + +
                      +
                      +scan_form_tags( + array( 'type' => array( 'captchac' ) ) ); + + if ( ! $has_tags ) { + return; + } + + if ( ! class_exists( 'ReallySimpleCaptcha' ) ) { + return; + } + + $uploads_dir = wpcf7_captcha_tmp_dir(); + wpcf7_init_captcha(); + + if ( ! is_dir( $uploads_dir ) + or ! wp_is_writable( $uploads_dir ) ) { + $message = sprintf( __( 'This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), $uploads_dir ); + + echo '

                      ' . esc_html( $message ) . '

                      '; + } + + if ( ! function_exists( 'imagecreatetruecolor' ) + or ! function_exists( 'imagettftext' ) ) { + $message = __( "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.", 'contact-form-7' ); + + echo '

                      ' . esc_html( $message ) . '

                      '; + } +} + + +/* CAPTCHA functions */ + +function wpcf7_init_captcha() { + static $captcha = null; + + if ( $captcha ) { + return $captcha; + } + + if ( class_exists( 'ReallySimpleCaptcha' ) ) { + $captcha = new ReallySimpleCaptcha(); + } else { + return false; + } + + $dir = trailingslashit( wpcf7_captcha_tmp_dir() ); + + $captcha->tmp_dir = $dir; + + if ( is_callable( array( $captcha, 'make_tmp_dir' ) ) ) { + $result = $captcha->make_tmp_dir(); + + if ( ! $result ) { + return false; + } + + return $captcha; + } + + if ( wp_mkdir_p( $dir ) ) { + $htaccess_file = path_join( $dir, '.htaccess' ); + + if ( file_exists( $htaccess_file ) ) { + return $captcha; + } + + if ( $handle = fopen( $htaccess_file, 'w' ) ) { + fwrite( $handle, 'Order deny,allow' . "\n" ); + fwrite( $handle, 'Deny from all' . "\n" ); + fwrite( $handle, '' . "\n" ); + fwrite( $handle, ' Allow from all' . "\n" ); + fwrite( $handle, '' . "\n" ); + fclose( $handle ); + } + } else { + return false; + } + + return $captcha; +} + +function wpcf7_captcha_tmp_dir() { + if ( defined( 'WPCF7_CAPTCHA_TMP_DIR' ) ) { + return WPCF7_CAPTCHA_TMP_DIR; + } else { + return path_join( wpcf7_upload_dir( 'dir' ), 'wpcf7_captcha' ); + } +} + +function wpcf7_captcha_tmp_url() { + if ( defined( 'WPCF7_CAPTCHA_TMP_URL' ) ) { + return WPCF7_CAPTCHA_TMP_URL; + } else { + return path_join( wpcf7_upload_dir( 'url' ), 'wpcf7_captcha' ); + } +} + +function wpcf7_captcha_url( $filename ) { + $url = path_join( wpcf7_captcha_tmp_url(), $filename ); + + if ( is_ssl() + and 'http:' == substr( $url, 0, 5 ) ) { + $url = 'https:' . substr( $url, 5 ); + } + + return apply_filters( 'wpcf7_captcha_url', esc_url_raw( $url ) ); +} + +function wpcf7_generate_captcha( $options = null ) { + if ( ! $captcha = wpcf7_init_captcha() ) { + return false; + } + + if ( ! is_dir( $captcha->tmp_dir ) + or ! wp_is_writable( $captcha->tmp_dir ) ) { + return false; + } + + $img_type = imagetypes(); + + if ( $img_type & IMG_PNG ) { + $captcha->img_type = 'png'; + } elseif ( $img_type & IMG_GIF ) { + $captcha->img_type = 'gif'; + } elseif ( $img_type & IMG_JPG ) { + $captcha->img_type = 'jpeg'; + } else { + return false; + } + + if ( is_array( $options ) ) { + if ( isset( $options['img_size'] ) ) { + $captcha->img_size = $options['img_size']; + } + + if ( isset( $options['base'] ) ) { + $captcha->base = $options['base']; + } + + if ( isset( $options['font_size'] ) ) { + $captcha->font_size = $options['font_size']; + } + + if ( isset( $options['font_char_width'] ) ) { + $captcha->font_char_width = $options['font_char_width']; + } + + if ( isset( $options['fg'] ) ) { + $captcha->fg = $options['fg']; + } + + if ( isset( $options['bg'] ) ) { + $captcha->bg = $options['bg']; + } + } + + $prefix = wp_rand(); + $captcha_word = $captcha->generate_random_word(); + return $captcha->generate_image( $prefix, $captcha_word ); +} + +function wpcf7_check_captcha( $prefix, $response ) { + if ( ! $captcha = wpcf7_init_captcha() ) { + return false; + } + + return $captcha->check( $prefix, $response ); +} + +function wpcf7_remove_captcha( $prefix ) { + if ( ! $captcha = wpcf7_init_captcha() ) { + return false; + } + + // Contact Form 7 generates $prefix with wp_rand() + if ( preg_match( '/[^0-9]/', $prefix ) ) { + return false; + } + + $captcha->remove( $prefix ); +} + +add_action( 'template_redirect', 'wpcf7_cleanup_captcha_files', 20, 0 ); + +function wpcf7_cleanup_captcha_files() { + if ( ! $captcha = wpcf7_init_captcha() ) { + return false; + } + + if ( is_callable( array( $captcha, 'cleanup' ) ) ) { + return $captcha->cleanup(); + } + + $dir = trailingslashit( wpcf7_captcha_tmp_dir() ); + + if ( ! is_dir( $dir ) + or ! is_readable( $dir ) + or ! wp_is_writable( $dir ) ) { + return false; + } + + if ( $handle = opendir( $dir ) ) { + while ( false !== ( $file = readdir( $handle ) ) ) { + if ( ! preg_match( '/^[0-9]+\.(php|txt|png|gif|jpeg)$/', $file ) ) { + continue; + } + + $stat = stat( path_join( $dir, $file ) ); + + if ( $stat['mtime'] + 3600 < time() ) { // 3600 secs == 1 hour + @unlink( path_join( $dir, $file ) ); + } + } + + closedir( $handle ); + } +} + +function wpcf7_captchac_options( $options ) { + if ( ! is_array( $options ) ) { + return array(); + } + + $op = array(); + $image_size_array = preg_grep( '%^size:[smlSML]$%', $options ); + + if ( $image_size = array_shift( $image_size_array ) ) { + preg_match( '%^size:([smlSML])$%', $image_size, $is_matches ); + + switch ( strtolower( $is_matches[1] ) ) { + case 's': + $op['img_size'] = array( 60, 20 ); + $op['base'] = array( 6, 15 ); + $op['font_size'] = 11; + $op['font_char_width'] = 13; + break; + case 'l': + $op['img_size'] = array( 84, 28 ); + $op['base'] = array( 6, 20 ); + $op['font_size'] = 17; + $op['font_char_width'] = 19; + break; + case 'm': + default: + $op['img_size'] = array( 72, 24 ); + $op['base'] = array( 6, 18 ); + $op['font_size'] = 14; + $op['font_char_width'] = 15; + } + } + + $fg_color_array = preg_grep( + '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options ); + + if ( $fg_color = array_shift( $fg_color_array ) ) { + preg_match( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', + $fg_color, $fc_matches ); + + if ( 3 == strlen( $fc_matches[1] ) ) { + $r = substr( $fc_matches[1], 0, 1 ); + $g = substr( $fc_matches[1], 1, 1 ); + $b = substr( $fc_matches[1], 2, 1 ); + + $op['fg'] = array( + hexdec( $r . $r ), + hexdec( $g . $g ), + hexdec( $b . $b ), + ); + } elseif ( 6 == strlen( $fc_matches[1] ) ) { + $r = substr( $fc_matches[1], 0, 2 ); + $g = substr( $fc_matches[1], 2, 2 ); + $b = substr( $fc_matches[1], 4, 2 ); + + $op['fg'] = array( + hexdec( $r ), + hexdec( $g ), + hexdec( $b ), + ); + } + } + + $bg_color_array = preg_grep( + '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options ); + + if ( $bg_color = array_shift( $bg_color_array ) ) { + preg_match( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', + $bg_color, $bc_matches ); + + if ( 3 == strlen( $bc_matches[1] ) ) { + $r = substr( $bc_matches[1], 0, 1 ); + $g = substr( $bc_matches[1], 1, 1 ); + $b = substr( $bc_matches[1], 2, 1 ); + + $op['bg'] = array( + hexdec( $r . $r ), + hexdec( $g . $g ), + hexdec( $b . $b ), + ); + } elseif ( 6 == strlen( $bc_matches[1] ) ) { + $r = substr( $bc_matches[1], 0, 2 ); + $g = substr( $bc_matches[1], 2, 2 ); + $b = substr( $bc_matches[1], 4, 2 ); + + $op['bg'] = array( + hexdec( $r ), + hexdec( $g ), + hexdec( $b ), + ); + } + } + + return $op; +} diff --git a/wp-content/plugins/contact-form-7/modules/recaptcha.php b/wp-content/plugins/contact-form-7/modules/recaptcha.php new file mode 100644 index 0000000..d9d9fd7 --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/recaptcha.php @@ -0,0 +1,576 @@ +add_category( 'captcha', + __( 'CAPTCHA', 'contact-form-7' ) + ); + + $integration->add_service( 'recaptcha', + WPCF7_RECAPTCHA::get_instance() + ); +} + +add_action( 'wp_enqueue_scripts', 'wpcf7_recaptcha_enqueue_scripts', 10, 0 ); + +function wpcf7_recaptcha_enqueue_scripts() { + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + $url = add_query_arg( + array( + 'render' => $service->get_sitekey(), + ), + 'https://www.google.com/recaptcha/api.js' + ); + + wp_enqueue_script( 'google-recaptcha', $url, array(), '3.0', true ); +} + +add_filter( 'wpcf7_form_hidden_fields', + 'wpcf7_recaptcha_add_hidden_fields', 100, 1 ); + +function wpcf7_recaptcha_add_hidden_fields( $fields ) { + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( ! $service->is_active() ) { + return $fields; + } + + return array_merge( $fields, array( + 'g-recaptcha-response' => '', + ) ); +} + +add_action( 'wp_footer', 'wpcf7_recaptcha_onload_script', 40, 0 ); + +function wpcf7_recaptcha_onload_script() { + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + if ( ! wp_script_is( 'google-recaptcha', 'done' ) ) { + return; + } + + $actions = apply_filters( 'wpcf7_recaptcha_actions', + array( + 'homepage' => 'homepage', + 'contactform' => 'contactform', + ) + ); + +?> + +is_active() ) { + return $spam; + } + + $submission = WPCF7_Submission::get_instance(); + + $token = isset( $_POST['g-recaptcha-response'] ) + ? trim( $_POST['g-recaptcha-response'] ) : ''; + + if ( $service->verify( $token ) ) { // Human + $spam = false; + } else { // Bot + $spam = true; + + if ( '' === $token ) { + $submission->add_spam_log( array( + 'agent' => 'recaptcha', + 'reason' => __( 'reCAPTCHA response token is empty.', 'contact-form-7' ), + ) ); + } else { + $submission->add_spam_log( array( + 'agent' => 'recaptcha', + 'reason' => sprintf( + __( 'reCAPTCHA score (%1$.2f) is lower than the threshold (%2$.2f).', 'contact-form-7' ), + $service->get_last_score(), + $service->get_threshold() + ), + ) ); + } + } + + return $spam; +} + +add_action( 'wpcf7_init', 'wpcf7_recaptcha_add_form_tag_recaptcha', 10, 0 ); + +function wpcf7_recaptcha_add_form_tag_recaptcha() { + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + wpcf7_add_form_tag( 'recaptcha', + '__return_empty_string', // no output + array( 'display-block' => true ) + ); +} + +add_action( 'wpcf7_upgrade', 'wpcf7_upgrade_recaptcha_v2_v3', 10, 2 ); + +function wpcf7_upgrade_recaptcha_v2_v3( $new_ver, $old_ver ) { + if ( version_compare( '5.1-dev', $old_ver, '<=' ) ) { + return; + } + + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( ! $service->is_active() ) { + return; + } + + // Maybe v2 keys are used now. Warning necessary. + WPCF7::update_option( 'recaptcha_v2_v3_warning', true ); + WPCF7::update_option( 'recaptcha', null ); +} + +add_action( 'wpcf7_admin_menu', 'wpcf7_admin_init_recaptcha_v2_v3', 10, 0 ); + +function wpcf7_admin_init_recaptcha_v2_v3() { + if ( ! WPCF7::get_option( 'recaptcha_v2_v3_warning' ) ) { + return; + } + + add_filter( 'wpcf7_admin_menu_change_notice', + 'wpcf7_admin_menu_change_notice_recaptcha_v2_v3', 10, 1 ); + + add_action( 'wpcf7_admin_warnings', + 'wpcf7_admin_warnings_recaptcha_v2_v3', 5, 3 ); +} + +function wpcf7_admin_menu_change_notice_recaptcha_v2_v3( $counts ) { + $counts['wpcf7-integration'] += 1; + return $counts; +} + +function wpcf7_admin_warnings_recaptcha_v2_v3( $page, $action, $object ) { + if ( 'wpcf7-integration' !== $page ) { + return; + } + + $message = sprintf( + esc_html( __( "API keys for reCAPTCHA v3 are different from those for v2; keys for v2 don’t work with the v3 API. You need to register your sites again to get new keys for v3. For details, see %s.", 'contact-form-7' ) ), + wpcf7_link( + __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), + __( 'reCAPTCHA (v3)', 'contact-form-7' ) + ) + ); + + echo sprintf( + '

                      %s

                      ', + $message + ); +} + +if ( ! class_exists( 'WPCF7_Service' ) ) { + return; +} + +class WPCF7_RECAPTCHA extends WPCF7_Service { + + private static $instance; + private $sitekeys; + private $last_score; + + public static function get_instance() { + if ( empty( self::$instance ) ) { + self::$instance = new self; + } + + return self::$instance; + } + + private function __construct() { + $this->sitekeys = WPCF7::get_option( 'recaptcha' ); + } + + public function get_title() { + return __( 'reCAPTCHA', 'contact-form-7' ); + } + + public function is_active() { + $sitekey = $this->get_sitekey(); + $secret = $this->get_secret( $sitekey ); + return $sitekey && $secret; + } + + public function get_categories() { + return array( 'captcha' ); + } + + public function icon() { + } + + public function link() { + echo wpcf7_link( + 'https://www.google.com/recaptcha/intro/index.html', + 'google.com/recaptcha' + ); + } + + public function get_global_sitekey() { + static $sitekey = ''; + + if ( $sitekey ) { + return $sitekey; + } + + if ( defined( 'WPCF7_RECAPTCHA_SITEKEY' ) ) { + $sitekey = WPCF7_RECAPTCHA_SITEKEY; + } + + $sitekey = apply_filters( 'wpcf7_recaptcha_sitekey', $sitekey ); + + return $sitekey; + } + + public function get_global_secret() { + static $secret = ''; + + if ( $secret ) { + return $secret; + } + + if ( defined( 'WPCF7_RECAPTCHA_SECRET' ) ) { + $secret = WPCF7_RECAPTCHA_SECRET; + } + + $secret = apply_filters( 'wpcf7_recaptcha_secret', $secret ); + + return $secret; + } + + public function get_sitekey() { + if ( $this->get_global_sitekey() && $this->get_global_secret() ) { + return $this->get_global_sitekey(); + } + + if ( empty( $this->sitekeys ) + or ! is_array( $this->sitekeys ) ) { + return false; + } + + $sitekeys = array_keys( $this->sitekeys ); + + return $sitekeys[0]; + } + + public function get_secret( $sitekey ) { + if ( $this->get_global_sitekey() && $this->get_global_secret() ) { + return $this->get_global_secret(); + } + + $sitekeys = (array) $this->sitekeys; + + if ( isset( $sitekeys[$sitekey] ) ) { + return $sitekeys[$sitekey]; + } else { + return false; + } + } + + protected function log( $url, $request, $response ) { + wpcf7_log_remote_request( $url, $request, $response ); + } + + public function verify( $token ) { + $is_human = false; + + if ( empty( $token ) or ! $this->is_active() ) { + return $is_human; + } + + $endpoint = 'https://www.google.com/recaptcha/api/siteverify'; + + $sitekey = $this->get_sitekey(); + $secret = $this->get_secret( $sitekey ); + + $request = array( + 'body' => array( + 'secret' => $secret, + 'response' => $token, + ), + ); + + $response = wp_remote_post( esc_url_raw( $endpoint ), $request ); + + if ( 200 != wp_remote_retrieve_response_code( $response ) ) { + if ( WP_DEBUG ) { + $this->log( $endpoint, $request, $response ); + } + + return $is_human; + } + + $response_body = wp_remote_retrieve_body( $response ); + $response_body = json_decode( $response_body, true ); + + $this->last_score = $score = isset( $response_body['score'] ) + ? $response_body['score'] + : 0; + + $threshold = $this->get_threshold(); + $is_human = $threshold < $score; + + $is_human = apply_filters( 'wpcf7_recaptcha_verify_response', + $is_human, $response_body ); + + if ( $submission = WPCF7_Submission::get_instance() ) { + $submission->recaptcha = array( + 'version' => '3.0', + 'threshold' => $threshold, + 'response' => $response_body, + ); + } + + return $is_human; + } + + public function get_threshold() { + return apply_filters( 'wpcf7_recaptcha_threshold', 0.50 ); + } + + public function get_last_score() { + return $this->last_score; + } + + protected function menu_page_url( $args = '' ) { + $args = wp_parse_args( $args, array() ); + + $url = menu_page_url( 'wpcf7-integration', false ); + $url = add_query_arg( array( 'service' => 'recaptcha' ), $url ); + + if ( ! empty( $args) ) { + $url = add_query_arg( $args, $url ); + } + + return $url; + } + + protected function save_data() { + WPCF7::update_option( 'recaptcha', $this->sitekeys ); + } + + protected function reset_data() { + $this->sitekeys = null; + $this->save_data(); + } + + public function load( $action = '' ) { + if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) { + check_admin_referer( 'wpcf7-recaptcha-setup' ); + + if ( ! empty( $_POST['reset'] ) ) { + $this->reset_data(); + $redirect_to = $this->menu_page_url( 'action=setup' ); + } else { + $sitekey = isset( $_POST['sitekey'] ) ? trim( $_POST['sitekey'] ) : ''; + $secret = isset( $_POST['secret'] ) ? trim( $_POST['secret'] ) : ''; + + if ( $sitekey and $secret ) { + $this->sitekeys = array( $sitekey => $secret ); + $this->save_data(); + + $redirect_to = $this->menu_page_url( array( + 'message' => 'success', + ) ); + } else { + $redirect_to = $this->menu_page_url( array( + 'action' => 'setup', + 'message' => 'invalid', + ) ); + } + } + + if ( WPCF7::get_option( 'recaptcha_v2_v3_warning' ) ) { + WPCF7::update_option( 'recaptcha_v2_v3_warning', false ); + } + + wp_safe_redirect( $redirect_to ); + exit(); + } + } + + public function admin_notice( $message = '' ) { + if ( 'invalid' == $message ) { + echo sprintf( + '

                      %1$s: %2$s

                      ', + esc_html( __( "ERROR", 'contact-form-7' ) ), + esc_html( __( "Invalid key values.", 'contact-form-7' ) ) ); + } + + if ( 'success' == $message ) { + echo sprintf( '

                      %s

                      ', + esc_html( __( 'Settings saved.', 'contact-form-7' ) ) ); + } + } + + public function display( $action = '' ) { + echo '

                      ' . sprintf( + esc_html( __( 'reCAPTCHA protects you against spam and other types of automated abuse. With Contact Form 7’s reCAPTCHA integration module, you can block abusive form submissions by spam bots. For details, see %s.', 'contact-form-7' ) ), + wpcf7_link( + __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), + __( 'reCAPTCHA (v3)', 'contact-form-7' ) + ) + ) . '

                      '; + + if ( $this->is_active() ) { + echo sprintf( + '

                      %s

                      ', + esc_html( __( "reCAPTCHA is active on this site.", 'contact-form-7' ) ) + ); + } + + if ( 'setup' == $action ) { + $this->display_setup(); + } else { + echo sprintf( + '

                      %2$s

                      ', + esc_url( $this->menu_page_url( 'action=setup' ) ), + esc_html( __( 'Setup Integration', 'contact-form-7' ) ) + ); + } + } + + private function display_setup() { + $sitekey = $this->is_active() ? $this->get_sitekey() : ''; + $secret = $this->is_active() ? $this->get_secret( $sitekey ) : ''; + +?> +
                      + + + + + + + + + + + + +
                      is_active() ) { + echo esc_html( $sitekey ); + echo sprintf( + '', + esc_attr( $sitekey ) + ); + } else { + echo sprintf( + '', + esc_attr( $sitekey ) + ); + } + ?>
                      is_active() ) { + echo esc_html( wpcf7_mask_password( $secret ) ); + echo sprintf( + '', + esc_attr( $secret ) + ); + } else { + echo sprintf( + '', + esc_attr( $secret ) + ); + } + ?>
                      +is_active() ) { + if ( $this->get_global_sitekey() && $this->get_global_secret() ) { + // nothing + } else { + submit_button( + _x( 'Remove Keys', 'API keys', 'contact-form-7' ), + 'small', 'reset' + ); + } + } else { + submit_button( __( 'Save Changes', 'contact-form-7' ) ); + } +?> +
                      + true ) ); +} + +function wpcf7_response_form_tag_handler( $tag ) { + if ( $contact_form = wpcf7_get_current_contact_form() ) { + return $contact_form->form_response_output(); + } +} diff --git a/wp-content/plugins/contact-form-7/modules/select.php b/wp-content/plugins/contact-form-7/modules/select.php new file mode 100644 index 0000000..ef0b67d --- /dev/null +++ b/wp-content/plugins/contact-form-7/modules/select.php @@ -0,0 +1,227 @@ + true, + 'selectable-values' => true, + ) + ); +} + +function wpcf7_select_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $multiple = $tag->has_option( 'multiple' ); + $include_blank = $tag->has_option( 'include_blank' ); + $first_as_label = $tag->has_option( 'first_as_label' ); + + if ( $tag->has_option( 'size' ) ) { + $size = $tag->get_option( 'size', 'int', true ); + + if ( $size ) { + $atts['size'] = $size; + } elseif ( $multiple ) { + $atts['size'] = 4; + } else { + $atts['size'] = 1; + } + } + + if ( $data = (array) $tag->get_data_option() ) { + $tag->values = array_merge( $tag->values, array_values( $data ) ); + $tag->labels = array_merge( $tag->labels, array_values( $data ) ); + } + + $values = $tag->values; + $labels = $tag->labels; + + $default_choice = $tag->get_default_option( null, array( + 'multiple' => $multiple, + 'shifted' => $include_blank, + ) ); + + if ( $include_blank + or empty( $values ) ) { + array_unshift( $labels, '---' ); + array_unshift( $values, '' ); + } elseif ( $first_as_label ) { + $values[0] = ''; + } + + $html = ''; + $hangover = wpcf7_get_hangover( $tag->name ); + + foreach ( $values as $key => $value ) { + if ( $hangover ) { + $selected = in_array( $value, (array) $hangover, true ); + } else { + $selected = in_array( $value, (array) $default_choice, true ); + } + + $item_atts = array( + 'value' => $value, + 'selected' => $selected ? 'selected' : '', + ); + + $item_atts = wpcf7_format_atts( $item_atts ); + + $label = isset( $labels[$key] ) ? $labels[$key] : $value; + + $html .= sprintf( '', + $item_atts, esc_html( $label ) ); + } + + if ( $multiple ) { + $atts['multiple'] = 'multiple'; + } + + $atts['name'] = $tag->name . ( $multiple ? '[]' : '' ); + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%4$s', + sanitize_html_class( $tag->name ), $atts, $html, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_select', 'wpcf7_select_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 ); + +function wpcf7_select_validation_filter( $result, $tag ) { + $name = $tag->name; + + if ( isset( $_POST[$name] ) + and is_array( $_POST[$name] ) ) { + foreach ( $_POST[$name] as $key => $value ) { + if ( '' === $value ) { + unset( $_POST[$name][$key] ); + } + } + } + + $empty = ! isset( $_POST[$name] ) || empty( $_POST[$name] ) && '0' !== $_POST[$name]; + + if ( $tag->is_required() and $empty ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } + + return $result; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_menu', 25, 0 ); + +function wpcf7_add_tag_generator_menu() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'menu', __( 'drop-down menu', 'contact-form-7' ), + 'wpcf7_tag_generator_menu' ); +} + +function wpcf7_tag_generator_menu( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + + $description = __( "Generate a form-tag for a drop-down menu. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/checkboxes-radio-buttons-and-menus/', 'contact-form-7' ), __( 'Checkboxes, Radio Buttons and Menus', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +
                      +
                      + + +
                      +
                      + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      +
                      +type ); + + $atts = array(); + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + + $value = isset( $tag->values[0] ) ? $tag->values[0] : ''; + + if ( empty( $value ) ) { + $value = __( 'Send', 'contact-form-7' ); + } + + $atts['type'] = 'submit'; + $atts['value'] = $value; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( '', $atts ); + + return $html; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_submit', 55, 0 ); + +function wpcf7_add_tag_generator_submit() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'submit', __( 'submit', 'contact-form-7' ), + 'wpcf7_tag_generator_submit', array( 'nameless' => 1 ) ); +} + +function wpcf7_tag_generator_submit( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + + $description = __( "Generate a form-tag for a submit button. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/submit-button/', 'contact-form-7' ), __( 'Submit Button', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + +
                      +
                      +
                      + +
                      + + +
                      + +
                      +
                      + true ) ); +} + +function wpcf7_text_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type, 'wpcf7-text' ); + + if ( in_array( $tag->basetype, array( 'email', 'url', 'tel' ) ) ) { + $class .= ' wpcf7-validates-as-' . $tag->basetype; + } + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['size'] = $tag->get_size_option( '40' ); + $atts['maxlength'] = $tag->get_maxlength_option(); + $atts['minlength'] = $tag->get_minlength_option(); + + if ( $atts['maxlength'] and $atts['minlength'] + and $atts['maxlength'] < $atts['minlength'] ) { + unset( $atts['maxlength'], $atts['minlength'] ); + } + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + + $atts['autocomplete'] = $tag->get_option( 'autocomplete', + '[-0-9a-zA-Z]+', true ); + + if ( $tag->has_option( 'readonly' ) ) { + $atts['readonly'] = 'readonly'; + } + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $value = (string) reset( $tag->values ); + + if ( $tag->has_option( 'placeholder' ) + or $tag->has_option( 'watermark' ) ) { + $atts['placeholder'] = $value; + $value = ''; + } + + $value = $tag->get_default_option( $value ); + + $value = wpcf7_get_hangover( $tag->name, $value ); + + $atts['value'] = $value; + + if ( wpcf7_support_html5() ) { + $atts['type'] = $tag->basetype; + } else { + $atts['type'] = 'text'; + } + + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%3$s', + sanitize_html_class( $tag->name ), $atts, $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_text', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_text*', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_url', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_url*', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_tel', 'wpcf7_text_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_tel*', 'wpcf7_text_validation_filter', 10, 2 ); + +function wpcf7_text_validation_filter( $result, $tag ) { + $name = $tag->name; + + $value = isset( $_POST[$name] ) + ? trim( wp_unslash( strtr( (string) $_POST[$name], "\n", " " ) ) ) + : ''; + + if ( 'text' == $tag->basetype ) { + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } + } + + if ( 'email' == $tag->basetype ) { + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } elseif ( '' != $value and ! wpcf7_is_email( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_email' ) ); + } + } + + if ( 'url' == $tag->basetype ) { + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } elseif ( '' != $value and ! wpcf7_is_url( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_url' ) ); + } + } + + if ( 'tel' == $tag->basetype ) { + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } elseif ( '' != $value and ! wpcf7_is_tel( $value ) ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_tel' ) ); + } + } + + if ( '' !== $value ) { + $maxlength = $tag->get_maxlength_option(); + $minlength = $tag->get_minlength_option(); + + if ( $maxlength and $minlength and $maxlength < $minlength ) { + $maxlength = $minlength = null; + } + + $code_units = wpcf7_count_code_units( stripslashes( $value ) ); + + if ( false !== $code_units ) { + if ( $maxlength and $maxlength < $code_units ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) ); + } elseif ( $minlength and $code_units < $minlength ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) ); + } + } + } + + return $result; +} + + +/* Messages */ + +add_filter( 'wpcf7_messages', 'wpcf7_text_messages', 10, 1 ); + +function wpcf7_text_messages( $messages ) { + $messages = array_merge( $messages, array( + 'invalid_email' => array( + 'description' => + __( "Email address that the sender entered is invalid", 'contact-form-7' ), + 'default' => + __( "The e-mail address entered is invalid.", 'contact-form-7' ), + ), + + 'invalid_url' => array( + 'description' => + __( "URL that the sender entered is invalid", 'contact-form-7' ), + 'default' => + __( "The URL is invalid.", 'contact-form-7' ), + ), + + 'invalid_tel' => array( + 'description' => + __( "Telephone number that the sender entered is invalid", 'contact-form-7' ), + 'default' => + __( "The telephone number is invalid.", 'contact-form-7' ), + ), + ) ); + + return $messages; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_text', 15, 0 ); + +function wpcf7_add_tag_generator_text() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'text', __( 'text', 'contact-form-7' ), + 'wpcf7_tag_generator_text' ); + $tag_generator->add( 'email', __( 'email', 'contact-form-7' ), + 'wpcf7_tag_generator_text' ); + $tag_generator->add( 'url', __( 'URL', 'contact-form-7' ), + 'wpcf7_tag_generator_text' ); + $tag_generator->add( 'tel', __( 'tel', 'contact-form-7' ), + 'wpcf7_tag_generator_text' ); +} + +function wpcf7_tag_generator_text( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = $args['id']; + + if ( ! in_array( $type, array( 'email', 'url', 'tel' ) ) ) { + $type = 'text'; + } + + if ( 'text' == $type ) { + $description = __( "Generate a form-tag for a single-line plain text input field. For more details, see %s.", 'contact-form-7' ); + } elseif ( 'email' == $type ) { + $description = __( "Generate a form-tag for a single-line email address input field. For more details, see %s.", 'contact-form-7' ); + } elseif ( 'url' == $type ) { + $description = __( "Generate a form-tag for a single-line URL input field. For more details, see %s.", 'contact-form-7' ); + } elseif ( 'tel' == $type ) { + $description = __( "Generate a form-tag for a single-line telephone number input field. For more details, see %s.", 'contact-form-7' ); + } + + $desc_link = wpcf7_link( __( 'https://contactform7.com/text-fields/', 'contact-form-7' ), __( 'Text Fields', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +

                      +
                      +
                      + + + + + + + + + + +
                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      +
                      + true ) ); +} + +function wpcf7_textarea_form_tag_handler( $tag ) { + if ( empty( $tag->name ) ) { + return ''; + } + + $validation_error = wpcf7_get_validation_error( $tag->name ); + + $class = wpcf7_form_controls_class( $tag->type ); + + if ( $validation_error ) { + $class .= ' wpcf7-not-valid'; + } + + $atts = array(); + + $atts['cols'] = $tag->get_cols_option( '40' ); + $atts['rows'] = $tag->get_rows_option( '10' ); + $atts['maxlength'] = $tag->get_maxlength_option(); + $atts['minlength'] = $tag->get_minlength_option(); + + if ( $atts['maxlength'] and $atts['minlength'] + and $atts['maxlength'] < $atts['minlength'] ) { + unset( $atts['maxlength'], $atts['minlength'] ); + } + + $atts['class'] = $tag->get_class_option( $class ); + $atts['id'] = $tag->get_id_option(); + $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); + + $atts['autocomplete'] = $tag->get_option( 'autocomplete', + '[-0-9a-zA-Z]+', true ); + + if ( $tag->has_option( 'readonly' ) ) { + $atts['readonly'] = 'readonly'; + } + + if ( $tag->is_required() ) { + $atts['aria-required'] = 'true'; + } + + $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; + + $value = empty( $tag->content ) + ? (string) reset( $tag->values ) + : $tag->content; + + if ( $tag->has_option( 'placeholder' ) + or $tag->has_option( 'watermark' ) ) { + $atts['placeholder'] = $value; + $value = ''; + } + + $value = $tag->get_default_option( $value ); + + $value = wpcf7_get_hangover( $tag->name, $value ); + + $atts['name'] = $tag->name; + + $atts = wpcf7_format_atts( $atts ); + + $html = sprintf( + '%4$s', + sanitize_html_class( $tag->name ), $atts, + esc_textarea( $value ), $validation_error ); + + return $html; +} + + +/* Validation filter */ + +add_filter( 'wpcf7_validate_textarea', + 'wpcf7_textarea_validation_filter', 10, 2 ); +add_filter( 'wpcf7_validate_textarea*', + 'wpcf7_textarea_validation_filter', 10, 2 ); + +function wpcf7_textarea_validation_filter( $result, $tag ) { + $type = $tag->type; + $name = $tag->name; + + $value = isset( $_POST[$name] ) ? (string) $_POST[$name] : ''; + + if ( $tag->is_required() and '' == $value ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) ); + } + + if ( '' !== $value ) { + $maxlength = $tag->get_maxlength_option(); + $minlength = $tag->get_minlength_option(); + + if ( $maxlength and $minlength + and $maxlength < $minlength ) { + $maxlength = $minlength = null; + } + + $code_units = wpcf7_count_code_units( stripslashes( $value ) ); + + if ( false !== $code_units ) { + if ( $maxlength and $maxlength < $code_units ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) ); + } elseif ( $minlength and $code_units < $minlength ) { + $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) ); + } + } + } + + return $result; +} + + +/* Tag generator */ + +add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_textarea', 20, 0 ); + +function wpcf7_add_tag_generator_textarea() { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->add( 'textarea', __( 'text area', 'contact-form-7' ), + 'wpcf7_tag_generator_textarea' ); +} + +function wpcf7_tag_generator_textarea( $contact_form, $args = '' ) { + $args = wp_parse_args( $args, array() ); + $type = 'textarea'; + + $description = __( "Generate a form-tag for a multi-line text input field. For more details, see %s.", 'contact-form-7' ); + + $desc_link = wpcf7_link( __( 'https://contactform7.com/text-fields/', 'contact-form-7' ), __( 'Text Fields', 'contact-form-7' ) ); + +?> +
                      +
                      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
                      +
                      + + +
                      +

                      +
                      +
                      +
                      + +
                      + + +
                      + +
                      + +
                      + +

                      +
                      + $value ) ); + update_option( 'wpcf7', $option ); + } +} + +add_action( 'plugins_loaded', 'wpcf7', 10, 0 ); + +function wpcf7() { + wpcf7_load_textdomain(); + WPCF7::load_modules(); + + /* Shortcodes */ + add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' ); + add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); +} + +add_action( 'init', 'wpcf7_init', 10, 0 ); + +function wpcf7_init() { + wpcf7_get_request_uri(); + wpcf7_register_post_types(); + + do_action( 'wpcf7_init' ); +} + +add_action( 'admin_init', 'wpcf7_upgrade', 10, 0 ); + +function wpcf7_upgrade() { + $old_ver = WPCF7::get_option( 'version', '0' ); + $new_ver = WPCF7_VERSION; + + if ( $old_ver == $new_ver ) { + return; + } + + do_action( 'wpcf7_upgrade', $new_ver, $old_ver ); + + WPCF7::update_option( 'version', $new_ver ); +} + +/* Install and default settings */ + +add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install', 10, 0 ); + +function wpcf7_install() { + if ( $opt = get_option( 'wpcf7' ) ) { + return; + } + + wpcf7_load_textdomain(); + wpcf7_register_post_types(); + wpcf7_upgrade(); + + if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) ) { + return; + } + + $contact_form = WPCF7_ContactForm::get_template( + array( + 'title' => + /* translators: title of your first contact form. %d: number fixed to '1' */ + sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ), + ) + ); + + $contact_form->save(); + + WPCF7::update_option( 'bulk_validate', + array( + 'timestamp' => current_time( 'timestamp' ), + 'version' => WPCF7_VERSION, + 'count_valid' => 1, + 'count_invalid' => 0, + ) + ); +} diff --git a/wp-content/plugins/contact-form-7/uninstall.php b/wp-content/plugins/contact-form-7/uninstall.php new file mode 100644 index 0000000..1903ec7 --- /dev/null +++ b/wp-content/plugins/contact-form-7/uninstall.php @@ -0,0 +1,28 @@ + -1, + 'post_type' => 'wpcf7_contact_form', + 'post_status' => 'any', + ) + ); + + foreach ( $posts as $post ) { + wp_delete_post( $post->ID, true ); + } + + $wpdb->query( sprintf( "DROP TABLE IF EXISTS %s", + $wpdb->prefix . 'contact_form_7' ) ); +} + +wpcf7_delete_plugin(); diff --git a/wp-content/plugins/contact-form-7/wp-contact-form-7.php b/wp-content/plugins/contact-form-7/wp-contact-form-7.php new file mode 100644 index 0000000..07328b1 --- /dev/null +++ b/wp-content/plugins/contact-form-7/wp-contact-form-7.php @@ -0,0 +1,67 @@ + false, + 'message' => esc_html__( 'Administrator permission is required', 'imsanity' ), + ) + ) + ); + } + if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'imsanity-bulk' ) ) { + die( + json_encode( + array( + 'success' => false, + 'message' => esc_html__( 'Access token has expired, please reload the page.', 'imsanity' ), + ) + ) + ); + } +} + + +/** + * Searches for up to 250 images that are candidates for resize and renders them + * to the browser as a json array, then dies + */ +function imsanity_get_images() { + imsanity_verify_permission(); + + global $wpdb; + $offset = 0; + $limit = apply_filters( 'imsanity_attachment_query_limit', 3000 ); + $results = array(); + $maxw = imsanity_get_option( 'imsanity_max_width', IMSANITY_DEFAULT_MAX_WIDTH ); + $maxh = imsanity_get_option( 'imsanity_max_height', IMSANITY_DEFAULT_MAX_HEIGHT ); + $count = 0; + + $images = $wpdb->get_results( $wpdb->prepare( "SELECT metas.meta_value as file_meta,metas.post_id as ID FROM $wpdb->postmeta metas INNER JOIN $wpdb->posts posts ON posts.ID = metas.post_id WHERE posts.post_type = 'attachment' AND posts.post_mime_type LIKE %s AND posts.post_mime_type != 'image/bmp' AND metas.meta_key = '_wp_attachment_metadata' ORDER BY ID DESC LIMIT %d,%d", '%image%', $offset, $limit ) ); + /* $images = $wpdb->get_results( "SELECT metas.meta_value as file_meta,metas.post_id as ID FROM $wpdb->postmeta metas INNER JOIN $wpdb->posts posts ON posts.ID = metas.post_id WHERE posts.post_type LIKE 'attachment' AND posts.post_mime_type LIKE 'image%%' AND posts.post_mime_type NOT LIKE 'image/bmp' AND metas.meta_key = '_wp_attachment_metadata' LIMIT $offset,$limit" ); */ + while ( $images ) { + + foreach ( $images as $image ) { + $imagew = false; + $imageh = false; + + $meta = unserialize( $image->file_meta ); + + // If "noresize" is included in the filename then we will bypass imsanity scaling. + if ( ! empty( $meta['file'] ) && strpos( $meta['file'], 'noresize' ) !== false ) { + continue; + } + + if ( imsanity_get_option( 'imsanity_deep_scan', false ) ) { + $file_path = imsanity_attachment_path( $meta, $image->ID, '', false ); + if ( $file_path ) { + list( $imagew, $imageh ) = getimagesize( $file_path ); + } + } + if ( empty( $imagew ) || empty( $imageh ) ) { + $imagew = $meta['width']; + $imageh = $meta['height']; + } + + if ( $imagew > $maxw || $imageh > $maxh ) { + $count++; + + $results[] = array( + 'id' => $image->ID, + 'width' => $imagew, + 'height' => $imageh, + 'file' => $meta['file'], + ); + } + + // Make sure we only return a limited number of records so we don't overload the ajax features. + if ( $count >= IMSANITY_AJAX_MAX_RECORDS ) { + break 2; + } + } + $offset += $limit; + $images = $wpdb->get_results( $wpdb->prepare( "SELECT metas.meta_value as file_meta,metas.post_id as ID FROM $wpdb->postmeta metas INNER JOIN $wpdb->posts posts ON posts.ID = metas.post_id WHERE posts.post_type = 'attachment' AND posts.post_mime_type LIKE %s AND posts.post_mime_type != 'image/bmp' AND metas.meta_key = '_wp_attachment_metadata' ORDER BY ID DESC LIMIT %d,%d", '%image%', $offset, $limit ) ); + } // endwhile + die( json_encode( $results ) ); +} + +/** + * Resizes the image with the given id according to the configured max width and height settings + * renders a json response indicating success/failure and dies + */ +function imsanity_resize_image() { + imsanity_verify_permission(); + + global $wpdb; + + $id = (int) $_POST['id']; + + if ( ! $id ) { + die( + json_encode( + array( + 'success' => false, + 'message' => esc_html__( 'Missing ID Parameter', 'imsanity' ), + ) + ) + ); + } + + $meta = wp_get_attachment_metadata( $id ); + + if ( $meta && is_array( $meta ) ) { + $uploads = wp_upload_dir(); + $oldpath = imsanity_attachment_path( $meta['file'], $id, '', false ); + if ( empty( $oldpath ) || ! is_writable( $oldpath ) ) { + /* translators: %s: File-name of the image */ + $msg = sprintf( esc_html__( '%s is not writable', 'imsanity' ), $meta['file'] ); + die( + json_encode( + array( + 'success' => false, + 'message' => $msg, + ) + ) + ); + } + + $maxw = imsanity_get_option( 'imsanity_max_width', IMSANITY_DEFAULT_MAX_WIDTH ); + $maxh = imsanity_get_option( 'imsanity_max_height', IMSANITY_DEFAULT_MAX_HEIGHT ); + + // method one - slow but accurate, get file size from file itself. + list( $oldw, $oldh ) = getimagesize( $oldpath ); + // method two - get file size from meta, fast but resize will fail if meta is out of sync. + if ( ! $oldw || ! $oldh ) { + $oldw = $meta['width']; + $oldh = $meta['height']; + } + + if ( ( $oldw > $maxw && $maxw > 0 ) || ( $oldh > $maxh && $maxh > 0 ) ) { + $quality = imsanity_get_option( 'imsanity_quality', IMSANITY_DEFAULT_QUALITY ); + + if ( $oldw > $maxw && $maxw > 0 && $oldh > $maxh && $maxh > 0 && apply_filters( 'imsanity_crop_image', false ) ) { + $neww = $maxw; + $newh = $maxh; + } else { + list( $neww, $newh ) = wp_constrain_dimensions( $oldw, $oldh, $maxw, $maxh ); + } + + $resizeresult = imsanity_image_resize( $oldpath, $neww, $newh, apply_filters( 'imsanity_crop_image', false ), null, null, $quality ); + + if ( $resizeresult && ! is_wp_error( $resizeresult ) ) { + $newpath = $resizeresult; + + if ( $newpath !== $oldpath && is_file( $newpath ) && filesize( $newpath ) < filesize( $oldpath ) ) { + // we saved some file space. remove original and replace with resized image. + unlink( $oldpath ); + rename( $newpath, $oldpath ); + $meta['width'] = $neww; + $meta['height'] = $newh; + + wp_update_attachment_metadata( $id, $meta ); + + $results = array( + 'success' => true, + 'id' => $id, + /* translators: %s: File-name of the image */ + 'message' => sprintf( esc_html__( 'OK: %s', 'imsanity' ), $oldpath ), + ); + } elseif ( $newpath !== $oldpath ) { + // the resized image is actually bigger in filesize (most likely due to jpg quality). + // keep the old one and just get rid of the resized image. + if ( is_file( $newpath ) ) { + unlink( $newpath ); + } + $results = array( + 'success' => false, + 'id' => $id, + /* translators: 1: File-name of the image 2: the error message, translated elsewhere */ + 'message' => sprintf( esc_html__( 'ERROR: %1$s (%2$s)', 'imsanity' ), $oldpath, esc_html__( 'Resized image was larger than the original', 'imsanity' ) ), + ); + } else { + $results = array( + 'success' => false, + 'id' => $id, + /* translators: 1: File-name of the image 2: the error message, translated elsewhere */ + 'message' => sprintf( esc_html__( 'ERROR: %1$s (%2$s)', 'imsanity' ), $oldpath, esc_html__( 'Unknown error, resizing function returned the same filename', 'imsanity' ) ), + ); + } + } elseif ( false === $resizeresult ) { + $results = array( + 'success' => false, + 'id' => $id, + /* translators: 1: File-name of the image 2: the error message, translated elsewhere */ + 'message' => sprintf( esc_html__( 'ERROR: %1$s (%2$s)', 'imsanity' ), $oldpath, esc_html__( 'wp_get_image_editor missing', 'imsanity' ) ), + ); + } else { + $results = array( + 'success' => false, + 'id' => $id, + /* translators: 1: File-name of the image 2: the error message, translated elsewhere */ + 'message' => sprintf( esc_html__( 'ERROR: %1$s (%2$s)', 'imsanity' ), $oldpath, htmlentities( $resizeresult->get_error_message() ) ), + ); + } + } else { + $results = array( + 'success' => true, + 'id' => $id, + /* translators: %s: File-name of the image */ + 'message' => sprintf( esc_html__( 'SKIPPED: %s (Resize not required)', 'imsanity' ), $oldpath ) . " -- $oldw x $oldh", + ); + if ( empty( $meta['width'] ) || empty( $meta['height'] ) ) { + if ( empty( $meta['width'] ) || $meta['width'] > $oldw ) { + $meta['width'] = $oldw; + } + if ( empty( $meta['height'] ) || $meta['height'] > $oldh ) { + $meta['height'] = $oldh; + } + wp_update_attachment_metadata( $id, $meta ); + } + } + } else { + $results = array( + 'success' => false, + 'id' => $id, + /* translators: %s: ID number of the image */ + 'message' => sprintf( esc_html__( 'ERROR: Attachment with ID of %d not found', 'imsanity' ), intval( $id ) ), + ); + } + + // If there is a quota we need to reset the directory size cache so it will re-calculate. + delete_transient( 'dirsize_cache' ); + + die( json_encode( $results ) ); +} diff --git a/wp-content/plugins/imsanity/changelog.txt b/wp-content/plugins/imsanity/changelog.txt new file mode 100644 index 0000000..aa4cc09 --- /dev/null +++ b/wp-content/plugins/imsanity/changelog.txt @@ -0,0 +1,74 @@ += 2.4.3 = +* changed: default size from 2048 to 1920 +* fixed: WP Import plugin breaks during Media imports +* fixed: setting a value to 0 causes errors on multi-site installs +* fixed: conversion settings not displaying correctly on multi-site + += 2.4.2 = +* changed: noresize in filename also works in batch processing +* fixed: error message does not contain filename when file is missing +* fixed: notice on network settings when deep scan option has not been set before + += 2.4.1 = +* fixed: bulk resizer scan returning incorrect results +* fixed: sprintf error during resizing and upload + += 2.4.0 = +* added: deep scanning option for when attachment metadata isn't updating properly +* fixed: uploads from Gutenberg not detected properly +* fixed: some other plugin(s) trying to muck with the Imsanity settings links and breaking things +* fixed: undefined notice for query during ajax operation +* fixed: stale metadata could prevent further resizing + += 2.3.9 = +* fixed: PNG to JPG filled transparency with black instead of white +* fixed: auto-rotation causes incorrect scaling +* fixed: results box stops scrolling at line 28 +* added: pre-emptive checks on file parameter to prevent read errors with getimagesize() + += 2.3.8 = +* added: 'imsanity_crop_image' filter to crop images during resizing +* added: increased security of network settings and AJAX requests +* changed: metadata fetch and update use correct functions instead of direct database queries +* changed: bulk resize search is kinder to your database +* fixed: bulk resize could produce a larger image +* fixed: image file permissions not checked prior to resizing +* fixed: EWWW Image Optimizer optimizes image during resizing instead of waiting for metadata generation +* fixed: JPG quality not displaying correctly on network/multisite settings page +* fixed: some strings were not translatable +* fixed: bulk resize results container was not scrollable +* removed: legacy resize function for WP lower than 3.5 + += 2.3.7 = +* fixed: uploads to Media Library not detected properly +* changed: default JPG quality is now 82, to match the WordPress default +* changed: fr_FR and ru_RU moved to WP.org language packs +* changed: new maintainer + += 2.3.6 = +* tested up to WP 4.4 +* if resized image is not smaller than original, then keep original +* allow IMSANITY_AJAX_MAX_RECORDS to be overridden in wp-config.php +* if png-to-jpg is enabled, replace png transparency with white + += 2.3.5 = +* Add option to hide Imsanity girl logo image on settings screen + += 2.3.4 = +* Security update to network settings page + += 2.3.3 = +* Update default size from 1024 to 2048 +* Tested up to WordPress 4.1.1 +* Move screenshots to /assets folder +* Added 256x256 icon + += 2.3.2 = +* Add PNG-To-JPG Option thanks to Jody Nesbitt + += 2.3.1 = +* ignore errors if EXIF data is not readable +* show counter when bulk resizing images + += 2.3.0 = +* fix for incorrectly identifying media uploads as coming from 'other' on WP 4+ diff --git a/wp-content/plugins/imsanity/images/ajax-loader.gif b/wp-content/plugins/imsanity/images/ajax-loader.gif new file mode 100644 index 0000000..f3158f6 Binary files /dev/null and b/wp-content/plugins/imsanity/images/ajax-loader.gif differ diff --git a/wp-content/plugins/imsanity/imsanity.php b/wp-content/plugins/imsanity/imsanity.php new file mode 100644 index 0000000..16efd5e --- /dev/null +++ b/wp-content/plugins/imsanity/imsanity.php @@ -0,0 +1,269 @@ + 0 ) { + return IMSANITY_SOURCE_POST; + } + + // If the referrer is the post editor, that's a good indication the image is attached to a post. + if ( ! empty( $_SERVER['HTTP_REFERER'] ) && strpos( $_SERVER['HTTP_REFERER'], '/post.php' ) ) { + return IMSANITY_SOURCE_POST; + } + + // Post_id of 0 is 3.x otherwise use the action parameter. + if ( 0 === $id || 'upload-attachment' === $action ) { + return IMSANITY_SOURCE_LIBRARY; + } + + // We don't know where this one came from but $_REQUEST['_wp_http_referer'] may contain info. + return IMSANITY_SOURCE_OTHER; +} + +/** + * Given the source, returns the max width/height. + * + * @example: list( $w, $h ) = imsanity_get_max_width_height( IMSANITY_SOURCE_LIBRARY ); + * @param int $source One of IMSANITY_SOURCE_POST | IMSANITY_SOURCE_LIBRARY | IMSANITY_SOURCE_OTHER. + */ +function imsanity_get_max_width_height( $source ) { + $w = imsanity_get_option( 'imsanity_max_width', IMSANITY_DEFAULT_MAX_WIDTH ); + $h = imsanity_get_option( 'imsanity_max_height', IMSANITY_DEFAULT_MAX_HEIGHT ); + + switch ( $source ) { + case IMSANITY_SOURCE_POST: + break; + case IMSANITY_SOURCE_LIBRARY: + $w = imsanity_get_option( 'imsanity_max_width_library', $w ); + $h = imsanity_get_option( 'imsanity_max_height_library', $h ); + break; + default: + $w = imsanity_get_option( 'imsanity_max_width_other', $w ); + $h = imsanity_get_option( 'imsanity_max_height_other', $h ); + break; + } + + return array( $w, $h ); +} + +/** + * Handler after a file has been uploaded. If the file is an image, check the size + * to see if it is too big and, if so, resize and overwrite the original. + * + * @param Array $params The parameters submitted with the upload. + */ +function imsanity_handle_upload( $params ) { + + // If "noresize" is included in the filename then we will bypass imsanity scaling. + if ( strpos( $params['file'], 'noresize' ) !== false ) { + return $params; + } + + // If preferences specify so then we can convert an original bmp or png file into jpg. + if ( 'image/bmp' === $params['type'] && imsanity_get_option( 'imsanity_bmp_to_jpg', IMSANITY_DEFAULT_BMP_TO_JPG ) ) { + $params = imsanity_convert_to_jpg( 'bmp', $params ); + } + + if ( 'image/png' === $params['type'] && imsanity_get_option( 'imsanity_png_to_jpg', IMSANITY_DEFAULT_PNG_TO_JPG ) ) { + $params = imsanity_convert_to_jpg( 'png', $params ); + } + + // Make sure this is a type of image that we want to convert and that it exists. + $oldpath = $params['file']; + + if ( ( ! is_wp_error( $params ) ) && is_file( $oldpath ) && is_readable( $oldpath ) && is_writable( $oldpath ) && filesize( $oldpath ) > 0 && in_array( $params['type'], array( 'image/png', 'image/gif', 'image/jpeg' ), true ) ) { + + // figure out where the upload is coming from. + $source = imsanity_get_source(); + + list( $maxw,$maxh ) = imsanity_get_max_width_height( $source ); + + list( $oldw, $oldh ) = getimagesize( $oldpath ); + + if ( ( $oldw > $maxw && $maxw > 0 ) || ( $oldh > $maxh && $maxh > 0 ) ) { + $quality = imsanity_get_option( 'imsanity_quality', IMSANITY_DEFAULT_QUALITY ); + + $ftype = imsanity_quick_mimetype( $oldpath ); + $orientation = imsanity_get_orientation( $oldpath, $ftype ); + // If we are going to rotate the image 90 degrees during the resize, swap the existing image dimensions. + if ( 6 === (int) $orientation || 8 === (int) $orientation ) { + $old_oldw = $oldw; + $oldw = $oldh; + $oldh = $old_oldw; + } + + if ( $oldw > $maxw && $maxw > 0 && $oldh > $maxh && $maxh > 0 && apply_filters( 'imsanity_crop_image', false ) ) { + $neww = $maxw; + $newh = $maxh; + } else { + list( $neww, $newh ) = wp_constrain_dimensions( $oldw, $oldh, $maxw, $maxh ); + } + + remove_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 ); + $resizeresult = imsanity_image_resize( $oldpath, $neww, $newh, apply_filters( 'imsanity_crop_image', false ), null, null, $quality ); + if ( function_exists( 'ewww_image_optimizer_load_editor' ) ) { + add_filter( 'wp_image_editors', 'ewww_image_optimizer_load_editor', 60 ); + } + + if ( $resizeresult && ! is_wp_error( $resizeresult ) ) { + $newpath = $resizeresult; + + if ( is_file( $newpath ) && filesize( $newpath ) < filesize( $oldpath ) ) { + // we saved some file space. remove original and replace with resized image. + unlink( $oldpath ); + rename( $newpath, $oldpath ); + } elseif ( is_file( $newpath ) ) { + // theresized image is actually bigger in filesize (most likely due to jpg quality). + // keep the old one and just get rid of the resized image. + unlink( $newpath ); + } + } elseif ( false === $resizeresult ) { + return $params; + } elseif ( is_wp_error( $resizeresult ) ) { + // resize didn't work, likely because the image processing libraries are missing. + // remove the old image so we don't leave orphan files hanging around. + unlink( $oldpath ); + + $params = wp_handle_upload_error( + $oldpath, + sprintf( + /* translators: 1: error message 2: link to support forums */ + esc_html__( 'Imsanity was unable to resize this image for the following reason: %1$s. If you continue to see this error message, you may need to install missing server components. If you think you have discovered a bug, please report it on the Imsanity support forum: %2$s', 'imsanity' ), + $resizeresult->get_error_message(), + 'https://wordpress.org/support/plugin/imsanity' + ) + ); + } else { + return $params; + } + } + } + clearstatcache(); + return $params; +} + + +/** + * Read in the image file from the params and then save as a new jpg file. + * if successful, remove the original image and alter the return + * parameters to return the new jpg instead of the original + * + * @param string $type Type of the image to be converted: 'bmp' or 'png'. + * @param array $params The upload parameters. + * @return array altered params + */ +function imsanity_convert_to_jpg( $type, $params ) { + + $img = null; + + if ( 'bmp' === $type ) { + include_once( 'libs/imagecreatefrombmp.php' ); + $img = imagecreatefrombmp( $params['file'] ); + } elseif ( 'png' === $type ) { + if ( ! function_exists( 'imagecreatefrompng' ) ) { + return wp_handle_upload_error( $params['file'], esc_html__( 'Imsanity requires the GD library to convert PNG images to JPG', 'imsanity' ) ); + } + + $input = imagecreatefrompng( $params['file'] ); + // convert png transparency to white. + $img = imagecreatetruecolor( imagesx( $input ), imagesy( $input ) ); + imagefill( $img, 0, 0, imagecolorallocate( $img, 255, 255, 255 ) ); + imagealphablending( $img, true ); + imagecopy( $img, $input, 0, 0, 0, 0, imagesx( $input ), imagesy( $input ) ); + } else { + return wp_handle_upload_error( $params['file'], esc_html__( 'Unknown image type specified in imsanity_convert_to_jpg', 'imsanity' ) ); + } + + // We need to change the extension from the original to .jpg so we have to ensure it will be a unique filename. + $uploads = wp_upload_dir(); + $oldfilename = basename( $params['file'] ); + $newfilename = basename( str_ireplace( '.' . $type, '.jpg', $oldfilename ) ); + $newfilename = wp_unique_filename( $uploads['path'], $newfilename ); + + $quality = imsanity_get_option( 'imsanity_quality', IMSANITY_DEFAULT_QUALITY ); + + if ( imagejpeg( $img, $uploads['path'] . '/' . $newfilename, $quality ) ) { + // Conversion succeeded: remove the original bmp & remap the params. + unlink( $params['file'] ); + + $params['file'] = $uploads['path'] . '/' . $newfilename; + $params['url'] = $uploads['url'] . '/' . $newfilename; + $params['type'] = 'image/jpeg'; + } else { + unlink( $params['file'] ); + + return wp_handle_upload_error( + $oldfilename, + /* translators: %s: the image mime type */ + sprintf( esc_html__( 'Imsanity was unable to process the %s file. If you continue to see this error you may need to disable the conversion option in the Imsanity settings.', 'imsanity' ), $type ) + ); + } + + return $params; +} + +/* add filters to hook into uploads */ +add_filter( 'wp_handle_upload', 'imsanity_handle_upload' ); +add_action( 'plugins_loaded', 'imsanity_init' ); diff --git a/wp-content/plugins/imsanity/languages/imsanity-es_MX.mo b/wp-content/plugins/imsanity/languages/imsanity-es_MX.mo new file mode 100644 index 0000000..184d16a Binary files /dev/null and b/wp-content/plugins/imsanity/languages/imsanity-es_MX.mo differ diff --git a/wp-content/plugins/imsanity/languages/imsanity-es_MX.po b/wp-content/plugins/imsanity/languages/imsanity-es_MX.po new file mode 100644 index 0000000..80fdf83 --- /dev/null +++ b/wp-content/plugins/imsanity/languages/imsanity-es_MX.po @@ -0,0 +1,223 @@ +# Translation of Plugins - Imsanity - Development (trunk) in Spanish (Mexico) +# This file is distributed under the same license as the Plugins - Imsanity - Development (trunk) package. +msgid "" +msgstr "" +"PO-Revision-Date: 2015-12-08 16:01:42+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: GlotPress/2.3.0-alpha\n" +"Language: es_MX\n" +"Project-Id-Version: Plugins - Imsanity - Development (trunk)\n" + +#. Author URI of the plugin/theme +msgid "http://verysimple.com/" +msgstr "" + +#. Author of the plugin/theme +msgid "Jason Hinkle" +msgstr "" + +#. Description of the plugin/theme +msgid "Imsanity stops insanely huge image uploads" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://verysimple.com/products/imsanity/" +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "Imsanity" +msgstr "" + +#: settings.php:628 +msgid "Save Changes" +msgstr "Guardar Cambios" + +#: settings.php:619 +msgid "Convert PNG To JPG" +msgstr "" + +#: settings.php:611 +msgid "Convert BMP To JPG" +msgstr "Convertir BMP a JPG" + +#: settings.php:597 +msgid "JPG image quality" +msgstr "Calidad de imagen JPG" + +#: settings.php:556 +msgid "Imsanity settings have been configured by the server administrator. There are no site-specific settings available." +msgstr "Configuración de Imsanity se han configurado por el administrador del servidor. No se dispone de ninguna configuración específica." + +#: settings.php:539 +msgid "Search Images..." +msgstr "Búsqueda de imágenes..." + +#: settings.php:532 +msgid "" +"It is HIGHLY recommended that you backup \n" +"\t\tyour wp-content/uploads folder before proceeding. You will have a chance to preview and select the images to convert.\n" +"\t\tIt is also recommended that you initially select only 1 or 2 images and verify that everything is ok before\n" +"\t\tprocessing your entire library. You have been warned!" +msgstr "" +"Importante! Es recomendable que realizar el backup de carpeta wp-content/uploads \\\t\\\tyour antes de proceder. Usted tendrá la oportunidad de escuchar y seleccionar las imágenes a convertir.\n" +"\\\t\\\tIt también se recomienda que inicialmente seleccionar sólo 1 ó 2 imágenes y comprobar que todo está bien antes de \\\t\\\tprocessing la biblioteca entera. Estáis avisados." + +#: settings.php:530 +msgid "WARNING: BULK RESIZE WILL ALTER YOUR ORIGINAL IMAGES AND CANNOT BE UNDONE!" +msgstr "ADVERTENCIA: A GRANEL RESIZE ALTERARà SUS IMÃGENES ORIGINALES Y NO SE PUEDE DESHACER!" + +#: settings.php:519 +msgid "Bulk Resize Images" +msgstr "A granel redimensionar imágenes" + +#: settings.php:501 +msgid "Imsanity Settings" +msgstr "Configuración de Imsanity" + +#: settings.php:484 +msgid "

                      Imsanity Version %s by %s

                      " +msgstr "

                      Imsanity versión %s de %s

                      " + +#: settings.php:469 +msgid "" +"

                      Imsanity automaticaly reduces the size of images that are larger than the specified maximum and replaces the original\n" +"\t\twith one of a more \"sane\" size. Site contributors don\\'t need to concern themselves with manually scaling images\n" +"\t\tand can upload them directly from their camera or phone.

                      \n" +"\n" +"\t\t

                      The resolution of modern cameras is larger than necessary for typical web display.\n" +"\t\tThe average computer screen is not big enough to display a 3 megapixel camera-phone image at full resolution.\n" +"\t\tWordPress does a good job of creating scaled-down copies which can be used, however the original images\n" +"\t\tare permanently stored, taking up disk quota and, if used on a page, create a poor viewer experience.

                      \n" +"\n" +"\t\t

                      This plugin is designed for sites where high-resolution images are not necessary and/or site contributors\n" +"\t\tdo not want (or understand how) to deal with scaling images. This plugin should not be used on\n" +"\t\tsites for which original, high-resolution images must be stored.

                      \n" +"\n" +"\t\t

                      Be sure to save back-ups of your full-sized images if you wish to keep them.

                      " +msgstr "" +"

                      Imsanity reduce de forma automática el tamaño de las imágenes que son más grandes que el máximo especificado y sustituye al original\n" +"\\\t\\\twith uno de un tamaño más\"sano\" . Colaboradores del sitio don\\'t tiene que preocuparse por la ampliación de imágenes manualmente\n" +"\\\t\\\tand puede cargar directamente desde su cámara o teléfono . < / P>\n" +"\n" +"\\\t\\\t

                      La resolución de las cámaras modernas es más grande de lo necesario para la visualización web típica .\n" +"\\\t\\pantalla media lLa no es lo suficientemente grande como para mostrar una imagen de la cámara - teléfono 3 megapíxeles con la máxima resolución .\n" +"\\\t\\\tWordPress hace un buen trabajo de crear a escala reducida copias que se pueden utilizar , sin embargo, las imágenes originales\n" +"\\\t\\\tara almacenado de forma permanente , tomando cuota de disco y , si se utiliza en una página, crear una experiencia pobre espectador. < / p>\n" +"\n" +"\\\t\\\t < p> Este plugin está diseñado para los sitios donde las imágenes de alta resolución no son necesarios y / o sitio contribuyentes\n" +"\\\t\\\tno quieren ( o entender cómo) para hacer frente a las imágenes de escala. Este complemento no se debe utilizar en\n" +"\\\t\\\tsites para que las imágenes originales de alta resolución deben ser almacenados .

                      \n" +"\n" +"\\\t\\\t

                      Asegúrese de guardar copias de seguridad de toda su imágenes de tamaño si lo desea para mantenerlos .

                      " + +#: settings.php:467 +msgid "Imsanity automatically resizes insanely huge image uploads" +msgstr "Automáticamente cambia el tamaño de imagen enorme subidas" + +#: settings.php:286 +msgid "Update Settings" +msgstr "Configuración de actualización" + +#: settings.php:281 settings.php:607 +msgid " (WordPress default is 90)" +msgstr " (Por defecto de WordPress es 90)" + +#: settings.php:271 +msgid "JPG Quality" +msgstr "Calidad JPG" + +#: settings.php:263 +msgid "Convert PNG to JPG" +msgstr "" + +#: settings.php:258 settings.php:266 settings.php:614 settings.php:622 +msgid "No" +msgstr "No" + +#: settings.php:257 settings.php:265 settings.php:613 settings.php:621 +msgid "Yes" +msgstr "Si" + +#: settings.php:255 +msgid "Convert BMP to JPG" +msgstr "Convertir BMP a JPG" + +#: settings.php:247 settings.php:589 +msgid "Images uploaded elsewhere (Theme headers, backgrounds, logos, etc)" +msgstr "Imágenes subidas en otros lugares (tema cabeceras, fondos, logotipos, etc.)" + +#: settings.php:239 settings.php:582 +msgid "Images uploaded directly to the Media Library" +msgstr "Imágenes subidas directamente a la biblioteca multimedia" + +#: settings.php:234 settings.php:242 settings.php:250 settings.php:577 +#: settings.php:584 settings.php:591 +msgid " (or enter 0 to disable)" +msgstr " (o escriba 0 para desactivar)" + +#: settings.php:231 settings.php:575 +msgid "Images uploaded within a Page/Post" +msgstr "Imágenes subidas dentro de un página y Post" + +#: settings.php:225 +msgid "Use global Imsanity settings (below) for all sites" +msgstr "Utilice la configuración global Imsanity (abajo) para todos los sitios" + +#: settings.php:224 +msgid "Allow each site to configure Imsanity settings" +msgstr "Permitir que cada sitio configurar las opciones de Imsanity" + +#: settings.php:221 +msgid "Global Settings Override" +msgstr "Anulación de la configuración global" + +#: settings.php:207 +msgid "Imsanity network settings saved." +msgstr "Configuración de red Imsanity guardado." + +#: settings.php:187 settings.php:200 +msgid "Imsanity Network Settings" +msgstr "Configuración de red Imsanity" + +#: settings.php:40 +msgid "Imsanity Plugin Settings" +msgstr "Configuración de Imsanity" + +#: libs/imagecreatefrombmp.php:129 +msgid "imagecreatefrombmp: %s has %d bits and this is not supported!" +msgstr "imagecreatefrombmp: %s tiene %d bits y esto no es compatible." + +#: libs/imagecreatefrombmp.php:43 +msgid "imagecreatefrombmp: Can not obtain filesize of %s !" +msgstr "imagecreatefrombmp: no puede obtener tamaño de %s!" + +#: libs/imagecreatefrombmp.php:21 +msgid "imagecreatefrombmp: %s is not a bitmap!" +msgstr "imagecreatefrombmp: %s no es un mapa de bits." + +#: libs/imagecreatefrombmp.php:14 +msgid "imagecreatefrombmp: Can not open %s!" +msgstr "imagecreatefrombmp: no se puede abrir %s!" + +#: ajax.php:185 +msgid "ERROR: (Attachment with ID of %s not found) " +msgstr "ERROR: (Adjunto con el ID de %s no encontrado) " + +#: ajax.php:179 +msgid "SKIPPED: %s (Resize not required)" +msgstr "OMITIDOS: %s (no es necesario redimensionar)" + +#: ajax.php:174 +msgid "ERROR: %s (%s)" +msgstr "ERROR: %s (%s)" + +#: ajax.php:170 +msgid "OK: %s" +msgstr "Bueno %s" + +#: ajax.php:98 +msgid "Missing ID Parameter" +msgstr "Falta el parámetro ID" \ No newline at end of file diff --git a/wp-content/plugins/imsanity/languages/imsanity-sv_SE.mo b/wp-content/plugins/imsanity/languages/imsanity-sv_SE.mo new file mode 100644 index 0000000..b45c674 Binary files /dev/null and b/wp-content/plugins/imsanity/languages/imsanity-sv_SE.mo differ diff --git a/wp-content/plugins/imsanity/languages/imsanity-sv_SE.po b/wp-content/plugins/imsanity/languages/imsanity-sv_SE.po new file mode 100644 index 0000000..62edba1 --- /dev/null +++ b/wp-content/plugins/imsanity/languages/imsanity-sv_SE.po @@ -0,0 +1,225 @@ +# Translation of Plugins - Imsanity - Development (trunk) in Swedish +# This file is distributed under the same license as the Plugins - Imsanity - Development (trunk) package. +msgid "" +msgstr "" +"PO-Revision-Date: 2015-09-23 14:53:56+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: GlotPress/2.3.0-alpha\n" +"Language: sv_SE\n" +"Project-Id-Version: Plugins - Imsanity - Development (trunk)\n" + +#. Author URI of the plugin/theme +msgid "http://verysimple.com/" +msgstr "" + +#. Author of the plugin/theme +msgid "Jason Hinkle" +msgstr "" + +#. Description of the plugin/theme +msgid "Imsanity stops insanely huge image uploads" +msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://verysimple.com/products/imsanity/" +msgstr "" + +#. Plugin Name of the plugin/theme +msgid "Imsanity" +msgstr "" + +#: settings.php:628 +msgid "Save Changes" +msgstr "Spara Ändringar" + +#: settings.php:619 +msgid "Convert PNG To JPG" +msgstr "" + +#: settings.php:611 +msgid "Convert BMP To JPG" +msgstr "Konvertera BMP till JPG" + +#: settings.php:597 +msgid "JPG image quality" +msgstr "Bildkvalitet för JPG" + +#: settings.php:556 +msgid "Imsanity settings have been configured by the server administrator. There are no site-specific settings available." +msgstr "Imsanitys inställningar har konfigurerats av serveradministratören. Det finns inga webbplatsspecifika inställningar tillgängliga." + +#: settings.php:539 +msgid "Search Images..." +msgstr "Sök Bilder..." + +#: settings.php:532 +msgid "" +"It is HIGHLY recommended that you backup \n" +"\t\tyour wp-content/uploads folder before proceeding. You will have a chance to preview and select the images to convert.\n" +"\t\tIt is also recommended that you initially select only 1 or 2 images and verify that everything is ok before\n" +"\t\tprocessing your entire library. You have been warned!" +msgstr "" +"Du rekommenderas STARKT att ta backup på \n" +"\t\tdin wp-content/uploads mapp innan du fortsätter. Du kommer att få möjlighet att förhandsvisa och välja bilder att konvertera.\n" +"\t\tDu rekommenderas också att först prova med 1 eller 2 bilder och kontrollera att all är ok innan\n" +"\t\tdu processar hela mediabiblioteket. Du har blivit varnad!" + +#: settings.php:530 +msgid "WARNING: BULK RESIZE WILL ALTER YOUR ORIGINAL IMAGES AND CANNOT BE UNDONE!" +msgstr "VARNING: BULKSKALNING KOMMER ATT ÄNDRA ORIGINALBILDERNA OCH KAN INTE ÅNGRAS!" + +#: settings.php:519 +msgid "Bulk Resize Images" +msgstr "Bulkskala Bilder" + +#: settings.php:501 +msgid "Imsanity Settings" +msgstr "Imsanity Inställningar" + +#: settings.php:484 +msgid "

                      Imsanity Version %s by %s

                      " +msgstr "

                      Imsanity Version %s av %s

                      " + +#: settings.php:469 +msgid "" +"

                      Imsanity automaticaly reduces the size of images that are larger than the specified maximum and replaces the original\n" +"\t\twith one of a more \"sane\" size. Site contributors don\\'t need to concern themselves with manually scaling images\n" +"\t\tand can upload them directly from their camera or phone.

                      \n" +"\n" +"\t\t

                      The resolution of modern cameras is larger than necessary for typical web display.\n" +"\t\tThe average computer screen is not big enough to display a 3 megapixel camera-phone image at full resolution.\n" +"\t\tWordPress does a good job of creating scaled-down copies which can be used, however the original images\n" +"\t\tare permanently stored, taking up disk quota and, if used on a page, create a poor viewer experience.

                      \n" +"\n" +"\t\t

                      This plugin is designed for sites where high-resolution images are not necessary and/or site contributors\n" +"\t\tdo not want (or understand how) to deal with scaling images. This plugin should not be used on\n" +"\t\tsites for which original, high-resolution images must be stored.

                      \n" +"\n" +"\t\t

                      Be sure to save back-ups of your full-sized images if you wish to keep them.

                      " +msgstr "" +"

                      Imsanity reducerar automatiskt storleken på bilder som är större än den specificerade maxstorleken och ersätter originalet\n" +"\t\tmed en version som har en mer \"sund\" storlek. Webbplatsmedarbetare behöver inte bekymra sig om att manuellt skala bilder\n" +"\t\toch kan ladda upp dem direkt från sin kamera eller mobil.

                      \n" +"\n" +"\t\t

                      Upplösningen på moderna kameror är högre än nödvändigt för vanlig webbvisning.\n" +"\t\tDen genomsnittliga datorskärmen är inte stor nog att visa en 3 megapixels bild från kamera/telefon i full upplösning.\n" +"\t\tWordPress gör ett bra jobb med att skapa nedskalade kopior som kan användas, men originalbilderna\n" +"\t\tlagras permanent och upptar diskutrymme och skapar en dålig visuell upplevelse för besökaren om de används på en sida.

                      \n" +"\n" +"\t\t

                      Detta insticksprogram är designat för webbplatser där högupplösta bilder inte är nödvändiga och/eller webbplatsmedarbetare\n" +"\t\tinte vill (eller kan) skala bilder. Detta insticksprogram bör inte användas på\n" +"\t\twebbplatser där högupplösta bildoriginal måste lagras.

                      \n" +"\n" +"\t\t

                      Se till att spara kopior av dina bildoriginal i full storlek om du vill behålla dem.

                      " + +#: settings.php:467 +msgid "Imsanity automatically resizes insanely huge image uploads" +msgstr "Imsanity förminskar automatiskt uppladdade bilder som är galet stora" + +#: settings.php:286 +msgid "Update Settings" +msgstr "Uppdatera Inställningar" + +#: settings.php:281 settings.php:607 +msgid " (WordPress default is 90)" +msgstr " (Wordpress standardinställning är 90)" + +#: settings.php:271 +msgid "JPG Quality" +msgstr "JPG-kvalitet" + +#: settings.php:263 +msgid "Convert PNG to JPG" +msgstr "" + +#: settings.php:258 settings.php:266 settings.php:614 settings.php:622 +msgid "No" +msgstr "Nej" + +#: settings.php:257 settings.php:265 settings.php:613 settings.php:621 +msgid "Yes" +msgstr "Ja" + +#: settings.php:255 +msgid "Convert BMP to JPG" +msgstr "Konvertera BMP till JPG" + +#: settings.php:247 settings.php:589 +msgid "Images uploaded elsewhere (Theme headers, backgrounds, logos, etc)" +msgstr "Bilder uppladdade på andra ställen (Sidhuvud för teman, bakgrunder, logotyper, etc.)" + +#: settings.php:239 settings.php:582 +msgid "Images uploaded directly to the Media Library" +msgstr "Bilder uppladdade direkt till Mediabiblioteket" + +#: settings.php:234 settings.php:242 settings.php:250 settings.php:577 +#: settings.php:584 settings.php:591 +msgid " (or enter 0 to disable)" +msgstr "(eller ange 0 för att deaktivera)" + +#: settings.php:231 settings.php:575 +msgid "Images uploaded within a Page/Post" +msgstr "Bilder uppladdade till en Sida/Inlägg" + +#: settings.php:225 +msgid "Use global Imsanity settings (below) for all sites" +msgstr "Använd Imsanitys globala inställningar (nedan) för alla webbplatser" + +#: settings.php:224 +msgid "Allow each site to configure Imsanity settings" +msgstr "Tillåt varje webbplats att konfigurera Imsanitys inställningar" + +#: settings.php:221 +msgid "Global Settings Override" +msgstr "Åsidosätt Globala Inställningar" + +#: settings.php:207 +msgid "Imsanity network settings saved." +msgstr "Imsanity nätverksinställningar sparades." + +#: settings.php:187 settings.php:200 +msgid "Imsanity Network Settings" +msgstr "Imsanity Nätverksinställningar" + +#: settings.php:40 +msgid "Imsanity Plugin Settings" +msgstr "Imsanity Programinställningar" + +#: libs/imagecreatefrombmp.php:129 +msgid "imagecreatefrombmp: %s has %d bits and this is not supported!" +msgstr "imagecreatefrombmp: %s har %d bits vilket inte stöds!" + +#: libs/imagecreatefrombmp.php:43 +msgid "imagecreatefrombmp: Can not obtain filesize of %s !" +msgstr "imagecreatefrombmp: Kan inte hämta filstorlek %s!" + +#: libs/imagecreatefrombmp.php:21 +msgid "imagecreatefrombmp: %s is not a bitmap!" +msgstr "imagecreatefrombmp: %s är ingen bitmap!" + +#: libs/imagecreatefrombmp.php:14 +msgid "imagecreatefrombmp: Can not open %s!" +msgstr "imagecreatefrombmp: Kan inte öppna %s !" + +#: ajax.php:185 +msgid "ERROR: (Attachment with ID of %s not found) " +msgstr "FEL: (Bilaga med ID %s hittades ej) " + +#: ajax.php:179 +msgid "SKIPPED: %s (Resize not required)" +msgstr "HOPPADE ÖVER: %s (Storleksändring behövs ej)" + +#: ajax.php:174 +msgid "ERROR: %s (%s)" +msgstr "FEL: %s (%s)" + +#: ajax.php:170 +msgid "OK: %s" +msgstr "OK: %s" + +#: ajax.php:98 +msgid "Missing ID Parameter" +msgstr "Saknad ID-parameter" \ No newline at end of file diff --git a/wp-content/plugins/imsanity/languages/readme.txt b/wp-content/plugins/imsanity/languages/readme.txt new file mode 100644 index 0000000..da77263 --- /dev/null +++ b/wp-content/plugins/imsanity/languages/readme.txt @@ -0,0 +1,11 @@ +LANGUAGE TRANSLATION FILES FOR IMSANITY +--------------------------------------- + +If you are interested in creating a language translation for Imsanity then +you're in the right place! We would love your help, and you +can get started translating Imsanity at https://translate.wordpress.org/projects/wp-plugins/imsanity + +Anything you can do to help is greatly appreciated and allows +Imsanity to be more easily used by people all over the world. + +Thank you for supporting Imsanity and all free software! diff --git a/wp-content/plugins/imsanity/libs/imagecreatefrombmp.php b/wp-content/plugins/imsanity/libs/imagecreatefrombmp.php new file mode 100644 index 0000000..a0561e4 --- /dev/null +++ b/wp-content/plugins/imsanity/libs/imagecreatefrombmp.php @@ -0,0 +1,315 @@ + $color ) { + $palette[ $i ] = $color + 16777216; + } + } + } + + // ignore extra bitmap headers. + if ( $meta['headersize'] > $bytes_read ) { + fread( $fh, $meta['headersize'] - $bytes_read ); + } + + // create gd image. + $im = imagecreatetruecolor( $meta['width'], $meta['height'] ); + $data = fread( $fh, $meta['imagesize'] ); + + // uncompress data. + switch ( $meta['compression'] ) { + case 1: + $data = rle8_decode( $data, $meta['width'] ); + break; + case 2: + $data = rle4_decode( $data, $meta['width'] ); + break; + } + + $p = 0; + $vide = chr( 0 ); + $y = $meta['height'] - 1; + /* translators: %s: the image filename */ + $error = sprintf( __( 'imagecreatefrombmp: %s has not enough data!', 'imsanity' ), $filename ); + // loop through the image data beginning with the lower left corner. + while ( $y >= 0 ) { + $x = 0; + while ( $x < $meta['width'] ) { + switch ( $meta['bits'] ) { + case 32: + case 24: + $part = substr( $data, $p, 3 ); + if ( ! $part ) { + trigger_error( $error, E_USER_WARNING ); + return $im; + } + $color = unpack( 'V', $part . $vide ); + break; + case 16: + $part = substr( $data, $p, 2 ); + if ( ! $part ) { + trigger_error( $error, E_USER_WARNING ); + return $im; + } + $color = unpack( 'v', $part ); + if ( empty( $meta['rMask'] ) || 0xf800 !== (int) $meta['rMask'] ) { + $color[1] = ( ( $color[1] & 0x7c00 ) >> 7 ) * 65536 + ( ( $color[1] & 0x03e0 ) >> 2 ) * 256 + ( ( $color[1] & 0x001f ) << 3 ); // 555. + } else { + $color[1] = ( ( $color[1] & 0xf800 ) >> 8 ) * 65536 + ( ( $color[1] & 0x07e0 ) >> 3 ) * 256 + ( ( $color[1] & 0x001f ) << 3 ); // 565. + } + break; + case 8: + $color = unpack( 'n', $vide . substr( $data, $p, 1 ) ); + $color[1] = $palette[ $color[1] + 1 ]; + break; + case 4: + $color = unpack( 'n', $vide . substr( $data, floor( $p ), 1 ) ); + $color[1] = 0 === ( $p * 2 ) % 2 ? $color[1] >> 4 : $color[1] & 0x0F; + $color[1] = $palette[ $color[1] + 1 ]; + break; + case 1: + $color = unpack( 'n', $vide . substr( $data, floor( $p ), 1 ) ); + switch ( ( $p * 8 ) % 8 ) { + case 0: + $color[1] = $color[1] >> 7; + break; + case 1: + $color[1] = ( $color[1] & 0x40 ) >> 6; + break; + case 2: + $color[1] = ( $color[1] & 0x20 ) >> 5; + break; + case 3: + $color[1] = ( $color[1] & 0x10 ) >> 4; + break; + case 4: + $color[1] = ( $color[1] & 0x8 ) >> 3; + break; + case 5: + $color[1] = ( $color[1] & 0x4 ) >> 2; + break; + case 6: + $color[1] = ( $color[1] & 0x2 ) >> 1; + break; + case 7: + $color[1] = ( $color[1] & 0x1 ); + break; + } + $color[1] = $palette[ $color[1] + 1 ]; + break; + default: + /* translators: 1: the image filename 2: bitrate of image */ + trigger_error( sprintf( __( 'imagecreatefrombmp: %1$s has %2$d bits and this is not supported!', 'imsanity' ), $filename, $meta['bits'] ), E_USER_WARNING ); + return false; + } + imagesetpixel( $im, $x, $y, $color[1] ); + $x++; + $p += $meta['bytes']; + } + $y--; + $p += $meta['decal']; + } + fclose( $fh ); + return $im; + } + /** + * The original source for these functions no longer exists, but it appears to come from + * MSDN and has proliferated across many projects with only the stale link which now + * points to https://docs.microsoft.com/en-us/windows/desktop/gdi/bitmap-compression. + */ + /** + * Decoder for RLE8 compression in windows bitmaps. + * + * @param string $str Data to decode. + * @param integer $width Image width. + * + * @return string + */ + function rle8_decode( $str, $width ) { + $linewidth = $width + ( 3 - ( $width - 1 ) % 4 ); + $out = ''; + $cnt = strlen( $str ); + + for ( $i = 0; $i < $cnt; $i++ ) { + $o = ord( $str[ $i ] ); + switch ( $o ) { + case 0: // ESCAPE. + $i++; + switch ( ord( $str[ $i ] ) ) { + case 0: // NEW LINE. + $padcnt = $linewidth - strlen( $out ) % $linewidth; + if ( $padcnt < $linewidth ) { + $out .= str_repeat( chr( 0 ), $padcnt ); // pad line. + } + break; + case 1: // END OF FILE. + $padcnt = $linewidth - strlen( $out ) % $linewidth; + if ( $padcnt < $linewidth ) { + $out .= str_repeat( chr( 0 ), $padcnt ); // pad line. + } + break 3; + case 2: // DELTA. + $i += 2; + break; + default: // ABSOLUTE MODE. + $num = ord( $str[ $i ] ); + for ( $j = 0; $j < $num; $j++ ) { + $out .= $str[ ++$i ]; + } + if ( $num % 2 ) { + $i++; + } + } + break; + default: + $out .= str_repeat( $str[ ++$i ], $o ); + } + } + return $out; + } + + /** + * Decoder for RLE4 compression in windows bitmaps. + * + * @param string $str Data to decode. + * @param integer $width Image width. + * @return string + */ + function rle4_decode( $str, $width ) { + $w = floor( $width / 2 ) + ( $width % 2 ); + $linewidth = $w + ( 3 - ( ( $width - 1 ) / 2 ) % 4 ); + $pixels = array(); + $cnt = strlen( $str ); + $c = 0; + + for ( $i = 0; $i < $cnt; $i++ ) { + $o = ord( $str[ $i ] ); + switch ( $o ) { + case 0: // ESCAPE. + $i++; + switch ( ord( $str[ $i ] ) ) { + case 0: // NEW LINE. + while ( 0 !== count( $pixels ) % $linewidth ) { + $pixels[] = 0; + } + break; + case 1: // END OF FILE. + while ( 0 !== count( $pixels ) % $linewidth ) { + $pixels[] = 0; + } + break 3; + case 2: // DELTA. + $i += 2; + break; + default: // ABSOLUTE MODE. + $num = ord( $str[ $i ] ); + for ( $j = 0; $j < $num; $j++ ) { + if ( 0 === $j % 2 ) { + $c = ord( $str[ ++$i ] ); + $pixels[] = ( $c & 240 ) >> 4; + } else { + $pixels[] = $c & 15; + } + } + + if ( 0 === $num % 2 ) { + $i++; + } + } + break; + default: + $c = ord( $str[ ++$i ] ); + for ( $j = 0; $j < $o; $j++ ) { + $pixels[] = ( 0 === $j % 2 ? ( $c & 240 ) >> 4 : $c & 15 ); + } + } + } + + $out = ''; + if ( count( $pixels ) % 2 ) { + $pixels[] = 0; + } + + $cnt = count( $pixels ) / 2; + + for ( $i = 0; $i < $cnt; $i++ ) { + $out .= chr( 16 * $pixels[ 2 * $i ] + $pixels[ 2 * $i + 1 ] ); + } + + return $out; + } +} diff --git a/wp-content/plugins/imsanity/libs/utils.php b/wp-content/plugins/imsanity/libs/utils.php new file mode 100644 index 0000000..1c5a2cf --- /dev/null +++ b/wp-content/plugins/imsanity/libs/utils.php @@ -0,0 +1,181 @@ +" + . ( $title ? "

                      " . $title . '

                      ' : '' ) + . $message + . '' ); + if ( $die ) { + die(); + } +} + +/** + * Replacement for deprecated image_resize function + * + * @param string $file Image file path. + * @param int $max_w Maximum width to resize to. + * @param int $max_h Maximum height to resize to. + * @param bool $crop Optional. Whether to crop image or resize. + * @param string $suffix Optional. File suffix. + * @param string $dest_path Optional. New image file path. + * @param int $jpeg_quality Optional, default is 90. Image quality percentage. + * @return mixed WP_Error on failure. String with new destination path. + */ +function imsanity_image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 82 ) { + if ( function_exists( 'wp_get_image_editor' ) ) { + $editor = wp_get_image_editor( $file ); + if ( is_wp_error( $editor ) ) { + return $editor; + } + $editor->set_quality( $jpeg_quality ); + + $ftype = imsanity_quick_mimetype( $file ); + + $orientation = imsanity_get_orientation( $file, $ftype ); + // Try to correct for auto-rotation if the info is available. + switch ( $orientation ) { + case 3: + $editor->rotate( 180 ); + break; + case 6: + $editor->rotate( -90 ); + break; + case 8: + $editor->rotate( 90 ); + break; + } + + $resized = $editor->resize( $max_w, $max_h, $crop ); + if ( is_wp_error( $resized ) ) { + return $resized; + } + + $dest_file = $editor->generate_filename( $suffix, $dest_path ); + + // FIX: make sure that the destination file does not exist. this fixes + // an issue during bulk resize where one of the optimized media filenames may get + // used as the temporary file, which causes it to be deleted. + while ( file_exists( $dest_file ) ) { + $dest_file = $editor->generate_filename( 'TMP', $dest_path ); + } + + $saved = $editor->save( $dest_file ); + + if ( is_wp_error( $saved ) ) { + return $saved; + } + + return $dest_file; + } + return false; +} diff --git a/wp-content/plugins/imsanity/license.txt b/wp-content/plugins/imsanity/license.txt new file mode 100644 index 0000000..e1e79fb --- /dev/null +++ b/wp-content/plugins/imsanity/license.txt @@ -0,0 +1,782 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +Additional Copyrights + +Portions of the software are derived from +Licenses of included software: + +arrive.js + +Copyright (c) 2014-2017 Uzair Farooq + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +optipng + +Copyright (C) 2001-2017 Cosmin Truta and the Contributing Authors. +For the purpose of copyright and licensing, the list of Contributing +Authors is available in the accompanying AUTHORS file. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the author(s) be held liable for any damages +arising from the use of this software. + +pngquant.c + +© 1989, 1991 by Jef Poskanzer. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided +that the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. This software is provided "as is" without express or +implied warranty. + +pngquant.c and rwpng.c/h + +© 1997-2002 by Greg Roelofs; based on an idea by Stefan Schneider. +© 2009-2017 by Kornel Lesiński. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +WebP + +Copyright (c) 2010, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/wp-content/plugins/imsanity/phpcs.ruleset.xml b/wp-content/plugins/imsanity/phpcs.ruleset.xml new file mode 100644 index 0000000..271d372 --- /dev/null +++ b/wp-content/plugins/imsanity/phpcs.ruleset.xml @@ -0,0 +1,15 @@ + + + Generally-applicable sniffs for WordPress plugins + + */vendor/* + */tests/* + + + + + + + + + diff --git a/wp-content/plugins/imsanity/readme.txt b/wp-content/plugins/imsanity/readme.txt new file mode 100644 index 0000000..e468c00 --- /dev/null +++ b/wp-content/plugins/imsanity/readme.txt @@ -0,0 +1,160 @@ +=== Imsanity === +Contributors: nosilver4u +Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW +Tags: image, scale, resize, space saver, quality +Requires at least: 4.9 +Tested up to: 5.2 +Requires PHP: 5.6 +Stable tag: 2.4.3 +License: GPLv3 + +Imsanity automatically resizes huge image uploads. Are contributors uploading huge photos? Tired of manually scaling? Imsanity to the rescue! + +== Description == + +Imsanity automatically resizes huge image uploads down to a size that is +more reasonable for display in browser, yet still more than large enough for typical website use. +The plugin is configurable with a max width, height and quality. When a contributor uploads an +image that is larger than the configured size, Imsanity will automatically scale it down to the +configured size and replace the original image. + +Imsanity also provides a bulk-resize feature to selectively resize previously uploaded images +to free up disk space. + +This plugin is ideal for blogs that do not require hi-resolution original images +to be stored and/or the contributors don't want (or understand how) to scale images +before uploading. + += Features = + +* Automatically scales large image uploads to a more "sane" size +* Bulk-resize feature to selectively resize existing images +* Allows configuration of max width/height and jpg quality +* Optionally converts BMP files to JPG so image can be scaled +* Once enabled, Imsanity requires no actions on the part of the user +* Uses WordPress built-in image scaling functions + += Translations = + +Imsanity is available in several languages, each of which will be downloaded automatically when you install the plugin. To help translate it into your language, visit https://translate.wordpress.org/projects/wp-plugins/imsanity + += Contribute = + +Imsanity is developed at https://github.com/nosilver4u/imsanity (pull requests are welcome) + +== Installation == + +Automatic Installation: + +1. Go to Admin -> Plugins -> Add New and search for "imsanity" +2. Click the Install Button +3. Click 'Activate' + +Manual Installation: + +1. Download imsanity.zip +2. Unzip and upload the 'imsanity' folder to your '/wp-content/plugins/' directory +3. Activate the plugin through the 'Plugins' menu in WordPress + +== Screenshots == + +1. Imsanity settings page to configure max height/width +2. Imsanity bulk image resize feature + +== Frequently Asked Questions == + += What is Imsanity? = + +Imsanity is a plugin that automatically resizes uploaded images that are larger than the configured max width/height + += Will installing the Imsanity plugin alter existing images in my blog? = + +Activating Imsanity will not alter any existing images. Imsanity resizes images as they are uploaded so +it does not affect existing images unless you specifically use the "Bulk Image Resize" feature on +the Imsanity settings page. The "Bulk Image Resize" feature allows you to selectively resize existing images. + += Why aren't all of my images detected when I try to use the bulk resize feature? = + +Imsanity doesn't search your file system to find large files, instead it looks at the "metadata" +in the WordPress media library database. To override this behavior, enable deep scanning. + += Why am I getting an error saying that my "File is not an image" ? = + +WordPress uses the GD library to handle the image manipulation. GD can be installed and configured to support +various types of images. If GD is not configured to handle a particular image type then you will get +this message when you try to upload it. For more info see http://php.net/manual/en/image.installation.php + += How can I tell Imsanity to ignore a certain image so I can upload it without being resized? = + +You can re-name your file and add "-noresize" to the filename. For example if your file is named +"photo.jpg" you can rename it "photo-noresize.jpg" and Imsanity will ignore it, allowing you +to upload the full-sized image. + +Optionally you can temporarily adjust the max image size settings and set them to a number that is +higher than the resolution of the image you wish to upload + += Why would I need this plugin? = + +Photos taken on any modern camera and even most cellphones are too large for display full-size in a browser. +In the case of modern DSLR cameras, the image sizes are intended for high-quality printing and are ridiculously +over-sized for display on a web page. + +Imsanity allows you to set a sanity limit so that all uploaded images will be constrained +to a reasonable size which is still more than large enough for the needs of a typical website. +Imsanity hooks into WordPress immediately after the image upload, but before WordPress processing +occurs. So WordPress behaves exactly the same in all ways, except it will be as if the contributor +had scaled their image to a reasonable size before uploading. + +The size limit that imsanity uses is configurable. The default value is large enough to fill +the average vistors entire screen without scaling so it is still more than large enough for +typical usage. + += Why would I NOT want to use this plugin? = + +You might not want to use Imsanity if you use WordPress as a stock art download +site, provide high-res images for print or use WordPress as a high-res photo +storage archive. If you are doing any of these things then most likely +you already have a good understanding of image resolution. + += Doesn't WordPress already automatically scale images? = + +When an image is uploaded WordPress keeps the original and, depending on the size of the original, +will create up to 4 smaller sized copies of the file (Large, Medium-Large, Medium, Thumbnail) which are intended +for embedding on your pages. Unless you have special photographic needs, the original usually sits +there unused, but taking up disk quota. + += Why did you spell Insanity wrong? = + +Imsanity is short for "Image Sanity Limit". A sanity limit is a term for limiting something down to +a size or value that is reasonable. + += Where do I go for support? = + +Questions may be posted on the support forum at https://wordpress.org/support/plugin/imsanity but if you don't get an answer, please use https://ewww.io/contact-us/. + +== Changelog == + += 2.4.3 = +* changed: default size from 2048 to 1920 +* fixed: WP Import plugin breaks during Media imports +* fixed: setting a value to 0 causes errors on multi-site +* fixed: conversion settings not displaying correctly on multi-site + += 2.4.2 = +* changed: noresize in filename also works in batch processing +* fixed: error message does not contain filename when file is missing +* fixed: notice on network settings when deep scan option has not been set before + += 2.4.1 = +* fixed: bulk resizer scan returning incorrect results +* fixed: sprintf error during resizing and upload + += 2.4.0 = +* added: deep scanning option for when attachment metadata isn't updating properly +* fixed: uploads from Gutenberg not detected properly +* fixed: some other plugin(s) trying to muck with the Imsanity settings links and breaking things +* fixed: undefined notice for query during ajax operation +* fixed: stale metadata could prevent further resizing + += Earlier versions = +Please refer to the separate changelog.txt file. diff --git a/wp-content/plugins/imsanity/scripts/imsanity.js b/wp-content/plugins/imsanity/scripts/imsanity.js new file mode 100644 index 0000000..ef1c681 --- /dev/null +++ b/wp-content/plugins/imsanity/scripts/imsanity.js @@ -0,0 +1,123 @@ +/** + * imsanity admin javascript functions + */ + +jQuery(document).ready(function($) {$(".fade").fadeTo(5000,1).fadeOut(3000);}); + +/** + * Begin the process of re-sizing all of the checked images + */ +function imsanity_resize_images() +{ + var images = []; + jQuery('.imsanity_image_cb:checked').each(function(i) { + images.push(this.value); + }); + + var target = jQuery('#resize_results'); + target.html(''); + //jQuery(document).scrollTop(target.offset().top); + + // start the recursion + imsanity_resize_next(images,0); +} + +/** + * recursive function for resizing images + */ +function imsanity_resize_next(images,next_index) +{ + if (next_index >= images.length) return imsanity_resize_complete(); + + jQuery.post( + ajaxurl, // (defined by wordpress - points to admin-ajax.php) + {_wpnonce: imsanity_vars._wpnonce, action: 'imsanity_resize_image', id: images[next_index]}, + function(response) + { + var result; + var target = jQuery('#resize_results'); + target.show(); + + try { + result = JSON.parse(response); + target.append('
                      ' + (next_index+1) + '/' + images.length + ' >> ' + result['message'] +'
                      '); + } + catch(e) { + target.append('
                      ' + imsanity_vars.invalid_response + '
                      '); + if (console) { + console.warn(images[next_index] + ': '+ e.message); + console.warn('Invalid JSON Response: ' + response); + } + } + + target.animate({scrollTop: target.prop('scrollHeight')}, 200); + // recurse + imsanity_resize_next(images,next_index+1); + } + ); +} + +/** + * fired when all images have been resized + */ +function imsanity_resize_complete() +{ + var target = jQuery('#resize_results'); + target.append('
                      ' + imsanity_vars.resizing_complete + '
                      '); + target.animate({scrollTop: target.prop('scrollHeight')}); +} + +/** + * ajax post to return all images that are candidates for resizing + * @param string the id of the html element into which results will be appended + */ +function imsanity_load_images(container_id) +{ + var container = jQuery('#'+container_id); + + var target = jQuery('#imsanity_target'); + target.show(); + jQuery('.imsanity-selection').remove(); + jQuery('#imsanity_loading').show(); + + target.animate({height: [250,'swing']},500, function() + { + jQuery(document).scrollTop(container.offset().top); + + jQuery.post( + ajaxurl, // (global defined by wordpress - points to admin-ajax.php) + {_wpnonce: imsanity_vars._wpnonce, action: 'imsanity_get_images'}, + function(response) { + var is_json = true; + try { + var images = jQuery.parseJSON(response); + } catch ( err ) { + is_json = false; + } + if ( ! is_json ) { + console.log( response ); + return false; + } + + jQuery('#imsanity_loading').hide(); + if (images.length > 0) + { + target.append('
                      Select All
                      '); + for (var i = 0; i < images.length; i++) + { + target.append('
                      ' + imsanity_vars.image + ' ' + images[i].id + ': ' + images[i].file +' ('+images[i].width+' x '+images[i].height+')
                      '); + } + if ( ! jQuery( '#resize-submit' ).length ) { + container.append('

                      '); + container.append('