Skip to content

Commit

Permalink
Merge pull request #5 from vollyimnetz/develop
Browse files Browse the repository at this point in the history
Version 0.10.3
  • Loading branch information
vollyimnetz committed Nov 18, 2015
2 parents 5599141 + 258db52 commit a50a453
Show file tree
Hide file tree
Showing 17 changed files with 705 additions and 517 deletions.
2 changes: 1 addition & 1 deletion crop-thumbnails.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

//cpt - stands for crop-post-thumbnail
define('CROP_THUMBS_LANG','cpt_lang');
define('CROP_THUMBS_VERSION','0.10.2');
define('CROP_THUMBS_VERSION','0.10.3');

function cpt_plugin_init() {
load_plugin_textdomain( CROP_THUMBS_LANG, false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
Expand Down
28 changes: 14 additions & 14 deletions functions/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ function ajaxWindow() {
$_REQUEST['parent_post_id'] = intval($_REQUEST['image_by_post_id']);
$this->byImageId();
} else {
$failure_msg = '<div class="listEmptyMsg">'.__('No featured Image set for this post until now.',CROP_THUMBS_LANG).'</div>';
$failure_msg = '<div class="listEmptyMsg">'.__('No featured image set for this post until now.',CROP_THUMBS_LANG).'</div>';
}
break;
default:
$failure_msg = __('An error happend!',CROP_THUMBS_LANG);
$failure_msg = __('An error occurred!',CROP_THUMBS_LANG);
break;
}
}
Expand Down Expand Up @@ -77,7 +77,7 @@ function listImages() {
if($this->shouldBeHiddenOnPostType($options,$parent_post_type)) {
$cptContent = '<div class="postTypeDisabledMsg">'.__('Cropping is disabled for this post-type.',CROP_THUMBS_LANG).'</div>';
} elseif($data==false) {
$cptContent = '<div class="listEmptyMsg">'.__('No images in this post yet. You have to upload some via upload dialog.',CROP_THUMBS_LANG).'</div>';
$cptContent = '<div class="listEmptyMsg">'.__('No images attached to this post yet. Please upload some via the upload dialog.',CROP_THUMBS_LANG).'</div>';
} else {
//the dynamic javascript
ob_start(); ?>
Expand Down Expand Up @@ -177,9 +177,9 @@ function byImageId() {
<script>
jQuery(document).ready(function($) {
cpt_lang = new Object();
cpt_lang['bug'] = "<?php _e('bug - this case shouldnt be happend',CROP_THUMBS_LANG);?>";
cpt_lang['warningOriginalToSmall'] = "<?php _e('Warning: the original image is to small to be cropped in good quality with this thumbnail-size.',CROP_THUMBS_LANG);?>";
cpt_lang['selectOne'] = "<?php _e('First, select one image. Then, click once again.',CROP_THUMBS_LANG);?>";
cpt_lang['bug'] = "<?php _e('Bug--this should not have occurred.',CROP_THUMBS_LANG);?>";
cpt_lang['warningOriginalToSmall'] = "<?php _e('Warning: the original image is too small to be cropped in good quality with this thumbnail size.',CROP_THUMBS_LANG);?>";
cpt_lang['selectOne'] = "<?php _e('First, select an image. Then, click once again.',CROP_THUMBS_LANG);?>";
cpt_ajax_nonce = "<?php echo wp_create_nonce($cptSettings->getNonceBase()); ?>";
cpt_debug_js = <?php echo (!empty($options['debug_js'])) ? 'true;' : 'false;'; ?>
});
Expand All @@ -206,23 +206,23 @@ function byImageId() {
<?php else : ?>

<div class="cpt-crop-view">
<?php if($headline) :?><div class="header"><a class="back" href="<?php echo admin_url( 'admin-ajax.php'); ?>?action=croppostthumb_ajax&post_id=<?php echo $current_parent_post_id; ?>"><?php _e('back to image-list',CROP_THUMBS_LANG); ?></a></div><?php endif; ?>
<div class="waitingWindow hidden"><?php _e('Please wait until the Images are cropped.',CROP_THUMBS_LANG); ?></div>
<?php if($headline) :?><div class="header"><a class="back" href="<?php echo admin_url( 'admin-ajax.php'); ?>?action=croppostthumb_ajax&post_id=<?php echo $current_parent_post_id; ?>"><?php _e('back to image list',CROP_THUMBS_LANG); ?></a></div><?php endif; ?>
<div class="waitingWindow hidden"><?php _e('Please wait until the images are cropped.',CROP_THUMBS_LANG); ?></div>
<div class="mainWindow">
<div class="selectionArea cptLeftPane">
<h3><?php _e('Raw',CROP_THUMBS_LANG); ?>: <?php echo $orig_img[1].' '.__('pixel',CROP_THUMBS_LANG)?> x <?php echo $orig_img[2].' '.__('pixel',CROP_THUMBS_LANG) ?> (<?php echo $orig_img['print_ratio']; ?>)</h3>
<img src="<?php echo $orig_img[0]?>" data-values='{"id":<?php echo $image_obj->ID; ?>,"parentId":<?php echo $post_id_attached ?>,"width":<?php echo $orig_img[1]?>,"height":<?php echo $orig_img[2] ?>}' />
<button id="cpt-generate" class="button"><?php _e('save crop',CROP_THUMBS_LANG);?></button>
<h4><?php _e('Quick-Instructions',CROP_THUMBS_LANG);?></h4>
<button id="cpt-generate" class="button"><?php _e('Save Crop',CROP_THUMBS_LANG);?></button>
<h4><?php _e('Quick Instructions',CROP_THUMBS_LANG);?></h4>
<ul class="step-info">
<li><?php _e('Step 1: Choose an image from the right.',CROP_THUMBS_LANG); ?></li>
<li><?php _e('Step 2: Use the mouse change the size of the rectangle on the image above.',CROP_THUMBS_LANG); ?></li>
<li><?php _e('Step 3: Click on "save crop".',CROP_THUMBS_LANG); ?></li>
<li><?php _e('Step 2: Use your mouse to change the size of the rectangle on the image above.',CROP_THUMBS_LANG); ?></li>
<li><?php _e('Step 3: Click on "Save Crop".',CROP_THUMBS_LANG); ?></li>
</ul>
</div>
<div class="cptRightPane">
<input type="checkbox" name="cpt-same-ratio" value="1" id="cpt-same-ratio" checked="checked" />
<label for="cpt-same-ratio" class="lbl-cpt-same-ratio"><?php _e('select images with same ratio at once',CROP_THUMBS_LANG); ?></label>
<label for="cpt-same-ratio" class="lbl-cpt-same-ratio"><?php _e('Crop all images with same ratio at once',CROP_THUMBS_LANG); ?></label>
<button id="cpt-deselect" class="button"><?php _e('deselect all',CROP_THUMBS_LANG); ?></button>
<ul class="thumbnail-list">
<?php
Expand Down Expand Up @@ -283,7 +283,7 @@ function byImageId() {

$_lowResWarning = '';
if($this->isLowRes($value,$orig_img)) {
$_lowResWarning = ' <span class="lowResWarning">'.__('Original image to small for good crop-quality!',CROP_THUMBS_LANG).'</span>';
$_lowResWarning = ' <span class="lowResWarning">'.__('Original image size too small for good crop quality!',CROP_THUMBS_LANG).'</span>';
}

?>
Expand Down
24 changes: 12 additions & 12 deletions functions/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CptSaveThumbnail {

/**
* Handle-function called via ajax request.
* Check and crop multiple Images. Update with wp_update_attachment_metadata if needed.
* Check and crop multiple images. Update with wp_update_attachment_metadata if needed.
* Input parameters:
* * $_REQUEST['selection'] - json-object - data of the selection/crop
* * $_REQUEST['raw_values'] - json-object - data of the original image
Expand Down Expand Up @@ -48,8 +48,8 @@ function saveThumbnail() {
#$debug.= "\nsource:".$sourceImgPath."\n";

/**
* will be true if the image format issnt in the attachements metadata,
* and wordpress dont know about the image-file
* will be true if the image format isn't in the attachements metadata,
* and Wordpress doesn't know about the image file
*/
$_changed_image_format = false;
$_processing_error = array();
Expand All @@ -58,7 +58,7 @@ function saveThumbnail() {
$this->addDebug(print_r($_imageSize,true));
$_delete_old_file = '';
if(!$this->isImageSizeValid($_imageSize,$dbImageSizes)) {
$this->addDebug("Image Size not valid.");
$this->addDebug("Image size not valid.");
continue;
}
if(empty($post_metadata['sizes'][$_imageSize->name])) {
Expand Down Expand Up @@ -103,18 +103,18 @@ function saveThumbnail() {

$_error = false;
if(empty($result)) {
$_processing_error[] = sprintf(__('Cant generate filesize "%s".',CROP_THUMBS_LANG),$_imageSize->name);
$_processing_error[] = sprintf(__("Can't generate filesize '%s'.",CROP_THUMBS_LANG),$_imageSize->name);
$_error = true;
} else {
if(!empty($_delete_old_file)) {
@unlink($_filepath_info['dirname'].'/'.$_delete_old_file);
}
if(!@copy($result,$_filepath)) {
$_processing_error[] = sprintf(__('Cant copy temporary file to media-library.',CROP_THUMBS_LANG));
$_processing_error[] = sprintf(__("Can't copy temporary file to media library.",CROP_THUMBS_LANG));
$_error = true;
}
if(!@unlink($result)) {
$_processing_error[] = sprintf(__('Cant delete temporary file.',CROP_THUMBS_LANG));
$_processing_error[] = sprintf(__("Can't delete temporary file.",CROP_THUMBS_LANG));
$_error = true;
}
}
Expand Down Expand Up @@ -206,15 +206,15 @@ function validation($selection,$obj,$sourceImgPath,$post_metadata) {
}

if(!isset($selection->x) || !isset($selection->y) || !isset($selection->x2) || !isset($selection->y2)) {
throw new Exception(__('ERROR: Submitted data are not complete.',CROP_THUMBS_LANG), 1);
throw new Exception(__('ERROR: Submitted data is incomplete.',CROP_THUMBS_LANG), 1);
}
$selection->x = intval($selection->x);
$selection->y = intval($selection->y);
$selection->x2 = intval($selection->x2);
$selection->y2 = intval($selection->y2);

if($selection->x < 0 || $selection->y < 0) {
throw new Exception(__('A cropping with this dimensions on these Image ist not possible.',CROP_THUMBS_LANG), 1);
throw new Exception(__('Cropping to these dimensions on this image is not possible.',CROP_THUMBS_LANG), 1);
}

/**
Expand All @@ -225,13 +225,13 @@ function validation($selection,$obj,$sourceImgPath,$post_metadata) {
*/

if(empty($obj)) {
throw new Exception(__('ERROR: Can`t find original Image in Database!',CROP_THUMBS_LANG), 1);
throw new Exception(__("ERROR: Can't find original image in database!",CROP_THUMBS_LANG), 1);
}
if(empty($sourceImgPath)) {
throw new Exception(__('ERROR: Can`t find original Imagefile!',CROP_THUMBS_LANG), 1);
throw new Exception(__("ERROR: Can't find original image file!",CROP_THUMBS_LANG), 1);
}
if(empty($post_metadata)) {
throw new Exception(__('ERROR: Can`t find original Image-Metadata!',CROP_THUMBS_LANG), 1);
throw new Exception(__("ERROR: Can't find original image metadata!",CROP_THUMBS_LANG), 1);
}
}

Expand Down
12 changes: 6 additions & 6 deletions functions/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function optionsPage() { ?>
</form>

<div class="<?php echo $this->cssPrefix; ?>paypal">
<h3><?php _e('Support the plugin-author',CROP_THUMBS_LANG) ?></h3>
<p><?php _e('You can support the plugin-author <br />(and let him know you love this plugin) <br />by donating via Paypal. Thanks a lot!',CROP_THUMBS_LANG); ?></p>
<h3><?php _e('Support the plugin author',CROP_THUMBS_LANG) ?></h3>
<p><?php _e('You can support the plugin author <br />(and let him know you love this plugin) <br />by donating via Paypal. Thanks a lot!',CROP_THUMBS_LANG); ?></p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="[email protected]">
Expand All @@ -69,8 +69,8 @@ function settingsInitialisation(){
register_setting( $this->uniqeSettingsId, $this->optionsKey, array($this,'validateSettings') );

$_sectionID = 'choose_sizes_section';
add_settings_section($_sectionID, __('Sizes and Posttypes',CROP_THUMBS_LANG), array($this,'sectionDescriptionChooseSizes'), 'page1');
add_settings_field('sizes', __('Choose the image-sizes you want to hide. Choose a post-type to prevent any use of the plugin for these entries.',CROP_THUMBS_LANG), array($this,'callback_choose_size'), 'page1', $_sectionID);
add_settings_section($_sectionID, __('Sizes and Post Types',CROP_THUMBS_LANG), array($this,'sectionDescriptionChooseSizes'), 'page1');
add_settings_field('sizes', __('Choose the image size options you want to hide for each post type.',CROP_THUMBS_LANG), array($this,'callback_choose_size'), 'page1', $_sectionID);
/*
$_sectionID = 'experimental';
add_settings_section($_sectionID, __('Experimental Settings',CROP_THUMBS_LANG), array($this,'emptySectionDescription'), 'page1');
Expand All @@ -87,8 +87,8 @@ function settingsInitialisation(){

function sectionDescriptionChooseSizes() {?>
<p>
<?php _e('Crop-Thumbnails is created to make cropping easy for the user. Often times the user only need to crop one, in dependence of the post-type. But the system will create also all other sizes. So, here you can select for what post-type what sizes should be visible in the plugin interface.',CROP_THUMBS_LANG) ?>
<br /><strong><?php _e('Crop-Thumbnails will only show croped images - sizes with no crop will always be hidden.',CROP_THUMBS_LANG); ?></strong>
<?php _e('Crop-Thumbnails is designed to make cropping images easy. For some post types, not all crop sizes are needed, but the plugin will automatically create all the crop sizes. Here you can select which crop sizes are available in the cropping interface for each post type..',CROP_THUMBS_LANG) ?>
<br /><strong><?php _e('Crop-Thumbnails will only show cropped images. Sizes with no crop will always be hidden.',CROP_THUMBS_LANG); ?></strong>
</p>
<?php
}
Expand Down
Binary file modified lang/cpt_lang-de_DE.mo
Binary file not shown.
Loading

0 comments on commit a50a453

Please sign in to comment.