0) ) ) {
$form_fields = array('import');
$method = '';
$url = wp_nonce_url('themes.php?page=tempera-page', 'tempera-import');
// Get file writing credentials
if (false === ($creds = request_filesystem_credentials($url, $method, false, false, $form_fields) ) ) {
return true;
}
if ( ! WP_Filesystem($creds) ) {
// our credentials were no good, ask the user for them again
request_filesystem_credentials($url, $method, true, false, $form_fields);
return true;
}
// Write the file if credentials are good
$upload_dir = wp_upload_dir();
$filename = trailingslashit($upload_dir['path']).'temperas.txt';
// by this point, the $wp_filesystem global should be working, so let's use it to create a file
global $wp_filesystem;
if ( ! $wp_filesystem->move($_FILES['import']['tmp_name'], $filename, true) ) {
echo 'Error saving file!';
return;
}
$file = $_FILES['import'];
if ($file['type'] == 'text/plain') {
$data = $wp_filesystem->get_contents($filename);
// try to read the file
if ($data !== FALSE){
$settings = json_decode($data, true);
// try to read the settings array
if (isset($settings['tempera_db'])){ ?>
';
}
else { // else: try to read the settings array
echo ''.__('Oops, there\'s a small problem.', 'tempera').'
';
echo __('The uploaded file does not contain valid Tempera options. Make sure the file is exported from the Tempera Options page.', 'tempera').'
';
tempera_import_form();
}
}
else { // else: try to read the file
echo ''.__('Oops, there\'s a small problem.', 'tempera').'
';
echo __('The uploaded file could not be read.', 'tempera').'
';
tempera_import_form();
}
}
else { // else: make sure the file uploaded was a plain text file
echo ''.__('Oops, there\'s a small problem.', 'tempera').'
';
echo __('The uploaded file is not supported. Make sure the file was exported from the Tempera page and that it is a text file.', 'tempera').'
';
tempera_import_form();
}
// Delete the file after we're done
$wp_filesystem->delete($filename);
}
else { // else: make sure there is an import file uploaded
echo ''.__( 'Oops! The file is empty or there was no file. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.', 'tempera' ).'
';
tempera_import_form();
}
echo ' ';
}
else {
wp_die(__('ERROR: You are not authorised to perform that operation', 'tempera'));
}
} // Closes the tempera_import_file() function definition
function tempera_presets(){
?>
CAUTION! When loading a color scheme, the Tempera theme settings under Text and Color Settings will be overriden. All other settings will remain intact.
SUGGESTION: It's always better to export your current theme settings before loading a color scheme." , "tempera"); ?>
Notice! You are close to the limit of variables your server accepts to process at a time.
You may not be able to save theme settings if a future update adds more configuration options unless you increase PHP's %s0% value.
";
$warnstr2 = "Warning! You will not be able to save the theme settings. Your server imposes a limit on the number of variables processed at a time lower than
the number of configuration variables the theme uses. You need to increase PHP's %s0% value to use the theme.
";
$warninfo = "The theme is currently using %s1% variables while your server limit is at %s2%.";
if (ini_get('max_input_vars')):
$phpmaxvars = ini_get('max_input_vars');
$warnstr1 = str_replace("%s0%","max_input_vars",$warnstr1);
$warnstr2 = str_replace("%s0%","max_input_vars",$warnstr2);
elseif (ini_get('suhosin.post.max_vars')):
$phpmaxvars = ini_get('suhosin.post.max_vars');
$warnstr1 = str_replace("%s0%","suhosin.post.max_vars",$warnstr1);
$warnstr2 = str_replace("%s0%","suhosin.post.max_vars",$warnstr2);
else:
$phpmaxvars = PHP_INT_MAX;
endif;
$warninfo = str_replace(array("%s1%","%s2%"),array($themevarcount,$phpmaxvars),$warninfo);
if ($themevarcount > $phpmaxvars): $return = $warnstr2.$warninfo;
elseif ($themevarcount+100 > $phpmaxvars): $return = $warnstr1.$warninfo;
else:
if ($debug): $return = "DEBUG: ".$warninfo; else: $return = ''; endif;
endif;
return $return;
} // cryout_maxvarcheck()
// Synchronizing the tinymce width with the content width
add_filter('tiny_mce_before_init', 'tempera_dynamic_editor_styles', 10);
function tempera_dynamic_editor_styles($settings){
$settings['content_css'] .= ",".admin_url('admin-ajax.php') ."/?action=dynamic_styles";
return $settings;
}
// add wp_ajax callback
add_action('wp_ajax_dynamic_styles', 'tempera_dynamic_styles_callback');
function tempera_dynamic_styles_callback(){
global $temperas;
echo "html .mceContentBody , .mceContentBody img {max-width:".$temperas['tempera_sidewidth']."px;}";
}
function cryout_fetch_feed() {
$tempera_news = fetch_feed( array( 'http://www.cryoutcreations.eu/cat/tempera/feed/') );
if ( ! is_wp_error( $tempera_news ) ) {
$maxitems = $tempera_news->get_item_quantity( 10 );
$news_items = $tempera_news->get_items( 0, $maxitems );
}
?>
' . __( 'No news items.', 'tempera' ) . ''; else :
foreach( $news_items as $news_item ) : ?>
-
get_date(' j F Y, H:i'); ?>
get_description() ),40,'...') ; ?>
Read more »