2023-12-26 269次
// http://www.xxxxx.com/?options=go
if (isset($_GET['options']) == 'go') {
global $wpdb;
$optionsframework_value = get_option('optionsframework');
$optionsframework_value = $optionsframework_value['id'];
$sql = "SELECT * FROM wp_options WHERE option_name= '{$optionsframework_value}'";
$results = $wpdb->get_results($sql, ARRAY_A);
echo "<pre>";
echo "<hr>";
echo "原始数据 =><br>";
var_dump(get_option("demo"));
echo "<hr>";
$fixed_value = resetlengths($results[0]["option_value"]);
// var_dump("处理数据 =>" . $fixed_value);
if (!empty($fixed_value)) {
$sql = "UPDATE wp_options SET option_value = '{$fixed_value}' WHERE option_name = '{$optionsframework_value}'";
$result = $wpdb->query($sql);
if ($result) {
echo "修正数据成功";
}
} else {
echo "无需处理";
}
}
//
function resetlengths($oldObject)
{
$aRex = '/s:(\d+):"(.*?)";/';
$newObject = preg_replace_callback($aRex, "rexOpotion", $oldObject);
if ($oldObject !== $newObject) {
return $newObject;
}
}
//
function rexOpotion($matches)
{
$len = strlen($matches[2]);
return 's:' . $len . ':"' . $matches[2] . '";';
}
// 调用 <?php echo of_get_option('site_notices', '暂无公告信息!');?>
// 常用配置
function optionsframework_options()
{
// 将所有分类(categories)加入数组
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
$options = array();
## 选项卡1
$options[] = array(
'name' => __('站点设置', 'GJ'),
'type' => 'heading'
);
// $options[] = array(
// 'name'=>'上传LOGO',
// 'desc' => __('尺寸400*400', 'GJ'),
// 'placeholder' => __('50px', 'GJ'),
// 'id' => 'site_logo',
// 'type' => 'upload'
// );
$options[] = array(
'desc' => __('是否显示线下专业渠道模块'),
'id' => 'show_buss',
'std' => '0',
'type' => 'checkbox'
);
$options[] = array(
'desc' => '微信二维码300*300',
'id' => 'site_wx',
'type' => 'upload'
);
$options[] = array(
'desc' => __('微博地址'),
'id' => 'site_weibo_link',
'type' => 'text'
);
$options[] = array(
'desc' => __('天猫店铺'),
'id' => 'site_tmall_link',
'type' => 'text'
);
$options[] = array(
'desc' => __('京东店铺'),
'id' => 'site_jd_link',
'type' => 'text'
);
// 地址信息
$options[] = array(
'desc' => __('地址信息'),
'id' => 'site_address',
'type' => 'text'
);
// 沟通工具
$options[] = array(
// 'placeholder' => '电话号码',
'desc' => __('企业邮箱'),
'id' => 'site_email',
'type' => 'text'
);
$options[] = array(
'desc' => __('Hr邮箱'),
'id' => 'site_email_hr',
'type' => 'text'
);
$options[] = array(
'desc' => __('企业电话'),
'id' => 'site_phone',
'type' => 'text'
);
// $options[] = array(
// 'desc' => __('QQ号码'),
// 'id' => 'site_qq',
// 'type' => 'text'
// );
// $options[] = array(
// 'desc' => __('咨询链接'),
// 'id' => 'site_online',
// 'type' => 'text'
// );
// 备案信息
$options[] = array(
'desc' => __('备案链接'),
'id' => 'site_icp_link',
"std" => 'https://beian.miit.gov.cn/',
'type' => 'text'
);
$options[] = array(
'desc' => __('ICP备案号'),
'id' => 'site_icp',
'type' => 'text'
);
$options[] = array(
'desc' => __('公安备案号'),
'id' => 'site_gongan',
'type' => 'text'
);
$options[] = array(
'desc' => __('Copyright版权'),
'id' => 'site_copyright',
'type' => 'text'
);
## 选项卡2
$options[] = array(
'name' => __('首页轮播图', 'GJ'),
'type' => 'heading'
);
$options[] = array(
'name' => __('首页banner', 'GJ'),
);
$options[] = array(
'desc' => __('输入轮播数量,最大支持5条'),
'id' => 'slide_number',
'std' => '0',
'class' => 'mini',
'type' => 'text'
);
$slide_num = of_get_option('slide_number');
if (empty($slide_num)) {
$slide_num = 0;
}
if ($slide_num > 5) {
$slide_num = 5;
}
for ($i = 0; $i < $slide_num; $i++) {
$options[] = array(
'id' => 'slide_pc_' . $i,
'desc' => __('电脑端1920*860', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'slide_mb_' . $i,
'desc' => __('移动端750*860', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'slide_title1_' . $i,
'desc' => __('标题1', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'slide_title2_' . $i,
'desc' => __('标题2', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'slide_desc_' . $i,
'desc' => __('描述', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'slide_link_' . $i,
'desc' => __('链接', 'GJ'),
'type' => 'text'
);
}
## 选项卡3
$options[] = array(
'name' => __('栏目Banner', 'GJ'),
'type' => 'heading'
);
// 1s
$options[] = array(
'id' => 'banner_about_pc',
'name' => __('关于琉兴', 'GJ'),
'desc' => __('电脑端1920*800', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_about_mb',
'desc' => __('移动端750*1200', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_about_title',
'desc' => __('标题', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'banner_about_subtitle',
'desc' => __('副标题', 'GJ'),
'type' => 'text'
);
// 3s
$options[] = array(
'id' => 'banner_product_pc',
'name' => __('产品中心', 'GJ'),
'desc' => __('电脑端1920*800', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_product_mb',
'desc' => __('移动端750*1200', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_product_title',
'desc' => __('标题', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'banner_product_subtitle',
'desc' => __('副标题', 'GJ'),
'type' => 'text'
);
// 4s
$options[] = array(
'id' => 'banner_solution_pc',
'name' => __('解决方案', 'GJ'),
'desc' => __('电脑端1920*800', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_solution_mb',
'desc' => __('移动端750*1200', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_solution_title',
'desc' => __('标题', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'banner_solution_subtitle',
'desc' => __('副标题', 'GJ'),
'type' => 'text'
);
// 10s
$options[] = array(
'id' => 'banner_news_pc',
'name' => __('新闻资讯', 'GJ'),
'desc' => __('电脑端1920*800', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_news_mb',
'desc' => __('移动端750*1200', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_news_title',
'desc' => __('标题', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'banner_news_subtitle',
'desc' => __('副标题', 'GJ'),
'type' => 'text'
);
//
$options[] = array(
'id' => 'banner_contact_pc',
'name' => __('联系我们', 'GJ'),
'desc' => __('电脑端1920*800', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_contact_mb',
'desc' => __('移动端750*1200', 'GJ'),
'type' => 'upload'
);
$options[] = array(
'id' => 'banner_contact_title',
'desc' => __('标题', 'GJ'),
'type' => 'text'
);
$options[] = array(
'id' => 'banner_contact_subtitle',
'desc' => __('副标题', 'GJ'),
'type' => 'text'
);
//
## 选项卡4
// $options[] = array(
// 'name' => __('其他设置', 'GJ'),
// 'type' => 'heading'
// );
// /*分隔*/
// $options[] = array(
// 'name' => __('百度统计', 'Solome'),
// 'id' => 'baidutongji',
// 'std' => '',
// 'type' => 'textarea'
// );
// $options[] = array(
// 'name' => __('其他统计', 'Solome'),
// 'id' => 'qitatongji',
// 'std' => '',
// 'type' => 'textarea'
// );
## 选项卡3
// $options[] = array(
// 'name' => __('社交Link', 'GJ'),
// 'type' => 'heading'
// );
// $options[] = array(
// 'desc' => __('Instagram'),
// 'id' => 'app_instagram',
// 'type' => 'text'
// );
// $options[] = array(
// 'desc' => __('Facebook'),
// 'id' => 'app_facebook',
// 'type' => 'text'
// );
// $options[] = array(
// 'desc' => __('Twitter'),
// 'id' => 'app_twitter',
// 'type' => 'text'
// );
// $options[] = array(
// 'desc' => __('Linkedin'),
// 'id' => 'app_linkedin',
// 'type' => 'text'
// );
// $options[] = array(
// 'desc' => __('Weibo'),
// 'id' => 'app_weibo',
// 'type' => 'text'
// );
return $options;
}