Skip to content

Commit

Permalink
Use Meta Box Updater
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Jan 9, 2025
1 parent d638099 commit aa429e6
Show file tree
Hide file tree
Showing 101 changed files with 626 additions and 9,423 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
name: Release
on:
workflow_dispatch:
branch:
branches:
- main
push:
tags:
- "*"
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create zip
run: |
name=${{ github.event.repository.name }}
git archive -o $name.zip --prefix=$name/ HEAD
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.event.repository.name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Slack
run: |
tag=$(git describe --tags `git rev-list --tags --max-count=1`)
name=${{ github.event.repository.name }}
curl -X POST --data-urlencode "payload={\"channel\": \"#meta-box\", \"username\": \"Bot\", \"text\": \"New version $tag for $name has been just released!\", \"icon_emoji\": \":tada:\"}" ${{ secrets.SLACK_WEBHOOK }}
call-workflow:
uses: wpmetabox/meta-box/.github/workflows/extension.yml@master
secrets:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SERVER_IP: ${{ secrets.SERVER_IP }}
DOWNLOADS_DIR: ${{ secrets.DOWNLOADS_DIR }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@
"wpmetabox/mb-relationships": "dev-master",
"wpmetabox/mb-rest-api": "dev-master",
"wpmetabox/mb-yoast-seo": "dev-master",
"wpmetabox/meta-box": "dev-master",
"wpmetabox/meta-box": "^5.10",
"wpmetabox/meta-box-beaver-themer-integrator": "dev-master",
"wpmetabox/meta-box-facetwp-integrator": "dev-master",
"wpmetabox/text-limiter": "dev-master",
"yahnis-elsts/plugin-update-checker": "^5.5"
"wpmetabox/text-limiter": "dev-master"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -88,18 +87,14 @@
"rm -rf vendor/**/**/.git",
"rm -rf modules/**/.git",
"echo Cleaning up plugin headers...",
"php cleanup.php",
"echo Removing Meta Box updater...",
"rm -rf modules/meta-box/src/Updater/"
"php cleanup.php"
],
"post-install-cmd": [
"echo Deleting .git dirs...",
"rm -rf vendor/**/**/.git",
"rm -rf modules/**/.git",
"echo Cleaning up plugin headers...",
"php cleanup.php",
"echo Removing Meta Box updater...",
"rm -rf modules/meta-box/src/Updater/"
"php cleanup.php"
]
},
"extra": {
Expand Down
60 changes: 4 additions & 56 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions meta-box-lite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,8 @@
* Text Domain: meta-box-lite
*/

use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

if ( ! defined( 'ABSPATH' ) ) {
return;
}

require_once __DIR__ . '/vendor/autoload.php';

$mbl_update_checker = PucFactory::buildUpdateChecker(
'https://github.com/wpmetabox/meta-box-lite/',
__FILE__,
'meta-box-lite'
);
$mbl_update_checker->setBranch( 'main' );

$mbl_update_checker->addResultFilter( function ( $info, $response = null ): void {
$info->icons = [
'default' => 'https://i0.wp.com/metabox.io/wp-content/uploads/2015/08/logo.png',
];
} );
20 changes: 5 additions & 15 deletions modules/meta-box/css/image-select.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
.rwmb-image-select {
display: inline-block;
width: 80px;
height: 80px;
float: left;
margin: 0 8px 8px 0;
margin: 0 10px 10px 0;
border: 3px solid #d8d8d8;
border-radius: 4px;
border-radius: 3px;
padding: 1px;
cursor: pointer;

--color: #2271b1;
}

.block-editor-page .rwmb-image-select {
--color: var(--wp-admin-theme-color, #2271b1);
}

.rwmb-image-select img {
width: 100%;
height: 100%;
object-fit: cover;
}

.rwmb-image-select:hover,
.rwmb-image-select:has(:checked) {
border-color: var(--color);
.rwmb-image-select.rwmb-active {
border-color: #0074a2;
}

.rwmb-image_select.rwmb-image_select {
display: none;
}
1 change: 0 additions & 1 deletion modules/meta-box/css/key-value.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.rwmb-key_value-clone {
display: flex;
align-items: center;
gap: 8px;
}
.rwmb-key_value-clone input {
flex: 1;
Expand Down
17 changes: 11 additions & 6 deletions modules/meta-box/inc/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function show( array $field, bool $saved, $post_id = 0 ) {
}

$end = static::end_html( $field );
$end = self::filter( 'end_html', $end, $field, $meta );
$end = self::filter( 'end_html', $end, $field, $meta );
$html = self::filter( 'wrapper_html', $begin . $field_html . $end, $field, $meta );

// Display label and input in DIV and allow user-defined classes to be appended.
Expand Down Expand Up @@ -75,15 +75,20 @@ public static function html( $meta, $field ) {
protected static function begin_html( array $field ): string {
$id = $field['attributes']['id'] ?? $field['id'];
$required = $field['required'] || ! empty( $field['attributes']['required'] );
$required = $required ? '<span class="rwmb-required">*</span>' : '';

$label = $field['name'] ? sprintf(
// Translators: %1$s - field ID, %2$s - field label, %3$s - required asterisk, %4$s - label description.
'<div class="rwmb-label" id="%1$s-label"><label for="%1$s">%2$s%3$s</label>%4$s</div>',
'<label for="%s">%s%s</label>',
esc_attr( $id ),
$field['name'],
$required,
static::label_description( $field )
$required ? '<span class="rwmb-required">*</span>' : ''
) : '';

$label .= static::label_description( $field );

$label = $label ? sprintf(
'<div class="rwmb-label" id="%s-label">%s</div>',
esc_attr( $id ),
$label
) : '';

$data_min_clone = is_numeric( $field['min_clone'] ) && $field['min_clone'] > 1 ? ' data-min-clone=' . $field['min_clone'] : '';
Expand Down
4 changes: 4 additions & 0 deletions modules/meta-box/inc/fields/fieldset-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ protected static function input_description( array $field ) : string {
return '';
}

protected static function label_description( array $field ) : string {
return '';
}

/**
* Normalize parameters for field.
*
Expand Down
1 change: 1 addition & 0 deletions modules/meta-box/inc/fields/image-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class RWMB_Image_Select_Field extends RWMB_Field {
public static function admin_enqueue_scripts() {
wp_enqueue_style( 'rwmb-image-select', RWMB_CSS_URL . 'image-select.css', [], RWMB_VER );
wp_style_add_data( 'rwmb-image-select', 'path', RWMB_CSS_DIR . 'image-select.css' );
wp_enqueue_script( 'rwmb-image-select', RWMB_JS_URL . 'image-select.js', [ 'jquery' ], RWMB_VER, true );
}

/**
Expand Down
17 changes: 16 additions & 1 deletion modules/meta-box/inc/fields/key-value.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,22 @@ public static function html( $meta, $field ) {
}

protected static function begin_html( array $field ) : string {
return parent::begin_html( $field ) . parent::input_description( $field );
$desc = $field['desc'] ? "<p id='{$field['id']}_description' class='description'>{$field['desc']}</p>" : '';

if ( empty( $field['name'] ) ) {
return '<div class="rwmb-input">' . $desc;
}

return sprintf(
'<div class="rwmb-label">
<label for="%s">%s</label>
</div>
<div class="rwmb-input">
%s',
$field['id'],
$field['name'],
$desc
);
}

protected static function input_description( array $field ) : string {
Expand Down
25 changes: 10 additions & 15 deletions modules/meta-box/js/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@
* Transform an input into a date picker.
*/
function transform() {
let $this = $( this ),
options = $this.data( 'options' );

let $inline = $this.siblings( '.rwmb-datetime-inline' );
if ( !$inline.length ) {
$inline = $this.closest( '.rwmb-input-group' ).siblings( '.rwmb-datetime-inline' );
}

let $timestamp = $this.siblings( '.rwmb-datetime-timestamp' ),
var $this = $( this ),
options = $this.data( 'options' ),
$inline = $this.siblings( '.rwmb-datetime-inline' ),
$timestamp = $this.siblings( '.rwmb-datetime-timestamp' ),
current = $this.val(),
$picker = $inline.length ? $inline : $this;

$this.siblings( '.ui-datepicker-append' ).remove(); // Remove appended text

options.onSelect = function () {
options.onSelect = function() {
$this.trigger( 'change' );
};
options.beforeShow = function ( i ) {
}
options.beforeShow = function( i ) {
if ( $( i ).prop( 'readonly' ) ) {
return false;
}
};
}

if ( $timestamp.length ) {
options.onClose = options.onSelect = function () {
Expand All @@ -41,15 +36,15 @@
} );
}

if ( !$inline.length ) {
if ( ! $inline.length ) {
$this.removeClass( 'hasDatepicker' ).datepicker( options );
return;
}

options.altField = '#' + $this.attr( 'id' );
$this.on( 'keydown', _.debounce( function () {
// if val is empty, return to allow empty datepicker input.
if ( !$this.val() ) {
if ( ! $this.val() ) {
return;
}
$picker
Expand Down
Loading

0 comments on commit aa429e6

Please sign in to comment.