Plugin Directory

Changeset 1121928


Ignore:
Timestamp:
03/27/2015 05:44:17 AM (11 years ago)
Author:
loumray
Message:

Checking in 1.2.0

Location:
remote-medias-lite/trunk
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • remote-medias-lite/trunk/assets/css/media-remote-admin.css

    r997433 r1121928  
    8383    color: #a00;
    8484}
     85
     86.rmlnotice {
     87    border-color: #ffba00 !important;
     88}
     89.media-frame select.rml-attachment-filters.attachment-filters {
     90    max-width: 100%;
     91    margin-right: 20px;
     92}
     93.ocsmorebanner {
     94    display: none;
     95    z-index: 999999;
     96    background: rgba(0,0,0,0.8);
     97    position: absolute;
     98    margin: 0px 0 50px 0;
     99    width: 100%;
     100    height: 100%;
     101    text-align: center;
     102}
     103.ocsbannerwrapper{
     104    position: relative;
     105    width: 100%;
     106  height: 100%;
     107}
     108.ocsbannercontent{
     109    position:absolute;
     110    top:50%;
     111    left:50%;
     112    width: 50%;
     113    margin-top:-75px;
     114    margin-left: -25%;
     115}
     116.ocsbannerwrapper p{
     117    color: #ffffff;
     118    font-size: 18px;
     119    font-weight: bold;
     120    display: block;
     121}
     122a.ocsbannerdismiss{
     123    color: #ffffff;
     124    margin-top:20px;
     125    display: inline-block;
     126    font-size:16px;
     127    text-decoration: none;
     128}
     129a.ocsbannerdismiss:hover{
     130    text-decoration: underline;
     131    color: #ffffff;
     132}
  • remote-medias-lite/trunk/assets/css/media-remote-admin.min.css

    r997433 r1121928  
    1 .rm-upload-wrap .uploader-inline-content{top:10%}.rm-upload-wrap p.no-mg-top{margin-top:0}.ocs-logo{padding-top:20px}.ocs-logo small{display:inline-block}.ocs-logo img{display:inline-block;padding-top:10px}.spinner.ocs-inline-loading{float:initial;margin-top:-3px}.ocs-2x{font-size:2em}.ocs-3x{font-size:3em}.ocs-green{color:#7ad03a}.ocs-red{color:#a00}.rml-actions{padding:10px;clear:both;border-top:1px solid #ddd;background:#f5f5f5;margin:-12px}.rml-validation-actions{text-align:right;float:right;line-height:23px}.rml-status-actions{margin:-12px;padding:15px 0}.rml-status-actions label{vertical-align:baseline}.rml-status-field{font-weight:600}.rml-status-actions label[for=account_status]:before{content:"\f316";color:#888;display:inline-block;font:400 20px/1 dashicons;speak:none;left:-1px;padding:0 5px 0 0;position:relative;top:0;text-decoration:none!important;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}ul.wpform-fieldset li:last-child{border-bottom:none;padding-bottom:0}.rml-status-field.notvalid{color:#a00}
     1.rm-upload-wrap .uploader-inline-content{top:10%}.rm-upload-wrap p.no-mg-top{margin-top:0}.ocs-logo{padding-top:20px}.ocs-logo small{display:inline-block}.ocs-logo img{display:inline-block;padding-top:10px}.spinner.ocs-inline-loading{float:initial;margin-top:-3px}.ocs-2x{font-size:2em}.ocs-3x{font-size:3em}.ocs-green{color:#7ad03a}.ocs-red{color:#a00}.rml-actions{padding:10px;clear:both;border-top:1px solid #ddd;background:#f5f5f5;margin:-12px}.rml-validation-actions{text-align:right;float:right;line-height:23px}.rml-status-actions{margin:-12px;padding:15px 0}.rml-status-actions label{vertical-align:baseline}.rml-status-field{font-weight:600}.rml-status-actions label[for=account_status]:before{content:"\f316";color:#888;display:inline-block;font:400 20px/1 dashicons;speak:none;left:-1px;padding:0 5px 0 0;position:relative;top:0;text-decoration:none!important;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}ul.wpform-fieldset li:last-child{border-bottom:none;padding-bottom:0}.rml-status-field.notvalid{color:#a00}.rmlnotice{border-color:#ffba00!important}.media-frame select.rml-attachment-filters.attachment-filters{max-width:100%;margin-right:20px}.ocsmorebanner{display:none;z-index:999999;background:rgba(0,0,0,.8);position:absolute;margin:0 0 50px;width:100%;height:100%;text-align:center}.ocsbannerwrapper{position:relative;width:100%;height:100%}.ocsbannercontent{position:absolute;top:50%;left:50%;width:50%;margin-top:-75px;margin-left:-25%}.ocsbannerwrapper p{color:#fff;font-size:18px;font-weight:700;display:block}a.ocsbannerdismiss{color:#fff;margin-top:20px;display:inline-block;font-size:16px;text-decoration:none}a.ocsbannerdismiss:hover{text-decoration:underline;color:#fff}
  • remote-medias-lite/trunk/assets/js/media-remote-ext.js

    r997768 r1121928  
    6363        'change': 'refresh'
    6464    },
    65     initialize: function()
    66     {
     65    initialize: function() {
    6766        _.defaults( this.options, {
    6867            message: '',
     
    7069        });
    7170       
    72         var state = this.controller.state();
    73         var template = state.get('uploadTemplate');
     71        var state = this.controller.state(),
     72            template = state.get('uploadTemplate');
    7473        if (template) {
    7574            this.template = wp.media.template(template);
    7675        }
     76
     77        if ( this.options.status ) {
     78            this.views.set( '.upload-inline-status', new wp.media.view.UploaderStatus({
     79                controller: this.controller
     80            }) );
     81        }
    7782    },
    78    
    79     render: function()
    80     {
    81         wp.media.View.prototype.render.apply( this, arguments );
    82         this.refresh();
     83    render: function() {
     84        wp.media.View.prototype.render.apply( this, arguments );
     85        this.refresh();
    8386        return this;
    8487    },
    85    
    8688    refresh: function( event ) {},
    8789    hide: function() {
     
    8991    }
    9092});
     93
    9194/**
    9295 *
     
    156159                delete props.query;
    157160
     161                // Remove the `remotefilters` property.
     162                delete props.remotefilters;
     163
     164                // Remove the `uioptions` property.
     165                delete props.uioptions;
     166
    158167                // Fill default args.
    159168                _.defaults( props, defaults );
     
    202211        }())
    203212});
    204 // Extends the default MediaFrame.Post view
    205 /**
    206  *
     213
     214/**
     215 * wp.media.view.AttachmentFilters.RemoteCustom
     216 *
     217 */
     218wp.media.view.AttachmentFilters.RemoteCustom = wp.media.view.AttachmentFilters.extend({
     219    className: 'rml-attachment-filters attachment-filters',
     220    createFilters: function() {
     221        var filters = {},
     222            remotefilters = this.model.get('remotefilters');
     223
     224        _.each(remotefilters, function(remotefilter) {
     225            var filter = {
     226                text: remotefilter.text || 'Undefined',
     227                props: remotefilter.props || {uploadedTo: null,orderby: 'date',order: 'DESC'},
     228                priority: remotefilter.priority || 10
     229            }
     230            if (remotefilter.slug) {
     231                filters[remotefilter.slug] = (filter);
     232            }
     233           
     234        });
     235
     236        this.filters = filters;
     237    }
     238});
     239
     240/**
     241 * wp.media.controller.RemoteLibrary
    207242 */
    208243wp.media.controller.RemoteLibrary = wp.media.controller.Library.extend({
     
    216251        router:     'browse',
    217252        menu:       'default',
     253        date:       false,
    218254        remote:     true,
    219255        searchable: true,
    220256        filterable: false,
    221257        sortable:   true,
     258        autoSelect: true,
    222259
    223260        // Uses a user setting to override the content mode.
     
    233270var oldMediaFrame = wp.media.view.MediaFrame.Post;
    234271wp.media.view.MediaFrame.Post = oldMediaFrame.extend({
    235 
    236272    initialize: function() {
    237273        oldMediaFrame.prototype.initialize.apply( this, arguments );
     
    244280        var that = this;
    245281   
    246         //TODO get service setting template from remote service setting object
    247         _.each(wp.media.view.settings.remoteMediaAccounts,function(account) {
     282        _.each(wp.media.view.settings.remoteMediaAccounts, function(account) {
     283            var serviceSettings = wp.media.view.settings.remoteServiceSettings[account.type] || [];
    248284            that.states.add([
    249285                new wp.media.controller.RemoteLibrary({
     
    254290                    priority:   30,
    255291                    toolbar:    'main-remote',
    256                     uploadTemplate: _.isUndefined( wp.media.view.settings.remoteServiceSettings[account.type] ) ? null : wp.media.view.settings.remoteServiceSettings[account.type].uploadTemplate,
    257                     filterable: 'uploaded',
     292                    uploadTemplate: serviceSettings.uploadTemplate || '',
     293                    filterable: account.filterable || 'uploaded',
    258294                    library:  wp.media.remotequery( _.defaults({
    259295                        type: 'remote',
    260                         account_id: account.id
     296                        account_id: account.id,
     297                        remotefilters: account.filters || [],
     298                        uioptions: account.uioptions || []
    261299                    }, options.library ) ),
    262300                    state:    'remote-library-'+account.id,
     
    277315        this.on( 'toolbar:render:main-remote', this.mainInsertToolbar, this );
    278316    },
    279    
    280317    uploadContent: function() {
    281318        var sectionid = this.state().get('sectionid');
     
    291328    }
    292329});
    293 
    294330wp.media.view.RemoteAttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
    295     createUploader: function() {
    296         this.uploader = new wp.media.view.RemoteUploaderInline({
    297             controller: this.controller,
    298             status:     false,
    299             message:    this.controller.isModeActive( 'grid' ) ? '' : wp.media.view.l10n.noItemsFound,
    300             canClose:   this.controller.isModeActive( 'grid' )
    301         });
    302 
    303         this.uploader.hide();
    304         this.views.add( this.uploader );
    305     },
    306331    createSingle: function () {
    307332        var sidebar = this.sidebar,
     
    327352        if ( this.model.id === 'remote-library-'+this.model.get('sectionid') ) {
    328353            sidebar.$el.addClass( 'visible' );
     354        }
     355    },
     356    createToolbar: function () {
     357        wp.media.view.AttachmentsBrowser.prototype.createToolbar.apply( this, arguments );
     358
     359        if ( 'custom' === this.options.filters ) {
     360            this.toolbar.set( 'filters', new wp.media.view.AttachmentFilters.RemoteCustom({
     361                controller: this.controller,
     362                model:      this.collection.props,
     363                priority:   -80
     364            }).render() );
    329365        }
    330366    }
     
    346382                search:     state.get('searchable'),
    347383                filters:    state.get('filterable'),
     384                date:       state.get('date'),
    348385                display:    state.has('display') ? state.get('display') : state.get('displaySettings'),
    349386                dragInfo:   state.get('dragInfo'),
  • remote-medias-lite/trunk/assets/js/media-remote-ext.min.js

    r997768 r1121928  
    1 !function(){oldSendAttachment=wp.media.editor.send.attachment,wp.media.editor.send.attachment=function(a,b){if("remote"!==b.type)return oldSendAttachment(a,b);{var c;b.caption}return wp.media.view.settings.captions||delete b.caption,a=wp.media.string.props(a,b),c={id:b.id,title:b.title,type:b.type,subtype:b.subtype,remotetype:b.remotetype,accountId:b.accountId||0,remotedata:b.remotedata||[]},a.linkUrl&&(c.url=a.linkUrl),"image"===b.remotetype&&(_.each({align:"align",size:"image-size",alt:"image_alt"},function(b,d){a[d]&&(c[b]=a[d])}),c.width=b.width||0,c.height=b.height||0,c.imgurl=b.url||c.url),wp.media.post("send-remote-attachment-to-editor",{nonce:rmlSendToEditorParams.nonce,attachment:c,post_id:wp.media.view.settings.post.id})},wp.media.view.RemoteUploaderInline=wp.media.View.extend({tagName:"div",className:"remote-uploader",template:wp.media.template("remote-media-upload"),events:{input:"refresh",keyup:"refresh",change:"refresh"},initialize:function(){_.defaults(this.options,{message:"",status:!0});var a=this.controller.state(),b=a.get("uploadTemplate");b&&(this.template=wp.media.template(b))},render:function(){return wp.media.View.prototype.render.apply(this,arguments),this.refresh(),this},refresh:function(){},hide:function(){this.$el.addClass("hidden")}}),wp.media.remotequery=function(a){return new wp.media.model.RemoteAttachments(null,{props:_.extend(_.defaults(a||{},{orderby:"date"}),{query:!0})})},wp.media.model.RemoteAttachments=wp.media.model.Attachments.extend({initialize:function(){wp.media.model.Attachments.prototype.initialize.apply(this,arguments)},_requery:function(){this.props.get("query")&&this.mirror(wp.media.model.RemoteQuery.get(this.props.toJSON()))}}),wp.media.model.RemoteQuery=wp.media.model.Query.extend({initialize:function(){wp.media.model.Query.prototype.initialize.apply(this,arguments)},sync:function(a,b,c){var d;return"read"===a?(c=c||{},c.context=this,c.data=_.extend(c.data||{},{action:"query-remote-attachments",post_id:wp.media.model.settings.post.id,security:rmlQueryAttachmentsParams.nonce}),args=_.clone(this.args),-1!==args.posts_per_page&&(args.paged=Math.floor(this.length/args.posts_per_page)+1),c.data.query=args,wp.media.ajax(c)):(d=wp.media.model.Attachments.prototype.sync?wp.media.model.Attachments.prototype:Backbone,d.sync.apply(this,arguments))}},{get:function(){var a=[];return function(b,c){var d,e={},f=wp.media.model.RemoteQuery.orderby,g=wp.media.model.RemoteQuery.defaultProps;return delete b.query,_.defaults(b,g),b.order=b.order.toUpperCase(),"DESC"!==b.order&&"ASC"!==b.order&&(b.order=g.order.toUpperCase()),_.contains(f.allowed,b.orderby)||(b.orderby=g.orderby),_.each(b,function(a,b){_.isNull(a)||(e[wp.media.model.RemoteQuery.propmap[b]||b]=a)}),_.defaults(e,wp.media.model.RemoteQuery.defaultArgs),e.orderby=f.valuemap[b.orderby]||b.orderby,d=_.find(a,function(a){return _.isEqual(a.args,e)}),d||(d=new wp.media.model.RemoteQuery([],_.extend(c||{},{props:b,args:e})),a.push(d)),d}}()}),wp.media.controller.RemoteLibrary=wp.media.controller.Library.extend({defaults:{id:"remote-library",multiple:"add",describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",remote:!0,searchable:!0,filterable:!1,sortable:!0,contentUserSetting:!0,syncSelection:!0}});var a=wp.media.view.MediaFrame.Post;wp.media.view.MediaFrame.Post=a.extend({initialize:function(){a.prototype.initialize.apply(this,arguments)},createStates:function(){a.prototype.createStates.apply(this,arguments);var b=this.options,c=this;_.each(wp.media.view.settings.remoteMediaAccounts,function(a){c.states.add([new wp.media.controller.RemoteLibrary({id:"remote-library-"+a.id,sectionid:a.id,title:a.title,service:a.type,priority:30,toolbar:"main-remote",uploadTemplate:_.isUndefined(wp.media.view.settings.remoteServiceSettings[a.type])?null:wp.media.view.settings.remoteServiceSettings[a.type].uploadTemplate,filterable:"uploaded",library:wp.media.remotequery(_.defaults({type:"remote",account_id:a.id},b.library)),state:"remote-library-"+a.id,editable:!0,displaySettings:!0,displayUserSettings:!0,menu:"default",AttachmentView:wp.media.view.Attachment.RemoteLibrary})])},this)},bindHandlers:function(){a.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:create:main-remote",this.createToolbar,this),this.on("toolbar:render:main-remote",this.mainInsertToolbar,this)},uploadContent:function(){var a=this.state().get("sectionid");a?(this.$el.removeClass("hide-toolbar"),this.content.set(new wp.media.view.RemoteUploaderInline({controller:this,model:this.state().props}))):wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this,arguments)}}),wp.media.view.RemoteAttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createUploader:function(){this.uploader=new wp.media.view.RemoteUploaderInline({controller:this.controller,status:!1,message:this.controller.isModeActive("grid")?"":wp.media.view.l10n.noItemsFound,canClose:this.controller.isModeActive("grid")}),this.uploader.hide(),this.views.add(this.uploader)},createSingle:function(){var a=this.sidebar,b=this.options.selection.single(),c=b.get("type"),d=b.get("remotetype");return"remote"!==c?wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments):("image"===d?(b.set("type",d),wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments),b.set("type","remote")):wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments),void(this.model.id==="remote-library-"+this.model.get("sectionid")&&a.$el.addClass("visible")))}});var b=wp.media.view.MediaFrame.Select;wp.media.view.MediaFrame.Select.prototype.browseRemoteContent=function(a){var c=this.state(),d=c.get("remote");d===!0?(this.$el.removeClass("hide-toolbar"),a.view=new wp.media.view.RemoteAttachmentsBrowser({controller:this,collection:c.get("library"),selection:c.get("selection"),model:c,sortable:c.get("sortable"),search:c.get("searchable"),filters:c.get("filterable"),display:c.get(c.has("display")?"display":"displaySettings"),dragInfo:c.get("dragInfo"),idealColumnWidth:c.get("idealColumnWidth"),suggestedWidth:c.get("suggestedWidth"),suggestedHeight:c.get("suggestedHeight"),AttachmentView:c.get("AttachmentView")})):b.prototype.browseContent.apply(this,arguments)},wp.media.view.MediaFrame.Select=b.extend({bindHandlers:function(){this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseRemoteContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this)}}),wp.media.view.Attachment.RemoteLibrary=wp.media.view.Attachment.Library.extend({template:wp.media.template("attachment-remote"),toggleSelection:function(){wp.media.view.Attachment.Library.prototype.toggleSelection.apply(this,arguments)}}),wp.media.view.Attachment.RemoteSelection=wp.media.view.Attachment.Selection.extend({template:wp.media.template("attachment-remote")}),oldAttachmentsSelection=wp.media.view.Attachments.Selection,wp.media.view.Attachments.Selection=oldAttachmentsSelection.extend({initialize:function(){return _.defaults(this.options,{AttachmentView:wp.media.view.Attachment.RemoteSelection}),oldAttachmentsSelection.prototype.initialize.apply(this,arguments)}})}(jQuery);
     1!function(){oldSendAttachment=wp.media.editor.send.attachment,wp.media.editor.send.attachment=function(a,b){if("remote"!==b.type)return oldSendAttachment(a,b);{var c;b.caption}return wp.media.view.settings.captions||delete b.caption,a=wp.media.string.props(a,b),c={id:b.id,title:b.title,type:b.type,subtype:b.subtype,remotetype:b.remotetype,accountId:b.accountId||0,remotedata:b.remotedata||[]},a.linkUrl&&(c.url=a.linkUrl),"image"===b.remotetype&&(_.each({align:"align",size:"image-size",alt:"image_alt"},function(b,d){a[d]&&(c[b]=a[d])}),c.width=b.width||0,c.height=b.height||0,c.imgurl=b.url||c.url),wp.media.post("send-remote-attachment-to-editor",{nonce:rmlSendToEditorParams.nonce,attachment:c,post_id:wp.media.view.settings.post.id})},wp.media.view.RemoteUploaderInline=wp.media.View.extend({tagName:"div",className:"remote-uploader",template:wp.media.template("remote-media-upload"),events:{input:"refresh",keyup:"refresh",change:"refresh"},initialize:function(){_.defaults(this.options,{message:"",status:!0});var a=this.controller.state(),b=a.get("uploadTemplate");b&&(this.template=wp.media.template(b)),this.options.status&&this.views.set(".upload-inline-status",new wp.media.view.UploaderStatus({controller:this.controller}))},render:function(){return wp.media.View.prototype.render.apply(this,arguments),this.refresh(),this},refresh:function(){},hide:function(){this.$el.addClass("hidden")}}),wp.media.remotequery=function(a){return new wp.media.model.RemoteAttachments(null,{props:_.extend(_.defaults(a||{},{orderby:"date"}),{query:!0})})},wp.media.model.RemoteAttachments=wp.media.model.Attachments.extend({initialize:function(){wp.media.model.Attachments.prototype.initialize.apply(this,arguments)},_requery:function(){this.props.get("query")&&this.mirror(wp.media.model.RemoteQuery.get(this.props.toJSON()))}}),wp.media.model.RemoteQuery=wp.media.model.Query.extend({initialize:function(){wp.media.model.Query.prototype.initialize.apply(this,arguments)},sync:function(a,b,c){var d;return"read"===a?(c=c||{},c.context=this,c.data=_.extend(c.data||{},{action:"query-remote-attachments",post_id:wp.media.model.settings.post.id,security:rmlQueryAttachmentsParams.nonce}),args=_.clone(this.args),-1!==args.posts_per_page&&(args.paged=Math.floor(this.length/args.posts_per_page)+1),c.data.query=args,wp.media.ajax(c)):(d=wp.media.model.Attachments.prototype.sync?wp.media.model.Attachments.prototype:Backbone,d.sync.apply(this,arguments))}},{get:function(){var a=[];return function(b,c){var d,e={},f=wp.media.model.RemoteQuery.orderby,g=wp.media.model.RemoteQuery.defaultProps;return delete b.query,delete b.remotefilters,delete b.uioptions,_.defaults(b,g),b.order=b.order.toUpperCase(),"DESC"!==b.order&&"ASC"!==b.order&&(b.order=g.order.toUpperCase()),_.contains(f.allowed,b.orderby)||(b.orderby=g.orderby),_.each(b,function(a,b){_.isNull(a)||(e[wp.media.model.RemoteQuery.propmap[b]||b]=a)}),_.defaults(e,wp.media.model.RemoteQuery.defaultArgs),e.orderby=f.valuemap[b.orderby]||b.orderby,d=_.find(a,function(a){return _.isEqual(a.args,e)}),d||(d=new wp.media.model.RemoteQuery([],_.extend(c||{},{props:b,args:e})),a.push(d)),d}}()}),wp.media.view.AttachmentFilters.RemoteCustom=wp.media.view.AttachmentFilters.extend({className:"rml-attachment-filters attachment-filters",createFilters:function(){var a={},b=this.model.get("remotefilters");_.each(b,function(b){var c={text:b.text||"Undefined",props:b.props||{uploadedTo:null,orderby:"date",order:"DESC"},priority:b.priority||10};b.slug&&(a[b.slug]=c)}),this.filters=a}}),wp.media.controller.RemoteLibrary=wp.media.controller.Library.extend({defaults:{id:"remote-library",multiple:"add",describe:!1,toolbar:"select",sidebar:"settings",content:"upload",router:"browse",menu:"default",date:!1,remote:!0,searchable:!0,filterable:!1,sortable:!0,autoSelect:!0,contentUserSetting:!0,syncSelection:!0}});var a=wp.media.view.MediaFrame.Post;wp.media.view.MediaFrame.Post=a.extend({initialize:function(){a.prototype.initialize.apply(this,arguments)},createStates:function(){a.prototype.createStates.apply(this,arguments);var b=this.options,c=this;_.each(wp.media.view.settings.remoteMediaAccounts,function(a){var d=wp.media.view.settings.remoteServiceSettings[a.type]||[];c.states.add([new wp.media.controller.RemoteLibrary({id:"remote-library-"+a.id,sectionid:a.id,title:a.title,service:a.type,priority:30,toolbar:"main-remote",uploadTemplate:d.uploadTemplate||"",filterable:a.filterable||"uploaded",library:wp.media.remotequery(_.defaults({type:"remote",account_id:a.id,remotefilters:a.filters||[],uioptions:a.uioptions||[]},b.library)),state:"remote-library-"+a.id,editable:!0,displaySettings:!0,displayUserSettings:!0,menu:"default",AttachmentView:wp.media.view.Attachment.RemoteLibrary})])},this)},bindHandlers:function(){a.prototype.bindHandlers.apply(this,arguments),this.on("toolbar:create:main-remote",this.createToolbar,this),this.on("toolbar:render:main-remote",this.mainInsertToolbar,this)},uploadContent:function(){var a=this.state().get("sectionid");a?(this.$el.removeClass("hide-toolbar"),this.content.set(new wp.media.view.RemoteUploaderInline({controller:this,model:this.state().props}))):wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this,arguments)}}),wp.media.view.RemoteAttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createSingle:function(){var a=this.sidebar,b=this.options.selection.single(),c=b.get("type"),d=b.get("remotetype");return"remote"!==c?wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments):("image"===d?(b.set("type",d),wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments),b.set("type","remote")):wp.media.view.AttachmentsBrowser.prototype.createSingle.apply(this,arguments),void(this.model.id==="remote-library-"+this.model.get("sectionid")&&a.$el.addClass("visible")))},createToolbar:function(){wp.media.view.AttachmentsBrowser.prototype.createToolbar.apply(this,arguments),"custom"===this.options.filters&&this.toolbar.set("filters",new wp.media.view.AttachmentFilters.RemoteCustom({controller:this.controller,model:this.collection.props,priority:-80}).render())}});var b=wp.media.view.MediaFrame.Select;wp.media.view.MediaFrame.Select.prototype.browseRemoteContent=function(a){var c=this.state(),d=c.get("remote");d===!0?(this.$el.removeClass("hide-toolbar"),a.view=new wp.media.view.RemoteAttachmentsBrowser({controller:this,collection:c.get("library"),selection:c.get("selection"),model:c,sortable:c.get("sortable"),search:c.get("searchable"),filters:c.get("filterable"),date:c.get("date"),display:c.get(c.has("display")?"display":"displaySettings"),dragInfo:c.get("dragInfo"),idealColumnWidth:c.get("idealColumnWidth"),suggestedWidth:c.get("suggestedWidth"),suggestedHeight:c.get("suggestedHeight"),AttachmentView:c.get("AttachmentView")})):b.prototype.browseContent.apply(this,arguments)},wp.media.view.MediaFrame.Select=b.extend({bindHandlers:function(){this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseRemoteContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this)}}),wp.media.view.Attachment.RemoteLibrary=wp.media.view.Attachment.Library.extend({template:wp.media.template("attachment-remote"),toggleSelection:function(){wp.media.view.Attachment.Library.prototype.toggleSelection.apply(this,arguments)}}),wp.media.view.Attachment.RemoteSelection=wp.media.view.Attachment.Selection.extend({template:wp.media.template("attachment-remote")}),oldAttachmentsSelection=wp.media.view.Attachments.Selection,wp.media.view.Attachments.Selection=oldAttachmentsSelection.extend({initialize:function(){return _.defaults(this.options,{AttachmentView:wp.media.view.Attachment.RemoteSelection}),oldAttachmentsSelection.prototype.initialize.apply(this,arguments)}})}(jQuery);
  • remote-medias-lite/trunk/assets/js/media-remote-query-test.js

    r997433 r1121928  
     1window.ocs = window.ocs || {};
     2ocs.rml = ocs.rml || {};
     3
    14(function($){
    2 $(document).ready(function($) {
    3     $('#rml_service_selection,#rml_account_settings select').live('change', function () {
    4         $('.rml-status-field.working').hide();
    5         $('.rml-status-field.notvalid').hide();
    6         $('.rml-status-field.unknown').show();
     5    'use strict';
     6    ocs.rml.AccountStatusManager = function () {
     7        this.init();
     8    }
     9
     10    ocs.rml.AccountStatusManager.prototype = {
     11        $statusField: $('.rml-status-field'),
     12        $querymsg: $('#query_msg'),
     13        $loading: $('#rmlloading'),
     14        $currentFields: null,
     15        authInterval: null,
     16        init: function () {
     17        },
     18        hookevents: function () {
     19            var that = this;
     20            $('#rml_service_selection,#rml_account_settings select').live('change', function () {
     21                that.setStatus('unknown');
     22            });
     23            $('#rml_account_settings input').live('keyup', function () {
     24                that.setStatus('unknown');
     25            });
     26            $('.action_query_test').live('click', function() {
     27                that.validate();
     28            });
     29        },
     30        fetchActiveFields: function () {
     31            this.$currentFields = $('.rmlfields-'+$('#remote_media_type').val());
     32        },
     33        getServiceClass: function () {
     34            this.fetchActiveFields();
     35            return this.$currentFields.find('#service_class').val() || '';
     36        },
     37        getPostId: function () {
     38            return $('#post_ID').val();
     39        },
     40        setStatus: function (status) {
     41            var $statusmsg = $('#rmlaccountstatus');
     42
     43            $statusmsg.html(status);
     44            this.$querymsg.html('');
     45            if (status === rmlQueryTestParams.status.invalid) {
     46                this.$querymsg.html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>');
     47            }
     48
     49            if (status === rmlQueryTestParams.status.enabled) {
     50                this.$querymsg.html('<div class="dashicons dashicons-yes ocs-3x ocs-green" style="margin-top: -3px; padding: 0 10px;"></div>');
     51            }
     52           
     53            return;
     54        },
     55        getCurrentSettings: function () {
     56            var settings = {},
     57                elements = $('.rmlfields-'+$('#remote_media_type').val()+'').find('input');
     58            $.each(elements, function () {
     59                var start = this.name.indexOf('[', this.name.indexOf('[')+1)+1,
     60                    end   = this.name.indexOf(']', this.name.indexOf(']')+1),
     61                    name = this.name;
     62                name = name.substr(start,end-start);
     63                settings[name] = $(this).val();
     64            })
     65            return settings;
     66        },
     67        authenticate: function (url) {
     68            var that = this,
     69                authwindow;
     70
     71            this.$loading.css('display', 'inline-block');
     72            this.setStatus(rmlQueryTestParams.status.authProcessing);
     73            if (url) {
     74                authwindow = window.open(url,'rmlauthprocess','height=400,width=800');
     75                this.authInterval = window.setInterval(function() {
     76                    try {
     77                        if (authwindow === null || authwindow.closed) {
     78                            that.authdone(0);
     79                        }
     80                    }
     81                    catch (e) {
     82                    }
     83                }, 1000);
     84            }
     85           
     86        },
     87        authdone: function (status) {
     88            var status = parseInt(status) || 0;
     89            window.clearInterval(this.authInterval);
     90            this.$loading.hide();
     91            if (status === 1) {
     92                this.setStatus(rmlQueryTestParams.status.enabled);
     93                $('.rmlnotice').hide();
     94                $('#rmlstatusbutton').html(rmlQueryTestParams.button.reauth);
     95            } else {
     96                this.setStatus(rmlQueryTestParams.status.authfailed);
     97            }
     98            this.$loading.hide();
     99        },
     100        validate: function () {
     101            var that = this,
     102                data = {
     103                    action: 'rmlQueryTest',
     104                    security: rmlQueryTestParams.nonce,
     105                    post_id: this.getPostId(),
     106                    account: this.getCurrentSettings()
     107                };
     108           
     109            that.$loading.css('display', 'inline-block');
     110
     111            $.post(rmlQueryTestParams.ajax_url, data, function(response) {
     112                that.$loading.hide();
     113                data = $.parseJSON(response);
     114
     115                if (data.authneeded && data.authurl) {
     116                    that.authenticate(data.authurl);
     117                    return true;
     118                }
     119                if(!data.authneeded && parseInt(data.validate) === 1) {
     120                    that.setStatus(rmlQueryTestParams.status.enabled);
     121                    return true;
     122                }
     123
     124                that.setStatus(rmlQueryTestParams.status.invalid);
     125                return false;
     126            });
     127            return false;
     128        }
     129    }
     130    ocs.rml.statusManager = new ocs.rml.AccountStatusManager();
     131
     132    $(document).ready(function($) {
     133        ocs.rml.statusManager.hookevents();
    7134    });
    8     $('#rml_account_settings input').live('keyup', function () {
    9         $('.rml-status-field.working').hide();
    10         $('.rml-status-field.notvalid').hide();
    11         $('.rml-status-field.unknown').show();
    12     });
    13     $('.action_query_test').live('click', function() {
    14         var $metabox = $(this).closest('.rmlfields'),
    15             $currentFields = $('.rmlfields-'+$('#remote_media_type').val()),
    16             data = {
    17                 action: 'rmlQueryTest',
    18                 security: rmlQueryTestParams.nonce,
    19                 post_id: $('#post_ID').val(),
    20                 user_id: $currentFields.find('#remote_user_id').val(),
    21                 service_class: $currentFields.find('#service_class').val()
    22             };
    23 
    24         $('#rmlloading').css('display', 'inline-block');
    25         $('#query_msg').html('');
    26         $('.rml-status-field.working').hide();
    27         $('.rml-status-field.notvalid').hide();
    28         $('.rml-status-field.unknown').show();
    29 
    30         if (data.user_id.length < 1) {
    31             $('#rmlloading').hide();
    32             $('.rml-status-field.notvalid').show();
    33             $('.rml-status-field.working').hide();
    34             $('.rml-status-field.unknown').hide();
    35             $('#query_msg').html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>');
    36             return false;
    37         }
    38         $.post(rmlQueryTestParams.ajax_url, data, function(response) {
    39             $('#rmlloading').hide();
    40             data = $.parseJSON( response );
    41             if(data.validate) {
    42                 $('.rml-status-field.working').show();
    43                 $('.rml-status-field.notvalid').hide();
    44                 $('.rml-status-field.unknown').hide();
    45                 $('#query_msg').html('<div class="dashicons dashicons-yes ocs-3x ocs-green" style="margin-top: -3px; padding: 0 10px;"></div>');
    46                 return true;
    47             }
    48             $('.rml-status-field.notvalid').show();
    49             $('.rml-status-field.working').hide();
    50             $('.rml-status-field.unknown').hide();
    51             $('#query_msg').html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>');
    52             return false;
    53         });
    54         return false;
    55     });
    56 });
    57135}(jQuery));
  • remote-medias-lite/trunk/assets/js/media-remote-query-test.min.js

    r997433 r1121928  
    1 !function(a){a(document).ready(function(a){a("#rml_service_selection,#rml_account_settings select").live("change",function(){a(".rml-status-field.working").hide(),a(".rml-status-field.notvalid").hide(),a(".rml-status-field.unknown").show()}),a("#rml_account_settings input").live("keyup",function(){a(".rml-status-field.working").hide(),a(".rml-status-field.notvalid").hide(),a(".rml-status-field.unknown").show()}),a(".action_query_test").live("click",function(){var b=(a(this).closest(".rmlfields"),a(".rmlfields-"+a("#remote_media_type").val())),c={action:"rmlQueryTest",security:rmlQueryTestParams.nonce,post_id:a("#post_ID").val(),user_id:b.find("#remote_user_id").val(),service_class:b.find("#service_class").val()};return a("#rmlloading").css("display","inline-block"),a("#query_msg").html(""),a(".rml-status-field.working").hide(),a(".rml-status-field.notvalid").hide(),a(".rml-status-field.unknown").show(),c.user_id.length<1?(a("#rmlloading").hide(),a(".rml-status-field.notvalid").show(),a(".rml-status-field.working").hide(),a(".rml-status-field.unknown").hide(),a("#query_msg").html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>'),!1):(a.post(rmlQueryTestParams.ajax_url,c,function(b){return a("#rmlloading").hide(),c=a.parseJSON(b),c.validate?(a(".rml-status-field.working").show(),a(".rml-status-field.notvalid").hide(),a(".rml-status-field.unknown").hide(),a("#query_msg").html('<div class="dashicons dashicons-yes ocs-3x ocs-green" style="margin-top: -3px; padding: 0 10px;"></div>'),!0):(a(".rml-status-field.notvalid").show(),a(".rml-status-field.working").hide(),a(".rml-status-field.unknown").hide(),a("#query_msg").html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>'),!1)}),!1)})})}(jQuery);
     1window.ocs=window.ocs||{},ocs.rml=ocs.rml||{},function(a){"use strict";ocs.rml.AccountStatusManager=function(){this.init()},ocs.rml.AccountStatusManager.prototype={$statusField:a(".rml-status-field"),$querymsg:a("#query_msg"),$loading:a("#rmlloading"),$currentFields:null,authInterval:null,init:function(){},hookevents:function(){var b=this;a("#rml_service_selection,#rml_account_settings select").live("change",function(){b.setStatus("unknown")}),a("#rml_account_settings input").live("keyup",function(){b.setStatus("unknown")}),a(".action_query_test").live("click",function(){b.validate()})},fetchActiveFields:function(){this.$currentFields=a(".rmlfields-"+a("#remote_media_type").val())},getServiceClass:function(){return this.fetchActiveFields(),this.$currentFields.find("#service_class").val()||""},getPostId:function(){return a("#post_ID").val()},setStatus:function(b){var c=a("#rmlaccountstatus");c.html(b),this.$querymsg.html(""),b===rmlQueryTestParams.status.invalid&&this.$querymsg.html('<div class="dashicons dashicons-no ocs-3x ocs-red" style="margin-top: -3px; padding: 0 10px;"></div>'),b===rmlQueryTestParams.status.enabled&&this.$querymsg.html('<div class="dashicons dashicons-yes ocs-3x ocs-green" style="margin-top: -3px; padding: 0 10px;"></div>')},getCurrentSettings:function(){var b={},c=a(".rmlfields-"+a("#remote_media_type").val()).find("input");return a.each(c,function(){var c=this.name.indexOf("[",this.name.indexOf("[")+1)+1,d=this.name.indexOf("]",this.name.indexOf("]")+1),e=this.name;e=e.substr(c,d-c),b[e]=a(this).val()}),b},authenticate:function(a){var b,c=this;this.$loading.css("display","inline-block"),this.setStatus(rmlQueryTestParams.status.authProcessing),a&&(b=window.open(a,"rmlauthprocess","height=400,width=800"),this.authInterval=window.setInterval(function(){try{(null===b||b.closed)&&c.authdone(0)}catch(a){}},1e3))},authdone:function(b){var b=parseInt(b)||0;window.clearInterval(this.authInterval),this.$loading.hide(),1===b?(this.setStatus(rmlQueryTestParams.status.enabled),a(".rmlnotice").hide(),a("#rmlstatusbutton").html(rmlQueryTestParams.button.reauth)):this.setStatus(rmlQueryTestParams.status.authfailed),this.$loading.hide()},validate:function(){var b=this,c={action:"rmlQueryTest",security:rmlQueryTestParams.nonce,post_id:this.getPostId(),account:this.getCurrentSettings()};return b.$loading.css("display","inline-block"),a.post(rmlQueryTestParams.ajax_url,c,function(d){return b.$loading.hide(),c=a.parseJSON(d),c.authneeded&&c.authurl?(b.authenticate(c.authurl),!0):c.authneeded||1!==parseInt(c.validate)?(b.setStatus(rmlQueryTestParams.status.invalid),!1):(b.setStatus(rmlQueryTestParams.status.enabled),!0)}),!1}},ocs.rml.statusManager=new ocs.rml.AccountStatusManager,a(document).ready(function(){ocs.rml.statusManager.hookevents()})}(jQuery);
  • remote-medias-lite/trunk/lang/remote-medias-lite.pot

    r1006821 r1121928  
    77msgid ""
    88msgstr ""
    9 "Project-Id-Version: RemoteMediasLite 1.1.1\n"
     9"Project-Id-Version: remote-medias-lite 1.1.1\n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2014-09-29 15:40-0400\n"
     11"POT-Creation-Date: 2015-03-26 22:35-0700\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1818"Content-Transfer-Encoding: 8bit\n"
    1919
    20 #: remote-medias-libs.php:41
     20#: bootstrap.php:33
    2121#, php-format
    2222msgid ""
     
    2525msgstr ""
    2626
    27 #: remote-medias-libs.php:43
     27#: bootstrap.php:35 remote-medias-libs.php:13
    2828#, php-format
    2929msgid ""
     
    8181
    8282#: src/RemoteMediaExt/AccountPostType.php:51
     83msgid "Remote library authentication needed. %sAuthenticate now%"
     84msgstr ""
     85
     86#: src/RemoteMediaExt/AccountPostType.php:55
    8387msgid ""
    8488"Could not connect to remote Library. Please verify your remote library "
     
    8690msgstr ""
    8791
    88 #: src/RemoteMediaExt/AccountPostType.php:73
    89 #: src/RemoteMediaExt/AccountPostType.php:74
     92#: src/RemoteMediaExt/AccountPostType.php:80
     93#: src/RemoteMediaExt/AccountPostType.php:81
    9094msgid "Remote library settings updated."
    9195msgstr ""
    9296
    93 #: src/RemoteMediaExt/AccountPostType.php:76
     97#: src/RemoteMediaExt/AccountPostType.php:83
    9498#, php-format
    9599msgid "Remote library settings restored to revision from %s"
    96100msgstr ""
    97101
    98 #: src/RemoteMediaExt/AccountPostType.php:77
     102#: src/RemoteMediaExt/AccountPostType.php:84
    99103msgid "Remote library settings published."
    100104msgstr ""
    101105
    102 #: src/RemoteMediaExt/AccountPostType.php:78
     106#: src/RemoteMediaExt/AccountPostType.php:85
    103107msgid "Remote library settings saved."
    104108msgstr ""
    105109
    106 #: src/RemoteMediaExt/AccountPostType.php:79
     110#: src/RemoteMediaExt/AccountPostType.php:86
    107111msgid "Remote library settings submitted."
    108112msgstr ""
    109113
    110 #: src/RemoteMediaExt/AccountPostType.php:81
     114#: src/RemoteMediaExt/AccountPostType.php:88
    111115#, php-format
    112116msgid "Remote library settings scheduled for: <strong>%1$s</strong>."
    113117msgstr ""
    114118
    115 #: src/RemoteMediaExt/AccountPostType.php:83
     119#. //php.net/date
     120#: src/RemoteMediaExt/AccountPostType.php:90
    116121msgid "M j, Y @ G:i"
    117122msgstr ""
    118123
    119 #: src/RemoteMediaExt/AccountPostType.php:85
     124#: src/RemoteMediaExt/AccountPostType.php:92
    120125msgid "Remote library settings draft updated."
     126msgstr ""
     127
     128#: src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php:219
     129#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:25
     130msgid "Enabled"
     131msgstr ""
     132
     133#: src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php:221
     134msgid "Authenticate now"
     135msgstr ""
     136
     137#: src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php:223
     138#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:23
     139msgid "Invalid"
     140msgstr ""
     141
     142#: src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php:225
     143#: src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php:228
     144#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:22
     145msgid "Unknown"
    121146msgstr ""
    122147
     
    138163
    139164#: src/RemoteMediaExt/Accounts/Dailymotion/Service.php:14
    140 msgid "Dailymotion Basic"
     165msgid "Dailymotion"
    141166msgstr ""
    142167
     
    150175
    151176#: src/RemoteMediaExt/Accounts/Flickr/Service.php:14
    152 msgid "Flickr Basic"
     177msgid "Flickr"
    153178msgstr ""
    154179
     
    161186msgstr ""
    162187
     188#: src/RemoteMediaExt/Accounts/Instagram/Service.php:14
     189msgid "Instagram"
     190msgstr ""
     191
     192#: src/RemoteMediaExt/Accounts/Instagram/Service.php:36
     193msgid "Instagram Username"
     194msgstr ""
     195
     196#: src/RemoteMediaExt/Accounts/Instagram/Service.php:41
     197msgid "Insert the Instagram user for this library"
     198msgstr ""
     199
    163200#: src/RemoteMediaExt/Accounts/Vimeo/Service.php:14
    164 msgid "Vimeo Basic"
     201msgid "Vimeo"
    165202msgstr ""
    166203
     
    174211
    175212#: src/RemoteMediaExt/Accounts/Youtube/Service.php:16
    176 msgid "Youtube Basic"
     213msgid "Youtube"
    177214msgstr ""
    178215
     
    185222msgstr ""
    186223
    187 #: src/RemoteMediaExt/FRemoteMediaExt.php:139
     224#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:24
     225msgid "Authenticating"
     226msgstr ""
     227
     228#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:26
     229msgid "Authenticate Now"
     230msgstr ""
     231
     232#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:27
     233msgid "Failed Auth"
     234msgstr ""
     235
     236#: src/RemoteMediaExt/Ajax/AjaxQueryValidation.php:29
     237msgid "Re-authenticate"
     238msgstr ""
     239
     240#: src/RemoteMediaExt/FRemoteMediaExt.php:147
    188241msgid "New Menu Added"
    189242msgstr ""
    190243
    191 #: src/RemoteMediaExt/FRemoteMediaExt.php:140
     244#: src/RemoteMediaExt/FRemoteMediaExt.php:148
    192245#, php-format
    193246msgid ""
     
    196249msgstr ""
    197250
    198 #: src/RemoteMediaExt/FRemoteMediaExt.php:151
     251#: src/RemoteMediaExt/FRemoteMediaExt.php:159
    199252msgid "Media Manager Extended"
    200253msgstr ""
    201254
    202 #: src/RemoteMediaExt/FRemoteMediaExt.php:152
     255#: src/RemoteMediaExt/FRemoteMediaExt.php:160
    203256#, php-format
    204257msgid ""
     
    207260msgstr ""
    208261
    209 #: src/RemoteMediaExt/FRemoteMediaExt.php:178
     262#: src/RemoteMediaExt/FRemoteMediaExt.php:186
    210263msgid "Service Selection"
    211264msgstr ""
    212265
    213 #: src/RemoteMediaExt/FRemoteMediaExt.php:191
     266#: src/RemoteMediaExt/FRemoteMediaExt.php:198
    214267msgid "Account Settings"
    215268msgstr ""
    216269
    217 #: src/RemoteMediaExt/FRemoteMediaExt.php:202
     270#: src/RemoteMediaExt/FRemoteMediaExt.php:209
    218271msgid "Status & Actions"
    219272msgstr ""
    220273
    221 #: src/RemoteMediaExt/FRemoteMediaExt.php:220
     274#: src/RemoteMediaExt/FRemoteMediaExt.php:227
    222275msgid "Remote Service"
    223276msgstr ""
    224277
    225 #: src/RemoteMediaExt/FRemoteMediaExt.php:227
     278#: src/RemoteMediaExt/FRemoteMediaExt.php:234
    226279msgid "Choose the type of service you want to connect."
    227280msgstr ""
     
    262315
    263316#: vendor/loumray/wpforms/src/UploadLibrary.php:129
    264 #: views/admin/media-remote-attachment.php:27
     317#: views/admin/media-remote-attachment.php:26
    265318msgid "Remove"
    266319msgstr ""
    267320
    268 #: views/admin/media-remote-attachment.php:31
     321#: views/admin/media-remote-attachment.php:30
    269322msgid "Deselect"
    270323msgstr ""
    271324
    272 #: views/admin/media-remote-attachment.php:39
     325#: views/admin/media-remote-attachment.php:37
    273326msgid "Caption this image&hellip;"
    274327msgstr ""
    275328
     329#: views/admin/media-remote-attachment.php:41
     330msgid "Describe this video&hellip;"
     331msgstr ""
     332
    276333#: views/admin/media-remote-attachment.php:43
    277 msgid "Describe this video&hellip;"
     334msgid "Describe this audio file&hellip;"
    278335msgstr ""
    279336
    280337#: views/admin/media-remote-attachment.php:45
    281 msgid "Describe this audio file&hellip;"
    282 msgstr ""
    283 
    284 #: views/admin/media-remote-attachment.php:47
    285338msgid "Describe this media file&hellip;"
    286339msgstr ""
     
    312365msgstr ""
    313366
     367#: views/admin/media-upload-instagram.php:11
     368msgid "Get unlimited number of pictures with RML Instagram Pro"
     369msgstr ""
     370
     371#: views/admin/media-upload-instagram.php:13
     372msgid "Get the extension and unlock premium features &raquo;"
     373msgstr ""
     374
     375#: views/admin/media-upload-instagram.php:16
     376msgid "Add our RML Instagram Pro extension to unlock premium features."
     377msgstr ""
     378
    314379#: views/admin/media-upload-vimeo.php:11
    315380msgid "Upload videos directly to your Vimeo account"
     
    330395msgstr ""
    331396
    332 #: views/admin/metaboxes/status-actions.php:5
     397#: views/admin/metaboxes/status-actions.php:9
    333398msgid "Account Status:"
    334399msgstr ""
    335400
    336 #: views/admin/metaboxes/status-actions.php:29
    337 msgid "Working"
    338 msgstr ""
    339 
    340 #: views/admin/metaboxes/status-actions.php:30
    341 msgid "Unknown"
    342 msgstr ""
    343 
    344 #: views/admin/metaboxes/status-actions.php:31
    345 msgid "Invalid"
    346 msgstr ""
    347 
    348 #: views/admin/metaboxes/status-actions.php:39
     401#: views/admin/metaboxes/status-actions.php:27
    349402msgid "Validate"
    350403msgstr ""
  • remote-medias-lite/trunk/readme.txt

    r1006821 r1121928  
    1 === Remote Media Libraries ===
     1=== Remote Media Libraries ===
    22Contributors: loumray
    3 Tags: youtube, vimeo, vimeo pro, dailymotion, flickr, API, Media Manager, Extension, Integration, direct upload, private videos, remote medias libraries, media explorer, embeds
     3Tags: youtube, vimeo, vimeo pro, dailymotion, flickr, API, Media Manager, Media Library Extension, Integration, direct upload, private videos, remote medias libraries, media explorer, embeded
    44Requires at least: 3.5
    5 Tested up to: 4.0
     5Tested up to: 4.2-beta1
    66Stable tag: 1.1.2
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
    99
    10 Remote Media Libraries gives you direct access to all medias accross the web directly from the Media Manager.
     10Remote Media Libraries (RML) gives you access to third parties media libraries directly from the Wordpress Media Library.
    1111
    1212== Description ==
    1313
    14 Remote Media Libraries gives you access to your favorite content of youtube, vimeo, dailymotion, flickr directly into the media manager.
     14Remote Media Libraries (RML) gives you access to your favorite content from Youtube, Vimeo, Dailymotion, Flickr and Instagram directly into the media library. The RML plugin makes it possible to navigate, search, and inserts remote media into you posts and pages. This will increased your page load time and also save on server bandwidth.
    1515
    16 The plugin makes it possible to navigate and manage all your medias from all your favorite remote services directly from wordpress media manager
     16You can create as many account as you want and they will show in the left sidebar of the Wordpress media library
    1717
    18 A LOT of service will be added for direct integration. Send us you favorite service and we will integrate it FAST.
    19 
    20 Also, it is possible to download cheaps add-ons that will let you direct upload your media files to 3rd party services and update your media content directly from your wordpress admin panel.
    21 
    22 = Supported Services =
     18= Currently Integrated Services =
    2319
    2420* Youtube
     
    2622* Dailymotion
    2723* Flickr
     24* Instagram
     25
     26= Vote for the next integration =
     27
     28We need your feedback to know which will be the next integration added to RML. Please take 1 minute to fill out this quick survey:
     29
     30<a href="http://onecodeshop.com/vote-for-the-next-integration/">Next integration survey »</a>
     31
     32= RML Pro versions =
     33
     34RML Pro versions let you access premium features:
     35
     36* Albums/lists filtering
     37* Unlimited amount of media in the library
     38* Secure private content
     39* Upload from Wordpress media library to your remote service
     40* And more ...
     41
     42More informations on RML pro versions:
     43
     44* <a href="http://onecodeshop.com/youtube-pro-remote-media-libraries/">RML Youtube Pro</a>
     45* <a href="http://onecodeshop.com/flickr-pro-remote-media-libraries/">RML Flickr Pro</a>
     46* <a href="http://onecodeshop.com/instagram-pro-remote-media-libraries/">RML Instagram Pro</a>
     47
    2848
    2949= Upcoming Services =
    3050
    31 * Vimeo Pro (make your exclusive videos private right from WP admin)
    32 * Instagram
     51* Amazon S3 Services
     52* Amazon Cloud Front
     53* Vimeo Pro (Upload capability)
     54* DropBox
    3355* Tumblr
    3456* Photobucket
     57* Facebook
    3558* Twitter
    36 * Amazon S3 Services
    3759* Cloud files
     60* Pixabay
     61* <a href="http://onecodeshop.com/vote-for-the-next-integration/">Vote for the next integration »</a>
    3862
    3963= Follow us! =
     
    4367* <a href="https://twitter.com/onecodeshop">twitter.com/onecodeshop</a>
    4468
    45 = Planned for Next Release =
     69= Buy us a coffee! =
    4670
    47 * Youtube Search & public feeds
    48 * Flickr Latest public feed and favorites
    49 * Instagram Basic Beta support
     71We do work hard to bring you the best of the RML plugin. As normal programmers and designers we live on coffee, support us and buy us a coffee, you will make us happy :) Humm coffee ...
     72
     73<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=P9N89H4AJ5PCL">Buy us a coffee »</a>
    5074
    5175== Changelog ==
     76= 1.2.0 =
     77* Initial support of instagram
     78* Update media library attachment template in media library to match WP behavior for local medias.
     79* Added missing image size in  display settings
     80* Fixed a bug that occured in the case that Youtube do not return any author
     81* Makes plugin main script parsable by PHP 5.2 to fail gracefully and display a notice.
     82* Extend plugin to support APIs that need authentication
     83
    5284= 1.1.2 =
    5385* Fixed a bug causing bad edit links on re-activated Link Manager admin links page
     
    6698
    6799== Upgrade Notice ==
     100= 1.2.0 =
     101This version add instagram support and multiple fixes.
     102
    68103= 1.1.1 =
    69104Improved support for remote medias images in Media Manager
     
    77112* WordPress 3.5 or greater
    78113* PHP version 5.3.3 or greater
     114* PHP cURl module intsalled
    79115
    80116= Manual installation =
  • remote-medias-lite/trunk/remote-medias-libs.php

    r1006821 r1121928  
    44Plugin URI: http://onecodeshop.com/
    55Description: Integrates 3rd party medias to WP media manager
    6 Version: 1.1.2
     6Version: 1.2.0
    77Author: Team OneCodeShop.com
    88Author URI: http://onecodeshop.com/
    99*/
    10 namespace WPRemoteMediaExt;
    1110
    12 use WPRemoteMediaExt\WPCore\admin\WPadminNotice;
    13 use WPRemoteMediaExt\WPCore\View;
    14 use WPRemoteMediaExt\WPCore\WPpluginTextDomain;
    15 use WPRemoteMediaExt\RemoteMediaExt\FRemoteMediaExt;
    16 use WPRemoteMediaExt\WPCore\WPplugin;
    17 
    18 require 'autoload.php';
    19 
    20 class PRemoteMedias extends WPplugin
     11function ocsRmlPhpNotice()
    2112{
    22 
    23     public static $instance;
    24 
    25     public static function getInstance()
    26     {
    27         if (!isset(self::$instance)) {
    28             self::$instance = new self();
    29         }
    30 
    31         return self::$instance;
    32     }
    33 
    34     public function __construct()
    35     {
    36         load_plugin_textdomain('remote-medias-lite', false, dirname(plugin_basename(__FILE__)).'/lang');
    37 
    38         parent::__construct(__FILE__, 'Remote Media Libraries', 'remote-medias-lite');
    39 
    40         $this->setReqWpVersion("3.5");
    41         $this->setReqWPMsg(sprintf(__('%s <strong>Requirements failed.</strong> WP version must <strong>at least %s</strong>. You are using version '.$GLOBALS['wp_version'], 'remote-medias-lite'), $this->getName(), $this->reqWPVersion));
    42         $this->setReqPhpVersion("5.3.3");
    43         $this->setReqPHPMsg(sprintf(__('%s <strong>Requirements failed.</strong> PHP version must <strong>at least %s</strong>. You are using version '. PHP_VERSION, 'remote-medias-lite'), $this->getName(), $this->reqPHPVersion));
    44                
    45         $this->setMainFeature(FRemoteMediaExt::getInstance());
    46         parent::init();
    47     }
     13    echo '<div class="message error"><p>'.sprintf(__('%s <strong>Requirements failed.</strong> PHP version must <strong>at least %s</strong>. You are using version '. PHP_VERSION, 'remote-medias-lite'), 'Remote Media Libraries', '5.3.3').'</p></div>';
    4814}
    4915
    50 $pwebremotemediasext = PRemoteMedias::getInstance();
    51 $pwebremotemediasext->register();
     16/*
     17 * Unfortunately, while grand daddy PHP 5.2 is still hanging around this check avoid PHP error upon PHP 5.2 activation.
     18 */
     19if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
     20    require 'bootstrap.php';
     21} else {
     22    add_action('admin_notices', 'ocsRmlPhpNotice');
     23}
  • remote-medias-lite/trunk/src/RemoteMediaExt/AccountPostType.php

    r1006821 r1121928  
    4646    public function initAdminNotices()
    4747    {
    48         if (isset($_REQUEST['rmlmsg']) &&
    49             absint($_REQUEST['rmlmsg']) === 1
    50         ) {
    51             $notice = new WPadminNotice(__("Could not connect to remote Library. Please verify your remote library settings. Only valid libraries are added to the media manager.", 'remote-medias-lite'), "message error");
    52             $notice->register();
     48        if (isset($_REQUEST['rmlmsg'])) {
     49            switch(absint($_REQUEST['rmlmsg'])) {
     50                case 1:
     51                    $notice = new WPadminNotice(sprintf(__("Remote library authentication needed. %sAuthenticate now%", 'remote-medias-lite'), '<a class="action_query_test" href="#">', '</a>'), "message error rmlnotice");
     52                    $notice->register();
     53                    break;
     54                case 2:
     55                    $notice = new WPadminNotice(__("Could not connect to remote Library. Please verify your remote library settings. Only valid libraries are added to the media manager.", 'remote-medias-lite'), "message error");
     56                    $notice->register();
     57                    break;
     58            }
     59           
    5360        }
    5461    }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php

    r998050 r1121928  
    33
    44use WPRemoteMediaExt\Guzzle\Http\Exception\ClientErrorResponseException;
     5use WPRemoteMediaExt\RemoteMediaExt\Exception;
    56
    67abstract class AbstractRemoteAccount
    78{
     9    const STATUS_UNKNOWN    = 0;
     10    const STATUS_AUTHNEEDED = 1;
     11    const STATUS_INVALID    = 2;
     12    const STATUS_ENABLED    = 10;
     13
    814    protected $localID;
    915    protected $remoteID;
     
    3137    }
    3238
     39    public function setId($aid)
     40    {
     41        $this->localID = $aid;
     42
     43        return $this;
     44    }
     45    public function setType($type)
     46    {
     47        $this->type = $type;
     48
     49        return $this;
     50    }
     51
    3352    public function getId()
    3453    {
     
    3958    {
    4059        return is_a($this->service, get_class($service));
     60    }
     61
     62    public function setServiceFromClass($serviceClass)
     63    {
     64        $serviceInstance = RemoteServiceFactory::create($serviceClass);
     65        if (!is_null($serviceInstance) &&
     66            $serviceInstance instanceof AbstractRemoteService
     67        ) {
     68            $this->setService($serviceInstance);
     69        }
    4170    }
    4271
     
    5281            if (!empty($serviceClass)) {
    5382                $serviceClass = RemoteServiceFactory::retrieveClassName($serviceClass);
    54 
    55                 $this->setService(RemoteServiceFactory::create($serviceClass));
     83                $this->setServiceFromClass($serviceClass);
    5684            }
    5785        }
     
    6189
    6290    /*
    63      * return false on failure true if success
     91     * @return false on failure or no change update true on update
     92     *
    6493     */
    6594    public function save()
    6695    {
    67         $this->validate();
    68 
     96        $this->set('service_class', RemoteServiceFactory::getDbClassName(RemoteServiceFactory::getClass($this->type)));
    6997        $return = update_post_meta($this->localID, 'remote_attr', $this->attributes);
    7098        $return = update_post_meta($this->localID, 'remote_account_type', $this->type) && $return;
     
    82110    }
    83111
     112    public function getServiceNamespace()
     113    {
     114        $serviceclass = get_class($this->service);
     115        return substr($serviceclass, 0, strrpos($serviceclass, '\\'));
     116
     117    }
     118   
    84119    public function getService()
    85120    {
     
    87122    }
    88123
    89     public function get($name)
     124    public function get($name, $default = null)
    90125    {
    91126        if ($name === null) {
     
    97132        }
    98133
    99         return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
     134        return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
    100135    }
    101136
     
    111146        if ($name == 'remote_account_type') {
    112147            $this->type = $value;
    113             $this->set('service_class', RemoteServiceFactory::getDbClassName(RemoteServiceFactory::getClass($this->type)));
    114148            return $this;
    115149        }
     
    141175    }
    142176
     177    public function isEnabled()
     178    {
     179        $isEnabled = $this->get('isEnabled', false);
     180        if ($isEnabled === true) {
     181            return true;
     182        }
     183
     184        $isValid = $this->get('isValid', false);
     185        $isAuthNeeded = $this->isAuthNeeded();
     186        if ($isAuthNeeded === false &&
     187            $isValid === true
     188        ) {
     189            return true;
     190        }
     191        return false;
     192    }
     193
     194    public function isAuthNeeded()
     195    {
     196        if ($this->service instanceof AbstractAuthService) {
     197            return true;
     198        }
     199
     200        return false;
     201    }
     202
     203    public function getAuthUrl()
     204    {
     205        if (!$this->isAuthNeeded() ||
     206            !$this->service instanceof AbstractAuthService
     207        ) {
     208            return '';
     209        }
     210
     211        return $this->service->getAuthUrl();
     212    }
     213
     214    public function getStatusDisplay()
     215    {
     216        $status = $this->getStatus();
     217        switch ($status) {
     218            case self::STATUS_ENABLED:
     219                return __('Enabled', 'remote-medias-lite');
     220            case self::STATUS_AUTHNEEDED:
     221                return __('Authenticate now', 'remote-medias-lite');
     222            case self::STATUS_INVALID:
     223                return __('Invalid', 'remote-medias-lite');
     224            default:
     225                return __('Unknown', 'remote-medias-lite');
     226        }
     227
     228        return __('Unknown', 'remote-medias-lite');
     229    }
     230
     231    public function getStatus()
     232    {
     233        if ($this->isEnabled()) {
     234            return self::STATUS_ENABLED;
     235        }
     236
     237        if ($this->isAuthNeeded()) {
     238            return self::STATUS_AUTHNEEDED;
     239        }
     240
     241        $isValid = $this->get('isValid');
     242        if ($isValid === false) {
     243            return self::STATUS_INVALID;
     244        }
     245        return self::STATUS_UNKNOWN;
     246    }
     247
     248    /*
     249    * @return 1 on validate, 0 on invalid params, -1 on error
     250    */
    143251    public function validate()
    144252    {
    145         if (!($this->service instanceof AbstractRemoteService)) {
    146             return false;
    147         }
    148 
    149         $return = array();
    150         $return['validate'] = false;
    151        
     253        $isValid = 0;
     254        $this->set('isValid', false);
     255
    152256        try {
    153             $return['validate'] = $this->service->validate($this);
     257            $isServiceValid = $this->service->validate();
     258            if ($isServiceValid === true) {
     259                $this->set('isValid', true);
     260                $isValid = 1;
     261            }
    154262        } catch (ClientErrorResponseException $e) {
    155             $return['error'] = true;
    156             $return['statuscode'] = $e->getResponse()->getStatusCode();
    157             $return['msg']        = $e->getResponse()->getReasonPhrase();
     263            $isValid = 0;
     264        } catch (Exception\InvalidAuthParamException $e) {
     265            $isValid = 0;
    158266        } catch (\Exception $e) {
    159             $return['error'] = true;
    160             $return['statuscode'] = $e->getCode();
    161             $return['msg']        = $e->getMessage();
    162         }
    163 
    164         $lastValidQuery = null;
    165 
    166         if ($return['validate'] === true) {
    167             $lastValidQuery =  $this->get('remote_user_id');
    168             $this->set('isValid', true);
    169         } else {
    170             $this->set('isValid', false);
    171         }
    172 
    173         $this->set('last_valid_query', $lastValidQuery);
    174 
    175         return $return['validate'];
     267            error_log('RML error occured validating account '.$this->getId().': '.$e->getMessage());
     268            $isValid = -1;
     269        }
     270
     271        return $isValid;
    176272    }
    177273}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteMedia.php

    r998050 r1121928  
    105105            );
    106106        }
    107         $sizes['full'] = array('url' => $url);
     107        $sizes['full'] = array(
     108            'height'      => $height,
     109            'width'       => $width,
     110            'url'         => $url,
     111            'orientation' => $height > $width ? 'portrait' : 'landscape',
     112        );
    108113
    109114        return $sizes;
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/AbstractRemoteService.php

    r998050 r1121928  
    2525    {
    2626        $this->accountPostType = $postType;
     27
     28        return $this;
    2729    }
    2830
     
    3032    {
    3133        $this->client = $client;
     34
     35        return $this;
    3236    }
    3337
     
    5559    {
    5660        foreach ($this->fieldSet as $field) {
    57             $field->attr('value', esc_attr($this->account->get($this->getSlug().'_'.$field->attr('id'))));
     61            $value = $this->account->get($this->getSlug().'_'.$field->attr('id'));
     62            $default = $field->attr('default');
     63            if (is_null($value) && !is_null($default)) {
     64                $value = $default;
     65            }
     66            $field->attr('value', esc_attr($value));
    5867        }
    5968        return $this->fieldSet;
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Dailymotion/Service.php

    r998050 r1121928  
    1212    public function __construct()
    1313    {
    14         parent::__construct(__('Dailymotion Basic'), 'dailymotion');
     14        parent::__construct(__('Dailymotion', 'remote-medias-lite'), 'dailymotion');
    1515
    1616        $client = Client::factory();
     
    3838            'class' => $this->getSlug(),
    3939            'id' => 'remote_user_id',
    40             'name' => 'account_meta['.$this->getSlug().'][remote_user_id]',
     40            'name' => 'account_meta['.$this->getSlug().'][dailymotion_remote_user_id]',
    4141            'desc' => __("Insert the Dailymotion User ID for this library", 'remote-medias-lite'),
    4242        );
     
    4949
    5050        $params = array(
    51             'user_id' => $this->account->get('remote_user_id'),
     51            'user_id' => $this->account->get('dailymotion_remote_user_id'),
    5252            'fields'  => 'id,screenname,status,username'
    5353        );
     
    6969
    7070        $params = array(
    71             'user_id' => $this->account->get('remote_user_id'),
     71            'user_id' => $this->account->get('dailymotion_remote_user_id'),
    7272            'fields'  => 'id,title,description,created_time,modified_time,owner,thumbnail_120_url,thumbnail_url,url'
    7373        );
     
    8181    {
    8282        $params = array(
    83             'user_id' => $this->account->get('remote_user_id'),
    84             'fields'  => 'id,title,description,created_time,modified_time,owner,thumbnail_120_url,thumbnail_url,url'
     83            'user_id' => $this->account->get('dailymotion_remote_user_id'),
     84            'fields'  => 'id,title,description,created_time,modified_time,owner,thumbnail_120_url,thumbnail_url,url',
    8585        );
    8686        $command = $this->client->getCommand('UserVideosRequest', $params);
     
    9292    public function getUserAttachments()
    9393    {
     94        $page = 1;
     95        $perpage = 40;
     96        $searchTerm = '';
     97
     98        if (isset($_POST['query']['posts_per_page'])) {
     99            $perpage = absint($_POST['query']['posts_per_page']);
     100        }
     101        if (isset($_POST['query']['s'])) {
     102            $searchTerm = sanitize_text_field($_POST['query']['s']);
     103        }
     104
    94105        $response = $this->GetUserMedias();
    95106        $medias = $response->getAll();
     
    102113            $attachments[$i] = $remoteMedia->toMediaManagerAttachment();
    103114        }
     115
     116        unset($attachments[count($attachments)-1]);
    104117        return $attachments;
    105118    }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Dailymotion/ServiceDescription.json

    r997433 r1121928  
    2727      "UserVideosRequest": {
    2828        "httpMethod": "GET",
    29         "uri": "user/{user_id}/videos?fields={fields}",
     29        "uri": "user/{user_id}/videos",
    3030        "summary": "Access the videos for a specific user",
    3131        "class": "WPRemoteMediaExt\\Guzzle\\Service\\Command\\OperationCommand",
     
    4040                "fields": {
    4141                    "type": "string",
    42                     "location": "uri",
     42                    "location": "query",
    4343                    "default": "id,title",
    4444                    "description": "Fields list. See http://www.dailymotion.com/doc/api/obj-video.html"
     45                },
     46                "page": {
     47                    "type": "string",
     48                    "location": "query",
     49                    "default": "1"
     50                },
     51                "limit": {
     52                    "type": "string",
     53                    "location": "query",
     54                    "default": "40"
    4555                }
    4656            }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Flickr/Service.php

    r998050 r1121928  
    1212    public function __construct()
    1313    {
    14           parent::__construct(__('Flickr Basic'), 'flickr');
     14          parent::__construct(__('Flickr', 'remote-medias-lite'), 'flickr');
    1515
    1616          $client = Client::factory();
     
    4747            'id' => 'remote_user_id',
    4848            'placeholder' => 'XXXXXXXX@NXX',
    49             'name' => 'account_meta['.$this->getSlug().'][remote_user_id]',
     49            'name' => 'account_meta['.$this->getSlug().'][flickr_remote_user_id]',
    5050            'desc' => __("Insert the Flickr User NSID for this library", 'remote-medias-lite'),
    5151        );
     
    5656    {
    5757        $params = array(
    58             'user_id' => $this->account->get('remote_user_id'),
     58            'user_id' => $this->account->get('flickr_remote_user_id'),
    5959        );
    6060        $command = $this->client->getCommand('UserPublicPhotos', $params);
    6161        $response = $this->client->execute($command);
    62 
    63         return $command->getResponse()->isSuccessful();
     62       
     63        return $response->isSuccessful();
    6464    }
    6565
     
    6868
    6969        // $params = array(
    70         //     'user_id' => $account->get('remote_user_id'),
     70        //     'user_id' => $account->get('flickr_remote_user_id'),
    7171        //     'request' => 'info'
    7272        // );
     
    7777    }
    7878
     79    /*
     80    *
     81    * Per Flickr site:
     82    *   Why do I only see 20 items in RSS feeds?
     83    *   Flickr only shows the latest 20 items in a feed. Because of this,
     84    *   the first time you connect to a feed you will only see the most
     85    *   recent items. But if your RSS reader saves items (as most do) you
     86    *   will see more than 20 as the items build up over time.
     87    *
     88    * from: https://www.flickr.com/help/website/#109651
     89    */
    7990    public function getUserMedias()
    8091    {
    8192        $params = array(
    82             'user_id' => $this->account->get('remote_user_id'),
     93            'user_id' => $this->account->get('flickr_remote_user_id'),
    8394        );
    8495        $command = $this->client->getCommand('UserPublicPhotos', $params);
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/MetaBoxSaveAccount.php

    r998050 r1121928  
    2828            if (is_array($value)) {
    2929                foreach ($value as $typedata => $typevalue) {
    30                     $account->set($key.'_'.$typedata, sanitize_text_field($typevalue));
     30                    $account->set($typedata, sanitize_text_field($typevalue));
    3131                }
    3232            } else {
     
    3535        }
    3636
    37         $account->set('remote_user_id', sanitize_text_field($_POST['account_meta'][$accountType]['remote_user_id']));
    3837        $account->set('service_class', sanitize_text_field($_POST['account_meta'][$accountType]['service_class']));
     38        $account->setServiceFromClass(stripslashes($account->get('service_class')));
    3939
     40        $account->validate();
    4041        $account->save();
    4142
    42         $isValid = $account->get('isValid');
    43         if (!$isValid) {
    44             $_REQUEST['rmlmsg'] = 1;
     43        $isEnabled = $account->isEnabled();
     44
     45        if (!$isEnabled) {
     46            $_REQUEST['rmlmsg'] = $account->getStatus();
    4547        } elseif (isset($_REQUEST['rmlmsg'])) {
    4648            unset($_REQUEST['rmlmsg']);
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/RemoteAccountFactory.php

    r992903 r1121928  
    44class RemoteAccountFactory
    55{
    6     //TODO create by id and create by type
    76    public static function create($rmID)
    87    {
     
    1615            $newaccount = new RemoteAccount();
    1716            $newaccount->setService($service);
     17            $newaccount->setType(RemoteServiceFactory::getType($serviceClass));
    1818
    1919            return $newaccount;
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/RemoteMediaFactory.php

    r997433 r1121928  
    44class RemoteMediaFactory
    55{
     6    public static function createFromAccountid($accountId, $metadata = array())
     7    {
     8        $account = RemoteAccountFactory::create($accountId);
     9        $baseNamespace = $account->getServiceNamespace();
     10        $rmclass = $baseNamespace.'\\RemoteMedia';
     11        if (class_exists($rmclass)) {
     12            return new $rmclass($metadata);
     13        }
     14        return null;
     15    }
     16
    617    public static function create($subtype, $metadata = array())
    718    {
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/RemoteServiceFactory.php

    r998050 r1121928  
    6868        return null;
    6969    }
     70
     71    public static function getType($class)
     72    {
     73        return array_search($class, self::$classes);
     74    }
    7075}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Vimeo/Service.php

    r998050 r1121928  
    1212    public function __construct()
    1313    {
    14         parent::__construct(__('Vimeo Basic'), 'vimeo');
     14        parent::__construct(__('Vimeo', 'remote-medias-lite'), 'vimeo');
    1515
    1616        $client = Client::factory();
     
    3838            'class' => $this->getSlug(),
    3939            'id' => 'remote_user_id',
    40             'name' => 'account_meta['.$this->getSlug().'][remote_user_id]',
     40            'name' => 'account_meta['.$this->getSlug().'][vimeo_remote_user_id]',
    4141            'desc' => __("Insert the Vimeo User ID for this library", 'remote-medias-lite'),
    4242        );
     
    4848
    4949        $params = array(
    50             'user_id' => $this->account->get('remote_user_id'),
     50            'user_id' => $this->account->get('vimeo_remote_user_id'),
    5151            'request' => 'info'
    5252        );
     
    6161
    6262        $params = array(
    63             'user_id' => $this->account->get('remote_user_id'),
     63            'user_id' => $this->account->get('vimeo_remote_user_id'),
    6464            'request' => 'info'
    6565        );
     
    7070    }
    7171
     72    /*
     73    * From https://developer.vimeo.com/apis/simple
     74    * Simple API responses include up to 20 items per page.
     75    *
     76    * By adding the ?page parameter to the URL, you can retrieve up to 3 pages
     77    * of data. If you need more than the maximum of 60 items, you must use the
     78    * New API.
     79    */
    7280    public function getUserMedias()
    7381    {
    7482        $params = array(
    75             'user_id' => $this->account->get('remote_user_id'),
     83            'user_id' => $this->account->get('vimeo_remote_user_id'),
    7684            'request' => 'videos'
    7785        );
     
    8492    public function getUserAttachments()
    8593    {
     94        $perpage = 40;
     95        $searchTerm = '';
     96
     97        if (isset($_POST['query']['posts_per_page'])) {
     98            $perpage = absint($_POST['query']['posts_per_page']);
     99        }
     100        if (isset($_POST['query']['s'])) {
     101            $searchTerm = sanitize_text_field($_POST['query']['s']);
     102        }
     103
     104        //Vimeo return 20 max items per page
    86105        $response = $this->GetUserMedias();
    87106        $medias = $response->getAll();
     
    92111            $remoteMedia = new RemoteMedia($media);
    93112            $remoteMedia->setAccount($this->getAccount());
    94             $attachments[$i] = $remoteMedia->toMediaManagerAttachment();
     113            $attachments[] = $remoteMedia->toMediaManagerAttachment();
    95114        }
     115       
    96116        return $attachments;
    97117    }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Vimeo/ServiceDescription.json

    r997433 r1121928  
    22    "name": "Vimeo",
    33    "apiVersion": "2",
    4     "description": "This API allows to connect with Vimeo web services",
     4    "description": "This API allows to connect with Vimeo web services. From https://developer.vimeo.com/apis/simple",
    55    "operations": {
    66      "UserRequest": {
     
    2222                    "description": "The data you want. Could be: info,videos,likes,appears_in,all_videos,subscriptions,albums,channels,groups",
    2323                    "required": true
     24                },
     25                "page": {
     26                    "type": "integer",
     27                    "location": "query"
    2428                }
    2529            }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/RemoteMedia.php

    r998050 r1121928  
    2626    {
    2727       
    28 
    2928        $attachment = array_merge(
    3029            $this->getBasicAttachment(),
     
    3635                'link'        => $this->metadata['url'],
    3736                'alt'         => '',
    38                 'author'      => $this->metadata['author']['name'],
     37                'author'      => isset($this->metadata['author']) && isset($this->metadata['author']['name']) ? $this->metadata['author']['name'] : '',
    3938                'description' => $this->metadata['content'],
    4039                'caption'     => "", //limit word count
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/Service.php

    r998050 r1121928  
    1414    public function __construct()
    1515    {
    16         parent::__construct(__('Youtube Basic'), 'youtube');
     16        parent::__construct(__('Youtube', 'remote-medias-lite'), 'youtube');
    1717
    1818        $client = Client::factory();
     
    4040            'class' => $this->getSlug(),
    4141            'id' => 'remote_user_id',
    42             'name' => 'account_meta['.$this->getSlug().'][remote_user_id]',
     42            'name' => 'account_meta['.$this->getSlug().'][youtube_remote_user_id]',
    4343            'desc' => __("Insert the Youtube User ID for this library", 'remote-medias-lite'),
    4444        );
     
    7272    {
    7373        $params = array(
    74             'user_id' => $this->account->get('remote_user_id'),
     74            'user_id' => $this->account->get('youtube_remote_user_id'),
    7575            'request' => 'info'
    7676        );
     
    8585    {
    8686        $params = array(
    87             'user_id' => $this->account->get('remote_user_id')
     87            'user_id' => $this->account->get('youtube_remote_user_id')
    8888        );
    8989        $command = $this->client->getCommand($this->command, $params);
     
    9393    }
    9494
    95     public function getUserMedias()
     95    public function getUserMedias($perpage = 40)
    9696    {
    9797        $params = array(
    98             'user_id' => $this->account->get('remote_user_id')
     98            'user_id' => $this->account->get('youtube_remote_user_id'),
     99            'max-results' => $perpage,
    99100        );
    100101        $command = $this->client->getCommand($this->command, $params);
     
    106107    public function getUserAttachments()
    107108    {
    108         $response = $this->GetUserMedias();
     109        $perpage = 40;
     110        $searchTerm = '';
     111
     112        if (isset($_POST['query']['posts_per_page'])) {
     113            $perpage = absint($_POST['query']['posts_per_page']);
     114        }
     115        if (isset($_POST['query']['s'])) {
     116            $searchTerm = sanitize_text_field($_POST['query']['s']);
     117        }
     118
     119        $response = $this->GetUserMedias($perpage);
    109120        $medias = $response->getAll();
    110121
     
    116127            $attachments[$i] = $remoteMedia->toMediaManagerAttachment();
    117128        }
     129        unset($attachments[count($attachments)-1]);
    118130        return $attachments;
    119131    }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Accounts/Youtube/ServiceDescription.json

    r997433 r1121928  
    1616                    "description": "The user id you want.",
    1717                    "required": true
     18                },
     19                "max-results": {
     20                    "type": "string",
     21                    "location": "query",
     22                    "default": 40
     23                },
     24                "start-index": {
     25                    "type": "string",
     26                    "location": "query",
     27                    "default": 1
     28                },
     29                "orderby": {
     30                    "type": "string",
     31                    "location": "query",
     32                    "default": "published"
    1833                }
    1934            }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxQueryAttachments.php

    r998050 r1121928  
    3232
    3333        } catch (ClientErrorResponseException $e) {
    34             $return['success'] = true;
     34            $return['success'] = false;
    3535            $return['statuscode'] = $e->getResponse()->getStatusCode();
    36             $return['msg']        = $e->getResponse()->getError();
     36            $return['msg']        = $e->getResponse()->getMessage();
    3737            wp_send_json($return);
    3838        } catch (CurlException $e) {
     
    4343        } catch (\Exception $e) {
    4444            $return['success'] = false;
    45             $return['statuscode'] = $e->getResponse()->getStatusCode();
    46             $return['msg']        = $e->getResponse()->getReasonPhrase();
     45            $return['statuscode'] = $e->getCode();
     46            $return['msg']        = $e->getMessage();
    4747            wp_send_json($return);
    4848        }
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxQueryValidation.php

    r997433 r1121928  
    22namespace WPRemoteMediaExt\RemoteMediaExt\Ajax;
    33
    4 use WPRemoteMediaExt\Guzzle\Http\Exception\ClientErrorResponseException;
    5 use WPRemoteMediaExt\RemoteMediaExt\Accounts\Vimeo\VimeoClient;
    64use WPRemoteMediaExt\RemoteMediaExt\Accounts\RemoteAccountFactory;
     5
    76use WPRemoteMediaExt\WPCore\WPajaxCall;
    87
     
    1615    }
    1716
     17    public function getScriptParams()
     18    {
     19        $params = parent::getScriptParams();
     20
     21        $params['status'] = array();
     22        $params['status']['unknown'] = __('Unknown', 'remote-medias-lite');
     23        $params['status']['invalid'] = __('Invalid', 'remote-medias-lite');
     24        $params['status']['authProcessing'] = __('Authenticating', 'remote-medias-lite');
     25        $params['status']['enabled'] = __('Enabled', 'remote-medias-lite');
     26        $params['status']['authNeeded'] = __('Authenticate Now', 'remote-medias-lite');
     27        $params['status']['authfailed'] = __('Failed Auth', 'remote-medias-lite');
     28        $params['button'] = array();
     29        $params['button']['reauth'] = __('Re-authenticate', 'remote-medias-lite');
     30
     31        return $params;
     32    }
     33
     34    public function end($data)
     35    {
     36        echo json_encode($data);
     37        die();
     38    }
     39
    1840    public function callback($data)
    1941    {
    20         $return = array('error' => false);
     42        $return = array(
     43            'error' => false,
     44            'validate' => false,
     45            'authneeded' => false,
     46            'authurl' => ''
     47        );
    2148
    22         $return['validate'] = false;
     49        $data    = $_POST['account'];
     50        $account = RemoteAccountFactory::createFromService(stripslashes(esc_attr($data['service_class'])));
    2351
    24         $account = RemoteAccountFactory::createFromService(stripslashes(esc_attr($_POST['service_class'])));
     52        if (is_null($account)) {
     53            $return['error'] = true;
     54            $return['msg'] = 'Service type class '.stripslashes(esc_attr($data['service_class'])).' unknown';
     55            $this->end($return);
     56        }
    2557
    26         if (!is_null($account)) {
    27             $account->set('remote_user_id', esc_attr($_POST['user_id']));
     58        unset($data['service_class']);
     59
     60        if (empty($_POST['post_id'])) {
     61            $return['error'] = true;
     62            $return['msg']   = 'post_id parameter missing';
     63            $this->end($return);
     64        }
     65
     66        $account->setId(absint($_POST['post_id']));
     67
     68        //Apply all attributes to account
     69        foreach ($data as $name => $value) {
     70            $account->set(esc_attr($name), esc_attr($value));
     71        }
     72
     73        $return['authneeded'] = $account->isAuthNeeded();
     74        //If no auth needed validate credentials
     75        if ($return['authneeded'] === false) {
     76
    2877            $return['validate'] = $account->validate();
    29             $return['last_valid_query'] = $account->get('last_valid_query');
    30         } else {
     78            $this->end($return);
     79        }
     80
     81        try {
     82            //If auth needed, get Auth URL
     83            $return['authurl'] = $account->getAuthUrl();
     84        } catch (ClientErrorResponseException $e) {
    3185            $return['error'] = true;
    32             $return['msg'] = 'Service type class '.stripslashes(esc_attr($_POST['service_class'])).' unknown';
     86            $return['msg']   = 'invalid remote library parmeters';
     87        } catch (InvalidAuthParamException $e) {
     88            $return['error'] = true;
     89            $return['msg']   = 'invalid remote library parmeters';
     90        } catch (\Exception $e) {
     91            error_log('RML could not get Auth Url:'.$e->getMessage());
     92            $return['error'] = true;
     93            $return['msg']   = 'post_id parameter missing';
    3394        }
    3495       
    35 
    36         echo htmlspecialchars(json_encode($return), ENT_NOQUOTES);
    37         die(); // this is required to return a proper result
     96        $this->end($return);
    3897    }
    3998}
  • remote-medias-lite/trunk/src/RemoteMediaExt/Ajax/AjaxSendRemoteToEditor.php

    r998050 r1121928  
    1919        $html = "";
    2020
    21         if (empty($jsattachment['subtype']) ||
     21        if (empty($jsattachment['accountId']) ||
    2222            empty($jsattachment['remotedata'])
    2323        ) {
     
    2525        }
    2626
    27         $media = RemoteMediaFactory::create($jsattachment['subtype'], $jsattachment['remotedata']);
     27        $accountId = absint($jsattachment['accountId']);
     28       
     29        $media = RemoteMediaFactory::createFromAccountid($accountId, $jsattachment['remotedata']);
    2830
    2931        if (is_null($media)) {
  • remote-medias-lite/trunk/src/RemoteMediaExt/FRemoteMediaExt.php

    r1006821 r1121928  
    1717use WPRemoteMediaExt\RemoteMediaExt\Library\MediaTemplate;
    1818use WPRemoteMediaExt\RemoteMediaExt\Library\MediaSettings;
    19 use WPRemoteMediaExt\RemoteMediaExt\Library\MediaLibrarySection;
    2019
    2120use WPRemoteMediaExt\WPCore\admin\WPfeaturePointer;
     
    3332    public static $instance;
    3433
    35     protected $version = '1.1.2';
     34    protected $version = '1.2.0';
    3635    protected $accountPostType;
    3736    protected $remoteServices = array();
     
    8685        //Hook Flickr Support
    8786        $service = new RemoteService\Flickr\Service();
     87        $service->setBasePath($this->getBasePath());
     88        $service->setAccountPostType($this->accountPostType);
     89        $this->hook($service);
     90        $this->addRemoteService($service);
     91
     92        //Hook Instagram Support
     93        $service = new RemoteService\Instagram\Service();
    8894        $service->setBasePath($this->getBasePath());
    8995        $service->setAccountPostType($this->accountPostType);
     
    123129
    124130        $this->hook(new MediaTemplate(new View($this->getViewsPath().'admin/media-remote-attachment.php')));
     131        $this->hook(new MediaTemplate(new View($this->getViewsPath().'admin/media-friendly-banner.php')));
     132        $this->addScript(new WPscriptAdmin(array('post.php' => array(), 'post-new.php' => array()), 'jquery-cookie', $this->getJsUrl().'jquery-cookie.min.js', $this->getJsUrl().'jquery-cookie.js', array('jquery'), $this->version));
    125133        $this->addScript(new WPscriptAdmin(array('post.php' => array(), 'post-new.php' => array()), 'media-remote-ext', $this->getJsUrl().'media-remote-ext.min.js', $this->getJsUrl().'media-remote-ext.js', array('media-editor','media-views'), $this->version));
    126134        $this->addStyle(new WPstyleAdmin(array(), 'media-remote-admin-css', $this->getCssUrl().'media-remote-admin.min.css', $this->getCssUrl().'media-remote-admin.css', array(), $this->version));
     
    185193        $metabox = new MetaBoxService(
    186194            new View(
    187                 $this->getViewsPath().'admin/metaboxes/basic-settings.php',
    188                 array('services' => $this->getRemoteServices())
     195                $this->getViewsPath().'admin/metaboxes/basic-settings.php'
    189196            ),
    190197            'rml_account_settings',
  • remote-medias-lite/trunk/src/RemoteMediaExt/Library/MediaSettings.php

    r998050 r1121928  
    5151                    'type' => $remoteAccount->get('type'),
    5252                    'title' => 'Insert '.$account->post_title,
     53                    'filterable' => $remoteAccount->get('library_filterable', ''),
     54                    'filters' => $remoteAccount->get('library_filters', ''),
     55                    'remoteuploadable' => $remoteAccount->get('remoteuploadable', false),
     56                    'uioptions' => $remoteAccount->get('uioptions', array())
    5357                );
    5458            }
  • remote-medias-lite/trunk/vendor/autoload.php

    r1006821 r1121928  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderInit5d42ae4508dec87ab775d81cc28eb958::getLoader();
     7return ComposerAutoloaderInit0750d3f245670d325db99442641da17f::getLoader();
  • remote-medias-lite/trunk/vendor/composer/ClassLoader.php

    r992903 r1121928  
    5555    private $classMap = array();
    5656
     57    private $classMapAuthoritative = false;
     58
    5759    public function getPrefixes()
    5860    {
    59         return call_user_func_array('array_merge', $this->prefixesPsr0);
     61        if (!empty($this->prefixesPsr0)) {
     62            return call_user_func_array('array_merge', $this->prefixesPsr0);
     63        }
     64
     65        return array();
    6066    }
    6167
     
    246252
    247253    /**
     254     * Turns off searching the prefix and fallback directories for classes
     255     * that have not been registered with the class map.
     256     *
     257     * @param bool $classMapAuthoritative
     258     */
     259    public function setClassMapAuthoritative($classMapAuthoritative)
     260    {
     261        $this->classMapAuthoritative = $classMapAuthoritative;
     262    }
     263
     264    /**
     265     * Should class lookup fail if not found in the current class map?
     266     *
     267     * @return bool
     268     */
     269    public function isClassMapAuthoritative()
     270    {
     271        return $this->classMapAuthoritative;
     272    }
     273
     274    /**
    248275     * Registers this instance as an autoloader.
    249276     *
     
    295322        if (isset($this->classMap[$class])) {
    296323            return $this->classMap[$class];
     324        }
     325        if ($this->classMapAuthoritative) {
     326            return false;
    297327        }
    298328
  • remote-medias-lite/trunk/vendor/composer/autoload_classmap.php

    r997433 r1121928  
    88return array(
    99    'WPRemoteMediaExt\\RemoteMediaExt\\AccountPostType' => $baseDir . '/src/RemoteMediaExt/AccountPostType.php',
     10    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\AbstractAuthService' => $baseDir . '/src/RemoteMediaExt/Accounts/AbstractAuthService.php',
    1011    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\AbstractRemoteAccount' => $baseDir . '/src/RemoteMediaExt/Accounts/AbstractRemoteAccount.php',
    1112    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\AbstractRemoteClient' => $baseDir . '/src/RemoteMediaExt/Accounts/AbstractRemoteClient.php',
     
    1819    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Flickr\\RemoteMedia' => $baseDir . '/src/RemoteMediaExt/Accounts/Flickr/RemoteMedia.php',
    1920    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Flickr\\Service' => $baseDir . '/src/RemoteMediaExt/Accounts/Flickr/Service.php',
     21    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Instagram\\Client' => $baseDir . '/src/RemoteMediaExt/Accounts/Instagram/Client.php',
     22    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Instagram\\RemoteMedia' => $baseDir . '/src/RemoteMediaExt/Accounts/Instagram/RemoteMedia.php',
     23    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Instagram\\Response' => $baseDir . '/src/RemoteMediaExt/Accounts/Instagram/Response.php',
     24    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\Instagram\\Service' => $baseDir . '/src/RemoteMediaExt/Accounts/Instagram/Service.php',
    2025    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\MetaBoxSaveAccount' => $baseDir . '/src/RemoteMediaExt/Accounts/MetaBoxSaveAccount.php',
    2126    'WPRemoteMediaExt\\RemoteMediaExt\\Accounts\\MetaBoxService' => $baseDir . '/src/RemoteMediaExt/Accounts/MetaBoxService.php',
     
    3540    'WPRemoteMediaExt\\RemoteMediaExt\\Ajax\\AjaxSendRemoteToEditor' => $baseDir . '/src/RemoteMediaExt/Ajax/AjaxSendRemoteToEditor.php',
    3641    'WPRemoteMediaExt\\RemoteMediaExt\\Ajax\\AjaxUserInfo' => $baseDir . '/src/RemoteMediaExt/Ajax/AjaxUserInfo.php',
     42    'WPRemoteMediaExt\\RemoteMediaExt\\Exception\\InvalidAuthParamException' => $baseDir . '/src/RemoteMediaExt/Exception/InvalidAuthParamException.php',
    3743    'WPRemoteMediaExt\\RemoteMediaExt\\FRemoteMediaExt' => $baseDir . '/src/RemoteMediaExt/FRemoteMediaExt.php',
    3844    'WPRemoteMediaExt\\RemoteMediaExt\\Library\\MediaArraySettings' => $baseDir . '/src/RemoteMediaExt/Library/MediaArraySettings.php',
  • remote-medias-lite/trunk/vendor/composer/autoload_real.php

    r1006821 r1121928  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit5d42ae4508dec87ab775d81cc28eb958
     5class ComposerAutoloaderInit0750d3f245670d325db99442641da17f
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit5d42ae4508dec87ab775d81cc28eb958', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInit0750d3f245670d325db99442641da17f', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit5d42ae4508dec87ab775d81cc28eb958', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInit0750d3f245670d325db99442641da17f', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4545}
    4646
    47 function composerRequire5d42ae4508dec87ab775d81cc28eb958($file)
     47function composerRequire0750d3f245670d325db99442641da17f($file)
    4848{
    4949    require $file;
  • remote-medias-lite/trunk/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php

    r992903 r1121928  
    226226            $this->checkCurlResult($mrc);
    227227            $this->processMessages();
     228
    228229            if ($active && curl_multi_select($this->multiHandle, $selectTimeout) === -1) {
    229230                // Perform a usleep if a select returns -1: https://bugs.php.net/bug.php?id=61141
  • remote-medias-lite/trunk/views/admin/media-remote-attachment.php

    r992903 r1121928  
    22?>
    33<script type="text/html" id="tmpl-attachment-remote">
    4   <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
    5       <# if ( data.uploading ) { #>
    6                 <div class="media-progress-bar"><div></div></div>
    7             <# } else if ( 'image' === data.type ) { #>
    8                 <div class="thumbnail">
    9                     <div class="centered">
    10                         <img src="{{ data.size.url }}" draggable="false" />
    11                     </div>
    12                 </div>
    13             <# } else if ('remote' === data.type) { #>
    14                 <div class="thumbnail">
    15                     <div class="centered">
    16                         <img src="{{ data.icon }}" draggable="false" />
    17                     </div>
     4    <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
     5        <div class="thumbnail">
     6            <# if ( data.uploading ) { #>
     7                <div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
     8            <# } else if ( 'image' === data.type && data.sizes ) { #>
     9                <div class="centered">
     10                    <img src="{{ data.size.url }}" draggable="false" alt="" />
    1811                </div>
    1912            <# } else { #>
    20                 <img src="{{ data.icon }}" class="icon" draggable="false" />
     13                <div class="centered">
     14                    <# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
     15                        <img src="{{ data.image.src }}" class="thumbnail" draggable="false" />
     16                    <# } else { #>
     17                        <img src="{{ data.icon }}" class="icon" draggable="false" />
     18                    <# } #>
     19                </div>
    2120                <div class="filename">
    2221                    <div>{{ data.filename }}</div>
    2322                </div>
    2423            <# } #>
    25 
    26             <# if ( data.buttons.close ) { #>
    27                 <a class="close media-modal-icon" href="#" title="<?php _e('Remove'); ?>"></a>
    28             <# } #>
    29 
    30             <# if ( data.buttons.check ) { #>
    31                 <a class="check" href="#" title="<?php _e('Deselect'); ?>"><div class="media-modal-icon"></div></a>
    32             <# } #>
    3324        </div>
    34         <#
    35         var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
    36         if ( data.describe ) { #>
    37             <# if ( 'image' === data.type ) { #>
    38                 <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
    39                     placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
    40             <# } else { #>
    41                 <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
    42                     <# if ( 'video' === data.type ) { #>
    43                         placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
    44                     <# } else if ( 'audio' === data.type ) { #>
    45                         placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
    46                     <# } else { #>
    47                         placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
    48                     <# } #> {{ maybeReadOnly }} />
    49             <# } #>
     25        <# if ( data.buttons.close ) { #>
     26            <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
    5027        <# } #>
     28    </div>
     29    <# if ( data.buttons.check ) { #>
     30        <a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a>
     31    <# } #>
     32    <#
     33    var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
     34    if ( data.describe ) {
     35        if ( 'image' === data.type ) { #>
     36            <input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
     37                placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
     38        <# } else { #>
     39            <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
     40                <# if ( 'video' === data.type ) { #>
     41                    placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
     42                <# } else if ( 'audio' === data.type ) { #>
     43                    placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
     44                <# } else { #>
     45                    placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
     46                <# } #> {{ maybeReadOnly }} />
     47        <# }
     48    } #>
    5149</script>
  • remote-medias-lite/trunk/views/admin/metaboxes/basic-settings.php

    r997435 r1121928  
    55//$metabox
    66//$account
    7 //$services
    87echo $hidden_nonce;
     8
     9$rml = \WPRemoteMediaExt\RemoteMediaExt\FRemoteMediaExt::getInstance();
     10$services = $rml->getRemoteServices();
    911
    1012foreach ($services as $service) {
     
    2224    <?php
    2325}
    24 ?>
  • remote-medias-lite/trunk/views/admin/metaboxes/status-actions.php

    r997435 r1121928  
    1 <div class="rml-status-box">
     1<?php
     2use \WPRemoteMediaExt\RemoteMediaExt\Accounts\AbstractRemoteAccount;
     3
     4?>
     5<div id="rml-status-box" class="rml-status-box">
    26<div class="rml-status-minor">
    37    <div class="rml-status-actions">
    48        <div class="misc-pub-section">
    5             <label for="account_status"><?php _e('Account Status:','remote-medias-lite'); ?></label>
     9            <label for="account_status"><?php _e('Account Status:', 'remote-medias-lite'); ?></label>
     10            <?php
     11            $status        = $account->getStatus();
     12            $statusDisplay = $account->getStatusDisplay();
     13            if ($status === AbstractRemoteAccount::STATUS_AUTHNEEDED) {
     14                $statusDisplay = '<a class="action_query_test" href="#">'.$statusDisplay.'</a>';
     15            }
    616           
    7             <?php
    8             $workingStyle = "";
    9             $unknownStyle = "";
    10             $invalidStyle = "";
    11             $status = $account->get('isValid');
    12             //working
    13             if ($status === true) {
    14                 $workingStyle = '';
    15                 $unknownStyle = 'style="display: none"';
    16                 $invalidStyle = 'style="display: none"';
    17             //unknown
    18             } elseif (is_null($status)) {
    19                 $workingStyle = 'style="display: none"';
    20                 $unknownStyle = '';
    21                 $invalidStyle = 'style="display: none"';
    22             //invalid
    23             } else {
    24                 $workingStyle = 'style="display: none"';
    25                 $unknownStyle = 'style="display: none"';
    26                 $invalidStyle = '';
    27             }
    2817            ?>
    29             <span class="rml-status-field working" <?php echo $workingStyle; ?>><?php _e('Working', 'remote-medias-lite'); ?></span>
    30             <span class="rml-status-field unknown" <?php echo $unknownStyle; ?>><?php _e('Unknown', 'remote-medias-lite'); ?></span>
    31             <span class="rml-status-field notvalid" <?php echo $invalidStyle; ?>><?php _e('Invalid', 'remote-medias-lite'); ?></span>
     18            <span id="rmlaccountstatus" class="rml-status-field"><?php echo $statusDisplay; ?></span>
    3219        </div>
    3320    </div>
     
    3724        <span id="query_msg"></span>
    3825        <div id="rmlloading" class="spinner ocs-inline-loading"></div>
    39         <a href="#" class="button button-large action_query_test"><?php _e('Validate', 'remote-medias-lite'); ?></a>
     26        <?php
     27        $buttonText = __('Validate', 'remote-medias-lite');
     28        // if ($account->isAuthNeeded() && $account->isEnabled()) {
     29        //     $buttonText = __('Re-authenticate', 'remote-medias-lite');
     30        // }
     31        ?>
     32        <a id="rmlstatusbutton" href="#" class="button button-large action_query_test"><?php echo $buttonText; ?></a>
    4033    </div>
    4134    <div class="clear"></div>
Note: See TracChangeset for help on using the changeset viewer.