first commit

This commit is contained in:
dwindown
2025-08-21 20:39:34 +07:00
commit 58c1497171
576 changed files with 177044 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
<defs>
<font id="iconpicker" horiz-adv-x="1000" >
<font-face font-family="iconpicker" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="spin3" unicode="&#xe815;" d="m494 850c-266 0-483-210-494-472c-1-19 13-20 13-20l84 0c16 0 19 10 19 18c10 199 176 358 378 358c107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18c-10-199-176-358-377-358c-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148c265 0 482 210 493 473c1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
<glyph glyph-name="search" unicode="&#xe812;" d="m643 386q0 103-74 176t-176 74t-177-74t-73-176t73-177t177-73t176 73t74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69q-80 0-153 31t-125 84t-84 125t-31 153t31 152t84 126t125 84t153 31t152-31t126-84t84-126t31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
<glyph glyph-name="cancel" unicode="&#xe814;" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165l-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164l-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164l164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164l164-164q15-15 15-38z" horiz-adv-x="785.7" />
<glyph glyph-name="block" unicode="&#xe84e;" d="m732 352q0 90-48 164l-421-420q76-50 166-50q62 0 118 25t96 65t65 97t24 119z m-557-167l421 421q-75 50-167 50q-83 0-153-40t-110-112t-41-152q0-91 50-167z m682 167q0-88-34-168t-91-137t-137-92t-166-34t-167 34t-137 92t-91 137t-34 168t34 167t91 137t137 91t167 34t166-34t137-91t91-137t34-167z" horiz-adv-x="857.1" />
<glyph glyph-name="down-dir" unicode="&#xe800;" d="m571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25t25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
<glyph glyph-name="up-dir" unicode="&#xe813;" d="m571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25t11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
<glyph glyph-name="left-dir" unicode="&#xe801;" d="m357 600v-500q0-14-10-25t-26-11t-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11t10-25z" horiz-adv-x="357.1" />
<glyph glyph-name="right-dir" unicode="&#xe802;" d="m321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11t-11 25v500q0 15 11 25t25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,2 @@
/* Grey Theme file for fontIconPicker {@link https://github.com/micc83/fontIconPicker} */
.fip-grey.icons-selector{font-size:16px}.fip-grey.icons-selector .selector{border:1px solid #EDEDED;background-color:#fff}.fip-grey.icons-selector .selector-button{background-color:#F4F4F4;border-left:1px solid #E1E1E1}.fip-grey.icons-selector .selector-button:hover{background-color:#f1f1f1}.fip-grey.icons-selector .selector-button:hover i{color:#999}.fip-grey.icons-selector .selector-button i{color:#aaa;text-shadow:0 1px 0 #FFF}.fip-grey.icons-selector .selected-icon i{color:#404040}.fip-grey.icons-selector .selector-popup{-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);-webkit-box-shadow:0 1px 1px rgba(0,0,0,.04);box-shadow:0 1px 1px rgba(0,0,0,.04);border:1px solid #E5E5E5}.fip-grey.icons-selector .selector-category select,.fip-grey.icons-selector .selector-search input[type=text]{border:1px solid #EDEDED;color:#404040;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;outline:0}.fip-grey.icons-selector input::-webkit-input-placeholder{color:#ddd}.fip-grey.icons-selector input:-moz-placeholder{color:#ddd}.fip-grey.icons-selector input::-moz-placeholder{color:#ddd}.fip-grey.icons-selector input:-ms-input-placeholder{color:#ddd!important}.fip-grey.icons-selector .selector-search i{color:#eee}.fip-grey.icons-selector .fip-icons-container{background-color:#fff;border:1px solid #EDEDED}.fip-grey.icons-selector .fip-icons-container .loading{color:#eee}.fip-grey.icons-selector .fip-box{border:1px solid #EFEFEF}.fip-grey.icons-selector .fip-box:hover{background-color:#f6f6f6}.fip-grey.icons-selector .selector-footer,.fip-grey.icons-selector .selector-footer i{color:#ddd}.fip-grey.icons-selector .selector-arrows i:hover{color:#777}.fip-grey.icons-selector span.current-icon,.fip-grey.icons-selector span.current-icon:hover{background-color:#2EA2CC;color:#fff;border:1px solid #298CBA}.fip-grey.icons-selector .icons-picker-error i:before{color:#eee}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

14
vendor/wpcfto/taxonomy_meta/enqueue.php vendored Normal file
View File

@@ -0,0 +1,14 @@
<?php
function wpcfto_enqueue_taxonomy_ss() {
$v = time();
$assets = STM_WPCFTO_URL . '/taxonomy_meta/assets';
$base = STM_WPCFTO_URL . '/taxonomy_meta/assets/';
wp_enqueue_script('fonticonpicker', $base . 'js/jquery.fonticonpicker.min.js', array(), $v);
wp_enqueue_style('fonticonpicker', $base . 'css/jquery.fonticonpicker.min.css', array(), $v);
wp_enqueue_style('fonticonpicker-grey', $base . 'css/jquery.fonticonpicker.grey.min.css', array(), $v);
wp_enqueue_style('linear', $assets . '/linearicons/linear.css', array(), $v);
}
add_action( 'admin_enqueue_scripts', 'wpcfto_enqueue_taxonomy_ss' );

View File

@@ -0,0 +1,11 @@
<?php
function wpcfto_term_meta_field_color($field_key, $value)
{
?>
<div class="wpcfto_image_field">
<input type="color"
value="<?php echo sanitize_text_field($value); ?>"
name="<?php echo esc_attr($field_key) ?>"/>
</div>
<?php }

View File

@@ -0,0 +1,9 @@
<?php
function wpcfto_term_meta_field_default($field_key, $value)
{ ?>
<input type="text"
name="<?php echo esc_attr($field_key) ?>"
id="<?php echo esc_attr($field_key) ?>"
value="<?php echo esc_attr($value); ?>"
class="term-meta-text-field"/>
<?php }

View File

@@ -0,0 +1,57 @@
<?php
require_once STM_WPCFTO_PATH . '/helpers/icons.php';
function wpcfto_term_meta_field_icon($field_key, $value)
{
?>
<div class="wpcfto_image_field">
<input type="text"
class="wpcfto_font"
value="<?php echo sanitize_text_field($value); ?>"
name="<?php echo esc_attr($field_key) ?>"/>
</div>
<?php
$fa_icons_i = array("");
if(function_exists('stm_new_fa_icons')) {
$fa_icons = stm_wpcfto_new_fa_icons();
foreach ($fa_icons as $icon) {
$icons = array_keys($icon);
$fa_icons_i[] = $icons[0];
}
}
$lr_icons = stm_wpcfto_add_vc_icons_linear(array());
$lr_icons = $lr_icons['Linear'];
$lr_icons_i = array("");
foreach ($lr_icons as $icon) {
$icons = array_keys($icon);
$lr_icons_i[] = str_replace('lnr-', 'lnricons-', $icons[0]);
}
$icons = apply_filters('wpcfto_iconpicker_sets', array(
'FontAwesome' => $fa_icons_i,
'Linear' => $lr_icons_i,
));
?>
<script type="text/javascript">
(function ($) {
var iconsSearch = icons = <?php echo json_encode($icons); ?>;
$(document).ready(function () {
$('.wpcfto_font').each(function () {
$(this).fontIconPicker({
source: icons,
searchSource: iconsSearch,
});
});
});
})(jQuery)
</script>
<?php }

View File

@@ -0,0 +1,74 @@
<?php
function wpcfto_term_meta_field_image($field_key, $value)
{
$img_src = wp_get_attachment_image_url($value, 'full');
?>
<div class="wpcfto_image_field">
<div class="wpcfto_image_field__holder">
<img src="<?php echo esc_url($img_src); ?>" />
</div>
<button class="button button-primary wpcfto_image_field__add">
<?php esc_html_e('Add image', 'wp-custom-fields-theme-options'); ?>
</button>
<button class="button button-secondary wpcfto_image_field__delete">
<?php esc_html_e('Delete image', 'wp-custom-fields-theme-options'); ?>
</button>
<input type="hidden"
name="<?php echo esc_attr($field_key) ?>"
id="<?php echo esc_attr($field_key) ?>"
value="<?php echo esc_attr($value); ?>" />
</div>
<script type="text/javascript">
(function($){
var frame;
$(document).ready(function(){
var $btn = '';
$('.wpcfto_image_field__delete').on('click', function(e) {
e.preventDefault();
$btn = $(this);
var $input = $btn.closest('.wpcfto_image_field').find('input');
var $img = $btn.closest('.wpcfto_image_field').find('img');
$input.val('');
$img.attr('src', '');
});
$('.wpcfto_image_field__add').on('click', function(e) {
e.preventDefault();
$btn = $(this);
if ( frame ) {
frame.open();
return;
}
frame = wp.media({
title: '<?php esc_html_e("Select or Upload Media Of Your Chosen Persuasion", 'wp-custom-fields-theme-options'); ?>',
button: {
text: '<?php esc_html_e("Use this media", 'wp-custom-fields-theme-options'); ?>'
},
multiple: false
});
frame.on( 'select', function() {
// Get media attachment details from the frame state
var attachment = frame.state().get('selection').first().toJSON();
var image_id = attachment.id;
var image_url = attachment.url;
var $input = $btn.closest('.wpcfto_image_field').find('input');
var $img = $btn.closest('.wpcfto_image_field').find('img');
$input.val(image_id);
$img.attr('src', image_url);
});
// Finally, open the modal on click
frame.open();
});
});
})(jQuery)
</script>
<?php }

View File

@@ -0,0 +1,127 @@
<?php
require_once STM_WPCFTO_PATH . '/taxonomy_meta/enqueue.php';
require_once STM_WPCFTO_PATH . '/taxonomy_meta/fields/default.php';
require_once STM_WPCFTO_PATH . '/taxonomy_meta/fields/image.php';
require_once STM_WPCFTO_PATH . '/taxonomy_meta/fields/icon.php';
require_once STM_WPCFTO_PATH . '/taxonomy_meta/fields/color.php';
function wpcfto_term_meta_fields()
{
return apply_filters('stm_wpcfto_term_meta_fields', array());
}
function wpcfto_sanitize_term_meta($value)
{
return sanitize_text_field($value);
}
function wpcfto_get_term_meta_text($term_id, $term_key)
{
$value = get_term_meta($term_id, $term_key, true);
$value = wpcfto_sanitize_term_meta($value);
return $value;
}
add_action('init', function () {
$taxonomies = wpcfto_term_meta_fields();
foreach ($taxonomies as $taxonomy => $fields) {
add_action("{$taxonomy}_add_form_fields", 'wpcfto_add_term_meta_fields');
add_action("{$taxonomy}_edit_form_fields", 'wpcfto_edit_term_meta_fields');
add_action("edit_{$taxonomy}", 'wpcfto_save_term_meta_field');
add_action("create_{$taxonomy}", 'wpcfto_save_term_meta_field');
}
function wpcfto_add_term_meta_fields($tax)
{
$meta = wpcfto_term_meta_fields();
$fields = $meta[$tax]; ?>
<table class="form-table">
<tbody>
<?php foreach ($fields as $field_key => $field): ?>
<tr class="form-field">
<th scope="row">
<label for="<?php echo esc_attr($field_key) ?>"><?php echo sanitize_text_field($field['label']); ?></label>
</th>
<td>
<?php switch ($field['type']) {
case 'image':
wpcfto_term_meta_field_image($field_key, '');
break;
case 'icon':
wpcfto_term_meta_field_icon($field_key, '');
break;
case 'color':
wpcfto_term_meta_field_color($field_key, '');
break;
default:
wpcfto_term_meta_field_default($field_key, '');
} ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php }
function wpcfto_edit_term_meta_fields($term)
{
$taxonomy = $term->taxonomy;
$meta = wpcfto_term_meta_fields();
$fields = $meta[$taxonomy]; ?>
<table class="form-table">
<tbody>
<?php foreach ($fields as $field_key => $field):
$value = wpcfto_get_term_meta_text($term->term_id, $field_key);
?>
<tr class="form-field">
<th scope="row">
<label for="<?php echo esc_attr($field_key) ?>"><?php echo sanitize_text_field($field['label']); ?></label>
</th>
<td>
<?php switch ($field['type']) {
case 'image':
wpcfto_term_meta_field_image($field_key, $value);
break;
case 'icon':
wpcfto_term_meta_field_icon($field_key, $value);
break;
case 'color':
wpcfto_term_meta_field_color($field_key, $value);
break;
default:
wpcfto_term_meta_field_default($field_key, $value);
} ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php }
function wpcfto_save_term_meta_field($term_id)
{
if (!empty($_POST['taxonomy'])) {
$taxonomy = sanitize_text_field($_POST['taxonomy']);
$meta = wpcfto_term_meta_fields();
if (!empty($meta[$taxonomy])) {
$fields = $meta[$taxonomy];
foreach ($fields as $field_key => $field) {
$field_value = (!empty($_POST[$field_key])) ? sanitize_text_field($_POST[$field_key]) : '';
update_term_meta($term_id, $field_key, $field_value);
}
}
}
}
});