WordPress Button Plugin MaxButtons - Version 7.13

Version Description

  • Updates to code base
  • Fixed - Small bug in Gutenberg regarding text fields
  • Fixed - Zero-width space (Unicode Character) could disturb URL output.
Download this release

Release Info

Developer basszje
Plugin Icon 128x128 WordPress Button Plugin MaxButtons
Version 7.13
Comparing to
See all releases

Code changes from version 7.11 to 7.13

assets/integrations/gutenberg/blocks.build.js CHANGED
@@ -84,7 +84,7 @@ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true }
84
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
85
 
86
  "use strict";
87
- eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(/*! ./style.scss */ 2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss__ = __webpack_require__(/*! ./editor.scss */ 3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__editor_scss__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/**\n * BLOCK: maxbuttons-block\n *\n * Registering a basic block with Gutenberg.\n * Simple block, renders and saves the same content without any interactivity.\n */\n\n// Import CSS.\n\n\n\nvar __ = wp.i18n.__; // Import __() from wp.i18n\n\nvar registerBlockType = wp.blocks.registerBlockType; // Import registerBlockType() from wp.blocks\n\nvar InspectorControls = wp.editor.InspectorControls;\nvar _wp$components = wp.components,\n PanelBody = _wp$components.PanelBody,\n TextareaControl = _wp$components.TextareaControl,\n TextControl = _wp$components.TextControl,\n ToggleControl = _wp$components.ToggleControl,\n Button = _wp$components.Button;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createElement = _wp$element.createElement;\nvar withState = wp.compose.withState;\n\n/**\n * Register: aa Gutenberg Block.\n *\n * Registers a new block provided a unique name and an object defining its\n * behavior. Once registered, the block is made editor as an option to any\n * editor interface where blocks are implemented.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/\n * @param {string} name Block name.\n * @param {Object} settings Block settings.\n * @return {?WPBlock} The block, if it has been successfully\n * registered; otherwise `undefined`.\n */\n\nregisterBlockType('maxbuttons/maxbuttons-block', {\n\t// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.\n\ttitle: __('MaxButtons Block'), // Block title.\n\ticon: createElement('img', {\n\t\t'src': mb_gutenberg.icon_url,\n\t\t'width': 20\n\t} // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.\n\t),\n\tcategory: 'common', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.\n\tkeywords: [__('maxbuttons-block'), __('maxbuttons')],\n\tclassName: false,\n\tcustomClassName: false,\n\tattributes: {\n\t\tid: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tbutton_id: {\n\t\t\ttype: 'string'\n\t\t},\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'url'\n\t\t},\n\t\ttext: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'text'\n\t\t},\n\t\ttext2: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tnewwindow: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\trelnofollow: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\ttooltip: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tcompile: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\tstyle: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\tgoogle_enable: {\n\t\t\ttype: 'integer'\n\t\t},\n\t\tgoogle_action: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tgoogle_label: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tgoogle_category: {\n\t\t\ttype: 'string'\n\t\t}\n\t},\n\n\t/**\n * The edit function describes the structure of your block in the context of the editor.\n * This represents what the editor will render when the block is used.\n *\n * The \"edit\" property must be a valid function.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/\n */\n\tedit: function (_Component) {\n\t\t_inherits(edit, _Component);\n\n\t\tfunction edit(props) {\n\t\t\t_classCallCheck(this, edit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (edit.__proto__ || Object.getPrototypeOf(edit)).call(this, props));\n\n\t\t\t_this.onChangeID = _this.onChangeID.bind(_this);\n\t\t\t_this.onChangeText = _this.onChangeText.bind(_this);\n\t\t\t_this.onChangeText2 = _this.onChangeText2.bind(_this);\n\t\t\t_this.onChangeURL = _this.onChangeURL.bind(_this);\n\t\t\t_this.onChangeTooltip = _this.onChangeTooltip.bind(_this);\n\t\t\t_this.onChangeClassName = _this.onChangeClassName.bind(_this);\n\t\t\t_this.onChangeGlabel = _this.onChangeGlabel.bind(_this);\n\t\t\t_this.onChangeGaction = _this.onChangeGaction.bind(_this);\n\t\t\t_this.onChangeGcategory = _this.onChangeGcategory.bind(_this);\n\n\t\t\t_this.updateNewWindow = _this.updateToggleAttribute('newwindow');\n\t\t\t_this.updateRelNoFollow = _this.updateToggleAttribute('relnofollow');\n\t\t\t_this.updateCompile = _this.updateToggleAttribute('compile');\n\t\t\t_this.updateStyle = _this.updateToggleAttribute('style');\n\n\t\t\t_this.preventClick = _this.preventClick.bind(_this);\n\t\t\t_this.ajaxButton = _this.ajaxButton.bind(_this);\n\t\t\t_this.openButtonModal = _this.openButtonModal.bind(_this);\n\t\t\t_this.insertButton = _this.insertButton.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\tstylefile: '',\n\t\t\t\tisPro: true // check if plugin is pro\n\t\t\t};\n\n\t\t\t_this.button; // init\n\t\t\t_this.limitajax;\n\t\t\treturn _this;\n\t\t}\n\n\t\t_createClass(edit, [{\n\t\t\tkey: 'componentDidMount',\n\t\t\tvalue: function componentDidMount() {\n\t\t\t\tif (this.props.attributes.id) {\n\t\t\t\t\tthis.ajaxButton();\n\t\t\t\t}\n\n\t\t\t\tif (mb_gutenberg.ispro) {\n\t\t\t\t\tthis.setState({ isPro: true });\n\t\t\t\t}\n\t\t\t\t//\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'ajaxButton',\n\t\t\tvalue: function ajaxButton(reset_atts) {\n\t\t\t\tclearTimeout(this.limitajax); // limit amount of refreshes via ajax.\n\t\t\t\tvar self = this;\n\n\t\t\t\tself.limitajax = setTimeout(function () {\n\t\t\t\t\tvar _self$props$attribute = self.props.attributes,\n\t\t\t\t\t id = _self$props$attribute.id,\n\t\t\t\t\t text = _self$props$attribute.text,\n\t\t\t\t\t text2 = _self$props$attribute.text2,\n\t\t\t\t\t url = _self$props$attribute.url,\n\t\t\t\t\t tooltip = _self$props$attribute.tooltip,\n\t\t\t\t\t newwindow = _self$props$attribute.newwindow,\n\t\t\t\t\t relnofollow = _self$props$attribute.relnofollow,\n\t\t\t\t\t className = _self$props$attribute.className,\n\t\t\t\t\t compile = _self$props$attribute.compile,\n\t\t\t\t\t style = _self$props$attribute.style;\n\n\n\t\t\t\t\twp.ajax.send('maxajax', {\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tplugin_action: 'gutenberg_button',\n\t\t\t\t\t\t\tnonce: maxajax.nonce,\n\t\t\t\t\t\t\tid: id,\n\t\t\t\t\t\t\ttext: text,\n\t\t\t\t\t\t\ttext2: text2,\n\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\tlinktitle: tooltip,\n\t\t\t\t\t\t\tnewwindow: newwindow,\n\t\t\t\t\t\t\trelnofollow: relnofollow,\n\t\t\t\t\t\t\textraclass: className,\n\t\t\t\t\t\t\tcompile: compile,\n\t\t\t\t\t\t\tstyle: style,\n\t\t\t\t\t\t\treset: reset_atts\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function success(data) {\n\t\t\t\t\t\t\tself.button = data.button;\n\t\t\t\t\t\t\tself.setState({ stylefile: data.style });\n\n\t\t\t\t\t\t\tif (data.attributes) {\n\t\t\t\t\t\t\t\tself.props.setAttributes(data.attributes);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function error(data) {}\n\t\t\t\t\t});\n\t\t\t\t}, 700);\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'preventClick',\n\t\t\tvalue: function preventClick(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeText',\n\t\t\tvalue: function onChangeText(value) {\n\t\t\t\tthis.props.setAttributes({ text: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeText2',\n\t\t\tvalue: function onChangeText2(value) {\n\t\t\t\tthis.props.setAttributes({ text2: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeTooltip',\n\t\t\tvalue: function onChangeTooltip(value) {\n\t\t\t\tthis.props.setAttributes({ tooltip: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeURL',\n\t\t\tvalue: function onChangeURL(value) {\n\t\t\t\tthis.props.setAttributes({ url: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeID',\n\t\t\tvalue: function onChangeID(value) {\n\t\t\t\t//\tajaxCall(value);\n\t\t\t\tthis.props.setAttributes({ id: value });\n\t\t\t\tthis.ajaxButton(true);\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeClassName',\n\t\t\tvalue: function onChangeClassName(value) {\n\t\t\t\tthis.props.setAttributes({ className: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGlabel',\n\t\t\tvalue: function onChangeGlabel(value) {\n\t\t\t\tthis.props.setAttributes({ google_label: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGcategory',\n\t\t\tvalue: function onChangeGcategory(value) {\n\t\t\t\tthis.props.setAttributes({ google_category: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGaction',\n\t\t\tvalue: function onChangeGaction(value) {\n\t\t\t\tthis.props.setAttributes({ google_action: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'updateToggleAttribute',\n\t\t\tvalue: function updateToggleAttribute(propName) {\n\t\t\t\tvar _this2 = this;\n\n\t\t\t\treturn function () {\n\t\t\t\t\tvar value = _this2.props.attributes[propName];\n\t\t\t\t\tvar setAttributes = _this2.props.setAttributes;\n\n\n\t\t\t\t\tsetAttributes(_defineProperty({}, propName, !value));\n\t\t\t\t};\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'openButtonModal',\n\t\t\tvalue: function openButtonModal() {\n\t\t\t\tvar options = {};\n\t\t\t\toptions.callback = this.insertButton;\n\t\t\t\toptions.useShortCodeOptions = false;\n\n\t\t\t\tthis.maxmedia = new window.maxFoundry.maxMedia();\n\t\t\t\tthis.maxmedia.init(options);\n\t\t\t\tthis.maxmedia.openModal();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'insertButton',\n\t\t\tvalue: function insertButton(button_id, target) {\n\t\t\t\tthis.onChangeID(button_id);\n\t\t\t\tthis.maxmedia.close();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'render',\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t attributes = _props.attributes,\n\t\t\t\t setAttributes = _props.setAttributes,\n\t\t\t\t className = _props.className;\n\n\n\t\t\t\tvar isPro = this.state.isPro;\n\t\t\t\tvar hasGoogle = attributes.google_enable;\n\t\t\t\tif (isPro && hasGoogle) var renderGoogle = true;else var renderGoogle = false;\n\n\t\t\t\tvar general_options = wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'mb_inspector' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Button Settings') },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclassName: 'modal-button',\n\t\t\t\t\t\t\t\tisLarge: 'true',\n\t\t\t\t\t\t\t\tonClick: this.openButtonModal\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t' Select Button '\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'h4',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t'Button ID : ',\n\t\t\t\t\t\t\tattributes.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Text'),\n\t\t\t\t\t\t\tvalue: attributes.text,\n\t\t\t\t\t\t\tonChange: this.onChangeText,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tthis.state.isPro ? wp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Text2'),\n\t\t\t\t\t\t\tvalue: attributes.text2,\n\t\t\t\t\t\t\tonChange: this.onChangeText2\n\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('URL'),\n\t\t\t\t\t\t\tvalue: attributes.url,\n\t\t\t\t\t\t\tonChange: this.onChangeURL,\n\t\t\t\t\t\t\thelp: __('You can enter an alternative URL')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Open in New Window'),\n\t\t\t\t\t\t\tchecked: attributes.newwindow,\n\t\t\t\t\t\t\tonChange: this.updateNewWindow\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Use rel=\"nofollow\"'),\n\t\t\t\t\t\t\tchecked: attributes.relnofollow,\n\t\t\t\t\t\t\tonChange: this.updateRelNoFollow\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Tooltip Text'),\n\t\t\t\t\t\t\tvalue: attributes.tooltip,\n\t\t\t\t\t\t\tonChange: this.onChangeTooltip\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\tvar advanced_options = wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'advanced' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Advanced Settings'), initialOpen: false },\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Extra CSS Class'),\n\t\t\t\t\t\t\tvalue: attributes.className,\n\t\t\t\t\t\t\tonChange: this.onChangeClassName,\n\t\t\t\t\t\t\thelp: __('Adds an extra CSS class to the button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Output CSS inline'),\n\t\t\t\t\t\t\tchecked: attributes.style,\n\t\t\t\t\t\t\tonChange: this.updateStyle,\n\t\t\t\t\t\t\thelp: __('Use when style is not loading properly. Will output it in the HTML document, instead of footer')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Recompile on load'),\n\t\t\t\t\t\t\tchecked: attributes.compile,\n\t\t\t\t\t\t\tonChange: this.updateCompile,\n\t\t\t\t\t\t\thelp: __('Use only for testing. This will slow down your site noticably! ')\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\tvar google_options = renderGoogle && wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'google' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Google Event Options'), initialOpen: false },\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Category'),\n\t\t\t\t\t\t\tvalue: attributes.google_category,\n\t\t\t\t\t\t\tonChange: this.onChangeGcategory,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Action'),\n\t\t\t\t\t\t\tvalue: attributes.google_action,\n\t\t\t\t\t\t\tonChange: this.onChangeGaction,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Label'),\n\t\t\t\t\t\t\tvalue: attributes.google_label,\n\t\t\t\t\t\t\tonChange: this.onChangeGlabel,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn [general_options, advanced_options, google_options, wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: className, key: 'mb_block' },\n\t\t\t\t\twp.element.createElement('span', { dangerouslySetInnerHTML: { __html: this.button }, onClick: this.preventClick }),\n\t\t\t\t\twp.element.createElement('link', { rel: 'stylesheet', href: this.state.stylefile }),\n\t\t\t\t\t!this.button ? wp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t'To start, add a MaxButton via the Block Settings on the right.'\n\t\t\t\t\t) : wp.element.createElement('div', null)\n\t\t\t\t)];\n\t\t\t}\n\t\t}]);\n\n\t\treturn edit;\n\t}(Component),\n\n\t/**\n * The save function defines the way in which the different attributes should be combined\n * into the final markup, which is then serialized by Gutenberg into post_content.\n *\n * The \"save\" property must be specified and must be a valid function.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/\n */\n\tsave: function save(props) {\n\t\treturn null;\n\t}\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9tYXhidXR0b25zLWJsb2NrL2Jsb2NrLmpzP2NhMGMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIF9jcmVhdGVDbGFzcyA9IGZ1bmN0aW9uICgpIHsgZnVuY3Rpb24gZGVmaW5lUHJvcGVydGllcyh0YXJnZXQsIHByb3BzKSB7IGZvciAodmFyIGkgPSAwOyBpIDwgcHJvcHMubGVuZ3RoOyBpKyspIHsgdmFyIGRlc2NyaXB0b3IgPSBwcm9wc1tpXTsgZGVzY3JpcHRvci5lbnVtZXJhYmxlID0gZGVzY3JpcHRvci5lbnVtZXJhYmxlIHx8IGZhbHNlOyBkZXNjcm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QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///1\n");
88
 
89
  /***/ }),
90
  /* 2 */
84
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
85
 
86
  "use strict";
87
+ eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(/*! ./style.scss */ 2);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss__ = __webpack_require__(/*! ./editor.scss */ 3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__editor_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__editor_scss__);\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\n/**\n * BLOCK: maxbuttons-block\n *\n * Registering a basic block with Gutenberg.\n * Simple block, renders and saves the same content without any interactivity.\n */\n\n// Import CSS.\n\n\n\nvar __ = wp.i18n.__; // Import __() from wp.i18n\n\nvar registerBlockType = wp.blocks.registerBlockType; // Import registerBlockType() from wp.blocks\n\nvar InspectorControls = wp.editor.InspectorControls;\nvar _wp$components = wp.components,\n PanelBody = _wp$components.PanelBody,\n TextareaControl = _wp$components.TextareaControl,\n TextControl = _wp$components.TextControl,\n ToggleControl = _wp$components.ToggleControl,\n Button = _wp$components.Button;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment,\n createElement = _wp$element.createElement;\nvar withState = wp.compose.withState;\n\n/**\n * Register: aa Gutenberg Block.\n *\n * Registers a new block provided a unique name and an object defining its\n * behavior. Once registered, the block is made editor as an option to any\n * editor interface where blocks are implemented.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/\n * @param {string} name Block name.\n * @param {Object} settings Block settings.\n * @return {?WPBlock} The block, if it has been successfully\n * registered; otherwise `undefined`.\n */\n\nregisterBlockType('maxbuttons/maxbuttons-block', {\n\t// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.\n\ttitle: __('MaxButtons Block'), // Block title.\n\ticon: createElement('img', {\n\t\t'src': mb_gutenberg.icon_url,\n\t\t'width': 20\n\t} // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.\n\t),\n\tcategory: 'common', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.\n\tkeywords: [__('maxbuttons-block'), __('maxbuttons')],\n\tclassName: false,\n\tcustomClassName: false,\n\tattributes: {\n\t\tid: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tbutton_id: {\n\t\t\ttype: 'string'\n\t\t},\n\t\turl: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'url'\n\t\t},\n\t\ttext: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'text'\n\t\t},\n\t\ttext2: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tnewwindow: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\trelnofollow: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\ttooltip: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tcompile: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\tstyle: {\n\t\t\ttype: 'boolean'\n\t\t},\n\t\tgoogle_enable: {\n\t\t\ttype: 'integer'\n\t\t},\n\t\tgoogle_action: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tgoogle_label: {\n\t\t\ttype: 'string'\n\t\t},\n\t\tgoogle_category: {\n\t\t\ttype: 'string'\n\t\t}\n\t},\n\n\t/**\n * The edit function describes the structure of your block in the context of the editor.\n * This represents what the editor will render when the block is used.\n *\n * The \"edit\" property must be a valid function.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/\n */\n\tedit: function (_Component) {\n\t\t_inherits(edit, _Component);\n\n\t\tfunction edit(props) {\n\t\t\t_classCallCheck(this, edit);\n\n\t\t\tvar _this = _possibleConstructorReturn(this, (edit.__proto__ || Object.getPrototypeOf(edit)).call(this, props));\n\n\t\t\t_this.onChangeID = _this.onChangeID.bind(_this);\n\t\t\t_this.onChangeText = _this.onChangeText.bind(_this);\n\t\t\t_this.onChangeText2 = _this.onChangeText2.bind(_this);\n\t\t\t_this.onChangeURL = _this.onChangeURL.bind(_this);\n\t\t\t_this.onChangeTooltip = _this.onChangeTooltip.bind(_this);\n\t\t\t_this.onChangeClassName = _this.onChangeClassName.bind(_this);\n\t\t\t_this.onChangeGlabel = _this.onChangeGlabel.bind(_this);\n\t\t\t_this.onChangeGaction = _this.onChangeGaction.bind(_this);\n\t\t\t_this.onChangeGcategory = _this.onChangeGcategory.bind(_this);\n\n\t\t\t_this.updateNewWindow = _this.updateToggleAttribute('newwindow');\n\t\t\t_this.updateRelNoFollow = _this.updateToggleAttribute('relnofollow');\n\t\t\t_this.updateCompile = _this.updateToggleAttribute('compile');\n\t\t\t_this.updateStyle = _this.updateToggleAttribute('style');\n\n\t\t\t_this.preventClick = _this.preventClick.bind(_this);\n\t\t\t_this.ajaxButton = _this.ajaxButton.bind(_this);\n\t\t\t_this.openButtonModal = _this.openButtonModal.bind(_this);\n\t\t\t_this.insertButton = _this.insertButton.bind(_this);\n\t\t\t_this.state = {\n\t\t\t\tstylefile: '',\n\t\t\t\tisPro: false // check if plugin is pro\n\t\t\t};\n\n\t\t\t_this.button; // init\n\t\t\t_this.limitajax;\n\t\t\treturn _this;\n\t\t}\n\n\t\t_createClass(edit, [{\n\t\t\tkey: 'componentDidMount',\n\t\t\tvalue: function componentDidMount() {\n\t\t\t\tif (this.props.attributes.id) {\n\t\t\t\t\tthis.ajaxButton();\n\t\t\t\t}\n\t\t\t\tconsole.log(mb_gutenberg);\n\t\t\t\tif (mb_gutenberg.ispro == 1) {\n\t\t\t\t\tthis.setState({ isPro: true });\n\t\t\t\t}\n\t\t\t\t//\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'ajaxButton',\n\t\t\tvalue: function ajaxButton(reset_atts) {\n\t\t\t\tclearTimeout(this.limitajax); // limit amount of refreshes via ajax.\n\t\t\t\tvar self = this;\n\n\t\t\t\tself.limitajax = setTimeout(function () {\n\t\t\t\t\tvar _self$props$attribute = self.props.attributes,\n\t\t\t\t\t id = _self$props$attribute.id,\n\t\t\t\t\t text = _self$props$attribute.text,\n\t\t\t\t\t text2 = _self$props$attribute.text2,\n\t\t\t\t\t url = _self$props$attribute.url,\n\t\t\t\t\t tooltip = _self$props$attribute.tooltip,\n\t\t\t\t\t newwindow = _self$props$attribute.newwindow,\n\t\t\t\t\t relnofollow = _self$props$attribute.relnofollow,\n\t\t\t\t\t className = _self$props$attribute.className,\n\t\t\t\t\t compile = _self$props$attribute.compile,\n\t\t\t\t\t style = _self$props$attribute.style;\n\n\n\t\t\t\t\twp.ajax.send('maxajax', {\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tplugin_action: 'gutenberg_button',\n\t\t\t\t\t\t\tnonce: maxajax.nonce,\n\t\t\t\t\t\t\tid: id,\n\t\t\t\t\t\t\ttext: text,\n\t\t\t\t\t\t\ttext2: text2,\n\t\t\t\t\t\t\turl: url,\n\t\t\t\t\t\t\tlinktitle: tooltip,\n\t\t\t\t\t\t\tnewwindow: newwindow,\n\t\t\t\t\t\t\trelnofollow: relnofollow,\n\t\t\t\t\t\t\textraclass: className,\n\t\t\t\t\t\t\tcompile: compile,\n\t\t\t\t\t\t\tstyle: style,\n\t\t\t\t\t\t\treset: reset_atts\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function success(data) {\n\t\t\t\t\t\t\tself.button = data.button;\n\t\t\t\t\t\t\tself.setState({ stylefile: data.style });\n\n\t\t\t\t\t\t\tif (data.attributes) {\n\t\t\t\t\t\t\t\tself.props.setAttributes(data.attributes);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror: function error(data) {}\n\t\t\t\t\t});\n\t\t\t\t}, 700);\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'preventClick',\n\t\t\tvalue: function preventClick(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeText',\n\t\t\tvalue: function onChangeText(value) {\n\t\t\t\tthis.props.setAttributes({ text: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeText2',\n\t\t\tvalue: function onChangeText2(value) {\n\t\t\t\tthis.props.setAttributes({ text2: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeTooltip',\n\t\t\tvalue: function onChangeTooltip(value) {\n\t\t\t\tthis.props.setAttributes({ tooltip: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeURL',\n\t\t\tvalue: function onChangeURL(value) {\n\t\t\t\tthis.props.setAttributes({ url: value });\n\t\t\t\tthis.ajaxButton();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeID',\n\t\t\tvalue: function onChangeID(value) {\n\t\t\t\t//\tajaxCall(value);\n\t\t\t\tthis.props.setAttributes({ id: value });\n\t\t\t\tthis.ajaxButton(true);\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeClassName',\n\t\t\tvalue: function onChangeClassName(value) {\n\t\t\t\tthis.props.setAttributes({ className: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGlabel',\n\t\t\tvalue: function onChangeGlabel(value) {\n\t\t\t\tthis.props.setAttributes({ google_label: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGcategory',\n\t\t\tvalue: function onChangeGcategory(value) {\n\t\t\t\tthis.props.setAttributes({ google_category: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'onChangeGaction',\n\t\t\tvalue: function onChangeGaction(value) {\n\t\t\t\tthis.props.setAttributes({ google_action: value });\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'updateToggleAttribute',\n\t\t\tvalue: function updateToggleAttribute(propName) {\n\t\t\t\tvar _this2 = this;\n\n\t\t\t\treturn function () {\n\t\t\t\t\tvar value = _this2.props.attributes[propName];\n\t\t\t\t\tvar setAttributes = _this2.props.setAttributes;\n\n\n\t\t\t\t\tsetAttributes(_defineProperty({}, propName, !value));\n\t\t\t\t};\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'openButtonModal',\n\t\t\tvalue: function openButtonModal() {\n\t\t\t\tvar options = {};\n\t\t\t\toptions.callback = this.insertButton;\n\t\t\t\toptions.useShortCodeOptions = false;\n\n\t\t\t\tthis.maxmedia = new window.maxFoundry.maxMedia();\n\t\t\t\tthis.maxmedia.init(options);\n\t\t\t\tthis.maxmedia.openModal();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'insertButton',\n\t\t\tvalue: function insertButton(button_id, target) {\n\t\t\t\tthis.onChangeID(button_id);\n\t\t\t\tthis.maxmedia.close();\n\t\t\t}\n\t\t}, {\n\t\t\tkey: 'render',\n\t\t\tvalue: function render() {\n\t\t\t\tvar _props = this.props,\n\t\t\t\t attributes = _props.attributes,\n\t\t\t\t setAttributes = _props.setAttributes,\n\t\t\t\t className = _props.className;\n\n\n\t\t\t\tvar isPro = this.state.isPro;\n\t\t\t\tvar hasGoogle = attributes.google_enable;\n\n\t\t\t\tif (isPro && hasGoogle) var renderGoogle = true;else var renderGoogle = false;\n\n\t\t\t\tvar general_options = wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'mb_inspector' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Button Settings') },\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\tButton,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclassName: 'modal-button',\n\t\t\t\t\t\t\t\tisLarge: 'true',\n\t\t\t\t\t\t\t\tonClick: this.openButtonModal\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t' Select Button '\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'h4',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t'Button ID : ',\n\t\t\t\t\t\t\tattributes.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Text'),\n\t\t\t\t\t\t\tvalue: attributes.text,\n\t\t\t\t\t\t\tonChange: this.onChangeText,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tthis.state.isPro ? wp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Text2'),\n\t\t\t\t\t\t\tvalue: attributes.text2,\n\t\t\t\t\t\t\tonChange: this.onChangeText2\n\t\t\t\t\t\t}) : null,\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('URL'),\n\t\t\t\t\t\t\tvalue: attributes.url,\n\t\t\t\t\t\t\tonChange: this.onChangeURL,\n\t\t\t\t\t\t\thelp: __('You can enter an alternative URL')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Open in New Window'),\n\t\t\t\t\t\t\tchecked: attributes.newwindow,\n\t\t\t\t\t\t\tonChange: this.updateNewWindow\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Use rel=\"nofollow\"'),\n\t\t\t\t\t\t\tchecked: attributes.relnofollow,\n\t\t\t\t\t\t\tonChange: this.updateRelNoFollow\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Tooltip Text'),\n\t\t\t\t\t\t\tvalue: attributes.tooltip,\n\t\t\t\t\t\t\tonChange: this.onChangeTooltip\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\tvar advanced_options = wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'advanced' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Advanced Settings'), initialOpen: false },\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Extra CSS Class'),\n\t\t\t\t\t\t\tvalue: attributes.className,\n\t\t\t\t\t\t\tonChange: this.onChangeClassName,\n\t\t\t\t\t\t\thelp: __('Adds an extra CSS class to the button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Output CSS inline'),\n\t\t\t\t\t\t\tchecked: attributes.style,\n\t\t\t\t\t\t\tonChange: this.updateStyle,\n\t\t\t\t\t\t\thelp: __('Use when style is not loading properly. Will output it in the HTML document, instead of footer')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(ToggleControl, {\n\t\t\t\t\t\t\tlabel: __('Recompile on load'),\n\t\t\t\t\t\t\tchecked: attributes.compile,\n\t\t\t\t\t\t\tonChange: this.updateCompile,\n\t\t\t\t\t\t\thelp: __('Use only for testing. This will slow down your site noticably! ')\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\tvar google_options = renderGoogle && wp.element.createElement(\n\t\t\t\t\tInspectorControls,\n\t\t\t\t\t{ key: 'google' },\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ title: __('Google Event Options'), initialOpen: false },\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Category'),\n\t\t\t\t\t\t\tvalue: attributes.google_category,\n\t\t\t\t\t\t\tonChange: this.onChangeGcategory,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Action'),\n\t\t\t\t\t\t\tvalue: attributes.google_action,\n\t\t\t\t\t\t\tonChange: this.onChangeGaction,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twp.element.createElement(TextControl, {\n\t\t\t\t\t\t\tlabel: __('Label'),\n\t\t\t\t\t\t\tvalue: attributes.google_label,\n\t\t\t\t\t\t\tonChange: this.onChangeGlabel,\n\t\t\t\t\t\t\thelp: __('You can change the text of the Button.')\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\treturn [general_options, advanced_options, google_options, wp.element.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t{ className: className, key: 'mb_block' },\n\t\t\t\t\twp.element.createElement('span', { dangerouslySetInnerHTML: { __html: this.button }, onClick: this.preventClick }),\n\t\t\t\t\twp.element.createElement('link', { rel: 'stylesheet', href: this.state.stylefile }),\n\t\t\t\t\t!this.button ? wp.element.createElement(\n\t\t\t\t\t\t'div',\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t'To start, add a MaxButton via the Block Settings on the right.'\n\t\t\t\t\t) : wp.element.createElement('div', null)\n\t\t\t\t)];\n\t\t\t}\n\t\t}]);\n\n\t\treturn edit;\n\t}(Component),\n\n\t/**\n * The save function defines the way in which the different attributes should be combined\n * into the final markup, which is then serialized by Gutenberg into post_content.\n *\n * The \"save\" property must be specified and must be a valid function.\n *\n * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/\n */\n\tsave: function save(props) {\n\t\treturn null;\n\t}\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL3NyYy9tYXhidXR0b25zLWJsb2NrL2Jsb2NrLmpzP2NhMGMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIF9jcmVhdGVDbGFzcyA9IGZ1bmN0aW9uICgpIHsgZnVuY3Rpb24gZGVmaW5lUHJvcGVydGllcyh0YXJnZXQsIHByb3BzKSB7IGZvciAodmFyIGkgPSAwOyBpIDwgcHJvcHMubGVuZ3RoOyBpKyspIHsgdmFyIGRlc2NyaXB0b3IgPSBwcm9wc1tpXTsgZGVzY3JpcHRvci5lbnVtZXJhYmxlID0gZ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UNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///1\n");
88
 
89
  /***/ }),
90
  /* 2 */
assets/integrations/gutenberg/gutenberg.php CHANGED
@@ -26,7 +26,7 @@ class gutenBerg{
26
  );
27
 
28
  wp_localize_script('maxbuttons_gutenberg-js', 'mb_gutenberg', array(
29
- 'ispro' => (defined('MAXBUTTONS_PRO_ROOT_FILE')) ? true : false,
30
  'icon_url' => MB()->get_plugin_url() . '/images/mb-32.png',
31
  ));
32
 
@@ -66,6 +66,12 @@ class gutenBerg{
66
  $reset = isset($post['reset']) ? $post['reset'] : false;
67
  $compile = isset($post['compile']) ? true : false;
68
 
 
 
 
 
 
 
69
  if ($window == 'true')
70
  $window = 'new';
71
 
26
  );
27
 
28
  wp_localize_script('maxbuttons_gutenberg-js', 'mb_gutenberg', array(
29
+ 'ispro' => (defined('MAXBUTTONS_PRO_ROOT_FILE')) ? 1 : 0,
30
  'icon_url' => MB()->get_plugin_url() . '/images/mb-32.png',
31
  ));
32
 
66
  $reset = isset($post['reset']) ? $post['reset'] : false;
67
  $compile = isset($post['compile']) ? true : false;
68
 
69
+ if (strlen(trim($text)) == 0 )
70
+ $text = null;
71
+
72
+ if (strlen(trim($text2)) == 0 )
73
+ $text2 = null;
74
+
75
  if ($window == 'true')
76
  $window = 'new';
77
 
assets/scss/_general.scss CHANGED
@@ -54,6 +54,9 @@
54
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
55
  min-height: 28px;
56
  }
 
 
 
57
  h1 > span {
58
  vertical-align: top;
59
  float: left;
@@ -68,7 +71,7 @@ h1 > span {
68
  // margin-left: 70px;
69
  font-weight: 400;
70
  /// font-style: italic;
71
- font-size: 18px;
72
  // display: inline-block;
73
  //height: 60px;
74
  overflow: hidden;
54
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
55
  min-height: 28px;
56
  }
57
+ h1 {
58
+ // display: inline-block;
59
+ }
60
  h1 > span {
61
  vertical-align: top;
62
  float: left;
71
  // margin-left: 70px;
72
  font-weight: 400;
73
  /// font-style: italic;
74
+ font-size: 18px;
75
  // display: inline-block;
76
  //height: 60px;
77
  overflow: hidden;
blocks/basic.php CHANGED
@@ -74,13 +74,12 @@ class basicBlock extends maxBlock
74
 
75
  $description = false;
76
 
77
- if (isset($post["description"]) && $post["description"] != '')
78
- {
79
- $description = str_replace("\n", '-nwline-', $post["description"]);
80
  $description = sanitize_text_field($description);
81
  $description = str_replace('-nwline-', "\n", $description);
82
-
83
- }
84
 
85
  $data = parent::save_fields($data, $post);
86
 
@@ -91,7 +90,14 @@ class basicBlock extends maxBlock
91
  // bypassing sanitize text field - causes problems with URLs and spaces
92
  $url = isset($post["url"]) ? trim($post["url"]) : '';
93
 
 
 
 
 
 
 
94
  $parsed_url = parse_url($url);
 
95
  $rawEncode = array("query","fragment");
96
  foreach($rawEncode as $item)
97
  {
@@ -126,7 +132,6 @@ class basicBlock extends maxBlock
126
  else
127
  $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
128
 
129
-
130
  $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
131
  $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
132
  $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
@@ -196,7 +201,6 @@ class basicBlock extends maxBlock
196
  $url = apply_filters('mb-url', $url, $data['url']); // passes processed url / raw url.
197
  $url = apply_filters('mb-url-' . $button_id, $url, $data['url']);
198
 
199
-
200
  $anchor->href = $url;
201
  //do_shortcode( esc_url($url, $this->protocols) );
202
 
74
 
75
  $description = false;
76
 
77
+ if (isset($post["description"]) && $post["description"] != '')
78
+ {
79
+ $description = str_replace("\n", '-nwline-', $post["description"]);
80
  $description = sanitize_text_field($description);
81
  $description = str_replace('-nwline-', "\n", $description);
82
+ }
 
83
 
84
  $data = parent::save_fields($data, $post);
85
 
90
  // bypassing sanitize text field - causes problems with URLs and spaces
91
  $url = isset($post["url"]) ? trim($post["url"]) : '';
92
 
93
+ // filter zero width space ( https://en.wikipedia.org/wiki/Zero-width_space ) in URL
94
+ // https://stackoverflow.com/questions/22600235/remove-unicode-zero-width-space-php
95
+ $url = str_replace("&#8203;", "", $url);
96
+ $url = str_replace("\xE2\x80\x8C", "", $url);
97
+ $url = str_replace("\xE2\x80\x8B", "", $url);
98
+
99
  $parsed_url = parse_url($url);
100
+
101
  $rawEncode = array("query","fragment");
102
  foreach($rawEncode as $item)
103
  {
132
  else
133
  $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
134
 
 
135
  $host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
136
  $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
137
  $user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
201
  $url = apply_filters('mb-url', $url, $data['url']); // passes processed url / raw url.
202
  $url = apply_filters('mb-url-' . $button_id, $url, $data['url']);
203
 
 
204
  $anchor->href = $url;
205
  //do_shortcode( esc_url($url, $this->protocols) );
206
 
classes/admin-class.php CHANGED
@@ -201,7 +201,6 @@ class maxButtonsAdmin
201
  if ($args["orderby"] != '')
202
  {
203
  $sql .= " ORDER BY $orderby $order";
204
-
205
  }
206
 
207
  if ($limit > 0)
@@ -219,7 +218,6 @@ class maxButtonsAdmin
219
 
220
  $buttons = $this->wpdb->get_results($sql, ARRAY_A);
221
 
222
-
223
  return $buttons;
224
 
225
  }
201
  if ($args["orderby"] != '')
202
  {
203
  $sql .= " ORDER BY $orderby $order";
 
204
  }
205
 
206
  if ($limit > 0)
218
 
219
  $buttons = $this->wpdb->get_results($sql, ARRAY_A);
220
 
 
221
  return $buttons;
222
 
223
  }
classes/button.php CHANGED
@@ -3,7 +3,6 @@ namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
  /* Datamodel and base functionality for a button
6
-
7
  */
8
 
9
  use \simple_html_dom as simple_html_dom;
@@ -77,7 +76,6 @@ class maxButton
77
  }
78
  }
79
 
80
-
81
  $this->clear(); // init
82
  }
83
 
@@ -401,7 +399,6 @@ class maxButton
401
  $block->admin_fields();
402
  $block->display_fields();
403
  }
404
- //do_action('mb-admin-fields' );
405
 
406
  }
407
 
@@ -656,7 +653,9 @@ class maxButton
656
  return $this->update($data);
657
 
658
  }
659
- /* Remove the button from database */
 
 
660
  public function delete($id)
661
  {
662
  global $wpdb;
@@ -730,7 +729,7 @@ class maxButton
730
 
731
  }
732
 
733
- do_action('mb/button/save', $id);
734
 
735
  if ($result === false)
736
  {
@@ -898,7 +897,6 @@ class maxButton
898
  $output = $this->display($args);
899
 
900
  return $output;
901
-
902
  }
903
 
904
 
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
  /* Datamodel and base functionality for a button
 
6
  */
7
 
8
  use \simple_html_dom as simple_html_dom;
76
  }
77
  }
78
 
 
79
  $this->clear(); // init
80
  }
81
 
399
  $block->admin_fields();
400
  $block->display_fields();
401
  }
 
402
 
403
  }
404
 
653
  return $this->update($data);
654
 
655
  }
656
+ /* Remove the button from database
657
+ * @todo implement, this function could be safer.
658
+ */
659
  public function delete($id)
660
  {
661
  global $wpdb;
729
 
730
  }
731
 
732
+ do_action('mb/button/save', $this->id);
733
 
734
  if ($result === false)
735
  {
897
  $output = $this->display($args);
898
 
899
  return $output;
 
900
  }
901
 
902
 
classes/buttons.php CHANGED
@@ -118,7 +118,7 @@ class maxButtons
118
  $button = MB()->getClass('button');
119
  $paged = isset($_POST['paged']) ? intval($_POST['paged']) : '';
120
 
121
- $redirect = admin_url() . 'admin.php?page=maxbuttons-controller';
122
 
123
  if ($paged)
124
  $redirect = add_query_arg('paged', $paged, $redirect);
118
  $button = MB()->getClass('button');
119
  $paged = isset($_POST['paged']) ? intval($_POST['paged']) : '';
120
 
121
+ $redirect = admin_url() . 'admin.php?page=maxbuttons-list';
122
 
123
  if ($paged)
124
  $redirect = add_query_arg('paged', $paged, $redirect);
classes/controller.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MaxButtons;
3
+
4
+ // controller for our views
5
+ abstract class MaxController
6
+ {
7
+
8
+ protected $view; // view data
9
+ protected $page;
10
+ protected $messages = array(); // messages to display to user.
11
+ protected $view_template;
12
+
13
+ public function __construct()
14
+ {
15
+ $this->view = new \stdClass;
16
+ }
17
+
18
+ public function view()
19
+ {
20
+ $view = $this->view;
21
+
22
+
23
+ if (! is_null($this->view_template))
24
+ {
25
+ $path = MB()->get_plugin_path() . 'includes/' . $this->view_template . '.php';
26
+ if (file_exists($path))
27
+ include_once($path);
28
+ else {
29
+ exit('Template Not Found');
30
+ }
31
+ }
32
+ }
33
+
34
+ abstract protected function handlePost();
35
+
36
+ public function getButtonLink($button_id = 0, $args = array())
37
+ {
38
+ $link = admin_url() . 'admin.php?page=maxbuttons-controller&action=edit';
39
+ if ($button_id > 0)
40
+ {
41
+ $link = add_query_arg('id', $button_id, $link);
42
+ }
43
+ $link = add_query_arg($args,$link);
44
+ return $link;
45
+ }
46
+
47
+ public function getListLink($view = 'all', $args = array() )
48
+ {
49
+ $link = admin_url() . 'admin.php?page=maxbuttons-list&view=' . $view;
50
+ $link = add_query_arg($args,$link);
51
+ return $link;
52
+
53
+ }
54
+
55
+ // sets name of the requested page. can be used to load a specific template.
56
+ public function setPage($page)
57
+ {
58
+ $this->page = $page;
59
+ }
60
+
61
+ }
classes/controllers/editorController.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MaxButtons;
3
+
4
+ // main thing for the button editor
5
+ class editorController extends MaxController
6
+ {
7
+ protected $view_template = 'maxbuttons-button';
8
+
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+
13
+ MB()->load_library('simple_template');
14
+ }
15
+
16
+ public function view()
17
+ {
18
+ if ($_POST) {
19
+ $this->handlePost();
20
+ }
21
+ $this->loadView();
22
+
23
+ parent::view();
24
+ }
25
+
26
+ protected function loadView()
27
+ {
28
+ $this->view->button = MB()->getClass('button'); // reset
29
+ $this->view->button_id = 0; // always load.
30
+
31
+ if (isset($_GET['id']) && $_GET['id'] != '') {
32
+ //$button =
33
+ $button_id = intval($_GET["id"]);
34
+ $this->view->button_id = $button_id;
35
+
36
+ if ($button_id == 0)
37
+
38
+ {
39
+ $error = __("Maxbuttons button id is zero. Your data is not saved correctly! Please check your database.","maxbuttons");
40
+ MB()->add_notice('error', $error);
41
+ }
42
+ // returns bool
43
+ $return = $this->view->button->set($button_id);
44
+ if ($return === false)
45
+ {
46
+ $error = __("MaxButtons could not find this button in the database. It might not be possible to save this button! Please check your database or contact support! ", "maxbuttons");
47
+ MB()->add_notice('error', $error);
48
+ }
49
+ }
50
+ }
51
+
52
+ protected function handlePost()
53
+ {
54
+ if (! check_admin_referer("button-edit","maxbuttons_button"))
55
+ {
56
+ exit("Request not valid");
57
+ }
58
+
59
+ $button = MB()->getClass('button'); ;
60
+ $button_id = intval($_POST["button_id"]);
61
+
62
+ if ($button_id > 0)
63
+ $button->set($button_id);
64
+ $return = $button->save($_POST);
65
+ if (is_int($return) && $button_id <= 0)
66
+ $button_id = $return;
67
+
68
+ if ($button_id === 0)
69
+ {
70
+ error_log(__("Maxbuttons Error: Button id should never be zero","maxbuttons"));
71
+ }
72
+
73
+ $button->set($button_id);
74
+ $url = $this->getButtonLink($button_id);
75
+ wp_redirect($url);
76
+ exit();
77
+ } // handlePost.
78
+
79
+ } // Class editorController
classes/controllers/listController.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MaxButtons;
3
+
4
+ class listController extends MaxController
5
+ {
6
+ protected $view_template = 'maxbuttons-list';
7
+
8
+ protected $mbadmin;
9
+ protected $button;
10
+
11
+ public function __construct()
12
+ {
13
+ $this->mbadmin = MB()->getClass('admin');
14
+ $this->button = MB()->getClass('button');
15
+ parent::__construct();
16
+ }
17
+
18
+ // view Loader.
19
+ public function view()
20
+ {
21
+
22
+ if (isset($_POST) && isset($_POST["mb-list-nonce"]) ) {
23
+ $this->handlePost();
24
+ }
25
+ $this->loadView();
26
+
27
+ parent::view();
28
+ }
29
+
30
+
31
+ public function loadView()
32
+ {
33
+
34
+ if (! isset($this->view->listView)) // Can be set by handlePost
35
+ $this->view->listView = (isset($_GET["view"])) ? sanitize_text_field($_GET["view"]) : "all";
36
+
37
+ $this->loadButtons();
38
+ $this->view->published_buttons_count = $this->mbadmin->getButtonCount(array());
39
+ $this->view->trashed_buttons_count = $this->mbadmin->getButtonCount(array("status" => "trash"));
40
+
41
+ }
42
+
43
+ protected function loadButtons()
44
+ {
45
+ $args = array();
46
+
47
+ $args['orderby'] = isset($_GET["orderby"]) ? sanitize_text_field($_GET["orderby"]) : 'id';
48
+ $args['order'] = isset($_GET["order"]) ? sanitize_text_field($_GET["order"]) : 'DESC';
49
+
50
+
51
+ if (isset($_GET["paged"]) && $_GET["paged"] != '')
52
+ {
53
+ $page = intval($_GET["paged"]);
54
+ $args["paged"] = $page;
55
+ }
56
+
57
+ if ($this->view->listView == 'trash')
58
+ $args["status"] = "trash";
59
+
60
+ $published_buttons = $this->mbadmin->getButtons($args);
61
+ $this->view->published_buttons = $published_buttons;
62
+ $this->view->pageArgs = $args;
63
+ }
64
+
65
+ protected function handlePost()
66
+ {
67
+ $verify = wp_verify_nonce( $_POST['mb-list-nonce'], 'mb-list' );
68
+ if (! $verify )
69
+ {
70
+ $this->messages[] = __('Something went wrong with the form, nonce not verified', 'maxbuttons');
71
+ return false;
72
+ }
73
+
74
+ $bulk_action = isset($_POST['bulk-action-select']) ? $_POST['bulk-action-select'] : false;
75
+ $button_id = isset($_POST['button-id']) ? $_POST['button-id'] : false;
76
+
77
+ if ($button_id && $bulk_action == 'trash') {
78
+ $count = 0;
79
+ foreach ($button_id as $id) {
80
+ $id = intval($id);
81
+ $this->button->set($id);
82
+ $this->button->setStatus('trash');
83
+ $count++;
84
+ }
85
+
86
+ if ($count == 1) {
87
+ $this->messages[] = __('Moved 1 button to the trash.', 'maxbuttons');
88
+ }
89
+
90
+ if ($count > 1) {
91
+ $this->messages[] = __('Moved ', 'maxbuttons') . $count . __(' buttons to the trash.', 'maxbuttons');
92
+ }
93
+ }
94
+ elseif ($button_id && $bulk_action == 'restore') {
95
+ $count = 0;
96
+
97
+ foreach ($button_id as $id) {
98
+ $id = intval($id);
99
+ $set = $this->button->set($id,'','trash');
100
+ $this->button->setStatus('publish');
101
+
102
+ //maxbuttons_button_restore($id);
103
+ $count++;
104
+ }
105
+
106
+ if ($count == 1) {
107
+ $this->messages[] = __('Restored 1 button.', 'maxbuttons');
108
+ }
109
+
110
+ if ($count > 1) {
111
+ $this->messages[] = __('Restored ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons');
112
+ }
113
+ $this->view->listView = 'all'; // switch to normal list.
114
+ }
115
+
116
+ if ($button_id && $bulk_action == 'delete') {
117
+ $count = 0;
118
+
119
+ foreach ($button_id as $id) {
120
+ $id = intval($id);
121
+ $this->button->delete($id);
122
+ $count++;
123
+ }
124
+
125
+ if ($count == 1) {
126
+ $this->messages[] = __('Deleted 1 button.', 'maxbuttons');
127
+ }
128
+
129
+ if ($count > 1) {
130
+ $this->messages[] = __('Deleted ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons');
131
+ }
132
+ }
133
+ } // handlePost
134
+
135
+
136
+ protected function handleMessages()
137
+ {
138
+ if (isset($_GET['message']) && $_GET['message'] == '1') {
139
+ $this->messages[] = __('Moved 1 button to the trash.', 'maxbuttons');
140
+ }
141
+
142
+ if (isset($_GET['message']) && $_GET['message'] == '1restore') {
143
+ $this->messages[] = __('Restored 1 button.', 'maxbuttons');
144
+ }
145
+
146
+ if (isset($_GET['message']) && $_GET['message'] == '1delete') {
147
+ $this->messages[] = __('Deleted 1 button.', 'maxbuttons');
148
+ }
149
+
150
+ if (isset($_GET['message']) && $_GET['message'] == 'empty-trash')
151
+ {
152
+ $this->messages[] = __('Emptied Trash', 'maxbuttons');
153
+ }
154
+
155
+ }
156
+
157
+
158
+ } // class listController
classes/controllers/settingsController.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MaxButtons;
3
+
4
+ class settingsController extends MaxController
5
+ {
6
+
7
+ protected $view_template = 'maxbuttons-settings';
8
+
9
+ public function __construct()
10
+ {
11
+ MB()->load_library('simple_template');
12
+ parent::__construct();
13
+ }
14
+
15
+ // view Loader.
16
+ public function view()
17
+ {
18
+ if (isset($_POST) ) {
19
+ $this->handlePost();
20
+ }
21
+ parent::view();
22
+ }
23
+
24
+
25
+ public function handlePost()
26
+ {
27
+ if(isset($_POST['alter_charset'])) {
28
+
29
+ global $maxbuttons_installed_version;
30
+ global $wpdb;
31
+ $table_name = maxUtils::get_table_name();
32
+
33
+ $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
34
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
35
+ $wpdb->query($sql);
36
+ $this->view->response = 'CHARSET now utf_8 COLLATE utf8_general_ci';
37
+
38
+ } else {
39
+ $this->view->response = '';
40
+ }
41
+
42
+ if (isset($_POST["reset_cache"]))
43
+ {
44
+ $button = MB()->getClass('button');
45
+ $button->reset_cache();
46
+
47
+ }
48
+
49
+ if (isset($_POST["remigrate"]))
50
+ {
51
+ $install = MB()->getClass("install");
52
+ $install::create_database_table();
53
+ $install::migrate();
54
+ }
55
+
56
+ if (isset($_POST["replace"]) && check_admin_referer('mb_bulk_edit', 'bulk_edit'))
57
+ {
58
+ $search = sanitize_text_field($_POST["search"]);
59
+ $replace = sanitize_text_field($_POST["replace"]);
60
+ $field = sanitize_text_field($_POST["replace_field"]);
61
+
62
+ $button = MB()->getClass('button');
63
+
64
+ if ($field == '')
65
+ exit("FATAL");
66
+
67
+ $admin = MB()->getClass('admin');
68
+ $buttonsIDS = $admin->getButtons(array('limit' => -1));
69
+
70
+ $data_found = false;
71
+
72
+ foreach($buttonsIDS as $row)
73
+ {
74
+ $button_id = $row["id"];
75
+ $button->set($button_id);
76
+ $data = $button->get();
77
+ foreach($data as $block => $fields)
78
+ {
79
+ if (isset($fields[$field]))
80
+ {
81
+ $value = $fields[$field];
82
+ $data[$block][$field] = str_replace($search, $replace, $value);
83
+ $button->update($data);
84
+
85
+ $data_found = true;
86
+ continue;
87
+ }
88
+
89
+ if ($data_found)
90
+ {
91
+ $data_found = false;
92
+ continue;
93
+ }
94
+ }
95
+
96
+
97
+ }
98
+
99
+ }
100
+ } // handlePost
101
+
102
+ } // settingsController
classes/controllers/supportController.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MaxButtons;
3
+
4
+ class supportController extends MaxController
5
+ {
6
+ protected $view_template = 'maxbuttons-support';
7
+
8
+ public function view()
9
+ {
10
+ $this->loadView();
11
+ parent::view();
12
+ }
13
+
14
+ protected function loadView()
15
+ {
16
+ $this->view->browser = $this->maxbuttons_get_browser();
17
+ $this->view->theme = \wp_get_theme();
18
+ $this->view->plugins = get_plugins();
19
+ $this->view->active_plugins = get_option('active_plugins', array());
20
+ }
21
+
22
+ public function handlePost()
23
+ {
24
+ return true; // no posts here.
25
+ }
26
+
27
+ // http://www.php.net/manual/en/function.get-browser.php#101125.
28
+ // Cleaned up a bit, but overall it's the same.
29
+ protected function maxbuttons_get_browser() {
30
+ $user_agent = $_SERVER['HTTP_USER_AGENT'];
31
+ $browser_name = 'Unknown';
32
+ $platform = 'Unknown';
33
+ $version= "";
34
+
35
+ // First get the platform
36
+ if (preg_match('/linux/i', $user_agent)) {
37
+ $platform = 'Linux';
38
+ }
39
+ elseif (preg_match('/macintosh|mac os x/i', $user_agent)) {
40
+ $platform = 'Mac';
41
+ }
42
+ elseif (preg_match('/windows|win32/i', $user_agent)) {
43
+ $platform = 'Windows';
44
+ }
45
+
46
+ // Next get the name of the user agent yes seperately and for good reason
47
+ if (preg_match('/MSIE/i', $user_agent) && !preg_match('/Opera/i', $user_agent)) {
48
+ $browser_name = 'Internet Explorer';
49
+ $browser_name_short = "MSIE";
50
+ }
51
+ elseif (preg_match('/Firefox/i', $user_agent)) {
52
+ $browser_name = 'Mozilla Firefox';
53
+ $browser_name_short = "Firefox";
54
+ }
55
+ elseif (preg_match('/Chrome/i', $user_agent)) {
56
+ $browser_name = 'Google Chrome';
57
+ $browser_name_short = "Chrome";
58
+ }
59
+ elseif (preg_match('/Safari/i', $user_agent)) {
60
+ $browser_name = 'Apple Safari';
61
+ $browser_name_short = "Safari";
62
+ }
63
+ elseif (preg_match('/Opera/i', $user_agent)) {
64
+ $browser_name = 'Opera';
65
+ $browser_name_short = "Opera";
66
+ }
67
+ elseif (preg_match('/Netscape/i', $user_agent)) {
68
+ $browser_name = 'Netscape';
69
+ $browser_name_short = "Netscape";
70
+ }
71
+
72
+ // Finally get the correct version number
73
+ $known = array('Version', $browser_name_short, 'other');
74
+ $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
75
+ if (!preg_match_all($pattern, $user_agent, $matches)) {
76
+ // We have no matching number just continue
77
+ }
78
+
79
+ // See how many we have
80
+ $i = count($matches['browser']);
81
+ if ($i != 1) {
82
+ // We will have two since we are not using 'other' argument yet
83
+ // See if version is before or after the name
84
+ if (strripos($user_agent, "Version") < strripos($user_agent, $browser_name_short)){
85
+ $version= $matches['version'][0];
86
+ }
87
+ else {
88
+ $version= $matches['version'][1];
89
+ }
90
+ }
91
+ else {
92
+ $version= $matches['version'][0];
93
+ }
94
+
95
+ // Check if we have a number
96
+ if ($version == null || $version == "") { $version = "?"; }
97
+
98
+ return array(
99
+ 'user_agent' => $user_agent,
100
+ 'name' => $browser_name,
101
+ 'version' => $version,
102
+ 'platform' => $platform,
103
+ 'pattern' => $pattern
104
+ );
105
+ }
106
+
107
+ } // controller.
classes/controllers/upgradeController.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace MaxButtons;
4
+
5
+ class upgradeController extends MaxController
6
+ {
7
+
8
+ protected $view_template = 'maxbuttons-pro';
9
+
10
+ public function view()
11
+ {
12
+ if ($this->page == 'social-share')
13
+ $this->view_template = 'social-share';
14
+
15
+ parent::view();
16
+ }
17
+
18
+ // no posts.
19
+ public function handlePost()
20
+ {
21
+ return false;
22
+ }
23
+ } // controller
classes/maxCSSParser.php CHANGED
@@ -48,7 +48,7 @@ class maxCSSParser
48
  function __construct()
49
  {
50
  //$root[] = array("a" => array("hover","active","responsive"));
51
-
52
  }
53
 
54
  function loadDom($domObj)
48
  function __construct()
49
  {
50
  //$root[] = array("a" => array("hover","active","responsive"));
51
+ MB()->load_library('scss');
52
  }
53
 
54
  function loadDom($domObj)
{includes → classes}/maxbuttons-admin-helper.php RENAMED
@@ -4,31 +4,29 @@ defined('ABSPATH') or die('No direct access permitted');
4
 
5
  /* Helper class for uniform elements in admin pages */
6
 
7
- add_action('mb-display-logo', array(maxUtils::namespaceit('maxAdmin'),'logo'));
8
- add_action('mb-display-title', array(maxUtils::namespaceit("maxAdmin"),'rate_us'), 20);
9
- add_action('mb-display-tabs', array(maxUtils::namespaceit('maxAdmin'),'tab_menu'));
10
- add_action('mb-display-ads', array(maxUtils::namespaceit('maxAdmin'), 'display_ads'));
11
- add_action('mb-display-pagination', array(maxUtils::namespaceit('maxAdmin'), 'display_pagination'), 10, 2);
12
-
13
- add_action('mb-display-collection-welcome', array(maxUtils::namespaceit('maxAdmin'), 'displayCollectionWelcome'));
14
-
15
-
16
  class maxAdmin
17
  {
18
  protected static $tabs = null;
19
 
 
 
 
 
 
 
 
 
 
20
 
21
  public static function logo()
22
  {
23
  $version = self::getAdVersion();
24
  $url = self::getCheckoutURL();
25
-
26
-
27
  ?>
28
 
29
  <?php printf(__('Upgrade to MaxButtons Pro today! %sClick Here%s', 'maxbuttons'), '<a class="simple-btn" href="' . $url . '&utm_source=mbf-dash' . $version . '&utm_medium=mbf-plugin&utm_content=click-here&utm_campaign=cart' . $version . '" target="_blank">', '</a>' ) ?>
30
 
31
- <?php $twitlink = 'https://twitter.com/intent/user?original_referer=http%3A%2F%2Flocal.max%2Fwp-admin%2Fadmin.php%3Fpage%3Dmaxbuttons-controller&amp;ref_src=twsrc%5Etfw&amp;region=count_link&amp;screen_name=maxfoundry&amp;tw_p=followbutton';
32
  ?>
33
 
34
  <?php
@@ -38,12 +36,8 @@ class maxAdmin
38
  {
39
  self::$tabs = array(
40
  "list" => array("name" => __('Buttons', 'maxbuttons'),
41
- "link" => "page=maxbuttons-controller&action=list",
42
- "active" => "maxbuttons-controller", ),
43
- "collection" => array("name" => __('Share Buttons','maxbuttons'),
44
- "link" => "page=maxbuttons-collections",
45
- "active" => "maxbuttons-collections",
46
- ),
47
  "pro" => array( "name" => __('Upgrade to Pro', 'maxbuttons'),
48
  "link" => "page=maxbuttons-pro",
49
  "active" => "maxbuttons-pro",
4
 
5
  /* Helper class for uniform elements in admin pages */
6
 
 
 
 
 
 
 
 
 
 
7
  class maxAdmin
8
  {
9
  protected static $tabs = null;
10
 
11
+ public static function init()
12
+ {
13
+ add_action('mb-display-logo', array(maxUtils::namespaceit('maxAdmin'),'logo'));
14
+ add_action('mb-display-title', array(maxUtils::namespaceit("maxAdmin"),'rate_us'), 20);
15
+ add_action('mb-display-tabs', array(maxUtils::namespaceit('maxAdmin'),'tab_menu'));
16
+ add_action('mb-display-ads', array(maxUtils::namespaceit('maxAdmin'), 'display_ads'));
17
+ add_action('mb-display-pagination', array(maxUtils::namespaceit('maxAdmin'), 'display_pagination'), 10, 2);
18
+ add_action('mb-display-collection-welcome', array(maxUtils::namespaceit('maxAdmin'), 'displayCollectionWelcome'));
19
+ }
20
 
21
  public static function logo()
22
  {
23
  $version = self::getAdVersion();
24
  $url = self::getCheckoutURL();
 
 
25
  ?>
26
 
27
  <?php printf(__('Upgrade to MaxButtons Pro today! %sClick Here%s', 'maxbuttons'), '<a class="simple-btn" href="' . $url . '&utm_source=mbf-dash' . $version . '&utm_medium=mbf-plugin&utm_content=click-here&utm_campaign=cart' . $version . '" target="_blank">', '</a>' ) ?>
28
 
29
+ <?php// $twitlink = 'https://twitter.com/intent/user?original_referer=http%3A%2F%2Flocal.max%2Fwp-admin%2Fadmin.php%3Fpage%3Dmaxbuttons&amp;ref_src=twsrc%5Etfw&amp;region=count_link&amp;screen_name=maxfoundry&amp;tw_p=followbutton';
30
  ?>
31
 
32
  <?php
36
  {
37
  self::$tabs = array(
38
  "list" => array("name" => __('Buttons', 'maxbuttons'),
39
+ "link" => "page=maxbuttons-list",
40
+ "active" => "maxbuttons-list", ),
 
 
 
 
41
  "pro" => array( "name" => __('Upgrade to Pro', 'maxbuttons'),
42
  "link" => "page=maxbuttons-pro",
43
  "active" => "maxbuttons-pro",
classes/maxbuttons-class.php CHANGED
@@ -19,12 +19,17 @@ class maxButtonsPlugin
19
 
20
  protected static $instance;
21
 
 
 
22
  /* Class constructor
23
  Add hooks and actions used by this plugin. Sets plugin environment information
24
  */
25
- function __construct()
26
  {
 
 
27
  maxUtils::timeInit(); // benchmark timer init.
 
28
 
29
  $this->plugin_url = self::get_plugin_url(); //plugins_url() . '/' . $this->plugin_name;
30
  $this->plugin_path = self::get_plugin_path(); //plugin_dir_path($rootfile);
@@ -35,6 +40,43 @@ class maxButtonsPlugin
35
  if ( defined('MAXBUTTONS_DEBUG') && MAXBUTTONS_DEBUG)
36
  $this->debug_mode = true;
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  add_action('plugins_loaded', array($this, 'load_textdomain'));
39
 
40
  add_filter('widget_text', 'do_shortcode');
@@ -95,9 +137,6 @@ class maxButtonsPlugin
95
  // setup page hooks and shortcode
96
  add_shortcode('maxcollection', array($this, 'collection_shortcode'));
97
 
98
-
99
- self::$instance = $this;
100
- maxIntegrations::init(); // fire the integrations.
101
  }
102
 
103
  public static function getInstance()
@@ -240,16 +279,17 @@ class maxButtonsPlugin
240
 
241
  // We add this submenu page with the same slug as the parent to ensure we don't get duplicates
242
  $sub_menu_title = __('Buttons', 'maxbuttons');
 
243
  $admin_pages[] = add_submenu_page($menu_slug, $page_title, $sub_menu_title, $capability, $menu_slug, $function);
244
 
245
  // Now add the submenu page for the Add New page
246
  $submenu_page_title = __('MaxButtons: Add/Edit Button', 'maxbuttons');
247
  $submenu_title = __('Add New', 'maxbuttons');
248
- $submenu_slug = 'maxbuttons-controller&action=edit';
 
249
  //$submenu_function = 'maxbuttons_button';
250
  $admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
251
 
252
-
253
  // Now add the submenu page for the Go Pro page
254
  $submenu_page_title = __('MaxButtons: Upgrade to Pro', 'maxbuttons');
255
  $submenu_title = __('Upgrade to Pro', 'maxbuttons');
@@ -275,7 +315,7 @@ class maxButtonsPlugin
275
  {
276
  $submenu_page_title = __('MaxButtons: Share Buttons', 'maxbuttons');
277
  $submenu_title = __('Share Buttons', 'maxbuttons');
278
- $submenu_slug = 'maxbuttons-collections';
279
  $admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
280
  }
281
  }
@@ -284,32 +324,50 @@ class maxButtonsPlugin
284
  {
285
  $page = sanitize_text_field($_GET["page"]);
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  switch($page)
288
  {
289
  case "maxbuttons-button":
290
- $pagepath = "includes/maxbuttons-button.php";
291
  break;
292
  case "maxbuttons-support":
293
- $pagepath = "includes/maxbuttons-support.php";
294
  break;
295
  case "maxbuttons-settings":
296
- $pagepath = "includes/maxbuttons-settings.php";
297
  break;
298
  case "maxbuttons-pro":
299
- $pagepath = "includes/maxbuttons-pro.php";
300
- break;
301
- case "maxbuttons-collections":
302
- $pagepath = "includes/maxbuttons-collections.php";
303
  break;
304
  default:
305
- $pagepath = "includes/maxbuttons-controller.php";
306
  break;
307
  }
308
- $pagepath = $this->plugin_path . $pagepath;
309
-
310
- include(apply_filters("mb-load-admin-page-$page", $pagepath));
 
311
  }
312
 
 
 
 
 
313
  public function load_library($libname)
314
  {
315
  $version = MAXBUTTONS_VERSION_NUM;
@@ -331,6 +389,30 @@ class maxButtonsPlugin
331
  wp_enqueue_script('maxbuttons-review-notice');
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  }
335
 
336
 
19
 
20
  protected static $instance;
21
 
22
+ private $paths = array('classes', 'classes/controllers');
23
+
24
  /* Class constructor
25
  Add hooks and actions used by this plugin. Sets plugin environment information
26
  */
27
+ public function __construct()
28
  {
29
+ $this->load(); // loads classes
30
+
31
  maxUtils::timeInit(); // benchmark timer init.
32
+ maxAdmin::init(); // helper class hook init
33
 
34
  $this->plugin_url = self::get_plugin_url(); //plugins_url() . '/' . $this->plugin_name;
35
  $this->plugin_path = self::get_plugin_path(); //plugin_dir_path($rootfile);
40
  if ( defined('MAXBUTTONS_DEBUG') && MAXBUTTONS_DEBUG)
41
  $this->debug_mode = true;
42
 
43
+ self::$instance = $this;
44
+
45
+ $this->hooks();
46
+
47
+ maxIntegrations::init(); // fire the integrations.
48
+
49
+ // Core libraries.
50
+ MB()->load_library('simplehtmldom');
51
+ MB()->load_library('simple_template');
52
+ }
53
+
54
+ public function load()
55
+ {
56
+ $plugin_path = plugin_dir_path(MAXBUTTONS_ROOT_FILE);
57
+ foreach($this->paths as $short_path)
58
+ {
59
+ $directory_path = realpath($plugin_path . $short_path);
60
+
61
+ if ($directory_path !== false)
62
+ {
63
+ $it = new \DirectoryIterator($directory_path);
64
+ foreach($it as $file)
65
+ {
66
+ $file_path = $file->getRealPath();
67
+ if ($file->isFile() && pathinfo($file_path, PATHINFO_EXTENSION) == 'php')
68
+ {
69
+ require_once($file_path);
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ }
76
+
77
+ public function hooks()
78
+ {
79
+
80
  add_action('plugins_loaded', array($this, 'load_textdomain'));
81
 
82
  add_filter('widget_text', 'do_shortcode');
137
  // setup page hooks and shortcode
138
  add_shortcode('maxcollection', array($this, 'collection_shortcode'));
139
 
 
 
 
140
  }
141
 
142
  public static function getInstance()
279
 
280
  // We add this submenu page with the same slug as the parent to ensure we don't get duplicates
281
  $sub_menu_title = __('Buttons', 'maxbuttons');
282
+ $menu_slug = 'maxbuttons-controller';
283
  $admin_pages[] = add_submenu_page($menu_slug, $page_title, $sub_menu_title, $capability, $menu_slug, $function);
284
 
285
  // Now add the submenu page for the Add New page
286
  $submenu_page_title = __('MaxButtons: Add/Edit Button', 'maxbuttons');
287
  $submenu_title = __('Add New', 'maxbuttons');
288
+ $submenu_slug = 'maxbuttons-button';
289
+
290
  //$submenu_function = 'maxbuttons_button';
291
  $admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
292
 
 
293
  // Now add the submenu page for the Go Pro page
294
  $submenu_page_title = __('MaxButtons: Upgrade to Pro', 'maxbuttons');
295
  $submenu_title = __('Upgrade to Pro', 'maxbuttons');
315
  {
316
  $submenu_page_title = __('MaxButtons: Share Buttons', 'maxbuttons');
317
  $submenu_title = __('Share Buttons', 'maxbuttons');
318
+ $submenu_slug = 'social-share';
319
  $admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
320
  }
321
  }
324
  {
325
  $page = sanitize_text_field($_GET["page"]);
326
 
327
+ if ($page == 'maxbuttons-controller')
328
+ {
329
+ $action = isset($_GET['action']) ? sanitize_text_field($_GET['action']) : null;
330
+ if (! is_null($action))
331
+ {
332
+ $page = 'maxbuttons-list'; // default;
333
+
334
+ if ($action == 'button' || $action == 'edit')
335
+ {
336
+ $page = 'maxbuttons-button';
337
+ }
338
+
339
+ }
340
+ }
341
+
342
  switch($page)
343
  {
344
  case "maxbuttons-button":
345
+ $controller = new editorController();
346
  break;
347
  case "maxbuttons-support":
348
+ $controller = new supportController();
349
  break;
350
  case "maxbuttons-settings":
351
+ $controller = new settingsController();
352
  break;
353
  case "maxbuttons-pro":
354
+ case "social-share":
355
+ $controller = new upgradeController();
 
 
356
  break;
357
  default:
358
+ $controller = new listController();
359
  break;
360
  }
361
+ //$pagepath = $this->plugin_path . $pagepath;
362
+ $controller->setPage($page);
363
+ $controller->view();
364
+ // include(apply_filters("mb-load-admin-page-$page", $pagepath));
365
  }
366
 
367
+ /** Load a library. This can be a non-standard Javascript / CSS combination or external PHP scripting
368
+ *
369
+ * @param $libname String Known library name
370
+ */
371
  public function load_library($libname)
372
  {
373
  $version = MAXBUTTONS_VERSION_NUM;
389
  wp_enqueue_script('maxbuttons-review-notice');
390
  }
391
 
392
+ if ($libname == 'scss')
393
+ {
394
+ // external libraries
395
+ if ( version_compare(PHP_VERSION, '5.4', '<' ) )
396
+ {
397
+ require_once($this->get_plugin_path() . "assets/libraries/scssphp_legacy/scss.inc.php");
398
+ }
399
+ else
400
+ {
401
+ require_once($this->get_plugin_path() . "assets/libraries/scssphp/scss.inc.php");
402
+ }
403
+ }
404
+
405
+ if ($libname == 'simple_template')
406
+ {
407
+ require_once($this->get_plugin_path() . "assets/libraries/simple-template/simple_template.php");
408
+ }
409
+
410
+ if ($libname == 'simplehtmldom')
411
+ {
412
+ if (! class_exists('simple_html_dom_node'))
413
+ require_once($this->get_plugin_path() . "assets/libraries/simplehtmldom/simple_html_dom.php");
414
+ }
415
+
416
  }
417
 
418
 
includes/maxbuttons-button.php CHANGED
@@ -2,57 +2,15 @@
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
- $button = MB()->getClass("button");
6
- $button_id = 0;
7
-
8
- if ($_POST) {
9
- if (! check_admin_referer("button-edit","maxbuttons_button"))
10
- {
11
- exit("Request not valid");
12
- }
13
-
14
- $button_id = intval($_POST["button_id"]);
15
-
16
- if ($button_id > 0)
17
- $button->set($button_id);
18
- $return = $button->save($_POST);
19
- if (is_int($return) && $button_id <= 0)
20
- $button_id = $return;
21
-
22
- if ($button_id === 0)
23
- {
24
- error_log(__("Maxbuttons Error: Button id should never be zero","maxbuttons"));
25
- }
26
-
27
- $button->set($button_id);
28
- wp_redirect(admin_url('admin.php?page=maxbuttons-controller&action=button&id=' . $button_id));
29
- exit();
30
- }
31
-
32
- if (isset($_GET['id']) && $_GET['id'] != '') {
33
- $button = MB()->getClass('button'); // reset
34
- $button_id = intval($_GET["id"]);
35
- if ($button_id == 0)
36
- {
37
- $error = __("Maxbuttons button id is zero. Your data is not saved correctly! Please check your database.","maxbuttons");
38
- MB()->add_notice('error', $error);
39
- }
40
- // returns bool
41
- $return = $button->set($button_id);
42
- if ($return === false)
43
- {
44
- $error = __("MaxButtons could not find this button in the database. It might not be possible to save this button! Please check your database or contact support! ", "maxbuttons");
45
- MB()->add_notice('error', $error);
46
- }
47
- }
48
-
49
 
50
  $admin = MB()->getClass('admin');
51
  $page_title = __("Button editor","maxbuttons");
52
- $action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-controller&action=edit'>" . __('Add New', 'maxbuttons') . "</a>";
53
  $admin->get_header(array("title" => $page_title, "title_action" => $action) );
54
  ?>
55
- <form id="new-button-form" action="<?php echo admin_url('admin.php?page=maxbuttons-controller&action=button&noheader=true'); ?>" method="post">
56
  <input type="hidden" name="button_id" value="<?php echo $button_id ?>">
57
  <?php wp_nonce_field("button-edit","maxbuttons_button") ?>
58
  <?php wp_nonce_field("button-copy","copy_nonce"); ?>
@@ -122,8 +80,8 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
122
  </div>
123
 
124
 
125
- <div class='mb-message mb-notice copy-notice hidden'><p><?php _e('Your button has not been saved. Any changes will be lost!','maxbuttons'); ?></p>
126
- </div>
127
  <p><?php _e("Do you want to copy this button to a new button?","maxbuttons"); ?></p>
128
  </span>
129
  <span class="controls">
@@ -138,8 +96,6 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
138
  /** Display admin notices [deprecated]
139
  * @ignore
140
  */
141
-
142
-
143
  /** Display admin notices
144
  *
145
  * Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format.
@@ -231,15 +187,26 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
231
  </div> <!-- inner -->
232
  </div> <!-- output -->
233
 
234
- <?php #### STARTING FIELDS;
 
 
235
 
 
236
  $button->admin_fields();
237
-
238
  ?>
239
-
 
 
 
 
 
 
 
 
240
  <div class="form-actions">
241
  <a href="#" class="button-primary button-save"><?php _e('Save', 'maxbuttons') ?></a>
242
  </div>
 
243
  </form>
244
 
245
  <?php // output the link dialog thing
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
+ $button_id = $this->view->button_id;
6
+ $button = $this->view->button;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  $admin = MB()->getClass('admin');
9
  $page_title = __("Button editor","maxbuttons");
10
+ $action = "<a class='page-title-action add-new-h2' href='" . $this->getButtonLink() . "'>" . __('Add New', 'maxbuttons') . "</a>";
11
  $admin->get_header(array("title" => $page_title, "title_action" => $action) );
12
  ?>
13
+ <form id="new-button-form" action="<?php echo $this->getButtonLink($button_id, array('noheader' => true)); // echo admin_url('admin.php?page=maxbuttons-controller&action=button&noheader=true'); ?>" method="post">
14
  <input type="hidden" name="button_id" value="<?php echo $button_id ?>">
15
  <?php wp_nonce_field("button-edit","maxbuttons_button") ?>
16
  <?php wp_nonce_field("button-copy","copy_nonce"); ?>
80
  </div>
81
 
82
 
83
+ <div class='mb-message mb-notice copy-notice hidden'><p><?php _e('Your button has not been saved. Any changes will be lost!','maxbuttons'); ?></p>
84
+ </div>
85
  <p><?php _e("Do you want to copy this button to a new button?","maxbuttons"); ?></p>
86
  </span>
87
  <span class="controls">
96
  /** Display admin notices [deprecated]
97
  * @ignore
98
  */
 
 
99
  /** Display admin notices
100
  *
101
  * Hook to display admin notices on error and other occurences in the editor. Follows WP guidelines on format.
187
  </div> <!-- inner -->
188
  </div> <!-- output -->
189
 
190
+ <div class='editor'>
191
+ <div id='normal_screen'>
192
+ <!-- <span class='dashicons dashicons-admin-home'>&nbsp;</span> -->
193
 
194
+ <?php #### STARTING FIELDS;
195
  $button->admin_fields();
 
196
  ?>
197
+ </div>
198
+ <!--
199
+ <div id='mobile_screen1'>
200
+ <span class='dashicons dashicons-admin-home'>&nbsp;</span>
201
+ - Screen 2 (wohoe)
202
+ </div>
203
+ -->
204
+
205
+ </div>
206
  <div class="form-actions">
207
  <a href="#" class="button-primary button-save"><?php _e('Save', 'maxbuttons') ?></a>
208
  </div>
209
+
210
  </form>
211
 
212
  <?php // output the link dialog thing
includes/maxbuttons-controller.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
  namespace MaxButtons;
 
 
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
  if (isset($_GET['action']) && $_GET['action'] != '') {
@@ -9,17 +11,19 @@ if (isset($_GET['action']) && $_GET['action'] != '') {
9
  switch ($action) {
10
  case 'button':
11
  case 'edit':
12
- include_once 'maxbuttons-button.php';
13
- break;
14
- case 'test':
15
- include_once 'maxbuttons-fa-test.php';
16
  break;
17
  default:
18
- include_once 'maxbuttons-list.php';
19
- break;
 
 
20
 
21
  }
22
 
23
  } else {
24
- include_once 'maxbuttons-list.php';
 
25
  }
1
  <?php
2
  namespace MaxButtons;
3
+ exit('XXIT');
4
+
5
  defined('ABSPATH') or die('No direct access permitted');
6
 
7
  if (isset($_GET['action']) && $_GET['action'] != '') {
11
  switch ($action) {
12
  case 'button':
13
  case 'edit':
14
+ //include_once 'maxbuttons-button.php';
15
+ $_GET['page'] = 'maxbuttons-button';
16
+ MB()->loadAdminPage();
 
17
  break;
18
  default:
19
+ //include_once 'maxbuttons-list.php';
20
+ $_GET['page'] = 'maxbuttons-list';
21
+ MB()->loadAdminPage();
22
+ break;
23
 
24
  }
25
 
26
  } else {
27
+ $_GET['page'] = 'maxbuttons-list';
28
+ MB()->loadAdminPage();
29
  }
includes/maxbuttons-list.php CHANGED
@@ -2,131 +2,9 @@
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
- $result = '';
6
- $button = MB()->getClass("button");
7
- $mbadmin = MB()->getClass("admin");
8
- $collections = MB()->getClass('collections');
9
- $collection = MB()->getClass('collection');
10
-
11
-
12
- $view = (isset($_GET["view"])) ? sanitize_text_field($_GET["view"]) : "all";
13
-
14
- // submit
15
- if (isset($_POST) && isset($_POST["mb-list-nonce"]) ) {
16
- $verify = wp_verify_nonce( $_POST['mb-list-nonce'], 'mb-list' );
17
- if (! $verify ) echo " Nonce not verifed";
18
-
19
- if ($verify && isset($_POST['button-id']) && isset($_POST['bulk-action-select'])) {
20
- if ($_POST['bulk-action-select'] == 'trash') {
21
- $count = 0;
22
-
23
- foreach ($_POST['button-id'] as $id) {
24
- $id = intval($id);
25
- $button->set($id);
26
- $button->setStatus('trash');
27
- $count++;
28
- }
29
-
30
- if ($count == 1) {
31
- $result = __('Moved 1 button to the trash.', 'maxbuttons');
32
- }
33
-
34
- if ($count > 1) {
35
- $result = __('Moved ', 'maxbuttons') . $count . __(' buttons to the trash.', 'maxbuttons');
36
- }
37
- }
38
- }
39
- if ($verify && $_POST['bulk-action-select'] == 'restore') {
40
- $count = 0;
41
-
42
- foreach ($_POST['button-id'] as $id) {
43
- $id = intval($id);
44
- $set = $button->set($id,'','trash');
45
- $button->setStatus('publish');
46
-
47
- //maxbuttons_button_restore($id);
48
- $count++;
49
- }
50
-
51
- if ($count == 1) {
52
- $result = __('Restored 1 button.', 'maxbuttons');
53
- }
54
-
55
- if ($count > 1) {
56
- $result = __('Restored ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons');
57
- }
58
- $view = 'all'; // switch to normal list.
59
- }
60
-
61
- if ($verify && $_POST['bulk-action-select'] == 'delete') {
62
- $count = 0;
63
-
64
- foreach ($_POST['button-id'] as $id) {
65
- $id = intval($id);
66
- $button->delete($id);
67
- $count++;
68
- }
69
-
70
- if ($count == 1) {
71
- $result = __('Deleted 1 button.', 'maxbuttons');
72
- }
73
-
74
- if ($count > 1) {
75
- $result = __('Deleted ', 'maxbuttons') . $count . __(' buttons.', 'maxbuttons');
76
- }
77
- }
78
- }
79
-
80
- if (isset($_GET['message']) && $_GET['message'] == '1') {
81
- $result = __('Moved 1 button to the trash.', 'maxbuttons');
82
- }
83
-
84
- if (isset($_GET['message']) && $_GET['message'] == '1restore') {
85
- $result = __('Restored 1 button.', 'maxbuttons');
86
- }
87
-
88
- if (isset($_GET['message']) && $_GET['message'] == '1delete') {
89
- $result = __('Deleted 1 button.', 'maxbuttons');
90
- }
91
-
92
- if (isset($_GET['message']) && $_GET['message'] == 'empty-trash')
93
- {
94
- $result = __('Emptied Trash', 'maxbuttons');
95
- }
96
-
97
- $args = array(
98
- "orderby" => "id",
99
- "order" => "DESC",
100
-
101
- );
102
-
103
- if (isset($_GET["orderby"]))
104
- $args["orderby"] = sanitize_text_field($_GET["orderby"]);
105
- if (isset($_GET["order"]))
106
- $args["order"] = sanitize_text_field($_GET["order"]);
107
-
108
- if (isset($_GET["paged"]) && $_GET["paged"] != '')
109
- {
110
- $page = intval($_GET["paged"]);
111
- $args["paged"] = $page;
112
- }
113
-
114
- if ($view == 'trash')
115
- $args["status"] = "trash";
116
-
117
-
118
- $published_buttons = $mbadmin->getButtons($args);
119
-
120
- $published_buttons_count = $mbadmin->getButtonCount(array());
121
- $trashed_buttons_count = $mbadmin->getButtonCount(array("status" => "trash"));
122
-
123
- $args["view"] = $view;
124
-
125
- $page_args = $args;
126
-
127
-
128
  ?>
129
 
 
130
  <script type="text/javascript">
131
  jQuery(document).ready(function() {
132
  jQuery("#bulk-action-all").click(function() {
@@ -145,28 +23,26 @@ $page_args = $args;
145
 
146
  <?php
147
  $page_title = __("Overview","maxbuttons");
148
- $action = "<a class='page-title-action add-new-h2' href='" . admin_url() . "admin.php?page=maxbuttons-controller&action=edit'>" . __('Add New', 'maxbuttons') . "</a>";
149
- $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
150
  ?>
151
 
152
  <div class="form-actions">
153
- <a class="button-primary" href="<?php echo admin_url() ?>admin.php?page=maxbuttons-controller&action=edit"><?php _e('Add New', 'maxbuttons') ?></a>
154
  </div>
155
 
156
- <?php if ($result != '') { ?>
157
- <div class="mb-notice mb-message"><?php echo $result ?></div>
158
  <?php }
159
-
160
- do_action('mb-display-reviewoffer');
161
  ?>
162
 
163
 
164
  <p class="status">
165
  <?php
166
- $url = admin_url() . "admin.php?page=maxbuttons-controller&action=list";
167
- $trash_url = $url . "&view=trash";
168
 
169
- if ($view == 'trash')
170
  {
171
  $all_line = "<strong><a href='$url'>" . __('All', 'maxbuttons') . "</strong></a>";
172
  $trash_line = __("Trash", "maxbuttons");
@@ -177,11 +53,11 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
177
  $trash_line = "<a href='$trash_url'>" . __("Trash","maxbuttons") . "</strong></a>";
178
  }
179
  ?>
180
- <?php echo $all_line ?><span class="count"> (<?php echo $published_buttons_count ?>)</span>
181
 
182
- <?php if ($trashed_buttons_count > 0) { ?>
183
  <span class="separator">|</span>
184
- <?php echo $trash_line ?> <span class="count">(<?php echo $trashed_buttons_count ?>)</span>
185
  <?php } ?>
186
  </p>
187
  <?php
@@ -196,36 +72,34 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
196
  <?php wp_nonce_field('button-empty-trash', 'empty-trash_nonce'); ?>
197
 
198
  <?php if (isset($page_args['paged'])) : ?>
199
- <input type="hidden" name="paged" value="<?php echo $page_args['paged'] ?>" />
200
  <?php endif; ?>
201
 
202
- <input type="hidden" name="view" value="<?php echo $view ?>" />
203
  <?php wp_nonce_field("mb-list","mb-list-nonce"); ?>
204
 
205
  <select name="bulk-action-select" id="bulk-action-select">
206
  <option value=""><?php _e('Bulk Actions', 'maxbuttons') ?></option>
207
- <?php if ($view == 'all'): ?>
208
 
209
  <option value="trash"><?php _e('Move to Trash', 'maxbuttons') ?></option>
210
  <?php endif;
211
- if ($view == 'trash'): ?>
212
  <option value="restore"><?php _e('Restore', 'maxbuttons') ?></option>
213
  <option value="delete"><?php _e('Delete Permanently', 'maxbuttons') ?></option>
214
  <?php endif; ?>
215
  </select>
216
  <input type="submit" class="button" value="<?php _e('Apply', 'maxbuttons') ?>" />
217
 
218
- <?php if ($view == 'trash'): ?>
219
  <button type="button" class='button alignright' value='empty-trash' data-buttonaction='empty-trash' data-confirm="<?php _e('Permanently delete all buttons in trash. Are you sure?', 'maxbuttons-pro') ?>"><?php _e('Empty Trash', 'maxbuttons'); ?></button>
220
  <?php endif; ?>
221
- <?php do_action("mb-display-pagination", $page_args, 'top'); ?>
222
 
223
 
224
 
225
  <?php // Sorting
226
-
227
-
228
- $link_order = (! isset($_GET["order"]) || $_GET["order"] == "DESC") ? "ASC" : 'DESC';
229
 
230
  $name_sort_url = add_query_arg(array(
231
  "orderby" => "name",
@@ -236,7 +110,7 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
236
  "order" => $link_order
237
  ));
238
 
239
- $sort_arrow = ( strtolower($args["order"]) == 'desc') ? 'dashicons-arrow-down' : 'dashicons-arrow-up'
240
  ?>
241
 
242
  <div class="button-list preview-buttons">
@@ -246,7 +120,7 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
246
  <span class='col col_button'>
247
  <a href="<?php echo $id_sort_url ?>">
248
  <?php _e('Button', 'maxbuttons') ?>
249
- <?php if ($args["orderby"] == 'id')
250
  echo "<span class='dashicons $sort_arrow'></span>";
251
  ?>
252
  </a>
@@ -254,7 +128,7 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
254
  <span class="col col_name manage-column column-name sortable <?php echo strtolower($link_order) ?>">
255
  <a href="<?php echo $name_sort_url ?>">
256
  <span><?php _e('Name and Description', 'maxbuttons') ?></span>
257
- <?php if ($args["orderby"] == 'name')
258
  echo "<span class='dashicons $sort_arrow'></span>";
259
  ?>
260
 
@@ -264,31 +138,30 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
264
  </div> <!-- heading -->
265
 
266
  <?php
267
- foreach ($published_buttons as $b):
268
  $id = $b['id'];
269
- if($view == 'trash')
270
- $button->set($id,'','trash');
271
- else
272
- $button->set($id);
273
 
274
- //$inCollections = $collections::isButtonInCollection($id);
 
 
 
275
  ?>
276
  <div class='button-row'>
277
  <span class="col col_check"><input type="checkbox" name="button-id[]" id="button-id-<?php echo $id ?>" value="<?php echo $id ?>" /></span>
278
  <span class="col col_button"><div class="shortcode-container">
279
  <?php
280
- $button->display( array("mode" => "preview") );
281
  ?>
282
  </div>
283
  <div class="actions">
284
- <?php if($view == 'all') : ?>
285
- <a href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=button&id=<?php echo $id ?>"><?php _e('Edit', 'maxbuttons') ?></a>
286
  <span class="separator">|</span>
287
  <a href='javascript:void(0);' data-buttonaction='copy' data-buttonid="<?php echo $id ?>"><?php _e('Copy', 'maxbuttons') ?></a>
288
  <span class="separator">|</span>
289
  <a href="javascript:void(0)" data-buttonaction='trash' data-buttonid="<?php echo $id ?>"><?php _e('Move to Trash', 'maxbuttons') ?></a>
290
  <?php endif;
291
- if ($view == 'trash'):
292
  ?>
293
  <a href="javascript:void(0);" data-buttonaction='restore' data-buttonid="<?php echo $id ?>"><?php _e('Restore', 'maxbuttons') ?></a>
294
  <span class="separator">|</span>
@@ -298,16 +171,16 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
298
 
299
 
300
  </span>
301
- <span class="col col_name"><a class="button-name" href="<?php admin_url() ?>admin.php?page=maxbuttons-controller&action=button&id=<?php echo $id ?>"><?php echo $button->getName() ?></a>
302
  <br />
303
- <p><?php echo $button->getDescription() ?></p>
304
  </span>
305
  <span class="col col_shortcode"> [maxbutton id="<?php echo $id ?>"] <br /><strong><?php _e('or', 'maxbuttons'); ?></strong><br />
306
- [maxbutton name="<?php echo $button->getName() ?>"]
307
 
308
  <?php
309
- if ($button->getUpdated(false) > 0) : ?>
310
- <span class='last-update'>Updated <?php echo $button->getUpdated(); ?></span>
311
  <?php endif; ?>
312
  </span>
313
  </div>
@@ -320,14 +193,14 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
320
 
321
  <div class=''>
322
  <?php
323
- if (count($published_buttons) == 0):
324
  include('maxbuttons-welcome.php');
325
  endif;
326
  ?>
327
  </div>
328
 
329
 
330
- <?php do_action("mb-display-pagination", $page_args, 'bottom'); ?>
331
 
332
 
333
 
@@ -336,4 +209,4 @@ $mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
336
  <?php do_action("mb-display-ads"); ?>
337
  </div>
338
 
339
- <?php $mbadmin->get_footer(); ?>
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ?>
6
 
7
+ <!-- @todo Remove -->
8
  <script type="text/javascript">
9
  jQuery(document).ready(function() {
10
  jQuery("#bulk-action-all").click(function() {
23
 
24
  <?php
25
  $page_title = __("Overview","maxbuttons");
26
+ $action = "<a class='page-title-action add-new-h2' href='" . $this->getButtonLink() . "'>" . __('Add New', 'maxbuttons') . "</a>";
27
+ $this->mbadmin->get_header(array("title" => $page_title, "title_action" => $action));
28
  ?>
29
 
30
  <div class="form-actions">
31
+ <a class="button-primary" href="<?php echo $this->getButtonLink(); ?>"><?php _e('Add New', 'maxbuttons') ?></a>
32
  </div>
33
 
34
+ <?php foreach ($this->messages as $message) { ?>
35
+ <div class="mb-notice mb-message"><?php echo $message ?></div>
36
  <?php }
 
 
37
  ?>
38
 
39
 
40
  <p class="status">
41
  <?php
42
+ $url = $this->getListLink(); // admin_url() . "admin.php?page=maxbuttons-controller&action=list";
43
+ $trash_url = $this->getListLink('trash'); // $url . "&view=trash";
44
 
45
+ if ($view->listView == 'trash')
46
  {
47
  $all_line = "<strong><a href='$url'>" . __('All', 'maxbuttons') . "</strong></a>";
48
  $trash_line = __("Trash", "maxbuttons");
53
  $trash_line = "<a href='$trash_url'>" . __("Trash","maxbuttons") . "</strong></a>";
54
  }
55
  ?>
56
+ <?php echo $all_line ?><span class="count"> (<?php echo $view->published_buttons_count ?>)</span>
57
 
58
+ <?php if ($view->trashed_buttons_count > 0) { ?>
59
  <span class="separator">|</span>
60
+ <?php echo $trash_line ?> <span class="count">(<?php echo $view->trashed_buttons_count ?>)</span>
61
  <?php } ?>
62
  </p>
63
  <?php
72
  <?php wp_nonce_field('button-empty-trash', 'empty-trash_nonce'); ?>
73
 
74
  <?php if (isset($page_args['paged'])) : ?>
75
+ <input type="hidden" name="paged" value="<?php echo $view->pageArgs['paged'] ?>" />
76
  <?php endif; ?>
77
 
78
+ <input type="hidden" name="view" value="<?php echo $view->listView ?>" />
79
  <?php wp_nonce_field("mb-list","mb-list-nonce"); ?>
80
 
81
  <select name="bulk-action-select" id="bulk-action-select">
82
  <option value=""><?php _e('Bulk Actions', 'maxbuttons') ?></option>
83
+ <?php if ($view->listView == 'all'): ?>
84
 
85
  <option value="trash"><?php _e('Move to Trash', 'maxbuttons') ?></option>
86
  <?php endif;
87
+ if ($view->listView == 'trash'): ?>
88
  <option value="restore"><?php _e('Restore', 'maxbuttons') ?></option>
89
  <option value="delete"><?php _e('Delete Permanently', 'maxbuttons') ?></option>
90
  <?php endif; ?>
91
  </select>
92
  <input type="submit" class="button" value="<?php _e('Apply', 'maxbuttons') ?>" />
93
 
94
+ <?php if ($view->listView == 'trash'): ?>
95
  <button type="button" class='button alignright' value='empty-trash' data-buttonaction='empty-trash' data-confirm="<?php _e('Permanently delete all buttons in trash. Are you sure?', 'maxbuttons-pro') ?>"><?php _e('Empty Trash', 'maxbuttons'); ?></button>
96
  <?php endif; ?>
97
+ <?php do_action("mb-display-pagination", $view->pageArgs, 'top'); ?>
98
 
99
 
100
 
101
  <?php // Sorting
102
+ $link_order = ($view->pageArgs['order'] == "DESC") ? "ASC" : 'DESC';
 
 
103
 
104
  $name_sort_url = add_query_arg(array(
105
  "orderby" => "name",
110
  "order" => $link_order
111
  ));
112
 
113
+ $sort_arrow = ( strtolower($view->pageArgs["order"]) == 'desc') ? 'dashicons-arrow-down' : 'dashicons-arrow-up'
114
  ?>
115
 
116
  <div class="button-list preview-buttons">
120
  <span class='col col_button'>
121
  <a href="<?php echo $id_sort_url ?>">
122
  <?php _e('Button', 'maxbuttons') ?>
123
+ <?php if ($view->pageArgs["orderby"] == 'id')
124
  echo "<span class='dashicons $sort_arrow'></span>";
125
  ?>
126
  </a>
128
  <span class="col col_name manage-column column-name sortable <?php echo strtolower($link_order) ?>">
129
  <a href="<?php echo $name_sort_url ?>">
130
  <span><?php _e('Name and Description', 'maxbuttons') ?></span>
131
+ <?php if ($view->pageArgs["orderby"] == 'name')
132
  echo "<span class='dashicons $sort_arrow'></span>";
133
  ?>
134
 
138
  </div> <!-- heading -->
139
 
140
  <?php
141
+ foreach ($view->published_buttons as $b):
142
  $id = $b['id'];
 
 
 
 
143
 
144
+ if($view->listView == 'trash')
145
+ $this->button->set($id,'','trash');
146
+ else
147
+ $this->button->set($id);
148
  ?>
149
  <div class='button-row'>
150
  <span class="col col_check"><input type="checkbox" name="button-id[]" id="button-id-<?php echo $id ?>" value="<?php echo $id ?>" /></span>
151
  <span class="col col_button"><div class="shortcode-container">
152
  <?php
153
+ $this->button->display( array("mode" => "preview") );
154
  ?>
155
  </div>
156
  <div class="actions">
157
+ <?php if($view->listView == 'all') : ?>
158
+ <a href="<?php echo $this->getButtonLink($id); ?>"><?php _e('Edit', 'maxbuttons') ?></a>
159
  <span class="separator">|</span>
160
  <a href='javascript:void(0);' data-buttonaction='copy' data-buttonid="<?php echo $id ?>"><?php _e('Copy', 'maxbuttons') ?></a>
161
  <span class="separator">|</span>
162
  <a href="javascript:void(0)" data-buttonaction='trash' data-buttonid="<?php echo $id ?>"><?php _e('Move to Trash', 'maxbuttons') ?></a>
163
  <?php endif;
164
+ if ($view->listView == 'trash'):
165
  ?>
166
  <a href="javascript:void(0);" data-buttonaction='restore' data-buttonid="<?php echo $id ?>"><?php _e('Restore', 'maxbuttons') ?></a>
167
  <span class="separator">|</span>
171
 
172
 
173
  </span>
174
+ <span class="col col_name"><a class="button-name" href="<?php echo $this->getButtonLink($id); ?>"><?php echo $this->button->getName() ?></a>
175
  <br />
176
+ <p><?php echo $this->button->getDescription() ?></p>
177
  </span>
178
  <span class="col col_shortcode"> [maxbutton id="<?php echo $id ?>"] <br /><strong><?php _e('or', 'maxbuttons'); ?></strong><br />
179
+ [maxbutton name="<?php echo $this->button->getName() ?>"]
180
 
181
  <?php
182
+ if ($this->button->getUpdated(false) > 0) : ?>
183
+ <span class='last-update'>Updated <?php echo $this->button->getUpdated(); ?></span>
184
  <?php endif; ?>
185
  </span>
186
  </div>
193
 
194
  <div class=''>
195
  <?php
196
+ if (count($view->published_buttons) == 0):
197
  include('maxbuttons-welcome.php');
198
  endif;
199
  ?>
200
  </div>
201
 
202
 
203
+ <?php do_action("mb-display-pagination", $view->pageArgs, 'bottom'); ?>
204
 
205
 
206
 
209
  <?php do_action("mb-display-ads"); ?>
210
  </div>
211
 
212
+ <?php $this->mbadmin->get_footer(); ?>
includes/maxbuttons-settings.php CHANGED
@@ -6,79 +6,7 @@ defined('ABSPATH') or die('No direct access permitted');
6
 
7
  $button = MB()->getClass('button'); // To load maxfield templates
8
 
9
- if(isset($_POST['alter_charset'])) {
10
 
11
- global $maxbuttons_installed_version;
12
- global $wpdb;
13
- $table_name = maxUtils::get_table_name();
14
-
15
- $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
16
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
17
- $wpdb->query($sql);
18
- $response = 'CHARSET now utf_8 COLLATE utf8_general_ci';
19
-
20
- } else {
21
- $response = '';
22
- }
23
-
24
- if (isset($_POST["reset_cache"]))
25
- {
26
- $button = MB()->getClass('button');
27
- $button->reset_cache();
28
-
29
- }
30
-
31
- if (isset($_POST["remigrate"]))
32
- {
33
- $install = MB()->getClass("install");
34
- $install::create_database_table();
35
- $install::migrate();
36
- }
37
-
38
- if (isset($_POST["replace"]) && check_admin_referer('mb_bulk_edit', 'bulk_edit'))
39
- {
40
- $search = sanitize_text_field($_POST["search"]);
41
- $replace = sanitize_text_field($_POST["replace"]);
42
- $field = sanitize_text_field($_POST["replace_field"]);
43
-
44
- $button = MB()->getClass('button');
45
-
46
- if ($field == '')
47
- exit("FATAL");
48
-
49
- $admin = MB()->getClass('admin');
50
- $buttonsIDS = $admin->getButtons(array('limit' => -1));
51
-
52
- $data_found = false;
53
-
54
- foreach($buttonsIDS as $row)
55
- {
56
- $button_id = $row["id"];
57
- $button->set($button_id);
58
- $data = $button->get();
59
- foreach($data as $block => $fields)
60
- {
61
- if (isset($fields[$field]))
62
- {
63
- $value = $fields[$field];
64
- $data[$block][$field] = str_replace($search, $replace, $value);
65
- $button->update($data);
66
-
67
- $data_found = true;
68
- continue;
69
- }
70
-
71
- if ($data_found)
72
- {
73
- $data_found = false;
74
- continue;
75
- }
76
- }
77
-
78
-
79
- }
80
-
81
- }
82
 
83
  ?>
84
  <?php
@@ -254,7 +182,7 @@ $admin->get_header(array("tabs_active" => true, "title" => $page_title) );
254
  <h3><?php _e('The button below should help fix the "foreign character issue" some people experience when using MaxButtons. If you use foreign characters in your buttons and after saving see ????, use this button.', 'maxbuttons') ?></h3>
255
 
256
  <form action="" method="POST">
257
- <input type="submit" name="alter_charset" class="button-primary" value="<?php _e('Change MaxButtons Table To UTF8', 'maxbuttons') ?>" /> <?php echo $response; ?>
258
  </form>
259
 
260
 
6
 
7
  $button = MB()->getClass('button'); // To load maxfield templates
8
 
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  ?>
12
  <?php
182
  <h3><?php _e('The button below should help fix the "foreign character issue" some people experience when using MaxButtons. If you use foreign characters in your buttons and after saving see ????, use this button.', 'maxbuttons') ?></h3>
183
 
184
  <form action="" method="POST">
185
+ <input type="submit" name="alter_charset" class="button-primary" value="<?php _e('Change MaxButtons Table To UTF8', 'maxbuttons') ?>" /> <?php echo $view->response; ?>
186
  </form>
187
 
188
 
includes/maxbuttons-support.php CHANGED
@@ -2,120 +2,14 @@
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
- $theme = wp_get_theme();
6
- $browser = maxbuttons_get_browser();
7
-
8
 
9
  function maxbuttons_system_label($label, $value, $spaces_between) {
10
  $output = "<label>$label</label>";
11
  return "<div class='info'>" . $output . trim($value) . "</div>" ;
12
  }
13
 
14
- // http://www.php.net/manual/en/function.get-browser.php#101125.
15
- // Cleaned up a bit, but overall it's the same.
16
- function maxbuttons_get_browser() {
17
- $user_agent = $_SERVER['HTTP_USER_AGENT'];
18
- $browser_name = 'Unknown';
19
- $platform = 'Unknown';
20
- $version= "";
21
-
22
- // First get the platform
23
- if (preg_match('/linux/i', $user_agent)) {
24
- $platform = 'Linux';
25
- }
26
- elseif (preg_match('/macintosh|mac os x/i', $user_agent)) {
27
- $platform = 'Mac';
28
- }
29
- elseif (preg_match('/windows|win32/i', $user_agent)) {
30
- $platform = 'Windows';
31
- }
32
-
33
- // Next get the name of the user agent yes seperately and for good reason
34
- if (preg_match('/MSIE/i', $user_agent) && !preg_match('/Opera/i', $user_agent)) {
35
- $browser_name = 'Internet Explorer';
36
- $browser_name_short = "MSIE";
37
- }
38
- elseif (preg_match('/Firefox/i', $user_agent)) {
39
- $browser_name = 'Mozilla Firefox';
40
- $browser_name_short = "Firefox";
41
- }
42
- elseif (preg_match('/Chrome/i', $user_agent)) {
43
- $browser_name = 'Google Chrome';
44
- $browser_name_short = "Chrome";
45
- }
46
- elseif (preg_match('/Safari/i', $user_agent)) {
47
- $browser_name = 'Apple Safari';
48
- $browser_name_short = "Safari";
49
- }
50
- elseif (preg_match('/Opera/i', $user_agent)) {
51
- $browser_name = 'Opera';
52
- $browser_name_short = "Opera";
53
- }
54
- elseif (preg_match('/Netscape/i', $user_agent)) {
55
- $browser_name = 'Netscape';
56
- $browser_name_short = "Netscape";
57
- }
58
-
59
- // Finally get the correct version number
60
- $known = array('Version', $browser_name_short, 'other');
61
- $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
62
- if (!preg_match_all($pattern, $user_agent, $matches)) {
63
- // We have no matching number just continue
64
- }
65
-
66
- // See how many we have
67
- $i = count($matches['browser']);
68
- if ($i != 1) {
69
- // We will have two since we are not using 'other' argument yet
70
- // See if version is before or after the name
71
- if (strripos($user_agent, "Version") < strripos($user_agent, $browser_name_short)){
72
- $version= $matches['version'][0];
73
- }
74
- else {
75
- $version= $matches['version'][1];
76
- }
77
- }
78
- else {
79
- $version= $matches['version'][0];
80
- }
81
-
82
- // Check if we have a number
83
- if ($version == null || $version == "") { $version = "?"; }
84
-
85
- return array(
86
- 'user_agent' => $user_agent,
87
- 'name' => $browser_name,
88
- 'version' => $version,
89
- 'platform' => $platform,
90
- 'pattern' => $pattern
91
- );
92
- }
93
-
94
- function check_charset() {
95
- global $maxbuttons_installed_version;
96
- global $wpdb;
97
- $check = "SHOW FULL COLUMNS FROM " . maxUtils::get_table_name();
98
- $charset = $wpdb->query($check);
99
- return $charset;
100
- }
101
- if(isset($_POST['alter_charset'])) {
102
- $kludge = 'altering table to be utf-8';
103
- global $maxbuttons_installed_version;
104
- global $wpdb;
105
- $table_name = maxUtils::get_table_name();
106
- $kludge = $table_name;
107
- // IMPORTANT: There MUST be two spaces between the PRIMARY KEY keywords
108
- // and the column name, and the column name MUST be in parenthesis.
109
- $sql = "ALTER TABLE " . $table_name . " CONVERT TO CHARACTER SET utf8";
110
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
111
- $wpdb->query($wpdb->prepare($sql));
112
- } else {
113
- $kludge = 'Not yet enabled';
114
- }
115
-
116
- $charr = check_charset();
117
-
118
-
119
  ?>
120
  <?php
121
  $support_link = apply_filters("mb-support-link", 'http://wordpress.org/support/plugin/maxbuttons');
@@ -137,8 +31,6 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
137
 
138
  <h4><?php _e('You may be asked to provide the information below to help troubleshoot your issue.', 'maxbuttons') ?></h4>
139
 
140
- <form>
141
-
142
  <div class='system_info'>
143
  ----- Begin System Info ----- <br />
144
 
@@ -151,7 +43,6 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
151
  global $wpdb;
152
  $mysql_version = $wpdb->db_version();
153
 
154
-
155
  echo maxbuttons_system_label('MySQL Version:', $mysql_version, 8) ?>
156
 
157
  <?php echo maxbuttons_system_label('Web Server:', $_SERVER['SERVER_SOFTWARE'], 11) ?>
@@ -172,26 +63,26 @@ $admin->get_header(array("title" => $page_title, "title_action" => $action) );
172
  <?php echo maxbuttons_system_label('WP_DEBUG:', defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set', 13) ?>
173
  <?php echo maxbuttons_system_label('Multi-Site Active:', is_multisite() ? 'Yes' : 'No', 4) ?>
174
 
175
- <?php echo maxbuttons_system_label('Operating System:', $browser['platform'], 5) ?>
176
- <?php echo maxbuttons_system_label('Browser:', $browser['name'] . ' ' . $browser['version'], 14) ?>
177
- <?php echo maxbuttons_system_label('User Agent:', $browser['user_agent'], 11) ?>
178
 
179
  Active Theme:
180
- <?php echo maxbuttons_system_label('-', $theme->get('Name') . ' ' . $theme->get('Version'), 1) ?>
181
- <?php echo maxbuttons_system_label('', $theme->get('ThemeURI'), 2) ?>
182
 
183
  Active Plugins:
184
  <?php
185
- $plugins = get_plugins();
186
- $active_plugins = get_option('active_plugins', array());
187
 
188
- foreach ($plugins as $plugin_path => $plugin) {
189
  // Only show active plugins
190
- if (in_array($plugin_path, $active_plugins)) {
191
  echo maxbuttons_system_label('-', $plugin['Name'] . ' ' . $plugin['Version'], 1);
192
 
193
- if (isset($plugin['PluginURI'])) {
194
- echo maxbuttons_system_label('', $plugin['PluginURI'], 2);
195
  }
196
 
197
  echo "\n";
@@ -200,7 +91,6 @@ foreach ($plugins as $plugin_path => $plugin) {
200
  ?>
201
  ----- End System Info -----
202
  </div>
203
- </form>
204
  </div>
205
  <div class="ad-wrap">
206
  <?php do_action("mb-display-ads"); ?>
2
  namespace MaxButtons;
3
  defined('ABSPATH') or die('No direct access permitted');
4
 
5
+ //$theme = wp_get_theme();
6
+ //$browser = maxbuttons_get_browser();
 
7
 
8
  function maxbuttons_system_label($label, $value, $spaces_between) {
9
  $output = "<label>$label</label>";
10
  return "<div class='info'>" . $output . trim($value) . "</div>" ;
11
  }
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ?>
14
  <?php
15
  $support_link = apply_filters("mb-support-link", 'http://wordpress.org/support/plugin/maxbuttons');
31
 
32
  <h4><?php _e('You may be asked to provide the information below to help troubleshoot your issue.', 'maxbuttons') ?></h4>
33
 
 
 
34
  <div class='system_info'>
35
  ----- Begin System Info ----- <br />
36
 
43
  global $wpdb;
44
  $mysql_version = $wpdb->db_version();
45
 
 
46
  echo maxbuttons_system_label('MySQL Version:', $mysql_version, 8) ?>
47
 
48
  <?php echo maxbuttons_system_label('Web Server:', $_SERVER['SERVER_SOFTWARE'], 11) ?>
63
  <?php echo maxbuttons_system_label('WP_DEBUG:', defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set', 13) ?>
64
  <?php echo maxbuttons_system_label('Multi-Site Active:', is_multisite() ? 'Yes' : 'No', 4) ?>
65
 
66
+ <?php echo maxbuttons_system_label('Operating System:', $view->browser['platform'], 5) ?>
67
+ <?php echo maxbuttons_system_label('Browser:', $view->browser['name'] . ' ' . $view->browser['version'], 14) ?>
68
+ <?php echo maxbuttons_system_label('User Agent:', $view->browser['user_agent'], 11) ?>
69
 
70
  Active Theme:
71
+ <?php echo maxbuttons_system_label('-', $view->theme->get('Name') . ' ' . $view->theme->get('Version'), 1) ?>
72
+ <?php echo maxbuttons_system_label('', $view->theme->get('ThemeURI'), 2) ?>
73
 
74
  Active Plugins:
75
  <?php
76
+ //$plugins = get_plugins();
77
+ //$active_plugins = get_option('active_plugins', array());
78
 
79
+ foreach ($view->plugins as $plugin_path => $plugin) {
80
  // Only show active plugins
81
+ if (in_array($plugin_path, $view->active_plugins)) {
82
  echo maxbuttons_system_label('-', $plugin['Name'] . ' ' . $plugin['Version'], 1);
83
 
84
+ if (isset($view->plugin['PluginURI'])) {
85
+ echo maxbuttons_system_label('', $view->plugin['PluginURI'], 2);
86
  }
87
 
88
  echo "\n";
91
  ?>
92
  ----- End System Info -----
93
  </div>
 
94
  </div>
95
  <div class="ad-wrap">
96
  <?php do_action("mb-display-ads"); ?>
includes/maxbuttons-welcome.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  <h3><?php _e('Welcome to MaxButtons!','maxbuttons'); ?></h3>
6
 
7
- <p class='started'><?php printf(__('To get you started, %s Create your first button %s' ,'maxbuttons'), '<a href="' . admin_url() . 'admin.php?page=maxbuttons-controller&action=edit&firstbutton=true" class="button-primary">', '</a>'); ?></a></p>
8
 
9
 
10
  <p><?php _e('Some links that may be helpful:','maxbuttons') ?></p>
4
 
5
  <h3><?php _e('Welcome to MaxButtons!','maxbuttons'); ?></h3>
6
 
7
+ <p class='started'><?php printf(__('To get you started, %s Create your first button %s' ,'maxbuttons'), '<a href="' . $this->getButtonLink(0, array('firstbutton' => true) ) . '" class="button-primary">', '</a>'); ?></a></p>
8
 
9
 
10
  <p><?php _e('Some links that may be helpful:','maxbuttons') ?></p>
js/maxbuttons-admin.js CHANGED
@@ -17,7 +17,7 @@ maxAdmin.prototype.init = function () {
17
 
18
  this.button_id = $('input[name="button_id"]').val();
19
  // Prevents the output button from being clickable (also in admin list view )
20
- $(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); });
21
  $(document).on('click', '.output .preview-toggle', $.proxy(this.toggle_preview, this));
22
 
23
  // overview input paging
@@ -234,6 +234,8 @@ maxAdmin.prototype.button_action = function(e)
234
  }
235
 
236
  var button_id = $(e.target).data('buttonid');
 
 
237
  var nonce = $('input[name="' + action + '_nonce"]').val();
238
  var paged = $('input[name="paged"]').val();
239
 
17
 
18
  this.button_id = $('input[name="button_id"]').val();
19
  // Prevents the output button from being clickable (also in admin list view )
20
+ $(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); e.stopPropagation(); });
21
  $(document).on('click', '.output .preview-toggle', $.proxy(this.toggle_preview, this));
22
 
23
  // overview input paging
234
  }
235
 
236
  var button_id = $(e.target).data('buttonid');
237
+ console.log(e.target);
238
+ console.log(button_id);
239
  var nonce = $('input[name="' + action + '_nonce"]').val();
240
  var paged = $('input[name="paged"]').val();
241
 
js/min/maxbuttons-admin.js CHANGED
@@ -1 +1 @@
1
- function maxAdmin(){}var $=jQuery;maxAdmin.prototype={colorUpdateTime:!0,colorPalettes:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("click","[data-buttonaction]",$.proxy(this.button_action,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),$(document).on("change, input",'input[type="range"]',$.proxy(this.updateRange,this)),this.updateRange(null),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$("#maxbuttons .color-field").alphaColorPicker({width:300,palettes:this.colorPalettes,changeFunc:$.proxy(_.throttle(function(t,e){t.preventDefault();var a=e.color.toString();this.update_color(t,e,a)},200),this)}),$(".iris-picker-inner .iris-square-value").removeAttr("href"),$(document).on("click",".iris-picker-inner .iris-square-value",function(t){return t.preventDefault(),t.stopPropagation(),!1}),$(".input.mbcolor .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("#maxbuttons input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("#maxbuttons input.color-field").on("focus",$.proxy(this.select_field,this)),$("#maxbuttons select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxajax.leave_page},this)),$(document).on("keyup","input",function(t){if(t.keyCode&&13==t.keyCode)return $(":input")[$(":input").index(document.activeElement)+1].focus(),!1}),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode),$("#url_button").on("click",$.proxy(this.openURLDialog,this)),$(".block_sidebar .open_control").on("click",this.toggleSidebar))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(t){t.preventDefault(),this.saveIndicator(!0);var e=$(t.target),a=$(e).data("field");if(void 0===a)o=$(e).attr("id");else var o=a;var n=this.fields[o],i=null;if(void 0!==n&&(void 0!==n.css&&(value=e.val(),void 0!==n.css_unit&&-1==value.indexOf(n.css_unit)&&(value+=n.css_unit),e.is(":checkbox")&&!e.is(":checked")&&(value=""),void 0!==n.pseudo&&(i=n.pseudo),this.putCSS(n,value,i)),void 0!==n.attr&&$(".output .result").find("a").attr(n.attr,e.val()),void 0!==n.func)){var r=n.func;r.indexOf(".")<0?r="self."+r+"(target)":r+="(target)";try{new Function("target","self",r)(e,this)}catch(t){console.error(t)}}},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.button_action=function(t){t.preventDefault();var e=$(t.target).data("buttonaction"),a=$(t.target).data("confirm");if(this.form_updated=!1,void 0!==a){if(!window.confirm(a))return}var o=$(t.target).data("buttonid"),n=$('input[name="'+e+'_nonce"]').val(),i=$('input[name="paged"]').val(),r=maxajax.ajax_url,s={action:"mb_button_action",button_action:e,button_id:o,nonce:n};void 0!==i&&(s.paged=i),$.post({url:r,data:s,success:function(t){response=JSON.parse(t),void 0!==response.redirection&&(window.location=response.redirection)},error:function(){console.error("error in button action"+e)}})},maxAdmin.prototype.checkCopyModal=function(t){this.form_updated?t.currentModal.find(".mb-message").show():$(t.currentModal).find(".mb-message").hide()},maxAdmin.prototype.toggle_preview=function(t){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,e,a){var o=".maxbutton";if("hover"==(a=a||"both")?o="a.hover ":"normal"==a&&(o="a.normal "),void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=o+" ."+n[i];$(".output .result").find(r).css(t.css,e)}}else $(".output .result").find(o).css(t.css,e)},maxAdmin.prototype.update_color=function(t,a,o){t.preventDefault(),this.saveIndicator(!0);var n=$(t.target);console.log("update_color :: "+o),-1===o.indexOf("#")&&o.indexOf("rgba")<0&&(o="#"+o,$("#"+i).val(o));var i=n.attr("id");if(""==$(n).val()?($(n).parents(".mbcolor").find(".wp-color-result").children(".the_color").css("background-image","url("+maxadmin_settings.icon_transparent+")"),void 0!==t.type&&"change"==t.type&&this.update_color(e,null,"rgba(0,0,0,0)")):$(n).parents(".mbcolor").find(".wp-color-result").children(".the_color").css("background-image","none"),-1!==i.indexOf("box_shadow"))this.updateBoxShadow(n);else if(-1!==i.indexOf("text_shadow"))this.updateTextShadow(n);else if(-1!==i.indexOf("gradient"))-1==i.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=i){var r=this.fields[i],s="normal";return void 0!==r.pseudo&&(s=r.pseudo),void this.putCSS(r,o,s)}o.indexOf("rgba"),$(".output .result").css("backgroundColor",o)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var e=$(t.target),a=$(t.target).parents("[data-bind]"),o="#"+a.data("id"),n="#"+a.data("bind");if(e.hasClass("arrow-right"))i="right";else var i="left";if(a.hasClass("right"))r="left";else var r="right";"left"==r?copy="right"==i:"right"==r&&(copy="right"!=i),copy?($(n).val($(o).val()),$(n).trigger("change"),$(n).wpColorPicker("color",$(o).val())):($(o).val($(n).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(n).val()))},maxAdmin.prototype.updateGradient=function(t){var e="";(t=t||!1)&&(e="_hover");var a=parseInt($("#gradient_stop").val());isNaN(a)&&(a=45);var o=$("#use_gradient").prop("checked"),n=$("#gradient_start_color"+e).val(),i=$("#gradient_end_color"+e).val();""==n&&(n="rgba(0,0,0,0)"),""==i&&(i="rgba(0,0,0,0)");var r=this.hexToRgb(n),s=this.hexToRgb(i),d=parseInt($("#gradient_start_opacity"+e).val()),l=parseInt($("#gradient_end_opacity"+e).val());if(o||(s=r,l=d),isNaN(d)&&(d=100),isNaN(l)&&(l=100),t)p=$(".output .result").find("a.hover");else var p=$(".output .result").find("a.normal");if(r.indexOf("rgba")<0)c="rgba("+r+","+d/100+") ";else var c=r;if(s.indexOf("rgba")<0)u="rgba("+s+","+l/100+") ";else var u=s;console.log(r.indexOf("rgba")+" "+r+" "+c+" "+u),p.css("background","linear-gradient("+c+a+"%,"+u+")")},maxAdmin.prototype.hexToRgb=function(t){if(t.indexOf("rgba")>=0)return t;t=t.replace("#","");var e=parseInt(t,16);return(e>>16&255)+","+(e>>8&255)+","+(255&e)},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var e=$("#box_shadow_offset_left").val(),a=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),n=$("#box_shadow_spread").val(),i=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();""==i&&(i="rgba(0,0,0,0)"),""==r&&(r="rgba(0,0,0,0)"),$(".output .result").find("a.normal").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+i),$(".output .result").find("a.hover").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,e){e=e||!1;var a=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),n=$("#text_shadow_width").val(),i=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),s=$(t).attr("id"),d=this.fields[s];d.css="textShadow",""==i&&(i="rgba(0,0,0,0)"),""==r&&(r="rgba(0,0,0,0)");var l=a+"px "+o+"px "+n+"px "+i;this.putCSS(d,l,"normal"),l=a+"px "+o+"px "+n+"px "+r,this.putCSS(d,l,"hover")},maxAdmin.prototype.updateAnchorText=function(t){0===$(".output .result").find("a .mb-text").length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(t){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var e=$(t).val(),a=$(t).attr("id"),o=this.fields[a];e>0?this.putCSS(o,e):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var e=t.val(),a=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<a.length;i++){o=a[i];$("#"+o).val(e);n=this.fields[o];this.putCSS(n,e+"px")}else{var e=$(t).val(),o=$(t).attr("id"),n=this.fields[o];this.putCSS(n,e)}},maxAdmin.prototype.toggleRadiusLock=function(t){var e=$(t.target),a=$(e).data("lock");"lock"==a?($(e).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(e).data("lock","unlock")):"unlock"==a&&($(e).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(e).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive,window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var e=parseInt($(t.target).val());if(e<=parseInt($(t.target).attr("max"))){var a=$(t.target).data("url");window.location=a+"&paged="+e}},maxAdmin.prototype.toggleShortcode=function(t){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var e=$(t.target),a=e.data("target"),o=$('.manual-entry[data-manual="'+a+'"]');if(o.is(":visible"))return o.hide(),!0;var n=e.parents(".option-container");o.css("top","0px"),o.css("right","-25%"),o.prependTo(n),o.show()},maxAdmin.prototype.resetConditionals=function(){$("[data-show], [data-has]").each(function(){var t=$(this).data("show");if(void 0===t&&(t=$(this).data("has")),void 0!==t){var e=t.target;$(document).off("change",'[name="'+e+'"]')}else console.error($(this)+"has a improperly set conditional")})},maxAdmin.prototype.initConditionials=function(){var t=this;this.resetConditionals(),$("[data-show]").each(function(){var e=$(this).data("show"),a=e.target,o=e.values;$(document).on("change",'[name="'+a+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+a+'"]').length>1?$('[name="'+a+'"]:checked').trigger("change",["conditional"]):$('[name="'+a+'"]').trigger("change",["conditional"])});var e=[];$("[data-has]").each(function(){var a=$(this).data("has"),o=a.target,n=a.values;$('[name="'+o+'"]').on("change",{target:o,child:this,values:n},$.proxy(t.updateHasConditional,t));var i='[name="'+o+'"]';$.inArray(i,e),e.push(i)}),e.length>0&&$(e.toString()).first().trigger("change",["conditional"])},maxAdmin.prototype.updateConditional=function(t){var e=t.data,a=e.values,o=e.child,n=$(t.currentTarget),i=$(n).val();if("checkbox"===n.attr("type")){var r=$(n).prop("checked");i="checked"==a&&r?"checked":"unchecked"!=a||r?0:"unchecked"}a.indexOf(i)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.updateHasConditional=function(t){var e=t.data,a=e.values,o=e.child,n=e.target,i=[];$(a).each(function(t){i.push("[value="+this+"]")}),$('[name="'+n+'"]').filter(i.toString()).length>0?$(o).fadeIn("fast"):$(o).fadeOut("fast")},maxAdmin.prototype.updateRange=function(t){if(void 0===t||null===t)e=$('input[type="range"]');else var e=[t.target];$(e).each(function(){var t=$(this).val();$(this).parents(".input").find(".range_value output").val(t+"%")})},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=!!t},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var e=mb_ajax.ajaxurl,a=$(t.target).serialize();$.ajax({type:"POST",url:e,data:a}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var e=$.parseJSON(t),a=e.result,o=e.title,n=e.data.id;if(void 0!==e.data.new_nonce){e.data.new_nonce;$('input[name="nonce"]').val(e.data.new_nonce)}if(a){$('input[name="collection_id"]').val(n);var i=window.location.href;-1===i.indexOf("collection_id")&&window.history.replaceState({},"",i+"&collection_id="+n),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),e.data.reload&&document.location.reload(!0)}a||($modal=window.maxFoundry.maxModal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(e.body),$modal.setControls('<button class="modal_close button-primary">'+e.close_text+"</button>"),$modal.show())},maxAdmin.prototype.openURLDialog=function(t){return window.wpActiveEditor="url",wpLink.open(),$("#link-options").hide(),$(".query-results").css("top","70px"),$("#wp-link-submit").off("click keyup change"),$("#wp-link-submit").on("click",$.proxy(this.updateLink,this)),!1},maxAdmin.prototype.updateLink=function(t){t.preventDefault();var e=$("#wp-link-url").val(),a=maxadmin_settings.homeurl;return e=e.replace(a,""),$("#url").val(e),wpLink.close(),!1},maxAdmin.prototype.toggleSidebar=function(t){var e=t.target,a=$(e).parents(".block_sidebar");a.hasClass("active")?a.removeClass("active"):a.addClass("active")};
1
+ function maxAdmin(){}var $=jQuery;maxAdmin.prototype={colorUpdateTime:!0,colorPalettes:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault(),t.stopPropagation()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("click","[data-buttonaction]",$.proxy(this.button_action,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),$(document).on("change, input",'input[type="range"]',$.proxy(this.updateRange,this)),this.updateRange(null),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$("#maxbuttons .color-field").alphaColorPicker({width:300,palettes:this.colorPalettes,changeFunc:$.proxy(_.throttle(function(t,e){t.preventDefault();var a=e.color.toString();this.update_color(t,e,a)},200),this)}),$(".iris-picker-inner .iris-square-value").removeAttr("href"),$(document).on("click",".iris-picker-inner .iris-square-value",function(t){return t.preventDefault(),t.stopPropagation(),!1}),$(".input.mbcolor .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("#maxbuttons input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("#maxbuttons input.color-field").on("focus",$.proxy(this.select_field,this)),$("#maxbuttons select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxajax.leave_page},this)),$(document).on("keyup","input",function(t){if(t.keyCode&&13==t.keyCode)return $(":input")[$(":input").index(document.activeElement)+1].focus(),!1}),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode),$("#url_button").on("click",$.proxy(this.openURLDialog,this)),$(".block_sidebar .open_control").on("click",this.toggleSidebar))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(t){t.preventDefault(),this.saveIndicator(!0);var e=$(t.target),a=$(e).data("field");if(void 0===a)o=$(e).attr("id");else var o=a;var n=this.fields[o],i=null;if(void 0!==n&&(void 0!==n.css&&(value=e.val(),void 0!==n.css_unit&&-1==value.indexOf(n.css_unit)&&(value+=n.css_unit),e.is(":checkbox")&&!e.is(":checked")&&(value=""),void 0!==n.pseudo&&(i=n.pseudo),this.putCSS(n,value,i)),void 0!==n.attr&&$(".output .result").find("a").attr(n.attr,e.val()),void 0!==n.func)){var r=n.func;r.indexOf(".")<0?r="self."+r+"(target)":r+="(target)";try{new Function("target","self",r)(e,this)}catch(t){console.error(t)}}},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.button_action=function(t){t.preventDefault();var e=$(t.target).data("buttonaction"),a=$(t.target).data("confirm");if(this.form_updated=!1,void 0!==a){if(!window.confirm(a))return}var o=$(t.target).data("buttonid");console.log(t.target),console.log(o);var n=$('input[name="'+e+'_nonce"]').val(),i=$('input[name="paged"]').val(),r=maxajax.ajax_url,s={action:"mb_button_action",button_action:e,button_id:o,nonce:n};void 0!==i&&(s.paged=i),$.post({url:r,data:s,success:function(t){response=JSON.parse(t),void 0!==response.redirection&&(window.location=response.redirection)},error:function(){console.error("error in button action"+e)}})},maxAdmin.prototype.checkCopyModal=function(t){this.form_updated?t.currentModal.find(".mb-message").show():$(t.currentModal).find(".mb-message").hide()},maxAdmin.prototype.toggle_preview=function(t){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,e,a){var o=".maxbutton";if("hover"==(a=a||"both")?o="a.hover ":"normal"==a&&(o="a.normal "),void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=o+" ."+n[i];$(".output .result").find(r).css(t.css,e)}}else $(".output .result").find(o).css(t.css,e)},maxAdmin.prototype.update_color=function(t,a,o){t.preventDefault(),this.saveIndicator(!0);var n=$(t.target);console.log("update_color :: "+o),-1===o.indexOf("#")&&o.indexOf("rgba")<0&&(o="#"+o,$("#"+i).val(o));var i=n.attr("id");if(""==$(n).val()?($(n).parents(".mbcolor").find(".wp-color-result").children(".the_color").css("background-image","url("+maxadmin_settings.icon_transparent+")"),void 0!==t.type&&"change"==t.type&&this.update_color(e,null,"rgba(0,0,0,0)")):$(n).parents(".mbcolor").find(".wp-color-result").children(".the_color").css("background-image","none"),-1!==i.indexOf("box_shadow"))this.updateBoxShadow(n);else if(-1!==i.indexOf("text_shadow"))this.updateTextShadow(n);else if(-1!==i.indexOf("gradient"))-1==i.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=i){var r=this.fields[i],s="normal";return void 0!==r.pseudo&&(s=r.pseudo),void this.putCSS(r,o,s)}o.indexOf("rgba"),$(".output .result").css("backgroundColor",o)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var e=$(t.target),a=$(t.target).parents("[data-bind]"),o="#"+a.data("id"),n="#"+a.data("bind");if(e.hasClass("arrow-right"))i="right";else var i="left";if(a.hasClass("right"))r="left";else var r="right";"left"==r?copy="right"==i:"right"==r&&(copy="right"!=i),copy?($(n).val($(o).val()),$(n).trigger("change"),$(n).wpColorPicker("color",$(o).val())):($(o).val($(n).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(n).val()))},maxAdmin.prototype.updateGradient=function(t){var e="";(t=t||!1)&&(e="_hover");var a=parseInt($("#gradient_stop").val());isNaN(a)&&(a=45);var o=$("#use_gradient").prop("checked"),n=$("#gradient_start_color"+e).val(),i=$("#gradient_end_color"+e).val();""==n&&(n="rgba(0,0,0,0)"),""==i&&(i="rgba(0,0,0,0)");var r=this.hexToRgb(n),s=this.hexToRgb(i),d=parseInt($("#gradient_start_opacity"+e).val()),l=parseInt($("#gradient_end_opacity"+e).val());if(o||(s=r,l=d),isNaN(d)&&(d=100),isNaN(l)&&(l=100),t)p=$(".output .result").find("a.hover");else var p=$(".output .result").find("a.normal");if(r.indexOf("rgba")<0)c="rgba("+r+","+d/100+") ";else var c=r;if(s.indexOf("rgba")<0)u="rgba("+s+","+l/100+") ";else var u=s;console.log(r.indexOf("rgba")+" "+r+" "+c+" "+u),p.css("background","linear-gradient("+c+a+"%,"+u+")")},maxAdmin.prototype.hexToRgb=function(t){if(t.indexOf("rgba")>=0)return t;t=t.replace("#","");var e=parseInt(t,16);return(e>>16&255)+","+(e>>8&255)+","+(255&e)},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var e=$("#box_shadow_offset_left").val(),a=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),n=$("#box_shadow_spread").val(),i=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();""==i&&(i="rgba(0,0,0,0)"),""==r&&(r="rgba(0,0,0,0)"),$(".output .result").find("a.normal").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+i),$(".output .result").find("a.hover").css("boxShadow",e+"px "+a+"px "+o+"px "+n+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,e){e=e||!1;var a=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),n=$("#text_shadow_width").val(),i=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),s=$(t).attr("id"),d=this.fields[s];d.css="textShadow",""==i&&(i="rgba(0,0,0,0)"),""==r&&(r="rgba(0,0,0,0)");var l=a+"px "+o+"px "+n+"px "+i;this.putCSS(d,l,"normal"),l=a+"px "+o+"px "+n+"px "+r,this.putCSS(d,l,"hover")},maxAdmin.prototype.updateAnchorText=function(t){0===$(".output .result").find("a .mb-text").length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(t){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var e=$(t).val(),a=$(t).attr("id"),o=this.fields[a];e>0?this.putCSS(o,e):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var e=t.val(),a=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<a.length;i++){o=a[i];$("#"+o).val(e);n=this.fields[o];this.putCSS(n,e+"px")}else{var e=$(t).val(),o=$(t).attr("id"),n=this.fields[o];this.putCSS(n,e)}},maxAdmin.prototype.toggleRadiusLock=function(t){var e=$(t.target),a=$(e).data("lock");"lock"==a?($(e).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(e).data("lock","unlock")):"unlock"==a&&($(e).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(e).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive,window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var e=parseInt($(t.target).val());if(e<=parseInt($(t.target).attr("max"))){var a=$(t.target).data("url");window.location=a+"&paged="+e}},maxAdmin.prototype.toggleShortcode=function(t){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var e=$(t.target),a=e.data("target"),o=$('.manual-entry[data-manual="'+a+'"]');if(o.is(":visible"))return o.hide(),!0;var n=e.parents(".option-container");o.css("top","0px"),o.css("right","-25%"),o.prependTo(n),o.show()},maxAdmin.prototype.resetConditionals=function(){$("[data-show], [data-has]").each(function(){var t=$(this).data("show");if(void 0===t&&(t=$(this).data("has")),void 0!==t){var e=t.target;$(document).off("change",'[name="'+e+'"]')}else console.error($(this)+"has a improperly set conditional")})},maxAdmin.prototype.initConditionials=function(){var t=this;this.resetConditionals(),$("[data-show]").each(function(){var e=$(this).data("show"),a=e.target,o=e.values;$(document).on("change",'[name="'+a+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+a+'"]').length>1?$('[name="'+a+'"]:checked').trigger("change",["conditional"]):$('[name="'+a+'"]').trigger("change",["conditional"])});var e=[];$("[data-has]").each(function(){var a=$(this).data("has"),o=a.target,n=a.values;$('[name="'+o+'"]').on("change",{target:o,child:this,values:n},$.proxy(t.updateHasConditional,t));var i='[name="'+o+'"]';$.inArray(i,e),e.push(i)}),e.length>0&&$(e.toString()).first().trigger("change",["conditional"])},maxAdmin.prototype.updateConditional=function(t){var e=t.data,a=e.values,o=e.child,n=$(t.currentTarget),i=$(n).val();if("checkbox"===n.attr("type")){var r=$(n).prop("checked");i="checked"==a&&r?"checked":"unchecked"!=a||r?0:"unchecked"}a.indexOf(i)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.updateHasConditional=function(t){var e=t.data,a=e.values,o=e.child,n=e.target,i=[];$(a).each(function(t){i.push("[value="+this+"]")}),$('[name="'+n+'"]').filter(i.toString()).length>0?$(o).fadeIn("fast"):$(o).fadeOut("fast")},maxAdmin.prototype.updateRange=function(t){if(void 0===t||null===t)e=$('input[type="range"]');else var e=[t.target];$(e).each(function(){var t=$(this).val();$(this).parents(".input").find(".range_value output").val(t+"%")})},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=!!t},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var e=mb_ajax.ajaxurl,a=$(t.target).serialize();$.ajax({type:"POST",url:e,data:a}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var e=$.parseJSON(t),a=e.result,o=e.title,n=e.data.id;if(void 0!==e.data.new_nonce){e.data.new_nonce;$('input[name="nonce"]').val(e.data.new_nonce)}if(a){$('input[name="collection_id"]').val(n);var i=window.location.href;-1===i.indexOf("collection_id")&&window.history.replaceState({},"",i+"&collection_id="+n),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),e.data.reload&&document.location.reload(!0)}a||($modal=window.maxFoundry.maxModal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(e.body),$modal.setControls('<button class="modal_close button-primary">'+e.close_text+"</button>"),$modal.show())},maxAdmin.prototype.openURLDialog=function(t){return window.wpActiveEditor="url",wpLink.open(),$("#link-options").hide(),$(".query-results").css("top","70px"),$("#wp-link-submit").off("click keyup change"),$("#wp-link-submit").on("click",$.proxy(this.updateLink,this)),!1},maxAdmin.prototype.updateLink=function(t){t.preventDefault();var e=$("#wp-link-url").val(),a=maxadmin_settings.homeurl;return e=e.replace(a,""),$("#url").val(e),wpLink.close(),!1},maxAdmin.prototype.toggleSidebar=function(t){var e=t.target,a=$(e).parents(".block_sidebar");a.hasClass("active")?a.removeClass("active"):a.addClass("active")};
maxbuttons.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MaxButtons
4
  Plugin URI: http://maxbuttons.com
5
  Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
6
- Version: 7.11
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
@@ -16,10 +16,9 @@ namespace MaxButtons;
16
  if (! defined('MAXBUTTONS_ROOT_FILE'))
17
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
18
  if (! defined('MAXBUTTONS_VERSION_NUM'))
19
- define('MAXBUTTONS_VERSION_NUM', '7.11');
20
-
21
- define('MAXBUTTONS_RELEASE',"25 July 2019");
22
 
 
23
 
24
  if (! function_exists('MaxButtons\maxbutton_double_load'))
25
  {
@@ -44,7 +43,7 @@ if (function_exists("MaxButtons\MB"))
44
  require_once("classes/maxbuttons-class.php");
45
 
46
  // core
47
- require_once('classes/button.php');
48
  require_once('classes/buttons.php');
49
  require_once("classes/installation.php");
50
  require_once("classes/max-utils.php");
@@ -74,7 +73,7 @@ require_once("assets/libraries/simple-template/simple_template.php");
74
 
75
  if (! class_exists('simple_html_dom_node'))
76
  require_once("assets/libraries/simplehtmldom/simple_html_dom.php");
77
-
78
 
79
  // runtime.
80
  if (! function_exists("MaxButtons\MB")) {
@@ -84,6 +83,7 @@ if (! function_exists("MaxButtons\MB")) {
84
  }
85
  }
86
  $m = new maxButtonsPlugin();
 
87
 
88
  // Activation / deactivation
89
  register_activation_hook(__FILE__, array(maxUtils::namespaceit("maxInstall"),'activation_hook') );
3
  Plugin Name: MaxButtons
4
  Plugin URI: http://maxbuttons.com
5
  Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
6
+ Version: 7.13
7
  Author: Max Foundry
8
  Author URI: http://maxfoundry.com
9
  Text Domain: maxbuttons
16
  if (! defined('MAXBUTTONS_ROOT_FILE'))
17
  define("MAXBUTTONS_ROOT_FILE", __FILE__);
18
  if (! defined('MAXBUTTONS_VERSION_NUM'))
19
+ define('MAXBUTTONS_VERSION_NUM', '7.13');
 
 
20
 
21
+ define('MAXBUTTONS_RELEASE',"10 October 2019");
22
 
23
  if (! function_exists('MaxButtons\maxbutton_double_load'))
24
  {
43
  require_once("classes/maxbuttons-class.php");
44
 
45
  // core
46
+ /*require_once('classes/button.php');
47
  require_once('classes/buttons.php');
48
  require_once("classes/installation.php");
49
  require_once("classes/max-utils.php");
73
 
74
  if (! class_exists('simple_html_dom_node'))
75
  require_once("assets/libraries/simplehtmldom/simple_html_dom.php");
76
+ */
77
 
78
  // runtime.
79
  if (! function_exists("MaxButtons\MB")) {
83
  }
84
  }
85
  $m = new maxButtonsPlugin();
86
+ do_action('maxbuttons/plugin/init' , $m);
87
 
88
  // Activation / deactivation
89
  register_activation_hook(__FILE__, array(maxUtils::namespaceit("maxInstall"),'activation_hook') );
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: maxfoundry, basszje, arcware, johnbhartley
3
  Tags: wordpress button plugin, share button, wordpress buttons, css3 button generator, responsive buttons, css wordpress button
4
  Requires at least: 4.8
5
- Tested up to: 5.2
6
  Requires PHP: 5.6
7
- Stable tag: 7.11
8
 
9
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
10
 
@@ -255,6 +255,17 @@ Secondly, please use latin only characters for button name ( Basic settings) and
255
 
256
  == Changelog ==
257
 
 
 
 
 
 
 
 
 
 
 
 
258
  = 7.11 =
259
 
260
  * New - Support for transparency.
2
  Contributors: maxfoundry, basszje, arcware, johnbhartley
3
  Tags: wordpress button plugin, share button, wordpress buttons, css3 button generator, responsive buttons, css wordpress button
4
  Requires at least: 4.8
5
+ Tested up to: 5.2.3
6
  Requires PHP: 5.6
7
+ Stable tag: 7.13
8
 
9
  WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
10
 
255
 
256
  == Changelog ==
257
 
258
+ = 7.13 =
259
+
260
+ * Updates to code base
261
+ * Fixed - Small bug in Gutenberg regarding text fields
262
+ * Fixed - Zero-width space (Unicode Character) could disturb URL output.
263
+
264
+ = 7.12 =
265
+
266
+ * Fixed - Certain external admin notices overlapping on overview page
267
+ * Fixed - Notice button_id when during copy / restore on the overview page
268
+
269
  = 7.11 =
270
 
271
  * New - Support for transparency.