Skip to content

Commit

Permalink
v 0.32.1
Browse files Browse the repository at this point in the history
- Fixes for array values.
- Add Github Workflows.
  • Loading branch information
Darklg committed Aug 1, 2023
1 parent c1e50e7 commit 10781cd
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
19 changes: 19 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PHP Lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
phplint:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: PHP Lint
uses: michaelw90/[email protected]
Binary file modified lang/wpupostmetas-fr_FR.mo
Binary file not shown.
34 changes: 17 additions & 17 deletions lang/wpupostmetas-fr_FR.po
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
msgid ""
msgstr ""
"Project-Id-Version: WPU Post Metas\n"
"POT-Creation-Date: 2023-02-13 11:43+0100\n"
"POT-Creation-Date: 2023-08-01 11:33+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Darklg <[email protected]>\n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.2.2\n"
"X-Generator: Poedit 3.3.2\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-SearchPath-0: ../.\n"

#: .././wpupostmetas.php:83
#: .././wpupostmetas.php:84
msgid "Simple admin for post metas"
msgstr "Administration simple pour les post metas"

#: .././wpupostmetas.php:95
#: .././wpupostmetas.php:96
msgid "Delete this line?"
msgstr "Supprimer cette ligne ?"

#: .././wpupostmetas.php:518
#: .././wpupostmetas.php:526
msgid "Remove image"
msgstr "Retirer l’image"

#: .././wpupostmetas.php:519
#: .././wpupostmetas.php:527
msgid "Choose an image"
msgstr "Choisir une image"

#: .././wpupostmetas.php:520
#: .././wpupostmetas.php:528
msgid "Change image"
msgstr "Changer l’image"

#: .././wpupostmetas.php:522
#: .././wpupostmetas.php:530
msgid "Remove file"
msgstr "Retirer le fichier"

#: .././wpupostmetas.php:523
#: .././wpupostmetas.php:531
msgid "Choose a file"
msgstr "Choisir un fichier"

#: .././wpupostmetas.php:524
#: .././wpupostmetas.php:532
msgid "Change file"
msgstr "Changer de fichier"

#: .././wpupostmetas.php:540 .././wpupostmetas.php:576
#: .././wpupostmetas.php:548 .././wpupostmetas.php:584
msgid "Select a value"
msgstr "Sélectionnez une valeur"

#: .././wpupostmetas.php:561 .././wpupostmetas.php:577
#: .././wpupostmetas.php:723
#: .././wpupostmetas.php:569 .././wpupostmetas.php:585
#: .././wpupostmetas.php:731
msgid "None"
msgstr "Aucun"

#: .././wpupostmetas.php:614
#: .././wpupostmetas.php:622
msgid "Add a new line"
msgstr "Nouvelle ligne"

#: .././wpupostmetas.php:615
#: .././wpupostmetas.php:623
msgid "Copy last line"
msgstr "Copier la dernière ligne"

#: .././wpupostmetas.php:850
#: .././wpupostmetas.php:858
msgid "No"
msgstr "Non"

#: .././wpupostmetas.php:851
#: .././wpupostmetas.php:859
msgid "Yes"
msgstr "Oui"

Expand Down
31 changes: 22 additions & 9 deletions wpupostmetas.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@
Plugin URI: https://github.com/WordPressUtilities/wpupostmetas
Update URI: https://github.com/WordPressUtilities/wpupostmetas
Description: Simple admin for post metas
Version: 0.32.0
Version: 0.32.1
Author: Darklg
Author URI: http://darklg.me/
Author URI: https://darklg.me/
Text Domain: wpupostmetas
Domain Path: /lang
Requires at least: 6.1
Requires PHP: 7.4
License: MIT License
License URI: http://opensource.org/licenses/MIT
License URI: https://opensource.org/licenses/MIT
*/

defined('ABSPATH') or die(':(');

class WPUPostMetas {
public $qtranslatex;
public $qtranslate;

public $version = '0.32.0';
public $version = '0.32.1';
public $boxes = array();
public $fields = array();
public $settings_update;
Expand Down Expand Up @@ -423,7 +429,10 @@ public function field_content($post, $id, $field, $only_field = false, $val = fa
$main_post_id = 0;
if (is_object($post)) {
$main_post_id = $post->ID;
$value = @trim(get_post_meta($main_post_id, $id, true));
$value = get_post_meta($main_post_id, $id, true);
if(is_string($value)){
$value = trim($value);
}

// If new post, try to load a default value
if (isset($field['default'], $post->post_title, $post->post_content) && empty($post->post_title) && empty($post->post_content) && empty($value)) {
Expand All @@ -442,6 +451,10 @@ public function field_content($post, $id, $field, $only_field = false, $val = fa
if ($val !== false) {
$value = $val;
}
$display_value = $value;
if(is_array($display_value)){
$display_value = implode(', ', $display_value);
}

if (!isset($field['tab']) || !$field['tab']) {
$field['tab'] = '';
Expand Down Expand Up @@ -585,7 +598,7 @@ public function field_content($post, $id, $field, $only_field = false, $val = fa
break;
case 'textarea':
case 'htmlcontent':
echo '<textarea ' . $required_attr . ' rows="3" cols="50" ' . $idname . '>' . $value . '</textarea>';
echo '<textarea ' . $required_attr . ' rows="3" cols="50" ' . $idname . '>' . $display_value . '</textarea>';
break;
case 'editor':
$editor_args = array(
Expand All @@ -594,7 +607,7 @@ public function field_content($post, $id, $field, $only_field = false, $val = fa
if (isset($field['editor_args']) && is_array($field['editor_args'])) {
$editor_args = array_merge($editor_args, $field['editor_args']);
}
wp_editor($value, $id, $editor_args);
wp_editor($display_value, $id, $editor_args);
break;
case 'table':

Expand Down Expand Up @@ -634,10 +647,10 @@ public function field_content($post, $id, $field, $only_field = false, $val = fa
case 'email':
case 'number':
case 'url':
echo '<input ' . $required_attr . ' type="' . $field['type'] . '" ' . $idname . ' value="' . esc_attr($value) . '" />';
echo '<input ' . $required_attr . ' type="' . $field['type'] . '" ' . $idname . ' value="' . esc_attr($display_value) . '" />';
break;
default:
echo '<input ' . $required_attr . ' type="text" ' . $idname . ' value="' . esc_attr($value) . '" />';
echo '<input ' . $required_attr . ' type="text" ' . $idname . ' value="' . esc_attr($display_value) . '" />';
}
if (isset($field['help'])) {
echo '<div class="wpupostmetas-description-help">' . $field['help'] . '</div>';
Expand Down

0 comments on commit 10781cd

Please sign in to comment.