* @version FW-20150208 */ global $cjtheme_item_vars, $cjtheme_file_opts, $wpdb; $cjtheme_options_table = cjtheme_item_info('options_table'); foreach ($cjtheme_item_vars['db_tables'] as $key => $sql) { $query = $wpdb->query($sql); if (!$query) { $wpdb->print_error(); die; } if (is_wp_error($query)) { echo $query->get_error_message(); die; } } $cjtheme_item_options = cjtheme_item_options(); foreach ($cjtheme_item_options as $key => $value) { foreach ($value as $okey => $ovalue) { $check = $wpdb->get_row("SELECT * FROM {$cjtheme_options_table} WHERE option_name = '{$ovalue['id']}'"); if (empty($check)) { if (is_array($ovalue['default'])) { $save_value = serialize($ovalue['default']); } else { $save_value = $ovalue['default']; } $wpdb->query("INSERT INTO {$cjtheme_options_table} (option_name, option_value) VALUES ('{$ovalue['id']}', '{$save_value}')"); } $cjtheme_file_opts[] = $ovalue['id']; } } $cjtheme_options_sync = $wpdb->get_results("SELECT * FROM {$cjtheme_options_table} ORDER BY option_id");
function cjtheme_google_fonts_string() { global $cjtheme_item_vars; $google_fonts = cjtheme_get_option('google_fonts'); $load_google_fonts_array = array(); if (!empty($google_fonts)) { $google_fonts_keys = array_keys(cjtheme_get_option('google_fonts')); $item_options = cjtheme_item_options(); foreach ($item_options as $key => $options) { foreach ($options as $key => $option) { if ($option['type'] == 'font') { $font_vars = cjtheme_get_option($option['id']); if (in_array($font_vars['family'], $google_fonts_keys)) { $load_google_fonts_array[$font_vars['family']] = $font_vars['family']; } } } } foreach ($load_google_fonts_array as $key => $font) { $string[] = str_replace(' ', '+', $key); } if (!empty($load_google_fonts_array)) { $return = @implode('|', $string); return $return; } else { return null; } } }