Skip to content

Commit

Permalink
Pretty big rewrite and reorganization - lots of cleanup - see #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Olaru committed Oct 11, 2019
1 parent 07e7119 commit 016c01c
Show file tree
Hide file tree
Showing 476 changed files with 4,149 additions and 4,138 deletions.
95 changes: 93 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,99 @@
[![Build Status](https://travis-ci.org/pixelgrade/pixproof.svg?branch=wporg)](https://travis-ci.org/pixelgrade/pixproof)

PixProof
========
**Easy Photo Proofing for Photographers**

## Description

WordPress photo gallery proofing plugin. Using special protected galleries you will allow your clients to examine and approve your photos.

**PixProof Gallery [Demo #1](http://bit.ly/1m3LmS0)** (use ‘demo’ as password)

It is a simple to use plugin that uses a Custom Post Type called Proof Galleries to help you manage your "clients" galleries separated from other post types you may have around (like regular galleries or projects).

These can be either public galleries (you will use the fact that the URL is not public and provide it only to your client) or password protected galleries (this is the recommended way) and you will provide the URL and the password to your individual clients (you can even make them private galleries - it is up to you).

You can read more about PixProof plugin on this article: [Proofing Photos with your Clients](https://pixelgrade.com/docs/timber/pages-and-content/proof-photos-clients/)


### Enabling Images Download

Go to Settings - PixProof - General Settings and check "Enable Images Download".

You can choose from two options:

* Manually (default) - you have to upload a ZIP archive to each gallery.
* Automatically - the client can download the selected images in a ZIP archive (automatically generated by the server).

### Compatible

PixProof should work with any theme as it uses standard WordPress hooks and filters.

Always use the [stable version](https://wordpress.org/plugins/pixproof) from wordpress.org

## Installation

Installing "PixProof" can be done either by searching for "PixProof" via the "Plugins → Add New" screen in your WordPress dashboard, or by using the following steps:

1. Download the plugin via WordPress.org.
2. Upload the ZIP file through the _Plugins → Add New → Upload_ screen in your WordPress dashboard.
3. Activate the plugin through the _Plugins_ menu in WordPress.
4. Head over to _Settings → PixProof_ and set it up, or go to _Proof Galleries_ and manage your galleries.

## Issues

If you identify any errors or have an idea for improving the plugin, please open an [issue](https://github.com/pixelgrade/pixproof/issues?stage=open). We're more than excited to see what the community thinks of this little plugin, and we welcome your input!

If Github is not your thing but you are passionate about PixProof and want to help us make it better, don't hesitate to [reach us](https://pixelgrade.com/contact/).

## Credits

* [CMB2](https://github.com/CMB2/CMB2) Metaboxes, custom fields library - License: GPLv2 or later
* [CMB2 Conditionals](https://github.com/jcchavezs/cmb2-conditionals/) plugin for CMB2 - License: GPLv2 or later

## Changelog

= 2.0.0 =
* This is a big rewrite of the plugin to make it easier to maintain and understand, also improved performance and future proofing compatibility.
* This update is **fully backward compatible** with previous versions.
* Tested with the latest WordPress version (5.2.3).
* Fixed minor issues.

= 1.2.4 =
* Added the `pixproof_filter_gallery_filename` filter
* Fixed some gallery filename issues.

= 1.2.3 =
* Improved strings translation.
* Fixed random order for images in gallery
* Fixed free access for archives created automatically(security fix)
* Fixed small warnings

= 1.2.2 =
* Improved strings translation. Thanks [David Perez](https://github.com/pixelgrade/pixproof/pull/17)
* Quit .po/.mo files for a general .pot one.

= 1.2.1 =
* Added the ability to disable the plugin style.
* Fixed some admin page style issues

= 1.2.0 =
* Added the ability to disable the download zip archives.
* Added the option to select the thumbnail size for individual gallery but also for all of them.
* Added the option to select the grid size
* Fixed the random order gallery option
* Fixed an issue where images are messed up after the plugin activation
* Small style improvements

= 1.1.1 =
* Fixed ZIP archive download on Windows
* Fixed Small bugs

= 1.1.0 =
* Added "Download Selected Images" (ZIP) option

= 1.0.7 =
* General style fixes
* Fix private galleries

= 1.0.5 =
* This is where all the magic started.
1 change: 1 addition & 0 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#pixproof_setup_page .cmb2-wrap .cmb-type-title.cmb2-id-pixproof-galleries-title{margin-top:0}
1 change: 1 addition & 0 deletions assets/css/edit-post.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
114 changes: 114 additions & 0 deletions assets/js/cmb2-conditionals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
jQuery(document).ready(function($) {
'use strict';

/**
* Add 'show' and 'hide' event to JQuery event detection.
* @see http://viralpatel.net/blogs/jquery-trigger-custom-event-show-hide-element/
*/
$.each(['show', 'hide'], function (i, ev) {
var el = $.fn[ev];
$.fn[ev] = function () {
this.trigger(ev);
return el.apply(this, arguments);
};
});

function CMB2ConditionalsInit(context) {
if(typeof context === 'undefined') {
context = 'body';
}

$('[data-conditional-id]', context).each(function(i, e) {
var $e = $(e),
id = $e.data('conditional-id'),
value = $e.data('conditional-value');

var $element = $('[name="' + id + '"]'),
$parent = $e.parents('.cmb-row:first').hide(),
$conditionParent = $element.parents('.cmb-row:first');

$e.data('conditional-required', $e.prop('required')).prop('required', false);

$element
.on('change', function(evt){
if($element.attr('type') === 'checkbox') {
var checked = $element.prop('checked');
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"]', checked);
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"][data-conditional-value="on"]', checked);
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"][data-conditional-value="off"]', !checked);
} else if(typeof value === 'undefined') {
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"]', ($element.val() ? true : false));
} else {
var conditionValue = CMB2ConditionalsStringToUnicode(evt.currentTarget.value);
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"]:not([data-conditional-value="' + conditionValue + '"])', false);
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"][data-conditional-value="' + conditionValue + '"]', true);
CMB2ConditionalToggleRows('[data-conditional-id="' + id + '"][data-conditional-value*=\'"' + conditionValue + '"\']', true);
}
});

$conditionParent.on('hide', function(evt){
$parent.toggle( false );
});
$conditionParent.on('show', function(evt){
if($element.length === 1) {
$element.trigger('change');
} else {
$element.filter(':checked').trigger('change');
}
});

if($element.length === 1) {
$element.trigger('change');
} else {
$element.filter(':checked').trigger('change');
}
});
}

function CMB2ConditionalsStringToUnicode(string){
var result = '', map = ["Á", "Ă","Ắ","Ặ","Ằ","Ẳ","Ẵ","Ǎ","Â","Ấ","Ậ","Ầ","Ẩ","Ẫ","Ä","Ǟ","Ȧ","Ǡ","Ạ","Ȁ","À","Ả","Ȃ","Ā","Ą","Å","Ǻ","Ḁ","Ⱥ","Ã","Ꜳ","Æ","Ǽ","Ǣ","Ꜵ","Ꜷ","Ꜹ","Ꜻ","Ꜽ","Ḃ","Ḅ","Ɓ","Ḇ","Ƀ","Ƃ","Ć","Č","Ç","Ḉ","Ĉ","Ċ","Ƈ","Ȼ","Ď","Ḑ","Ḓ","Ḋ","Ḍ","Ɗ","Ḏ","Dz","Dž","Đ","Ƌ","DZ","DŽ","É","Ĕ","Ě","Ȩ","Ḝ","Ê","Ế","Ệ","Ề","Ể","Ễ","Ḙ","Ë","Ė","Ẹ","Ȅ","È","Ẻ","Ȇ","Ē","Ḗ","Ḕ","Ę","Ɇ","Ẽ","Ḛ","Ꝫ","Ḟ","Ƒ","Ǵ","Ğ","Ǧ","Ģ","Ĝ","Ġ","Ɠ","Ḡ","Ǥ","Ḫ","Ȟ","Ḩ","Ĥ","Ⱨ","Ḧ","Ḣ","Ḥ","Ħ","Í","Ĭ","Ǐ","Î","Ï","Ḯ","İ","Ị","Ȉ","Ì","Ỉ","Ȋ","Ī","Į","Ɨ","Ĩ","Ḭ","Ꝺ","Ꝼ","Ᵹ","Ꞃ","Ꞅ","Ꞇ","Ꝭ","Ĵ","Ɉ","Ḱ","Ǩ","Ķ","Ⱪ","Ꝃ","Ḳ","Ƙ","Ḵ","Ꝁ","Ꝅ","Ĺ","Ƚ","Ľ","Ļ","Ḽ","Ḷ","Ḹ","Ⱡ","Ꝉ","Ḻ","Ŀ","Ɫ","Lj","Ł","LJ","Ḿ","Ṁ","Ṃ","Ɱ","Ń","Ň","Ņ","Ṋ","Ṅ","Ṇ","Ǹ","Ɲ","Ṉ","Ƞ","Nj","Ñ","NJ","Ó","Ŏ","Ǒ","Ô","Ố","Ộ","Ồ","Ổ","Ỗ","Ö","Ȫ","Ȯ","Ȱ","Ọ","Ő","Ȍ","Ò","Ỏ","Ơ","Ớ","Ợ","Ờ","Ở","Ỡ","Ȏ","Ꝋ","Ꝍ","Ō","Ṓ","Ṑ","Ɵ","Ǫ","Ǭ","Ø","Ǿ","Õ","Ṍ","Ṏ","Ȭ","Ƣ","Ꝏ","Ɛ","Ɔ","Ȣ","Ṕ","Ṗ","Ꝓ","Ƥ","Ꝕ","Ᵽ","Ꝑ","Ꝙ","Ꝗ","Ŕ","Ř","Ŗ","Ṙ","Ṛ","Ṝ","Ȑ","Ȓ","Ṟ","Ɍ","Ɽ","Ꜿ","Ǝ","Ś","Ṥ","Š","Ṧ","Ş","Ŝ","Ș","Ṡ","Ṣ","Ṩ","Ť","Ţ","Ṱ","Ț","Ⱦ","Ṫ","Ṭ","Ƭ","Ṯ","Ʈ","Ŧ","Ɐ","Ꞁ","Ɯ","Ʌ","Ꜩ","Ú","Ŭ","Ǔ","Û","Ṷ","Ü","Ǘ","Ǚ","Ǜ","Ǖ","Ṳ","Ụ","Ű","Ȕ","Ù","Ủ","Ư","Ứ","Ự","Ừ","Ử","Ữ","Ȗ","Ū","Ṻ","Ų","Ů","Ũ","Ṹ","Ṵ","Ꝟ","Ṿ","Ʋ","Ṽ","Ꝡ","Ẃ","Ŵ","Ẅ","Ẇ","Ẉ","Ẁ","Ⱳ","Ẍ","Ẋ","Ý","Ŷ","Ÿ","Ẏ","Ỵ","Ỳ","Ƴ","Ỷ","Ỿ","Ȳ","Ɏ","Ỹ","Ź","Ž","Ẑ","Ⱬ","Ż","Ẓ","Ȥ","Ẕ","Ƶ","IJ","Œ","ᴀ","ᴁ","ʙ","ᴃ","ᴄ","ᴅ","ᴇ","ꜰ","ɢ","ʛ","ʜ","ɪ","ʁ","ᴊ","ᴋ","ʟ","ᴌ","ᴍ","ɴ","ᴏ","ɶ","ᴐ","ᴕ","ᴘ","ʀ","ᴎ","ᴙ","ꜱ","ᴛ","ⱻ","ᴚ","ᴜ","ᴠ","ᴡ","ʏ","ᴢ","á","ă","ắ","ặ","ằ","ẳ","ẵ","ǎ","â","ấ","ậ","ầ","ẩ","ẫ","ä","ǟ","ȧ","ǡ","ạ","ȁ","à","ả","ȃ","ā","ą","ᶏ","ẚ","å","ǻ","ḁ","ⱥ","ã","ꜳ","æ","ǽ","ǣ","ꜵ","ꜷ","ꜹ","ꜻ","ꜽ","ḃ","ḅ","ɓ","ḇ","ᵬ","ᶀ","ƀ","ƃ","ɵ","ć","č","ç","ḉ","ĉ","ɕ","ċ","ƈ","ȼ","ď","ḑ","ḓ","ȡ","ḋ","ḍ","ɗ","ᶑ","ḏ","ᵭ","ᶁ","đ","ɖ","ƌ","ı","ȷ","ɟ","ʄ","dz","dž","é","ĕ","ě","ȩ","ḝ","ê","ế","ệ","ề","ể","ễ","ḙ","ë","ė","ẹ","ȅ","è","ẻ","ȇ","ē","ḗ","ḕ","ⱸ","ę","ᶒ","ɇ","ẽ","ḛ","ꝫ","ḟ","ƒ","ᵮ","ᶂ","ǵ","ğ","ǧ","ģ","ĝ","ġ","ɠ","ḡ","ᶃ","ǥ","ḫ","ȟ","ḩ","ĥ","ⱨ","ḧ","ḣ","ḥ","ɦ","ẖ","ħ","ƕ","í","ĭ","ǐ","î","ï","ḯ","ị","ȉ","ì","ỉ","ȋ","ī","į","ᶖ","ɨ","ĩ","ḭ","ꝺ","ꝼ","ᵹ","ꞃ","ꞅ","ꞇ","ꝭ","ǰ","ĵ","ʝ","ɉ","ḱ","ǩ","ķ","ⱪ","ꝃ","ḳ","ƙ","ḵ","ᶄ","ꝁ","ꝅ","ĺ","ƚ","ɬ","ľ","ļ","ḽ","ȴ","ḷ","ḹ","ⱡ","ꝉ","ḻ","ŀ","ɫ","ᶅ","ɭ","ł","lj","ſ","ẜ","ẛ","ẝ","ḿ","ṁ","ṃ","ɱ","ᵯ","ᶆ","ń","ň","ņ","ṋ","ȵ","ṅ","ṇ","ǹ","ɲ","ṉ","ƞ","ᵰ","ᶇ","ɳ","ñ","nj","ó","ŏ","ǒ","ô","ố","ộ","ồ","ổ","ỗ","ö","ȫ","ȯ","ȱ","ọ","ő","ȍ","ò","ỏ","ơ","ớ","ợ","ờ","ở","ỡ","ȏ","ꝋ","ꝍ","ⱺ","ō","ṓ","ṑ","ǫ","ǭ","ø","ǿ","õ","ṍ","ṏ","ȭ","ƣ","ꝏ","ɛ","ᶓ","ɔ","ᶗ","ȣ","ṕ","ṗ","ꝓ","ƥ","ᵱ","ᶈ","ꝕ","ᵽ","ꝑ","ꝙ","ʠ","ɋ","ꝗ","ŕ","ř","ŗ","ṙ","ṛ","ṝ","ȑ","ɾ","ᵳ","ȓ","ṟ","ɼ","ᵲ","ᶉ","ɍ","ɽ","ↄ","ꜿ","ɘ","ɿ","ś","ṥ","š","ṧ","ş","ŝ","ș","ṡ","ṣ","ṩ","ʂ","ᵴ","ᶊ","ȿ","ɡ","ᴑ","ᴓ","ᴝ","ť","ţ","ṱ","ț","ȶ","ẗ","ⱦ","ṫ","ṭ","ƭ","ṯ","ᵵ","ƫ","ʈ","ŧ","ᵺ","ɐ","ᴂ","ǝ","ᵷ","ɥ","ʮ","ʯ","ᴉ","ʞ","ꞁ","ɯ","ɰ","ᴔ","ɹ","ɻ","ɺ","ⱹ","ʇ","ʌ","ʍ","ʎ","ꜩ","ú","ŭ","ǔ","û","ṷ","ü","ǘ","ǚ","ǜ","ǖ","ṳ","ụ","ű","ȕ","ù","ủ","ư","ứ","ự","ừ","ử","ữ","ȗ","ū","ṻ","ų","ᶙ","ů","ũ","ṹ","ṵ","ᵫ","ꝸ","ⱴ","ꝟ","ṿ","ʋ","ᶌ","ⱱ","ṽ","ꝡ","ẃ","ŵ","ẅ","ẇ","ẉ","ẁ","ⱳ","ẘ","ẍ","ẋ","ᶍ","ý","ŷ","ÿ","ẏ","ỵ","ỳ","ƴ","ỷ","ỿ","ȳ","ẙ","ɏ","ỹ","ź","ž","ẑ","ʑ","ⱬ","ż","ẓ","ȥ","ẕ","ᵶ","ᶎ","ʐ","ƶ","ɀ","ff","ffi","ffl","fi","fl","ij","œ","st","ₐ","ₑ","ᵢ","ⱼ","ₒ","ᵣ","ᵤ","ᵥ","ₓ"];

for(var i = 0; i < string.length; i++){
if(jQuery.inArray(string[i], map) === -1) {
result += string[i]
} else {
result += "\\\\u" + ("000" + string[i].charCodeAt(0).toString(16)).substr(-4);
}
}

return result;
}

function CMB2ConditionalToggleRows(obj, showOrHide){
var $elements = (obj instanceof jQuery) ? obj : $(obj);

return $elements.each(function(i, e) {
var $e = $(e);

$e.prop('required', showOrHide && $e.data('conditional-required'));

$e.parents('.cmb-row:first').toggle(showOrHide);

// For textarea code (CodeMirror) we need to do a refresh when we show it.
if ( true === showOrHide ) {
CMB2ConditionalMaybeInitializeCodeEditor( $e );
}
});
}

function CMB2ConditionalMaybeInitializeCodeEditor( $element ) {
if ( ! window.CMB2.codeEditorArgs || ! wp || ! wp.codeEditor || ! $element.length ) {
return;
}

if ( ! $element.hasClass( 'cmb2-textarea-code' ) || $element.hasClass('disable-codemirror') ) {
return;
}

$element.siblings('.CodeMirror').each(function(i, el){
el.CodeMirror.refresh();
});
}

CMB2ConditionalsInit('.option-pixproof_settings');
});
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions assets/js/settings-page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function ($) {
"use strict";
$(function () {

});

}(jQuery));
File renamed without changes.
5 changes: 5 additions & 0 deletions assets/scss/admin.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* This stylesheet is used to add styles to the settings page of the plugin. */

#pixproof_setup_page .cmb2-wrap .cmb-type-title.cmb2-id-pixproof-galleries-title {
margin-top: 0;
}
27 changes: 27 additions & 0 deletions assets/scss/edit-post.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Overwrite some CMB2 styling

.postbox.cmb2-postbox .cmb2-wrap > .cmb-field-list > .cmb-row {
padding: 1em 0;

&.cmb-type-title {
padding: 0.6em 1em;
background-color: #fafafa;
margin: 0 -12px;
border-top: 1px solid #e9e9e9;
}

&.cmb2-id--pixproof-main-gallery {
margin: 0;
border-bottom: none;
}

.cmb2-metabox-description {
display: block;
color: #757575;
font-style: italic;
margin: 0;
padding-top: .5em;
font-size: 13px;
line-height: 1.5;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion callbacks/output.php

This file was deleted.

29 changes: 0 additions & 29 deletions callbacks/save_settings.php

This file was deleted.

Loading

0 comments on commit 016c01c

Please sign in to comment.