diff --git a/.vscode/settings.json b/.vscode/settings.json index 6791d545..10ae071e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "prettier.useTabs": true, "prettier.trailingComma": "all", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "[php]": { "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" diff --git a/assets/css/options.css b/assets/css/options.css deleted file mode 100644 index 6465c4b4..00000000 --- a/assets/css/options.css +++ /dev/null @@ -1,575 +0,0 @@ -@import url("https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;0,900;1,400&display=swap"); - -.qubely-options-section { - background-color: #ffffff; - padding: 30px; - background-repeat: no-repeat; - background-position: 100% 100%; -} - -.qubely-options-section-header { - border-bottom: 1px solid #ebebf1; - margin: -30px -30px 30px; - padding: 20px 30px; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.qubely-options-section-header h2, -.qubely-options-section-header h3 { - margin: 0; - line-height: 1; -} - -.qubely-options-section-header h2 { - font-size: 24px; - color: #232323; - margin-bottom: 10px; -} - -.qubely-options-section-header h3 { - font-size: 18px; - font-weight: 300; - color: #232323; -} - -@media (min-width: 992px) { - .qubely-options-section { - padding: 60px; - } - - .qubely-options-section-header h2 { - font-size: 35px; - margin-bottom: 20px; - } - - .qubely-options-section-header h3 { - font-size: 25px; - } - - .qubely-options-section-header { - margin: -60px -60px 30px; - padding: 30px 60px; - } -} - -h3.qubely-options-section-title, -h4.qubely-options-section-title { - line-height: 1; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -h3.qubely-options-section-title { - font-size: 28px; - color: #e12985; - margin: 0 0 30px; -} - -h4.qubely-options-section-title { - font-size: 21px; - color: #232323; - margin: 0 0 20px; -} - -.qubely-options-section-title img { - margin-left: 15px; -} - -.qubely-options-features { - list-style: none; - padding: 0; - margin: 0 0 30px; -} - -.qubely-options-features:after { - display: block; - clear: both; - content: " "; -} - -.qubely-options-features > li { - font-size: 14px; - line-height: 1.8; - display: block; - color: #838383; - width: 50%; - float: left; -} - -.qubely-options-features > li > i { - font-style: normal; - color: #60da4f; - margin-right: 10px; -} - -.qubely-embed-responsive { - position: relative; - display: block; - width: 100%; - padding: 0; - overflow: hidden; -} - -.qubely-embed-responsive:before { - content: " "; - display: block; - padding-top: 56.25%; -} - -.qubely-embed-responsive .qubely-embed-responsive-item { - position: absolute; - top: 0; - bottom: 0; - left: 0; - width: 100%; - height: 100%; - border: 0; -} - -.qubely-mb-0 { - margin-bottom: 0; -} - -.qubely-mb-30 { - margin-bottom: 30px; -} - -.qubely-mt-20 { - margin-top: 20px; -} - -.qubely-row { - display: -ms-flexbox; - display: flex; - -ms-flex-wrap: wrap; - flex-wrap: wrap; - margin-right: -15px; - margin-left: -15px; - box-sizing: border-box; -} - -.qubely-row > div { - position: relative; - width: 100%; - padding-right: 15px; - padding-left: 15px; - box-sizing: border-box; -} - -@media (min-width: 992px) { - .qubely-row.qubely-columns-2 > div { - -ms-flex: 0 0 50%; - flex: 0 0 50%; - max-width: 50%; - } -} - -/** - * New Getting Started - */ -#gs-wrapper { - display: block !important; -} - -* { - box-sizing: border-box; -} -p { - margin: 0 0 10px; - font-size: 14px; -} -.qubely-getting-started { - font-family: "Lato", sans-serif; - color: rgba(36, 47, 87, 0.7); - font-size: 14px; -} -.qubely-getting-started img { - display: block; - max-width: 100%; -} - -.qubely-gs-container { - display: grid; - grid-template-columns: 1fr 285px; - grid-gap: 25px; -} - -@media only screen and (max-width: 991px) { - .qubely-gs-container { - grid-template-columns: 1fr; - } -} - -.qubely-gs-card-row { - display: grid; - grid-column-gap: 25px; -} - -.qubely-column-3 { - grid-template-columns: 1fr 1fr 1fr; -} - -.qubely-column-2 { - grid-template-columns: 1fr 1fr; -} - -@media only screen and (max-width: 700px) { - .qubely-column-3, - .qubely-column-2 { - grid-template-columns: 1fr; - } -} - -.qubely-gs-card { - background: white; - border: 1px solid #eaedf7; - padding: 32px; - border-radius: 10px; - margin-bottom: 25px; -} - -.qubely-cta-card { - position: relative; - overflow: hidden; - background: var(--card-bg); - z-index: 1; -} - -.qubely-cta-card > img { - position: absolute; - right: -10px; - bottom: -60px; - z-index: -1; - height: 90%; - width: auto; -} - -.qubely-cta-card p { - max-width: 350px; -} - -.card-gradient { - background-color: #a100ff; - background-image: linear-gradient(135deg, #f96ed8, #a100ff); -} - -.card-gradient h2 { - font-size: 30px; - line-height: 35px; - color: #fff; - margin: 0 0 30px; - font-weight: 300; -} - -.qubely-gs-card-compact { - display: flex; - text-decoration: none; - transition: 300ms; -} -.qubely-gs-card-compact:hover { - box-shadow: 0 30px 30px -10px rgba(28, 41, 90, 0.1), 0 0 0 2px #2e98ff inset; -} -.qubely-gs-card-compact > span { - height: 60px; - flex-basis: 60px; - max-width: 60px; - background: rgba(213, 234, 255, 0.2); - border: 1px solid #d5eaff; - display: flex; - align-items: center; - justify-content: center; - border-radius: 12px; - font-size: 25px; - color: #2e98ff; -} -.qubely-gs-card-compact > span > img { - width: 1em; -} - -.qubely-gs-card-compact:nth-child(2n) > span { - background: rgba(218, 247, 240, 0.2); - border: 1px solid #daf7f0; - color: #1fd0a3; -} - -.qubely-gs-card-compact:nth-child(3n) > span { - background: rgba(231, 230, 254, 0.2); - border: 1px solid #e7e6fe; - color: #665cfe; -} - -.qubely-gs-card-compact .qubely-gs-card-content { - flex-grow: 1; - margin-left: 16px; - margin-top: -3px; -} - -.qubely-gs-card-compact .qubely-gs-card-content h6 { - margin: 0; - font-size: 14px; - color: #97a0c3; - font-weight: 400; - line-height: 22px; -} - -.qubely-gs-card-compact .qubely-gs-card-content h3 { - margin: 0; - color: #353535; - font-weight: 300; - font-size: 32px; - line-height: 45px; -} - -.qubely-gs-card .qubely-gs-card-title { - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: 12px; -} - -.qubely-gs-card .qubely-gs-card-title.is-large { - padding: 0 30px 30px; - margin: 0 -30px 28px; - border-bottom: 1px solid #eaedf7; -} -.qubely-gs-card .qubely-gs-card-title h2 { - font-size: 26px; - margin: 0; - line-height: 1; -} -.qubely-gs-card-title h3 { - font-size: 22px; - line-height: 27px; - margin: 0; -} -.qubely-gs-card .qubely-gs-card-title a { - font-size: 16px; - color: #007aff; - text-decoration: none; - transition: 300ms; -} -.qubely-gs-card .qubely-gs-card-title a:hover { - color: #0f4d91; -} -.qubely-gs-card .qubely-gs-card-title a span { - margin-left: 6px; -} -.qubely-gs-card .qubely-gs-card-title button { - font-size: 16px; - border: none; - outline: none; - background: none; - cursor: pointer; - padding: 2px 8px; - margin-right: -8px; - margin-top: -8px; - align-self: flex-start; -} - -.qubely-gs-card .qubely-gs-card-title button:hover, -.qubely-gs-card .qubely-gs-card-title button:focus { - outline: none; -} - -.qubely-gs-card-content.qubely-gs-changelog { - /*height: 300px;*/ - /*overflow: hidden;*/ - position: relative; - margin-bottom: 20px; -} - -.qubely-gs-card-content.qubely-gs-changelog ul { - list-style: disc; - padding-left: 20px; - margin-bottom: 25px; -} - -.qubely-gs-card-content.qubely-gs-changelog h3 { - font-size: 18px; - font-weight: 400; - color: #242f57; -} -.qubely-gs-card-content.qubely-gs-changelog h3:first-child { - margin-top: 0; -} -/* -.qubely-gs-card-content.qubely-gs-changelog::before { - content: ""; - height: 24px; - width: 100%; - bottom: 0; - left: 0; - background: linear-gradient(0deg, white 5px, transparent); - position: absolute; -}*/ - -.qubely-gs-header { - padding: 80px; - background-repeat: no-repeat; - background-position: right top; - background-size: 260px; -} - -.qubely-gs-header h2 { - font-size: 46px; - font-weight: 700; - margin: 0 0 20px; - color: #242f57; - line-height: 1; -} - -.qubely-gs-header h3 { - font-size: 30px; - color: #242f57; - line-height: 1; - font-weight: 300; - margin: 0 0 40px; -} - -.qubely-gs-button { - padding: 6px 30px; - font-size: 16px; - background: #dddddd; - border-radius: 30px; - line-height: 30px; - display: inline-flex; - color: #007aff; - text-decoration: none; - align-items: center; - transition: 300ms; -} - -.qubely-gs-button.button-lg { - padding: 15px 37px; -} - -.qubely-gs-button.button-block { - width: 100%; - text-align: center; - justify-content: center; -} - -.qubely-gs-link { - font-size: 16px; - color: #007aff; - display: inline-flex; - text-decoration: none; - align-items: center; - transition: 300ms; -} - -.qubely-gs-link:hover { - color: #0f4d91; -} - -.qubely-gs-link span, -.qubely-gs-button span { - margin-left: 9px; -} - -.qubely-gs-button:hover { - color: #007aff; - box-shadow: 0 20px 30px rgba(19, 42, 67, 0.2); -} -.qubely-gs-button.link:hover { - box-shadow: none !important; - color: #0f4d91; -} - -.qubely-gs-button.primary { - background: #007aff; - color: #fff; -} -.qubely-gs-button.primary:hover { - color: #fff; -} - -.qubely-gs-button.white:hover, -.qubely-gs-button.white { - background: #ffffff; - color: #007aff; -} - -.qubely-gs-button.link { - background: none; -} - -.qubely-gs-card-footer { - margin-top: 24px; -} - -/* Post */ - -.qubely-gs-post-card img { - border-radius: 5px; -} - -.qubely-gs-post-card a:first-child { - min-height: 150px; - background: #f7f7f7; - border-radius: 5px; -} -.qubely-gs-post-card a:first-child:hover { - box-shadow: 0 10px 20px -10px rgba(19, 42, 67, 0.2); -} -.qubely-gs-post-card a { - color: #242f57; - display: block; - text-decoration: none; - line-height: 20px; - transition: 200ms; -} - -.qubely-gs-post-card img { - display: block; -} - -.qubely-gs-post-card a:hover { - color: #007aff; -} - -.qubely-gs-post-card span { - display: block; - margin-bottom: 8px; - margin-top: 16px; - color: rgba(36, 47, 87, 0.6); -} - -.qubely-gs-post-card.card-placeholder span, -.qubely-gs-post-card.card-placeholder a { - background: #f1f1f1; - color: transparent !important; - pointer-events: none; -} -.qubely-gs-post-card.card-placeholder span { - width: 120px; -} - -.qubely-gs-social-links { - margin: 0 0 0 -10px; - padding: 0; -} -.qubely-gs-social-links a { - display: inline-flex; - padding: 10px; - color: rgba(36, 47, 87, 0.7); - text-decoration: none; - font-size: 16px; - transition: 200ms; -} - -.qubely-gs-social-links a:hover { - color: #007aff; -} diff --git a/assets/img/admin/blocks.svg b/assets/img/admin/blocks.svg deleted file mode 100644 index 2df365e4..00000000 --- a/assets/img/admin/blocks.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/img/admin/join-fb.svg b/assets/img/admin/join-fb.svg deleted file mode 100644 index 86523e33..00000000 --- a/assets/img/admin/join-fb.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/img/admin/keep-in-touch.svg b/assets/img/admin/keep-in-touch.svg deleted file mode 100644 index 941060aa..00000000 --- a/assets/img/admin/keep-in-touch.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/img/admin/qubely-option-logo.jpg b/assets/img/admin/qubely-option-logo.jpg deleted file mode 100644 index 0e29a6d9..00000000 Binary files a/assets/img/admin/qubely-option-logo.jpg and /dev/null differ diff --git a/assets/img/admin/sections.svg b/assets/img/admin/sections.svg deleted file mode 100644 index a490cc54..00000000 --- a/assets/img/admin/sections.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/img/admin/starter-pack.svg b/assets/img/admin/starter-pack.svg deleted file mode 100644 index f404ba58..00000000 --- a/assets/img/admin/starter-pack.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/img/blocks/pieprogress/template-pro-notice.jpg b/assets/img/blocks/pieprogress/template-pro-notice.jpg deleted file mode 100644 index d0f427dc..00000000 Binary files a/assets/img/blocks/pieprogress/template-pro-notice.jpg and /dev/null differ diff --git a/assets/img/icon-premium.svg b/assets/img/icon-premium.svg deleted file mode 100644 index e9adacb9..00000000 --- a/assets/img/icon-premium.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/js/common-script.js b/assets/js/common-script.js index 685902a0..ff3ff51d 100644 --- a/assets/js/common-script.js +++ b/assets/js/common-script.js @@ -576,166 +576,4 @@ jQuery(function ($) { qubelySettingsTabContent.find(".qubely-settings-inner").first().show(); } } - // postgrid-pro loadmore - - /*$('.qubely-postgrid-loadmore').on('click', function () { - var self = $(this); - var page = parseInt(self.data('page')); - var maxPage = parseInt(self.data('max-page')); - $.ajax({ - url: qubely_urls.ajax, - data: { - action: 'post_grid_loadmore', - page: page - } - }).success(function (response) { - /!*$('.qubely-postgrid-wrapper').html(response); - self.data('page', page + 1); - if(page === maxPage) { - self.remove(); - }*!/ - console.log(response); - }) - });*/ - - var qubelyGsPostWrap = $(".qubely-gs-card-blog-posts"); - if (qubelyGsPostWrap.length) { - function generatePostMarkup(post) { - var div = document.createElement("div"); - div.classList.add("qubely-gs-post-card"); - - var anchor1 = document.createElement("a"); - anchor1.setAttribute("href", post.link); - - var img = document.createElement("img"); - if (post.qubely_featured_image_url && post.qubely_featured_image_url.medium_large) { - img.setAttribute("src", post.qubely_featured_image_url.medium_large[0]); - } - - anchor1.appendChild(img); - - var span = document.createElement("span"); - var date = new Date(post.date); - span.innerText = `${date.getUTCDate()}/${date.getUTCMonth()}/${date.getUTCFullYear()}`; - - var anchor2 = document.createElement("a"); - anchor2.setAttribute("href", post.link); - - $(anchor2).html(post.title.rendered); - - div.appendChild(anchor1); - div.appendChild(span); - div.appendChild(anchor2); - return div; - } - - function printPostMarkup(posts) { - $(".qubely-gs-post-items-wrap").empty(); - posts.forEach((post) => { - $(".qubely-gs-post-items-wrap").append(generatePostMarkup(post)); - }); - } - - function fetchPost() { - var cacheTime = localStorage.getItem("__qubely_themeum_post_time"); - var cachedPost = localStorage.getItem("__qubely_themeum_post"); - - if (!cachedPost || !parseInt(cacheTime) > Date.now()) { - var endpoint = - "https://www.themeum.com/wp-json/wp/v2/posts?per_page=3&status=publish&orderby=date&categories=1486"; - fetch(endpoint) - .then((response) => response.json()) - .then((res) => { - if (Array.isArray(res)) { - printPostMarkup(res); - localStorage.setItem("__qubely_themeum_post_time", Date.now() + 3600e3); - localStorage.setItem("__qubely_themeum_post", JSON.stringify(res)); - } else { - qubelyGsPostWrap.remove(); - } - }) - .catch((e) => { - qubelyGsPostWrap.remove(); - }); - } else { - var posts = JSON.parse(cachedPost); - printPostMarkup(posts); - } - } - - // fetchPost(); - } - - var sectionCount = $(".qubely-gs-section-count"); - if (sectionCount.length) { - var endpoint = "https://qubely.io/wp-json/wp/v2/sections"; - var cacheTime = localStorage.getItem("__qubely_section_count_time"); - var cachedCount = localStorage.getItem("__qubely_section_count"); - if (!cachedCount || !parseInt(cacheTime) > Date.now()) { - fetch(endpoint) - .then((response) => { - var count = response.headers.get("X-WP-Total"); - if (count) { - count = count + "+"; - sectionCount.html(count); - localStorage.setItem("__qubely_section_count_time", Date.now() + 3600e3); - localStorage.setItem("__qubely_section_count", count); - } - }) - .catch((e) => { - // debug - }); - } else { - sectionCount.html(cachedCount); - } - } - - var blockCount = $(".qubely-gs-block-count"); - if (blockCount.length) { - var endpoint = "https://qubely.io/wp-json/wp/v2/block"; - var cacheTime = localStorage.getItem("__qubely_block_count_time"); - var cachedCount = localStorage.getItem("__qubely_block_count"); - if (!cachedCount || !parseInt(cacheTime) > Date.now()) { - fetch(endpoint) - .then((response) => { - var count = response.headers.get("X-WP-Total"); - if (count) { - count = count + "+"; - blockCount.html(count); - localStorage.setItem("__qubely_block_count_time", Date.now() + 3600e3); - localStorage.setItem("__qubely_block_count", count); - } - }) - .catch((e) => { - // debug - }); - } else { - blockCount.html(cachedCount); - } - } - - var layoutCount = $(".qubely-gs-layout-count"); - if (layoutCount.length) { - var endpoint = "https://qubely.io/wp-json/restapi/v2/layouts"; - var cacheTime = localStorage.getItem("__qubely_layout_count_time"); - var cachedCount = localStorage.getItem("__qubely_layout_count"); - if (!cachedCount || !parseInt(cacheTime) > Date.now()) { - fetch(endpoint, { - method: "post", - }) - .then((response) => { - response.json().then((response) => { - var count = response.filter((item) => item.parentID === 0).length + "+"; - layoutCount.html(count); - localStorage.setItem("__qubely_layout_count_time", Date.now() + 3600e3); - localStorage.setItem("__qubely_layout_count", count); - }); - }) - .catch((e) => { - // debug - }); - } else { - layoutCount.html(cachedCount); - } - } })(jQuery); diff --git a/assets/reactjs/.npmrc b/assets/reactjs/.npmrc new file mode 100755 index 00000000..4fd02195 --- /dev/null +++ b/assets/reactjs/.npmrc @@ -0,0 +1 @@ +engine-strict=true \ No newline at end of file diff --git a/assets/reactjs/package.json b/assets/reactjs/package.json index 5b59eba3..007d0d30 100755 --- a/assets/reactjs/package.json +++ b/assets/reactjs/package.json @@ -5,8 +5,9 @@ "main": "index.js", "scripts": { "start": "webpack --watch", + "watchCss": "gulp watch", "test": "echo \"Error: no test specified\" && exit 1", - "build": "NODE_ENV=production webpack --config ./webpack.production.config.js" + "build": "NODE_ENV=production webpack --config ./webpack.production.config.js && gulp sass" }, "author": "themeum", "license": "ISC", @@ -64,5 +65,9 @@ "env", "react" ] + }, + "engines": { + "node": "14.17.5", + "npm": "6.14.8" } } diff --git a/assets/reactjs/src/blocks/button/Edit.js b/assets/reactjs/src/blocks/button/Edit.js index f7b3a4d0..6ec28c5f 100644 --- a/assets/reactjs/src/blocks/button/Edit.js +++ b/assets/reactjs/src/blocks/button/Edit.js @@ -1,5 +1,5 @@ -import icons from "../../helpers/icons"; import classnames from "classnames"; +import icons from "../../helpers/icons"; const { __ } = wp.i18n; const { Fragment, Component, createRef } = wp.element; @@ -35,7 +35,6 @@ const { RadioAdvanced, ColorAdvanced, withCSSGenerator, - InspectorSections, Inline: { InlineToolbar }, gloalSettings: { animationSettings, interactionSettings, globalSettingsPanel }, ContextMenu: { ContextMenu, handleContextMenu }, @@ -61,7 +60,7 @@ class Edit extends Component { // updateBlockAttributes, // buttonGroupAttributes, attributes: { - url, + qubelyButtonUrl, iconName, recreateStyles, fillType, @@ -133,10 +132,7 @@ class Edit extends Component { - - - - + setAttributes({ url: value })} + value={qubelyButtonUrl} + onChange={(value) => setAttributes({ qubelyButtonUrl: value })} /> {enableAlignment && ( div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button{margin: {{spacing}};}' } { selector: '{{QUBELY}} .qubely-block-button-group {margin-right: -{{spacing}};} {{QUBELY}} .qubely-block-button-group.qubely-backend .block-editor-block-list__layout > div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button:not(:last-child){margin-right: {{spacing}};}', diff --git a/assets/reactjs/src/blocks/contactform/Save.js b/assets/reactjs/src/blocks/contactform/Save.js index d58e6605..4f4f9f09 100644 --- a/assets/reactjs/src/blocks/contactform/Save.js +++ b/assets/reactjs/src/blocks/contactform/Save.js @@ -127,7 +127,7 @@ class Save extends Component { buttonIconPosition={buttonIconPosition} buttonTag={buttonTag} /> - + - - - - + this.setState({ device: value })} /> )} - setAttributes({ url: val })} /> + setAttributes({ qubelyIconUrl: val })} /> diff --git a/assets/reactjs/src/blocks/icon/index.js b/assets/reactjs/src/blocks/icon/index.js index b9c0ecbb..59ec4c8f 100644 --- a/assets/reactjs/src/blocks/icon/index.js +++ b/assets/reactjs/src/blocks/icon/index.js @@ -31,7 +31,7 @@ registerBlockType("qubely/icon", { style: [{ selector: "{{QUBELY}}" }], }, name: { type: "string", default: "fas fa-rocket" }, - url: { type: "object", default: {} }, + qubelyIconUrl: { type: "object", default: {} }, alignment: { type: "object", default: { md: "center" }, diff --git a/assets/reactjs/src/blocks/image/index.js b/assets/reactjs/src/blocks/image/index.js index 4ed50c3a..1ee31558 100644 --- a/assets/reactjs/src/blocks/image/index.js +++ b/assets/reactjs/src/blocks/image/index.js @@ -1,6 +1,6 @@ -import "./style.scss"; import Edit from "./Edit"; import Save from "./Save"; +import "./style.scss"; const { __ } = wp.i18n; const { RichText } = wp.blockEditor; const { registerBlockType } = wp.blocks; @@ -604,7 +604,7 @@ registerBlockType("qubely/image", { }, example: { attributes: { - image: { url: "https://qubely.io/wp-content/uploads/qubely-assets/demo/image8.jpg" }, + image: { url: "" }, enableCaption: true, imageCaption: __("Qubely is a full-fledged Gutenberg block toolkit.", "qubely"), }, diff --git a/assets/reactjs/src/blocks/pieprogress/Edit.js b/assets/reactjs/src/blocks/pieprogress/Edit.js index 1982c999..38bf8b78 100644 --- a/assets/reactjs/src/blocks/pieprogress/Edit.js +++ b/assets/reactjs/src/blocks/pieprogress/Edit.js @@ -1,5 +1,5 @@ -import Progress from "./Progress"; import icons from "../../helpers/icons"; +import Progress from "./Progress"; const { Fragment, Component, createRef } = wp.element; const { PanelBody, Toolbar, TextControl } = wp.components; const { InspectorControls, BlockControls, RichText } = wp.blockEditor; @@ -122,14 +122,6 @@ class Edit extends Component { - - - {__("Pie - - ); - } - getClassName = () => { const { attributes: { align, childRow, rowContainerWidth }, @@ -208,15 +202,6 @@ class Edit extends Component { ))} -
- -
); diff --git a/assets/reactjs/src/blocks/table-of-contents/components.js b/assets/reactjs/src/blocks/table-of-contents/components.js index 50da667f..f8f47565 100644 --- a/assets/reactjs/src/blocks/table-of-contents/components.js +++ b/assets/reactjs/src/blocks/table-of-contents/components.js @@ -89,6 +89,7 @@ class TableOfContents extends Component { }); } } + componentWillUnmount() { this.state.unsubscribe(); } diff --git a/assets/reactjs/src/blocks/tabs/index.js b/assets/reactjs/src/blocks/tabs/index.js index efa0d52d..354da9f6 100644 --- a/assets/reactjs/src/blocks/tabs/index.js +++ b/assets/reactjs/src/blocks/tabs/index.js @@ -2,8 +2,9 @@ import "./style.scss"; import Save from "./Save"; import Edit from "./Edit"; import attributes from "./attributes"; -const { Component } = wp.element; -const { InnerBlocks } = wp.blockEditor; +import classnames from "classnames"; +const { Fragment, Component } = wp.element; +const { InnerBlocks, RichText } = wp.blockEditor; const { HelperFunction: { animationAttr, IsInteraction }, } = wp.qubelyComponents; @@ -11,16 +12,18 @@ const { const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; +const supports = { + html: false, + className: false, + align: ["full", "wide", "center"], +}; + registerBlockType("qubely/tabs", { title: __("Tabs"), category: "qubely", icon: {__("Tabs, description: __("Showcase features in beautiful pre-designed tabs with Qubely Tabs."), - supports: { - html: false, - className: false, - align: ["full", "wide", "center"], - }, + supports: supports, example: { attributes: { tabTitles: [{ title: "Tab 1" }, { title: "Tab 2" }, { title: "Tab 3" }], @@ -43,4 +46,142 @@ registerBlockType("qubely/tabs", { attributes, edit: Edit, save: Save, + deprecated: [ + { + attributes, + supports, + save(props) { + const { + attributes: { + uniqueId, + className, + tabs, + navType, + autoSwithcing, + showProgressBar, + defaultDelay, + tabStyle, + tabTitles, + iconPosition, + navAlignment, + animation, + interaction, + navLayout, + enableImageNavTitle, + progressbarPosition, + imageNavTitleAlignment, + enableImageNavDesciption, + }, + } = props; + + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + + const renderTabTitles = () => { + return tabTitles.map((title, index) => ( + + {navType === "text" ? ( + + + {title.iconName && (iconPosition == "top" || iconPosition == "left") && ( + + )} + {title.title} + {title.iconName && iconPosition == "right" && ( + + )} + + + ) : ( +
+
+ {navLayout !== "three" && ( + + {typeof title.avatar !== "undefined" && title.avatar.url ? ( + {title.avatar.alt + ) : ( +
+ +
+ )} +
+ )} + + {(enableImageNavTitle || enableImageNavDesciption) && ( +
+ {enableImageNavTitle && ( + + )} + {enableImageNavDesciption && ( + + )} +
+ )} +
+
+ )} + + {autoSwithcing && showProgressBar && ( +
+ )} + + )); + }; + + const blockWrapperClasses = classnames( + { [`qubely-block-${uniqueId}`]: typeof uniqueId !== "undefined" }, + { "with-auto-swithing": autoSwithcing }, + { [className]: typeof className !== "undefined" } + ); + const blockClasses = classnames("qubely-block-tab", `${interactionClass}`, `qubely-tab-style-${tabStyle}`, { + "with-auto-swithing": autoSwithcing, + }); + + return ( +
+
+
{renderTabTitles()}
+
+ +
+
+
+ ); + } + } + ] }); diff --git a/assets/reactjs/src/blocks/team/index.js b/assets/reactjs/src/blocks/team/index.js index 6ace07cd..bf9f813f 100644 --- a/assets/reactjs/src/blocks/team/index.js +++ b/assets/reactjs/src/blocks/team/index.js @@ -1,6 +1,6 @@ -import "./style.scss"; import Edit from "./Edit"; import Save from "./Save"; +import "./style.scss"; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; const { @@ -25,7 +25,7 @@ registerBlockType("qubely/team", { example: { attributes: { contentBg: "", - image: { url: "https://qubely.io/wp-content/uploads/qubely-assets/demo/team1.jpg" }, + image: { url: "" }, }, }, attributes: { diff --git a/assets/reactjs/src/blocks/testimonial/Edit.js b/assets/reactjs/src/blocks/testimonial/Edit.js index 477565da..b9e1621b 100644 --- a/assets/reactjs/src/blocks/testimonial/Edit.js +++ b/assets/reactjs/src/blocks/testimonial/Edit.js @@ -25,7 +25,6 @@ const { withCSSGenerator, InspectorTabs, InspectorTab, - InspectorSections, } = wp.qubelyComponents; import icons from "../../helpers/icons"; @@ -214,10 +213,7 @@ class Edit extends Component { return ( - - - - + - - - - + - - - - + { - const [sections, setSections] = useState([]); - const [loadingState, setLoadingState] = useState(""); - const block = typeof props.block !== "undefined" ? props.block : ""; - const storeName = "_qubely_local_cache_"; - const storeNameDate = "_last_update_"; - - useEffect(() => { - const today = new Date(); - const sectionData = _getStoreData("sections"); - - if (sectionData) { - let expDate = _getStoreData(storeNameDate); - expDate = expDate ? expDate : 0; - if (expDate !== null && today > expDate) { - _clearStore(); - _fetchSections(today); - } else { - setSections(sectionData); - } - } else { - _fetchSections(today); - } - }, []); - - // Sync sections in background - const _syncSections = (sections) => { - sections.forEach((section, index) => { - const isLatest = sections.length === index + 1 ? true : false; - _fetchSection(section.ID, () => { - if (isLatest) { - setLoadingState("qubely-done"); - setTimeout(() => { - setLoadingState(""); - }, 1000); - } - }); - }); - }; - - // fetch sections - const _fetchSections = (today) => { - setLoadingState("qubely-is-loading"); - fetch("https://qubely.io/wp-json/restapi/v2/sections", { - method: "POST", - body: block ? new URLSearchParams("block_name=" + block) : "", - }) - .then((response) => (response.ok ? response.json() : Promise.reject(response))) - .then((response) => { - const cacheExp = new Date().setDate(today.getDate() + 1); - setSections(response); - _setStore("sections", response); - _setStore(storeNameDate, cacheExp); - _syncSections(response); - }) - .catch((err) => { - console.warn("Something went wrong.", err); - }); - }; - - // fetch section - const _fetchSection = (section_id, callback) => { - fetch("https://qubely.io/wp-json/restapi/v2/single-section", { - method: "POST", - body: new URLSearchParams("section_id=" + section_id), - }) - .then((response) => (response.ok ? response.json() : Promise.reject(response))) - .then((response) => { - _setStore(section_id, response.rawData); - callback && callback(); - }) - .catch((err) => { - console.warn("Something went wrong.", err); - }); - }; - - // insert section as block - const _insertSection = (section_id) => { - const { insertBlocks } = props; - const sectionData = _getStoreData(section_id); - if (sectionData !== null) { - insertBlocks(parse(sectionData)); - } else { - _fetchSection(section_id, () => { - const sectionData = _getStoreData(section_id); - insertBlocks(parse(sectionData)); - }); - } - }; - - // Get full storage - const _getStore = () => { - let store = window.localStorage.getItem(storeName); - store = JSON.parse(store); - return store ? store : null; - }; - - // Get data from storage by key - const _getStoreData = (key) => { - let store = _getStore(); - store = - store !== null && typeof store[block] !== "undefined" && typeof store[block][key] !== "undefined" - ? store[block][key] - : null; - return store; - }; - - // Set data to storage - const _setStore = (key, newData) => { - if (typeof key === "undefined" || typeof newData === "undefined") { - return false; - } - let storage = _getStore() ? _getStore() : {}; - if (typeof storage[block] === "undefined") { - storage[block] = {}; - } - storage[block][key] = newData; - storage = JSON.stringify(storage); - window.localStorage.setItem(storeName, storage); - }; - - // Clear localStorage data - const _clearStore = () => window.localStorage.setItem(storeName, JSON.stringify({})); - - // Re-sync blocks - const _syncBlocks = () => { - const today = new Date(); - _clearStore(); - _fetchSections(today); - }; - - return ( - -
- - - - {sections.map((section, i) => ( -
- {section.name} -
- -
-
- ))} -
-
- ); -}; - -export default withDispatch((dispatch) => ({ insertBlocks: dispatch("core/block-editor").insertBlocks }))(Sections); diff --git a/assets/reactjs/src/components/css/inspectorSections.scss b/assets/reactjs/src/components/css/inspectorSections.scss deleted file mode 100644 index f3f233ec..00000000 --- a/assets/reactjs/src/components/css/inspectorSections.scss +++ /dev/null @@ -1,88 +0,0 @@ -.qubely-block-sections { - position: relative; - button.qubely-block-refresh { - position: absolute; - top: -41px; - right: 20px; - z-index: 2; - border: none; - padding: 0; - cursor: pointer; - background: transparent; - height: 24px; - width: 24px; - text-align: center; - line-height: 24px; - &:focus { - outline: none; - } - &.qubely-is-loading { - animation: qubelySync 1s linear infinite; - } - &.qubely-done { - color: #00cf00; - span.fas::before { - content: "\f00c"; - } - } - } -} - -@keyframes qubelySync { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -.qubely-block-section { - position: relative; - margin-bottom: 10px; - border-radius: 5px; - box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); - overflow: hidden; - background: #dddddd; - img { - display: block; - } - .qubely-block-section-btns { - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - display: flex; - align-items: center; - justify-content: center; - opacity: 0; - visibility: hidden; - background: rgba(33, 132, 249, 0.8); - transition: 300ms; - button { - font-size: 12px; - line-height: 28px; - height: 28px; - padding: 0 24px; - background: #ffffff; - border-radius: 30px; - color: #565d66; - display: block; - border: none; - font-weight: 500; - cursor: pointer; - transition: 300ms; - &:hover { - color: #2184f9; - box-shadow: 0 8px 10px -3px rgba(0, 0, 0, 0.3); - } - } - } - &:hover { - .qubely-block-section-btns { - opacity: 1; - visibility: visible; - } - } -} diff --git a/assets/reactjs/src/components/fields/Carousel/index.js b/assets/reactjs/src/components/fields/Carousel/index.js index a6b60542..add7fb80 100644 --- a/assets/reactjs/src/components/fields/Carousel/index.js +++ b/assets/reactjs/src/components/fields/Carousel/index.js @@ -84,10 +84,10 @@ export default class Carousel extends Component { Array(parseInt(cloneItems)) .fill(0) .map((_, i) => { - const lastChild = cloneElement(children[children.length - 1 - i], { + const lastChild = cloneElement(children[Math.max(0, children.length - 1 - i)], { className: `clone qubely-carousel-item`, }); - const firstChild = cloneElement(children[i], { className: `clone qubely-carousel-item` }); + const firstChild = cloneElement(children[Math.min(i, children.length-1)], { className: `clone qubely-carousel-item` }); firstChilds.push(firstChild); lastChilds.push(lastChild); }); diff --git a/assets/reactjs/src/components/fields/Interaction.js b/assets/reactjs/src/components/fields/Interaction.js index a6455b55..2feb7979 100644 --- a/assets/reactjs/src/components/fields/Interaction.js +++ b/assets/reactjs/src/components/fields/Interaction.js @@ -149,21 +149,6 @@ class Interaction extends Component { alt={__("Qubely")} />
-
- {__("Upgrade to Pro")} - - {__( - "Get all features of post grid at your disposal by upgrading to pro version" - )} - -
- - {__("Upgrade Now")} - ) : ( diff --git a/assets/reactjs/src/components/fields/Styles.js b/assets/reactjs/src/components/fields/Styles.js index a52ae775..03e902e6 100644 --- a/assets/reactjs/src/components/fields/Styles.js +++ b/assets/reactjs/src/components/fields/Styles.js @@ -35,19 +35,6 @@ class Styles extends Component {
{__("Qubely")}
-
- {__("Upgrade to Pro")} - - {__("Get all features of post grid at your disposal by upgrading to pro version")} - -
- - {__("Upgrade Now")} - )} diff --git a/assets/reactjs/src/components/others/import-button/index.js b/assets/reactjs/src/components/others/import-button/index.js deleted file mode 100644 index 23259c1d..00000000 --- a/assets/reactjs/src/components/others/import-button/index.js +++ /dev/null @@ -1,20 +0,0 @@ -import { ModalManager } from "../../../helpers/ModalManager"; -import PageListModal from "../../../helpers/PageListModal"; - -const { __ } = wp.i18n; - -const ImportButton = () => { - return ( -
- -
- ); -}; -export default ImportButton; diff --git a/assets/reactjs/src/components/others/index.js b/assets/reactjs/src/components/others/index.js index c83bdb18..17fc945c 100644 --- a/assets/reactjs/src/components/others/index.js +++ b/assets/reactjs/src/components/others/index.js @@ -1,2 +1,2 @@ export { default as Pagination } from "./pagination"; -export { default as ImportButton } from "./import-button"; + diff --git a/assets/reactjs/src/editor.scss b/assets/reactjs/src/editor.scss index 145abbcd..f9bc58c7 100644 --- a/assets/reactjs/src/editor.scss +++ b/assets/reactjs/src/editor.scss @@ -33,7 +33,6 @@ } .qubely-row > .block-editor-inner-blocks > .block-editor-block-list__layout { display: flex; - // flex-wrap: wrap; } .wp-block-qubely-row > .block-editor-inner-blocks > .block-editor-block-list__layout > [data-type="qubely/column"] { display: flex; @@ -645,13 +644,11 @@ div[data-type="qubely/row"].is-resizing //// new .components-resizable-box__container { .qubely-column { - //width: 100%; max-width: 100%; } } .block-editor-block-list__layout { .components-resizable-box__container { - //width: 100% !important; max-width: 100% !important; } } @@ -680,14 +677,6 @@ div[data-type="qubely/row"].is-resizing margin-right: 0; } -// .qubely-row .editor-block-list__block .editor-block-contextual-toolbar { -// margin-left: 0; -// margin-right: 0; -// } - -//.qubely-row .block-editor-block-list__layout .editor-block-list__block.is-selected >.editor-block-list__block-edit::before { -// outline: 0; -//} .qubely-row .block-editor-block-list__layout .editor-block-list__block @@ -697,14 +686,7 @@ div[data-type="qubely/row"].is-resizing .components-resizable-box__container { position: relative; } -// .block-editor-block-list__layout .editor-block-list__block .qubely-row .editor-block-list__block-edit::before { -// right: 1px; -// left: 1px; -// } -// .block-editor-block-list__layout .editor-block-list__block .qubely-row .editor-block-drop-zone + .editor-block-list__block-edit::before { -// right: -14px; -// left: -14px; -// } + .qubely-row .block-editor-block-list__layout .editor-block-list__block.is_hovered[data-type="qubely/columns"] @@ -721,25 +703,6 @@ div[data-type="qubely/row"].is-resizing position: relative; } -.qubely-row - .block-editor-block-list__layout - .editor-block-list__block - .editor-block-list__block-edit - > .editor-block-contextual-toolbar - + [data-block] - .components-resizable-box__container::before { - // z-index: 0; - // content: ""; - // position: absolute; - // outline: 1px solid #e2e4e7; - // transition: outline .1s linear; - // pointer-events: none; - // right: -14px; - // left: -14px; - // top: -14px; - // bottom: -14px; -} - .qubely-row .block-editor-block-list__layout .editor-block-list__block.is_hovered .components-resizable-box__container { position: relative; } @@ -817,22 +780,6 @@ div[data-type="qubely/row"].is-resizing } } } - - .import-layout-btn-container { - .is-button.is-primary { - text-shadow: none; - background: #2184f9; - box-shadow: none; - border: 0; - padding: 10px 12px; - line-height: 1; - height: auto; - transition: color 300ms, background-color 300ms; - &:hover { - background: rgb(29, 116, 223); - } - } - } } // ---------------------------------------- @@ -891,57 +838,6 @@ div[data-type="qubely/row"].is-resizing } } -#qubelyImportLayoutBtn { - position: relative; - vertical-align: middle; - display: inline-flex; - align-items: center; - text-decoration: none; - white-space: nowrap; - border-width: 1px; - border-style: solid; - font-size: 13px; - color: #ffffff; - background: linear-gradient(90deg, #aa0fd0 4.81%, #4321e0 57.77%, #65a8ff 104.73%); - margin: 0 15px 0 15px; - padding: 9px 12px; - border: 0; - border-radius: 8px; - cursor: pointer; - transition: color 300ms; - z-index: 1; - - &:before { - content: " "; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: linear-gradient(90deg, #d638fd 4.81%, #502cf5 57.77%, #4395ff 104.73%); - border-radius: 8px; - opacity: 0; - z-index: -2; - transition: opacity 300ms; - } - - &:hover, - &:focus, - &:active { - color: #fff; - text-decoration: none; - &:before { - opacity: 1; - } - } - - img { - height: 16px; - width: 16px; - margin-right: 10px; - } -} - // Common .qubely-editor-btn { background: none; @@ -1097,22 +993,6 @@ div[data-type="qubely/row"].is-resizing pointer-events: none; } -// .qubely-section .qubely-row .block-editor-inner-blocks { -// padding: 14px; -// } -.qubely-row * > [data-type="qubely/column"].has-child-selected .block-editor-inner-blocks { - // padding: 14px; -} - -.editor-styles-wrapper .qubely-row * > [data-type="qubely/column"] [data-block] { - // margin-top: 0; - // margin-bottom: 0; -} -.editor-styles-wrapper .qubely-row * > [data-type="qubely/column"].has-child-selected [data-block] { - // margin-top: 28px; - // margin-bottom: 28px; -} - .block-editor-block-list__block .qubely-row * > [data-type="qubely/column"] .block-list-appender { margin: 0; } @@ -1127,10 +1007,6 @@ div[data-type="qubely/row"].is-resizing span.block-editor-block-icon img { max-width: 24px; } -.qubely-import-button-wrapper { - display: inline-flex; - align-items: center; -} .advanced-background-trigger { margin-left: 10px; diff --git a/assets/reactjs/src/helpers/ModalManager.js b/assets/reactjs/src/helpers/ModalManager.js deleted file mode 100755 index 72d4364f..00000000 --- a/assets/reactjs/src/helpers/ModalManager.js +++ /dev/null @@ -1,86 +0,0 @@ -const { __ } = wp.i18n; -const { Component, Fragment } = wp.element; - -var onClose; - -class Modal extends Component { - constructor(props) { - super(props); - this.state = { - afterOpen: false, - beforeClose: false, - }; - } - close() { - if (!this.props.onRequestClose || this.props.onRequestClose()) { - Manager.close(); - } - } - handleKeyDown = (event) => { - if (event.keyCode === 27) { - Manager.close(); - } - }; - componentDidMount() { - const { openTimeoutMS, closeTimeoutMS } = this.props; - document.addEventListener("keydown", this.handleKeyDown); - setTimeout(() => this.setState({ afterOpen: true }), openTimeoutMS ? openTimeoutMS : 150); - - onClose = (callback) => { - this.setState({ beforeClose: true }, () => { - this.closeTimer = setTimeout(callback, closeTimeoutMS ? closeTimeoutMS : 150); - }); - }; - } - componentWillUnmount() { - onClose = null; - clearTimeout(this.closeTimer); - document.removeEventListener("keydown", this.handleKeyDown); - } - - render() { - return ( - - { - this.close(); - }} - className="qubely-pagelist-modal-overlay" - > -   - -
e.stopPropagation()}> - {this.props.children} -
-
- ); - } -} - -var node; -const Manager = { - open(component) { - if (onClose) { - throw __("There is already one modal.It must be closed before one new modal will be opened"); - } - if (!node) { - node = document.createElement("div"); - node.className = "qubely-builder-modal"; - document.body.appendChild(node); - } - wp.element.render(component, node); - document.body.classList.add("qubely-builder-modal-open"); - }, - close() { - onClose && - onClose(() => { - wp.element.unmountComponentAtNode(node); - document.body.classList.remove("qubely-builder-modal-open"); - }); - }, -}; - -module.exports = { - Modal: Modal, - ModalManager: Manager, -}; diff --git a/assets/reactjs/src/helpers/PageLIstModal.scss b/assets/reactjs/src/helpers/PageLIstModal.scss deleted file mode 100644 index 5af85163..00000000 --- a/assets/reactjs/src/helpers/PageLIstModal.scss +++ /dev/null @@ -1,600 +0,0 @@ -@mixin placeholder-color($color) { - &::-webkit-input-placeholder { - /* WebKit browsers */ - color: $color; - opacity: 1; - } - &:-moz-placeholder { - /* Mozilla Firefox 4 to 18 */ - color: $color; - opacity: 1; - } - &::-moz-placeholder { - /* Mozilla Firefox 19+ */ - color: $color; - opacity: 1; - } - &:-ms-input-placeholder { - /* Internet Explorer 10+ */ - color: $color; - opacity: 1; - } -} - -.qubely-builder-modal { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 9999; - display: flex; - align-items: center; - justify-content: center; - pointer-events: none; - * { - box-sizing: border-box; - pointer-events: all; - } - .qubely-pagelist-modal-overlay { - position: absolute; - width: 100%; - height: 100%; - background: red; - left: 0; - top: 0; - z-index: -1; - background: rgba(#000, 0.6); - } -} - -.qubely-builder-modal-header { - position: absolute; - top: 0; - left: 0; - width: 100%; - border-radius: 6px 6px 0 0; - display: flex; - z-index: 99999; - .template-search-box { - position: relative; - width: 270px; - i { - font-size: 21px; - color: #95c2ee; - position: absolute; - top: 50%; - left: 40px; - transform: translateY(-50%); - } - input { - display: block; - width: 100%; - height: 85px; - color: #507a9b; - background: #1b3865; - border: none; - font-size: 20px; - padding: 0 20px 0 75px; - margin: 0; - font-weight: 300; - border-radius: 6px 0 0 0 !important; - @include placeholder-color(#507a9b); - &:focus { - box-shadow: none; - outline: 0; - } - } - } -} - -.qubely-pagelist-modal-inner { - padding-top: 85px; - position: relative; - display: flex; - width: 1500px; - height: 80%; - border-radius: 6px; - background: #ebeef4; - max-width: 85%; - .qubely-layout-modal-sidebar { - min-width: 270px; - background: #0e2244; - border-radius: 0 0 0 6px; - color: #587e97; - overflow-y: auto; - .qubely-modal-sidebar-content { - padding: 30px 40px; - h3 { - font-size: 21px; - color: #95c2ee; - margin: 0 0 30px; - font-weight: 500; - } - ul { - list-style: none; - margin: 0; - padding: 0; - li { - padding: 6px 0; - display: block; - font-size: 14px; - overflow: hidden; - cursor: pointer; - transition: 300ms; - &:hover { - color: #95c2ee; - } - &.active { - color: #2184f9; - } - span { - float: right; - } - } - } - } - } - .qubely-layout-modal-content-area { - flex-grow: 1; - max-height: 100%; - overflow-y: auto; - position: relative; - } -} - -//template list header - -.qubely-template-list-header { - text-align: center; - background-color: #fff; - border-radius: 6px 6px 0 0; - position: relative; - flex-grow: 1; - padding-right: 50px; - button:not(.qubely-builder-close-modal) { - display: inline-block; - line-height: 25px; - padding: 30px 40px; - border: none; - background: transparent; - cursor: pointer; - font-size: 16px; - margin: 0 1px 0 0; - transition: color 300ms, background-color 300ms; - &:hover { - color: #2184f9; - } - &.active { - background-color: #ebeef4; - color: #2184f9; - } - &:focus { - outline: none; - } - } - .qubely-builder-close-modal { - position: absolute; - font-size: 20px; - color: #9b9b9b; - background-color: transparent; - border: none; - right: 30px; - top: 50%; - cursor: pointer; - transform: translateY(-50%); - transition: color 300ms; - &:hover { - color: #2184f9; - } - &:focus { - outline: none; - } - } -} - -//template list sub header - -.qubely-template-list-sub-header { - display: flex; - justify-content: space-between; - align-items: center; - padding: 23px 25px 0; - h4 { - font-size: 21px; - color: #0e2244; - font-weight: 500; - margin: 0; - } - .qubely-template-filter-button-group { - background: #f8fafb; - display: inline-flex; - border: 1px solid #d8d8d8; - border-radius: 4px; - button { - display: inline-flex; - line-height: 28px; - padding: 5px 18px; - align-items: center; - background: none; - border: none; - color: #587e97; - position: relative; - z-index: 1; - cursor: pointer; - &:focus { - outline: none; - } - &:last-child { - color: #f5a623; - } - &.active { - background: #2184f9; - color: #fff; - } - img { - display: inline-block; - width: auto; - height: 14px; - margin-right: 4px; - } - &:not(:last-child)::after { - content: ""; - height: 13px; - background-color: #c4cbcf; - width: 1px; - right: 0px; - top: 50%; - position: absolute; - transform: translateY(-50%); - } - &.active::after { - display: none; - } - &::before { - content: ""; - position: absolute; - background: #2184f9; - height: calc(100% + 4px); - width: calc(100% + 4px); - left: -2px; - top: -2px; - z-index: -1; - border-radius: 4px; - box-shadow: 0 0 4px rgba(33, 32, 249, 0.3); - opacity: 0; - } - &.active::before { - opacity: 1; - } - } - } -} - -.qubely-modal-loader { - display: inline-block; - position: absolute; - width: 80px; - height: 80px; - line-height: 80px; - text-align: center; - left: 50%; - margin-left: -50px; - top: 50%; - margin-top: -50px; - font-size: 24px; - color: #1e7ed8; -} -.qubely-modal-loader img { - height: 80px; - width: 80px; -} - -/*block style*/ -.qubely-builder-template-found-empty { - text-align: center; - border-color: transparent !important; - .qubely-builder-empty-title { - display: block; - width: 100%; - } -} - -#layouts-blocks-list { - width: 100%; - display: flex; - flex-wrap: wrap; - padding: 10px 10px 35px 10px; - > div { - width: 33.3333%; - padding: 15px; - position: relative; - @media (max-width: 1199px) { - width: 50%; - } - &.qubely-builder-template-found-empty { - width: 100%; - text-align: center; - opacity: 0.5; - border: none !important; - padding-top: 70px !important; - } - } - .qubely-pro { - position: absolute; - background: red; - padding: 4px 5px; - border-radius: 3px; - color: #fff; - font-size: 10px; - right: 20px; - top: 20px; - text-transform: uppercase; - line-height: 1; - } - &.qubely-frontendd-block-list { - display: block; - padding-bottom: 35px; - padding-top: 0px; - > div { - &.qubely-reusable-list-title { - color: #adafb2; - } - width: 100%; - display: flex; - flex-wrap: nowrap; - border-bottom: 1px solid #e2e4e7; - font-weight: 600; - padding: 12px 0 12px 15px; - margin-bottom: 0; - align-items: center; - &:first-child { - border-top: 1px solid #e2e4e7; - } - .qubely-reusable-list-content { - flex-grow: 1; - } - .qubely-reusable-list-info { - flex-grow: 1; - max-width: 165px; - display: flex; - flex-wrap: nowrap; - } - - .qubely-reusable-list-button { - margin-left: 30px; - } - .qubely-reusable-list-button button { - display: inline-block; - padding: 0; - border: none; - transition: 300ms; - cursor: pointer; - background-color: transparent; - &:not(:last-child) { - margin-right: 10px; - } - i { - font-size: 16px; - color: #cdcfd1; - } - &:hover i { - color: #007cba; - } - &:last-child:hover i { - color: red; - } - } - } - } -} - -.qubely-default-template-image { - transition: 300ms; - img { - width: 100%; - display: block; - } -} - -.qubely-single-block-item { - margin-bottom: 30px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); -} -.qubely-single-block-item .qubely-tmpl-title { - background: #fff; - margin: 0; - color: #23282d; - padding: 13px 15px; -} - -.qubely-single-block-item .qubely-single-item-inner { - position: relative; - overflow: hidden; - .qubely-default-template-image { - transition: 300ms; - } - .qubely-tmpl-info { - position: absolute; - width: 100%; - background: rgba(0, 0, 0, 0.5); - height: 100%; - top: 0; - left: 0; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - transition: 300ms; - opacity: 0; - .qubely-tmpl-title { - margin: 0 0 15px; - color: #fff; - font-size: 19px; - font-weight: 400; - } - } - &:hover { - .qubely-tmpl-info { - opacity: 1; - } - .qubely-default-template-image { - filter: blur(3px); - } - } -} - -.qubely-import-button-group span, -.qubely-import-button-group a { - display: inline-block; - padding: 0 12px 2px; - margin: 2px; - height: 33px; - line-height: 32px; - font-size: 13px; - color: #353535; - border: 1px solid #f7f7f7; - background: #f7f7f7; - box-shadow: 0 1px 0 #ccc; - vertical-align: top; - border-radius: 3px; - text-decoration: none; - cursor: pointer; -} -.qubely-import-button-group span i, -.qubely-import-button-group a i { - font-size: 10px; - margin-right: 4px; -} - -.qubely-import-button-group span { - background: #0085ba; - border-color: #006a95 #00648c #00648c; - box-shadow: inset 0 -1px 0 #00648c; - color: #fff; - text-decoration: none; - text-shadow: 0 -1px 1px #005d82, 1px 0 1px #005d82, 0 1px 1px #005d82, -1px 0 1px #005d82; -} - -.qubely-import-button-group a.qubely-button-download { - border: 1px solid #1e70d6; - background: #1e70d6; - box-shadow: 0 1px 0 #165cb4; - color: #fff; -} - -.qubely-import-button-group .qubely-button-download { - margin-left: 5px; -} - -/*multiple box*/ -#layouts-blocks-list div.qubely-multiple-template-box { - margin-bottom: 5px; - .multiple-template-view { - border: 1px solid #e2e4e7; - background: #fff; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05), 0 10px 0 -5px #fff, 0 10px 1px -4px rgba(0, 0, 0, 0.08), - 0 20px 0 -10px #fff, 0 20px 1px -9px rgba(0, 0, 0, 0.08); - cursor: pointer; - } - .qubely-tmpl-info { - padding: 10px 12px; - h5 { - margin: 0; - font-size: 14px; - color: #23282d; - line-height: 19px; - span { - font-size: 13px; - color: #cdcfd1; - line-height: 18px; - } - } - } -} - -.qubely-template-option-header { - padding: 20px 20px 0; - .qubely-template-back { - cursor: pointer; - .dashicons { - vertical-align: text-bottom; - } - } -} - -#wpwrap .edit-post-visual-editor .import-layout-btn-container { - text-align: center; - margin-top: 20px; -} -#wpwrap .edit-post-visual-editor .import-layout-btn-container #importLayoutBtn { - color: #fff; - font-size: 13px; -} - -.qubely-template-back { - cursor: pointer; - .dashicons { - vertical-align: text-bottom; - } -} - -/* .qubely-modal-loader span { - width: 50px; - height: 50px; -} */ - -//global settings - -.qubely-import-global, -.qubely-restore-global_preset { - width: 500px; - border-radius: 4px; - .qubely-import-settings-footer { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 20px; - } - .qubely-restore-settings-footer { - display: flex; - align-items: flex-start; - justify-content: center; - margin-top: 20px; - flex-direction: column; - .action-buttons { - width: 100%; - justify-content: flex-end; - } - } - .help { - font-size: 12px; - margin-bottom: -5px; - margin-top: 20px; - } - .qubely-import-settings { - .label { - font-size: 14px; - margin-top: -5px; - } - .action-buttons { - display: flex; - .action-button { - cursor: pointer; - padding: 6px 30px; - border: 1px solid #d8d8d8; - border-radius: 4px; - &.yes { - margin-left: 15px; - color: #fff; - background-color: #2184f9; - } - } - } - .remember-choice-box { - .label { - display: inline-block; - } - } - } -} diff --git a/assets/reactjs/src/helpers/PageListModal.js b/assets/reactjs/src/helpers/PageListModal.js deleted file mode 100755 index c2bcea51..00000000 --- a/assets/reactjs/src/helpers/PageListModal.js +++ /dev/null @@ -1,1054 +0,0 @@ -const { compose } = wp.compose; -const { withDispatch } = wp.data; -const { Component, Fragment } = wp.element; -const { Spinner, Modal } = wp.components; -const { parse } = wp.blocks; -const { apiFetch } = wp; -const { __ } = wp.i18n; -import { Modal as QubelyModal, ModalManager } from "./ModalManager"; -import SingleItem from "./components/SingleItem"; -import MultipleItem from "./components/MultipleItem"; -import ReusableBlockItem from "./components/ReusableBlockItem"; -import "./PageLIstModal.scss"; - -class PageListModal extends Component { - constructor(props) { - super(props); - this.state = { - loading: false, - blockCategories: [], - layoutCategories: [], - layoutCategoryItems: {}, - selectedBlockCategory: "", - selectedLayoutCategory: "", - blockData: "", - layoutData: "", - savedBlocks: "", - itemType: "layout", - layer: "single", - searchContext: "", - isSearchEnable: false, - notFoundMessage: "Sorry, we couldn't find the match.", - requestFailedMsg: "", - spinner: false, - lazyloadThrottleTimeout: 0, - priceFilter: "", - isOpen: false, - rememberChoice: false, - }; - this._lazyload = this._lazyload.bind(this); - } - - componentDidMount() { - this._onlickLayoutsTab(); - return; - } - - componentDidUpdate() { - if (this.state.layer === "single") { - this._lazyload(); - } - } - - componentWillUnmount() { - let node = document.querySelector("#modalContainer"); - node && node.removeEventListener("scroll", this._lazyload); - } - - getCurrentPageData() { - let { itemType, priceFilter } = this.state; - let pageData = itemType == "block" ? this.state.blockData : this.state.layoutData; - let pageCategories = itemType == "block" ? this.state.blockCategories : this.state.layoutCategories; - let selectedCategory = - itemType == "block" ? this.state.selectedBlockCategory : this.state.selectedLayoutCategory; - let currentPageData = []; - let tempDataID = []; - - if (this.state.layer === "single") { - if (this.state.parent_id) { - //if click from multiple entry - for (let key in pageData) { - pageData[key].map((value) => { - if ( - value.parentID && - this.state.parent_id === value.parentID && - !(tempDataID.indexOf(value.ID) > -1) - ) { - currentPageData.push(value); - tempDataID.push(value.ID); - } - }); - } - } else { - if (selectedCategory) { - pageData[selectedCategory].map((value) => { - if (itemType == "block") { - if (!(tempDataID.indexOf(value.ID) > -1)) { - currentPageData.push(value); - tempDataID.push(value.ID); - } - } else { - if (value.parentID && !(tempDataID.indexOf(value.ID) > -1)) { - currentPageData.push(value); - tempDataID.push(value.ID); - } - } - }); - } else { - for (let key in pageData) { - Array.isArray(pageData[key]) && - pageData[key].map((value) => { - if (itemType == "block") { - if (!(tempDataID.indexOf(value.ID) > -1)) { - currentPageData.push(value); - tempDataID.push(value.ID); - } - } else { - if (value.parentID && !(tempDataID.indexOf(value.ID) > -1)) { - currentPageData.push(value); - tempDataID.push(value.ID); - } - } - }); - } - } - } - } - - if (this.state.layer === "multiple") { - if (selectedCategory) { - let itemCount = 0; - pageData[selectedCategory].map((value) => { - if (!value.parentID && !(tempDataID.indexOf(value.ID) > -1)) { - let found = value.category.find((item) => item.slug == selectedCategory); - if (found) { - tempDataID.push(value.ID); - currentPageData.push(value); - } - } - }); - } else { - for (let key in pageData) { - if (typeof pageData[key] === "object") { - pageData[key].map((value) => { - if (!value.parentID && !(tempDataID.indexOf(value.ID) > -1)) { - tempDataID.push(value.ID); - currentPageData.push(value); - } - }); - } - } - } - } - - if (this.state.layer === "block") { - currentPageData = this.state.savedBlocks; - } - - if (itemType != "saved_blocks") { - currentPageData = - priceFilter == "pro" - ? currentPageData.filter((item) => item.pro == true) - : priceFilter == "free" - ? currentPageData.filter((item) => item.pro == false) - : currentPageData; - } - - if (this.state.isSearchEnable) { - let filterData = currentPageData.filter( - (item) => item.name.toLowerCase().indexOf(this.state.searchContext.toLowerCase()) != -1 - ); - return { pageCategories, selectedCategory, currentPageData: filterData }; - } - - return { pageCategories, selectedCategory, currentPageData }; - } - - deleteSavedBlock(index, blockID) { - let { savedBlocks } = this.state; - let requestFailedMsg = []; - let security = qubely_urls.nonce; - let currentUserId = qubely_admin.current_user_id; - const options = { - method: "POST", - url: - qubely_admin.ajax + - "?action=qubely_delete_saved_block&block_id=" + - blockID + - "&security=" + - security + - "&user_id=" + - currentUserId, - headers: { "Content-Type": "application/json" }, - }; - apiFetch(options) - .then((response) => { - if (response.success) { - delete savedBlocks[index]; - this.setState({ savedBlocks }); - } - }) - .catch((error) => { - requestFailedMsg.push(error.code + " : " + error.message); - this.setState({ - requestFailedMsg, - }); - }); - } - - importLayoutBlock(itemData, isPro) { - let { itemType } = this.state; - const { insertBlocks, removeBlock, rowClientId } = this.props; - let globalSettings, - importWithGlobal = false; - - if (typeof itemData.global_settings !== "undefined" && itemData.global_settings) { - importWithGlobal = true; - } - - if (!qubely_admin.pro_enable && isPro == true) { - // - } else { - this.setState({ spinner: itemData.ID }); - if (importWithGlobal) { - globalSettings = JSON.parse(itemData.global_settings); - } - - let requestFailedMsg = []; - let security = qubely_urls.nonce; - let currentUserId = qubely_admin.current_user_id; - const options = { - method: "POST", - url: - qubely_admin.ajax + - "?action=qubely_get_single_" + - itemType + - "&" + - itemType + - "_id=" + - itemData.ID + - "&security=" + - security + - "&user_id=" + - currentUserId, - headers: { "Content-Type": "application/json" }, - }; - apiFetch(options) - .then((response) => { - if (response.success) { - //import layout - let pageData = parse(response.data.rawData); - - if (importWithGlobal) { - let temp = JSON.stringify(pageData); - if (typeof globalSettings.colors !== "undefined" && globalSettings.colors.length > 0) { - globalSettings.colors.forEach((color, index) => { - temp = temp.replace(new RegExp(`var.--qubely-color-${index + 1}.`, "g"), color); - }); - } - if ( - typeof globalSettings.typography !== "undefined" && - globalSettings.typography.length > 0 - ) { - globalSettings.typography.forEach((typo, index) => { - let tempValue = JSON.stringify({ ...typo.value, activeSource: "custom" }); - temp = temp.replace( - new RegExp(`\"globalSource\":\"${index + 1}\"`, "g"), - tempValue.slice(1, -1) - ); - }); - } - if (qubely_admin.import_with_global_settings === "always") { - this.props.insertBlocks(pageData); - ModalManager.close(); - } else if (qubely_admin.import_with_global_settings === "never") { - this.props.insertBlocks(JSON.parse(temp)); - ModalManager.close(); - } else if ( - qubely_admin.import_with_global_settings === "manually" || - !qubely_admin.import_with_global_settings || - typeof qubely_admin.import_with_global_settings === "undefined" - ) { - localStorage.setItem("changed", temp); - localStorage.setItem("original", JSON.stringify(pageData)); - this.setState({ isOpen: true }); - } - } else { - insertBlocks(pageData); - ModalManager.close(); - } - - if (rowClientId) { - removeBlock(rowClientId); // remove row block - } - } - }) - .catch((error) => { - requestFailedMsg.push(error.code + " : " + error.message); - this.setState({ - requestFailedMsg, - }); - }); - } - } - - getSectionsList() { - this.setState({ loading: true }); - let requestFailedMsg = []; - let security = qubely_urls.nonce; - let currentUserId = qubely_admin.current_user_id; - - const options = { - method: "POST", - url: - qubely_admin.ajax + - "?action=qubely_get_sections" + - "&security=" + - security + - "&user_id=" + - currentUserId, - headers: { "Content-Type": "application/json" }, - }; - apiFetch(options) - .then((response) => { - if (response.success) { - let blockCategories = [], - blockData = {}; - - response.data.map((item) => { - if (item.category) { - item.category.map((cat) => { - if (cat.slug in blockData) { - blockData[cat.slug].push(item); - } else { - blockData[cat.slug] = []; - blockData[cat.slug].push(item); - } - let index = -1; - blockCategories.forEach((change, i) => { - if (cat.slug == change.slug) { - index = i; - blockCategories[i].count = blockCategories[i].count + 1; - } - }); - if (index === -1) { - blockCategories.push({ name: cat.name, slug: cat.slug, count: 1 }); - } - }); - } - }); - - this.setState({ - loading: false, - blockCategories, - blockData, - }); - - let node = document.querySelector("#modalContainer"); - node.addEventListener("scroll", this._lazyload, true); - this._lazyload(); - } else { - this.setState({ - loading: false, - requestFailedMsg: response.data.message, - }); - } - }) - .catch((error) => { - requestFailedMsg.push(error.code + " : " + error.message); - this.setState({ - loading: false, - requestFailedMsg, - }); - }); - } - - importSavedBlock(block) { - const { insertBlocks, removeBlock, rowClientId } = this.props; - const blocks = parse(block.post_content); - insertBlocks(blocks); - if (rowClientId) { - removeBlock(rowClientId); // remove row block - } - ModalManager.close(); - } - - _onlickBlocksTab() { - let { blockData } = this.state; - if (!blockData) { - this.getSectionsList(); - } - this.setState({ - itemType: "block", - layer: "single", - parent_id: "", - searchContext: "", - priceFilter: "", - }); - } - - _onlickLayoutsTab() { - let { layoutData, layoutCategoryItems } = this.state; - - if (!layoutData) { - this.setState({ loading: true }); - let requestFailedMsg = []; - let security = qubely_urls.nonce; - let currentUserId = qubely_admin.current_user_id; - - const options = { - method: "POST", - url: - qubely_admin.ajax + - "?action=qubely_get_layouts" + - "&security=" + - security + - "&user_id=" + - currentUserId, - headers: { "Content-Type": "application/json" }, - }; - apiFetch(options) - .then((response) => { - if (response.success) { - let layoutCategories = [], - layoutData = {}; - - response.data.map((item) => { - let itemKey = `item${item.parentID}`; - if (layoutCategoryItems.hasOwnProperty(itemKey)) { - layoutCategoryItems[itemKey] += 1; - } else { - layoutCategoryItems[itemKey] = 1; - } - - if (item.category) { - item.category.map((cat) => { - if (cat.slug in layoutData) { - layoutData[cat.slug].push(item); - } else { - layoutData[cat.slug] = []; - layoutData[cat.slug].push(item); - } - let index = -1; - layoutCategories.forEach((change, i) => { - if (cat.slug == change.slug) { - index = i; - if (item.parentID == 0) { - layoutCategories[i].count = layoutCategories[i].count + 1; - } - } - }); - if (index == -1) { - layoutCategories.push({ - name: cat.name, - slug: cat.slug, - count: item.parentID == 0 ? 1 : 0, - }); - } - }); - } - }); - - this.setState({ - loading: false, - layoutCategories, - layoutCategoryItems, - layoutData, - }); - - let node = document.querySelector("#modalContainer"); - node.addEventListener("scroll", this._lazyload, true); - this._lazyload(); - } else { - this.setState({ - loading: false, - requestFailedMsg: response.data.message, - }); - } - }) - .catch((error) => { - requestFailedMsg.push(error.code + " : " + error.message); - this.setState({ - loading: false, - requestFailedMsg, - }); - }); - } - - this.setState({ - itemType: "layout", - layer: "multiple", - parent_id: "", - searchContext: "", - priceFilter: "", - }); - } - - _onlickSavedBlocksTab() { - let requestFailedMsg = []; - let { savedBlocks } = this.state; - let security = qubely_urls.nonce; - let currentUserId = qubely_admin.current_user_id; - - if (!savedBlocks) { - this.setState({ loading: true }); - const options = { - method: "POST", - url: - qubely_admin.ajax + - "?action=qubely_get_saved_block" + - "&security=" + - security + - "&user_id=" + - currentUserId, - headers: { "Content-Type": "application/json" }, - }; - apiFetch(options) - .then((response) => { - this.setState({ - loading: false, - layer: "block", - itemType: "saved_blocks", - savedBlocks: response.data, - searchContext: "", - priceFilter: "", - }); - }) - .catch((error) => { - requestFailedMsg.push(error.code + " : " + error.message); - this.setState({ - loading: false, - requestFailedMsg, - searchContext: "", - priceFilter: "", - }); - }); - } else { - this.setState({ - layer: "block", - itemType: "saved_blocks", - searchContext: "", - priceFilter: "", - }); - } - } - - _onClickSingleEntity(template_id) { - this.setState({ - layer: "single", - parent_id: template_id, - }); - } - - _lazyload() { - let { lazyloadThrottleTimeout } = this.state; - let lazyloadImages = document.querySelectorAll("img.lazy"); - if (lazyloadImages.length) { - if (lazyloadThrottleTimeout) { - this.setState({ - lazyloadThrottleTimeout: clearTimeout(lazyloadThrottleTimeout), - }); - } - let modalContainer = document.querySelector("#modalContainer"); - - lazyloadThrottleTimeout = setTimeout(function () { - let firstElement = document.querySelector("#first-single-item"); - if (firstElement) { - let rect = firstElement.getBoundingClientRect(), - scrollTop = window.pageYOffset || document.documentElement.scrollTop, - scrollTopOffset = Math.abs(rect.top + scrollTop); - - lazyloadImages.forEach(function (img) { - if (img.offsetTop < modalContainer.clientHeight + scrollTopOffset) { - img.src = img.dataset.src; - //img.classList.remove('lazy'); - } - }); - } - - if (lazyloadImages.length == 0) { - modalContainer.removeEventListener("scroll", this._lazyload); - } - }, 20); - } - } - - _OnChangeCategory(value) { - if (this.state.itemType == "block") { - this.setState({ selectedBlockCategory: value }); - } else if (this.state.itemType == "layout") { - this.setState({ selectedLayoutCategory: value }); - } - } - - _sliceCurrentData(data, n = 3, balanced = true) { - if (n < 2) return [data]; - - var len = data.length, - out = [], - i = 0, - size; - - if (len % n === 0) { - size = Math.floor(len / n); - while (i < len) { - out.push(data.slice(i, (i += size))); - } - } else if (balanced) { - while (i < len) { - size = Math.ceil((len - i) / n--); - out.push(data.slice(i, (i += size))); - } - } else { - n--; - size = Math.floor(len / n); - if (len % size === 0) size--; - while (i < size * n) { - out.push(data.slice(i, (i += size))); - } - out.push(data.slice(size * n)); - } - return out; - } - - _OnSearchTemplate(event) { - let { isSearchEnable } = this.state; - isSearchEnable = event.target.value === "" ? false : true; - this.setState({ isSearchEnable, searchContext: event.target.value }); - } - - _backgroundImage(url) { - if (!url) { - return qubely_admin.plugin + "assets/img/qubely-medium.jpg"; - } - return url; - } - - _getDataLength(type, singleCount) { - const { - selectedBlockCategory, - blockCategories, - selectedLayoutCategory, - itemType, - blockData, - layoutCategories, - } = this.state; - let count = 0; - if (type == "heading") { - if (itemType == "block") { - if (selectedBlockCategory == "") { - count = singleCount; - //blockCategories.forEach(function (data) { count = count + data.count; }); - } else { - blockCategories.forEach(function (data) { - if (data.slug == selectedBlockCategory) { - count = data.count; - } - }); - } - return count; - } else { - if (this.state.layer == "multiple") { - if (selectedLayoutCategory == "") { - //layoutCategories.forEach(function (data) { count = count + data.count; }); - count = singleCount; - } else { - layoutCategories.forEach(function (data) { - if (data.slug == selectedLayoutCategory) { - count = data.count; - } - }); - } - return count; - } else { - return singleCount; - } - } - } else { - if (itemType == "block") { - Object.keys(blockData).forEach(function (key) { - count = count + blockData[key].length; - }); - return count; - } else { - layoutCategories.forEach(function (data) { - count = count + data.count; - }); - return count; - } - } - } - - _changePriceFilter(val = "") { - this.setState({ - priceFilter: val ? val : "", - }); - } - - render() { - let { pageCategories, currentPageData } = this.getCurrentPageData(); - let types = qubely_admin.pro_enable ? "active" : "inactive"; - let { itemType, blockData, layer, isOpen, rememberChoice, selectedBlockCategory, selectedLayoutCategory } = - this.state; - - const closeModal = () => this.setState({ isOpen: false }); - - const importBlocks = (actionType) => { - let type = "changed"; - if (actionType === "yes") { - type = "original"; - } - this.props.insertBlocks(JSON.parse(localStorage.getItem(type))); - ModalManager.close(); - if ( - (qubely_admin.import_with_global_settings === "manually" || - !qubely_admin.import_with_global_settings || - typeof qubely_admin.import_with_global_settings === "undefined") && - rememberChoice - ) { - $.post({ - url: qubely_urls.ajax, - data: { - action: "update_qubely_options", - _wpnonce: qubely_urls.nonce, - options: { - import_with_global_settings: actionType === "yes" ? "always" : "never", - }, - }, - }) - .success(function (response) { - qubely_admin["import_with_global_settings"] = actionType === "yes" ? "always" : "never"; - }) - .fail(function (error) { - console.log("error : ", error); - }); - } - }; - return ( - - -
-
- - -
- -
- - - - -
-
- -
-
- {((!(itemType == "layout" && layer == "single") && !(itemType == "saved_blocks")) || - (this.state.parent_id && layer === "single")) &&

Categories

} - {((!this.state.parent_id && layer != "block") || - (this.state.parent_id && layer === "single")) && ( -
    -
  • this._OnChangeCategory("")} - > - {__("All ")} - {itemType == "block" ? "Sections" : "Starter Packs"} - {this._getDataLength("category", currentPageData.length)} -
  • - {pageCategories.map((data, index) => ( -
  • this._OnChangeCategory(data.slug)} - key={index} - > - {data.name} - - {itemType == "block" - ? blockData[data.slug] - ? blockData[data.slug].length - : 0 - : data.count} - -
  • - ))} -
- )} -
-
-
- {itemType != "saved_blocks" && ( -
-

- {this.state.itemType == "layout" && this.state.layer == "single" && ( - this.setState({ layer: "multiple", parent_id: "" })} - > - -   - - )} - {this._getDataLength( - itemType === "layout" && selectedLayoutCategory === "" && layer !== "single" - ? "category" - : "heading", - currentPageData.length - )} -   - {itemType == "block" - ? __("Sections") - : this.state.layer == "single" - ? __("Layouts") - : __("Starter Packs")} -

-
- - - -
-
- )} - - {!this.state.loading ? ( -
-
- {/*
- ( this.state.itemType == 'layout' ) && -
-
    -
  • this.setState( { layer: 'multiple', parent_id: '' } ) } />
  • -
  • this.setState( { layer: 'single' } ) } />
  • -
-
- -
*/} - -
- {this.state.layer == "single" && - this._sliceCurrentData(currentPageData).map((item) => ( -
- {item.map((data, index) => ( - - ))} -
- ))} - - {this.state.layer == "multiple" && - currentPageData.map((data, index) => ( - - ))} - - {this.state.layer == "block" && currentPageData.length != 0 && ( -
-
- {__("Title")} -
-
-
- {__("Publish")}{" "} -
-
-
- )} - - {this.state.layer == "block" && - currentPageData.map((data, index) => ( - - ))} - - {currentPageData.length === 0 && ( -
-

- {" "} - {this.state.notFoundMessage}{" "} -

-
- )} -
-
-
- ) : ( -
-
- {this.state.requestFailedMsg ? ( - this.state.requestFailedMsg.map((error, index) =>

{error}

) - ) : ( -
- -
- )} - {/**/} -
-
- )} -
-
- {isOpen && - (qubely_admin.import_with_global_settings === "manually" || - !qubely_admin.import_with_global_settings || - typeof qubely_admin.import_with_global_settings === "undefined") && ( - -
-
{__("Apply global styling while importing this?")}
-
-
- - this.setState((state) => { - return { rememberChoice: !state.rememberChoice }; - }) - } - /> - -
-
-
{ - importBlocks("no"); - }} - > - {__("No")} -
-
{ - importBlocks("yes"); - }} - > - {__("Yes")} -
-
-
-
-
- )} -
- ); - } -} - -export default compose([ - withDispatch((dispatch) => { - const { insertBlocks, removeBlock } = dispatch("core/block-editor"); - - return { - insertBlocks, - removeBlock, - }; - }), -])(PageListModal); diff --git a/assets/reactjs/src/helpers/components/MultipleItem.js b/assets/reactjs/src/helpers/components/MultipleItem.js deleted file mode 100755 index a44084be..00000000 --- a/assets/reactjs/src/helpers/components/MultipleItem.js +++ /dev/null @@ -1,23 +0,0 @@ -const { __ } = wp.i18n; -export default (props) => { - return ( -
-
props.onClickSingleEntity(props.data.ID)}> -
- {__("Default - {props.data.pro && {__("Pro")} } -
-
-
- - {props.totalLayouts} {__("Layouts")} - -
-
-
- ); -}; diff --git a/assets/reactjs/src/helpers/components/ReusableBlockItem.js b/assets/reactjs/src/helpers/components/ReusableBlockItem.js deleted file mode 100755 index b2245e42..00000000 --- a/assets/reactjs/src/helpers/components/ReusableBlockItem.js +++ /dev/null @@ -1,31 +0,0 @@ -const { __ } = wp.i18n; -export default (props) => { - return ( -
-
- -
-
-
16 Feb 2019
-
- - -
-
-
- ); -}; diff --git a/assets/reactjs/src/helpers/components/SingleItem.js b/assets/reactjs/src/helpers/components/SingleItem.js deleted file mode 100755 index 05218be3..00000000 --- a/assets/reactjs/src/helpers/components/SingleItem.js +++ /dev/null @@ -1,70 +0,0 @@ -const { __ } = wp.i18n; -const { Fragment } = wp.element; - -export default (props) => { - return ( -
-
-
- {__("Lazy - {props.data.pro && {__("Pro")}} -
- {/* qubely-default-template-image */} -
-
- {props.itemType != "comming" ? ( - - {props.data.liveurl && ( - - {__("Preview")}{" "} - - )} - {props.types == "inactive" && props.data.pro == true ? ( - - {__("Upgrade to Pro")} - - ) : ( - { - props.importLayoutBlock(props.data, props.data.pro); - }} - > - {props.spinner == props.data.ID ? ( - - ) : ( - - )} - {__("Import")} - - )} - - ) : ( -
- {__("Coming Soon.")} -
- )} -
- {/* qubely-import-button-group */} -
- {/* qubely-tmpl-info */} -
- {/* qubely-single-item-inner */} -

-

- ); -}; diff --git a/assets/reactjs/src/helpers/globalCSS.js b/assets/reactjs/src/helpers/globalCSS.js index c276bb5a..d1206cfd 100644 --- a/assets/reactjs/src/helpers/globalCSS.js +++ b/assets/reactjs/src/helpers/globalCSS.js @@ -1,6 +1,5 @@ const PATH = "/qubely/v1/global_settings"; -import { _device, _push } from "../components/CssHelper"; -import { DEFAULTPRESETS, DEFAULTBREAKINGPOINTS } from "../plugins/global-settings/constants"; +import { DEFAULTBREAKINGPOINTS, DEFAULTPRESETS } from "../plugins/global-settings/constants"; async function fetchFromApi() { return await wp.apiFetch({ path: PATH }); } diff --git a/assets/reactjs/src/index.js b/assets/reactjs/src/index.js index 0dc4626f..0ffa6c9a 100644 --- a/assets/reactjs/src/index.js +++ b/assets/reactjs/src/index.js @@ -4,40 +4,40 @@ const { render } = wp.element; import "./components/FieldRender"; import "./components/format-library"; -import "./editor.scss"; import "./blocks/scss/style.scss"; +import "./editor.scss"; -import "./blocks/row"; // Row -import "./blocks/row/column"; // Column +import "./blocks/accordion"; // Accordion +import "./blocks/advancedlist"; // Advanced List +import "./blocks/animatedheadline"; // Animated Headline import "./blocks/button"; // Button -import "./blocks/text"; // Text -import "./blocks/icon"; // Icon -import "./blocks/map"; // Map +import "./blocks/buttongroup"; // Button Group +import "./blocks/contactform"; // Contact Form +import "./blocks/counter"; // counter import "./blocks/divider"; // Divider -import "./blocks/infobox"; // Info Box -import "./blocks/image"; // Image -import "./blocks/testimonial"; // Testimonial -import "./blocks/accordion"; // Accordion import "./blocks/heading"; // Heading Box -import "./blocks/videopopup"; // Video popup +import "./blocks/icon"; // Icon +import "./blocks/iconlist"; // Icon List +import "./blocks/image"; // Image +import "./blocks/image-comparison"; // image-comparison +import "./blocks/infobox"; // Info Box +import "./blocks/map"; // Map +import "./blocks/pieprogress"; // PieProgress +import "./blocks/postgrid"; // Postgrid +import "./blocks/pricing"; // pricing import "./blocks/progressbar"; // Progress Bar -import "./blocks/counter"; // counter +import "./blocks/row"; // Row +import "./blocks/row/column"; // Column +import "./blocks/socialicons"; // Social Icons +import "./blocks/table-of-contents"; import "./blocks/tabs"; // Tabs import "./blocks/tabs/tab"; // Inner Tabs -import "./blocks/socialicons"; // Social Icons -import "./blocks/contactform"; // Contact Form -import "./blocks/buttongroup"; // Button Group -import "./blocks/advancedlist"; // Advanced List -import "./blocks/iconlist"; // Icon List -import "./blocks/wrapper"; // Wrapper import "./blocks/team"; // Team -import "./blocks/pricing"; // pricing +import "./blocks/testimonial"; // Testimonial +import "./blocks/text"; // Text import "./blocks/timeline"; // Timeline -import "./blocks/postgrid"; // Postgrid -import "./blocks/animatedheadline"; // Animated Headline -import "./blocks/pieprogress"; // PieProgress -import "./blocks/table-of-contents"; -import "./blocks/image-comparison"; // image-comparison +import "./blocks/videopopup"; // Video popup +import "./blocks/wrapper"; // Wrapper import "./plugins"; @@ -114,22 +114,4 @@ wp.blocks.updateCategory("qubely", { ), }); -import { ImportButton } from "./components/others"; - -wp.domReady(function () { - setTimeout(function () { - const toolbar = document.querySelector(".edit-post-header__toolbar"); - const toolbarChild = document.querySelector(".edit-post-header-toolbar"); - - if (!toolbar) { - return; - } - const qubelyImportWrapper = document.createElement("div"); - qubelyImportWrapper.classList.add("qubely-import-button-wrapper"); - if (!toolbar.querySelector(".qubely-import-button-wrapper")) { - render(, qubelyImportWrapper); - toolbar.insertBefore(qubelyImportWrapper, toolbarChild); - } - }, 100); -}); diff --git a/assets/reactjs/src/plugins/global-settings/index.js b/assets/reactjs/src/plugins/global-settings/index.js index 247b43ea..44d4c74c 100644 --- a/assets/reactjs/src/plugins/global-settings/index.js +++ b/assets/reactjs/src/plugins/global-settings/index.js @@ -79,7 +79,7 @@ class GlobalSettings extends Component { } }); } - // this.getGlobalSettings(); + this.getGlobalSettings(); let hasExistingValues = true; fetchFromApi().then((data) => { if (data.success) { @@ -235,46 +235,46 @@ class GlobalSettings extends Component { } } - // getGlobalSettings = () => { - // let hasExistingValues = true; - // return fetchFromApi().then(data => { - // if (qubely_admin.is_core_active && this.state.savedMeta && ( - // this.state.savedMeta.key !== data.settings.activePreset || - // Object.keys(diff({ 'colors': data.settings.presets[data.settings.activePreset].colors }, { 'colors': this.state.savedMeta.colors })).length > 0 || - // Object.keys(diff({ 'typography': data.settings.presets[data.settings.activePreset].typography }, { 'typography': this.state.savedMeta.typography })).length > 0 || - // Object.keys(diff({ 'breakingPoints': data.settings.breakingPoints }, { 'breakingPoints': this.state.savedMeta.breakingPoints })).length > 0 - // )) { - // console.log('preset changed'); - // this.setState({ isPresetChanged: true, showModal: true }); - // } else { - // console.log('same preset'); - // this.setState({ isPresetChanged: false }); - // } - // if (data.success) { - // if (Object.keys(data.settings).length === 0) { - // hasExistingValues = false - // this.updateGlobalSettings(); - // } - // if (data.settings.activePreset !== 'theme') { - // this.saveGlobalCSS(); - // } - // this.setState({ ...data.settings }); - // localStorage.setItem('qubely-global-settings', JSON.stringify({ - // ...DEFAULTPRESETS.presets[DEFAULTPRESETS.activePreset], - // breakingPoints: { - // ...this.state.breakingPoints, - // ...(typeof qubely_container_width !== undefined && qubely_container_width), - // ...((hasExistingValues && typeof data.settings.breakingPoints !== 'undefined') & data.settings.breakingPoints) - // }, - // ...((hasExistingValues && typeof data.settings.presets !== 'undefined' && typeof data.settings.activePreset !== 'undefined') & data.settings.presets[data.settings.activePreset]), + getGlobalSettings = () => { + let hasExistingValues = true; + return fetchFromApi().then(data => { + if (qubely_admin.is_core_active && this.state.savedMeta && ( + this.state.savedMeta.key !== data.settings.activePreset || + Object.keys(diff({ 'colors': data.settings.presets[data.settings.activePreset].colors }, { 'colors': this.state.savedMeta.colors })).length > 0 || + Object.keys(diff({ 'typography': data.settings.presets[data.settings.activePreset].typography }, { 'typography': this.state.savedMeta.typography })).length > 0 || + Object.keys(diff({ 'breakingPoints': data.settings.breakingPoints }, { 'breakingPoints': this.state.savedMeta.breakingPoints })).length > 0 + )) { + console.log('preset changed'); + this.setState({ isPresetChanged: true, showModal: true }); + } else { + console.log('same preset'); + this.setState({ isPresetChanged: false }); + } + if (data.success) { + if (Object.keys(data.settings).length === 0) { + hasExistingValues = false + this.updateGlobalSettings(); + } + if (data.settings.activePreset !== 'theme') { + this.saveGlobalCSS(); + } + this.setState({ ...data.settings }); + localStorage.setItem('qubely-global-settings', JSON.stringify({ + ...DEFAULTPRESETS.presets[DEFAULTPRESETS.activePreset], + breakingPoints: { + ...this.state.breakingPoints, + ...(typeof qubely_container_width !== undefined && qubely_container_width), + ...((hasExistingValues && typeof data.settings.breakingPoints !== 'undefined') & data.settings.breakingPoints) + }, + ...((hasExistingValues && typeof data.settings.presets !== 'undefined' && typeof data.settings.activePreset !== 'undefined') & data.settings.presets[data.settings.activePreset]), - // })) - // } else { - // this.setState({ ...DEFAULTPRESETS }); - // this.updateGlobalSettings() - // } - // }); - // } + })) + } else { + this.setState({ ...DEFAULTPRESETS }); + this.updateGlobalSettings() + } + }); + } restoreSavedpreset(savedMeta) { const { key, name, colors, typography, breakingPoints } = savedMeta; diff --git a/core/Options.php b/core/Options.php index 75ee82d0..66a414a1 100644 --- a/core/Options.php +++ b/core/Options.php @@ -1,8 +1,10 @@ settings = new QUBELY_Settings(); } @@ -27,18 +30,15 @@ public function init() { */ public function admin_menu() { - require __DIR__ . '/admin-views/Getting_Started.php'; - $getting_started = new QUBELY_Getting_Started(); - $parent_slug = 'qubely-settings'; - $cap = 'manage_options'; + $cap = 'manage_options'; add_menu_page( esc_html__('Qubely', 'qubely'), esc_html__('Qubely', 'qubely'), $cap, $parent_slug, - array($this->settings, 'markup'), + [$this->settings, 'markup'], QUBELY_DIR_URL . 'assets/img/qubely-logo-white.svg' ); @@ -48,17 +48,9 @@ public function admin_menu() esc_html__('Settings', 'qubely'), $cap, 'qubely-settings', - array($this->settings, 'markup') + [$this->settings, 'markup'] ); - add_submenu_page( - $parent_slug, - esc_html__('Getting Started', 'qubely'), - esc_html__('Getting Started', 'qubely'), - $cap, - 'qubely', - array($getting_started, 'markup') - ); } } } diff --git a/core/QUBELY.php b/core/QUBELY.php index 4c4abf47..3d548bf7 100644 --- a/core/QUBELY.php +++ b/core/QUBELY.php @@ -1,817 +1,833 @@ qubely_api_request_body_default = array( - 'request_from' => 'qubely', - // 'request_qubely_version' => QUBELY_VERSION, - ); - $this->qubely_api_request_body = apply_filters( 'qubely_api_request_body', array() ); - - // Editor Load - add_action( 'enqueue_block_editor_assets', array( $this, 'qubely_editor_assets' ) ); - - // Editor Load - add_action( 'admin_enqueue_scripts', array( $this, 'qubely_admin_assets' ) ); - - // Block Categories - if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { - add_filter( 'block_categories_all', array( $this, 'qubely_block_categories' ), 1, 2 ); - } else { - add_filter( 'block_categories', array( $this, 'qubely_block_categories' ), 1, 2 ); - } - - // Add Styles and Scripts - add_action( 'wp_enqueue_scripts', array( $this, 'qubely_enqueue_style' ) ); - - add_action( 'wp_enqueue_scripts', array( $this, 'qubely_enqueue_scripts' ) ); - - // Load Inline Scripts - add_action( 'admin_head', array( $this, 'qubely_inline_admin_header_scripts' ), 0 ); - add_action( 'wp_footer', array( $this, 'qubely_inline_footer_scripts' ) ); - - // Add post meta key - $this->add_global_settings_post_meta(); - - // Common style - - $this->enqueue_block_css(); - - add_action( 'rest_api_init', array( $this, 'register_api_hook' ) ); - add_action( 'delete_post', array( $this, 'before_delete_post' ), 10 ); - - // Get layout and block from Server and Cache - add_action( 'wp_ajax_qubely_get_sections', array( $this, 'qubely_get_sections' ) ); - add_action( 'wp_ajax_qubely_get_layouts', array( $this, 'qubely_get_layouts' ) ); - - add_action( 'wp_ajax_qubely_get_single_layout', array( $this, 'qubely_get_single_layout' ) ); - add_action( 'wp_ajax_qubely_get_single_block', array( $this, 'qubely_get_single_section' ) ); - - add_action( 'wp_ajax_qubely_get_saved_block', array( $this, 'qubely_get_saved_block' ) ); - add_action( 'wp_ajax_qubely_delete_saved_block', array( $this, 'qubely_delete_saved_block' ) ); - - add_action( 'wp_ajax_qubely_send_form_data', array( $this, 'qubely_send_form_data' ) ); - add_action( 'wp_ajax_nopriv_qubely_send_form_data', array( $this, 'qubely_send_form_data' ) ); - - add_action( 'wp_ajax_qubely_add_to_cart', array( $this, 'qubely_add_to_cart' ) ); - add_action( 'wp_ajax_nopriv_qubely_add_to_cart', array( $this, 'qubely_add_to_cart' ) ); - // dynamic blocks - add_action( 'init', array( $this, 'init_dynamic_blocks' ) ); - - // qubely admin class - add_filter( 'admin_body_class', array( $this, 'qubely_editor_bodyclass' ) ); - - add_filter( 'body_class', array( $this, 'add_custom_class' ) ); - - // qubely global container width - add_action( 'wp_enqueue_scripts', array( $this, 'qubely_global_container_width' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'qubely_global_container_width' ) ); - - add_action( 'qubely_active_theme_preset', array( $this, 'active_theme_preset' ) ); - - } - - /** - * Theme preset activation hook - */ - public function active_theme_preset() { - $settings = json_decode( get_option( $this->option_keyword ) ); - $settings->activePreset = 'theme'; - $settings = json_encode( $settings ); - update_option( $this->option_keyword, $settings ); - } - - /** - * Qubely Container Width - */ - public function qubely_global_container_width() { - $default = array( - 'sm' => apply_filters( 'qubely_container_sm', 540 ), - 'md' => apply_filters( 'qubely_container_md', 720 ), - 'lg' => apply_filters( 'qubely_container_lg', 960 ), - 'xl' => apply_filters( 'qubely_container_xl', 1140 ), - ); - - $container = wp_parse_args( apply_filters( 'qubely_container_width', $default ), $default ); - wp_register_script( 'qubely_container_width', '' ); - wp_localize_script( 'qubely_container_width', 'qubely_container_width', $container ); - wp_enqueue_script( 'qubely_container_width' ); - } - - /** - * Qubely editor body class - * - * @param string|mixed $classes - * - * @return string|mixed $classes - */ - public function qubely_editor_bodyclass( $classes ) { - - $current_screen = get_current_screen(); - - if ( 'post' == $current_screen->base ) { - $classes .= 'qubely qubely-editor'; - } - return $classes; - } - - /** - * Add custom classes - * - * @param array $classes - * - * @return array $classes - */ - public function add_custom_class( $classes ) { - return array_merge( $classes, array( 'qubely qubely-frontend' ) ); - } - - /** - * Create preview CSS - */ - public function create_preview_css() { - - global $wp_filesystem; - if ( ! $wp_filesystem ) { - require_once ABSPATH . 'wp-admin/includes/file.php'; - } - $upload_dir = wp_upload_dir(); - WP_Filesystem( false, $upload_dir['basedir'], true ); - $dir = trailingslashit( $upload_dir['basedir'] ) . 'qubely/'; - - $filename = "qubely-preview.css"; - $jsonfilename = "qubely-preview.json"; - - if ( ! $wp_filesystem->is_dir( $dir ) ) { - $wp_filesystem->mkdir( $dir ); - } - - if ( ! file_exists( $dir . $filename ) ) { - if ( ! $wp_filesystem->put_contents( $dir . $filename, '' ) ) { - throw new Exception( __( 'Prevriew CSS can not be saved due to permission!!!', 'qubely' ) ); - } - } - if ( ! file_exists( $dir . $jsonfilename ) ) { - if ( ! $wp_filesystem->put_contents( $dir . $jsonfilename, '{}' ) ) { - throw new Exception( __( 'Preview JSON can not be saved due to permission!!!', 'qubely' ) ); - } - } - } - - /** - * Init dynamic blocks frontend - */ - public function init_dynamic_blocks() { - require_once QUBELY_DIR_PATH . 'core/blocks/postgrid.php'; - $this->create_preview_css(); - } - - /** - * Load Editor Styles and Scripts - * - * @since 1.0.0 - */ - public function qubely_editor_assets() { - global $pagenow; - - if ( 'widgets.php' !== $pagenow ) { - wp_enqueue_script( 'qubely-blocks-js', QUBELY_DIR_URL . 'assets/js/qubely.dev.js', array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ), QUBELY_VERSION, true ); - } - - $palette = get_theme_support( 'qubely-color-palette' ); - $palette = array_replace( array( '#062040', '#566372', '#2084F9', '#F3F3F3', '#EEEEEE', '#FFFFFF' ), ( $palette ? $palette[0] : array() ) ); - - $options = get_option( 'qubely_options' ); - $qubely_gmap_api_key = isset( $options['qubely_gmap_api_key'] ) ? sanitize_text_field( $options['qubely_gmap_api_key'] ) : ''; - $qubely_recaptcha_site_key = isset( $options['qubely_recaptcha_site_key'] ) ? sanitize_text_field( $options['qubely_recaptcha_site_key'] ) : ''; - $mc_key = isset( $options['mailchimp_api_key'] ) ? sanitize_text_field( $options['mailchimp_api_key'] ) : ''; - $qubely_recaptcha_secret_key = isset( $options['qubely_recaptcha_secret_key'] ) ? sanitize_text_field( $options['qubely_recaptcha_secret_key'] ) : ''; - $enable_global_settings = isset( $options['import_with_global_settings'] ) ? sanitize_text_field( $options['import_with_global_settings'] ) : false; - $protocols = array( 'http://', 'https://', 'http://www', 'https://www', 'www' ); - wp_localize_script( - 'qubely-blocks-js', - 'qubely_admin', - array( - 'plugin' => QUBELY_DIR_URL, - 'ajax' => admin_url( 'admin-ajax.php' ), - 'pro_enable' => defined( 'QUBELY_PRO_VERSION' ) ? true : false, - 'shapes' => $this->getSvgShapes(), - 'post_type' => self::get_post_types(), - 'all_taxonomy' => $this->get_all_taxonomy(), - 'image_sizes' => $this->get_all_image_sizes(), - 'palette' => $palette, - 'overwriteTheme' => true, - 'current_user_id' => get_current_user_id(), - 'qubely_gmap_api_key' => $qubely_gmap_api_key, - 'qubely_recaptcha_site_key' => $qubely_recaptcha_site_key, - 'qubely_recaptcha_secret_key' => $qubely_recaptcha_secret_key, - 'site_url' => site_url(), - 'admin_url' => admin_url(), - 'actual_url' => str_replace( $protocols, '', site_url() ), - 'import_with_global_settings' => $enable_global_settings, - 'publishedPosts' => wp_count_posts()->publish, - 'mc_key' => $mc_key, - 'is_core_active' => is_plugin_active( 'qubely-core/qubely-core.php' ), - ) - ); - } - - /** - * Load SvgShapes - * - * @since 1.0.0 - */ - public function getSvgShapes() { - $shape_path = QUBELY_DIR_PATH . 'assets/shape'; - $shapes = glob( $shape_path . '/*.svg' ); - $shapeArray = array(); - if ( count( $shapes ) ) { - foreach ( $shapes as $shape ) { - $shapeArray[ str_replace( array( '.svg', $shape_path . '/' ), '', $shape ) ] = file_get_contents( $shape ); - } - } - return $shapeArray; - } - - /** - * Load SvgShapes - * - * @since 1.0.0 - */ - public function getSvgDivider() { - $divider_path = QUBELY_DIR_PATH . 'assets/divider'; - $dividers = glob( $divider_path . '/*.svg' ); - $dividerArray = array(); - if ( count( $dividers ) ) { - foreach ( $dividers as $divider ) { - $dividerArray[ str_replace( array( '.svg', $divider_path . '/' ), '', $divider ) ] = file_get_contents( $divider ); - } - } - return $dividerArray; - } - - /** - * Parse all blocks - * - * * @since 1.6.5 - */ - public function parse_all_blocks() { - $blocks; - if ( is_single() || is_page() || is_404() ) { - global $post; - if ( is_object( $post ) && property_exists( $post, 'post_content' ) ) { - $blocks = parse_blocks( $post->post_content ); - } - } elseif ( is_archive() || is_home() || is_search() ) { - global $wp_query; - foreach ( $wp_query as $post ) { - if ( is_object( $post ) && property_exists( $post, 'post_content' ) ) { - $blocks = parse_blocks( $post->post_content ); - } - } - } - return $blocks; - } - - /** - * Load font-awesome CSS - * - * * @since 1.6.5 - */ - public function qubely_load_fontawesome() { - $option_data = get_option( 'qubely_options' ); - $load_font_awesome = isset( $option_data['load_font_awesome_CSS'] ) ? sanitize_text_field( $option_data['load_font_awesome_CSS'] ) : 'yes'; - if ( $load_font_awesome == 'yes' ) { - $blocks = $this->parse_all_blocks(); - $contains_qubely_blocks = $this->has_blocks_with_fontawesome( $blocks ); - if ( $contains_qubely_blocks ) { - } - wp_enqueue_style( 'qubely-font-awesome', QUBELY_DIR_URL . 'assets/css/font-awesome.min.css', false, QUBELY_VERSION ); - } - } - - public function colsFromArray( array $array, $keys ) { - if ( ! is_array( $keys ) ) $keys = [ $keys ]; - return array_map( function ( $el ) use ( $keys ) { - $o = []; - foreach( $keys as $key ) { - // if(isset($el[$key]))$o[$key] = $el[$key]; //you can do it this way if you don't want to set a default for missing keys. - $o[ $key ] = isset( $el[ $key ] ) ? $el[ $key ] : false; - } - return $o; - }, $array ); - } - - /** - * Get block google fonts - */ - public function gather_block_fonts( $blocks,$block_fonts ) { - $google_fonts = $block_fonts; - foreach ( $blocks as $key => $block ) { - if ( strpos( $block['blockName'], 'qubely' ) !== false ) { - foreach ( $block['attrs'] as $key => $att ) { - if ( gettype( $att ) == 'array' && isset( $att['openTypography'] ) && isset( $att['family'] ) ) { - if ( isset( $block['attrs'][ $key ]['activeSource'] ) ) { - if ( $block['attrs'][ $key ]['activeSource'] == 'custom' ) { - array_push( $google_fonts,$block['attrs'][ $key ]['family'] ); - } - } else { - array_push( $google_fonts,$block['attrs'][ $key ]['family'] ); - } - } - } - } - if ( isset( $block['innerBlocks'] ) && gettype( $block['innerBlocks'] ) == 'array' && count( $block['innerBlocks'] ) > 0 ) { - $child_fonts = $this->gather_block_fonts( $block['innerBlocks'], $google_fonts ); - if ( count( $child_fonts ) > 0 ) { - $google_fonts= array_merge( $google_fonts, $child_fonts ); - } - } - } - return array_unique( $google_fonts ); - } - - /** - * Check whether post contains - * any qubely blocks - * - * @param array $blocks - * - * @return bool - */ - public function has_qubely_blocks( $blocks ) { - $is_qubely_block = false; - foreach ( $blocks as $key => $block ) { - if ( strpos( $block['blockName'], 'qubely' ) !== false ) { - $is_qubely_block = true; - } - if ( isset( $block['innerBlocks'] ) && gettype( $block['innerBlocks'] ) == 'array' && count( $block['innerBlocks'] ) > 0 ) { - $is_qubely_block = $this->has_qubely_blocks( $block['innerBlocks'] ); - } - } - return $is_qubely_block; - } - - /** - * Check whether post contains - * any qubely blocks with Font-awesome - * - * @param array $blocks - * - * @return bool - */ - public function has_blocks_with_fontawesome( $blocks ) { - $has_fontawesome_block = false; - $target_blocks = array( - 'qubely/icon', - 'qubely/accordion', - 'qubely/advancedlist', - 'qubely/iconlist', - 'qubely/infobox', - 'qubely/pricing', - 'qubely/socialicons', - 'qubely/tabs', - 'qubely/timeline', - 'qubely/testimonial', - 'qubely/team', - 'qubely/woocarousel', - 'qubely/testimonialcarousel', - 'qubely/teamcarousel', - 'qubely/table', - 'qubely/postcarousel', - 'qubely/imagecarousel', - 'qubely/verticaltabs', - 'qubely/form', - 'qubely/button', - 'qubely/buttongroup', - 'qubely/table-of-contents', - 'qubely/videopopup', - 'qubely/pieprogress', - 'qubely/wooproducts', - 'qubely/postgrid', - 'qubely/contactform', - 'core/block', - ); - foreach ( $blocks as $key => $block ) { - if ( in_array( $block['blockName'], $target_blocks, true ) ) { - $has_fontawesome_block = true; - } - if ( $has_fontawesome_block == false && isset( $block['innerBlocks'] ) && gettype( $block['innerBlocks'] ) == 'array' && count( $block['innerBlocks'] ) > 0 ) { - $has_fontawesome_block = $this->has_blocks_with_fontawesome( $block['innerBlocks'] ); - } - } - return $has_fontawesome_block; - } - - /** - * Load Google fonts - * - * @since 1.6.5 - */ - public function qubely_load_googlefonts() { - //Global settings fonts - $blocks; - $contains_qubely_blocks = false; - $block_fonts = []; - $option_data = get_option( 'qubely_options' ); - $load_google_fonts = isset( $option_data['load_google_fonts'] ) ? sanitize_text_field( $option_data['load_google_fonts'] ) : 'yes'; - - if ( $load_google_fonts == 'yes' ) { - $blocks = $this->parse_all_blocks(); - $contains_qubely_blocks = $this->has_qubely_blocks( $blocks ); - - if ( $contains_qubely_blocks ) { - $block_fonts = $this->gather_block_fonts( $blocks, $block_fonts ); - $global_settings = get_option( $this->option_keyword ); - $global_settings = $global_settings == false ? json_decode( '{}' ) : json_decode( $global_settings ); - $global_settings = json_decode( json_encode( $global_settings ), true ); - $gfonts = ''; - $all_global_fonts = array(); - if ( isset( $global_settings['presets'] ) && isset( $global_settings['presets'][ $global_settings['activePreset'] ] ) && isset( $global_settings['presets'][ $global_settings['activePreset'] ]['typography'] ) ) { - $all_global_fonts = $this->colsFromArray( array_column( $global_settings['presets'][ $global_settings['activePreset'] ]['typography'], 'value' ), ['family', 'weight'] ); - } - if ( count( $all_global_fonts ) > 0 ) { - $global_fonts = array_column( $all_global_fonts, 'family' ); - - $all_fonts = array_unique( array_merge( $global_fonts, $block_fonts ) ); - - if ( ! empty( $all_fonts ) ) { - $system = array( - 'Arial', - 'Tahoma', - 'Verdana', - 'Helvetica', - 'Times New Roman', - 'Trebuchet MS', - 'Georgia', - ); - - $gfonts_attr = ':100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic'; - - foreach ( $all_fonts as $font ) { - if ( ! in_array( $font, $system, true ) && ! empty( $font ) ) { - $gfonts .= str_replace( ' ', '+', trim( $font ) ) . $gfonts_attr . '|'; - } - } - } - - if ( ! empty( $gfonts ) ) { - $query_args = array( - 'family' => $gfonts, - ); - - wp_register_style( - 'qubely-google-fonts', - add_query_arg( $query_args, '//fonts.googleapis.com/css' ), - array(), - QUBELY_VERSION - ); - wp_enqueue_style( 'qubely-google-fonts' ); - } - } - } - } - } - - /** - * Admin Style & Script - * - * @since 1.0.0 - */ - public function qubely_admin_assets() { - wp_register_script( 'qubely_local_script', '' ); - wp_localize_script( - 'qubely_local_script', - 'qubely_urls', - array( - 'plugin' => QUBELY_DIR_URL, - 'ajax' => admin_url( 'admin-ajax.php' ), - 'nonce' => wp_create_nonce( 'qubely_nonce' ), - ) - ); - wp_enqueue_script( 'qubely_local_script' ); - - #START_REPLACE - wp_enqueue_style( 'qubley-animated-headline-style', QUBELY_DIR_URL . 'assets/css/qubely.animatedheadline.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-animation', QUBELY_DIR_URL . 'assets/css/animation.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-magnific-popup-style', QUBELY_DIR_URL . 'assets/css/magnific-popup.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-style-min', QUBELY_DIR_URL . 'assets/css/style.min.css', false, QUBELY_VERSION ); - #END_REPLACE - - wp_enqueue_style( 'qubely-font-awesome', QUBELY_DIR_URL . 'assets/css/font-awesome.min.css', false, QUBELY_VERSION ); - - wp_enqueue_script( 'qubely-magnific-popup', QUBELY_DIR_URL . 'assets/js/qubely.magnific-popup.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_enqueue_script( 'jquery-animatedHeadline', QUBELY_DIR_URL . 'assets/js/jquery.animatedheadline.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_enqueue_script( 'qubely-block-map', QUBELY_DIR_URL . 'assets/js/blocks/map.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_enqueue_script( 'qubely-block-contactform', QUBELY_DIR_URL . 'assets/js/blocks/contactform.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_enqueue_script( 'qubely-block-common', QUBELY_DIR_URL . 'assets/js/common-script.js', array( 'jquery' ), QUBELY_VERSION, true ); - - wp_register_style( 'qubely-options', QUBELY_DIR_URL . 'assets/css/options.css', false, QUBELY_VERSION ); - } - - /** - * Get Post Types. - * - * @since 1.0.9 - */ - public static function get_post_types() { - $post_types = get_post_types( - array( - 'public' => true, - 'show_in_rest' => true, - ), - 'objects' - ); - - $options = array(); - - foreach ( $post_types as $post_type ) { - if ( 'product' === $post_type->name ) { - continue; - } - - if ( 'attachment' === $post_type->name ) { - continue; - } - - if ( 'page' === $post_type->name ) { - continue; - } - - $options[] = array( - 'value' => $post_type->name, - 'label' => $post_type->label, - ); - } - - return $options; - } - - /** - * Get all taxonomies. - * - * @since 1.0.9 - */ - public static function get_all_taxonomy() { - $post_types = self::get_post_types(); - - $taxonomy_array = array(); - - foreach ( $post_types as $value ) { - $post_type = $value['value']; - - $taxonomies = get_object_taxonomies( $post_type, 'objects' ); - $data = array(); - - foreach ( $taxonomies as $tax_slug => $tax ) { - if ( ! $tax->public || ! $tax->show_ui ) { - continue; - } - - $data[ $tax_slug ] = $tax; - - $terms = get_terms( $tax_slug ); - - $related_tax = array(); - - if ( ! empty( $terms ) ) { - foreach ( $terms as $term ) { - $related_tax[] = array( - 'value' => $term->term_id, - 'label' => $term->name, - ); - } - - $taxonomy_array[ $post_type ]['terms'][ $tax_slug ] = $related_tax; - } - } - $taxonomy_array[ $post_type ]['taxonomy'] = $data; - } - - return $taxonomy_array; - } - - /** - * Get all image sizes. - * - * @since 1.0.9 - */ - public static function get_all_image_sizes() { - global $_wp_additional_image_sizes; - - $sizes = get_intermediate_image_sizes(); - $image_sizes = array(); - - $image_sizes[] = array( - 'value' => 'full', - 'label' => esc_html__( 'Full', 'qubely' ), - ); - - foreach ( $sizes as $size ) { - if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) { - $image_sizes[] = array( - 'value' => $size, - 'label' => ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) ), - ); - } else { - $image_sizes[] = array( - 'value' => $size, - 'label' => sprintf( - '%1$s (%2$sx%3$s)', - ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) ), - $_wp_additional_image_sizes[ $size ]['width'], - $_wp_additional_image_sizes[ $size ]['height'] - ), - ); - } - } - return $image_sizes; - } - - /** - * Frontend Style & Script - * - * @since 1.0.0 - */ - public function qubely_enqueue_style() { - if ( get_post_meta( get_the_ID(), '_qubely_css', true ) != '' ) { - - /* - * @warning: Don't Remove `START_REPLACE` and `START_REPLACE` comments. These comments are required for gulp build - */ - - #START_REPLACE - wp_enqueue_style( 'qubley-animated-headline-style', QUBELY_DIR_URL . 'assets/css/qubely.animatedheadline.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-animation', QUBELY_DIR_URL . 'assets/css/animation.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-magnific-popup-style', QUBELY_DIR_URL . 'assets/css/magnific-popup.css', false, QUBELY_VERSION ); - wp_enqueue_style( 'qubely-style-min', QUBELY_DIR_URL . 'assets/css/style.min.css', false, QUBELY_VERSION ); - #END_REPLACE - - - $this->qubely_load_fontawesome(); - $this->qubely_load_googlefonts(); - } - } - - // Check if a block is in reusable - public function has_block_in_reusable( $block_name, $id = false ){ - $id = (!$id) ? get_the_ID() : $id; - if( $id ){ - if ( has_block( 'block', $id ) ){ - // Check reusable blocks - $content = get_post_field( 'post_content', $id ); - $blocks = parse_blocks( $content ); - - if ( ! is_array( $blocks ) || empty( $blocks ) ) { - return false; - } - - foreach ( $blocks as $block ) { - if ( $block['blockName'] === 'core/block' && ! empty( $block['attrs']['ref'] ) ) { - if( has_block( $block_name, $block['attrs']['ref'] ) ){ - return true; - } - } - } - } - } - - return false; - } - - public function qubely_enqueue_scripts() { - wp_register_script( 'qubely_local_script', '' ); - $protocols = array( 'http://', 'https://', 'http://www', 'https://www', 'www' ); - wp_localize_script( - 'qubely_local_script', - 'qubely_urls', - array( - 'plugin' => QUBELY_DIR_URL, - 'ajax' => admin_url( 'admin-ajax.php' ), - 'nonce' => wp_create_nonce( 'qubely_nonce' ), - 'actual_url' => str_replace( $protocols, '', site_url() ), - ) - ); - wp_enqueue_script( 'qubely_local_script' ); - - $blocks_meta_data = get_post_meta( get_the_ID(), '__qubely_available_blocks', true ); - $blocks_meta_data = maybe_unserialize( $blocks_meta_data ); - - /** - * register scripts - */ - wp_register_script( 'qubley-animated-headline-script', QUBELY_DIR_URL . 'assets/js/jquery.animatedheadline.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_register_script( 'qubely-block-map', QUBELY_DIR_URL . 'assets/js/blocks/map.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_register_script( 'qubely-magnific-popup-script', QUBELY_DIR_URL . 'assets/js/qubely.magnific-popup.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_register_script( 'qubely-block-contactform', QUBELY_DIR_URL . 'assets/js/blocks/contactform.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_register_script( 'qubely-block-image-comparison', QUBELY_DIR_URL . 'assets/js/blocks/image-comparison.js', array(), QUBELY_VERSION, true ); - wp_register_script( 'qubely-block-common', QUBELY_DIR_URL . 'assets/js/common-script.js', array( 'jquery' ), QUBELY_VERSION, true ); - wp_register_script( 'qubely-interaction', QUBELY_DIR_URL . 'assets/js/interaction.js', array( 'jquery' ), QUBELY_VERSION, true ); - - - if ( is_array( $blocks_meta_data ) && count( $blocks_meta_data ) ) { - $available_blocks = $blocks_meta_data['available_blocks']; - $has_interaction = $blocks_meta_data['interaction']; - $has_animation = $blocks_meta_data['animation']; - $has_parallax = $blocks_meta_data['parallax']; - - if ( has_block( 'qubely/animatedheadline' ) || $this->has_block_in_reusable( 'qubely/animatedheadline' ) ) { - wp_enqueue_script( 'qubley-animated-headline-script' ); - } - if ( has_block( 'qubely/map' ) ) { - wp_enqueue_script( 'qubely-block-map' ); - } - if ( has_block( 'qubely/videopopup' ) || has_block( 'qubely/gallery' ) || $this->has_block_in_reusable( 'qubely/videopopup' ) || $this->has_block_in_reusable( 'qubely/gallery' ) ) { - wp_enqueue_script( 'qubely-magnific-popup-script' ); - } - if ( has_block( 'qubely/contactform' ) || has_block( 'qubely/form' ) || $this->has_block_in_reusable( 'qubely/contactform' ) || $this->has_block_in_reusable( 'qubely/form' ) ) { - wp_enqueue_script( 'qubely-block-contactform' ); - } - if ( has_block( 'qubely/imagecomparison' ) || $this->has_block_in_reusable( 'qubely/imagecomparison' ) ) { - wp_enqueue_script( 'qubely-block-image-comparison' ); - } - - if ( $has_interaction ) { - wp_enqueue_script( 'qubely-interaction' ); - } - - if ( - $has_interaction || - $has_parallax || - $has_animation || - in_array( 'qubely/accordion', $available_blocks ) || - in_array( 'qubely/pieprogress', $available_blocks ) || - in_array( 'qubely/counter', $available_blocks ) || - in_array( 'qubely/tabs', $available_blocks ) || - in_array( 'qubely/table-of-contents', $available_blocks ) || - in_array( 'qubely/verticaltabs', $available_blocks ) || - in_array( 'qubely/postgrid', $available_blocks ) || - $this->has_block_in_reusable( 'qubely/accordion' ) || - $this->has_block_in_reusable( 'qubely/pieprogress' ) || - $this->has_block_in_reusable( 'qubely/counter' ) || - $this->has_block_in_reusable( 'qubely/tabs' ) || - $this->has_block_in_reusable( 'qubely/table-of-contents' ) || - $this->has_block_in_reusable( 'qubely/verticaltabs' ) || - $this->has_block_in_reusable( 'qubely/postgrid' ) - ) { - wp_enqueue_script( 'qubely-block-common' ); - } - } else { - $post = null; - $wp_post = get_post( $post ); - if ( $wp_post instanceof WP_Post ) { - $post = $wp_post->post_content; - } - - if ( false !== strpos( $post, '' ); + echo do_blocks( '' ); } else { get_header(); } @@ -36,7 +36,7 @@ if ( version_compare( $wp_version, '5.9', '>=' ) && function_exists( 'wp_is_block_theme' ) && true === wp_is_block_theme() ) { $theme = wp_get_theme(); $theme_slug = $theme->get( 'TextDomain' ); - echo do_blocks(''); + echo do_blocks(''); echo ''; wp_footer(); echo ''; diff --git a/gulpfile.js b/gulpfile.js index 5fd8c450..4f375375 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,16 @@ const minifyCSS = require('gulp-csso'); const minifyJS = require('gulp-minify'); const concatCss = require('gulp-concat-css'); const merge = require('merge-stream'); +const fs = require('fs'); + +let versionNumber = ''; +try { + const data = fs.readFileSync('qubely.php', 'utf8'); + const match = data.match(/Version:\s*([\d.]+)/i); + versionNumber = match ? match[1] : ''; +} catch (err) { + console.error('Error reading file:', err); +} function cleanBuild() { return src('./build', { read: false, allowEmpty: true }) @@ -13,7 +23,7 @@ function cleanBuild() { } function cleanZip() { - return src('./qubely.zip', { read: false, allowEmpty: true }) + return src(`./*.zip`, { read: false, allowEmpty: true }) .pipe(clean()); } @@ -121,7 +131,7 @@ function removeCSSFiles() { function makeZip() { return src('./build/**/*.*') - .pipe(zip('qubely.zip')) + .pipe(zip(`qubely-${versionNumber}.zip`)) .pipe(dest('./')) } diff --git a/package.json b/package.json index 86b1d10f..4fa28f41 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "merge-stream": "^2.0.0" }, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "prebuild": "cd ./assets/reactjs && npm run build && gulp sass", + "build": "npm run prebuild && gulp" }, "repository": { "type": "git", diff --git a/qubely.php b/qubely.php index 6e6413c7..b051451d 100644 --- a/qubely.php +++ b/qubely.php @@ -3,12 +3,12 @@ * Plugin Name: Qubely - Advanced Gutenberg Blocks * Plugin URI: https://www.themeum.com/ * Description: The one and only Gutenberg block plugin you will ever need. - * Version: 1.8.3 + * Version: 1.8.11 * Author: Themeum * Author URI: https://www.themeum.com/ * Text Domain: qubely * Requires at least: 5.3 - * Tested up to: 6.0.1 + * Tested up to: 6.5.3 * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt */ @@ -20,11 +20,11 @@ add_action('init', 'qubely_language_load'); function qubely_language_load() { - load_plugin_textdomain('qubely', false, basename(dirname(__FILE__)) . '/languages/'); + load_plugin_textdomain('qubely', false, basename(dirname(__FILE__)) . '/languages/'); } // Define Version -define('QUBELY_VERSION', '1.8.3'); +define('QUBELY_VERSION', '1.8.11'); // Define License define('QUBELY_LICENSE', 'free'); @@ -41,30 +41,31 @@ function qubely_language_load() /** * Add qubely admin options page */ -require_once QUBELY_DIR_PATH . 'core/Options.php'; // Loading QUBELY Blocks Main Files +require_once QUBELY_DIR_PATH . 'core/Options.php'; // Loading QUBELY Blocks Main Files // Page Template Added -require_once QUBELY_DIR_PATH.'core/Template.php'; +require_once QUBELY_DIR_PATH . 'core/Template.php'; -if (class_exists('QUBELY_Options')){ +if (class_exists('QUBELY_Options')) { new QUBELY_Options(); } // Version Check & Include Core if (!version_compare(PHP_VERSION, '5.4', '>=')) { - add_action('admin_notices', array('QUBELY_Initial_Setup', 'php_error_notice')); // PHP Version Check + add_action('admin_notices', ['QUBELY_Initial_Setup', 'php_error_notice']); // PHP Version Check } elseif (!version_compare(get_bloginfo('version'), '4.7', '>=')) { - add_action('admin_notices', array('QUBELY_Initial_Setup', 'wordpress_error_notice')); // WordPress Version Check + add_action('admin_notices', ['QUBELY_Initial_Setup', 'wordpress_error_notice']); // WordPress Version Check } else { - require_once QUBELY_DIR_PATH . 'core/QUBELY.php'; // Loading QUBELY Blocks Main Files + require_once QUBELY_DIR_PATH . 'core/QUBELY.php'; // Loading QUBELY Blocks Main Files } -function qubely_blocks_add_orderby( $params ) { +function qubely_blocks_add_orderby($params) +{ - $params['orderby']['enum'][] = 'rand'; - $params['orderby']['enum'][] = 'menu_order'; + $params['orderby']['enum'][] = 'rand'; + $params['orderby']['enum'][] = 'menu_order'; - return $params; + return $params; } /** @@ -72,120 +73,125 @@ function qubely_blocks_add_orderby( $params ) { * * @since 1.0.9 */ -function qubely_register_rest_fields() { - $post_types = QUBELY_MAIN::get_post_types(); +function qubely_register_rest_fields() +{ + $post_types = QUBELY_MAIN::get_post_types(); - foreach ( $post_types as $key => $value ) { + foreach ($post_types as $key => $value) { // Featured image. register_rest_field( $value['value'], 'qubely_featured_image_url', - array( + [ 'get_callback' => 'qubely_get_featured_image_url', 'update_callback' => null, - 'schema' => array( + 'schema' => [ 'description' => __('Different sized featured images'), - 'type' => 'array', - ), - ) + 'type' => 'array', + ], + ] ); // Author info. register_rest_field( $value['value'], 'qubely_author', - array( + [ 'get_callback' => 'qubely_get_author_info', 'update_callback' => null, 'schema' => null, - ) + ] ); // Add comment info. register_rest_field( $value['value'], 'qubely_comment', - array( + [ 'get_callback' => 'qubely_get_comment_info', 'update_callback' => null, 'schema' => null, - ) + ] ); // Category links. register_rest_field( $value['value'], 'qubely_category', - array( + [ 'get_callback' => 'qubely_get_category_list', 'update_callback' => null, - 'schema' => array( + 'schema' => [ 'description' => __('Category list links'), 'type' => 'string', - ), - ) + ], + ] ); // Excerpt. register_rest_field( $value['value'], 'qubely_excerpt', - array( + [ 'get_callback' => 'qubely_get_excerpt', 'update_callback' => null, 'schema' => null, - ) + ] ); } } // Author. -function qubely_get_author_info( $object ) { - $author = ( isset( $object['author'] ) ) ? $object['author'] : ''; +function qubely_get_author_info($object) +{ + $author = (isset($object['author'])) ? $object['author'] : ''; + + $author_data['display_name'] = get_the_author_meta('display_name', $author); + $author_data['author_link'] = get_author_posts_url($author); - $author_data['display_name'] = get_the_author_meta( 'display_name', $author ) ; - $author_data['author_link'] = get_author_posts_url( $author ); - return $author_data; } // Comment. -function qubely_get_comment_info( $object ) { - $comments_count = wp_count_comments( $object['id'] ); +function qubely_get_comment_info($object) +{ + $comments_count = wp_count_comments($object['id']); return $comments_count->total_comments; } // Category list. -if ( !function_exists( 'qubely_get_category_list' ) ) { - function qubely_get_category_list( $object ) { - $taxonomies = get_post_taxonomies( $object['id'] ); - if ( 'post' === get_post_type() ) { - return get_the_category_list( esc_html__(' '), '', $object['id'] ); +if (!function_exists('qubely_get_category_list')) { + function qubely_get_category_list($object) + { + $taxonomies = get_post_taxonomies($object['id']); + if ('post' === get_post_type()) { + return get_the_category_list(esc_html__(' '), '', $object['id']); } else { - if ( ! empty( $taxonomies ) ) { - return get_the_term_list( $object['id'], $taxonomies[0], ' ' ); + if (!empty($taxonomies)) { + return get_the_term_list($object['id'], $taxonomies[0], ' '); } } } } // Feature image. -function qubely_get_featured_image_url( $object ) { +function qubely_get_featured_image_url($object) +{ - $featured_images = array(); - if ( ! isset( $object['featured_media'] ) ) { + $featured_images = []; + if (!isset($object['featured_media'])) { return $featured_images; } else { - $image = wp_get_attachment_image_src( $object['featured_media'], 'full', false ); - if ( is_array( $image ) ) { + $image = wp_get_attachment_image_src($object['featured_media'], 'full', false); + if (is_array($image)) { $featured_images['full'] = $image; - $featured_images['landscape'] = wp_get_attachment_image_src( $object['featured_media'], 'qubely_landscape', false ); - $featured_images['portraits'] = wp_get_attachment_image_src( $object['featured_media'], 'qubely_portrait', false ); - $featured_images['thumbnail'] = wp_get_attachment_image_src( $object['featured_media'], 'qubely_thumbnail', false ); + $featured_images['landscape'] = wp_get_attachment_image_src($object['featured_media'], 'qubely_landscape', false); + $featured_images['portraits'] = wp_get_attachment_image_src($object['featured_media'], 'qubely_portrait', false); + $featured_images['thumbnail'] = wp_get_attachment_image_src($object['featured_media'], 'qubely_thumbnail', false); $image_sizes = QUBELY_MAIN::get_all_image_sizes(); - foreach ( $image_sizes as $key => $value ) { - $size = $value['value']; + foreach ($image_sizes as $key => $value) { + $size = $value['value']; $featured_images[$size] = wp_get_attachment_image_src( $object['featured_media'], $size, @@ -198,31 +204,33 @@ function qubely_get_featured_image_url( $object ) { } // Excerpt. -function qubely_get_excerpt( $object ) { - $excerpt = wp_trim_words( get_the_excerpt( $object['id'] ) ); - if ( ! $excerpt ) { +function qubely_get_excerpt($object) +{ + $excerpt = wp_trim_words(get_the_excerpt($object['id'])); + if (!$excerpt) { $excerpt = null; } return $excerpt; } -add_action( 'rest_api_init', 'qubely_register_rest_fields' ); +add_action('rest_api_init', 'qubely_register_rest_fields'); /** - * Order by + * Order by */ -function qubely_resigter_rest_order_by_fields() { +function qubely_resigter_rest_order_by_fields() +{ $post_types = QUBELY_MAIN::get_post_types(); - foreach ( $post_types as $key => $type ) { - add_filter( "rest_{$type['value']}_collection_params", 'qubely_blocks_add_orderby', 10, 1 ); - } + foreach ($post_types as $key => $type) { + add_filter("rest_{$type['value']}_collection_params", 'qubely_blocks_add_orderby', 10, 1); + } } -add_action( 'init', 'qubely_resigter_rest_order_by_fields' ); +add_action('init', 'qubely_resigter_rest_order_by_fields'); function qubely_blog_posts_image_sizes() { - add_image_size( 'qubely_landscape', 1200, 750, true ); - add_image_size( 'qubely_portrait', 540, 320, true ); - add_image_size( 'qubely_thumbnail', 140, 100, true ); + add_image_size('qubely_landscape', 1200, 750, true); + add_image_size('qubely_portrait', 540, 320, true); + add_image_size('qubely_thumbnail', 140, 100, true); } -add_action( 'after_setup_theme', 'qubely_blog_posts_image_sizes' ); +add_action('after_setup_theme', 'qubely_blog_posts_image_sizes'); diff --git a/readme.md b/readme.md index 3fc4a20e..1544cb4c 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ [Qubely](https://wordpress.org/plugins/qubely/) is a full-fledged Gutenberg toolkit with plenty of predefined sections and modern layout packs to create beautiful pages and posts on the Gutenberg editor. It offers a whole new experience that minimizes all limitations of the Gutenberg editor and opens unlimited possibilities to create any simple to complex content on a WordPress website. This user-friendly tool has been developed with all necessary customization features to achieve any possible layout. -[![Qubely - Advanced Gutenberg Blocks](https://ps.w.org/qubely/assets/banner-1544x500.png?rev=2111259)](http://www.youtube.com/watch?v=_aRAQkHZiUQ) +[![Qubely - Advanced Gutenberg Blocks](https://ps.w.org/qubely/assets/banner-1544x500.jpg?rev=2111259)](http://www.youtube.com/watch?v=_aRAQkHZiUQ) ## Qubely core features at a glance @@ -57,7 +57,6 @@ ### Connect -- [Qubely Website](https://qubely.io/) - [Documentation](https://docs.themeum.com/qubely/) - [Download on WordPress.org](https://wordpress.org/plugins/qubely/) - [Join our Facebook Community](https://www.facebook.com/groups/qubely) @@ -83,7 +82,7 @@ The WordPress codex contains [instructions on how to do this here](https://codex ## Development - Navigate to reactjs folder `cd assets/reactjs` -- `npm install` +- `npm install` (node version `14.15.0` required) - `npm start` - `gulp watch` (for CSS hotloading) @@ -107,13 +106,11 @@ Showcase detailed with Qubely Gallery -countdown

Countdown

Create under construction banners, announce release and more -mediacard

Media Card

Add an image or video with an offset diff --git a/readme.txt b/readme.txt index e57bb72d..69843ed4 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: themeum Donate link: https://www.themeum.com Tags: blocks, gutenberg, gutenberg blocks, editor, block, page builder Requires at least: 5.3 -Tested up to: 6.0.1 -Stable tag: 1.8.3 +Tested up to: 6.5.3 +Stable tag: 1.8.11 Requires PHP: 7.0 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt @@ -13,13 +13,9 @@ Readymade gutenberg blocks and sections with rich customization options. Enhance == Description == -[Qubely](https://www.themeum.com/product/qubely?utm_source=wporg&utm_medium=link&utm_campaign=orglanding&utm_term=description&utm_content=qubely) is a full-fledged Gutenberg block toolkit with plenty of custom blocks, predefined sections and starter packs to create beautiful web pages. It minimizes the limitations of the Gutenberg editor and opens unlimited possibilities for any simple to complex design on Gutenberg. Qubely is a user-friendly Gutenberg plugin with necessary customization features and advanced functionalities. +Qubely is a full-fledged Gutenberg block toolkit with plenty of custom blocks, predefined sections and starter packs to create beautiful web pages. It minimizes the limitations of the Gutenberg editor and opens unlimited possibilities for any simple to complex design on Gutenberg. Qubely is a user-friendly Gutenberg plugin with necessary customization features and advanced functionalities. -Extend the default WordPress Gutenberg editor with many [custom blocks](https://www.themeum.com/qubely/blocks/?utm_source=wporg&utm_medium=link&utm_campaign=orglanding&utm_content=customblocks) that are missing in there. Take control of your website design and apply out of the box styling options offered in Qubely. Create web pages that are stunning as well as mobile optimized. - -[Qubely Blocks Pro](https://www.themeum.com/product/qubely/?utm_source=wporg&utm_medium=link&utm_campaign=orglanding&utm_content=qubelyblockspro) || [Live Preview](https://www.themeum.com/qubely/starter-packs/) || [Documentation](https://docs.themeum.com/qubely/) - -[youtube https://www.youtube.com/watch?v=_aRAQkHZiUQ] +Extend the default WordPress Gutenberg editor with many custom blocks that are missing in there. Take control of your website design and apply out of the box styling options offered in Qubely. Create web pages that are stunning as well as mobile optimized. ## QUBELY GUTENBERG BLOCKS CORE FEATURES AT A GLANCE @@ -44,55 +40,53 @@ Want to know all the latest news and be part of the Qubely community? [Join our Qubely adds numerous custom Gutenberg blocks to the Gutenberg block editor and takes Gutenberg editor to the next level. The available custom advanced Gutenberg blocks inside Qubely are: -* [Row](https://www.themeum.com/qubely/blocks/#block-row) -* [Button](https://www.themeum.com/qubely/blocks/#block-button) -* [Testimonial](https://www.themeum.com/qubely/blocks/#block-testimonial) -* [Heading](https://www.themeum.com/qubely/blocks/#block-heading) -* [Counter](https://www.themeum.com/qubely/blocks/#block-counters) -* [Tabs](https://www.themeum.com/qubely/blocks/#block-tabs) -* [Accordion/Toggle](https://www.themeum.com/qubely/blocks/#block-accordion) +* Row +* Button +* Testimonial +* Heading +* Counter +* Tabs +* Accordion/Toggle * Advanced Text -* [Video Popup](https://www.themeum.com/qubely/blocks/#block-video-popup) -* [Google Map](https://www.themeum.com/qubely/blocks/#block-google-map) -* [Progress Bar](https://www.themeum.com/qubely/blocks/#block-progress-bar) -* [Social Icons](https://www.themeum.com/qubely/blocks/#block-social-icons) -* [Button Group](https://www.themeum.com/qubely/blocks/#block-button-group) -* [Info Box](https://www.themeum.com/qubely/blocks/#block-info-box) -* [Advanced List](https://www.themeum.com/qubely/blocks/#block-advanced-list) -* [Contact Form](https://www.themeum.com/qubely/blocks/#block-contact) -* [Icon List](https://www.themeum.com/qubely/blocks/#block-icon-list) -* [Pricing](https://www.themeum.com/qubely/blocks/#block-pricing) -* [Team](https://www.themeum.com/qubely/blocks/#block-team) -* [Image](https://www.themeum.com/qubely/blocks/#block-image) -* [Timeline](https://www.themeum.com/qubely/blocks/#block-timeline) -* [Post Grid](https://www.themeum.com/qubely/blocks/#block-post-grid) +* Video Popup +* Google Map +* Progress Bar +* Social Icons +* Button Group +* Info Box +* Advanced List +* Contact Form +* Icon List +* Pricing +* Team +* Image +* Timeline +* Post Grid * Icon * Divider * Block Wrapper -* [Pie Progress](https://www.themeum.com/qubely/blocks/#block-pie-progress) +* Pie Progress More advanced Gutenberg blocks, pre-designed sections and starter packs are coming every month! [Signup on our site]() to receive updates via email. -## Pro Features +## Pro Features (Now Free) 14 blocks that help you build more sophisticated designs- -* [Form Builder](https://www.themeum.com/qubely/blocks/#block-form-builder) -* [Image Gallery](https://www.themeum.com/qubely/blocks/#block-image-gallery) -* [Image Carousel](https://www.themeum.com/qubely/blocks/#block-image-carousel) -* [Post Carousel](https://www.themeum.com/qubely/blocks/#block-post-carousel) -* [Advanced Post Grid](https://www.themeum.com/qubely/blocks/#block-advanced-post-grid) -* [Pricing List](https://www.themeum.com/qubely/blocks/#block-pricing-list) -* [Team Carousel](https://www.themeum.com/qubely/blocks/#block-team-carousel) -* [Testimonial Carousel](https://www.themeum.com/qubely/blocks/#block-testimonial-carousel) -* [Media Card](https://www.themeum.com/qubely/blocks/#block-media-card) -* [Pie Progress](https://www.themeum.com/qubely/blocks/#block-pie-progress) -* [Countdown](https://www.themeum.com/qubely/blocks/#block-countdown) -* [Table Builder](https://www.themeum.com/qubely/blocks/#block-table-builder) -* [Woo Products](https://www.themeum.com/qubely/blocks/#block-woo-products) -* [Woo Carousel](https://www.themeum.com/qubely/blocks/#block-woo-carousel) - -⭐️ [Ready Sections](https://www.themeum.com/qubely/sections/) ⭐️ [Starter Packs](https://www.themeum.com/qubely/starter-packs/) +* Form Builder +* Image Gallery +* Image Carousel +* Post Carousel +* Advanced Post Grid +* Pricing List +* Team Carousel +* Testimonial Carousel +* Media Card +* Pie Progress +* Countdown +* Table Builder +* Woo Products +* Woo Carousel ## QUBELY GUTENBERG BLOCKS FEATURES AND FUNCTIONALITIES IN DETAILS @@ -174,9 +168,6 @@ Create responsive designs with Qubely Gutenberg block plugin. Control the entire This Gutenberg page builder gives you full control over the typography. You can choose the font, apply font weight, font transform, set font size, line height, letter spacing in px, em, and percentage on the basis of the devices. -> You may find the documentation here -> [Documentation](https://docs.themeum.com/qubely/) - Want To Contribute To The Plugin? @@ -219,11 +210,11 @@ Yes, Qubely is built based on the Gutenberg editor. Qubely does not work with th = Where can I get support? = -You can post your questions on the [support forum here](https://wordpress.org/support/plugin/qubely/) or chat with us live from [our website](https://www.themeum.com). +You can post your questions on the [support forum here](https://wordpress.org/support/plugin/qubely/). = Where can I report a bug? = -You can report bugs on the [support forum here](https://wordpress.org/support/plugin/qubely/) or send us an email using the contact form on [our website](https://www.themeum.com). +You can report bugs on the [support forum here](https://wordpress.org/support/plugin/qubely/). == Screenshots == @@ -239,6 +230,40 @@ You can report bugs on the [support forum here](https://wordpress.org/support/pl == Changelog == += 1.8.11 = +Compatibility: Improved compatibility with Qubely Pro +Update: Enhanced overall stability +Fix: Image carousel breaks when there is only one image +Fix: Removed pre-made layouts and sections + += 1.8.10 = +Compatibility: PHP 8.1 & 8.2 Compatibility Added + += 1.8.9 = +Fix: Resolved table of contents issue. +Fix: Fixed settings color preset issue. +Fix: Enhanced security measures. +Update: Unlocked all premium features. + += 1.8.8 = +Fix: Resolved some CSS issues + += 1.8.7 = +Update: Improved security + += 1.8.6 = +Update: Addressed security vulnerability issue + += 1.8.5 = +New: Jetpack compatibility is introduced +Update: All Stylesheet and Script libraries are updated to the latest version +Update: More security improvements is introduced +Fix: Form Builder had an issue with the Recipient Email input field + += 1.8.4 = +Update: Implemented more security update for improved security +New: Introduced "Deprecation" in case of the "Block Recovery Issue" for Update + = 1.8.3 = Update: Email Sending Mechanism is improved in terms of Security and Performance Update: PHP version compatibility is improved