Skip to content

Commit

Permalink
v 0.17.0
Browse files Browse the repository at this point in the history
- Update dependencies.
- New option for unique IPs.
- Display total number of votes.
  • Loading branch information
Darklg committed Feb 8, 2024
1 parent e5ee6da commit ab112ae
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

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

- name: PHP Lint
uses: michaelw90/[email protected]
4 changes: 3 additions & 1 deletion inc/WPUBaseAdminDatas/WPUBaseAdminDatas.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
/*
Class Name: WPU Base Admin Datas
Description: A class to handle datas in WordPress admin
Version: 3.10.0
Version: 3.10.1
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
License: MIT License
License URI: https://opensource.org/licenses/MIT
*/

defined('ABSPATH') || die;

class WPUBaseAdminDatas {

public $default_perpage = 20;
Expand Down
6 changes: 4 additions & 2 deletions inc/WPUBaseFields/WPUBaseFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
/*
Class Name: WPU Base Fields
Description: A class to handle fields in WordPress
Version: 0.16.0
Version: 0.16.2
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
License: MIT License
License URI: https://opensource.org/licenses/MIT
*/

defined('ABSPATH') || die;

class WPUBaseFields {
private $script_id;
private $version = '0.16.0';
private $version = '0.16.1';
private $fields = array();
private $field_groups = array();
private $supported_types = array(
Expand Down
38 changes: 20 additions & 18 deletions inc/WPUBaseFields/assets/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@ document.addEventListener("DOMContentLoaded", function() {
return;
}

for (var _key in _data) {
(function(_key, _value, $wrapper) {
var $input = document.getElementById('wpubasefields_' + _key);

function check_value() {
var _visible = true;
if (_value == 'checked') {
if (!$input.checked) {
_visible = false;
}
function check_values() {
var _visible = true,
$input;
for (var _key in _data) {
$input = document.getElementById('wpubasefields_' + _key);
if (_data[_key] == 'checked') {
if (!$input.checked) {
_visible = false;
}
else {
if (_value != $input.value) {
_visible = false;
}
}
else {
if (_data[_key] != $input.value) {
_visible = false;
}
$wrapper.setAttribute('data-visible', _visible ? '1' : '0');
}
check_value();
$input.addEventListener('change', check_value, 1);
}(_key, _data[_key], $wrapper));
}
$wrapper.setAttribute('data-visible', _visible ? '1' : '0');
}

for (var _key in _data) {
document.getElementById('wpubasefields_' + _key).addEventListener('change', check_values, 1);
}

check_values();
});

/* ----------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion inc/WPUBaseMessages/WPUBaseMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
/*
Class Name: WPU Base Messages
Description: A class to handle messages in WordPress
Version: 1.3.3
Version: 1.3.4
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
License: MIT License
License URI: https://opensource.org/licenses/MIT
*/

defined('ABSPATH') || die;

class WPUBaseMessages {

private $transient_msg;
Expand Down
20 changes: 11 additions & 9 deletions inc/WPUBaseSettings/WPUBaseSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
/*
Class Name: WPU Base Settings
Description: A class to handle native settings in WordPress admin
Version: 0.17.5
Version: 0.18.1
Class URI: https://github.com/WordPressUtilities/wpubaseplugin
Author: Darklg
Author URI: https://darklg.me/
License: MIT License
License URI: https://opensource.org/licenses/MIT
*/

defined('ABSPATH') || die;

class WPUBaseSettings {

private $hook_page = false;
Expand Down Expand Up @@ -75,13 +77,7 @@ public function admin_notices() {
}

public function get_settings() {
$opt = get_option($this->settings_details['option_id']);
if (!is_array($opt)) {
/* Set default values */
$opt = $this->get_setting_values();
update_option($this->settings_details['option_id'], $opt);
}
return $opt;
return $this->get_setting_values();
}

public function get_setting($id, $lang = false) {
Expand Down Expand Up @@ -223,6 +219,7 @@ public function add_settings() {
'id' => $id,
'lang_id' => $lang_id,
'label_for' => $id,
'translated_from' => isset($this->settings[$id]['translated_from']) ? $this->settings[$id]['translated_from'] : false,
'required' => $this->settings[$id]['required'],
'post_type' => $this->settings[$id]['post_type'],
'datas' => $this->settings[$id]['datas'],
Expand Down Expand Up @@ -328,6 +325,9 @@ public function render__field($args = array()) {
}
$id .= $attr;
$value = isset($options[$args['id']]) ? $options[$args['id']] : $args['default_value'];
if(!isset($options[$args['id']]) && isset($args['translated_from']) && $args['translated_from'] && isset($options[$args['translated_from']]) && $options[$args['translated_from']]){
$value = $options[$args['translated_from']];
}

switch ($args['type']) {
case 'checkbox':
Expand Down Expand Up @@ -365,12 +365,14 @@ public function render__field($args = array()) {
break;
case 'post':
case 'page':
wp_dropdown_pages(array(
$code_dropdown = wp_dropdown_pages(array(
'echo' => false,
'name' => $name_val,
'id' => $args['id'],
'selected' => $value,
'post_type' => isset($args['post_type']) ? $args['post_type'] : $args['type']
));
echo str_replace('<select ', '<select ' . $attr, $code_dropdown);
break;
case 'select':
echo '<select ' . $name . ' ' . $id . '>';
Expand Down
Binary file modified lang/wpu_polls-fr_FR.mo
Binary file not shown.
Loading

0 comments on commit ab112ae

Please sign in to comment.