Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wpmetabox/meta-box
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Dec 4, 2024
2 parents 3c66773 + aa072da commit 177cce9
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 16 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/trigger-auto-listings-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Reusable workflow to trigger update on auto listings plugin

on:
workflow_call:
secrets:
ACCESS_TOKEN:
required: true

jobs:
trigger-update:
runs-on: ubuntu-latest
steps:
- name: Trigger update on Auto Listings
run:
curl --request POST --url https://api.github.com/repos/elightup/auto-listings/actions/workflows/update-from-extensions.yml/dispatches --header 'Authorization:Bearer ${{ secrets.ACCESS_TOKEN }}' --header 'content-type:application/json' --data '{"ref":"master"}'
2 changes: 1 addition & 1 deletion .github/workflows/update-from-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: composer global require liborm85/composer-vendor-cleaner
- name: Remove vendor folder and reinstall extensions
run: |
rm -rf vendor
rm -rf vendor modules
composer update
- name: Commit changes
run: |
Expand Down
1 change: 1 addition & 0 deletions css/background.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.rwmb-background-row {
margin-bottom: 5px;
display: flex;
gap: 5px;
flex-wrap: wrap;
align-items: flex-start;
}
Expand Down
1 change: 1 addition & 0 deletions css/button-group.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
z-index: 1;
padding: 5px 10px;
background: #fff;
cursor: pointer;
}
.rwmb-button-input-list .selected {
border-color: var(--color);
Expand Down
2 changes: 1 addition & 1 deletion css/file-input.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
width: 100%;
display: flex;
align-items: center;
grid-gap: 4px;
gap: 5px;
}
.rwmb-file_input {
margin: 0 4px 0 0;
Expand Down
4 changes: 4 additions & 0 deletions inc/fields/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public static function format_single_value( $field, $value, $args, $post_id ) {
* @return array|bool False if file not found. Array of image info on success.
*/
public static function file_info( $file, $args = [], $field = [] ) {
if ( ! empty( $field['upload_dir'] ) ) {
return self::file_info_custom_dir( $file, $field );
}

$path = get_attached_file( $file );
if ( ! $path ) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion inc/fields/oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function get_embed( $url, $not_available = '' ) {
if ( $not_available ) {
$not_available = '<div class="rwmb-oembed-not-available">' . wp_kses_post( $not_available ) . '</div>';
}
$not_available = apply_filters( 'rwmb_oembed_not_available_string', $not_available );
$not_available = apply_filters( 'rwmb_oembed_not_available_string', $not_available, $url );

return $embed ? $embed : $not_available;
}
Expand Down
2 changes: 1 addition & 1 deletion inc/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class RWMB_Loader {
protected function constants() {
// Script version, used to add version for scripts and styles.
define( 'RWMB_VER', '5.10.3' );
define( 'RWMB_VER', '5.10.4' );

list( $path, $url ) = self::get_path( dirname( __DIR__ ) );

Expand Down
8 changes: 5 additions & 3 deletions js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,22 @@

// Find address field based on its name attribute. Auto search inside groups when needed.
findAddressField: function ( fieldName ) {
const selector = `input[name="${ fieldName }"], select[name="${ fieldName }"]`;

// Not in a group.
var $address = $( 'input[name="' + fieldName + '"]' );
let $address = $( selector );
if ( $address.length ) {
return $address;
}

// If map and address is inside a cloneable group.
$address = this.$container.closest( '.rwmb-group-clone' ).find( 'input[name*="[' + fieldName + ']"]' );
$address = this.$container.closest( '.rwmb-group-clone' ).find( selector );
if ( $address.length ) {
return $address;
}

// If map and address is inside a non-cloneable group.
$address = this.$container.closest( '.rwmb-group-wrapper' ).find( 'input[name*="[' + fieldName + ']"]' );
$address = this.$container.closest( '.rwmb-group-wrapper' ).find( selector );
if ( $address.length ) {
return $address;
}
Expand Down
8 changes: 5 additions & 3 deletions js/osm.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,20 +240,22 @@

// Find address field based on its name attribute. Auto search inside groups when needed.
findAddressField: function ( fieldName ) {
const selector = `input[name="${ fieldName }"], select[name="${ fieldName }"]`;

// Not in a group.
var $address = $( 'input[name="' + fieldName + '"]' );
let $address = $( selector );
if ( $address.length ) {
return $address;
}

// If map and address is inside a cloneable group.
$address = this.$container.closest( '.rwmb-group-clone' ).find( 'input[name*="[' + fieldName + ']"]' );
$address = this.$container.closest( '.rwmb-group-clone' ).find( selector );
if ( $address.length ) {
return $address;
}

// If map and address is inside a non-cloneable group.
$address = this.$container.closest( '.rwmb-group-wrapper' ).find( 'input[name*="[' + fieldName + ']"]' );
$address = this.$container.closest( '.rwmb-group-wrapper' ).find( selector );
if ( $address.length ) {
return $address;
}
Expand Down
33 changes: 30 additions & 3 deletions js/validation/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@
init() {
var that = this,
editor = wp.data.dispatch( 'core/editor' );
if ( ! editor || ! that.$form.length ) {

if ( !editor || !that.$form.length ) {
return false;
}

Expand Down Expand Up @@ -258,6 +258,25 @@
}
};

class TaxonomyValidation extends Validation {
init() {
const submitButton = $( '#submit' );

this.$form.validate( {
...this.settings,
invalidHandler: null,
onkeyup: () => {
submitButton.prop( 'disabled', !this.$form.valid() );
}
} );

submitButton.prop( 'disabled', !this.$form.valid() );
$( '#tag-name' ).on( 'blur', () => {
submitButton.prop( 'disabled', !this.$form.valid() );
} );
}
}

// Run on document ready.
function init() {
if ( rwmb.isGutenberg ) {
Expand All @@ -268,7 +287,7 @@
} );

new GutenbergValidation( `.mb-block-edit` ).init();

return;
}

Expand All @@ -278,6 +297,14 @@
var form = new Validation( this );
form.init();
} );

const $addTag = $( '#addtag' );
if ( $addTag.length ) {
new TaxonomyValidation( '#addtag' ).init();
$( '#submit' ).on( 'click', function () {
new TaxonomyValidation( '#addtag' ).init();
} );
}
};

rwmb.$document
Expand Down
2 changes: 1 addition & 1 deletion meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Meta Box
* Plugin URI: https://metabox.io
* Description: Create custom meta boxes and custom fields in WordPress.
* Version: 5.10.3
* Version: 5.10.4
* Author: MetaBox.io
* Author URI: https://metabox.io
* License: GPL2+
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Donate link: https://metabox.io/pricing/
Tags: custom fields, custom post types, post type, custom taxonomies, meta box
Requires at least: 5.9
Requires PHP: 7.0
Tested up to: 6.6.2
Stable tag: 5.10.3
Tested up to: 6.7
Stable tag: 5.10.4
License: GPLv2 or later

Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
Expand Down Expand Up @@ -160,6 +160,12 @@ If you like this plugin, you might also like our other WordPress products:

== Changelog ==

= 5.10.4 - 2024-11-20 =
- OSM/Map fields: add support for select field type
- Add `$url` to `rwmb_oembed_not_available_string` filter
- Small CSS improvements for file input, background & button group
- Fix not returning value for helper functions for images saving in a custom folder and using a custom table

= 5.10.3 - 2024-10-30 =
- fix: std after saving
- fix: field set text save empty values
Expand Down

0 comments on commit 177cce9

Please sign in to comment.