/** * Keep settings in the file of theme * @param string $file Path to file where to save fields settings * @param string $settings_source Source setting * @return boolean Operation status */ function jcf_clone_db_settings_to_fs($file, $settings_source) { $jcf_settings = jcf_get_all_settings_from_db(); $dir = dirname($file); if (!is_dir($dir) && !wp_mkdir_p($dir) || !is_writable($dir) || !($saved = jcf_save_all_settings_in_file($jcf_settings, $settings_source))) { // if fail - print error $msg = array('error', sprintf(__('<strong>Settings storage update FAILED!</strong>. Please check that directory exists and writable: %s', JCF_TEXTDOMAIN), dirname($dir))); jcf_add_admin_notice($msg[0], $msg[1]); } else { // we have another notification after this func called //$msg = array('notice', __('<strong>Fields settings</strong> successfully copied!', JCF_TEXTDOMAIN)); } return $saved; }
/** * export fields from form callback */ function jcf_ajax_export_fields_form() { $jcf_read_settings = jcf_get_read_settings(); if ($jcf_read_settings != JCF_CONF_SOURCE_DB) { $jcf_settings = jcf_get_all_settings_from_file(); } else { $jcf_settings = jcf_get_all_settings_from_db(); } $post_types = !empty($jcf_settings['post_types']) ? $jcf_settings['post_types'] : jcf_get_post_types(); $fieldsets = $jcf_settings['fieldsets']; $field_settings = $jcf_settings['field_settings']; $registered_fields = jcf_get_registered_fields(); // load template header('Content-Type: text/html; charset=utf-8'); include JCF_ROOT . '/templates/export.tpl.php'; exit; }