Commit c932a52e authored by root's avatar root Committed by lechuck
Browse files

Aggiornato Theme Constructor alla 1.5.7

parent 580d01f8
......@@ -20,7 +20,7 @@ if (version_compare(phpversion(), '5.0.0', '<')) {
$constructor_modules = array(
__('Themes', 'constructor') => 'themes',
__('Layout', 'constructor') => 'layout',
__('Sidebar', 'constructor') => 'sidebar',
__('Templates', 'constructor') => 'templates',
__('Header', 'constructor') => 'header',
__('Content', 'constructor') => 'content',
__('Comments','constructor') => 'comments',
......@@ -32,6 +32,7 @@ $constructor_modules = array(
__('Images', 'constructor') => 'images',
__('Slideshow', 'constructor') => 'slideshow',
__('Save', 'constructor') => 'save',
__('Clean', 'constructor') => 'clean',
__('Help', 'constructor') => 'help'
);
......
......@@ -5,8 +5,6 @@
* @package WordPress
* @subpackage Constructor
*/
require_once 'ajax/donate.php';
require_once 'ajax/save.php';
/**
* Definition of response OK/KO
......@@ -16,17 +14,12 @@ require_once 'ajax/save.php';
define('RESPONSE_OK', 'ok');
define('RESPONSE_KO', 'ko');
/**
* Return simple JSON response
*
* @param string $status RESPONSE_OK|RESPONSE_KO
* @param string $message
*/
function returnResponse($status = RESPONSE_OK, $message = '') {
header('Content-type: application/json');
$message = addslashes($message);
echo "{'status':'$status','message':'$message'}";
die();
}
require_once CONSTRUCTOR_DIRECTORY .'/libs/Constructor/Ajax.php';
$ajax = new Constructor_Ajax();
add_action('wp_ajax_constructor_admin_save', array($ajax, 'save'));
add_action('wp_ajax_constructor_admin_clean', array($ajax, 'clean'));
add_action('wp_ajax_constructor_admin_donate', array($ajax, 'donate'));
?>
\ No newline at end of file
<?php
/**
* @package WordPress
* @subpackage Constructor
*/
function constructor_admin_donate() {
// set donate flag to false
$constructor_admin = get_option('constructor_admin');
$constructor_admin['donate'] = false;
update_option('constructor_admin', $constructor_admin);
die();
}
add_action('wp_ajax_constructor_admin_donate', 'constructor_admin_donate');
?>
\ No newline at end of file
<?php
/**
* @package WordPress
* @subpackage Constructor
*/
function constructor_admin_save()
{
global $current_user, $template_uri;
// setup permissions for save
$permission = 0777;
$directory = get_template_directory();
// get theme options
$constructor = get_option('constructor');
$admin = get_option('constructor_admin');
// get theme name
$theme = isset($_REQUEST['theme'])?$_REQUEST['theme']:$admin['theme'];
$theme_old = $constructor['theme'];
$theme_new = strtolower($theme);
$theme_new = preg_replace('/\W/', '-', $theme_new);
$theme_new = preg_replace('/[-]+/', '-', $theme_new);
$theme_uri = isset($_REQUEST['theme-uri'])?$_REQUEST['theme-uri']:'';
$description = stripslashes(isset($_REQUEST['description'])?$_REQUEST['description']:'');
$version = isset($_REQUEST['version'])?$_REQUEST['version']:'0.0.1';
$author = isset($_REQUEST['author'])?$_REQUEST['author']:'';
$author_uri = isset($_REQUEST['author-uri'])?$_REQUEST['author-uri']:$current_user->user_nicename;
if (is_dir($directory.'/themes/'.$theme_new) &&
!is_writable($directory.'/themes/'.$theme_new)) {
returnResponse(RESPONSE_KO, sprintf(__('Directory "%s" is not writable.', 'constructor'), $directory.'/themes/'.$theme_new));
} else {
if (!is_writable($directory.'/themes/')) {
returnResponse(RESPONSE_KO, sprintf(__('Directory "%s" is not writable.', 'constructor'), $directory.'/themes/'));
} else {
@mkdir($directory.'/themes/'.$theme_new);
@chmod($directory.'/themes/'.$theme_new, $permission);
}
}
// copy all theme images to new? directory
foreach ($constructor['images'] as $img => $data) {
if (!empty($data['src'])) {
$file = pathinfo($data['src']);
$old_image = $directory . '/'. $data['src'];
$new_image = $directory . '/themes/'. $theme_new .'/'. $file['basename'];
if ($old_image != $new_image) {
// we are already check directory permissions
if (!@copy($old_image, $new_image)) {
returnResponse(RESPONSE_KO, sprintf(__('Can\'t copy file "%s".', 'constructor'), $old_image));
}
// read and write for owner and everybody else
@chmod($new_image, $permission);
$constructor['images'][$img]['src'] = 'themes/'. $theme_new .'/'. $file['basename'];
}
}
}
// copy default screenshot (if not exist)
if (!file_exists($directory.'/themes/'.$theme_new.'/screenshot.png') &&
file_exists($directory.'/themes/'.$theme_old.'/screenshot.png')) {
if (!@copy($directory.'/themes/'.$theme_old.'/screenshot.png', $directory.'/themes/'.$theme_new.'/screenshot.png')) {
returnResponse(RESPONSE_KO, sprintf(__('Can\'t copy file "%s".', 'constructor'), '/themes/'.$theme_old.'/screenshot.png'));
}
} elseif (!file_exists($directory.'/themes/'.$theme_new.'/screenshot.png')) {
if (!@copy($directory.'/admin/images/screenshot.png', $directory.'/themes/'.$theme_new.'/screenshot.png')) {
returnResponse(RESPONSE_KO, sprintf(__('Can\'t copy file "%s".', 'constructor'), '/admin/images/screenshot.png'));
}
}
// read and write for owner and everybody else
@chmod($directory.'/themes/'.$theme_new.'/screenshot.png', $permission);
// update style file
if (file_exists($directory.'/themes/'.$theme_old.'/style.css')) {
$style = file_get_contents($directory.'/themes/'.$theme_old.'/style.css');
// match first comment /* ... */
$style = preg_replace('|\/\*(.*)\*\/|Umis', '', $style, 1);
} else {
$style = '';
}
$style = "/*
Theme Name: $theme
Theme URI: $theme_uri
Description: $description
Version: $version
Author: $author
Author URI: $author_uri
*/".$style;
unset($constructor['theme']);
$config = "<?php \n".
"/* Save on ".date('Y-m-d H:i')." */ \n".
"return ".
var_export($constructor, true).
"\n ?>";
// update files content
if (!@file_put_contents($directory.'/themes/'.$theme_new.'/style.css', $style)) {
returnResponse(RESPONSE_KO, sprintf(__('Can\'t save file "%s".', 'constructor'), '/themes/'.$theme_new.'/style.css'));
}
if (!@file_put_contents($directory.'/themes/'.$theme_new.'/config.php', $config)) {
returnResponse(RESPONSE_KO, sprintf(__('Can\'t save file "%s".', 'constructor'), '/themes/'.$theme_new.'/config.php'));
}
returnResponse(RESPONSE_OK, __('Theme was saved, please reload page for view changes', 'constructor'));
die();
}
add_action('wp_ajax_constructor_admin_save', 'constructor_admin_save');
?>
\ No newline at end of file
......@@ -129,10 +129,12 @@
.constructor dl dd {
padding:2px;
}
.constructor .slider input {
.constructor .slider input,
.constructor input.tiny {
border:0;
color:#21759B;
font-weight:bold;
text-align:right;
width:42px
}
......@@ -224,7 +226,83 @@
#constr-themes div p {
color:#555;
}
/*Layouts Tab*/
.layout-preview {
margin:10px auto;
width:694px;height:440px;
padding:6px;
border:2px solid #ccc;
border-radius: 6px;
-moz-border-radius: 6px;
-khtml-border-radius: 6px;
-webkit-border-radius: 6px;
box-shadow: 2px 2px 4px #aaa;
-moz-box-shadow: 2px 2px 4px #aaa;
-webkit-box-shadow: 2px 2px 4px #aaa
}
.layout-main-content {
display:none;
width:694px;height:440px;
border:1px solid #ccc;
}
.margin-east, .margin-west {
color:#777;
background: #ddd;
overflow: hidden;
}
.layout-info {
text-shadow: 0 1px 0 #FFFFFF;
text-align:center;
margin:4px 0;
}
.layout-info span {
color:#777
}
.east, .west, .center {
background: #fff;
}
.center {
border-bottom:1px solid #ccc;
}
.south {
border-top:1px solid #ccc;
}
#layouts a {
background:url(images/layouts.png) 50% 4px no-repeat;
width:160px;
height:120px;
text-indent:-9999%;
}
#layouts a.el1 { background-position: 50% -136px }
#layouts a.el2 { background-position: 50% -276px }
#layouts a.el3 { background-position: 50% -416px }
#layouts a.el4 { background-position: 50% -556px }
#layouts a.el5 { background-position: 50% -696px }
/*Controls*/
.graver-north {
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
background: url(images/graver.png) #fff 50% -100% repeat-y;
}
.graver-west-open, .graver-east-open,
.resizer-east, .resizer-west {
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
background: url(images/graver.png) #fff 100% 50% repeat-x;
}
.sidebar {
background: #CBE3FF;
}
.extrabar {
background: #99ff99;
}
/*Fonts Tab*/
#constr-fonts select {
font-size:14px;
......@@ -232,9 +310,11 @@
#constr-fonts optgroup option {
text-indent:8px;
}
#font-example {
font-size:26px;
.font-example {
margin:10px;
border:1px solid #ddd;
}
.font-example
/*Footer Tab*/
#constr-footer textarea {
......@@ -271,40 +351,28 @@
#opacity .darklow {
color:#fff;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA9JREFUeNpiYGBg8AUIMAAAUgBOUWVeTwAAAABJRU5ErkJggg==);
background:rgba(0, 0, 0, 0.3);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#50000000, endColorstr=#50000000);
background:url('../../images/opacity_black_30.png');
}
#opacity .dark {
color:#fff;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA9JREFUeNpiYmBgaAAIMAAAjwCD5Hc2/AAAAABJRU5ErkJggg==);
background:rgba(0, 0, 0, 0.5);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#75000000, endColorstr=#75000000);
background:url('../../images/opacity_black_50.png');
}
#opacity .darkhigh {
color:#fff;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA9JREFUeNpiYGBgOAMQYAAA0QDNW2hbhQAAAABJRU5ErkJggg==);
background:rgba(0, 0, 0, 0.8);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#90000000, endColorstr=#90000000);
background:url('../../images/opacity_black_80.png');
}
#opacity .lightlow {
color:#000;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi+P//vy9AgAEACUkDS4BbGHwAAAAASUVORK5CYII=);
background:rgba(255, 255, 255, 0.3);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#50FFFFFF, endColorstr=#50FFFFFF);
background:url('../../images/opacity_white_30.png');
}
#opacity .light {
color:#000;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi/v//fyxAgAEACWgDXjXePfkAAAAASUVORK5CYII=);
background:rgba(255, 255, 255, 0.5);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#75FFFFFF, endColorstr=#75FFFFFF);
background:url('../../images/opacity_white_50.png');
}
#opacity .lighthigh {
color:#000;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi/P///xmAAAMACc0DyzeP8KAAAAAASUVORK5CYII=);
background:rgba(255, 255, 255, 0.8);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#90FFFFFF, endColorstr=#90FFFFFF);
background:url('../../images/opacity_white_80.png');
}
.colorpicker input {
......@@ -316,7 +384,7 @@
#constructor-layers {
width:800px;
height:659px;
background:url(images/layers.png) !important;
background:url(images/images-hint.png) !important;
}
#constructor-layers ol {
padding:144px 0 0 64px;
......
......@@ -4,22 +4,38 @@
* @subpackage Constructor
*/
return array(
'Cantarell', // Regular Italic Bold Bold Italic
'Cardo', //
'Allerta',
'"Allerta Stencil"',
'Arimo', // Regular / Italic / Bold / Bold Italic
'Arvo', // Regular / Italic / Bold / Bold Italic
'Bentham',
'Cantarell', // Regular / Italic / Bold / Bold Italic
'Cardo',
'Cousine', // Regular / Italic / Bold / Bold Italic
'Crimson',
'"Droid Sans",sans-serif', // Regular Bold
'"Droid Sans Mono",monospace',
'"Droid Serif",serif',
'Cuprum',
'"Droid Sans"', // Regular / Bold
'"Droid Sans Mono"',
'"Droid Serif"',
'Geo',
'"IM Fell"',
'Inconsolata',
'"Josefin Sans Std Light"',
'"Josefin Sans"',
'"Josefin Slab"',
'Lobster',
'Molengo',
'Neucha',
'Neuton',
'Nobile',
'"OFL Sorts Mill Goudy TT"',
'"Old Standard TT"',
'"PT Sans"',
'Philosopher',
'Puritan',
'"Reenie Beanie"',
'Tangerine',
'Tinos',
'UnifrakturMaguntia',
'Vollkorn',
'"Yanone Kaffeesatz"',
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment