[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: term-handlers.php
<?php /** * @Template: term-handlers.php * @since: 1.0.0 * @author: Case-Themes * @descriptions: * @create: 27-Feb-18 */ if (!function_exists('ct_term_meta_export')) { function ct_term_meta_export($file) { global $wp_filesystem; $post_types = apply_filters('ct_post_types', array()); $taxonomies_data = array(); foreach ($post_types as $post_type) { $taxonomies = get_object_taxonomies($post_type); foreach ($taxonomies as $tax) { $terms = get_terms(array('taxonomy' => $tax, "hide_empty" => false)); foreach ($terms as $term) { $taxonomies_data[$tax][$term->slug] = get_term_meta($term->term_id); } } } $file_contents = json_encode($taxonomies_data); $wp_filesystem->put_contents($file, $file_contents, FS_CHMOD_FILE); // Save it } } if (!function_exists('ct_term_meta_import')) { function ct_term_meta_import($file) { // File exists? if (file_exists($file)) { // Get file contents and decode $data = file_get_contents($file); $taxonomies_data = json_decode($data, true); foreach ($taxonomies_data as $tax_name => $terms) { foreach ($terms as $term_slug => $term_metas) { $term = get_term_by('slug', $term_slug, $tax_name); foreach ($term_metas as $key => $value) { if (maybe_unserialize($value[0]) !== false && strpos($value[0], 'http') !== false && is_array(maybe_unserialize($value[0]))) { $str_data = json_encode(maybe_unserialize($value[0])); $index_start = strpos($str_data,'http'); $length = strpos($str_data, 'wp-content') - $index_start; $old_site = substr($str_data,$index_start,$length); $new_data = str_replace($old_site,site_url().'/',$str_data); $new_data = json_decode($new_data,true); } else { $new_data = maybe_unserialize($value[0]) !== false ? maybe_unserialize($value[0]): $value[0]; } if(!empty($term->term_id)){ update_term_meta($term->term_id, $key, $new_data ); } } } } global $import_result; $import_result[] = 'Import term meta successfully!'; } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.82 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002