Plugin Directory

Changeset 2194825


Ignore:
Timestamp:
11/17/2019 12:36:07 PM (6 years ago)
Author:
easycontent
Message:

1.0.1 patch update

Location:
easycontent/trunk
Files:
24 added
15 edited

Legend:

Unmodified
Added
Removed
  • easycontent/trunk/app/NoticesManager.php

    r2189682 r2194825  
    2424        }
    2525
    26         $this->notices[$type][] = esc_html( $notice );
     26        $this->notices[$type][] = $notice;
    2727    }
    2828
  • easycontent/trunk/app/Plugin.php

    r2190570 r2194825  
    143143            || 'post-new.php' === $hookSuffix
    144144        ) {
     145            wp_enqueue_style( 'ec-jquery-ui', EASYCONTENT_URL . 'assets/css/vendor/jquery-ui/jquery-ui.min.css', [], EASYCONTENT_PLUGIN_VERSION );
    145146            wp_enqueue_script( 'ec-admin', EASYCONTENT_URL . 'assets/js/admin.js', ['jquery', 'jquery-ui-dialog'], EASYCONTENT_PLUGIN_VERSION );
    146147        }
  • easycontent/trunk/app/Post.php

    r2190570 r2194825  
    201201                ] )
    202202                : ( new Article( $this->getArticle()->id ) )->addNewRevision( [
     203                    'title' => $this->_wpPostObject->post_title,
    203204                    'content' => $this->_wpPostObject->post_content,
    204205                    'meta_title' => $this->getMetaTitle(),
  • easycontent/trunk/app/controllers/actions/main/Import.php

    r2189682 r2194825  
    4040                : null;
    4141
    42             $topicIds = array_map( 'absint', (array)$_POST['ECImportArticlesForm']['topic-ids'] );
     42            $articleIds = isset( $_POST['ECImportArticlesForm']['topic-ids'] )
     43                ? array_map( 'absint', (array)$_POST['ECImportArticlesForm']['topic-ids'] )
     44                : [];
    4345
    4446            $importForm->submit( [
    4547                'newStage' => $newStageId,
    46                 'articleIds' => isset( $_POST['ECImportArticlesForm']['topic-ids'] )
    47                     ? $topicIds
    48                     : []
     48                'articleIds' => $articleIds
    4949            ] );
    5050
  • easycontent/trunk/app/rest/actions/PullArticle.php

    r2189682 r2194825  
    33namespace EasyContent\WordPress\Rest\Actions;
    44
     5use EasyContent\WordPress\Exceptions\EasyContentResponseException;
     6use EasyContent\WordPress\Plugin;
    57use EasyContent\WordPress\Post;
     8use GuzzleHttp\Exception\BadResponseException;
    69
    710class PullArticle extends BaseAction
     
    3235
    3336            return $post->pull();
     37        } catch ( BadResponseException $e ) {
     38            $ecException = new EasyContentResponseException( $e );
     39
     40            if ( $ecException->getCode() == EasyContentResponseException::ARTICLE_NOT_FOUND_CODE ) {
     41                $message  = __( 'Remote article was not found in %s project. Do you want to unlink it from this post? ', EASYCONTENT_TXTDOMAIN );
     42                $message .= __( 'If you unlink it and then push this post to EasyContent, a new article will be created.', EASYCONTENT_TXTDOMAIN );
     43                $message  = sprintf( $message, Plugin::getInstance()->getMisc()->projectName );
     44
     45                return new \WP_Error( $e->getCode(), $message );
     46            }
     47
     48            return new \WP_Error( $e->getCode(), $ecException->getMessage() );
    3449        } catch (\Exception $e) {
    3550            return new \WP_Error( $e->getCode(), $e->getMessage() );
  • easycontent/trunk/assets/css/plugin.css

    r2190570 r2194825  
    6363}
    6464
    65 #ec-push-confirmation-modal {
     65#ec-push-confirmation-modal,
     66#ec-pull-confirmation-modal {
    6667    display: none;
    6768}
  • easycontent/trunk/assets/js/admin.js

    r2190570 r2194825  
    88
    99
    10         var defaults = {
    11             autoOpen: false,
    12             show: true,
    13             hide: true,
    14             minHeight: false,
    15             buttons: [],
    16             draggable: false,
    17             modal: true,
    18             resizable: false
    19         };
    2010
    21         // var $pullArticleDialog = $('#').dialog(defaults);
    22         var $pushArticleDialog = $('#ec-push-confirmation-modal').dialog(defaults);
    23         //
    24         // $('#ec-push-article-button').click(function(e) {
    25         //  e.preventDefault();
    26         //  $pushArticleDialog.dialog('open');
    27         //
    28         //  console.log(e.target);
    29         // });
    30         //
    31         // $('#post').submit(function(e) {
    32         //  e.preventDefault();
    33         //  console.log(e);
    34         // });
     11        function getModalParameters(type) {
     12            var params = {
     13                autoOpen: false,
     14                buttons: [
     15                    {
     16                        text: 'Cancel',
     17                        click: function() {
     18                            $(this).dialog('close');
     19                        }
     20                    }
     21                ],
     22                show: true,
     23                hide: true,
     24                minHeight: false,
     25                draggable: false,
     26                modal: true,
     27                resizable: false
     28            };
     29
     30            var btn = 'push' === type
     31                ? {
     32                    text: 'Push',
     33                    click: function() {
     34                        $mainForm.append(pushInput);
     35                        $mainForm.submit();
     36                        $(this).dialog('close');
     37                    }
     38                }
     39                : {
     40                    text: 'Pull',
     41                    click: function() {
     42                        $mainForm.append(pullInput);
     43                        $mainForm.submit();
     44                        $(this).dialog('close');
     45                    }
     46                };
     47
     48            params.buttons.push(btn);
     49
     50            return params;
     51        }
     52
     53        var pushInput = document.createElement('input');
     54            pushInput.type = 'hidden';
     55            pushInput.name = 'ec_push_post';
     56            pushInput.value = '1';
     57
     58        var pullInput = document.createElement('input');
     59            pullInput.type = 'hidden';
     60            pullInput.name = 'ec_pull_post';
     61            pullInput.value = '1';
     62
     63        var $mainForm = $('#post'),
     64            $pushArticleDialog = $('#ec-push-confirmation-modal').dialog(getModalParameters('push')),
     65            $pullArticleDialog = $('#ec-pull-confirmation-modal').dialog(getModalParameters('pull'));
     66
     67        $('#ec-push-article-button').click(function(e) {
     68            $pushArticleDialog.dialog('open');
     69        });
     70
     71        $('#ec-pull-article-button').click(function(e) {
     72            $pullArticleDialog.dialog('open');
     73        });
    3574
    3675
  • easycontent/trunk/assets/js/gutenberg/build/index.js

    r2189682 r2194825  
    1 !function(e){var t={};function n(s){if(t[s])return t[s].exports;var c=t[s]={i:s,l:!1,exports:{}};return e[s].call(c.exports,c,c.exports,n),c.l=!0,c.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:s})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t,n){var s=n(5);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},c=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(c=c.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),c.forEach(function(t){s(e,t,n[t])})}return e}},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=regeneratorRuntime},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t,n){"use strict";n.r(t);var s=n(11),c=n(0),a=n(1),o=n(10),r=n(4),i=n(8),l=n(2),u="OPEN_MODAL",p="CLOSE_MODAL",d="TOGGLE_MODAL",h={PULL:"PULL",PUSH:"PUSH"};var b=Object(i.compose)(Object(l.withSelect)(function(e,t){var n=e("easycontent-wp-store"),s=n.getArticle,c=n.getModals,a=e("core/editor"),o=a.isSavingPost,r=a.isEditedPostSaveable,i=a.isEditedPostPublishable,l=a.isPostSavingLocked,u=a.isCurrentPostPublished,p=c(),d=!o()&&r()&&!l()&&!i()&&u();return{article:s(),isOpened:p[h.PUSH].isOpened,postCanBePushed:d}}),Object(l.withDispatch)(function(e,t,n){var s=n.select,c=e("easycontent-wp-store"),a=c.closeModal,o=c.pushArticle,r=s("easycontent-wp-store").isDoingAjax;return{close:function(){a(h.PUSH)},push:function(e,t){t&&!r()&&(o(e),a(h.PUSH))}}}))(function(e){var t=e.article,n=e.isOpened,s=e.postCanBePushed,o=e.close,i=e.push;return Object(c.createElement)(c.Fragment,null,n&&s&&Object(c.createElement)(r.Modal,{className:"ec-push-post-modal",onRequestClose:o,title:Object(a.__)("Push post to EasyContent.io?"),closeButtonLabel:Object(a.__)("Close")},Object(c.createElement)("p",null,t.isSynced?Object(a.__)("Are you sure you want to push this post to EasyContent? Any changes in EasyContent will be overwritten."):Object(a.__)("Push this post to EasyContent?")),Object(c.createElement)(r.Button,{isDefault:!0,onClick:o},Object(a.__)("Cancel")),Object(c.createElement)(r.Button,{isPrimary:!0,onClick:function(){return i(t.id,s)}},Object(a.__)("Push"))))}),f=Object(i.compose)(Object(l.withSelect)(function(e,t,n){return{isOpened:(0,e("easycontent-wp-store").getModals)()[h.PULL].isOpened}}),Object(l.withDispatch)(function(e,t,n){var s=n.select,c=e("easycontent-wp-store"),a=c.closeModal,o=c.pullArticle,r=s("easycontent-wp-store"),i=r.isDoingAjax,l=(0,r.getArticle)();return{close:function(){a(h.PULL)},pull:function(){!i()&&l.isSynced&&(o(),a(h.PULL))}}}))(function(e){var t=e.isOpened,n=e.close,s=e.pull;return Object(c.createElement)(c.Fragment,null,t&&Object(c.createElement)(r.Modal,{className:"ec-push-post-modal",onRequestClose:n,title:Object(a.__)("Pull post from EasyContent.io?"),closeButtonLabel:Object(a.__)("Close")},Object(c.createElement)("p",null,Object(a.__)("Are you sure you want to pull this Post from EasyContent? Any local changes will be overwritten.")),Object(c.createElement)(r.Button,{isDefault:!0,onClick:n},Object(a.__)("Cancel")),Object(c.createElement)(r.Button,{isPrimary:!0,onClick:s},Object(a.__)("Pull"))))}),m=Object(i.compose)(Object(l.withSelect)(function(e,t){var n=e("easycontent-wp-store"),s=n.getArticle,c=(n.getModals,n.getStages),a=n.isDoingAjax,o=n.isStagesSelectVisible,r=e("core/editor"),i=r.isSavingPost,l=r.isEditedPostSaveable,u=r.isEditedPostPublishable,p=r.isPostSavingLocked,d=r.isCurrentPostPublished,h=!i()&&l()&&!p()&&!u()&&d();return{article:s(),stages:c(),doingAjax:a(),isStagesSelectVisible:o(),postCanBePushed:h}}),Object(l.withDispatch)(function(e,t,n){var s=n.select,c=e("easycontent-wp-store"),a=c.openModal,o=c.showSelect,r=c.hideSelect,i=c.setNewArticleStage,l=s("easycontent-wp-store"),u=l.isDoingAjax,p=(0,l.getArticle)();return{openPullModal:function(){a(h.PULL)},openPushModal:function(){a(h.PUSH)},setArticleStage:function(e,t){if(!u()&&p.isSynced){var n=t.find(function(t){return t.id==e.target.value});i(n)}},showSelect:o,hideSelect:r}}))(function(e){var t=e.article,s=e.stages,i=e.doingAjax,l=e.postCanBePushed,u=e.openPushModal,p=e.setArticleStage,d=e.showSelect,h=e.hideSelect,m=e.isStagesSelectVisible,O=e.openPullModal,j=n(13)({active:i,"ec-widget-spinner-wrapper":!0});return Object(c.createElement)(o.PluginPostStatusInfo,null,Object(c.createElement)("div",{className:"ec-post-status-inner-wrapper"},Object(c.createElement)("div",{className:"ec-post-status-header"},"EasyContent"),Object(c.createElement)("div",{className:"ec-post-status-row"},Object(c.createElement)(r.Dashicon,{icon:"format-aside"}),Object(c.createElement)("span",{className:"status-item-name"},Object(a.__)("Item"),": "),t.isSynced?Object(c.createElement)("a",{href:t.url,target:"_blank"},t.topicName):Object(c.createElement)("span",null,Object(a.__)("N/A"))),!m&&Object(c.createElement)("div",{className:"ec-post-status-row"},Object(c.createElement)(r.Dashicon,{icon:"admin-network"}),Object(c.createElement)("span",{className:"status-item-name"},Object(a.__)("Status"),": "),t.isSynced&&t.stage?Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"ec-post-stage-color",style:{backgroundColor:"#"+t.stage.color}}),Object(c.createElement)(r.Button,{isLink:!0,onClick:d},t.stage.name)):Object(c.createElement)("span",null,Object(a.__)("N/A"))),s&&s.length>0&&m&&Object(c.createElement)("div",{className:"ec-post-status-row"},Object(c.createElement)("select",{onChange:function(e){return p(e,s)},value:t.stage.id},s.map(function(e,t){return Object(c.createElement)("option",{value:e.id},e.name)})),Object(c.createElement)(r.IconButton,{onClick:h,icon:"no",label:Object(a.__)("Cancel")})),Object(c.createElement)("div",{className:"ec-post-status-row"},Object(c.createElement)(r.Dashicon,{icon:"calendar"}),Object(c.createElement)("span",{className:"status-item-name"},Object(a.__)("Last Updated")+": "),t.lastUpdatedString?Object(c.createElement)(c.Fragment,null,t.lastUpdatedString+" "+Object(a.__)("ago")):Object(c.createElement)(c.Fragment,null,"—")),Object(c.createElement)("div",{className:"ec-post-status-buttons"},Object(c.createElement)(r.Button,{isDefault:!0,disabled:!t.isSynced,onClick:O},Object(a.__)("Pull"))," ",Object(c.createElement)(r.Button,{isPrimary:!0,disabled:!l,onClick:u},Object(a.__)("Push"))),Object(c.createElement)("div",{className:j},Object(c.createElement)(r.Spinner,null))),Object(c.createElement)(b,null),Object(c.createElement)(f,null))}),O=n(5),j=n.n(O),g=n(3),y=n.n(g),E=n(7),S=n.n(E),_="START_AJAX_CALL",P="END_AJAX_CALL";function v(){return{type:_}}function w(){return{type:P}}function A(e,t){switch(this.state=e,this.then=function(e){return new e(this.state,t)},t.type){case _:return void(this.state=y()({},this.state,{doingAjax:!0}));case P:return void(this.state=y()({},this.state,{doingAjax:!1}))}this.reduce&&this.reduce()}var x=n(6),C=n.n(x),L=C.a.mark(D),k=C.a.mark(M),N="PUSH_ARTICLE",T="PULL_ARTICLE",U="UPDATE_ARTICLE_DATA";function D(e){var t,n;return C.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,v();case 2:return t=e?{type:N,id:e}:{type:N},s.next=5,t;case 5:if(!(n=s.sent).success){s.next=9;break}return s.next=9,{type:U,payload:n.payload};case 9:return s.next=11,w();case 11:case"end":return s.stop()}},L)}function M(){var e;return C.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v();case 2:return t.next=4,{type:T};case 4:if(!(e=t.sent).success){t.next=8;break}return t.next=8,{type:U,payload:e.payload};case 8:return t.next=10,w();case 10:case"end":return t.stop()}},k)}function B(e){return{type:U,payload:e}}function I(e,t){this.reduce=function(){switch(t.type){case U:this.state=y()({},e),this.state.article=t.payload}},A.apply(this,arguments)}var H,R=C.a.mark(X),G="SHOW_STAGES_SELECT",V="HIDE_STAGES_SELECT",F="SET_STAGES_ARRAY",q="SET_NEW_ARTICLE_STAGE",J="UPDATE_ARTICLE_STAGE_STATE";function W(){return{type:V}}function X(e){return C.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v();case 2:return t.next=4,{type:q,stage:e};case 4:if(!t.sent.success){t.next=8;break}return t.next=8,{type:J,stage:e};case 8:return t.next=10,W();case 10:return t.next=12,w();case 12:case"end":return t.stop()}},R)}function Y(e,t){this.reduce=function(){switch(t.type){case G:this.state=y()({},this.state,{stagesSelectVisible:!0});break;case V:this.state=y()({},this.state,{stagesSelectVisible:!1});break;case F:this.state=y()({},this.state,{stages:t.stages});break;case J:this.state=y()({},e),this.state.article.stage=t.stage}},A.apply(this,arguments)}var z={modals:(H={},j()(H,h.PULL,{isOpened:!1}),j()(H,h.PUSH,{isOpened:!1}),H),article:{id:0,isSynced:!1,title:"",topicName:Object(a.__)("N/A"),url:"#",content:"",stage:{id:0,name:Object(a.__)("N/A"),color:"fff"},lastUpdatedString:""},stages:[],stagesSelectVisible:!1,doingAjax:!1};var K,Q=n(9),Z=Object(l.registerStore)("easycontent-wp-store",{reducer:function(){return new function(e,t){this.reduce=function(){var e=t.modal===h.PULL?h.PUSH:h.PULL;switch(t.type){case u:this.state.modals[t.modal].isOpened||this.state.modals[e].isOpened||(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=!0);break;case p:this.state.modals[t.modal].isOpened&&(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=!1);break;case d:var n=!this.state.modals[t.modal].isOpened;(!this.state.modals[e].isOpened&&n||this.state.modals[t.modal].isOpened&&!n)&&(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=n)}},A.apply(this,arguments)}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,arguments.length>1?arguments[1]:void 0).then(Y).then(I).state},actions:{openModal:function(e){return{type:u,modal:e}},closeModal:function(e){return{type:p,modal:e}},toggleModal:function(e){return{type:d,modal:e}},pushArticle:D,pullArticle:M,showSelect:function(){return{type:G}},hideSelect:W,setNewArticleStage:X},selectors:{getArticle:function(e){return e.article},getModals:function(e){return e.modals},getStages:function(e){return e.stages},isStagesSelectVisible:function(e){return e.stagesSelectVisible},isDoingAjax:function(e){return e.doingAjax}},controls:(K={},j()(K,N,function(e){var t=Object(l.select)("core/editor").getCurrentPostId();return t=t||0,S()({method:"POST",path:"/easycontent/v1/posts/".concat(t,"/push"),cache:"no-cache"}).then(function(e){return Object(l.dispatch)("core/notices").createSuccessNotice(Object(a.__)("Post was pushed to EasyContent.io successfully")),{payload:e,success:!0}},function(e){return 404==e.code?Object(l.dispatch)("core/notices").createErrorNotice(e.message,{actions:[{onClick:function(e){S()({method:"POST",path:"/easycontent/v1/posts/".concat(t,"/unlink"),cache:"no-cache"}).then(function(e){Object(l.dispatch)("core/notices").createSuccessNotice(Object(a.__)("Post was unlinked successfully")),Z.dispatch(B(z))},function(e){Object(l.dispatch)("core/notices").createErrorNotice(e.message)})},label:"Unlink"}]}):Object(l.dispatch)("core/notices").createErrorNotice(e.message),y()({},e,{success:!1})})}),j()(K,T,function(e){var t=(0,Object(l.select)("easycontent-wp-store").getArticle)().id;return S()({method:"POST",path:"/easycontent/v1/articles/".concat(t,"/pull"),cache:"no-cache"}).then(function(e){Object(l.dispatch)("core/notices").createNotice("success",Object(a.__)("Post was pulled from EasyContent.io successfully")),Object(l.dispatch)("core/editor").editPost({title:e.title});var t=Object(l.select)("core/editor").getEditorBlocks().map(function(e){return e.clientId});return Object(l.dispatch)("core/block-editor").replaceBlocks(t,Object(Q.parse)(e.content),0),{payload:e,success:!0}},function(e){return Object(l.dispatch)("core/notices").createNotice("error",e.message),y()({},e,{success:!1})})}),j()(K,q,function(e){var t=Object(l.select)("core/editor").getCurrentPostId();return t=t||0,S()({method:"PATCH",path:"/easycontent/v1/posts/".concat(t),data:{workflow_stage_id:e.stage.id},cache:"no-cache"}).then(function(e){return{payload:e,success:!0}},function(e){return Object(l.dispatch)("core/notices").createNotice("error",e.message),y()({},e,{success:!1})})}),K),resolvers:{getArticle:function(){var e=Object(l.select)("core/editor").getCurrentPostId();e&&S()({path:"/easycontent/v1/posts/".concat(e,"/article"),method:"GET",cache:"no-cache"}).then(function(e){null!==e&&Z.dispatch(B(e))})},getStages:function(){S()({path:"/easycontent/v1/stages",method:"GET",cache:"no-cache"}).then(function(e){Z.dispatch(function(e){return{type:F,stages:e}}(e))})}},initialState:z});Object(s.registerPlugin)("easycontent-gutenberg-sidebar",{render:m})},function(e,t,n){var s;
     1!function(e){var t={};function n(c){if(t[c])return t[c].exports;var s=t[c]={i:c,l:!1,exports:{}};return e[c].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,c){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:c})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t,n){var c=n(5);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},s=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),s.forEach(function(t){c(e,t,n[t])})}return e}},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=regeneratorRuntime},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t,n){"use strict";n.r(t);var c=n(11),s=n(0),a=n(2),o=n(10),r=n(4),i=n(8),l=n(1),u="OPEN_MODAL",p="CLOSE_MODAL",d="TOGGLE_MODAL",h={PULL:"PULL",PUSH:"PUSH"};var b=Object(i.compose)(Object(l.withSelect)(function(e,t){var n=e("easycontent-wp-store"),c=n.getArticle,s=n.getModals,a=e("core/editor"),o=a.isSavingPost,r=a.isEditedPostSaveable,i=a.isEditedPostPublishable,l=a.isPostSavingLocked,u=a.isCurrentPostPublished,p=s(),d=!o()&&r()&&!l()&&!i()&&u();return{article:c(),isOpened:p[h.PUSH].isOpened,postCanBePushed:d}}),Object(l.withDispatch)(function(e,t,n){var c=n.select,s=e("easycontent-wp-store"),a=s.closeModal,o=s.pushArticle,r=c("easycontent-wp-store").isDoingAjax;return{close:function(){a(h.PUSH)},push:function(e,t){t&&!r()&&(o(e),a(h.PUSH))}}}))(function(e){var t=e.article,n=e.isOpened,c=e.postCanBePushed,o=e.close,i=e.push;return Object(s.createElement)(s.Fragment,null,n&&c&&Object(s.createElement)(r.Modal,{className:"ec-push-post-modal",onRequestClose:o,title:Object(a.__)("Push post to EasyContent.io?"),closeButtonLabel:Object(a.__)("Close")},Object(s.createElement)("p",null,t.isSynced?Object(a.__)("Are you sure you want to push this post to EasyContent? Any changes in EasyContent will be overwritten."):Object(a.__)("Push this post to EasyContent?")),Object(s.createElement)(r.Button,{isDefault:!0,onClick:o},Object(a.__)("Cancel")),Object(s.createElement)(r.Button,{isPrimary:!0,onClick:function(){return i(t.id,c)}},Object(a.__)("Push"))))}),f=Object(i.compose)(Object(l.withSelect)(function(e,t,n){return{isOpened:(0,e("easycontent-wp-store").getModals)()[h.PULL].isOpened}}),Object(l.withDispatch)(function(e,t,n){var c=n.select,s=e("easycontent-wp-store"),a=s.closeModal,o=s.pullArticle,r=c("easycontent-wp-store"),i=r.isDoingAjax,l=(0,r.getArticle)();return{close:function(){a(h.PULL)},pull:function(){!i()&&l.isSynced&&(o(),a(h.PULL))}}}))(function(e){var t=e.isOpened,n=e.close,c=e.pull;return Object(s.createElement)(s.Fragment,null,t&&Object(s.createElement)(r.Modal,{className:"ec-push-post-modal",onRequestClose:n,title:Object(a.__)("Pull post from EasyContent.io?"),closeButtonLabel:Object(a.__)("Close")},Object(s.createElement)("p",null,Object(a.__)("Are you sure you want to pull this Post from EasyContent? Any local changes will be overwritten.")),Object(s.createElement)(r.Button,{isDefault:!0,onClick:n},Object(a.__)("Cancel")),Object(s.createElement)(r.Button,{isPrimary:!0,onClick:c},Object(a.__)("Pull"))))}),O=Object(i.compose)(Object(l.withSelect)(function(e,t){var n=e("easycontent-wp-store"),c=n.getArticle,s=(n.getModals,n.getStages),a=n.isDoingAjax,o=n.isStagesSelectVisible,r=e("core/editor"),i=r.isSavingPost,l=r.isEditedPostSaveable,u=r.isEditedPostPublishable,p=r.isPostSavingLocked,d=r.isCurrentPostPublished,h=!i()&&l()&&!p()&&!u()&&d();return{article:c(),stages:s(),doingAjax:a(),isStagesSelectVisible:o(),postCanBePushed:h}}),Object(l.withDispatch)(function(e,t,n){var c=n.select,s=e("easycontent-wp-store"),a=s.openModal,o=s.showSelect,r=s.hideSelect,i=s.setNewArticleStage,l=c("easycontent-wp-store"),u=l.isDoingAjax,p=(0,l.getArticle)();return{openPullModal:function(){a(h.PULL)},openPushModal:function(){a(h.PUSH)},setArticleStage:function(e,t){if(!u()&&p.isSynced){var n=t.find(function(t){return t.id==e.target.value});i(n)}},showSelect:o,hideSelect:r}}))(function(e){var t=e.article,c=e.stages,i=e.doingAjax,l=e.postCanBePushed,u=e.openPushModal,p=e.setArticleStage,d=e.showSelect,h=e.hideSelect,O=e.isStagesSelectVisible,m=e.openPullModal,j=n(13)({active:i,"ec-widget-spinner-wrapper":!0});return Object(s.createElement)(o.PluginPostStatusInfo,null,Object(s.createElement)("div",{className:"ec-post-status-inner-wrapper"},Object(s.createElement)("div",{className:"ec-post-status-header"},"EasyContent"),Object(s.createElement)("div",{className:"ec-post-status-row"},Object(s.createElement)(r.Dashicon,{icon:"format-aside"}),Object(s.createElement)("span",{className:"status-item-name"},Object(a.__)("Item"),": "),t.isSynced?Object(s.createElement)("a",{href:t.url,target:"_blank"},t.topicName):Object(s.createElement)("span",null,Object(a.__)("N/A"))),!O&&Object(s.createElement)("div",{className:"ec-post-status-row"},Object(s.createElement)(r.Dashicon,{icon:"admin-network"}),Object(s.createElement)("span",{className:"status-item-name"},Object(a.__)("Status"),": "),t.isSynced&&t.stage?Object(s.createElement)(s.Fragment,null,Object(s.createElement)("span",{className:"ec-post-stage-color",style:{backgroundColor:"#"+t.stage.color}}),Object(s.createElement)(r.Button,{isLink:!0,onClick:d},t.stage.name)):Object(s.createElement)("span",null,Object(a.__)("N/A"))),c&&c.length>0&&O&&Object(s.createElement)("div",{className:"ec-post-status-row"},Object(s.createElement)("select",{onChange:function(e){return p(e,c)},value:t.stage.id},c.map(function(e,t){return Object(s.createElement)("option",{value:e.id},e.name)})),Object(s.createElement)(r.IconButton,{onClick:h,icon:"no",label:Object(a.__)("Cancel")})),Object(s.createElement)("div",{className:"ec-post-status-row"},Object(s.createElement)(r.Dashicon,{icon:"calendar"}),Object(s.createElement)("span",{className:"status-item-name"},Object(a.__)("Last Updated")+": "),t.lastUpdatedString?Object(s.createElement)(s.Fragment,null,t.lastUpdatedString):Object(s.createElement)(s.Fragment,null,"—")),Object(s.createElement)("div",{className:"ec-post-status-buttons"},Object(s.createElement)(r.Button,{isDefault:!0,disabled:!t.isSynced,onClick:m},Object(a.__)("Pull"))," ",Object(s.createElement)(r.Button,{isPrimary:!0,disabled:!l,onClick:u},Object(a.__)("Push"))),Object(s.createElement)("div",{className:j},Object(s.createElement)(r.Spinner,null))),Object(s.createElement)(b,null),Object(s.createElement)(f,null))}),m=n(5),j=n.n(m),g=n(3),y=n.n(g),E=n(7),S=n.n(E),P="START_AJAX_CALL",_="END_AJAX_CALL";function v(){return{type:P}}function w(){return{type:_}}function A(e,t){switch(this.state=e,this.then=function(e){return new e(this.state,t)},t.type){case P:return void(this.state=y()({},this.state,{doingAjax:!0}));case _:return void(this.state=y()({},this.state,{doingAjax:!1}))}this.reduce&&this.reduce()}var x=n(6),C=n.n(x),L=C.a.mark(D),k=C.a.mark(M),N="PUSH_ARTICLE",T="PULL_ARTICLE",U="UPDATE_ARTICLE_DATA";function D(e){var t,n;return C.a.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,v();case 2:return t=e?{type:N,id:e}:{type:N},c.next=5,t;case 5:if(!(n=c.sent).success){c.next=9;break}return c.next=9,{type:U,payload:n.payload};case 9:return c.next=11,w();case 11:case"end":return c.stop()}},L)}function M(){var e;return C.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v();case 2:return t.next=4,{type:T};case 4:if(!(e=t.sent).success){t.next=8;break}return t.next=8,{type:U,payload:e.payload};case 8:return t.next=10,w();case 10:case"end":return t.stop()}},k)}function B(e){return{type:U,payload:e}}function I(e,t){this.reduce=function(){switch(t.type){case U:this.state=y()({},e),this.state.article=t.payload}},A.apply(this,arguments)}var H,R=C.a.mark(X),G="SHOW_STAGES_SELECT",V="HIDE_STAGES_SELECT",F="SET_STAGES_ARRAY",q="SET_NEW_ARTICLE_STAGE",J="UPDATE_ARTICLE_STAGE_STATE";function W(){return{type:V}}function X(e){return C.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v();case 2:return t.next=4,{type:q,stage:e};case 4:if(!t.sent.success){t.next=8;break}return t.next=8,{type:J,stage:e};case 8:return t.next=10,W();case 10:return t.next=12,w();case 12:case"end":return t.stop()}},R)}function Y(e,t){this.reduce=function(){switch(t.type){case G:this.state=y()({},this.state,{stagesSelectVisible:!0});break;case V:this.state=y()({},this.state,{stagesSelectVisible:!1});break;case F:this.state=y()({},this.state,{stages:t.stages});break;case J:this.state=y()({},e),this.state.article.stage=t.stage}},A.apply(this,arguments)}var z={modals:(H={},j()(H,h.PULL,{isOpened:!1}),j()(H,h.PUSH,{isOpened:!1}),H),article:{id:0,isSynced:!1,title:"",topicName:Object(a.__)("N/A"),url:"#",content:"",stage:{id:0,name:Object(a.__)("N/A"),color:"fff"},lastUpdatedString:""},stages:[],stagesSelectVisible:!1,doingAjax:!1};var K,Q=n(9),Z=Object(l.registerStore)("easycontent-wp-store",{reducer:function(){return new function(e,t){this.reduce=function(){var e=t.modal===h.PULL?h.PUSH:h.PULL;switch(t.type){case u:this.state.modals[t.modal].isOpened||this.state.modals[e].isOpened||(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=!0);break;case p:this.state.modals[t.modal].isOpened&&(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=!1);break;case d:var n=!this.state.modals[t.modal].isOpened;(!this.state.modals[e].isOpened&&n||this.state.modals[t.modal].isOpened&&!n)&&(this.state=y()({},this.state),this.state.modals[t.modal].isOpened=n)}},A.apply(this,arguments)}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,arguments.length>1?arguments[1]:void 0).then(Y).then(I).state},actions:{openModal:function(e){return{type:u,modal:e}},closeModal:function(e){return{type:p,modal:e}},toggleModal:function(e){return{type:d,modal:e}},pushArticle:D,pullArticle:M,showSelect:function(){return{type:G}},hideSelect:W,setNewArticleStage:X},selectors:{getArticle:function(e){return e.article},getModals:function(e){return e.modals},getStages:function(e){return e.stages},isStagesSelectVisible:function(e){return e.stagesSelectVisible},isDoingAjax:function(e){return e.doingAjax}},controls:(K={},j()(K,N,function(e){var t=Object(l.select)("core/editor").getCurrentPostId();return t=t||0,S()({method:"POST",path:"/easycontent/v1/posts/".concat(t,"/push"),cache:"no-cache"}).then(function(e){return Object(l.dispatch)("core/notices").createSuccessNotice(Object(a.__)("Post was pushed to EasyContent.io successfully")),{payload:e,success:!0}},function(e){return 404==e.code?Object(l.dispatch)("core/notices").createErrorNotice(e.message,{actions:[{onClick:function(e){S()({method:"POST",path:"/easycontent/v1/posts/".concat(t,"/unlink"),cache:"no-cache"}).then(function(e){Object(l.dispatch)("core/notices").createSuccessNotice(Object(a.__)("Post was unlinked successfully")),Z.dispatch(B(z))},function(e){Object(l.dispatch)("core/notices").createErrorNotice(e.message)})},label:"Unlink"}]}):Object(l.dispatch)("core/notices").createErrorNotice(e.message),y()({},e,{success:!1})})}),j()(K,T,function(e){var t=(0,Object(l.select)("easycontent-wp-store").getArticle)().id;return S()({method:"POST",path:"/easycontent/v1/articles/".concat(t,"/pull"),cache:"no-cache"}).then(function(e){Object(l.dispatch)("core/notices").createNotice("success",Object(a.__)("Post was pulled from EasyContent.io successfully")),Object(l.dispatch)("core/editor").editPost({title:e.title});var t=Object(l.select)("core/editor").getEditorBlocks().map(function(e){return e.clientId});return Object(l.dispatch)("core/block-editor").replaceBlocks(t,Object(Q.parse)(e.content),0),{payload:e,success:!0}},function(e){return 404==e.code?Object(l.dispatch)("core/notices").createErrorNotice(e.message,{actions:[{onClick:function(e){var t=Object(l.select)("core/editor").getCurrentPostId();t=t||0,S()({method:"POST",path:"/easycontent/v1/posts/".concat(t,"/unlink"),cache:"no-cache"}).then(function(e){Object(l.dispatch)("core/notices").createSuccessNotice(Object(a.__)("Post was unlinked successfully")),Z.dispatch(B(z))},function(e){Object(l.dispatch)("core/notices").createErrorNotice(e.message)})},label:"Unlink"}]}):Object(l.dispatch)("core/notices").createErrorNotice(e.message),y()({},e,{success:!1})})}),j()(K,q,function(e){var t=Object(l.select)("core/editor").getCurrentPostId();return t=t||0,S()({method:"PATCH",path:"/easycontent/v1/posts/".concat(t),data:{workflow_stage_id:e.stage.id},cache:"no-cache"}).then(function(e){return{payload:e,success:!0}},function(e){return Object(l.dispatch)("core/notices").createNotice("error",e.message),y()({},e,{success:!1})})}),K),resolvers:{getArticle:function(){var e=Object(l.select)("core/editor").getCurrentPostId();e&&S()({path:"/easycontent/v1/posts/".concat(e,"/article"),method:"GET",cache:"no-cache"}).then(function(e){null!==e&&Z.dispatch(B(e))})},getStages:function(){S()({path:"/easycontent/v1/stages",method:"GET",cache:"no-cache"}).then(function(e){Z.dispatch(function(e){return{type:F,stages:e}}(e))})}},initialState:z});Object(c.registerPlugin)("easycontent-gutenberg-sidebar",{render:O})},function(e,t,n){var c;
    22/*!
    33  Copyright (c) 2017 Jed Watson.
     
    1010  http://jedwatson.github.io/classnames
    1111*/
    12 !function(){"use strict";var n={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var a=typeof s;if("string"===a||"number"===a)e.push(s);else if(Array.isArray(s)&&s.length){var o=c.apply(null,s);o&&e.push(o)}else if("object"===a)for(var r in s)n.call(s,r)&&s[r]&&e.push(r)}}return e.join(" ")}void 0!==e&&e.exports?(c.default=c,e.exports=c):void 0===(s=function(){return c}.apply(t,[]))||(e.exports=s)}()}]);
     12!function(){"use strict";var n={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var c=arguments[t];if(c){var a=typeof c;if("string"===a||"number"===a)e.push(c);else if(Array.isArray(c)&&c.length){var o=s.apply(null,c);o&&e.push(o)}else if("object"===a)for(var r in c)n.call(c,r)&&c[r]&&e.push(r)}}return e.join(" ")}void 0!==e&&e.exports?(s.default=s,e.exports=s):void 0===(c=function(){return s}.apply(t,[]))||(e.exports=c)}()}]);
  • easycontent/trunk/easycontent-wp.php

    r2189682 r2194825  
    44 * Plugin URI:  https://easycontent.io
    55 * Description: Imports articles from EasyContent to your wordpress site and exports articles from your wordpress site to EasyContent
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Requires at least: 5.0.7
    88 * Requires PHP: 5.6
     
    2121
    2222if ( ! defined( 'EASYCONTENT_PLUGIN_VERSION' ) ) {
    23     define( 'EASYCONTENT_PLUGIN_VERSION', '1.0.0' );
     23    define( 'EASYCONTENT_PLUGIN_VERSION', '1.0.1' );
    2424}
    2525
  • easycontent/trunk/readme.txt

    r2189682 r2194825  
    66Tested up to:       5.3
    77Requires PHP:       5.6
    8 Stable tag:         1.0
     8Stable tag:         1.0.1
    99License:            GPL-2.0+
    1010License URI:        http://www.gnu.org/licenses/gpl-2.0.html
  • easycontent/trunk/vendor/autoload.php

    r2190570 r2194825  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitd6c05bbb3711798f5111fa93f3b69dd3::getLoader();
     7return ComposerAutoloaderInit8c3c9f11622b83242375d90bb4d7e7fd::getLoader();
  • easycontent/trunk/vendor/composer/autoload_real.php

    r2190570 r2194825  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd6c05bbb3711798f5111fa93f3b69dd3
     5class ComposerAutoloaderInit8c3c9f11622b83242375d90bb4d7e7fd
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitd6c05bbb3711798f5111fa93f3b69dd3', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit8c3c9f11622b83242375d90bb4d7e7fd', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitd6c05bbb3711798f5111fa93f3b69dd3', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit8c3c9f11622b83242375d90bb4d7e7fd', 'loadClassLoader'));
    2525
    2626        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    2828            require_once __DIR__ . '/autoload_static.php';
    2929
    30             call_user_func(\Composer\Autoload\ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3::getInitializer($loader));
     30            call_user_func(\Composer\Autoload\ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd::getInitializer($loader));
    3131        } else {
    3232            $map = require __DIR__ . '/autoload_namespaces.php';
     
    4949
    5050        if ($useStaticLoader) {
    51             $includeFiles = Composer\Autoload\ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3::$files;
     51            $includeFiles = Composer\Autoload\ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd::$files;
    5252        } else {
    5353            $includeFiles = require __DIR__ . '/autoload_files.php';
    5454        }
    5555        foreach ($includeFiles as $fileIdentifier => $file) {
    56             composerRequired6c05bbb3711798f5111fa93f3b69dd3($fileIdentifier, $file);
     56            composerRequire8c3c9f11622b83242375d90bb4d7e7fd($fileIdentifier, $file);
    5757        }
    5858
     
    6161}
    6262
    63 function composerRequired6c05bbb3711798f5111fa93f3b69dd3($fileIdentifier, $file)
     63function composerRequire8c3c9f11622b83242375d90bb4d7e7fd($fileIdentifier, $file)
    6464{
    6565    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • easycontent/trunk/vendor/composer/autoload_static.php

    r2190570 r2194825  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3
     7class ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd
    88{
    99    public static $files = array (
     
    16171617    {
    16181618        return \Closure::bind(function () use ($loader) {
    1619             $loader->prefixLengthsPsr4 = ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3::$prefixLengthsPsr4;
    1620             $loader->prefixDirsPsr4 = ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3::$prefixDirsPsr4;
    1621             $loader->classMap = ComposerStaticInitd6c05bbb3711798f5111fa93f3b69dd3::$classMap;
     1619            $loader->prefixLengthsPsr4 = ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd::$prefixLengthsPsr4;
     1620            $loader->prefixDirsPsr4 = ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd::$prefixDirsPsr4;
     1621            $loader->classMap = ComposerStaticInit8c3c9f11622b83242375d90bb4d7e7fd::$classMap;
    16221622
    16231623        }, null, ClassLoader::class);
  • easycontent/trunk/views/admin/metaboxes/post-sync.php

    r2190570 r2194825  
    7070<div class="ec-meta-box__footer">
    7171    <?php if ( $post->isSynced() ) : ?>
    72         <button type="submit" name="ec_pull_post" value="1" class="button button-primary button-large">
     72        <button type="button" class="button button-primary button-large" id="ec-pull-article-button">
    7373            <?= esc_html__( 'Pull', EASYCONTENT_TXTDOMAIN ) ?>
    7474        </button>
     
    7878        </span>
    7979    <?php endif ?>
    80 
    81     <!-- <button type="submit" name="ec_push_post" value="1" class="button button-primary button-large">
    82         <?= esc_html__( 'Push', EASYCONTENT_TXTDOMAIN ) ?>
    83     </button> -->
    8480
    8581    <button type="button" class="button button-primary button-large" id="ec-push-article-button">
     
    9591    <?php endif ?>
    9692</div>
     93
     94<?php if ( $post->isSynced() ) : ?>
     95    <div id="ec-pull-confirmation-modal">
     96        <span><?= esc_html__( 'Are you sure you want to pull this Post from EasyContent? Any local changes will be overwritten.', EASYCONTENT_TXTDOMAIN ) ?></span>
     97    </div>
     98<?php endif;
  • easycontent/trunk/views/admin/pages/publishing-options.php

    r2189682 r2194825  
    2828    <h2><?= esc_html( get_admin_page_title() ) ?></h2>
    2929
    30     <p><?= esc_html( sprintf( __( 'You are currently connected to project <strong>%s</strong> in account <strong>%s</strong>.', EASYCONTENT_TXTDOMAIN ), $projectName, $accountName) ) ?></p>
     30    <p><?= sprintf( __( 'You are currently connected to project <strong>%s</strong> in account <strong>%s</strong>.', EASYCONTENT_TXTDOMAIN ), $projectName, $accountName) ?></p>
    3131
    3232    <p><?= esc_html__( 'Please set up your publishing options', EASYCONTENT_TXTDOMAIN ) ?></p>
Note: See TracChangeset for help on using the changeset viewer.