Skip to content

Commit

Permalink
v 8.0.0
Browse files Browse the repository at this point in the history
- Main git branch change.
- Fix invalid option export.
- Better behavior on export checkboxes.
- Updated dependencies.
- New translation file format.
  • Loading branch information
Darklg committed Sep 21, 2024
1 parent 9164dcd commit 56f7cfc
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 79 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"ecmaVersion": "latest"
},
"rules": {
"no-prototype-builtins": 0
"no-prototype-builtins": 0,
"no-unused-vars": 1,
"no-undef": 1
},
"globals": {
"wp": true,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: ESLint

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install modules
run: npm install -g eslint
run: npm install -g eslint@^8
- name: Run ESLint
run: eslint assets/ --ext .js
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: PHP Lint

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

jobs:
phplint:
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 WPUtilities

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.
26 changes: 17 additions & 9 deletions assets/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ jQuery(document).ready(function() {

var wputh_options_set_exportcheck = function() {
'use strict';
jQuery('.wpu-export-section').on('change', '.wpu-export-title-checkbox', function() {
var $this = jQuery(this),
$parent = $this.closest('.wpu-export-section');
$parent.find('.wpu-export-boxes-check').prop("checked", $this.prop('checked'));
jQuery('.wpu-export-section').each(function() {
var $section = jQuery(this),
$masterCheck = $section.find('.wpu-export-title-checkbox'),
$checkboxes = $section.find('.wpu-export-boxes-check');

$masterCheck.on('change', function() {
$checkboxes.prop("checked", $masterCheck.prop('checked'));
});

$checkboxes.on('change', function() {
$masterCheck.prop("checked", $checkboxes.filter(':checked').length == $checkboxes.length);
});
});

};

/* ----------------------------------------------------------
Expand All @@ -44,8 +53,9 @@ var wputh_options_set_wp_link = function() {
var src_json = {};
try {
src_json = JSON.parse($textarea.val());
} catch (e) {
console.log('Could not parse');
}
catch (e) {console.log('Could not parse');}
if (typeof src_json == 'object') {
if (src_json.href) {
jQuery('#wp-link-url').val(src_json.href);
Expand Down Expand Up @@ -216,8 +226,7 @@ var wputh_options_set_media = function() {
att = attachment.url;
att = att.replace($preview.data('removethis'), '');
previewContent += '<div class="wpu-options-upload-preview--file">' + att + '</div>';
}
else {
} else {
previewContent += '<img src="' + att + '" />';
}
previewContent += '</div>';
Expand Down Expand Up @@ -261,8 +270,7 @@ var wputh_options_set_accordion = function() {
// Set opened box
if (window.location.hash && jQuery(window.location.hash).length > 0) {
jQuery(window.location.hash).trigger('click');
}
else {
} else {
boxes.eq(0).removeClass('is-closed');
}

Expand Down
2 changes: 1 addition & 1 deletion inc/WPUBaseUpdate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Update your Github WordPress plugin from the plugins page admin.
## Insert in the INIT hook

```php
include dirname( __FILE__ ) . '/inc/WPUBaseUpdate/WPUBaseUpdate.php';
require_once __DIR__ . '/inc/WPUBaseUpdate/WPUBaseUpdate.php';
$this->settings_update = new \PLUGINID\WPUBaseUpdate(
'WordPressUtilities',
'PLUGINID',
Expand Down
14 changes: 10 additions & 4 deletions inc/WPUBaseUpdate/WPUBaseUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*
Class Name: WPU Base Update
Description: A class to handle plugin update from github
Version: 0.4.5
Version: 0.5.0
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
Expand All @@ -26,6 +26,7 @@ class WPUBaseUpdate {
private $plugin_id;
private $plugin_dir;
private $details;
private $is_tracked = false;

public function __construct($github_username = false, $github_project = false, $current_version = false, $details = array()) {
$this->init($github_username, $github_project, $current_version, $details);
Expand All @@ -47,9 +48,7 @@ public function init($github_username = false, $github_project = false, $current
$this->plugin_dir = (defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : WP_CONTENT_DIR . '/plugins') . '/' . $this->plugin_id;

$gitpath = dirname($this->plugin_dir) . '/.git';
if (is_dir($gitpath) || file_exists($gitpath)) {
return;
}
$this->is_tracked = (is_dir($gitpath) || file_exists($gitpath));

if (!is_array($details)) {
$details = array();
Expand Down Expand Up @@ -125,6 +124,13 @@ public function get_new_plugin_info() {
'sections' => array()
);

/* Disable download link if plugin is tracked */
if ($this->is_tracked) {
$plugin_info['trunk'] = '';
$plugin_info['download_link'] = '';
$plugin_info['package'] = '';
}

/* Fetch plugin data */
$plugin_data = array();
if (file_exists($this->plugin_dir)) {
Expand Down
2 changes: 2 additions & 0 deletions lang/wpuoptions-fr_FR.l10n.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
return ['domain'=>NULL,'plural-forms'=>NULL,'messages'=>['Friendly interface for website options'=>'Interface conviviale pour les options de site','Site options'=>'Options du site','Import'=>'Importer','Export'=>'Exporter','Options'=>'Options','Warning : The saved options may be different than yours. Maybe someone changed them while you were editing ?'=>'Avertissement : Les options enregistrées peuvent être différentes des vôtres. Peut-être ont-elles été modifiées pendant que vous éditiez ?','No fields for the moment'=>'Aucun champ pour le moment','Click below to download a .json file containing all your website\'s options.'=>'Cliquez ci-dessous pour télécharger un fichier .json contenant toutes les options de votre site.','Default box'=>'Box par défaut','Export options'=>'Exporter les options','The file has been successfully imported.'=>'Le fichier a été importé avec succès.','The file has not been imported.'=>'Le fichier n’a pas été importé.','Upload a .json file (generated by WPU Options) to import your website\'s options.'=>'Transférez un fichier .json (généré par WPU Options) pour importer les options de votre site.','Import options file'=>'Importer le fichier d\'options','Error in the form.'=>'Erreur dans le formulaire.','The field "%s" must not be empty'=>'Le champ "%s" ne doit pas être vide','The field "%s" has been updated.'=>'Le champ "%s" a été mis à jour.','The field "%s" has not been updated, because it\'s not valid.'=>'Le champ "%s" n’a pas été mis à jour, car il est invalide.','Success!'=>'Succès !','Fail!'=>'Echec !','Update'=>'Mettre à jour','Edit this text'=>'Modifier ce texte','Cancel edition'=>'Annuler l\'édition','Add a picture'=>'Ajouter une image','Change this picture'=>'Modifier cette image','Do you really want to remove this image ?'=>'Voulez-vous vraiment retirer cette image ?','Add a file'=>'Ajouter un fichier','Change this file'=>'Modifier ce fichier','Do you really want to remove this file ?'=>'Voulez-vous vraiment retirer ce fichier ?','maleSelect a %s'=>'Sélectionner un %s','femaleSelect a %s'=>'Sélectionner une %s','Select some %s'=>'Sélectionnez des %s','Select a value'=>'Sélectionner une valeur','Edit link'=>'Modifier le lien','No'=>'Non','Yes'=>'Oui','Edit Site:'=>'Modifier le site :','Incorrect site ID.'=>'ID de site incorrect.','The requested site does not exist.'=>'Le site recherché n\'existe pas.'],'language'=>'fr_FR','x-generator'=>'Poedit 3.5'];
Binary file modified lang/wpuoptions-fr_FR.mo
Binary file not shown.
Loading

0 comments on commit 56f7cfc

Please sign in to comment.