├── .gitmodules
├── css
├── pte-media.css
└── pte.css
├── js
├── jquery.coffee
├── settings.coffee
├── main.js
├── snippets
│ ├── pte-fix-thickbox.js
│ ├── editor.coffee
│ └── pte_enable_media.js
├── apps
│ ├── pteApp.coffee
│ └── urlCacheBreaker.coffee
├── csmain.coffee
├── controllers
│ ├── ViewCtrl.coffee
│ ├── TableCtrl.coffee
│ ├── CropCtrl.coffee
│ └── PteCtrl.coffee
└── jcrop-api.coffee
├── screenshot-1.jpg
├── screenshot-2.jpg
├── screenshot-3.jpg
├── screenshot-4.jpg
├── screenshot-5.jpg
├── assets
├── icon-128.png
├── icon-256.png
├── banner-772x250.jpg
└── icon.svg
├── js-build
└── main.js.gz
├── .gitignore
├── apps
├── jcrop
│ ├── css
│ │ ├── Jcrop.gif
│ │ ├── jquery.Jcrop.min.css
│ │ └── jquery.Jcrop.css
│ ├── MIT-LICENSE.txt
│ ├── README.md
│ └── index.html
├── font-awesome
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.ttf
│ │ └── fontawesome-webfont.woff
│ ├── less
│ │ ├── fixed-width.less
│ │ ├── core.less
│ │ ├── bordered-pulled.less
│ │ ├── rotated-flipped.less
│ │ ├── larger.less
│ │ ├── list.less
│ │ ├── font-awesome.less
│ │ ├── stacked.less
│ │ ├── path.less
│ │ ├── mixins.less
│ │ ├── spinning.less
│ │ └── variables.less
│ ├── scss
│ │ ├── _fixed-width.scss
│ │ ├── _core.scss
│ │ ├── _bordered-pulled.scss
│ │ ├── _larger.scss
│ │ ├── _rotated-flipped.scss
│ │ ├── _list.scss
│ │ ├── font-awesome.scss
│ │ ├── _stacked.scss
│ │ ├── _path.scss
│ │ ├── _mixins.scss
│ │ ├── _spinning.scss
│ │ └── _variables.scss
│ └── .gitignore
├── angular
│ └── angular-resource.min.js
└── requirejs
│ ├── domReady.js
│ ├── cs.js
│ └── i18n.js
├── i18n
├── post-thumbnail-editor-de_DE.mo
├── post-thumbnail-editor-es_ES.mo
├── post-thumbnail-editor-fr_FR.mo
├── post-thumbnail-editor-it_IT.mo
├── post-thumbnail-editor-pl_PL.mo
├── post-thumbnail-editor-pt_BR.mo
├── post-thumbnail-editor-es_ES.po
├── post-thumbnail-editor-de_DE.po
├── post-thumbnail-editor.pot
├── post-thumbnail-editor-pl_PL.po
└── post-thumbnail-editor-it_IT.po
├── Makefile
├── checklist.md
├── php
├── overwrite_imgedit_preview.php
├── class-pte-image-editor-imagick.php
├── class-pte-image-editor-gd.php
├── log.php
├── options.php
└── chromephp
│ └── ChromePhp.php
└── README.txt
/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/css/pte-media.css:
--------------------------------------------------------------------------------
1 | a.pte {
2 | text-decoration: none;
3 | }
4 |
--------------------------------------------------------------------------------
/js/jquery.coffee:
--------------------------------------------------------------------------------
1 | define [], ->
2 | return if jQuery then jQuery.noConflict() else {}
3 |
--------------------------------------------------------------------------------
/screenshot-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/screenshot-1.jpg
--------------------------------------------------------------------------------
/screenshot-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/screenshot-2.jpg
--------------------------------------------------------------------------------
/screenshot-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/screenshot-3.jpg
--------------------------------------------------------------------------------
/screenshot-4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/screenshot-4.jpg
--------------------------------------------------------------------------------
/screenshot-5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/screenshot-5.jpg
--------------------------------------------------------------------------------
/assets/icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/assets/icon-128.png
--------------------------------------------------------------------------------
/assets/icon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/assets/icon-256.png
--------------------------------------------------------------------------------
/js-build/main.js.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/js-build/main.js.gz
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .css
2 | .sass-cache/
3 | .buildpath
4 | .project
5 | .settings/
6 | local.mk
7 | .pot
8 | *.svgz
9 |
--------------------------------------------------------------------------------
/apps/jcrop/css/Jcrop.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/apps/jcrop/css/Jcrop.gif
--------------------------------------------------------------------------------
/assets/banner-772x250.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/assets/banner-772x250.jpg
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-de_DE.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-de_DE.mo
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-es_ES.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-es_ES.mo
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-fr_FR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-fr_FR.mo
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-it_IT.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-it_IT.mo
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-pl_PL.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-pl_PL.mo
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-pt_BR.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/i18n/post-thumbnail-editor-pt_BR.mo
--------------------------------------------------------------------------------
/apps/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/apps/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/apps/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/apps/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/apps/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/apps/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/apps/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sewpafly/post-thumbnail-editor/HEAD/apps/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/apps/font-awesome/less/fixed-width.less:
--------------------------------------------------------------------------------
1 | // Fixed Width Icons
2 | // -------------------------
3 | .@{fa-css-prefix}-fw {
4 | width: (18em / 14);
5 | text-align: center;
6 | }
7 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_fixed-width.scss:
--------------------------------------------------------------------------------
1 | // Fixed Width Icons
2 | // -------------------------
3 | .#{$fa-css-prefix}-fw {
4 | width: (18em / 14);
5 | text-align: center;
6 | }
7 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/core.less:
--------------------------------------------------------------------------------
1 | // Base Class Definition
2 | // -------------------------
3 |
4 | .@{fa-css-prefix} {
5 | display: inline-block;
6 | font-family: FontAwesome;
7 | font-style: normal;
8 | font-weight: normal;
9 | line-height: 1;
10 | -webkit-font-smoothing: antialiased;
11 | -moz-osx-font-smoothing: grayscale;
12 | }
13 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_core.scss:
--------------------------------------------------------------------------------
1 | // Base Class Definition
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix} {
5 | display: inline-block;
6 | font-family: FontAwesome;
7 | font-style: normal;
8 | font-weight: normal;
9 | line-height: 1;
10 | -webkit-font-smoothing: antialiased;
11 | -moz-osx-font-smoothing: grayscale;
12 | }
13 |
--------------------------------------------------------------------------------
/apps/font-awesome/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | *.egg-info
3 | *.db
4 | *.db.old
5 | *.swp
6 | *.db-journal
7 |
8 | .coverage
9 | .DS_Store
10 | .installed.cfg
11 |
12 | .idea/*
13 | .svn/*
14 | src/website/static/*
15 | src/website/media/*
16 |
17 | bin
18 | build
19 | cfcache
20 | develop-eggs
21 | dist
22 | downloads
23 | eggs
24 | parts
25 | tmp
26 | .sass-cache
27 |
28 | src/website/settingslocal.py
29 | stunnel.log
--------------------------------------------------------------------------------
/apps/font-awesome/less/bordered-pulled.less:
--------------------------------------------------------------------------------
1 | // Bordered & Pulled
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-border {
5 | padding: .2em .25em .15em;
6 | border: solid .08em @fa-border-color;
7 | border-radius: .1em;
8 | }
9 |
10 | .pull-right { float: right; }
11 | .pull-left { float: left; }
12 |
13 | .@{fa-css-prefix} {
14 | &.pull-left { margin-right: .3em; }
15 | &.pull-right { margin-left: .3em; }
16 | }
17 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/rotated-flipped.less:
--------------------------------------------------------------------------------
1 | // Rotated & Flipped Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); }
5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); }
6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); }
7 |
8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); }
9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); }
10 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_bordered-pulled.scss:
--------------------------------------------------------------------------------
1 | // Bordered & Pulled
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-border {
5 | padding: .2em .25em .15em;
6 | border: solid .08em $fa-border-color;
7 | border-radius: .1em;
8 | }
9 |
10 | .pull-right { float: right; }
11 | .pull-left { float: left; }
12 |
13 | .#{$fa-css-prefix} {
14 | &.pull-left { margin-right: .3em; }
15 | &.pull-right { margin-left: .3em; }
16 | }
17 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/larger.less:
--------------------------------------------------------------------------------
1 | // Icon Sizes
2 | // -------------------------
3 |
4 | /* makes the font 33% larger relative to the icon container */
5 | .@{fa-css-prefix}-lg {
6 | font-size: (4em / 3);
7 | line-height: (3em / 4);
8 | vertical-align: -15%;
9 | }
10 | .@{fa-css-prefix}-2x { font-size: 2em; }
11 | .@{fa-css-prefix}-3x { font-size: 3em; }
12 | .@{fa-css-prefix}-4x { font-size: 4em; }
13 | .@{fa-css-prefix}-5x { font-size: 5em; }
14 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_larger.scss:
--------------------------------------------------------------------------------
1 | // Icon Sizes
2 | // -------------------------
3 |
4 | /* makes the font 33% larger relative to the icon container */
5 | .#{$fa-css-prefix}-lg {
6 | font-size: (4em / 3);
7 | line-height: (3em / 4);
8 | vertical-align: -15%;
9 | }
10 | .#{$fa-css-prefix}-2x { font-size: 2em; }
11 | .#{$fa-css-prefix}-3x { font-size: 3em; }
12 | .#{$fa-css-prefix}-4x { font-size: 4em; }
13 | .#{$fa-css-prefix}-5x { font-size: 5em; }
14 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/list.less:
--------------------------------------------------------------------------------
1 | // List Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-ul {
5 | padding-left: 0;
6 | margin-left: @fa-li-width;
7 | list-style-type: none;
8 | > li { position: relative; }
9 | }
10 | .@{fa-css-prefix}-li {
11 | position: absolute;
12 | left: -@fa-li-width;
13 | width: @fa-li-width;
14 | top: (2em / 14);
15 | text-align: center;
16 | &.@{fa-css-prefix}-lg {
17 | left: -@fa-li-width + (4em / 14);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_rotated-flipped.scss:
--------------------------------------------------------------------------------
1 | // Rotated & Flipped Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); }
5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); }
6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); }
7 |
8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); }
9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); }
10 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_list.scss:
--------------------------------------------------------------------------------
1 | // List Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-ul {
5 | padding-left: 0;
6 | margin-left: $fa-li-width;
7 | list-style-type: none;
8 | > li { position: relative; }
9 | }
10 | .#{$fa-css-prefix}-li {
11 | position: absolute;
12 | left: -$fa-li-width;
13 | width: $fa-li-width;
14 | top: (2em / 14);
15 | text-align: center;
16 | &.#{$fa-css-prefix}-lg {
17 | left: -$fa-li-width + (4em / 14);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/font-awesome.less:
--------------------------------------------------------------------------------
1 | /*!
2 | * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 | */
5 |
6 | @import "variables";
7 | @import "mixins";
8 | @import "path";
9 | @import "core";
10 | @import "larger";
11 | @import "fixed-width";
12 | @import "list";
13 | @import "bordered-pulled";
14 | @import "spinning";
15 | @import "rotated-flipped";
16 | @import "stacked";
17 | @import "icons";
18 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/font-awesome.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome
3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
4 | */
5 |
6 | @import "variables";
7 | @import "mixins";
8 | @import "path";
9 | @import "core";
10 | @import "larger";
11 | @import "fixed-width";
12 | @import "list";
13 | @import "bordered-pulled";
14 | @import "spinning";
15 | @import "rotated-flipped";
16 | @import "stacked";
17 | @import "icons";
18 |
--------------------------------------------------------------------------------
/js/settings.coffee:
--------------------------------------------------------------------------------
1 | define [], ->
2 | getWindowVar = (key) ->
3 | if !window[key]
4 | throw "PTE_EXCEPTION: Invalid window var: " + key
5 | window[key]
6 | settings =
7 | width: getWindowVar 'post_width'
8 | height: getWindowVar 'post_height'
9 | id: getWindowVar 'post_id'
10 | ajaxurl: getWindowVar 'ajaxurl'
11 | i18n: getWindowVar 'pteI18n'
12 | nonce: getWindowVar 'pte_nonce'
13 | options_nonce: getWindowVar 'pte_options_nonce'
14 |
15 |
--------------------------------------------------------------------------------
/js/main.js:
--------------------------------------------------------------------------------
1 | require({
2 | paths: {
3 | 'angular': '../apps/angular/angular.min',
4 | 'angular-resource': '../apps/angular/angular-resource.min',
5 | 'cs': '../apps/requirejs/cs',
6 | 'coffee-script': '../apps/coffee-script',
7 | 'jcrop': '../apps/jcrop/js/jquery.Jcrop.min',
8 | },
9 | shim: {
10 | 'angular': {
11 | exports: 'angular'
12 | },
13 | 'angular-resource': {
14 | exports: 'angular',
15 | deps: ['angular']
16 | },
17 | 'jcrop':['cs!jquery']
18 | }
19 | }, ['cs!csmain']);
20 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/stacked.less:
--------------------------------------------------------------------------------
1 | // Stacked Icons
2 | // -------------------------
3 |
4 | .@{fa-css-prefix}-stack {
5 | position: relative;
6 | display: inline-block;
7 | width: 2em;
8 | height: 2em;
9 | line-height: 2em;
10 | vertical-align: middle;
11 | }
12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x {
13 | position: absolute;
14 | left: 0;
15 | width: 100%;
16 | text-align: center;
17 | }
18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; }
19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; }
20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; }
21 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_stacked.scss:
--------------------------------------------------------------------------------
1 | // Stacked Icons
2 | // -------------------------
3 |
4 | .#{$fa-css-prefix}-stack {
5 | position: relative;
6 | display: inline-block;
7 | width: 2em;
8 | height: 2em;
9 | line-height: 2em;
10 | vertical-align: middle;
11 | }
12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x {
13 | position: absolute;
14 | left: 0;
15 | width: 100%;
16 | text-align: center;
17 | }
18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; }
19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; }
20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; }
21 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/path.less:
--------------------------------------------------------------------------------
1 | /* FONT PATH
2 | * -------------------------- */
3 |
4 | @font-face {
5 | font-family: 'FontAwesome';
6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}');
7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'),
8 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'),
9 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'),
10 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg');
11 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts
12 | font-weight: normal;
13 | font-style: normal;
14 | }
15 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_path.scss:
--------------------------------------------------------------------------------
1 | /* FONT PATH
2 | * -------------------------- */
3 |
4 | @font-face {
5 | font-family: 'FontAwesome';
6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}');
7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'),
8 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'),
9 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'),
10 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg');
11 | //src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts
12 | font-weight: normal;
13 | font-style: normal;
14 | }
15 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/mixins.less:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | .fa-icon-rotate(@degrees, @rotation) {
5 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation);
6 | -webkit-transform: rotate(@degrees);
7 | -moz-transform: rotate(@degrees);
8 | -ms-transform: rotate(@degrees);
9 | -o-transform: rotate(@degrees);
10 | transform: rotate(@degrees);
11 | }
12 |
13 | .fa-icon-flip(@horiz, @vert, @rotation) {
14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1);
15 | -webkit-transform: scale(@horiz, @vert);
16 | -moz-transform: scale(@horiz, @vert);
17 | -ms-transform: scale(@horiz, @vert);
18 | -o-transform: scale(@horiz, @vert);
19 | transform: scale(@horiz, @vert);
20 | }
21 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_mixins.scss:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | @mixin fa-icon-rotate($degrees, $rotation) {
5 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=$rotation);
6 | -webkit-transform: rotate($degrees);
7 | -moz-transform: rotate($degrees);
8 | -ms-transform: rotate($degrees);
9 | -o-transform: rotate($degrees);
10 | transform: rotate($degrees);
11 | }
12 |
13 | @mixin fa-icon-flip($horiz, $vert, $rotation) {
14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=$rotation);
15 | -webkit-transform: scale($horiz, $vert);
16 | -moz-transform: scale($horiz, $vert);
17 | -ms-transform: scale($horiz, $vert);
18 | -o-transform: scale($horiz, $vert);
19 | transform: scale($horiz, $vert);
20 | }
21 |
--------------------------------------------------------------------------------
/js/snippets/pte-fix-thickbox.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | old_tb_position = tb_position;
3 | tb_position = function() {
4 | var tbWindow = $('#TB_window'), tbIframe = tbWindow.find('iframe');
5 | if ( tbIframe.size() > 0 && tbIframe.get(0).src.match(/pte_ajax/) ) {
6 | var W = $(window).width() - 100,
7 | H = $(window).height() - 50,
8 | adminbar_height = 0;
9 |
10 | if ( $('body.admin-bar').length )
11 | adminbar_height = 28;
12 |
13 | // Set the default size
14 | $('#TB_iframeContent').width(W).height(H - 75 - adminbar_height);
15 |
16 | tbWindow.css({'margin-left': '-' + parseInt((( W ) / 2),10) + 'px'});
17 | if ( typeof document.body.style.maxWidth != 'undefined' )
18 | tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
19 | }
20 | else {
21 | old_tb_position();
22 | }
23 | }
24 | })(jQuery);
25 |
--------------------------------------------------------------------------------
/apps/font-awesome/less/spinning.less:
--------------------------------------------------------------------------------
1 | // Spinning Icons
2 | // --------------------------
3 |
4 | .@{fa-css-prefix}-spin {
5 | -webkit-animation: spin 2s infinite linear;
6 | -moz-animation: spin 2s infinite linear;
7 | -o-animation: spin 2s infinite linear;
8 | animation: spin 2s infinite linear;
9 | }
10 |
11 | @-moz-keyframes spin {
12 | 0% { -moz-transform: rotate(0deg); }
13 | 100% { -moz-transform: rotate(359deg); }
14 | }
15 | @-webkit-keyframes spin {
16 | 0% { -webkit-transform: rotate(0deg); }
17 | 100% { -webkit-transform: rotate(359deg); }
18 | }
19 | @-o-keyframes spin {
20 | 0% { -o-transform: rotate(0deg); }
21 | 100% { -o-transform: rotate(359deg); }
22 | }
23 | @-ms-keyframes spin {
24 | 0% { -ms-transform: rotate(0deg); }
25 | 100% { -ms-transform: rotate(359deg); }
26 | }
27 | @keyframes spin {
28 | 0% { transform: rotate(0deg); }
29 | 100% { transform: rotate(359deg); }
30 | }
31 |
--------------------------------------------------------------------------------
/apps/font-awesome/scss/_spinning.scss:
--------------------------------------------------------------------------------
1 | // Spinning Icons
2 | // --------------------------
3 |
4 | .#{$fa-css-prefix}-spin {
5 | -webkit-animation: spin 2s infinite linear;
6 | -moz-animation: spin 2s infinite linear;
7 | -o-animation: spin 2s infinite linear;
8 | animation: spin 2s infinite linear;
9 | }
10 |
11 | @-moz-keyframes spin {
12 | 0% { -moz-transform: rotate(0deg); }
13 | 100% { -moz-transform: rotate(359deg); }
14 | }
15 | @-webkit-keyframes spin {
16 | 0% { -webkit-transform: rotate(0deg); }
17 | 100% { -webkit-transform: rotate(359deg); }
18 | }
19 | @-o-keyframes spin {
20 | 0% { -o-transform: rotate(0deg); }
21 | 100% { -o-transform: rotate(359deg); }
22 | }
23 | @-ms-keyframes spin {
24 | 0% { -ms-transform: rotate(0deg); }
25 | 100% { -ms-transform: rotate(359deg); }
26 | }
27 | @keyframes spin {
28 | 0% { transform: rotate(0deg); }
29 | 100% { transform: rotate(359deg); }
30 | }
31 |
--------------------------------------------------------------------------------
/js/apps/pteApp.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'angular'
3 | 'angular-resource'
4 | 'cs!apps/urlCacheBreaker'
5 | ], (angular) ->
6 | app = angular.module 'pte', ['ngResource', 'UrlCacheBreaker']
7 | #app.config ($locationProvider) ->
8 | # $locationProvider.html5Mode true
9 | # return
10 |
11 |
12 |
13 | # Taken from angular-ui.github.com
14 | #app.directive 'uiEvent', ['$parse', ($parse) ->
15 | # (scope, elm, attrs) ->
16 | # events = scope.$eval attrs.uiEvent
17 | # angular.forEach events, (uiEvent, eventName) ->
18 | # fn = $parse uiEvent
19 | # elm.bind eventName, (evt) ->
20 | # params = Array.prototype.slice.call arguments
21 | # # Take out first paramater (event object);
22 | # params = params.splice 1
23 | # scope.$apply ->
24 | # fn scope, {$event: evt, $params: params}
25 | # return
26 | # return
27 | # return
28 | # return
29 | #]
30 | return app
31 |
--------------------------------------------------------------------------------
/js/apps/urlCacheBreaker.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'angular'
3 | ], (angular) ->
4 | app = angular.module 'UrlCacheBreaker', []
5 | app.filter 'randomizeUrl', ->
6 | random = ->
7 | Math.floor(Math.random()*1000001).toString(16)
8 |
9 | urlMap = {}
10 |
11 | (url) ->
12 | if not url? then return url
13 |
14 | # Check for a reset object
15 | # {reset: true} will reset all urls
16 | # {reset: true, urls: ['url','url']} will set to a new random number
17 | if (angular.isObject url) and url.reset
18 | if url.urls?.length > 0
19 | for reset_url in url.urls
20 | urlMap[reset_url] = random()
21 | else
22 | urlMap = {}
23 | return
24 |
25 | if url not of urlMap
26 | urlMap[url] = random()
27 |
28 | randomness = urlMap[url]
29 |
30 | separator = '?'
31 | if url?.indexOf('?') >= 0
32 | separator = '&'
33 |
34 | return url + separator + randomness
35 |
36 | return app
37 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: js
2 | JS_OUTPUT = js-build
3 |
4 | # local.mk is not tracked in git project
5 | # USED FOR i18n functions
6 | # I18N_ENV = $(wildcard /home/.../wordpress-i18n/makepot.php)
7 | # I18N = $(if $(I18N_ENV),$(I18N_ENV),$(shell cygpath -u -a ~/build/wordpress_i18n/makepot.php))
8 | include $(wildcard local.mk)
9 |
10 | # A simple make will compile the js/css and minify them
11 | all: gzip-js trans
12 |
13 | # Build javascript
14 | js:
15 | @echo "Building javascript"
16 | r.js -o build.js
17 | chmod -R 777 $(JS_OUTPUT)
18 |
19 | $(JS_OUTPUT): js
20 | gzip-js: $(JS_OUTPUT)
21 | gzip - > $(JS_OUTPUT)/main.js.gz < $(JS_OUTPUT)/main.js
22 |
23 | # i18n - Defined in local.mk to point to wordpress makepot.php script
24 | trans:
25 | @echo "Creating Internationalization Template"
26 | ifdef I18N
27 | cd i18n; \
28 | php '$(I18N)' wp-plugin ../
29 | endif
30 | # To translate the .po to .mo files
31 | # for file in `find . -name "*.po"` ; do msgfmt -o ${file/.po/.mo} $file ; done
32 | # msgfmt -o filename.mo filename.po
33 |
34 | # Clean
35 | clean:
36 | @echo "Cleaning up"
37 | rm -rf $(JS_OUTPUT)
38 |
39 | # vi: ts=3
40 |
--------------------------------------------------------------------------------
/apps/jcrop/MIT-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Tapmodo Interactive LLC,
2 | http://github.com/tapmodo/Jcrop
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the
6 | "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish,
8 | distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/js/csmain.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'require'
3 | 'cs!jquery'
4 | 'angular'
5 | ], (require, $, angular) ->
6 | # COFFEESCRIPT VERSION OF UNDERSCORE ONCE:
7 | once = (func) ->
8 | ran = false
9 | memo = null
10 | return ->
11 | if ran
12 | return memo
13 | ran = true
14 | memo = func.apply this, arguments
15 | func = null
16 | return memo
17 |
18 | startupFunction = once ->
19 | require [
20 | 'cs!apps/pteApp'
21 | 'cs!controllers/PteCtrl'
22 | 'cs!controllers/TableCtrl'
23 | 'cs!controllers/CropCtrl'
24 | 'cs!controllers/ViewCtrl'
25 | ], (pteApp) ->
26 | angular.bootstrap $(".wrap"), [pteApp.name]
27 | return
28 | return
29 |
30 |
31 | # If the page is already loaded then just run the startup
32 | # otherwise, set the load callback
33 | #
34 | #console.log document.readyState
35 | if document.readyState is 'complete' or document.readyState is 'loaded'
36 | startupFunction()
37 | else
38 | $(window).load ->
39 | startupFunction()
40 |
41 | # Provide failsafe
42 | timeout = 10000
43 | window.setTimeout ->
44 | startupFunction()
45 | , timeout
46 |
47 | return
48 |
--------------------------------------------------------------------------------
/js/controllers/ViewCtrl.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'cs!apps/pteApp'
3 | ], (app) ->
4 | app.controller "ViewCtrl", ['$scope', ($scope) ->
5 | #$scope.orderBy = 'width'
6 | $scope.orderBy = (thumbnail) ->
7 | current = thumbnail.current?.width * thumbnail.current?.height
8 | if current? and current > 0
9 | return current
10 | thumbnail.width * thumbnail.height
11 |
12 | ###
13 | # Click on the picture to select it for cropping and then, change to
14 | # crop panel
15 | ###
16 | $scope.selectThumb = (thumbnail) ->
17 | thumbnail.selected = true
18 | $scope.changePage 'crop'
19 | $scope.updateSelected()
20 | return
21 |
22 | ###
23 | Add a class to all the thumbnails
24 | 'modified': adds green background
25 | 'original': adds a transition from green to normal (CSS3)
26 | ###
27 | $scope.thumbnailClass = (thumbnail) ->
28 | classes = []
29 | if thumbnail.proposed?
30 | classes.push 'modified'
31 | else
32 | classes.push 'original'
33 |
34 | if thumbnail.selected
35 | classes.push 'selected'
36 | return classes
37 |
38 | #if 'showProposed' of thumbnail
39 | # # hack... Using CSS3 for the animations causes an issue
40 | # # when anything set to 'original' gets recreated.
41 | # window.setTimeout ->
42 | # delete thumbnail.showProposed
43 | # , 1100
44 | # return 'original'
45 | #return ''
46 |
47 | return
48 | ]
49 | return app
50 |
--------------------------------------------------------------------------------
/checklist.md:
--------------------------------------------------------------------------------
1 | # Checklist
2 |
3 | 1. ~~Update jquery-tmpl and any other apps~~
4 | * `cd apps/jquery-tmpl`
5 | * `git fetch upstream`
6 | * `git merge upstream/master`
7 | * `git push origin master`
8 | 1. Update the php/override functions to have the latest wordpress code...
9 | 2. Run build script: `make`
10 | * compiles & minifies css/js
11 | * concatenates into one file
12 | * builds the .pot translation file
13 | 3. Update post-thumbnail-editor.php
14 | * Change the version information in 2 places
15 | 4. Modify README.txt
16 | * Update the requires/tested version information
17 | * Update the Upgrade Notice
18 | * Update the Changelog
19 | * Update screenshots (max-width: 532px)
20 | * [Test README](http://wordpress.org/extend/plugins/about/validator/)
21 | 5. Fix any translation changes
22 | * gvim -d new-pot-file old-po-file
23 | * Rebuild .mo from .po files (msgfmt po-file -o mo-file)
24 | find * -iname '*.po' | \
25 | while read file; do \
26 | echo "$file --> ${file%.po}"; msgfmt $file -o ${file%.po}.mo; \
27 | done
28 | 6. Test on Firefox, Chrome, Safari, IE7/8/9 & Linux/Windows/Mac
29 | * Do the rows change color on selection?
30 | * Test changing from debug to normal
31 | * How does post-thumbnails work with spaces in the name?
32 | 7. Tag the git release
33 | * `git commit -a -m "Commit msg"`
34 | * `git tag [-a -m 'annotated tag'] version`
35 | * `git push --tags`
36 | 8. Push to wordpress
37 | * `gitk` Use diff utility to see changes from last version
38 | * Manually update the svn tree
39 | * Tag release: `svn cp trunk tag/-version-`
40 | * Check in all changes: `svn ci -m "message"`
41 |
42 |
--------------------------------------------------------------------------------
/php/overwrite_imgedit_preview.php:
--------------------------------------------------------------------------------
1 | get_size();
41 | $w = $size['width'];
42 | $h = $size['height'];
43 |
44 | $ratio = pte_image_get_preview_ratio( $w, $h );
45 | $w2 = $w * $ratio;
46 | $h2 = $h * $ratio;
47 |
48 | if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
49 | return false;
50 |
51 | return wp_stream_image( $img, $post->post_mime_type, $post_id );
52 | }
53 |
54 | /**
55 | * From wp-admin/includes/image-edit.php
56 | */
57 | function pte_image_get_preview_ratio($w, $h) {
58 | $options = pte_get_options();
59 | $img_max_size = $options['pte_imgedit_max_size'];
60 | $max = max($w, $h);
61 | return $max > $img_max_size ? ($img_max_size / $max) : 1;
62 | }
63 |
--------------------------------------------------------------------------------
/js/controllers/TableCtrl.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'angular'
3 | 'cs!apps/pteApp'
4 | ], (angular, app) ->
5 | app.controller "TableCtrl", ['$scope', ($scope) ->
6 | ###
7 | # Toggles the selected value from true to false on a row click
8 | #
9 | # Ignore the case where the checkbox itself is clicked, This might
10 | # need to be updated to be useful with the save/cancel icons also
11 | # found in the table row.
12 | #
13 | # @param thumbnail The thumbnail to change
14 | ###
15 | $scope.toggleSelected = (thumbnail) ->
16 | thumbnail.selected = !thumbnail.selected
17 | # This is for telling other Controllers that the selection changed
18 | $scope.updateSelected()
19 | return
20 |
21 |
22 | ###
23 | # Used by the view to set all the rows to the same value
24 | ###
25 | $scope.toggleAll = ->
26 | for name, thumbnail of $scope.thumbnails
27 | thumbnail.selected = $scope.tableSelector
28 | $scope.updateSelected()
29 | return
30 |
31 | ###
32 | # Toggle the thumbnails based on their aspectRatio
33 | #
34 | # If there are multiple thumbnails, use the value of the first thumbnail.selected
35 | # to determine the rest.
36 | ###
37 | $scope.selectAspectRatio = (ar) ->
38 | event?.stopPropagation?()
39 | selectVal = null
40 | angular.forEach $scope.thumbnails, (thumb) ->
41 | if thumb.name in ar.thumbnails
42 | if not selectVal?
43 | selectVal = if thumb.selected? and thumb.selected then false else true
44 | thumb.selected = selectVal
45 | return
46 | $scope.updateSelected()
47 | return
48 |
49 | return
50 | ]
51 | return app
52 |
--------------------------------------------------------------------------------
/apps/jcrop/css/jquery.Jcrop.min.css:
--------------------------------------------------------------------------------
1 | /* jquery.Jcrop.min.css v0.9.12 (build:20130126) */
2 | .jcrop-holder{direction:ltr;text-align:left;}
3 | .jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;}
4 | .jcrop-vline{height:100%;width:1px!important;}
5 | .jcrop-vline.right{right:0;}
6 | .jcrop-hline{height:1px!important;width:100%;}
7 | .jcrop-hline.bottom{bottom:0;}
8 | .jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
9 | .jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;}
10 | .jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
11 | .jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
12 | .jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
13 | .jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
14 | .jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
15 | .jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
16 | .jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
17 | .jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
18 | .jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
19 | .jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
20 | .jcrop-dragbar.ord-n{margin-top:-4px;}
21 | .jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
22 | .jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
23 | .jcrop-dragbar.ord-w{margin-left:-4px;}
24 | .jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;}
25 | .jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;}
26 | .jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;}
27 | .jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;}
28 | .solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;}
29 | .jcrop-holder img,img.jcrop-preview{max-width:none;}
30 |
--------------------------------------------------------------------------------
/js/snippets/editor.coffee:
--------------------------------------------------------------------------------
1 | do (jQuery) ->
2 | timeout = 300
3 | image_id = null
4 | pte_url = (override_id) ->
5 | id = override_id || image_id || jQuery("#attachment-id").val()
6 | _.template pteL10n.url, {'id': id}
7 | $getLink = (id) ->
8 | jQuery """#{ pteL10n.PTE }"""
9 |
10 |
11 |
12 | checkExistingThickbox = (e) ->
13 | if window.parent.frames.length > 0
14 | # Bind the current context (a href=...) so that thickbox
15 | # can act independent of me...
16 | do =>
17 | #window.parent.setTimeout tb_click, 0
18 | window.parent.tb_click()
19 | true
20 | e.stopPropagation()
21 | #
22 | # Entry to our code
23 | # Override the imgEdit.open function
24 | #
25 | injectPTE = ->
26 | # Find and inject pte-url into size cell...
27 | #jQuery('.media-item').each (i,elem) ->
28 | # post_id = elem.id.replace "media-item-",""
29 | # $getLink(post_id)
30 | # .css
31 | # 'font-size': '.8em'
32 | # 'margin-left': '5px'
33 | # .click(checkExistingThickbox)
34 | # .appendTo jQuery 'tr.image-size th.label', elem
35 |
36 | if imageEdit.open?
37 | imageEdit.oldopen = imageEdit.open
38 | imageEdit.open = (id, nonce) ->
39 | image_id = id
40 | imageEdit.oldopen id,nonce
41 | launchPTE()
42 | # Does the imgedit-save-target already exist?
43 | $editmenu = jQuery("""p[id^="imgedit-save-target-"]""")
44 | if $editmenu?.length > 0
45 | #set the image_id & launch it
46 | matches = $editmenu[0].id.match(/imgedit-save-target-(\d+)/)
47 | if matches[1]?
48 | image_id = matches[1]
49 | launchPTE()
50 | true
51 |
52 | launchPTE = ->
53 | # Check if elements are loaded
54 | #selector = """p[id^="imgedit-save-target-#{ image_id }"]"""
55 | selector = """#imgedit-save-target-#{ image_id }"""
56 | $editmenu = jQuery(selector)
57 | if $editmenu?.size() < 1
58 | window.setTimeout(launchPTE, timeout)
59 | return false
60 |
61 | # Add convenience functions to menu
62 | $link = $getLink().click checkExistingThickbox
63 | $link.addClass "button-primary"
64 | $link.css "margin-top", "10px"
65 | $editmenu.append $link
66 |
67 | injectPTE()
68 |
69 |
--------------------------------------------------------------------------------
/php/class-pte-image-editor-imagick.php:
--------------------------------------------------------------------------------
1 | $ar ) { // constrain to the dst_h
27 | $tmp_dst_h = $dst_h;
28 | $tmp_dst_w = $dst_h * $ar;
29 | $tmp_dst_y = 0;
30 | $tmp_dst_x = ($dst_w / 2) - ($tmp_dst_w / 2);
31 | }
32 | else {
33 | $tmp_dst_w = $dst_w;
34 | $tmp_dst_h = $dst_w / $ar;
35 | $tmp_dst_x = 0;
36 | $tmp_dst_y = ($dst_h / 2) - ($tmp_dst_h / 2);
37 | }
38 |
39 | if ( pte_is_crop_border_opaque() ) {
40 | $color = new ImagickPixel( $_GET['pte-fit-crop-color'] );
41 | }
42 |
43 | try {
44 | // crop the original image
45 | $this->image->cropImage( $src_w, $src_h, $src_x, $src_y );
46 | $this->image->scaleImage( $tmp_dst_w, $tmp_dst_h );
47 |
48 | // Create a new image and then compose the old one onto it.
49 | $img = new Imagick();
50 | $img->newImage( $dst_w, $dst_h, isset( $color ) ? $color : 'white' );
51 | $img->setImageFormat( $this->image->getImageFormat() );
52 | if ( ! isset( $color ) ) {
53 | $img->setImageOpacity( 0.0 );
54 | }
55 | $img->compositeImage( $this->image, Imagick::COMPOSITE_DEFAULT, $tmp_dst_x, $tmp_dst_y );
56 | $img->flattenImages();
57 |
58 | $this->image = $img;
59 | }
60 | catch ( Exception $e ) {
61 | return new WP_Error( 'image_crop_error', __('Image crop failed.'), $this->file );
62 | }
63 | return $this->update_size();
64 |
65 | }
66 | return parent::crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/apps/jcrop/README.md:
--------------------------------------------------------------------------------
1 | Jcrop Image Cropping Plugin
2 | ===========================
3 |
4 | Jcrop is the quick and easy way to add image cropping functionality to
5 | your web application. It combines the ease-of-use of a typical jQuery
6 | plugin with a powerful cross-platform DHTML cropping engine that is
7 | faithful to familiar desktop graphics applications.
8 |
9 | Cross-platform Compatibility
10 | ----------------------------
11 |
12 | * Firefox 2+
13 | * Safari 3+
14 | * Opera 9.5+
15 | * Google Chrome 0.2+
16 | * Internet Explorer 6+
17 |
18 | Feature Overview
19 | ----------------
20 |
21 | * Attaches unobtrusively to any image
22 | * Supports aspect ratio locking
23 | * Supports minSize/maxSize setting
24 | * Callbacks for selection done, or while moving
25 | * Keyboard support for nudging selection
26 | * API features to create interactivity, including animation
27 | * Support for CSS styling
28 | * Experimental touch-screen support (iOS, Android, etc)
29 |
30 | Contributors
31 | ============
32 |
33 | **Special thanks to the following contributors:**
34 |
35 | * [Bruno Agutoli](mailto:brunotla1@gmail.com)
36 | * dhorrigan
37 | * Phil-B
38 | * jaymecd
39 | * all others who have committed their time and effort to help improve Jcrop
40 |
41 | MIT License
42 | ===========
43 |
44 | **Jcrop is free software under MIT License.**
45 |
46 | #### Copyright (c) 2008-2012 Tapmodo Interactive LLC,
http://github.com/tapmodo/Jcrop
47 |
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of this software and associated documentation files (the
50 | "Software"), to deal in the Software without restriction, including
51 | without limitation the rights to use, copy, modify, merge, publish,
52 | distribute, sublicense, and/or sell copies of the Software, and to
53 | permit persons to whom the Software is furnished to do so, subject to
54 | the following conditions:
55 |
56 | The above copyright notice and this permission notice shall be
57 | included in all copies or substantial portions of the Software.
58 |
59 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
60 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
61 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
62 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
63 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
64 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
65 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
66 |
67 |
--------------------------------------------------------------------------------
/apps/jcrop/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Jcrop: the jQuery Image Cropping Plugin
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
24 |
25 |
26 |
27 | Jcrop
28 | is the image cropping plugin for
29 | jQuery.
30 | You've successfully unpacked Jcrop.
31 |
32 |
33 |
Static Demos
34 |
35 |
55 |
56 |
Live Demo
57 |
58 |
62 |
63 |
Jcrop Links
64 |
65 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/php/class-pte-image-editor-gd.php:
--------------------------------------------------------------------------------
1 | $ar ) { // constrain to the dst_h
27 | $tmp_dst_h = $dst_h;
28 | $tmp_dst_w = $dst_h * $ar;
29 | $tmp_dst_y = 0;
30 | $tmp_dst_x = ($dst_w / 2) - ($tmp_dst_w / 2);
31 | }
32 | else {
33 | $tmp_dst_w = $dst_w;
34 | $tmp_dst_h = $dst_w / $ar;
35 | $tmp_dst_x = 0;
36 | $tmp_dst_y = ($dst_h / 2) - ($tmp_dst_h / 2);
37 | }
38 | // copy $this->image unto a new image with the right width/height.
39 | $img = wp_imagecreatetruecolor( $dst_w, $dst_h );
40 |
41 | if ( function_exists( 'imageantialias' ) )
42 | imageantialias( $img, true );
43 |
44 | if ( pte_is_crop_border_opaque() ) {
45 | $c = self::getRgbFromHex( $_GET['pte-fit-crop-color'] );
46 | $color = imagecolorallocate( $img, $c[0], $c[1], $c[2] );
47 | }
48 | else {
49 | PteLogger::debug( "setting transparent/white" );
50 | //$color = imagecolorallocate( $img, 100, 100, 100 );
51 | $color = imagecolorallocatealpha( $img, 255, 255, 255, 127 );
52 | }
53 |
54 | imagefilledrectangle( $img, 0, 0, $dst_w, $dst_h, $color );
55 | imagecopyresampled( $img, $this->image,
56 | $tmp_dst_x, $tmp_dst_y, $src_x, $src_y,
57 | $tmp_dst_w, $tmp_dst_h, $src_w, $src_h
58 | );
59 | if ( is_resource( $img ) ) {
60 | imagedestroy( $this->image );
61 | $this->image = $img;
62 | $this->update_size();
63 | return true;
64 | }
65 | return new WP_Error( 'image_crop_error', __('Image crop failed.'), $this->file );
66 | }
67 | return parent::crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
68 | }
69 |
70 | /**
71 | * Pulled from: http://php.net/manual/en/ref.image.php
72 | *
73 | * print_r( getRgbFromHex( "#FFFFFF" ) )
74 | * --> // Output: Array ( [0] => 255 [1] => 255 [2] => 255 )
75 | */
76 | public static function getRgbFromHex($color_hex) {
77 | return array_map( 'hexdec', explode( '|', wordwrap( substr( $color_hex, 1 ), 2, '|', 1 ) ) );
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/apps/angular/angular-resource.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | AngularJS v1.2.1
3 | (c) 2010-2012 Google, Inc. http://angularjs.org
4 | License: MIT
5 | */
6 | (function(H,f,z){'use strict';var v=f.$$minErr("$resource"),A=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;f.module("ngResource",["ng"]).factory("$resource",["$http","$q",function(D,E){function n(f,h){this.template=f;this.defaults=h||{};this.urlParams={}}function w(m,h,k){function r(d,c){var e={};c=x({},h,c);s(c,function(a,c){u(a)&&(a=a());var g;if(a&&a.charAt&&"@"==a.charAt(0)){g=d;var b=a.substr(1);if(null==b||""===b||"hasOwnProperty"===b||!A.test("."+b))throw v("badmember",b);for(var b=b.split("."),f=0,h=
7 | b.length;f
6 | # Adapted from underscore (underscorejs.org) source
7 | throttle = (func, wait) ->
8 | [context, args, timeout, result] = []
9 | previous = 0
10 | later = ->
11 | previous = new Date
12 | timeout = null
13 | result = func.apply(context, args)
14 | return null
15 | ->
16 | now = new Date
17 | remaining = wait - (now - previous)
18 | context = this
19 | args = arguments
20 | if (remaining <= 0)
21 | clearTimeout(timeout)
22 | timeout = null
23 | previous = now
24 | result = func.apply(context, args)
25 | else if (!timeout)
26 | timeout = setTimeout(later, remaining)
27 | return result
28 |
29 |
30 | jcrop = null
31 | crop_options =
32 | # TODO
33 | # Make the bgColor an option (dropdown, black or transparent)
34 | #bgColor: 'green' # make it an option?
35 | onChange: throttle( ->
36 | #jcrop = this
37 | changeBgColor = (color) ->
38 | if color != bgColor
39 | jcrop.setOptions
40 | bgColor: color
41 | return
42 |
43 | isBad = ->
44 | compare = (constraint, dimension) ->
45 | if ! constraint?
46 | return true
47 | if constraint is 0
48 | return false
49 | constraint < dimension
50 | # If both dimensions are required
51 | # and if the constraint_w is less than the actual cropped width then we are no longer constrained
52 | # and if the constraint_h is less than the actual cropped height then we are no longer constrained
53 | if is_ar_enforced and compare(crop_w, w) and compare(crop_h, h)
54 | return false # GOOD
55 | # If only one dimension is required
56 | # if the constraint_w is less than the actual cropped width
57 | # - or -
58 | # if the constraint_h is less than the actual cropped height then we are no longer constrained
59 | if !is_ar_enforced and compare(crop_w, w) or compare(crop_h, h)
60 | return false # GOOD
61 | return true
62 |
63 |
64 |
65 | cropConstraints = this.getOptions().cropConstraints
66 | if !cropConstraints
67 | changeBgColor 'black'
68 | return
69 |
70 | [crop_w, crop_h, is_ar_enforced] = cropConstraints
71 | {bgColor} = this.getOptions()
72 | {w, h} = this.tellSelect()
73 | #console.log w, h, crop_w, crop_h
74 |
75 | if isBad()
76 | changeBgColor 'red'
77 | else
78 | changeBgColor 'green'
79 | return
80 | , 50)
81 |
82 |
83 | onRelease: ->
84 | {x, y, w, h, x2, y2} = this.tellSelect()
85 | if isNaN x
86 | return
87 | if x isnt 0 or
88 | y isnt 0 or
89 | w isnt 0 or
90 | h isnt 0 or
91 | x2 isnt 0 or
92 | y2 isnt 0
93 | this.setSelect [0,0,0,0,0,0]
94 | this.release()
95 | return
96 |
97 |
98 | trueSize: [
99 | settings.width
100 | settings.height
101 | ]
102 |
103 | jcrop = $.Jcrop "#pte-preview", crop_options
104 | jcrop.release()
105 |
106 | return jcrop
107 |
--------------------------------------------------------------------------------
/assets/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
78 |
--------------------------------------------------------------------------------
/apps/jcrop/css/jquery.Jcrop.css:
--------------------------------------------------------------------------------
1 | /* jquery.Jcrop.css v0.9.12 - MIT License */
2 | /*
3 | The outer-most container in a typical Jcrop instance
4 | If you are having difficulty with formatting related to styles
5 | on a parent element, place any fixes here or in a like selector
6 |
7 | You can also style this element if you want to add a border, etc
8 | A better method for styling can be seen below with .jcrop-light
9 | (Add a class to the holder and style elements for that extended class)
10 | */
11 | .jcrop-holder {
12 | direction: ltr;
13 | text-align: left;
14 | }
15 | /* Selection Border */
16 | .jcrop-vline,
17 | .jcrop-hline {
18 | background: #ffffff url("Jcrop.gif");
19 | font-size: 0;
20 | position: absolute;
21 | }
22 | .jcrop-vline {
23 | height: 100%;
24 | width: 1px !important;
25 | }
26 | .jcrop-vline.right {
27 | right: 0;
28 | }
29 | .jcrop-hline {
30 | height: 1px !important;
31 | width: 100%;
32 | }
33 | .jcrop-hline.bottom {
34 | bottom: 0;
35 | }
36 | /* Invisible click targets */
37 | .jcrop-tracker {
38 | height: 100%;
39 | width: 100%;
40 | /* "turn off" link highlight */
41 | -webkit-tap-highlight-color: transparent;
42 | /* disable callout, image save panel */
43 | -webkit-touch-callout: none;
44 | /* disable cut copy paste */
45 | -webkit-user-select: none;
46 | }
47 | /* Selection Handles */
48 | .jcrop-handle {
49 | background-color: #333333;
50 | border: 1px #eeeeee solid;
51 | width: 7px;
52 | height: 7px;
53 | font-size: 1px;
54 | }
55 | .jcrop-handle.ord-n {
56 | left: 50%;
57 | margin-left: -4px;
58 | margin-top: -4px;
59 | top: 0;
60 | }
61 | .jcrop-handle.ord-s {
62 | bottom: 0;
63 | left: 50%;
64 | margin-bottom: -4px;
65 | margin-left: -4px;
66 | }
67 | .jcrop-handle.ord-e {
68 | margin-right: -4px;
69 | margin-top: -4px;
70 | right: 0;
71 | top: 50%;
72 | }
73 | .jcrop-handle.ord-w {
74 | left: 0;
75 | margin-left: -4px;
76 | margin-top: -4px;
77 | top: 50%;
78 | }
79 | .jcrop-handle.ord-nw {
80 | left: 0;
81 | margin-left: -4px;
82 | margin-top: -4px;
83 | top: 0;
84 | }
85 | .jcrop-handle.ord-ne {
86 | margin-right: -4px;
87 | margin-top: -4px;
88 | right: 0;
89 | top: 0;
90 | }
91 | .jcrop-handle.ord-se {
92 | bottom: 0;
93 | margin-bottom: -4px;
94 | margin-right: -4px;
95 | right: 0;
96 | }
97 | .jcrop-handle.ord-sw {
98 | bottom: 0;
99 | left: 0;
100 | margin-bottom: -4px;
101 | margin-left: -4px;
102 | }
103 | /* Dragbars */
104 | .jcrop-dragbar.ord-n,
105 | .jcrop-dragbar.ord-s {
106 | height: 7px;
107 | width: 100%;
108 | }
109 | .jcrop-dragbar.ord-e,
110 | .jcrop-dragbar.ord-w {
111 | height: 100%;
112 | width: 7px;
113 | }
114 | .jcrop-dragbar.ord-n {
115 | margin-top: -4px;
116 | }
117 | .jcrop-dragbar.ord-s {
118 | bottom: 0;
119 | margin-bottom: -4px;
120 | }
121 | .jcrop-dragbar.ord-e {
122 | margin-right: -4px;
123 | right: 0;
124 | }
125 | .jcrop-dragbar.ord-w {
126 | margin-left: -4px;
127 | }
128 | /* The "jcrop-light" class/extension */
129 | .jcrop-light .jcrop-vline,
130 | .jcrop-light .jcrop-hline {
131 | background: #ffffff;
132 | filter: alpha(opacity=70) !important;
133 | opacity: .70!important;
134 | }
135 | .jcrop-light .jcrop-handle {
136 | -moz-border-radius: 3px;
137 | -webkit-border-radius: 3px;
138 | background-color: #000000;
139 | border-color: #ffffff;
140 | border-radius: 3px;
141 | }
142 | /* The "jcrop-dark" class/extension */
143 | .jcrop-dark .jcrop-vline,
144 | .jcrop-dark .jcrop-hline {
145 | background: #000000;
146 | filter: alpha(opacity=70) !important;
147 | opacity: 0.7 !important;
148 | }
149 | .jcrop-dark .jcrop-handle {
150 | -moz-border-radius: 3px;
151 | -webkit-border-radius: 3px;
152 | background-color: #ffffff;
153 | border-color: #000000;
154 | border-radius: 3px;
155 | }
156 | /* Simple macro to turn off the antlines */
157 | .solid-line .jcrop-vline,
158 | .solid-line .jcrop-hline {
159 | background: #ffffff;
160 | }
161 | /* Fix for twitter bootstrap et al. */
162 | .jcrop-holder img,
163 | img.jcrop-preview {
164 | max-width: none;
165 | }
166 |
--------------------------------------------------------------------------------
/css/pte.css:
--------------------------------------------------------------------------------
1 | .pte-iframe {
2 | padding-left: 15px;
3 | }
4 |
5 | #pte-subtitle {
6 | font-size: .7em;
7 | color: #444444;
8 | }
9 | #aspect-ratio-selector a,
10 | .nav-tab-wrapper a {
11 | cursor: pointer;
12 | }
13 | #pte-image { float: left; margin-right: 10px;}
14 | #pte-thumbnail-column {
15 | float: left;
16 | position: relative;
17 | width: 400px;
18 | }
19 | #pte-thumbnail-column button {
20 | float: right;
21 | margin: 5px;
22 | }
23 | /**.pte-thumbnails-menu { display: none; }**/
24 | .pte-thumbnail-menu {
25 | font-size: 1.2em;
26 | line-height: 1.3em;
27 | }
28 | td.pte-thumbnail-options {
29 | width: 50px;
30 | }
31 | .pte-thumbnail-menu .fa-save { color: green; }
32 | .pte-thumbnail-menu .fa-trash-o { color: red; }
33 | .pte-thumbnail-menu i:hover,
34 | .pte-thumbnails-menu i:hover {
35 | font-size: 1.2em;
36 | }
37 |
38 | /** Font Awesome **/
39 | i {
40 | font-family: FontAwesome;
41 | font-style: normal;
42 | font-weight: normal;
43 | line-height: 1;
44 | -webkit-font-smoothing: antialiased;
45 | -moz-osx-font-smoothing: grayscale;
46 | }
47 | /** **/
48 | i.disabled {
49 | color: #aaaaaa;
50 | }
51 | tr.selected-true { background-color: #e0ffe0; }
52 | tr.selected-true.alternate { background-color: #eaffea; }
53 | th.center,
54 | td.center {
55 | text-align: center;
56 | }
57 |
58 | #pte-thumbnail-table td {
59 | line-height: 1.8em;
60 | }
61 | #pte-thumbnail-table th {
62 | line-height: 1.5em;
63 | }
64 |
65 | #pte-thumbnail-table th input,
66 | #pte-thumbnail-table td input {
67 | margin: 1px 0 0;
68 | }
69 | .align-right {
70 | text-align: right !important;
71 | }
72 |
73 | #aspect-ratio-selector {
74 | margin-top: 20px;
75 | font-size: 1.3em;
76 | }
77 |
78 | .info-message {
79 | background-color: #ddddff;
80 | border: 1px solid blue;
81 | color: blue;
82 | font-size: 1.5em;
83 | margin-bottom: 10px;
84 | padding: 10px;
85 | position:relative;
86 | }
87 | .info-message .fa-times {
88 | font-size: 1.1em;
89 | position: absolute;
90 | top: 9px;
91 | right: 10px;
92 | }
93 |
94 | .error-message {
95 | font-size: 1.5em;
96 | padding: 10px;
97 | margin-bottom: 10px;
98 | position:relative;
99 | border: 1px solid red;
100 | background-color: #ffdddd;
101 | }
102 | .error-message .fa-times {
103 | font-size: 1.1em;
104 | position: absolute;
105 | top: 9px;
106 | right: 10px;
107 | }
108 |
109 | #pte-crop-settings {
110 | background-color: #f9f9f9;
111 | border: 1px solid #888888;
112 | margin-bottom: 20px;
113 | padding: 7px 10px;
114 | }
115 |
116 | #pte-crop-settings .fa-times {
117 | position: absolute;
118 | top: 12px;
119 | right: 10px;
120 | font-size: 12pt;
121 | }
122 | #pte-crop-controls {
123 | text-align: center;
124 | margin: 10px 0;
125 | }
126 | .pte-display-thumbnail-image {
127 | margin-bottom: 10px;
128 | position: relative;
129 | }
130 |
131 | .pte-display-thumbnail-menu {
132 | font-size: 1.2em;
133 | float:left;
134 | margin-right: 3px;
135 | padding: 2px;
136 | }
137 |
138 | .no-current-image {
139 | font-size: 3em;
140 | }
141 |
142 | .pte-display-thumbnail-image.selected {
143 | border-width: 5px !important;
144 | border-style: solid;
145 | border-color: #cccccc;
146 | }
147 |
148 | .pte-display-thumbnail-image.modified {
149 | border: 1px solid green;
150 | background-color: #ddffdd;
151 | padding: 10px 5px;
152 | }
153 | .pte-display-thumbnail-image.original {
154 | transition: background 1.5s ease-in-out, padding 1.5s ease-in-out;
155 | -webkit-transition: background 1.5s ease-in-out, padding 1.5s ease-in-out;
156 | -moz-transition: background 1.5s ease-in-out, padding 1.5s ease-in-out;
157 | }
158 |
159 | /*** Angular cloak ***/
160 | [ng\:cloak], [ng-cloak], .ng-cloak {
161 | display: none;
162 | }
163 |
164 | /** For thumbnail review **/
165 | #pte-remember, #pte-remember-list {
166 | margin: 0;
167 | padding: 0;
168 | z-index: 1000;
169 | }
170 | #pte-remember.horizontal {
171 | width: 100%;
172 | }
173 | #pte-remember.vertical {
174 | position: absolute;
175 | top: -15px;
176 | right: -130px;
177 | /*top: -0px;*/
178 | }
179 | #pte-remember.horizontal #pte-remember-list {
180 | overflow-x: auto;
181 | width: 100%;
182 | white-space: nowrap;
183 | margin-right: -10px;
184 | }
185 | #pte-remember.horizontal li { display: inline-block; margin-left: 10px; }
186 | #pte-remember.horizontal #pte-remember-list li:first-child { margin-left: 0; }
187 | #pte-remember.horizontal li img { height: 100px; }
188 | #pte-remember.vertical li img { width: 100px; }
189 |
190 | #pte-iris-dialog {
191 | margin: 10px;
192 | display: none;
193 | }
194 |
--------------------------------------------------------------------------------
/apps/requirejs/domReady.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/requirejs/domReady for details
5 | */
6 | /*jslint */
7 | /*global require: false, define: false, requirejs: false,
8 | window: false, clearInterval: false, document: false,
9 | self: false, setInterval: false */
10 |
11 |
12 | define(function () {
13 | 'use strict';
14 |
15 | var isTop, testDiv, scrollIntervalId,
16 | isBrowser = typeof window !== "undefined" && window.document,
17 | isPageLoaded = !isBrowser,
18 | doc = isBrowser ? document : null,
19 | readyCalls = [];
20 |
21 | function runCallbacks(callbacks) {
22 | var i;
23 | for (i = 0; i < callbacks.length; i += 1) {
24 | callbacks[i](doc);
25 | }
26 | }
27 |
28 | function callReady() {
29 | var callbacks = readyCalls;
30 |
31 | if (isPageLoaded) {
32 | //Call the DOM ready callbacks
33 | if (callbacks.length) {
34 | readyCalls = [];
35 | runCallbacks(callbacks);
36 | }
37 | }
38 | }
39 |
40 | /**
41 | * Sets the page as loaded.
42 | */
43 | function pageLoaded() {
44 | if (!isPageLoaded) {
45 | isPageLoaded = true;
46 | if (scrollIntervalId) {
47 | clearInterval(scrollIntervalId);
48 | }
49 |
50 | callReady();
51 | }
52 | }
53 |
54 | if (isBrowser) {
55 | if (document.addEventListener) {
56 | //Standards. Hooray! Assumption here that if standards based,
57 | //it knows about DOMContentLoaded.
58 | document.addEventListener("DOMContentLoaded", pageLoaded, false);
59 | window.addEventListener("load", pageLoaded, false);
60 | } else if (window.attachEvent) {
61 | window.attachEvent("onload", pageLoaded);
62 |
63 | testDiv = document.createElement('div');
64 | try {
65 | isTop = window.frameElement === null;
66 | } catch (e) {}
67 |
68 | //DOMContentLoaded approximation that uses a doScroll, as found by
69 | //Diego Perini: http://javascript.nwbox.com/IEContentLoaded/,
70 | //but modified by other contributors, including jdalton
71 | if (testDiv.doScroll && isTop && window.external) {
72 | scrollIntervalId = setInterval(function () {
73 | try {
74 | testDiv.doScroll();
75 | pageLoaded();
76 | } catch (e) {}
77 | }, 30);
78 | }
79 | }
80 |
81 | //Check if document already complete, and if so, just trigger page load
82 | //listeners. Latest webkit browsers also use "interactive", and
83 | //will fire the onDOMContentLoaded before "interactive" but not after
84 | //entering "interactive" or "complete". More details:
85 | //http://dev.w3.org/html5/spec/the-end.html#the-end
86 | //http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded
87 | //Hmm, this is more complicated on further use, see "firing too early"
88 | //bug: https://github.com/requirejs/domReady/issues/1
89 | //so removing the || document.readyState === "interactive" test.
90 | //There is still a window.onload binding that should get fired if
91 | //DOMContentLoaded is missed.
92 | if (document.readyState === "complete") {
93 | pageLoaded();
94 | }
95 | }
96 |
97 | /** START OF PUBLIC API **/
98 |
99 | /**
100 | * Registers a callback for DOM ready. If DOM is already ready, the
101 | * callback is called immediately.
102 | * @param {Function} callback
103 | */
104 | function domReady(callback) {
105 | if (isPageLoaded) {
106 | callback(doc);
107 | } else {
108 | readyCalls.push(callback);
109 | }
110 | return domReady;
111 | }
112 |
113 | domReady.version = '2.0.1';
114 |
115 | /**
116 | * Loader Plugin API method
117 | */
118 | domReady.load = function (name, req, onLoad, config) {
119 | if (config.isBuild) {
120 | onLoad(null);
121 | } else {
122 | domReady(onLoad);
123 | }
124 | };
125 |
126 | /** END OF PUBLIC API **/
127 |
128 | return domReady;
129 | });
130 |
--------------------------------------------------------------------------------
/js/snippets/pte_enable_media.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | // for debug : trace every event
3 | //var originalTrigger = wp.media.view.MediaFrame.Post.prototype.trigger;
4 | //wp.media.view.MediaFrame.Post.prototype.trigger = function(){
5 | // console.log('Event Triggered:', arguments);
6 | // originalTrigger.apply(this, Array.prototype.slice.call(arguments));
7 | //}
8 |
9 | var pteIframeLink;
10 | pteIframeLink = _.template(pteL10n.url + "&title=false");
11 |
12 | $( function() {
13 | var injectTemplate, template;
14 | // Change the attachment-details html
15 | injectTemplate = _.template("\n " +
18 | pteL10n.PTE +
19 | "\n")({id:"{{ data.id }}"});
20 | template = $("#tmpl-attachment-details").text();
21 | template = template.replace(/()/, "" + injectTemplate + "\n$1");
22 | $("#tmpl-attachment-details").text(template);
23 |
24 | // Change the *other* attachment details
25 | template = $("#tmpl-attachment-details-two-column").text();
26 | template = template.replace(/(
)([\s\S]*?)(<\/div>)/m,
27 | "$1$2| " + injectTemplate + "$3");
28 | $("#tmpl-attachment-details-two-column").text(template);
29 | });
30 |
31 | // Hook into the media.views.attachment to create our link
32 | var featuredImageOpen = false;
33 | var oldDetails = wp.media.view.Attachment.Details;
34 |
35 | wp.media.view.Attachment.Details = oldDetails.extend({
36 | initialize: function() {
37 | oldDetails.prototype.initialize.apply( this, arguments );
38 | },
39 |
40 | // PTE link listener...
41 | events: _.extend(oldDetails.prototype.events, {
42 | 'click .pte': 'loadPteEditor'
43 | }),
44 |
45 | // this.controller == wp.media.view.MediaFrame.Post instance
46 | // This sets/gets a state 'pte', that we can then modify to a state
47 | // which will load an iframe:
48 | //
49 | // See media-views.js:1077:iframeContent()
50 | //
51 | loadPteEditor: function(evt) {
52 | evt.preventDefault();
53 | evt.stopImmediatePropagation();
54 |
55 | var state = this.controller.state().id;
56 | var me = this;
57 | if ( !featuredImageOpen && state !== "pte" ) {
58 | featuredImageOpen = true;
59 | this.controller.createIframeStates();
60 | me.controller.once('close', function() {
61 | featuredImageOpen = false;
62 | me.controller.setState(state);
63 | });
64 | }
65 |
66 | this.controller.state( 'pte' ).set({
67 | src: pteIframeLink({id:this.model.id}),
68 | title: pteL10n.PTE + ": " + this.model.attributes.filename,
69 | content: 'iframe'
70 | });
71 |
72 | if (this.controller.state().id == "pte") this.controller.state().trigger("activate");
73 | else this.controller.setState('pte');
74 |
75 | // wordpress 4.0 media library doesn't set the media-frame state
76 | jQuery('.media-modal-content > div').addClass('media-frame');
77 | }
78 | });
79 |
80 | // Set the featuredImage object as `this` for the frame function...
81 | if ( typeof wp.media.featuredImage !== 'undefined' ) {
82 | oldFeaturedImageFrame = $.proxy( wp.media.featuredImage.frame, wp.media.featuredImage );
83 | wp.media.featuredImage.frame = function() {
84 | var frame = oldFeaturedImageFrame()
85 | frame.setState('library')
86 | return frame;
87 | }
88 | }
89 |
90 | // Overwrite the MediaFrame.Post class
91 | //var oldPost = wp.media.view.MediaFrame.Post;
92 | //wp.media.view.MediaFrame.Post = oldPost.extend({
93 | // initialize: function() {
94 | // oldPost.prototype.initialize.apply(this, arguments);
95 | // this.on( 'content:create:pte', this.pteLoadIframe, this );
96 | // },
97 | // pteLoadIframe: function( content ) {
98 | // console.log( content );
99 | // //console.log( this );
100 | // this.iframeContent( content );
101 | // },
102 | // logger: function() {
103 | // console.log( arguments );
104 | // }
105 | //});
106 |
107 | //PteController = wp.media.controller.State.extend({
108 | // initialize: function() {
109 | // this.props = new Backbone.Model({url: "test"});
110 | // this.props.on( 'change:data', this.refresh, this );
111 | // },
112 | // refresh: function() {
113 | // console.log( 'REFRESHING' );
114 | // this.frame.content.get().refresh();
115 | // },
116 | // customAction: function() {
117 | // console.log( 'CUSTOM ACTION!' );
118 | // }
119 | //});
120 |
121 | //PteIframe = wp.media.view.Iframe.extend({
122 | // initialize: function() {
123 | // wp.media.view.Iframe.prototype.initialize.apply( this, arguments );
124 | // }
125 | //})
126 |
127 | //var oldMediaFramePost = wp.media.view.MediaFrame.Post;
128 | //wp.media.view.MediaFrame.Post = oldMediaFramePost.extend({
129 | // initialize: function () {
130 | // oldMediaFramePost.prototype.initialize.apply( this, arguments );
131 | // this.states.add([ new PteController({
132 | // id: 'pte',
133 | // menu: 'default',
134 | // content: 'PAJAMAS',
135 | // title: 'PAJAMAS - title',
136 | // priority: 200,
137 | // type: 'link'
138 | // })]);
139 |
140 | // this.on( 'content:render:PAJAMAS', this.customContent, this );
141 | // },
142 | // customContent: function(content) {
143 | // this.$el.addClass('hide-toolbar');
144 | // this.$el.addClass('hide-sidebar');
145 | // var view = new PteIframe({
146 | // controller: this,
147 | // model: this.state().props
148 | // });
149 | // this.content.set( view );
150 | // }
151 | //});
152 |
153 | })(jQuery);
154 |
--------------------------------------------------------------------------------
/apps/requirejs/cs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license cs 0.4.3 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/jrburke/require-cs for details
5 | */
6 |
7 | /*jslint */
8 | /*global define, window, XMLHttpRequest, importScripts, Packages, java,
9 | ActiveXObject, process, require */
10 |
11 | define(['coffee-script'], function (CoffeeScript) {
12 | 'use strict';
13 | var fs, getXhr,
14 | progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
15 | fetchText = function () {
16 | throw new Error('Environment unsupported.');
17 | },
18 | buildMap = {};
19 |
20 | if (typeof process !== "undefined" &&
21 | process.versions &&
22 | !!process.versions.node) {
23 | //Using special require.nodeRequire, something added by r.js.
24 | fs = require.nodeRequire('fs');
25 | fetchText = function (path, callback) {
26 | callback(fs.readFileSync(path, 'utf8'));
27 | };
28 | } else if ((typeof window !== "undefined" && window.navigator && window.document) || typeof importScripts !== "undefined") {
29 | // Browser action
30 | getXhr = function () {
31 | //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
32 | var xhr, i, progId;
33 | if (typeof XMLHttpRequest !== "undefined") {
34 | return new XMLHttpRequest();
35 | } else {
36 | for (i = 0; i < 3; i += 1) {
37 | progId = progIds[i];
38 | try {
39 | xhr = new ActiveXObject(progId);
40 | } catch (e) {}
41 |
42 | if (xhr) {
43 | progIds = [progId]; // so faster next time
44 | break;
45 | }
46 | }
47 | }
48 |
49 | if (!xhr) {
50 | throw new Error("getXhr(): XMLHttpRequest not available");
51 | }
52 |
53 | return xhr;
54 | };
55 |
56 | fetchText = function (url, callback) {
57 | var xhr = getXhr();
58 | xhr.open('GET', url, true);
59 | xhr.onreadystatechange = function (evt) {
60 | //Do not explicitly handle errors, those should be
61 | //visible via console output in the browser.
62 | if (xhr.readyState === 4) {
63 | callback(xhr.responseText);
64 | }
65 | };
66 | xhr.send(null);
67 | };
68 | // end browser.js adapters
69 | } else if (typeof Packages !== 'undefined') {
70 | //Why Java, why is this so awkward?
71 | fetchText = function (path, callback) {
72 | var stringBuffer, line,
73 | encoding = "utf-8",
74 | file = new java.io.File(path),
75 | lineSeparator = java.lang.System.getProperty("line.separator"),
76 | input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
77 | content = '';
78 | try {
79 | stringBuffer = new java.lang.StringBuffer();
80 | line = input.readLine();
81 |
82 | // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
83 | // http://www.unicode.org/faq/utf_bom.html
84 |
85 | // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
86 | // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
87 | if (line && line.length() && line.charAt(0) === 0xfeff) {
88 | // Eat the BOM, since we've already found the encoding on this file,
89 | // and we plan to concatenating this buffer with others; the BOM should
90 | // only appear at the top of a file.
91 | line = line.substring(1);
92 | }
93 |
94 | stringBuffer.append(line);
95 |
96 | while ((line = input.readLine()) !== null) {
97 | stringBuffer.append(lineSeparator);
98 | stringBuffer.append(line);
99 | }
100 | //Make sure we return a JavaScript string and not a Java string.
101 | content = String(stringBuffer.toString()); //String
102 | } finally {
103 | input.close();
104 | }
105 | callback(content);
106 | };
107 | }
108 |
109 | return {
110 | fetchText: fetchText,
111 |
112 | get: function () {
113 | return CoffeeScript;
114 | },
115 |
116 | write: function (pluginName, name, write) {
117 | if (buildMap.hasOwnProperty(name)) {
118 | var text = buildMap[name];
119 | write.asModule(pluginName + "!" + name, text);
120 | }
121 | },
122 |
123 | version: '0.4.3',
124 |
125 | load: function (name, parentRequire, load, config) {
126 | var path = parentRequire.toUrl(name + '.coffee');
127 | fetchText(path, function (text) {
128 |
129 | //Do CoffeeScript transform.
130 | try {
131 | text = CoffeeScript.compile(text, config.CoffeeScript);
132 | } catch (err) {
133 | err.message = "In " + path + ", " + err.message;
134 | throw err;
135 | }
136 |
137 | //Hold on to the transformed text if a build.
138 | if (config.isBuild) {
139 | buildMap[name] = text;
140 | }
141 |
142 | //IE with conditional comments on cannot handle the
143 | //sourceURL trick, so skip it if enabled.
144 | /*@if (@_jscript) @else @*/
145 | if (!config.isBuild) {
146 | text += "\r\n//@ sourceURL=" + path;
147 | }
148 | /*@end@*/
149 |
150 | load.fromText(name, text);
151 |
152 | //Give result to load. Need to wait until the module
153 | //is fully parse, which will happen after this
154 | //execution.
155 | parentRequire([name], function (value) {
156 | load(value);
157 | });
158 | });
159 | }
160 | };
161 | });
162 |
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-es_ES.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2013 Post Thumbnail Editor
2 | # This file is distributed under the same license as the Post Thumbnail Editor package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Post Thumbnail Editor 2.0.0\n"
6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7 | "POT-Creation-Date: 2013-03-08 04:51:59+00:00\n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=UTF-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "PO-Revision-Date: 2013-03-22 20:52+0100\n"
12 | "Last-Translator: Samuel Aguilera
\n"
13 | "Language-Team: Samuel Aguilera \n"
14 | "Language: Spanish\n"
15 | "X-Generator: Poedit 1.5.4\n"
16 |
17 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.0.0-beta) #-#-#-#-#
18 | #. Plugin Name of the plugin/theme
19 | #: html/pte.php:166 php/options.php:55 post-thumbnail-editor.php:107
20 | #: post-thumbnail-editor.php:207 post-thumbnail-editor.php:208
21 | #: post-thumbnail-editor.php:216 post-thumbnail-editor.php:217
22 | msgid "Post Thumbnail Editor"
23 | msgstr "Post Thumbnail Editor"
24 |
25 | #: html/pte.php:167
26 | msgid "crop and resize"
27 | msgstr "recortar y redimensionar"
28 |
29 | #: html/pte.php:171 html/pte.php:206
30 | msgid "Crop"
31 | msgstr "Recortar"
32 |
33 | #: html/pte.php:172
34 | msgid "View"
35 | msgstr "Ver"
36 |
37 | #: html/pte.php:201
38 | msgid "Options"
39 | msgstr "Opciones"
40 |
41 | #: html/pte.php:214
42 | msgid "Aspect Ratio"
43 | msgstr "Relación de aspecto"
44 |
45 | #: html/pte.php:215
46 | msgid "width/height"
47 | msgstr "anchura/altura"
48 |
49 | #: html/pte.php:229 php/options.php:37 post-thumbnail-editor.php:178
50 | msgid "Thumbnails"
51 | msgstr "Miniaturas"
52 |
53 | #: html/pte.php:235
54 | msgid "Save all"
55 | msgstr "Guardar todo"
56 |
57 | #: html/pte.php:240
58 | msgid "Reset all"
59 | msgstr "Reiniciar todo"
60 |
61 | #: html/pte.php:244
62 | msgid "View all/modified"
63 | msgstr "Ver todo/modificado"
64 |
65 | #: html/pte.php:263
66 | msgid "Save"
67 | msgstr "Guardar"
68 |
69 | #: html/pte.php:266
70 | msgid "Reset"
71 | msgstr "Reiniciar"
72 |
73 | #: html/pte.php:269
74 | msgid "Compare/View"
75 | msgstr "Comparar/Ver"
76 |
77 | #: html/pte.php:276
78 | msgid "These thumbnails have an aspect ratio set:"
79 | msgstr "Estas miniaturas tienen fijada una relación de aspecto:"
80 |
81 | #: html/pte.php:301
82 | msgid "Original"
83 | msgstr "Original"
84 |
85 | #: html/pte.php:308
86 | msgid "No image has been generated yet for image: "
87 | msgstr "Todavía no se ha generado una imagen: "
88 |
89 | #: html/pte.php:315
90 | msgid "Proposed"
91 | msgstr "Propuesta"
92 |
93 | #: php/functions.php:239
94 | msgid "Invalid meta data for POST #%d: %s"
95 | msgstr "Datos meta no válidos para el POST #%d: %s"
96 |
97 | #: php/functions.php:244
98 | msgid "Please contact support"
99 | msgstr "Por favor contacta con el soporte"
100 |
101 | #: php/log.php:15
102 | msgid "ERROR"
103 | msgstr "ERROR"
104 |
105 | #: php/log.php:18
106 | msgid "WARNING"
107 | msgstr "ATENCIÓN"
108 |
109 | #: php/log.php:21
110 | msgid "DEBUG"
111 | msgstr "DEPURACIÓN"
112 |
113 | #: php/log.php:101
114 | msgid "ERROR Logging Message: %s"
115 | msgstr "Registro de mensaje de ERROR: %s"
116 |
117 | #: php/options.php:11
118 | msgid "User Options"
119 | msgstr "Opciones de usuario"
120 |
121 | #: php/options.php:16
122 | msgid "Debug"
123 | msgstr "Depuración"
124 |
125 | #: php/options.php:22
126 | msgid "Reset to defaults"
127 | msgstr "Reiniciar a valores predeterminados"
128 |
129 | #: php/options.php:33
130 | msgid "Site Options"
131 | msgstr "Opciones del sitio"
132 |
133 | #: php/options.php:42
134 | msgid "JPEG Compression"
135 | msgstr "Compresión JPEG"
136 |
137 | #: php/options.php:63
138 | msgid "Save Changes"
139 | msgstr "Guardar cambios"
140 |
141 | #: php/options.php:77
142 | msgid ""
143 | "Only users with the 'manage_options' capability may make changes to these "
144 | "settings."
145 | msgstr ""
146 | "Sólo los usuarios con la capacidad 'manage_options' pueden hacer cambios a "
147 | "estos ajustes."
148 |
149 | #: php/options.php:103
150 | msgid "JPEG Compression needs to be set from 0 to 100."
151 | msgstr "La compresión JPEG debe fijarse de 0 a 100."
152 |
153 | #: php/options.php:129
154 | msgid "Enable debugging"
155 | msgstr "Activar depuración"
156 |
157 | #: php/options.php:132
158 | msgid "WP_DEBUG is currently set to true and will override this setting."
159 | msgstr ""
160 | "WP_DEBUG está fijado actualmente a 'true' por lo que reemplazará este ajuste."
161 |
162 | #: php/options.php:143
163 | msgid "Reset User Options"
164 | msgstr "Reiniciar opciones de usuario"
165 |
166 | #: php/options.php:169
167 | msgid "Post Thumbnail"
168 | msgstr "Miniatura de entrada"
169 |
170 | #: php/options.php:170
171 | msgid "Hidden"
172 | msgstr "Oculta"
173 |
174 | #: php/options.php:199
175 | msgid "Set the compression level for resizing jpeg images (0 to 100)."
176 | msgstr ""
177 | "Fija el nivel de compresión para las imágenes JPEG redimensionadas (0 a 100)."
178 |
179 | #: php/options.php:200
180 | msgid "No entry defaults to using the 'jpeg_quality' filter or 90"
181 | msgstr "Sin valor se usará el filtro predeterminado 'jpeg_quality' ó 90"
182 |
183 | #: php/options.php:210
184 | msgid "These site-wide settings can only be changed by an administrator"
185 | msgstr ""
186 | "Estos ajustes que afectan a todo el sitio sólo pueden cambiarse por un "
187 | "administrador"
188 |
189 | #: post-thumbnail-editor.php:177
190 | msgid "Edit Thumbnails"
191 | msgstr "Editar miniaturas"
192 |
193 | #: post-thumbnail-editor.php:276
194 | msgid "No thumbnails selected"
195 | msgstr "No hay miniaturas seleccionadas"
196 |
197 | #: post-thumbnail-editor.php:277
198 | msgid "No crop selected"
199 | msgstr "No hay recorte seleccionado"
200 |
201 | #: post-thumbnail-editor.php:278
202 | msgid "Cropping will likely result in skewed imagery"
203 | msgstr "El recorte probablemente dará como resultado imágenes sesgadas"
204 |
205 | #: post-thumbnail-editor.php:279
206 | msgid "There was a problem saving the crop..."
207 | msgstr "Hubo un problema al guardar el recorte..."
208 |
209 | #. Plugin URI of the plugin/theme
210 | msgid "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
211 | msgstr "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
212 |
213 | #. Description of the plugin/theme
214 | msgid "Individually manage your post thumbnails"
215 | msgstr "Gestiona individualmente tus miniaturas"
216 |
217 | #. Author of the plugin/theme
218 | msgid "sewpafly"
219 | msgstr "sewpafly"
220 |
221 | #. Author URI of the plugin/theme
222 | msgid "http://sewpafly.github.com/post-thumbnail-editor"
223 | msgstr "http://sewpafly.github.com/post-thumbnail-editor"
224 |
--------------------------------------------------------------------------------
/php/log.php:
--------------------------------------------------------------------------------
1 | type){
15 | case self::$ERROR:
16 | return __( "ERROR", PTE_DOMAIN );
17 | break;
18 | case self::$WARN:
19 | return __( "WARNING", PTE_DOMAIN );
20 | break;
21 | case self::$INFO:
22 | return __( "INFO", PTE_DOMAIN );
23 | break;
24 | default:
25 | return __( "DEBUG", PTE_DOMAIN );
26 | }
27 | }
28 |
29 | public function __construct( $type, $message ){
30 | if ( !is_int( $type ) || !( $type & self::max_log_level() ) ){
31 | throw new Exception( "Invalid Log Type: '{$type}'" );
32 | }
33 | $this->type = $type;
34 | $this->message = trim( $message );
35 | $this->date = time();
36 | }
37 |
38 | public function __toString(){
39 | $type = $this->getTypeString();
40 | return sprintf('[%-7s][%s][ %s ]',
41 | $type,
42 | gmdate('c', $this->date),
43 | $this->message
44 | );
45 | }
46 | public function getType(){
47 | return $this->type;
48 | }
49 | public function getMessage(){
50 | return $this->message;
51 | }
52 | public static function max_log_level(){
53 | return self::$ERROR | self::$WARN | self::$INFO | self::$DEBUG;
54 | }
55 | }
56 |
57 | interface PteLogHandler {
58 | public function handle( PteLogMessage $message );
59 | }
60 |
61 | class PteLogChromeHandler implements PteLogHandler {
62 | protected $chrome = null;
63 |
64 | public function __construct() {
65 | if ( !class_exists( 'ChromePhp' ) ) {
66 | require_once( PTE_PLUGINPATH . 'php/chromephp/ChromePhp.php' );
67 | }
68 | ChromePhp::getInstance()->addSetting(ChromePhp::BACKTRACE_LEVEL, 5);
69 | }
70 |
71 | /**
72 | * Using ChromePhp, log the message
73 | */
74 | public function handle( PteLogMessage $message ) {
75 |
76 | switch( $message->getType() ) {
77 | case PteLogMessage::$ERROR:
78 | ChromePhp::error( $message->getMessage() );
79 | break;
80 | case PteLogMessage::$WARN:
81 | ChromePhp::warn( $message->getMessage() );
82 | break;
83 | case PteLogMessage::$INFO:
84 | ChromePhp::info( $message->getMessage() );
85 | break;
86 | case PteLogMessage::$DEBUG:
87 | default:
88 | ChromePhp::log( $message->getMessage() );
89 | break;
90 | }
91 | }
92 | }
93 |
94 | class PteLogFileHandler implements PteLogHandler
95 | {
96 | protected $filename;
97 |
98 | protected $lines = 0;
99 |
100 | public function __construct()
101 | {
102 | $this->filename = self::getLogFileName();
103 | wp_mkdir_p( dirname( $this->filename ) );
104 | touch( $this->filename );
105 | }
106 |
107 | public static function getLogFileUrl()
108 | {
109 | // SETS PTE_TMP_DIR and PTE_TMP_URL
110 | extract( pte_tmp_dir() );
111 | return $PTE_TMP_URL . 'log.txt';
112 | }
113 |
114 | public static function getLogFileName()
115 | {
116 | // SETS PTE_TMP_DIR and PTE_TMP_URL
117 | extract( pte_tmp_dir() );
118 | return $PTE_TMP_DIR . 'log.txt';
119 | }
120 |
121 | private function logAndTruncate( $message )
122 | {
123 | $content = file( $this->filename, FILE_IGNORE_NEW_LINES );
124 | if ( $content === false ) {
125 | $content = array();
126 | }
127 |
128 | $content = array_merge( $content, explode( "\n", (string) $message ) );
129 |
130 | if ( count( $content ) > $this->lines ) {
131 | $content = array_slice( $content, $this->lines * -1);
132 | }
133 |
134 | file_put_contents( $this->filename,
135 | implode( "\n", $content )
136 | );
137 | }
138 |
139 | public function handle( PteLogMessage $message )
140 | {
141 | if ( isset( $this->lines ) && $this->lines )
142 | logAndTruncate( $message );
143 | // append to file
144 | $fp = fopen( $this->filename, 'a+' );
145 | fwrite( $fp, $message . "\n" );
146 | fclose($fp);
147 | }
148 |
149 | }
150 |
151 | class PteLogger implements PteLogHandler {
152 | private static $instance;
153 | private $messages = array();
154 | private $counts = array();
155 | //private $defaulttype = 4;
156 | //private $defaulttype = PteLogMessage::$DEBUG;
157 | private $defaulttype = NULL;
158 | private $handlers = array();
159 |
160 | private function __construct() {
161 | $this->defaulttype = PteLogMessage::$DEBUG;
162 | $options = pte_get_options();
163 |
164 | # Add chrome log handler
165 | if ( $options['pte_debug_out_chrome'] )
166 | $this->handlers[] = new PteLogChromeHandler;
167 | # Add file log handler
168 | if ( $options['pte_debug_out_file'] )
169 | $this->handlers[] = new PteLogFileHandler;
170 |
171 | $this->handlers[] = $this;
172 | }
173 |
174 | public static function singleton()
175 | {
176 | if (!isset(self::$instance)) {
177 | $className = __CLASS__;
178 | self::$instance = new $className();
179 | }
180 | return self::$instance;
181 | }
182 |
183 |
184 | public function handle( PteLogMessage $message ) {
185 | //self::singleton()->chrome_log( $message );
186 | $type = $message->getType();
187 |
188 | if ( ! isset( $this->counts[ $type ] ) ){
189 | $this->counts[ $message->getType() ] = 1;
190 | }
191 | else {
192 | $this->counts[ $message->getType() ]++;
193 | }
194 | $this->messages[] = $message;
195 | }
196 |
197 | private function add_message( $message ) {
198 | foreach ( $this->handlers as $handler ){
199 | $handler->handle( $message );
200 | }
201 | }
202 |
203 | public function get_log_count( $type ){
204 | if ( !isset( $this->counts[ $type ] ) || !is_int( $this->counts[ $type ] ) )
205 | return 0;
206 | return $this->counts[$type];
207 | }
208 |
209 | /*
210 | * pte_log
211 | */
212 | private function pte_log($message, $type=NULL){
213 | if ( ! $message instanceof PteLogMessage ){
214 | if ( is_string( $message ) ){
215 | if ( is_null( $type ) ){
216 | $type = $this->defaulttype;
217 | }
218 | try {
219 | $message = new PteLogMessage( $type, $message );
220 | }
221 | catch ( Exception $e ){
222 | printf( __( "ERROR Logging Message: %s", PTE_DOMAIN ), $message );
223 | }
224 | }
225 | else{
226 | return false;
227 | }
228 | }
229 | // If debug isn't enabled only track WARN and ERROR messages
230 | // (throw away DEBUG messages)
231 | $options = pte_get_options();
232 | if ( ! $options['pte_debug'] and $type == PteLogMessage::$DEBUG ){
233 | return false;
234 | }
235 |
236 | $this->add_message( $message );
237 | return true;
238 | }
239 |
240 | /*
241 | * pte_log helper functions
242 | */
243 | public static function error( $message ){
244 | self::singleton()->pte_log( $message, PteLogMessage::$ERROR );
245 | }
246 | public static function warn( $message ){
247 | self::singleton()->pte_log( $message, PteLogMessage::$WARN );
248 | }
249 | public static function debug($message){
250 | self::singleton()->pte_log( $message, PteLogMessage::$DEBUG );
251 | }
252 |
253 | public function get_logs( $levels=NULL ){
254 | // Check that $levels is valid
255 | $max = PteLogMessage::max_log_level();
256 | if ( !is_int( $levels ) or $levels < 0 or $levels > $max ){
257 | $levels = $max;
258 | }
259 |
260 | foreach ( $this->messages as $message ){
261 | // If the current Level is requested, add to output
262 | if ( $levels & $message->getType() ){
263 | $output[] = $message->__toString();
264 | }
265 | }
266 | return $output;
267 | }
268 |
269 | }
270 |
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-de_DE.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010 Post Thumbnail Editor
2 | # This file is distributed under the same license as the Post Thumbnail Editor package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Post Thumbnail Editor 1.0.1-alpha2\n"
6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7 | "POT-Creation-Date: 2011-09-06 15:57:59+00:00\n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=UTF-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "PO-Revision-Date: 2012-04-02 10:57+0100\n"
12 | "Last-Translator: Christian Wenzl \n"
13 | "Language-Team: Christian Wenzl \n"
14 | "X-Poedit-Language: German\n"
15 | "X-Poedit-Country: GERMANY\n"
16 | "X-Poedit-SourceCharset: utf-8\n"
17 |
18 | #: html/pte.php:20
19 | msgid "Post Thumbnail Editor - Step 1"
20 | msgstr "Vorschaubild Editor - Schritt 1"
21 |
22 | #: html/pte.php:33
23 | msgid "Create Thumbnails"
24 | msgstr "Erzeuge Vorschaubilder"
25 |
26 | #: html/pte.php:39
27 | msgid "Choose the images/thumbnails that you want to edit:"
28 | msgstr "Wählen Sie die zu bearbeitenden Bilder:"
29 |
30 | #: html/pte.php:42
31 | msgid "Select: %1$sAll%2$s | %3$sNone%4$s"
32 | msgstr "Auswahl: %1$sAlle%2$s | %3$sKeine%4$s"
33 |
34 | #: html/pte.php:59
35 | msgid "Current image:"
36 | msgstr "Aktuelles Bild:"
37 |
38 | #: html/pte.php:78
39 | msgid "Back"
40 | msgstr "Zurück"
41 |
42 | #: html/pte.php:80
43 | msgid "Post Thumbnail Editor - Step 2"
44 | msgstr "Vorschaubild Editor - Schritt 2"
45 |
46 | #: html/pte.php:83
47 | #: html/pte.php:144
48 | msgid "We noticed some potential issues:"
49 | msgstr "Es sind einige Probleme aufgetreten:"
50 |
51 | #: html/pte.php:86
52 | msgid "View %1$slogs%2$s for further information"
53 | msgstr "Weitere Informationen finden Sie in den %1$sLogdateien%2$s"
54 |
55 | #: html/pte.php:91
56 | msgid "%1$sEnable debugging%2$s for additional information"
57 | msgstr "%1$sDebug aktivieren%2$s um weitere Informationen zu erhalten"
58 |
59 | #: html/pte.php:101
60 | msgid "Select the images you want to keep: %1$sAll%2$s | %3$sNone%4$s"
61 | msgstr "Wählen Sie die zu behaltenden Bilder aus: %1$sAlle%2$s | %3$sKeine%4$s"
62 |
63 | #: html/pte.php:124
64 | msgid "Okay, these look good..."
65 | msgstr "Okey, sieht gut aus..."
66 |
67 | #: html/pte.php:128
68 | msgid "I'd rather start over..."
69 | msgstr "Nochmal neu beginnen..."
70 |
71 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 1.0.1-alpha2) #-#-#-#-#
72 | #. Plugin Name of the plugin/theme
73 | #: html/pte.php:135
74 | #: post-thumbnail-editor.php:113
75 | #: post-thumbnail-editor.php:178
76 | #: post-thumbnail-editor.php:179
77 | #: php/options.php:64
78 | msgid "Post Thumbnail Editor"
79 | msgstr "Vorschaubild Editor"
80 |
81 | #: html/pte.php:138
82 | msgid "Images were created successfully."
83 | msgstr "Die Bilder wurden erfolgreich erstellt."
84 |
85 | #: html/pte.php:140
86 | msgid "Click %1$shere%2$s to modify another thumbnail."
87 | msgstr "Klicken Sie %1$shier%2$s um ein weiteres Vorschaubild zu bearbeiten."
88 |
89 | #: html/pte.php:156
90 | msgid "Please wait"
91 | msgstr "Etwas Geduld"
92 |
93 | #: html/pte.php:160
94 | msgid "Click here to show application logs"
95 | msgstr "Klicken Sie hier um die Logdatei einzusehen"
96 |
97 | #: html/pte.php:162
98 | #: php/options.php:30
99 | msgid "Debug"
100 | msgstr "Debug"
101 |
102 | #: html/pte.php:167
103 | msgid "If you are having any issues with this plugin, create a problem report on %1$sgithub%2$s or %3$swordpress.org%4$s so that I can look into it. Copy these log statements and include some information about what you were trying "
104 | msgstr "Falls Sie irgendwelche Probleme bei diesem Plugin feststellen, melden Sie dies bitte bei %1$sgithub%2$s oder %3$swordpress.org%4$s damit sich der Entwickler darum kümmern kann. Kopieren Sie diese Log-Informationen dazu, ergänzend von einer kurzen Beschreibung was Sie versucht haben."
105 |
106 | #: html/pte.php:181
107 | msgid "Send to Pastebin"
108 | msgstr "In den Papierkorb"
109 |
110 | #: html/pte.php:182
111 | msgid "Clear Messages"
112 | msgstr "Nachrichten leeren"
113 |
114 | #: html/pte.php:185
115 | msgid "Run Tests"
116 | msgstr "Tests starten"
117 |
118 | #: html/pte.php:186
119 | msgid "Close"
120 | msgstr "Schließen"
121 |
122 | #: post-thumbnail-editor.php:167
123 | msgid "Edit Thumbnails"
124 | msgstr "Vorschaubilder bearbeiten"
125 |
126 | #: post-thumbnail-editor.php:168
127 | #: php/options.php:51
128 | msgid "Thumbnails"
129 | msgstr "Vorschaubilder"
130 |
131 | #: php/log.php:15
132 | msgid "ERROR"
133 | msgstr "FEHLER"
134 |
135 | #: php/log.php:18
136 | msgid "WARNING"
137 | msgstr "WARNUNG"
138 |
139 | #: php/log.php:21
140 | msgid "DEBUG"
141 | msgstr "DEBUG"
142 |
143 | #: php/log.php:99
144 | msgid "ERROR Logging Message: %s"
145 | msgstr "FEHLERMELDUNG: %s"
146 |
147 | #: php/options.php:8
148 | msgid "These site-wide settings can only be changed by an administrator"
149 | msgstr "Diese seitenweite Einstellung kann nur durch einen Administrator geändert werden"
150 |
151 | #: php/options.php:19
152 | msgid "User Options"
153 | msgstr "Benutzer Einstellungen"
154 |
155 | #: php/options.php:24
156 | msgid "Thickbox dimensions"
157 | msgstr "Abmessungen der Thickbox"
158 |
159 | #: php/options.php:36
160 | msgid "Reset to defaults"
161 | msgstr "Auf Standardeinstellungen zurücksetzen"
162 |
163 | #: php/options.php:47
164 | msgid "Site Options"
165 | msgstr "Seiteneinstellungen"
166 |
167 | #: php/options.php:72
168 | msgid "Save Changes"
169 | msgstr "Änderungen speichern"
170 |
171 | #: php/options.php:86
172 | msgid "Only users with the 'manage_options' capability may make changes to these settings."
173 | msgstr "Nur Benutzer mit dem Recht 'manage_options' (Einstellungen bearbeiten) können diese Optionen ändern."
174 |
175 | #: php/options.php:118
176 | msgid "Thickbox width must be at least 750 pixels."
177 | msgstr "Breite der Thickbox muss mind. 750 Pixel betragen."
178 |
179 | #: php/options.php:128
180 | msgid "Thickbox height must be greater than 550 pixels."
181 | msgstr "Höhe der Thickbox muss mind. 750 Pixel betragen."
182 |
183 | #: php/options.php:142
184 | msgid "Width:"
185 | msgstr "Breite:"
186 |
187 | #: php/options.php:146
188 | msgid "Set this to a value greater than 750."
189 | msgstr "mind. 750 Pixel"
190 |
191 | #: php/options.php:153
192 | msgid "Height:"
193 | msgstr "Höhe:"
194 |
195 | #: php/options.php:157
196 | msgid "Set this to a value greater than 550."
197 | msgstr "mind. 550 Pixel"
198 |
199 | #: php/options.php:169
200 | msgid "Enable debugging"
201 | msgstr "Debugging aktivieren"
202 |
203 | #: php/options.php:178
204 | msgid "Reset User Options"
205 | msgstr "Benutzereinstellungen zurücksetzen"
206 |
207 | #: php/options.php:204
208 | msgid "Post Thumbnail"
209 | msgstr "Artikel Vorschaubild"
210 |
211 | #: php/options.php:205
212 | msgid "Hidden"
213 | msgstr "Versteckt"
214 |
215 | #: php/functions.php:257
216 | msgid "Sorry, there was a problem trying to send to pastebin"
217 | msgstr "Ups, konnte die Datei nicht in den Papierkorb legen."
218 |
219 | #: php/functions.php:258
220 | msgid "PASTEBIN URL:"
221 | msgstr "Url zum Papierkorb:"
222 |
223 | #: php/functions.php:259
224 | msgid "Disabling aspect ratio"
225 | msgstr "Seitenverhältnis nicht beachten"
226 |
227 | #. Plugin URI of the plugin/theme
228 | msgid "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
229 | msgstr "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
230 |
231 | #. Description of the plugin/theme
232 | msgid "Individually manage your post thumbnails"
233 | msgstr "Verändern Sie die Vorschaubilder individuell nach Ihren Vorstellungen"
234 |
235 | #. Author of the plugin/theme
236 | msgid "sewpafly"
237 | msgstr "sewpafly"
238 |
239 | #. Author URI of the plugin/theme
240 | msgid "http://sewpafly.github.com/post-thumbnail-editor"
241 | msgstr "http://sewpafly.github.com/post-thumbnail-editor"
242 |
243 |
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor.pot:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2015 Post Thumbnail Editor
2 | # This file is distributed under the same license as the Post Thumbnail Editor package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Post Thumbnail Editor 2.4.5\n"
6 | "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/post-thumbnail-"
7 | "editor\n"
8 | "POT-Creation-Date: 2015-06-17 05:07:23+00:00\n"
9 | "MIME-Version: 1.0\n"
10 | "Content-Type: text/plain; charset=UTF-8\n"
11 | "Content-Transfer-Encoding: 8bit\n"
12 | "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
13 | "Last-Translator: FULL NAME \n"
14 | "Language-Team: LANGUAGE \n"
15 |
16 | #: html/pte.php:23
17 | msgid "No thumbnails selected"
18 | msgstr ""
19 |
20 | #: html/pte.php:24
21 | msgid "No crop selected"
22 | msgstr ""
23 |
24 | #: html/pte.php:25
25 | msgid "Cropping will likely result in skewed imagery"
26 | msgstr ""
27 |
28 | #: html/pte.php:26
29 | msgid "There was a problem saving the crop..."
30 | msgstr ""
31 |
32 | #: html/pte.php:27 php/options.php:22
33 | msgid "Crop and Save"
34 | msgstr ""
35 |
36 | #: html/pte.php:28 html/pte.php:52
37 | msgid "Crop"
38 | msgstr ""
39 |
40 | #: html/pte.php:29 html/pte.php:201
41 | msgid "Save"
42 | msgstr ""
43 |
44 | #: html/pte.php:30
45 | msgid "Set transparent"
46 | msgstr ""
47 |
48 | #: html/pte.php:31
49 | msgid "transparent/white"
50 | msgstr ""
51 |
52 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.4.5) #-#-#-#-#
53 | #. Plugin Name of the plugin/theme
54 | #: html/pte.php:46 php/options.php:79 post-thumbnail-editor.php:211
55 | #: post-thumbnail-editor.php:251 post-thumbnail-editor.php:340
56 | #: post-thumbnail-editor.php:393 post-thumbnail-editor.php:394
57 | #: post-thumbnail-editor.php:400 post-thumbnail-editor.php:401
58 | #: post-thumbnail-editor.php:444
59 | msgid "Post Thumbnail Editor"
60 | msgstr ""
61 |
62 | #: html/pte.php:47
63 | msgid "crop and resize"
64 | msgstr ""
65 |
66 | #: html/pte.php:53
67 | msgid "View"
68 | msgstr ""
69 |
70 | #: html/pte.php:85
71 | msgid "Options"
72 | msgstr ""
73 |
74 | #: html/pte.php:101
75 | msgid "Aspect Ratio"
76 | msgstr ""
77 |
78 | #: html/pte.php:104
79 | msgid "width/height"
80 | msgstr ""
81 |
82 | #: html/pte.php:110
83 | msgid "Crop and save"
84 | msgstr ""
85 |
86 | #: html/pte.php:119
87 | msgid "Change the current thumbnails position:"
88 | msgstr ""
89 |
90 | #: html/pte.php:122 php/options.php:54
91 | msgid "JPEG Compression"
92 | msgstr ""
93 |
94 | #: html/pte.php:126
95 | msgid "0 to 100 (Default: %d)"
96 | msgstr ""
97 |
98 | #: html/pte.php:135
99 | msgid "Fit crop to thumbnail by adding border"
100 | msgstr ""
101 |
102 | #: html/pte.php:157 php/options.php:49 post-thumbnail-editor.php:361
103 | msgid "Thumbnails"
104 | msgstr ""
105 |
106 | #: html/pte.php:158
107 | msgid "width"
108 | msgstr ""
109 |
110 | #: html/pte.php:158
111 | msgid "W"
112 | msgstr ""
113 |
114 | #: html/pte.php:159
115 | msgid "height"
116 | msgstr ""
117 |
118 | #: html/pte.php:159
119 | msgid "H"
120 | msgstr ""
121 |
122 | #: html/pte.php:160
123 | msgid "crop"
124 | msgstr ""
125 |
126 | #: html/pte.php:160
127 | msgid "C"
128 | msgstr ""
129 |
130 | #: html/pte.php:166
131 | msgid "Save all"
132 | msgstr ""
133 |
134 | #: html/pte.php:171
135 | msgid "Reset all"
136 | msgstr ""
137 |
138 | #: html/pte.php:175
139 | msgid "View all/modified"
140 | msgstr ""
141 |
142 | #: html/pte.php:204
143 | msgid "Reset"
144 | msgstr ""
145 |
146 | #: html/pte.php:207
147 | msgid "Compare/View"
148 | msgstr ""
149 |
150 | #: html/pte.php:214
151 | msgid "These thumbnails have an aspect ratio set:"
152 | msgstr ""
153 |
154 | #: html/pte.php:223
155 | msgid "Current Thumbnails"
156 | msgstr ""
157 |
158 | #: html/pte.php:253
159 | msgid "Original"
160 | msgstr ""
161 |
162 | #: html/pte.php:260
163 | msgid "No image has been generated yet for image: "
164 | msgstr ""
165 |
166 | #: html/pte.php:267
167 | msgid "Proposed"
168 | msgstr ""
169 |
170 | #: php/class-pte-image-editor-gd.php:65
171 | #: php/class-pte-image-editor-imagick.php:61
172 | msgid "Image crop failed."
173 | msgstr ""
174 |
175 | #: php/functions.php:110
176 | msgid "Thumbnail"
177 | msgstr ""
178 |
179 | #: php/functions.php:111
180 | msgid "Medium"
181 | msgstr ""
182 |
183 | #: php/functions.php:112
184 | msgid "Large"
185 | msgstr ""
186 |
187 | #: php/functions.php:113
188 | msgid "Full Size"
189 | msgstr ""
190 |
191 | #: php/functions.php:241
192 | msgid "Invalid meta data for POST #%d: %s"
193 | msgstr ""
194 |
195 | #: php/functions.php:246
196 | msgid "Please contact support"
197 | msgstr ""
198 |
199 | #: php/log.php:16
200 | msgid "ERROR"
201 | msgstr ""
202 |
203 | #: php/log.php:19
204 | msgid "WARNING"
205 | msgstr ""
206 |
207 | #: php/log.php:22
208 | msgid "INFO"
209 | msgstr ""
210 |
211 | #: php/log.php:25
212 | msgid "DEBUG"
213 | msgstr ""
214 |
215 | #: php/log.php:222
216 | msgid "ERROR Logging Message: %s"
217 | msgstr ""
218 |
219 | #: php/options.php:11
220 | msgid "User Options"
221 | msgstr ""
222 |
223 | #: php/options.php:16
224 | msgid "Debug"
225 | msgstr ""
226 |
227 | #: php/options.php:28
228 | msgid "Crop Picture Size"
229 | msgstr ""
230 |
231 | #: php/options.php:34
232 | msgid "Reset to defaults"
233 | msgstr ""
234 |
235 | #: php/options.php:45
236 | msgid "Site Options"
237 | msgstr ""
238 |
239 | #: php/options.php:59
240 | msgid "Cache Buster"
241 | msgstr ""
242 |
243 | #: php/options.php:87
244 | msgid "Save Changes"
245 | msgstr ""
246 |
247 | #: php/options.php:101
248 | msgid ""
249 | "Only users with the 'manage_options' capability may make changes to these "
250 | "settings."
251 | msgstr ""
252 |
253 | #: php/options.php:127
254 | msgid "JPEG Compression needs to be set from 0 to 100."
255 | msgstr ""
256 |
257 | #: php/options.php:165
258 | msgid "Crop Size must be between 0 and 10000."
259 | msgstr ""
260 |
261 | #: php/options.php:184
262 | msgid "Enable debugging"
263 | msgstr ""
264 |
265 | #: php/options.php:187
266 | msgid ""
267 | "WP_DEBUG is currently set to true and will override this setting. (debug is "
268 | "enabled)"
269 | msgstr ""
270 |
271 | #: php/options.php:194
272 | msgid "Use ChromePhp for log output"
273 | msgstr ""
274 |
275 | #: php/options.php:202
276 | msgid "Write log output to a file"
277 | msgstr ""
278 |
279 | #: php/options.php:217
280 | msgid "I know what I'm doing, bypass the image verification."
281 | msgstr ""
282 |
283 | #: php/options.php:230
284 | msgid "Set the max size for the crop image."
285 | msgstr ""
286 |
287 | #: php/options.php:231
288 | msgid "No entry defaults to 600"
289 | msgstr ""
290 |
291 | #: php/options.php:238
292 | msgid ""
293 | "Check this to save the generated working image to disk instead of creating "
294 | "on the fly (experimental)"
295 | msgstr ""
296 |
297 | #: php/options.php:249
298 | msgid "Reset User Options"
299 | msgstr ""
300 |
301 | #: php/options.php:275
302 | msgid "Post Thumbnail"
303 | msgstr ""
304 |
305 | #: php/options.php:276
306 | msgid "Hidden"
307 | msgstr ""
308 |
309 | #: php/options.php:306
310 | msgid "Set the compression level for resizing jpeg images (0 to 100)."
311 | msgstr ""
312 |
313 | #: php/options.php:307
314 | msgid "No entry defaults to using the 'jpeg_quality' filter or 90"
315 | msgstr ""
316 |
317 | #: php/options.php:319
318 | msgid "Append timestamp to filename. Useful for solving caching problems."
319 | msgstr ""
320 |
321 | #: php/options.php:330
322 | msgid "These site-wide settings can only be changed by an administrator"
323 | msgstr ""
324 |
325 | #: post-thumbnail-editor.php:360
326 | msgid "Edit Thumbnails"
327 | msgstr ""
328 |
329 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.4.5) #-#-#-#-#
330 | #. Plugin URI of the plugin/theme
331 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.4.5) #-#-#-#-#
332 | #. Author URI of the plugin/theme
333 | msgid "http://sewpafly.github.io/post-thumbnail-editor/"
334 | msgstr ""
335 |
336 | #. Description of the plugin/theme
337 | msgid "Individually manage your post thumbnails"
338 | msgstr ""
339 |
340 | #. Author of the plugin/theme
341 | msgid "sewpafly"
342 | msgstr ""
343 |
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | === Post Thumbnail Editor ===
2 | Contributors: sewpafly
3 | Donate link: http://sewpafly.github.io/post-thumbnail-editor/#toc_donations
4 | Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image, awesome, crop
5 | Requires at least: 4.1
6 | Tested up to: 4.5
7 | Stable tag: trunk
8 | License: GPLv2
9 |
10 | Fed up with the lack of automated tools to properly crop and scale post thumbnails? Maybe this plugin can help.
11 |
12 | == Description ==
13 |
14 | To meet the needs of themes where the post-thumbnails have random and capricious sizes (which causes wordpress to crop images simply from the middle (either chopping off the top and bottom or chopping off the sides), this plugin attempts to give the users an interface to manually fix those thumbnail and random images.
15 |
16 | == Installation ==
17 |
18 | 1. Download the zip file from
19 | 2. Unzip to your wp-content/plugins directory under the wordpress installation.
20 | 3. Activate the plugin through the 'Plugins' menu in WordPress
21 | 4. Rock On
22 |
23 | = or =
24 |
25 | 1. Install from within your wordpress admin area by searching for "post thumbnail editor"
26 |
27 | == Frequently Asked Questions ==
28 |
29 | = Usage =
30 |
31 | 1. Start with the Media Library
32 | 1. Open Media Library
33 | 2. Click the "Thumbnail" link in the rollover options.
34 | 2. or start within image editor interface (when viewing image details)
35 | 1. Click "Edit Image"
36 | 2. Click the "Post Thumbnail Editor" link under the other thumbnail options.
37 | 3. Using Post Thumbnail Editor Interface
38 | 1. Select the thumbnails you want to edit. If a thumbnail defines a specific aspect ratio it will be applied to the editor. If you select thumbnails with different aspect ratios (`width / height`), this feature is disabled. Be careful or you might make some of your pictures look funny.
39 | 2. Select the cropped/scaled area, by clicking and dragging on the left-hand image.
40 | 3. Click the "Crop" button.
41 | 4. Use the save icon to save the pictures, or use the view tab to compare the old and new versions before you commit.
42 | 4. It's possible that you might have to refresh the cache (ctrl+f5 on the page) to see changes, but they should be there.
43 |
44 | = Did you even test this? =
45 |
46 | Yes. No. Sort of. Thanks for asking. But [let me know if you're having problems][gh] and I'll see what I can do.
47 |
48 | = So it's installed but it doesn't appear to be working, how do I troubleshoot the problems? =
49 |
50 | Before posting a question or requesting support, disable all other plugins to verify that the problem isn't caused by some esoteric conflict. If you find a conflict with another plugin, let me know and I will fix it.
51 |
52 | If you want to post a problem on the [support forums][wp] or at [github][gh] please include the following information:
53 |
54 | 1. What browser (and version) are you using, or which browsers have you seen the behavior in?
55 | 2. What wordpress version are you using?
56 | 3. Does the javascript console report any exceptions/errors?
57 | * Google Chrome: ctrl+shift+j
58 | * Firefox: ctrl+shift+j
59 | * IE: F12 to open developer tools, click on the "Script" tab and view the "Console" sidebar.
60 | 4. Detail the steps to reproduce your problem
61 | * What did you do?
62 | * What did you expect to happen?
63 | * What actually happened?
64 |
65 | [wp]: http://wordpress.org/support/plugin/post-thumbnail-editor
66 | [gh]: https://github.com/sewpafly/post-thumbnail-editor/issues
67 |
68 | == Screenshots ==
69 |
70 | 1. Before/After
71 | 2. To edit from Media Library click "Thumbnail" in the rollover options for the row.
72 | 3. In the Edit subpage for media locate the box titled "Thumbnail Settings", and click the link to "Post Thumbnail Editor".
73 | 4. Crop the image as you see fit, select the thumbnails you wish to change, and click "Crop".
74 | 5. Save the resized/recropped images by clicking the save icon.
75 |
76 | == Changelog ==
77 |
78 | = 2.4.7 =
79 | * Updated brazilian translation
80 | * Fix for wordpress 4.5 - @nate-allen
81 |
82 | = 2.4.6 =
83 | * Updated polish translation
84 | * Check if featuredImage exists before override to avoid JS error (@gbonhevi)
85 |
86 | = 2.4.5 =
87 | * Fixed bug with post's media library
88 |
89 | = 2.4.4 =
90 | * Fixed bug with debug mode and certain plugins
91 | * Updated French translation
92 |
93 | = 2.4.3 =
94 | * Debug mode was broken
95 | * Update the generated .gz javascript file
96 | * modify the media library to have a fallback url
97 | * check that option `pte_jpeg_compression` exists before trying to access it
98 |
99 | = 2.4.2 =
100 | * Fix CSRF vulnerabilities. Thanks to [J.D. Grimes](http://codesymphony.co/) for reporting them.
101 |
102 | = 2.4.1 =
103 | * Bug fixes: see issues #100, #101, #102 on github
104 | * Bump wordpress compatibility
105 |
106 | = 2.4.0 =
107 | * Bug fixes
108 | * Use temporary file for editor image _(experimental)_
109 | * Logging to file/chromephp
110 |
111 | = 2.3.0 =
112 | * Updated libraries
113 | * (re-)Added Thickbox/Media Library Integration (#65)
114 | * Set jpeg compression dynamically (#63)
115 | * Add fit crop to thumbnail option (enabled by default), can be overridden in the "Options" menu #78
116 | * Various bug fixes
117 |
118 | = 2.2.2 =
119 | * Unreleased version
120 | * Updated libraries
121 | * Added spinner to show loading
122 | * Polish translation
123 | * fix #76: PHP Strict Standards Error
124 | * Save and crop stays in crop view
125 |
126 | = 2.2.1 =
127 | * fixed onLoad problem
128 |
129 | = 2.2.0 =
130 | * View the thumbnails you are planning on modifying from the crop tab
131 | * New documentation at http://sewpafly.github.io/post-thumbnail-editor
132 | * Resolved issue where users without capability could load the editor
133 | * Added new custom `pte-edit` capability.
134 | * Now use almondjs for the normal AMD loader
135 | * Fixed some crop constraint bugs
136 | * Removed requireJS domReady plugin
137 | * Upgraded angularjs
138 | * Improved startup
139 |
140 | = 2.1.0 =
141 | * Crop Constraints are visually available: green is good and red means there will be upscaling
142 | * In the options panel change the size of the cropping image
143 | * Bug fix: 3.6 compatibility
144 | * Added thumbnail metadata to table
145 |
146 | = 2.0.1 =
147 | * IE fix with the jcrop api
148 | * Now go into the view mode after cropping
149 | * Added option to crop and save without verifying
150 | * Featured images now have link to launch the Post Thumbnail Editor
151 | * Updated coffee-script to 1.6.2
152 | * Updated French and Spanish translations
153 | * Made the cache buster an option
154 |
155 | = 2.0.0 =
156 | * New UI based off angularjs -- awesome framework btw -- same backend
157 | * In view tab, click the pictures to select (double-click switches to crop view).
158 | * Works on iPhone/iPad.
159 |
160 | = 1.0.7 =
161 | * Updated for Wordpress 3.5 (introduces backwards incompatible changes)
162 | * Other bug fixes
163 |
164 | = 1.0.5 =
165 | * Fix custom sizes with either height or width set to '0'
166 | * Added German translation
167 |
168 | = 1.0.4 =
169 | * Added full paths to php includes
170 | * Fix handling for thumbnail names with spaces
171 | * Fix unlink/deletion issue
172 | * Added Portuguese translation
173 |
174 | = 1.0.3 =
175 | * Fixed some javascript issues
176 | * Added Italian translation
177 |
178 | = 1.0.2 =
179 | * Problem with SVN commit of 1.0.1
180 |
181 | = 1.0.1 =
182 | * Fixed compatibility with other thickbox enabled plugins that called the wordpress media scripts.
183 | * Added Options screen (Settings -> Post Thumbnail Editor) to configure thickbox dimensions and enable/disable debugging.
184 | * Added Translation support & French translation (thanks to Li-An)
185 |
186 | = 1.0.0 =
187 | * Total redesign of PHP/HTML interface
188 | * Allows editing multiple images
189 | * Switch from fancybox to wordpress' included thickbox
190 |
191 | = 0.2 =
192 | * Added support to change thumbnails aspect ratio. Previously a square image was generated. (Only works for "medium" or "large" thumbnails by default. Will work for "thumbnail" size if the crop checkbox isn't checked under Media Settings).
193 | * Thumbnails are appended with "-pte" to differentiate images created with this plugin
194 |
195 | = 0.1.1 =
196 | * Fixed IE8/firefox javascript errors
197 |
198 | = 0.1 =
199 | * Initial cut
200 |
201 | == Upgrade Notice ==
202 |
203 | = 2.4.7 =
204 | Some bug fixes - thanks @nate-allen
205 |
--------------------------------------------------------------------------------
/apps/requirejs/i18n.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license RequireJS i18n 2.0.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3 | * Available via the MIT or new BSD license.
4 | * see: http://github.com/requirejs/i18n for details
5 | */
6 | /*jslint regexp: true */
7 | /*global require: false, navigator: false, define: false */
8 |
9 | /**
10 | * This plugin handles i18n! prefixed modules. It does the following:
11 | *
12 | * 1) A regular module can have a dependency on an i18n bundle, but the regular
13 | * module does not want to specify what locale to load. So it just specifies
14 | * the top-level bundle, like "i18n!nls/colors".
15 | *
16 | * This plugin will load the i18n bundle at nls/colors, see that it is a root/master
17 | * bundle since it does not have a locale in its name. It will then try to find
18 | * the best match locale available in that master bundle, then request all the
19 | * locale pieces for that best match locale. For instance, if the locale is "en-us",
20 | * then the plugin will ask for the "en-us", "en" and "root" bundles to be loaded
21 | * (but only if they are specified on the master bundle).
22 | *
23 | * Once all the bundles for the locale pieces load, then it mixes in all those
24 | * locale pieces into each other, then finally sets the context.defined value
25 | * for the nls/colors bundle to be that mixed in locale.
26 | *
27 | * 2) A regular module specifies a specific locale to load. For instance,
28 | * i18n!nls/fr-fr/colors. In this case, the plugin needs to load the master bundle
29 | * first, at nls/colors, then figure out what the best match locale is for fr-fr,
30 | * since maybe only fr or just root is defined for that locale. Once that best
31 | * fit is found, all of its locale pieces need to have their bundles loaded.
32 | *
33 | * Once all the bundles for the locale pieces load, then it mixes in all those
34 | * locale pieces into each other, then finally sets the context.defined value
35 | * for the nls/fr-fr/colors bundle to be that mixed in locale.
36 | */
37 | (function () {
38 | 'use strict';
39 |
40 | //regexp for reconstructing the master bundle name from parts of the regexp match
41 | //nlsRegExp.exec("foo/bar/baz/nls/en-ca/foo") gives:
42 | //["foo/bar/baz/nls/en-ca/foo", "foo/bar/baz/nls/", "/", "/", "en-ca", "foo"]
43 | //nlsRegExp.exec("foo/bar/baz/nls/foo") gives:
44 | //["foo/bar/baz/nls/foo", "foo/bar/baz/nls/", "/", "/", "foo", ""]
45 | //so, if match[5] is blank, it means this is the top bundle definition.
46 | var nlsRegExp = /(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;
47 |
48 | //Helper function to avoid repeating code. Lots of arguments in the
49 | //desire to stay functional and support RequireJS contexts without having
50 | //to know about the RequireJS contexts.
51 | function addPart(locale, master, needed, toLoad, prefix, suffix) {
52 | if (master[locale]) {
53 | needed.push(locale);
54 | if (master[locale] === true || master[locale] === 1) {
55 | toLoad.push(prefix + locale + '/' + suffix);
56 | }
57 | }
58 | }
59 |
60 | function addIfExists(req, locale, toLoad, prefix, suffix) {
61 | var fullName = prefix + locale + '/' + suffix;
62 | if (require._fileExists(req.toUrl(fullName + '.js'))) {
63 | toLoad.push(fullName);
64 | }
65 | }
66 |
67 | /**
68 | * Simple function to mix in properties from source into target,
69 | * but only if target does not already have a property of the same name.
70 | * This is not robust in IE for transferring methods that match
71 | * Object.prototype names, but the uses of mixin here seem unlikely to
72 | * trigger a problem related to that.
73 | */
74 | function mixin(target, source, force) {
75 | var prop;
76 | for (prop in source) {
77 | if (source.hasOwnProperty(prop) && (!target.hasOwnProperty(prop) || force)) {
78 | target[prop] = source[prop];
79 | } else if (typeof source[prop] === 'object') {
80 | if (!target[prop] && source[prop]) {
81 | target[prop] = {};
82 | }
83 | mixin(target[prop], source[prop], force);
84 | }
85 | }
86 | }
87 |
88 | define(['module'], function (module) {
89 | var masterConfig = module.config ? module.config() : {};
90 |
91 | return {
92 | version: '2.0.4',
93 | /**
94 | * Called when a dependency needs to be loaded.
95 | */
96 | load: function (name, req, onLoad, config) {
97 | config = config || {};
98 |
99 | if (config.locale) {
100 | masterConfig.locale = config.locale;
101 | }
102 |
103 | var masterName,
104 | match = nlsRegExp.exec(name),
105 | prefix = match[1],
106 | locale = match[4],
107 | suffix = match[5],
108 | parts = locale.split("-"),
109 | toLoad = [],
110 | value = {},
111 | i, part, current = "";
112 |
113 | //If match[5] is blank, it means this is the top bundle definition,
114 | //so it does not have to be handled. Locale-specific requests
115 | //will have a match[4] value but no match[5]
116 | if (match[5]) {
117 | //locale-specific bundle
118 | prefix = match[1];
119 | masterName = prefix + suffix;
120 | } else {
121 | //Top-level bundle.
122 | masterName = name;
123 | suffix = match[4];
124 | locale = masterConfig.locale;
125 | if (!locale) {
126 | locale = masterConfig.locale =
127 | typeof navigator === "undefined" ? "root" :
128 | (navigator.language ||
129 | navigator.userLanguage || "root").toLowerCase();
130 | }
131 | parts = locale.split("-");
132 | }
133 |
134 | if (config.isBuild) {
135 | //Check for existence of all locale possible files and
136 | //require them if exist.
137 | toLoad.push(masterName);
138 | addIfExists(req, "root", toLoad, prefix, suffix);
139 | for (i = 0; i < parts.length; i++) {
140 | part = parts[i];
141 | current += (current ? "-" : "") + part;
142 | addIfExists(req, current, toLoad, prefix, suffix);
143 | }
144 |
145 | req(toLoad, function () {
146 | onLoad();
147 | });
148 | } else {
149 | //First, fetch the master bundle, it knows what locales are available.
150 | req([masterName], function (master) {
151 | //Figure out the best fit
152 | var needed = [],
153 | part;
154 |
155 | //Always allow for root, then do the rest of the locale parts.
156 | addPart("root", master, needed, toLoad, prefix, suffix);
157 | for (i = 0; i < parts.length; i++) {
158 | part = parts[i];
159 | current += (current ? "-" : "") + part;
160 | addPart(current, master, needed, toLoad, prefix, suffix);
161 | }
162 |
163 | //Load all the parts missing.
164 | req(toLoad, function () {
165 | var i, partBundle, part;
166 | for (i = needed.length - 1; i > -1 && needed[i]; i--) {
167 | part = needed[i];
168 | partBundle = master[part];
169 | if (partBundle === true || partBundle === 1) {
170 | partBundle = req(prefix + part + '/' + suffix);
171 | }
172 | mixin(value, partBundle);
173 | }
174 |
175 | //All done, notify the loader.
176 | onLoad(value);
177 | });
178 | });
179 | }
180 | }
181 | };
182 | });
183 | }());
184 |
--------------------------------------------------------------------------------
/js/controllers/CropCtrl.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'cs!apps/pteApp'
3 | 'cs!jcrop-api'
4 | 'cs!jquery'
5 | 'cs!settings'
6 | ], (app, jcrop, $, settings) ->
7 | app.controller "CropCtrl", ['$scope','$log', ($scope, $log) ->
8 | $scope.$watch 'pteCropSave', (x,y) ->
9 | if x is y
10 | return
11 |
12 | $scope.updateOptions
13 | 'pte_crop_save': if $scope.pteCropSave then 'true' else 'false'
14 |
15 | return
16 |
17 | $scope.userDisabledFitCrop = false
18 | $scope.$watch 'aspectRatio', ->
19 | ar = $scope.aspectRatio || null
20 | if ar is null
21 | if $scope.userDisabledFitCrop
22 | $scope.setInfoMessage $scope.i18n.crop_problems
23 | # Set the fit to crop automatically
24 | else
25 | $scope.pteFitCrop = true
26 | $scope.pteFitCropColor = settings.i18n.transparent
27 | jcrop.setOptions
28 | aspectRatio: ar
29 | return
30 |
31 | $scope.$watch 'cropConstraints', ->
32 | cropConstraints = $scope.cropConstraints || [null, null, false]
33 | jcrop.setOptions
34 | cropConstraints: cropConstraints
35 | return
36 |
37 |
38 | $scope.changeAR = ->
39 | $scope.userChanged = true
40 |
41 | $scope.toggleOptions = ->
42 | $scope.cropOptions = !$scope.cropOptions
43 | if !$scope.cropOptions
44 | $scope.aspectRatio = null
45 | $scope.userChanged = false
46 | $scope.pteJpgCompression = null
47 | $scope.updateSelected()
48 | return
49 |
50 | $scope.fitToCrop = (e) ->
51 | if !$( "#pteFitCrop" ).prop('checked')
52 | $scope.userDisabledFitCrop = true
53 | $scope.setInfoMessage $scope.i18n.crop_problems
54 | return
55 |
56 | color = $scope.pteFitCropColor || ""
57 | $("#pte-iris-dialog").find("input").val(color).iris
58 | hide: false
59 | .end().dialog
60 | dialogClass: "wp-dialog"
61 | buttons: [
62 | text: settings.i18n.fitCrop_transparent
63 | click: ->
64 | $scope.$apply "pteFitCropColor = '"+ settings.i18n.transparent + "'"
65 | $( this ).dialog( 'close' )
66 | ,
67 | text: settings.i18n.fitCrop_save
68 | click: ->
69 | $scope.$apply "pteFitCropColor = '" + $( "input", this ).val() + "'"
70 | $( this ).dialog( 'close' )
71 | ]
72 | return
73 |
74 | ###
75 | # Change the AspectRatio based on the selected thumbnails
76 | #
77 | # This will create some interesting issues with the new option that
78 | # allows the user to manually set the aspectRatio, so I need to step
79 | # through the different options and it would be a good idea to actually
80 | # create some sort of a unit test to verify that they actually work.
81 | #
82 | # 1. If the user has previously selected an AR, this is the default AR
83 | # until the user closes the options. If the user clears the AR
84 | # manually with the refresh button, respect that.
85 | #
86 | # 2. If wordpress' crop setting is set then set the AR.
87 | #
88 | # 3. In order to set the AR, each selected thumbnail needs to have the
89 | # same AR.
90 | #
91 | # 4. For the default AR: Use the original images width/height
92 | #
93 | ###
94 | $scope.updateSelected = ->
95 | $scope.setInfoMessage null
96 | # Respect the user setting (#1)
97 | if $scope.userChanged
98 | return
99 |
100 | ar = null
101 | cropConstraints = [null, null, false]
102 | try
103 | selected = false
104 | for thumbnail in $scope.thumbnails
105 | # Get the crop/width/height and convert to numerals
106 | {crop, width, height} = thumbnail
107 | crop = +crop
108 | width = +width
109 | height = +height
110 | tmp_ar = width/height
111 |
112 | if thumbnail.selected
113 | [cropW, cropH, isAR] = cropConstraints
114 | if !cropW or (0 < width and cropW < width)
115 | cropW = width
116 | if !cropH or (0 < height and cropH < height)
117 | cropH = height
118 | isAR = isAR or crop
119 | cropConstraints = [cropW, cropH, isAR]
120 | selected = true
121 |
122 | # Check Wordpress Crop setting (#2)
123 | if thumbnail.selected and crop > 0
124 | # Every AR should be the same (#3)
125 | if ar isnt null and (tmp_ar + 0.01 < ar or ar < tmp_ar - 0.01)
126 | throw "PTE_EXCEPTION"
127 | ar = tmp_ar
128 |
129 | # (#4) Set the default
130 | if ar is null and selected is false
131 | ar = settings.width/settings.height
132 | catch error
133 | ar = null
134 |
135 | $scope.aspectRatio = ar
136 | $scope.cropConstraints = cropConstraints
137 | return # end updateSelected
138 |
139 | ###
140 | # Submit Crop to server
141 | ###
142 | $scope.submitCrop = ->
143 | if $scope.cropInProgress
144 | return
145 | $scope.cropInProgress = true
146 | # Check that there are thumbnails actually selected...
147 | selected_thumbs = $.map $scope.thumbnails, (thumb, i) ->
148 | if thumb.selected
149 | return thumb.name
150 | else
151 | return null
152 | if selected_thumbs.length is 0
153 | $scope.setErrorMessage $scope.i18n.no_t_selected
154 | $log.error $scope.i18n.no_t_selected
155 | $scope.cropInProgress = false
156 | return
157 |
158 | {x, y, w, h, x2, y2} = jcrop.tellSelect()
159 | if x is 0 and
160 | y is 0 and
161 | w is 0 and
162 | h is 0 and
163 | x2 is 0 and
164 | y2 is 0
165 | $scope.setErrorMessage $scope.i18n.no_c_selected
166 | $log.error $scope.i18n.no_c_selected
167 | $scope.cropInProgress = false
168 | return
169 |
170 | crop_options =
171 | 'pte-action': 'resize-images'
172 | 'id': settings.id
173 | 'pte-sizes[]': selected_thumbs
174 | 'w':w
175 | 'h':h
176 | 'x':x
177 | 'y':y
178 | 'pte-nonce': settings.nonce
179 |
180 | if $scope.pteCropSave
181 | crop_options['save'] = 'true'
182 |
183 | if 0 <= +$scope.pteJpgCompression <= 100
184 | crop_options['pte-jpeg-compression'] = $scope.pteJpgCompression
185 |
186 | # If the user wants to fit the crop to the thumbnail size, set the background color here
187 | if $scope.pteFitCrop
188 | color = $scope.pteFitCropColor || ""
189 | color = "" if color is settings.i18n.transparent
190 | crop_options[ 'pte-fit-crop-color' ] = color
191 |
192 | crop_results = $scope.thumbnailResource.get crop_options, ->
193 | $scope.cropInProgress = false
194 |
195 | if crop_results?.immediate
196 | return $scope.confirmResults crop_results
197 |
198 | $scope.setNonces
199 | 'pte-nonce': crop_results['pte-nonce']
200 | 'pte-delete-nonce': crop_results['pte-delete-nonce']
201 |
202 | $.each $scope.thumbnails, (i, thumb) ->
203 | if crop_results.thumbnails[thumb.name]
204 | proposed =
205 | url: crop_results.thumbnails[thumb.name].url
206 | file: crop_results.thumbnails[thumb.name].file
207 | thumb.proposed = proposed
208 | thumb.showProposed = true
209 | return
210 | $scope.view on
211 | return
212 |
213 | return # end submitCrop
214 |
215 | #$scope.thumbnailObject = $scope.thumbnailResource.get {id: id}, ->
216 |
217 | # For Crop and Save
218 | $scope.cropText = ->
219 | if $scope.pteCropSave is on
220 | return $scope.i18n.cropSave
221 | return $scope.i18n.crop
222 |
223 | ###
224 | # Listener
225 | ###
226 | $scope.$on 'thumbnail_selected', (event) ->
227 | $scope.updateSelected()
228 | return
229 |
230 | $scope.updateSelected()
231 | return
232 | ]
233 | return app
234 |
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-pl_PL.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2013 Post Thumbnail Editor
2 | # This file is distributed under the same license as the Post Thumbnail Editor package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Post Thumbnail Editor 2.0.0\n"
6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7 | "POT-Creation-Date: 2015-06-16 11:57+0100\n"
8 | "PO-Revision-Date: 2015-06-16 11:57+0100\n"
9 | "Last-Translator: Batek Florczak \n"
10 | "Language-Team: Bartosz Florczak \n"
11 | "Language: pl\n"
12 | "MIME-Version: 1.0\n"
13 | "Content-Type: text/plain; charset=UTF-8\n"
14 | "Content-Transfer-Encoding: 8bit\n"
15 | "X-Generator: Poedit 1.8.1\n"
16 | "X-Poedit-Basepath: ..\\\n"
17 | "X-Poedit-KeywordsList: _e;__\n"
18 | "X-Poedit-SearchPath-0: .\n"
19 | "X-Poedit-SearchPathExcluded-0: js-build\n"
20 |
21 | #: html/pte.php:23
22 | msgid "No thumbnails selected"
23 | msgstr "Nie wybrano miniatur"
24 |
25 | #: html/pte.php:24
26 | msgid "No crop selected"
27 | msgstr "Nie zaznaczono obszaru kadrowania"
28 |
29 | #: html/pte.php:25
30 | msgid "Cropping will likely result in skewed imagery"
31 | msgstr "Kadrowanie może doprowadzić do zniekształceń"
32 |
33 | #: html/pte.php:26
34 | msgid "There was a problem saving the crop..."
35 | msgstr "Wystąpił problem z zapisem kadru..."
36 |
37 | #: html/pte.php:27 php/options.php:22
38 | msgid "Crop and Save"
39 | msgstr "Przytnij i zapisz"
40 |
41 | #: html/pte.php:28 html/pte.php:52
42 | msgid "Crop"
43 | msgstr "Przycinanie"
44 |
45 | #: html/pte.php:29 html/pte.php:201
46 | msgid "Save"
47 | msgstr "Zapisz"
48 |
49 | #: html/pte.php:30
50 | msgid "Set transparent"
51 | msgstr "Przezroczyste"
52 |
53 | #: html/pte.php:31
54 | msgid "transparent/white"
55 | msgstr "przezroczysty / biały"
56 |
57 | #: html/pte.php:46 php/options.php:79 post-thumbnail-editor.php:211
58 | #: post-thumbnail-editor.php:340 post-thumbnail-editor.php:393
59 | #: post-thumbnail-editor.php:394 post-thumbnail-editor.php:400
60 | #: post-thumbnail-editor.php:401 post-thumbnail-editor.php:444
61 | msgid "Post Thumbnail Editor"
62 | msgstr "Edytor Ikon Wpisu"
63 |
64 | #: html/pte.php:47
65 | msgid "crop and resize"
66 | msgstr "przytnij i pomniejsz"
67 |
68 | #: html/pte.php:53
69 | msgid "View"
70 | msgstr "Zobacz"
71 |
72 | #: html/pte.php:85
73 | msgid "Options"
74 | msgstr "Opcje"
75 |
76 | #: html/pte.php:101
77 | msgid "Aspect Ratio"
78 | msgstr "Proporcje Obrazu"
79 |
80 | #: html/pte.php:104
81 | msgid "width/height"
82 | msgstr "szerokość/wysokość"
83 |
84 | #: html/pte.php:110
85 | msgid "Crop and save"
86 | msgstr "Przytnij i zapisz"
87 |
88 | #: html/pte.php:119
89 | msgid "Change the current thumbnails position:"
90 | msgstr "Zmień bieżącą pozycję miniatury:"
91 |
92 | #: html/pte.php:122 php/options.php:54
93 | msgid "JPEG Compression"
94 | msgstr "Kompresja JPEG"
95 |
96 | #: html/pte.php:126
97 | #, php-format
98 | msgid "0 to 100 (Default: %d)"
99 | msgstr "0 do 100 (Domyślnie:% d)"
100 |
101 | #: html/pte.php:135
102 | msgid "Fit crop to thumbnail by adding border"
103 | msgstr "Przytnij do miniatury dodając ramkę"
104 |
105 | #: html/pte.php:157 php/options.php:49 post-thumbnail-editor.php:361
106 | msgid "Thumbnails"
107 | msgstr "Miniatury"
108 |
109 | #: html/pte.php:158
110 | msgid "width"
111 | msgstr "szerokość"
112 |
113 | #: html/pte.php:158
114 | msgid "W"
115 | msgstr "Sz."
116 |
117 | #: html/pte.php:159
118 | msgid "height"
119 | msgstr "Wysokość"
120 |
121 | #: html/pte.php:159
122 | msgid "H"
123 | msgstr "Wys."
124 |
125 | #: html/pte.php:160
126 | msgid "crop"
127 | msgstr "przycinanie"
128 |
129 | #: html/pte.php:160
130 | msgid "C"
131 | msgstr "Przyc."
132 |
133 | #: html/pte.php:166
134 | msgid "Save all"
135 | msgstr "Zapisz wszystko"
136 |
137 | #: html/pte.php:171
138 | msgid "Reset all"
139 | msgstr "Zresetuj wszystko"
140 |
141 | #: html/pte.php:175
142 | msgid "View all/modified"
143 | msgstr "Zobacz wszystkie/zmodyfikowane"
144 |
145 | #: html/pte.php:204
146 | msgid "Reset"
147 | msgstr "Zresetuj"
148 |
149 | #: html/pte.php:207
150 | msgid "Compare/View"
151 | msgstr "Porównaj/Zobacz"
152 |
153 | #: html/pte.php:214
154 | msgid "These thumbnails have an aspect ratio set:"
155 | msgstr "Proporcje miniatur:"
156 |
157 | #: html/pte.php:223
158 | msgid "Current Thumbnails"
159 | msgstr "Obecne miniatury"
160 |
161 | #: html/pte.php:253
162 | msgid "Original"
163 | msgstr "Oryginał"
164 |
165 | #: html/pte.php:260
166 | msgid "No image has been generated yet for image: "
167 | msgstr "Nie wygenerowano jeszcze obrazu dla pliku:"
168 |
169 | #: html/pte.php:267
170 | msgid "Proposed"
171 | msgstr "Propozycja"
172 |
173 | #: php/class-pte-image-editor-gd.php:65 php/class-pte-image-editor-imagick.php:61
174 | msgid "Image crop failed."
175 | msgstr "Przycinanie nie powiodło się"
176 |
177 | #: php/functions.php:110
178 | msgid "Thumbnail"
179 | msgstr "Miniatura"
180 |
181 | #: php/functions.php:111
182 | msgid "Medium"
183 | msgstr "Średni"
184 |
185 | #: php/functions.php:112
186 | msgid "Large"
187 | msgstr "Duży"
188 |
189 | #: php/functions.php:113
190 | msgid "Full Size"
191 | msgstr "Pełny rozmiar"
192 |
193 | #: php/functions.php:241
194 | #, php-format
195 | msgid "Invalid meta data for POST #%d: %s"
196 | msgstr "Błędne dane POST #%d: %s"
197 |
198 | #: php/functions.php:246
199 | msgid "Please contact support"
200 | msgstr "Proszę skontaktować się z pomocą techniczną"
201 |
202 | #: php/log.php:16
203 | msgid "ERROR"
204 | msgstr "BŁĄD"
205 |
206 | #: php/log.php:19
207 | msgid "WARNING"
208 | msgstr "OSTRZEŻENIE"
209 |
210 | #: php/log.php:22
211 | msgid "INFO"
212 | msgstr "INFO"
213 |
214 | #: php/log.php:25
215 | msgid "DEBUG"
216 | msgstr "DEBUGOWANIE"
217 |
218 | #: php/log.php:222
219 | #, php-format
220 | msgid "ERROR Logging Message: %s"
221 | msgstr "BŁĄD logowania wiadomości: %s"
222 |
223 | #: php/options.php:11
224 | msgid "User Options"
225 | msgstr "Opcje użytkownika"
226 |
227 | #: php/options.php:16
228 | msgid "Debug"
229 | msgstr "Debugowanie"
230 |
231 | #: php/options.php:28
232 | msgid "Crop Picture Size"
233 | msgstr "Wielkość kadrowanego obrazka"
234 |
235 | #: php/options.php:34
236 | msgid "Reset to defaults"
237 | msgstr "Przywróć do stanu pierwotnego"
238 |
239 | #: php/options.php:45
240 | msgid "Site Options"
241 | msgstr "Opcje Strony"
242 |
243 | #: php/options.php:59
244 | msgid "Cache Buster"
245 | msgstr "Cache Buster"
246 |
247 | #: php/options.php:101
248 | msgid ""
249 | "Only users with the 'manage_options' capability may make changes to these settings."
250 | msgstr ""
251 | "Tylko użytkownicy z uprawnieniami na poziomie 'manage_options' mogą zmieniać te "
252 | "ustawienia."
253 |
254 | #: php/options.php:127
255 | msgid "JPEG Compression needs to be set from 0 to 100."
256 | msgstr "Kompresja JPEG powinna mieścić się w zakresie 0 do 100."
257 |
258 | #: php/options.php:165
259 | msgid "Crop Size must be between 0 and 10000."
260 | msgstr "Obszar kadrowania musi wynosić pomiędzy 0 a 10000."
261 |
262 | #: php/options.php:184
263 | msgid "Enable debugging"
264 | msgstr "Włącz debugowanie"
265 |
266 | #: php/options.php:187
267 | msgid ""
268 | "WP_DEBUG is currently set to true and will override this setting. (debug is enabled)"
269 | msgstr "WP_DEBUG jest ustawiona na \"true\" i nadpisuje to ustawienie."
270 |
271 | #: php/options.php:194
272 | #, php-format
273 | msgid "Use ChromePhp for log output"
274 | msgstr "Użyj ChromePhp dla logów."
275 |
276 | #: php/options.php:202
277 | #, php-format
278 | msgid "Write log output to a file"
279 | msgstr "Zapisz log do pliku"
280 |
281 | #: php/options.php:217
282 | msgid "I know what I'm doing, bypass the image verification."
283 | msgstr "Wiem co robię, pomiń weryfikację obrazka."
284 |
285 | #: php/options.php:230
286 | msgid "Set the max size for the crop image."
287 | msgstr "Ustaw maksymalny rozmiar kadrowanego obrazka."
288 |
289 | #: php/options.php:231
290 | msgid "No entry defaults to 600"
291 | msgstr "Puste pole oznacza domyślne 600"
292 |
293 | #: php/options.php:238
294 | msgid ""
295 | "Check this to save the generated working image to disk instead of creating on the "
296 | "fly (experimental)"
297 | msgstr ""
298 | "Zaznacz aby zapisać wersję roboczą generowanego pliku na dysku, zamiast tworzyć go w "
299 | "locie (funkcja eksperymentalna)"
300 |
301 | #: php/options.php:275
302 | msgid "Post Thumbnail"
303 | msgstr "Ikona Wpisu"
304 |
305 | #: php/options.php:276
306 | msgid "Hidden"
307 | msgstr "Ukryte"
308 |
309 | #: php/options.php:306
310 | msgid "Set the compression level for resizing jpeg images (0 to 100)."
311 | msgstr "Ustaw poziom kompresji dla zmienianych obrazów (0 do 100)."
312 |
313 | #: php/options.php:307
314 | msgid "No entry defaults to using the 'jpeg_quality' filter or 90"
315 | msgstr "Brak domyślnego ustawienia filtra ' 'jpeg_quality'"
316 |
317 | #: php/options.php:319
318 | msgid "Append timestamp to filename. Useful for solving caching problems."
319 | msgstr ""
320 | "Dodaj znacznik czasu do pliku. Użyteczne w przypadku problemów z pamięcią podręczną."
321 |
322 | #: php/options.php:330
323 | msgid "These site-wide settings can only be changed by an administrator"
324 | msgstr "Te ustawienia mogą być zmieniane tylko przez administratora"
325 |
326 | #: post-thumbnail-editor.php:360
327 | msgid "Edit Thumbnails"
328 | msgstr "Edytuj Miniatury"
329 |
330 | #~ msgid "Save Changes"
331 | #~ msgstr "Zapisz Zmiany"
332 |
333 | #~ msgid "Reset User Options"
334 | #~ msgstr "Zresetuj Opcje Użytkownika"
335 |
336 | #~ msgid "http://sewpafly.github.io/post-thumbnail-editor/"
337 | #~ msgstr "http://sewpafly.github.io/post-thumbnail-editor/"
338 |
339 | #~ msgid "Individually manage your post thumbnails"
340 | #~ msgstr "Osobno zarządzaj ikonami wpisów"
341 |
342 | #~ msgid "sewpafly"
343 | #~ msgstr "sewpafly"
344 |
345 | #~ msgid "WP_DEBUG is currently set to true and will override this setting."
346 | #~ msgstr "WP_DEBUG jest ustawiona na true i nadpisuje to ustawienie."
347 |
348 | #~ msgid "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
349 | #~ msgstr "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
350 |
351 | #~ msgid "http://sewpafly.github.com/post-thumbnail-editor"
352 | #~ msgstr "http://sewpafly.github.com/post-thumbnail-editor"
353 |
--------------------------------------------------------------------------------
/js/controllers/PteCtrl.coffee:
--------------------------------------------------------------------------------
1 | define [
2 | 'angular'
3 | 'cs!apps/pteApp'
4 | 'cs!settings'
5 | 'cs!jquery'
6 | ], (angular, app, settings, $) ->
7 | app.controller "PteCtrl", ['$scope','$resource','$log', '$filter', ($scope, $resource, $log, $filter) ->
8 | ###
9 | # Page handling feature
10 | #
11 | # Switch the enabled page to change the view
12 | ###
13 | $scope.page =
14 | loading: on
15 | crop: off
16 | view: off
17 | $scope.changePage = (page) ->
18 | $scope.viewFilterValue = off
19 | for key, value of $scope.page
20 | if key == page
21 | $scope.page[key] = on
22 | else
23 | $scope.page[key] = off
24 |
25 | ###
26 | # Set the Tab Class to active when the page is enabled
27 | #
28 | # This is watched by the view on a ng-class directive.
29 | ###
30 | $scope.pageClass = (page) ->
31 | if $scope.page[page]
32 | return "nav-tab-active"
33 |
34 | ###
35 | # Resource
36 | ###
37 | $scope.thumbnailResource = $resource settings.ajaxurl,
38 | 'action': 'pte_ajax'
39 | 'pte-action': 'get-thumbnail-info'
40 |
41 | ###
42 | # Catch the thumbnail selected event and broadcast to all the children scopes
43 | ###
44 | #$scope.$on 'thumbnail_selected', (event, thumbs) ->
45 | # $scope.$broadcast 'thumbnail_selected', thumbs
46 | # return
47 |
48 | ###
49 | # Publish selected event
50 | ###
51 | $scope.updateSelected = ->
52 | $scope.$broadcast 'thumbnail_selected'
53 |
54 |
55 | ###
56 | # Update options
57 | #
58 | # Use this to update user/site options
59 | ###
60 | $scope.updateOptions = (update_options) ->
61 | update_options['pte-action'] = 'change-options'
62 | update_options['pte-nonce'] = settings.options_nonce
63 | $log.log "Updating Options", update_options
64 |
65 | updated = $scope.thumbnailResource.get update_options, ->
66 | $log.log "Updated options"
67 | return
68 |
69 |
70 | ###
71 | # ViewFilter is a filter expression that checks if the viewFilter specifies
72 | # certain thumbnail names to display or if it should just be all modified.
73 | #
74 | # Using the tab buttons will reset this feature.
75 | ###
76 | $scope.viewFilterValue = off
77 | $scope.view = (val) ->
78 | event?.stopPropagation?()
79 | $scope.changePage('view')
80 | $scope.viewFilterValue = val
81 | return
82 | $scope.viewFilterFunc = (thumbnail) ->
83 | if $scope.viewFilterValue is off
84 | return true
85 | if angular.isString $scope.viewFilterValue
86 | if thumbnail.name is $scope.viewFilterValue
87 | return true
88 | else
89 | return false
90 | if angular.isArray $scope.viewFilterValue
91 | # check if thumbnail.name is in array
92 | if thumbnail.name in $scope.viewFilterValue
93 | return true
94 | # This sets the view to show only the recently changed images
95 | if $scope.viewFilterValue
96 | return thumbnail.proposed?
97 | return true
98 |
99 | ###
100 | # SAVE
101 | ###
102 | $scope.save = (thumbnail) ->
103 | #event?.stopPropagation?()
104 | #$log.log thumbnail_array
105 | data =
106 | 'pte-action': 'confirm-images'
107 | 'pte-nonce': nonces['pte-nonce']
108 | id: id
109 | thumbnail_array = []
110 | if !thumbnail
111 | angular.forEach $scope.thumbnails, (thumb) ->
112 | if thumb.proposed
113 | thumbnail_array.push thumb
114 | return
115 | if thumbnail_array.length < 1
116 | return
117 | else
118 | thumbnail_array.push thumbnail
119 |
120 | for thumbnail in thumbnail_array
121 | key = 'pte-confirm['+thumbnail.name+']'
122 | data[key] = thumbnail.proposed.file
123 |
124 | $log.log data
125 |
126 | confirm_results = $scope.thumbnailResource.get data, ->
127 | $scope.confirmResults confirm_results
128 |
129 | return
130 |
131 | $scope.confirmResults = (confirm_results) ->
132 | if !confirm_results.thumbnails
133 | $scope.setErrorMessage $scope.i18n.save_crop_problem
134 | return
135 | #$filter('randomizeUrl') {reset: true}
136 | viewFilter = []
137 | resetUrls = []
138 | for thumbnail in $scope.thumbnails
139 | if confirm_results.thumbnails[thumbnail.name]
140 | viewFilter.push thumbnail.name
141 | thumbnail.current = confirm_results.thumbnails[thumbnail.name].current
142 | resetUrls.push thumbnail.current.url
143 | if thumbnail.proposed?.url
144 | resetUrls.push thumbnail.proposed.url
145 | #if !angular.isObject thumbnail.current
146 | # thumbnail.current = {}
147 | #thumbnail.current.url = thumbnail.proposed.url
148 | #thumbnail.selected = false
149 | $scope.trash thumbnail
150 | if confirm_results.immediate
151 | # Change to the view
152 | #$scope.view viewFilter
153 | else
154 | checkFilter()
155 |
156 | $filter('randomizeUrl') {reset: true, urls: resetUrls}
157 | return
158 |
159 |
160 | ###
161 | # Clean up procedures
162 | #
163 | # trash function just removes from view.
164 | # trashAll deletes from server, and we hook into the unload
165 | # event to cleanup after ourselves
166 | ###
167 | $scope.trash = (thumbnail) ->
168 | event?.stopPropagation?()
169 | delete thumbnail.proposed
170 | thumbnail.showProposed = false
171 | # if there aren't any other proposed, set the viewFilter to false
172 | checkFilter()
173 |
174 | # if there aren't any other proposed, set the viewFilter to false
175 | checkFilter = ->
176 | for thumbnail in $scope.thumbnails
177 | if thumbnail.proposed
178 | return
179 | $scope.viewFilterValue = off
180 |
181 | $scope.trashAll = ->
182 | deleteTemp()
183 | angular.forEach $scope.thumbnails, (thumb) ->
184 | $scope.trash thumb
185 | $filter('randomizeUrl') {reset: true}
186 | return
187 |
188 | deleteTemp = ->
189 | if not nonces?['pte-delete-nonce']?
190 | return
191 | deleteResults = $.ajax settings.ajaxurl,
192 | async: false
193 | data:
194 | 'action': 'pte_ajax'
195 | id: id
196 | 'pte-action': 'delete-images'
197 | 'pte-nonce': nonces['pte-delete-nonce']
198 | return
199 |
200 | $(window).unload (event) ->
201 | deleteTemp()
202 | return
203 |
204 |
205 | ###
206 | # Allow selecting based on the aspect ratio
207 | ###
208 | $scope.aspectRatios = []
209 | addToAspectRatios = (thumb) ->
210 | ar = thumb.width/thumb.height
211 |
212 | # Check for valid AspectRatio
213 | if !ar? or ar is Infinity
214 | return
215 |
216 | if !thumb.crop or +thumb.crop < 1
217 | return
218 |
219 | for aspectRatio in $scope.aspectRatios
220 | if ar - 0.01 < aspectRatio.size < ar + 0.01
221 | aspectRatio.thumbnails.push thumb.name
222 | return
223 | $scope.aspectRatios.push
224 | size: ar
225 | thumbnails: [thumb.name]
226 | return
227 |
228 |
229 | ###
230 | # Initialization
231 | ###
232 | id = settings.id
233 | if !id
234 | $log.error "No ID Found"
235 |
236 | $scope.i18n = settings.i18n
237 |
238 | $scope.infoMessage = null
239 | $scope.setInfoMessage = (message) ->
240 | $scope.infoMessage = message
241 |
242 | $scope.errorMessage = null
243 | $scope.setErrorMessage = (message) ->
244 | $scope.errorMessage = message
245 |
246 | nonces = null
247 | $scope.setNonces = (nonceObj) ->
248 | nonces = nonceObj
249 |
250 | ## LOAD THE THUMBNAIL INFORMATION ##
251 | $scope.thumbnails = []
252 | $scope.thumbnailObject = $scope.thumbnailResource.get {id: id}, ->
253 | angular.forEach $scope.thumbnailObject, (thumb, name) ->
254 | if name not in ["$promise", "$resolved"]
255 | thumb.name = name
256 | @thumbnails.push thumb
257 | addToAspectRatios thumb
258 | return
259 | , $scope
260 | $scope.updateSelected()
261 |
262 | # Turn off loading page
263 | $log.info "Disabling loading screen"
264 | $scope.changePage('crop')
265 | return
266 |
267 | $scope.anyProposed = ->
268 | for thumb in $scope.thumbnails
269 | if thumb.proposed?
270 | return true
271 | return false
272 |
273 | ###
274 | # Used to hide/show the existing thumbnails
275 | #
276 | # @since 2.2.0
277 | ###
278 | $scope.anySelected = ->
279 | for thumb in $scope.thumbnails
280 | if thumb.selected
281 | return true
282 | return false
283 |
284 | ###
285 | # Update wordpress option when the currentThumbnailBarPosition changes
286 | ###
287 | $scope.$watch 'currentThumbnailBarPosition', (x,y) ->
288 | if x is y
289 | return
290 |
291 | $scope.updateOptions
292 | 'pte_thumbnail_bar': $scope.currentThumbnailBarPosition
293 |
294 | return
295 |
296 | $scope.toggleCurrentThumbnailBarPosition = ->
297 | positions = ["vertical", "horizontal"]
298 | if $scope.currentThumbnailBarPosition is positions[0]
299 | $scope.currentThumbnailBarPosition = positions[1]
300 | else
301 | $scope.currentThumbnailBarPosition = positions[0]
302 | return
303 |
304 | ### STOP THE MADNESS ###
305 | return
306 | ]
307 | return app
308 |
--------------------------------------------------------------------------------
/i18n/post-thumbnail-editor-it_IT.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2010 Post Thumbnail Editor
2 | # This file is distributed under the same license as the Post Thumbnail Editor package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Post Thumbnail Editor 2.0\n"
6 | "Report-Msgid-Bugs-To: http://wordpress.org/tag/post-thumbnail-editor\n"
7 | "POT-Creation-Date: 2013-03-08 04:51:59+00:00\n"
8 | "PO-Revision-Date: 2013-03-09 17:27+0100\n"
9 | "Last-Translator: \n"
10 | "Language-Team: Marco Rossi \n"
11 | "MIME-Version: 1.0\n"
12 | "Content-Type: text/plain; charset=UTF-8\n"
13 | "Content-Transfer-Encoding: 8bit\n"
14 | "X-Poedit-Language: Italian\n"
15 | "X-Poedit-Country: ITALY\n"
16 | "X-Poedit-SourceCharset: utf-8\n"
17 |
18 | #. #-#-#-#-# post-thumbnail-editor.pot (Post Thumbnail Editor 2.0.0-beta) #-#-#-#-#
19 | #. Plugin Name of the plugin/theme
20 | #: html/pte.php:166
21 | #: php/options.php:55
22 | #: post-thumbnail-editor.php:107
23 | #: post-thumbnail-editor.php:207
24 | #: post-thumbnail-editor.php:208
25 | #: post-thumbnail-editor.php:216
26 | #: post-thumbnail-editor.php:217
27 | msgid "Post Thumbnail Editor"
28 | msgstr "Post Thumbnail Editor"
29 |
30 | #: html/pte.php:167
31 | msgid "crop and resize"
32 | msgstr "Taglia e ridimensiona"
33 |
34 | #: html/pte.php:171
35 | #: html/pte.php:206
36 | msgid "Crop"
37 | msgstr "Taglia"
38 |
39 | #: html/pte.php:172
40 | msgid "View"
41 | msgstr "Vista"
42 |
43 | #: html/pte.php:201
44 | #, fuzzy
45 | msgid "Options"
46 | msgstr "Opzioni utente"
47 |
48 | #: html/pte.php:214
49 | msgid "Aspect Ratio"
50 | msgstr "Proporzioni"
51 |
52 | #: html/pte.php:215
53 | msgid "width/height"
54 | msgstr "larghezza/altezza"
55 |
56 | #: html/pte.php:229
57 | #: php/options.php:37
58 | #: post-thumbnail-editor.php:178
59 | msgid "Thumbnails"
60 | msgstr "Modifica Miniature"
61 |
62 | #: html/pte.php:235
63 | #, fuzzy
64 | msgid "Save all"
65 | msgstr "Registra le modifiche"
66 |
67 | #: html/pte.php:240
68 | #, fuzzy
69 | msgid "Reset all"
70 | msgstr "Ripristina la configurazione iniziale"
71 |
72 | #: html/pte.php:244
73 | msgid "View all/modified"
74 | msgstr "Vedi tutto/modifica"
75 |
76 | #: html/pte.php:263
77 | msgid "Save"
78 | msgstr "Salva"
79 |
80 | #: html/pte.php:266
81 | msgid "Reset"
82 | msgstr "Cancella"
83 |
84 | #: html/pte.php:269
85 | msgid "Compare/View"
86 | msgstr "Compara/Vedi"
87 |
88 | #: html/pte.php:276
89 | #, fuzzy
90 | msgid "These thumbnails have an aspect ratio set:"
91 | msgstr "Scegli le immagini/miniature che vuoi modificare:"
92 |
93 | #: html/pte.php:301
94 | msgid "Original"
95 | msgstr "Originale"
96 |
97 | #: html/pte.php:308
98 | msgid "No image has been generated yet for image: "
99 | msgstr "Non è stata ancora generata nessuna miniatura per l'immagine:"
100 |
101 | #: html/pte.php:315
102 | msgid "Proposed"
103 | msgstr "Proposta"
104 |
105 | #: php/functions.php:239
106 | msgid "Invalid meta data for POST #%d: %s"
107 | msgstr "I meta dati per il POST #%d: %s non sono validi"
108 |
109 | #: php/functions.php:244
110 | msgid "Please contact support"
111 | msgstr "Si prega di contattare il supporto"
112 |
113 | #: php/log.php:15
114 | msgid "ERROR"
115 | msgstr "ERRORE"
116 |
117 | #: php/log.php:18
118 | msgid "WARNING"
119 | msgstr "AVVISO"
120 |
121 | #: php/log.php:21
122 | msgid "DEBUG"
123 | msgstr "DEBUG"
124 |
125 | #: php/log.php:101
126 | msgid "ERROR Logging Message: %s"
127 | msgstr "ERRORE messaggio di logging: %s"
128 |
129 | #: php/options.php:11
130 | msgid "User Options"
131 | msgstr "Opzioni utente"
132 |
133 | #: php/options.php:16
134 | msgid "Debug"
135 | msgstr "Debug"
136 |
137 | #: php/options.php:22
138 | msgid "Reset to defaults"
139 | msgstr "Ripristina la configurazione iniziale"
140 |
141 | #: php/options.php:33
142 | msgid "Site Options"
143 | msgstr "Opzioni del sito"
144 |
145 | #: php/options.php:42
146 | msgid "JPEG Compression"
147 | msgstr "Compressione JPEG"
148 |
149 | #: php/options.php:63
150 | msgid "Save Changes"
151 | msgstr "Registra le modifiche"
152 |
153 | #: php/options.php:77
154 | msgid "Only users with the 'manage_options' capability may make changes to these settings."
155 | msgstr "Solo gli utenti con i permessi di 'manage_options' possono cambiare queste configurazioni."
156 |
157 | #: php/options.php:103
158 | msgid "JPEG Compression needs to be set from 0 to 100."
159 | msgstr "La compressione JPEG dev'essere un valore tra 0 e 100."
160 |
161 | #: php/options.php:129
162 | msgid "Enable debugging"
163 | msgstr "Abilita il debugging"
164 |
165 | #: php/options.php:132
166 | msgid "WP_DEBUG is currently set to true and will override this setting."
167 | msgstr "WP_DEBUG è attualmente attivo e questo sovrascriverà questa configurazione."
168 |
169 | #: php/options.php:143
170 | msgid "Reset User Options"
171 | msgstr "Cancella le opzioni utente"
172 |
173 | #: php/options.php:169
174 | msgid "Post Thumbnail"
175 | msgstr "Tipi di Miniature"
176 |
177 | #: php/options.php:170
178 | msgid "Hidden"
179 | msgstr "Nascondi"
180 |
181 | #: php/options.php:199
182 | msgid "Set the compression level for resizing jpeg images (0 to 100)."
183 | msgstr "Configura il livello di compressione per il ridimensionamento delle immagini jpeg (0-100)."
184 |
185 | #: php/options.php:200
186 | msgid "No entry defaults to using the 'jpeg_quality' filter or 90"
187 | msgstr "Non inserire niente se si vuole usare il filtro 'jpeg_quality' o 90"
188 |
189 | #: php/options.php:210
190 | msgid "These site-wide settings can only be changed by an administrator"
191 | msgstr "Queste impostazioni generali, possono essere cambiate solo dall'amministratore.
Scegli quali, tra le miniature usate nel sito, vuoi mostrare o nascondere nella finestra delle modifiche (di default, sono mostrate)."
192 |
193 | #: post-thumbnail-editor.php:177
194 | msgid "Edit Thumbnails"
195 | msgstr "Modifica Miniature"
196 |
197 | #: post-thumbnail-editor.php:276
198 | msgid "No thumbnails selected"
199 | msgstr "Nessuna miniatura selezionata"
200 |
201 | #: post-thumbnail-editor.php:277
202 | msgid "No crop selected"
203 | msgstr "Nessun taglio selezionato"
204 |
205 | #: post-thumbnail-editor.php:278
206 | msgid "Cropping will likely result in skewed imagery"
207 | msgstr "Il ritaglio porterà ad una immagine alterata"
208 |
209 | #: post-thumbnail-editor.php:279
210 | #, fuzzy
211 | msgid "There was a problem saving the crop..."
212 | msgstr "Spiacente, c'è stato un problema nell'invio a Pastebin"
213 |
214 | #. Plugin URI of the plugin/theme
215 | msgid "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
216 | msgstr "http://wordpress.org/extend/plugins/post-thumbnail-editor/"
217 |
218 | #. Description of the plugin/theme
219 | msgid "Individually manage your post thumbnails"
220 | msgstr "Gestione individuale delle miniature"
221 |
222 | #. Author of the plugin/theme
223 | msgid "sewpafly"
224 | msgstr "sewpafly"
225 |
226 | #. Author URI of the plugin/theme
227 | msgid "http://sewpafly.github.com/post-thumbnail-editor"
228 | msgstr "http://sewpafly.github.com/post-thumbnail-editor"
229 |
230 | #~ msgid "Post Thumbnail Editor - Step 1"
231 | #~ msgstr "Modifica delle miniature - Passo 1"
232 |
233 | #~ msgid "Create Thumbnails"
234 | #~ msgstr "Crea miniatura"
235 |
236 | #~ msgid "Select: %1$sAll%2$s | %3$sNone%4$s"
237 | #~ msgstr "Seleziona: %1$sTutte%2$s | %3$sNessuna%4$s"
238 |
239 | #~ msgid "Current image:"
240 | #~ msgstr "Dimensione Miniatura:"
241 |
242 | #~ msgid "Back"
243 | #~ msgstr "Indietro"
244 |
245 | #~ msgid "Post Thumbnail Editor - Step 2"
246 | #~ msgstr "Modifica delle miniature - Passo 2"
247 |
248 | #~ msgid "We noticed some potential issues:"
249 | #~ msgstr "Abbiamo rilevato alcuni potenziali problemi:"
250 |
251 | #~ msgid "View %1$slogs%2$s for further information"
252 | #~ msgstr "Esamina i %1$slogs%2$s per avere ulteriori informazioni"
253 |
254 | #~ msgid "%1$sEnable debugging%2$s for additional information"
255 | #~ msgstr "%1$sAbilita il debugging%2$s per avere ulteriori informazioni"
256 |
257 | #~ msgid "Select the images you want to keep: %1$sAll%2$s | %3$sNone%4$s"
258 | #~ msgstr ""
259 | #~ "Seleziona le immagini che vuoi mantenere: %1$sTutte%2$s | %3$sNessuna%4$s"
260 |
261 | #~ msgid "Okay, these look good..."
262 | #~ msgstr "Ok, queste vanno bene..."
263 |
264 | #~ msgid "I'd rather start over..."
265 | #~ msgstr "Preferisco riprovare ..."
266 |
267 | #~ msgid "Images were created successfully."
268 | #~ msgstr "Le nuove immagini sono state create perfettamente."
269 |
270 | #~ msgid "Click %1$shere%2$s to modify another thumbnail."
271 | #~ msgstr "Clicca %1$squi%2$s per modificare altre miniature."
272 |
273 | #~ msgid "Please wait"
274 | #~ msgstr "Si prega di attendere"
275 |
276 | #~ msgid "Click here to show application logs"
277 | #~ msgstr "Clicca qui per mostrare i logs dell'applicazione"
278 |
279 | #~ msgid ""
280 | #~ "If you are having any issues with this plugin, create a problem report on "
281 | #~ "%1$sgithub%2$s or %3$swordpress.org%4$s so that I can look into it. Copy "
282 | #~ "these log statements and include some information about what you were "
283 | #~ "trying to do, the expected output, and the output you got (the more "
284 | #~ "information the better). Thanks and good luck!"
285 | #~ msgstr ""
286 | #~ "Se hai problemi con questo plugin, apri un rapporto su %1$sgithub%2$s o %"
287 | #~ "3$swordpress.org%4$s in modo da permettermi di esaminarlo. Copia il testo "
288 | #~ "di questi logs e includi tutte le informazioni necessarie su cosa stavi "
289 | #~ "facendo quando si è verificato il problema, il risultato che ti aspettavi "
290 | #~ "e quello che, invece, hai ottenuto (più informazioni fornisci, meglio "
291 | #~ "sarà).Grazie e buona fortuna!"
292 |
293 | #~ msgid "Send to Pastebin"
294 | #~ msgstr "Invia a Pastebin"
295 |
296 | #~ msgid "Clear Messages"
297 | #~ msgstr "Cancella messaggi"
298 |
299 | #~ msgid "Run Tests"
300 | #~ msgstr "Esegui i tests"
301 |
302 | #~ msgid "Close"
303 | #~ msgstr "Chiudi"
304 |
305 | #~ msgid "Thickbox dimensions"
306 | #~ msgstr "Dimensione Finestra di modifica"
307 |
308 | #~ msgid "Thickbox width must be at least 750 pixels."
309 | #~ msgstr "La larghezza dev'essere almeno di 750 pixels."
310 |
311 | #~ msgid "Thickbox height must be greater than 550 pixels."
312 | #~ msgstr "L'altezza dev'essere almeno di 550 pixels."
313 |
314 | #~ msgid "Width:"
315 | #~ msgstr "Larghezza:"
316 |
317 | #~ msgid "Set this to a value greater than 750."
318 | #~ msgstr "Inserire un valore di almeno 750px ."
319 |
320 | #~ msgid "Height:"
321 | #~ msgstr "Altezza:"
322 |
323 | #~ msgid "Set this to a value greater than 550."
324 | #~ msgstr "Inserire un valore di almeno 550px ."
325 |
326 | #~ msgid "PASTEBIN URL:"
327 | #~ msgstr "PASTEBIN URL:"
328 |
329 | #~ msgid "Disabling aspect ratio"
330 | #~ msgstr "Le miniature selezionate sono di proporzioni diverse"
331 |
--------------------------------------------------------------------------------
/php/options.php:
--------------------------------------------------------------------------------
1 | */
70 | ?>
71 |
78 |
91 | $pte_hidden_sizes );
117 |
118 | // Check the JPEG Compression value
119 | if ( isset($input['pte_jpeg_compression']) && $input['pte_jpeg_compression'] != "" ){
120 | $tmp_jpeg_compression = (int) preg_replace( "/[\D]/", "", $input['pte_jpeg_compression'] );
121 | if ( ! is_int( $tmp_jpeg_compression )
122 | || $tmp_jpeg_compression < 0
123 | || $tmp_jpeg_compression > 100 )
124 | {
125 | add_settings_error('pte_options_site'
126 | , 'pte_options_error'
127 | , __( "JPEG Compression needs to be set from 0 to 100.", PTE_DOMAIN ) . $tmp_jpeg_compression . "/" . $input['pte_jpeg_compression']);
128 | }
129 | $output['pte_jpeg_compression'] = $tmp_jpeg_compression;
130 | }
131 |
132 | // Cache Buster
133 | $output['cache_buster'] = isset( $input['pte_cache_buster'] );
134 |
135 | return $output;
136 | }
137 |
138 | function pte_options_validate( $input ){
139 | $options = pte_get_user_options();
140 |
141 | if ( isset( $input['reset'] ) ){
142 | return array();
143 | }
144 | $checkboxes = array(
145 | 'pte_debug',
146 | 'pte_debug_out_chrome',
147 | 'pte_debug_out_file',
148 | 'pte_crop_save',
149 | 'pte_imgedit_disk',
150 | );
151 |
152 | foreach ($checkboxes as $opt) {
153 | if (isset( $input[$opt] ) )
154 | $options[$opt] = true;
155 | else if (isset($options[$opt]))
156 | unset($options[$opt]);
157 | }
158 |
159 | // Check the imgedit_max_size value
160 | if ( $input['pte_imgedit_max_size'] != "" ){
161 | $tmp_size = (int) preg_replace( "/[\D]/", "", $input['pte_imgedit_max_size'] );
162 | if ( $tmp_size < 0 || $tmp_size > 10000 ) {
163 | add_settings_error( pte_get_option_name()
164 | , 'pte_options_error'
165 | , __( "Crop Size must be between 0 and 10000.", PTE_DOMAIN ) );
166 | }
167 | $options['pte_imgedit_max_size'] = $tmp_size;
168 | }
169 | else{
170 | unset( $options['pte_imgedit_max_size'] );
171 | }
172 |
173 | return $options;
174 | }
175 |
176 | function pte_debug_display(){
177 | $options = pte_get_user_options();
178 | $option_label = pte_get_option_name();
179 | ?>
180 | id="pte_debug"/>
185 | " );
187 | _e( "WP_DEBUG is currently set to true and will override this setting. (debug is enabled)" );
188 | print( "" );
189 | }?>
190 |
191 | id="pte_debug_out_chrome"/>
193 |
194 |
197 |
198 | id="pte_debug_out_file"/>
200 |
201 |
205 |
206 |
213 | id="pte_crop_save"/>
218 |
219 |
226 |
230 |
231 |
232 |
233 |
234 |
237 | id="pte_imgedit_disk">
240 |
241 |
242 |
247 |
250 | 0 ){
256 | if ( $a > $b ){
257 | $a = $a - $b;
258 | }
259 | else {
260 | $b = $b - $a;
261 | }
262 | }
263 | if ( $a < 0 or $b < 0 ){
264 | return null;
265 | }
266 | return $a;
267 | }
268 |
269 | function pte_sizes_display(){
270 | require_once( 'functions.php' );
271 | $options = pte_get_options();
272 |
273 | // Table Header
274 | ?>
275 | ' );
297 | }
298 |
299 | function pte_jpeg_compression_display(){
300 | $options = pte_get_site_options();
301 | ?>
302 |
306 |
307 |
308 |
309 |
315 | id="pte_cache_buster"/>
318 |
321 |
322 |
23 | */
24 | class ChromePhp
25 | {
26 | /**
27 | * @var string
28 | */
29 | const VERSION = '4.1.0';
30 |
31 | /**
32 | * @var string
33 | */
34 | const HEADER_NAME = 'X-ChromeLogger-Data';
35 |
36 | /**
37 | * @var string
38 | */
39 | const BACKTRACE_LEVEL = 'backtrace_level';
40 |
41 | /**
42 | * @var string
43 | */
44 | const LOG = 'log';
45 |
46 | /**
47 | * @var string
48 | */
49 | const WARN = 'warn';
50 |
51 | /**
52 | * @var string
53 | */
54 | const ERROR = 'error';
55 |
56 | /**
57 | * @var string
58 | */
59 | const GROUP = 'group';
60 |
61 | /**
62 | * @var string
63 | */
64 | const INFO = 'info';
65 |
66 | /**
67 | * @var string
68 | */
69 | const GROUP_END = 'groupEnd';
70 |
71 | /**
72 | * @var string
73 | */
74 | const GROUP_COLLAPSED = 'groupCollapsed';
75 |
76 | /**
77 | * @var string
78 | */
79 | const TABLE = 'table';
80 |
81 | /**
82 | * @var string
83 | */
84 | protected $_php_version;
85 |
86 | /**
87 | * @var int
88 | */
89 | protected $_timestamp;
90 |
91 | /**
92 | * @var array
93 | */
94 | protected $_json = array(
95 | 'version' => self::VERSION,
96 | 'columns' => array('log', 'backtrace', 'type'),
97 | 'rows' => array()
98 | );
99 |
100 | /**
101 | * @var array
102 | */
103 | protected $_backtraces = array();
104 |
105 | /**
106 | * @var bool
107 | */
108 | protected $_error_triggered = false;
109 |
110 | /**
111 | * @var array
112 | */
113 | protected $_settings = array(
114 | self::BACKTRACE_LEVEL => 1
115 | );
116 |
117 | /**
118 | * @var ChromePhp
119 | */
120 | protected static $_instance;
121 |
122 | /**
123 | * Prevent recursion when working with objects referring to each other
124 | *
125 | * @var array
126 | */
127 | protected $_processed = array();
128 |
129 | /**
130 | * constructor
131 | */
132 | private function __construct()
133 | {
134 | $this->_php_version = phpversion();
135 | $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time();
136 | $this->_json['request_uri'] = $_SERVER['REQUEST_URI'];
137 | }
138 |
139 | /**
140 | * gets instance of this class
141 | *
142 | * @return ChromePhp
143 | */
144 | public static function getInstance()
145 | {
146 | if (self::$_instance === null) {
147 | self::$_instance = new self();
148 | }
149 | return self::$_instance;
150 | }
151 |
152 | /**
153 | * logs a variable to the console
154 | *
155 | * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
156 | * @return void
157 | */
158 | public static function log()
159 | {
160 | $args = func_get_args();
161 | return self::_log('', $args);
162 | }
163 |
164 | /**
165 | * logs a warning to the console
166 | *
167 | * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
168 | * @return void
169 | */
170 | public static function warn()
171 | {
172 | $args = func_get_args();
173 | return self::_log(self::WARN, $args);
174 | }
175 |
176 | /**
177 | * logs an error to the console
178 | *
179 | * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
180 | * @return void
181 | */
182 | public static function error()
183 | {
184 | $args = func_get_args();
185 | return self::_log(self::ERROR, $args);
186 | }
187 |
188 | /**
189 | * sends a group log
190 | *
191 | * @param string value
192 | */
193 | public static function group()
194 | {
195 | $args = func_get_args();
196 | return self::_log(self::GROUP, $args);
197 | }
198 |
199 | /**
200 | * sends an info log
201 | *
202 | * @param mixed $data,... unlimited OPTIONAL number of additional logs [...]
203 | * @return void
204 | */
205 | public static function info()
206 | {
207 | $args = func_get_args();
208 | return self::_log(self::INFO, $args);
209 | }
210 |
211 | /**
212 | * sends a collapsed group log
213 | *
214 | * @param string value
215 | */
216 | public static function groupCollapsed()
217 | {
218 | $args = func_get_args();
219 | return self::_log(self::GROUP_COLLAPSED, $args);
220 | }
221 |
222 | /**
223 | * ends a group log
224 | *
225 | * @param string value
226 | */
227 | public static function groupEnd()
228 | {
229 | $args = func_get_args();
230 | return self::_log(self::GROUP_END, $args);
231 | }
232 |
233 | /**
234 | * sends a table log
235 | *
236 | * @param string value
237 | */
238 | public static function table()
239 | {
240 | $args = func_get_args();
241 | return self::_log(self::TABLE, $args);
242 | }
243 |
244 | /**
245 | * internal logging call
246 | *
247 | * @param string $type
248 | * @return void
249 | */
250 | protected static function _log($type, array $args)
251 | {
252 | // nothing passed in, don't do anything
253 | if (count($args) == 0 && $type != self::GROUP_END) {
254 | return;
255 | }
256 |
257 | $logger = self::getInstance();
258 |
259 | $logger->_processed = array();
260 |
261 | $logs = array();
262 | foreach ($args as $arg) {
263 | $logs[] = $logger->_convert($arg);
264 | }
265 |
266 | $backtrace = debug_backtrace(false);
267 | $level = $logger->getSetting(self::BACKTRACE_LEVEL);
268 |
269 | $backtrace_message = 'unknown';
270 | if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
271 | $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
272 | }
273 |
274 | $logger->_addRow($logs, $backtrace_message, $type);
275 | }
276 |
277 | /**
278 | * converts an object to a better format for logging
279 | *
280 | * @param Object
281 | * @return array
282 | */
283 | protected function _convert($object)
284 | {
285 | // if this isn't an object then just return it
286 | if (!is_object($object)) {
287 | return $object;
288 | }
289 |
290 | //Mark this object as processed so we don't convert it twice and it
291 | //Also avoid recursion when objects refer to each other
292 | $this->_processed[] = $object;
293 |
294 | $object_as_array = array();
295 |
296 | // first add the class name
297 | $object_as_array['___class_name'] = get_class($object);
298 |
299 | // loop through object vars
300 | $object_vars = get_object_vars($object);
301 | foreach ($object_vars as $key => $value) {
302 |
303 | // same instance as parent object
304 | if ($value === $object || in_array($value, $this->_processed, true)) {
305 | $value = 'recursion - parent object [' . get_class($value) . ']';
306 | }
307 | $object_as_array[$key] = $this->_convert($value);
308 | }
309 |
310 | $reflection = new ReflectionClass($object);
311 |
312 | // loop through the properties and add those
313 | foreach ($reflection->getProperties() as $property) {
314 |
315 | // if one of these properties was already added above then ignore it
316 | if (array_key_exists($property->getName(), $object_vars)) {
317 | continue;
318 | }
319 | $type = $this->_getPropertyKey($property);
320 |
321 | if ($this->_php_version >= 5.3) {
322 | $property->setAccessible(true);
323 | }
324 |
325 | try {
326 | $value = $property->getValue($object);
327 | } catch (ReflectionException $e) {
328 | $value = 'only PHP 5.3 can access private/protected properties';
329 | }
330 |
331 | // same instance as parent object
332 | if ($value === $object || in_array($value, $this->_processed, true)) {
333 | $value = 'recursion - parent object [' . get_class($value) . ']';
334 | }
335 |
336 | $object_as_array[$type] = $this->_convert($value);
337 | }
338 | return $object_as_array;
339 | }
340 |
341 | /**
342 | * takes a reflection property and returns a nicely formatted key of the property name
343 | *
344 | * @param ReflectionProperty
345 | * @return string
346 | */
347 | protected function _getPropertyKey(ReflectionProperty $property)
348 | {
349 | $static = $property->isStatic() ? ' static' : '';
350 | if ($property->isPublic()) {
351 | return 'public' . $static . ' ' . $property->getName();
352 | }
353 |
354 | if ($property->isProtected()) {
355 | return 'protected' . $static . ' ' . $property->getName();
356 | }
357 |
358 | if ($property->isPrivate()) {
359 | return 'private' . $static . ' ' . $property->getName();
360 | }
361 | }
362 |
363 | /**
364 | * adds a value to the data array
365 | *
366 | * @var mixed
367 | * @return void
368 | */
369 | protected function _addRow(array $logs, $backtrace, $type)
370 | {
371 | // if this is logged on the same line for example in a loop, set it to null to save space
372 | if (in_array($backtrace, $this->_backtraces)) {
373 | $backtrace = null;
374 | }
375 |
376 | // for group, groupEnd, and groupCollapsed
377 | // take out the backtrace since it is not useful
378 | if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) {
379 | $backtrace = null;
380 | }
381 |
382 | if ($backtrace !== null) {
383 | $this->_backtraces[] = $backtrace;
384 | }
385 |
386 | $row = array($logs, $backtrace, $type);
387 |
388 | $this->_json['rows'][] = $row;
389 | $this->_writeHeader($this->_json);
390 | }
391 |
392 | protected function _writeHeader($data)
393 | {
394 | header(self::HEADER_NAME . ': ' . $this->_encode($data));
395 | }
396 |
397 | /**
398 | * encodes the data to be sent along with the request
399 | *
400 | * @param array $data
401 | * @return string
402 | */
403 | protected function _encode($data)
404 | {
405 | return base64_encode(utf8_encode(json_encode($data)));
406 | }
407 |
408 | /**
409 | * adds a setting
410 | *
411 | * @param string key
412 | * @param mixed value
413 | * @return void
414 | */
415 | public function addSetting($key, $value)
416 | {
417 | $this->_settings[$key] = $value;
418 | }
419 |
420 | /**
421 | * add ability to set multiple settings in one call
422 | *
423 | * @param array $settings
424 | * @return void
425 | */
426 | public function addSettings(array $settings)
427 | {
428 | foreach ($settings as $key => $value) {
429 | $this->addSetting($key, $value);
430 | }
431 | }
432 |
433 | /**
434 | * gets a setting
435 | *
436 | * @param string key
437 | * @return mixed
438 | */
439 | public function getSetting($key)
440 | {
441 | if (!isset($this->_settings[$key])) {
442 | return null;
443 | }
444 | return $this->_settings[$key];
445 | }
446 | }
447 |
--------------------------------------------------------------------------------