Changeset 3028541
- Timestamp:
- 01/30/2024 06:26:48 AM (2 years ago)
- Location:
- urlslab/trunk
- Files:
-
- 83 added
- 83 deleted
- 23 edited
-
admin/dist/assets/BacklinksTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/BacklinksTable-uprug8xt1p.js (added)
-
admin/dist/assets/BrowserIcon-ohdlhedoxj.js (deleted)
-
admin/dist/assets/BrowserIcon-uprug8xt1p.js (added)
-
admin/dist/assets/CSPViolationsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CSPViolationsTable-uprug8xt1p.js (added)
-
admin/dist/assets/CSSCacheTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CSSCacheTable-uprug8xt1p.js (added)
-
admin/dist/assets/Cache-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Cache-uprug8xt1p.js (added)
-
admin/dist/assets/CacheRulesTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CacheRulesTable-uprug8xt1p.js (added)
-
admin/dist/assets/ContentCacheTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/ContentCacheTable-uprug8xt1p.js (added)
-
admin/dist/assets/CreditsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CreditsTable-uprug8xt1p.js (added)
-
admin/dist/assets/CssOptimizer-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CssOptimizer-uprug8xt1p.js (added)
-
admin/dist/assets/CustomHtml-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CustomHtml-uprug8xt1p.js (added)
-
admin/dist/assets/CustomHtmlTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/CustomHtmlTable-uprug8xt1p.js (added)
-
admin/dist/assets/Editor-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Editor-uprug8xt1p.js (added)
-
admin/dist/assets/Faq-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Faq-uprug8xt1p.js (added)
-
admin/dist/assets/FaqUrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/FaqUrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/FaqsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/FaqsTable-uprug8xt1p.js (added)
-
admin/dist/assets/Generator-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Generator-uprug8xt1p.js (added)
-
admin/dist/assets/GeneratorResultTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/GeneratorResultTable-uprug8xt1p.js (added)
-
admin/dist/assets/GeneratorShortcodeTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/GeneratorShortcodeTable-uprug8xt1p.js (added)
-
admin/dist/assets/GscSitesTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/GscSitesTable-uprug8xt1p.js (added)
-
admin/dist/assets/ImageAltAttribute-ohdlhedoxj.js (deleted)
-
admin/dist/assets/ImageAltAttribute-uprug8xt1p.js (added)
-
admin/dist/assets/JSCacheTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/JSCacheTable-uprug8xt1p.js (added)
-
admin/dist/assets/KeywordsLinks-ohdlhedoxj.js (deleted)
-
admin/dist/assets/KeywordsLinks-uprug8xt1p.js (added)
-
admin/dist/assets/KeywordsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/KeywordsTable-uprug8xt1p.js (added)
-
admin/dist/assets/LazyLoading-ohdlhedoxj.js (deleted)
-
admin/dist/assets/LazyLoading-uprug8xt1p.js (added)
-
admin/dist/assets/MediaFilesTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/MediaFilesTable-uprug8xt1p.js (added)
-
admin/dist/assets/MediaOffloader-ohdlhedoxj.js (deleted)
-
admin/dist/assets/MediaOffloader-uprug8xt1p.js (added)
-
admin/dist/assets/Modules-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Modules-uprug8xt1p.js (added)
-
admin/dist/assets/MultiSelectMenu-ohdlhedoxj.js (deleted)
-
admin/dist/assets/MultiSelectMenu-uprug8xt1p.js (added)
-
admin/dist/assets/NotFoundTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/NotFoundTable-uprug8xt1p.js (added)
-
admin/dist/assets/Optimize-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Optimize-uprug8xt1p.js (added)
-
admin/dist/assets/Page404-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Page404-uprug8xt1p.js (added)
-
admin/dist/assets/QueryDetailPanel-ohdlhedoxj.js (deleted)
-
admin/dist/assets/QueryDetailPanel-uprug8xt1p.js (added)
-
admin/dist/assets/Redirects-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Redirects-uprug8xt1p.js (added)
-
admin/dist/assets/RedirectsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/RedirectsTable-uprug8xt1p.js (added)
-
admin/dist/assets/RelatedResources-ohdlhedoxj.js (deleted)
-
admin/dist/assets/RelatedResources-uprug8xt1p.js (added)
-
admin/dist/assets/Schedule-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Schedule-uprug8xt1p.js (added)
-
admin/dist/assets/SchedulesTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SchedulesTable-uprug8xt1p.js (added)
-
admin/dist/assets/SearchAndReplace-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SearchAndReplace-uprug8xt1p.js (added)
-
admin/dist/assets/SearchReplaceTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SearchReplaceTable-uprug8xt1p.js (added)
-
admin/dist/assets/Security-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Security-uprug8xt1p.js (added)
-
admin/dist/assets/Serp-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Serp-uprug8xt1p.js (added)
-
admin/dist/assets/SerpCompetitorsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpCompetitorsTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpContentGapTable-ohdlhedoxj.css (deleted)
-
admin/dist/assets/SerpContentGapTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpContentGapTable-uprug8xt1p.css (added)
-
admin/dist/assets/SerpContentGapTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpQueryDetailClusterUrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpQueryDetailClusterUrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpQueryDetailQueryClusterTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpQueryDetailQueryClusterTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpQueryDetailRankedUrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpQueryDetailRankedUrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpTopDomainsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpTopDomainsTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpUrlDetailQueryTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpUrlDetailQueryTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpUrlDetailSimilarUrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpUrlDetailSimilarUrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/SerpUrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SerpUrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/Settings-ohdlhedoxj.css (deleted)
-
admin/dist/assets/Settings-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Settings-uprug8xt1p.css (added)
-
admin/dist/assets/Settings-uprug8xt1p.js (added)
-
admin/dist/assets/SimpleButton-ohdlhedoxj.css (deleted)
-
admin/dist/assets/SimpleButton-ohdlhedoxj.js (deleted)
-
admin/dist/assets/SimpleButton-uprug8xt1p.css (added)
-
admin/dist/assets/SimpleButton-uprug8xt1p.js (added)
-
admin/dist/assets/TableFilters-ohdlhedoxj.js (deleted)
-
admin/dist/assets/TableFilters-uprug8xt1p.js (added)
-
admin/dist/assets/TagsLabels-ohdlhedoxj.css (deleted)
-
admin/dist/assets/TagsLabels-ohdlhedoxj.js (deleted)
-
admin/dist/assets/TagsLabels-uprug8xt1p.css (added)
-
admin/dist/assets/TagsLabels-uprug8xt1p.js (added)
-
admin/dist/assets/TreeView-ohdlhedoxj.js (deleted)
-
admin/dist/assets/TreeView-uprug8xt1p.js (added)
-
admin/dist/assets/URLMapTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/URLMapTable-uprug8xt1p.js (added)
-
admin/dist/assets/URLRelationTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/URLRelationTable-uprug8xt1p.js (added)
-
admin/dist/assets/UrlDetailPanel-ohdlhedoxj.js (deleted)
-
admin/dist/assets/UrlDetailPanel-uprug8xt1p.js (added)
-
admin/dist/assets/Urls-ohdlhedoxj.js (deleted)
-
admin/dist/assets/Urls-uprug8xt1p.js (added)
-
admin/dist/assets/UrlsTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/UrlsTable-uprug8xt1p.js (added)
-
admin/dist/assets/UsageTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/UsageTable-uprug8xt1p.js (added)
-
admin/dist/assets/WebVitals-ohdlhedoxj.js (deleted)
-
admin/dist/assets/WebVitals-uprug8xt1p.js (added)
-
admin/dist/assets/YouTubeCacheTable-ohdlhedoxj.js (deleted)
-
admin/dist/assets/YouTubeCacheTable-uprug8xt1p.js (added)
-
admin/dist/assets/_ModuleViewHeader-ohdlhedoxj.css (deleted)
-
admin/dist/assets/_ModuleViewHeader-uprug8xt1p.css (added)
-
admin/dist/assets/_TableDetail-ohdlhedoxj.css (deleted)
-
admin/dist/assets/_TableDetail-ohdlhedoxj.js (deleted)
-
admin/dist/assets/_TableDetail-uprug8xt1p.css (added)
-
admin/dist/assets/_TableDetail-uprug8xt1p.js (added)
-
admin/dist/assets/faketable-ohdlhedoxj.png (deleted)
-
admin/dist/assets/faketable-uprug8xt1p.png (added)
-
admin/dist/assets/faq-ohdlhedoxj.svg (deleted)
-
admin/dist/assets/faq-uprug8xt1p.svg (added)
-
admin/dist/assets/internet-explorer_9-11_48x48-ohdlhedoxj.png (deleted)
-
admin/dist/assets/internet-explorer_9-11_48x48-uprug8xt1p.png (added)
-
admin/dist/assets/labelsList-ohdlhedoxj.js (deleted)
-
admin/dist/assets/labelsList-uprug8xt1p.js (added)
-
admin/dist/assets/main-ohdlhedoxj.css (deleted)
-
admin/dist/assets/main-uprug8xt1p.css (added)
-
admin/dist/assets/menu-icon-settings-ohdlhedoxj.svg (deleted)
-
admin/dist/assets/menu-icon-settings-uprug8xt1p.svg (added)
-
admin/dist/assets/safari_48x48-ohdlhedoxj.png (deleted)
-
admin/dist/assets/safari_48x48-uprug8xt1p.png (added)
-
admin/dist/assets/urlslab-logo-ohdlhedoxj.svg (deleted)
-
admin/dist/assets/urlslab-logo-uprug8xt1p.svg (added)
-
admin/dist/assets/useModuleSectionRoute-ohdlhedoxj.css (deleted)
-
admin/dist/assets/useModuleSectionRoute-ohdlhedoxj.js (deleted)
-
admin/dist/assets/useModuleSectionRoute-uprug8xt1p.css (added)
-
admin/dist/assets/useModuleSectionRoute-uprug8xt1p.js (added)
-
admin/dist/assets/useRedirectTableMenus-ohdlhedoxj.js (deleted)
-
admin/dist/assets/useRedirectTableMenus-uprug8xt1p.js (added)
-
admin/dist/assets/wordpress-ohdlhedoxj.png (deleted)
-
admin/dist/assets/wordpress-uprug8xt1p.png (added)
-
admin/dist/main-ohdlhedoxj.js (deleted)
-
admin/dist/main-uprug8xt1p.js (added)
-
admin/src/components/DetailsPanel.jsx (modified) (1 diff)
-
admin/src/elements/RefreshTableButton.jsx (modified) (1 diff)
-
admin/src/tables/CSPViolationsTable.jsx (modified) (6 diffs)
-
blocks/build/ai-content.asset.php (modified) (1 diff)
-
blocks/build/ai-content.js (modified) (1 diff)
-
blocks/src/blocks/ai-content/edit.js (modified) (3 diffs)
-
includes/api/class-urlslab-api-security.php (modified) (4 diffs)
-
includes/class-urlslab-admin.php (modified) (1 diff)
-
includes/cron/class-urlslab-cron-convert-avif-images.php (modified) (1 diff)
-
includes/cron/class-urlslab-cron-convert-webp-images.php (modified) (1 diff)
-
includes/data/class-urlslab-data-serp-query.php (modified) (11 diffs)
-
includes/driver/class-urlslab-driver-file.php (modified) (4 diffs)
-
includes/driver/class-urlslab-driver.php (modified) (3 diffs)
-
includes/tool/class-urlslab-tool-config.php (modified) (2 diffs)
-
includes/tool/class-urlslab-tool-htaccess.php (modified) (3 diffs)
-
includes/widget/class-urlslab-widget-cache.php (modified) (3 diffs)
-
includes/widget/class-urlslab-widget-media-offloader.php (modified) (4 diffs)
-
includes/widget/class-urlslab-widget-redirects.php (modified) (3 diffs)
-
includes/widget/class-urlslab-widget-security.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
uninstall.php (modified) (1 diff)
-
urlslab.php (modified) (2 diffs)
-
vendor_prefixed/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
urlslab/trunk/admin/src/components/DetailsPanel.jsx
r3027290 r3028541 128 128 { 129 129 row[ 'edit_' + name[ 0 ] ]?.length > 0 && 130 130 131 <Tooltip title={ __( 'Edit Post' ) } arrow placement="bottom"> 131 132 <IconButton size="xs" component="a" href={ row[ 'edit_' + name[ 0 ] ] } -
urlslab/trunk/admin/src/elements/RefreshTableButton.jsx
r3025823 r3028541 15 15 16 16 const handleRefresh = () => { 17 queryClient.invalidateQueries( [ slug ] ); 17 queryClient.invalidateQueries( { 18 predicate: ( query ) => 19 query.queryKey[ 0 ] === slug && query.queryKey[ 1 ] !== 'count', 20 } ); 18 21 19 22 if ( ! noCount ) { -
urlslab/trunk/admin/src/tables/CSPViolationsTable.jsx
r3027290 r3028541 1 import { useEffect, useMemo } from 'react';1 import { useEffect, useMemo, useCallback } from 'react'; 2 2 import { __ } from '@wordpress/i18n/'; 3 3 … … 9 9 import useChangeRow from '../hooks/useChangeRow'; 10 10 import DescriptionBox from '../elements/DescriptionBox'; 11 import Button from '@mui/joy/Button'; 12 13 import { postFetch } from '../api/fetching.js'; 14 import { setNotification } from '../hooks/useNotifications.jsx'; 11 15 12 16 const paginationId = 'blocked_url_id'; 17 const optionalSelector = 'violated_directive'; 13 18 14 19 const header = { … … 30 35 const { isSelected, selectRows, deleteRow } = useChangeRow( ); 31 36 37 const addToCSPSettings = useCallback( async ( cell ) => { 38 const { violated_directive, blocked_url_id } = cell?.row.original; 39 setNotification( blocked_url_id, { message: __( 'Appending to CSP Settings…' ), status: 'info' } ); 40 41 const response = await postFetch( `security/add_to_csp_settings/${ violated_directive }/${ blocked_url_id }`, {} ); 42 const result = await response.json(); 43 44 if ( ! response?.ok ) { 45 setNotification( blocked_url_id, { message: result?.message, status: 'error' } ); 46 return false; 47 } 48 setNotification( blocked_url_id, { message: result?.message, status: 'success' } ); 49 }, [] ); 50 32 51 useEffect( () => { 33 52 useTableStore.setState( () => ( … … 42 61 header, 43 62 id: 'url', 63 optionalSelector, 44 64 }, 45 65 }, … … 75 95 tooltip: ( cell ) => cell.getValue(), 76 96 header: ( th ) => <SortBy { ...th } />, 77 minSize: 30 ,97 minSize: 300, 78 98 } ), 79 99 columnHelper.accessor( 'blocked_url', { … … 86 106 cell: ( val ) => <DateTimeFormat datetime={ val.getValue() } />, 87 107 header: ( th ) => <SortBy { ...th } />, 88 minSize: 80,108 minSize: 100, 89 109 } ), 90 110 columnHelper.accessor( 'editRow', { 91 111 className: 'editRow', 92 112 cell: ( cell ) => <RowActionButtons 93 onDelete={ () => deleteRow( { cell } ) }113 onDelete={ () => deleteRow( { cell, optionalSelector } ) } 94 114 > 115 <Button 116 size="xxs" 117 onClick={ () => addToCSPSettings( cell ) } 118 > 119 { __( 'Add To CSP Settings' ) } 120 </Button> 95 121 </RowActionButtons>, 96 122 header: null, -
urlslab/trunk/blocks/build/ai-content.asset.php
r3027290 r3028541 1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => ' 79ff3a86a704dd89062f');1 <?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '4edae5c50a37d8f98ef9'); -
urlslab/trunk/blocks/build/ai-content.js
r3027290 r3028541 1 !function(){var e={184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===c){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,r),c.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,r,n){return o=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r),(r="symbol"==t(o)?o:String(o))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e;var o}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c,a,i=[],l=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=c.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=window.React,i=r(184),l=r.n(i),u=window.wp.i18n,s=window.wp.compose,h=window.wp.element,p=window.wp.blockEditor, f=window.wp.components;function v(e,t,r,n,o,c,a){try{var i=e[c](a),l=i.value}catch(e){return void r(e)}i.done?t(l):Promise.resolve(l).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var c=e.apply(t,r);function a(e){v(c,n,o,a,i,"next",e)}function i(e){v(c,n,o,a,i,"throw",e)}a(void 0)}))}}var m=window.regeneratorRuntime,b=r.n(m);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e){return O.apply(this,arguments)}function O(){return O=d(b().mark((function e(t){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1".concat(t?"/".concat(t):""),{method:"GET",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include"});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),O.apply(this,arguments)}function E(){return E=d(b().mark((function e(t,r,n){var o;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1/".concat(t),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include",body:JSON.stringify(g({},r)),signal:null==n?void 0:n.signal});case 3:return o=e.sent,e.abrupt("return",o);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),E.apply(this,arguments)}var j=function(){var e=d(b().mark((function e(t){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w("module/".concat(t)).then((function(e){return e}));case 2:if(!(r=e.sent).ok){e.next=5;break}return e.abrupt("return",r.json());case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function S(){return S=d(b().mark((function e(t,r){var n;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1/module/".concat(t),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include",body:JSON.stringify(r)});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),S.apply(this,arguments)}function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var P="ai-content",x="urlslab-generator",I=JSON.parse('{"u2":"urlslab-blocks/ai-content"}');(0,e.registerBlockType)(I.u2,{icon:function(){return(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",fillRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",clipRule:"evenodd",viewBox:"0 0 48 48"},(0,a.createElement)("g",{transform:"scale(.88785 .91788)"},(0,a.createElement)("path",{fill:"none",d:"M0 0H54.063V52.295H0z"}),(0,a.createElement)("clipPath",{id:"a"},(0,a.createElement)("path",{d:"M0 0H54.063V52.295H0z"})),(0,a.createElement)("g",{clipPath:"url(#a)"},(0,a.createElement)("path",{fill:"none",d:"M33.139 71.738H511.5V554.5H33.139z",transform:"matrix(.10952 0 0 .10832 -3.63 -7.771) translate(7.653 .003)"}),(0,a.createElement)("g",{transform:"matrix(.10952 0 0 .10832 -3.63 -7.771) translate(7.141 -.205)"},(0,a.createElement)("clipPath",{id:"b"},(0,a.createElement)("path",{d:"M33.139 71.738H511.5V554.5H33.139z"})),(0,a.createElement)("g",{clipPath:"url(#b)"},(0,a.createElement)("path",{d:"M5385.86 466.265h1.14V273h-252v389h-305V273h-252v389h-304V273h-252v389h-294V273h-263v389h-294V273h-262v389l-.64-.002V746h.64v472h262V746h294v472h263V746h294v472h252V746h304v472h252V746h305v472h250.86V466.265ZM6499.12 3948h.88v-252h-389v-294h389v-262h-389v-294h389v-263h-389v-294h389v-262h-389v-294h389v-263h-.88v5.45H5565V1733h462v294h-462v262h462v294h-462v263h462v294h-462v262h462v294h-462v244.98h934.12v7.02ZM2741 3940.98V3696h-473v-294h473v-262h-473v-294h473v-263h-473v-294h473v-262h-473v-294h473v-257.55h-945V1733h388v294h-388v262h388v294h-388v263h388v294h-388v262h388v294h-388v244.98h945Zm2646 1009.18h-1.14V4211H5135v472h-305v-472h-252v472h-304v-472h-252v472h-294v-472h-263v472h-294v-472h-262l-.64 29.72V4618h.64v527h262v-378h294v378h263v-378h294v378h252v-378h304v378h252v-378h305v378h252v-194.84Z",transform:"matrix(.10157 0 0 -.09932 -148.481 582.385)"}),(0,a.createElement)("path",{d:"M100.454 128.324H479.35V518.842H100.454z",transform:"matrix(1.00901 0 0 1.00015 -19.43 -10.577)"}),(0,a.createElement)("path",{d:"M487.278 128.324c0-4.319-3.55-7.82-7.928-7.82H100.454c-4.378 0-7.927 3.501-7.927 7.82v390.518c0 4.319 3.549 7.82 7.927 7.82H479.35c4.378 0 7.928-3.501 7.928-7.82V128.324Zm-15.855 7.82v374.878H108.382V136.144h363.041Z",transform:"matrix(1.00901 0 0 1.00015 -19.43 -10.577)"}),(0,a.createElement)("g",{fill:"#fff",fillRule:"nonzero",transform:"matrix(1.06648 0 0 1.04286 -157.333 62.739)"},(0,a.createElement)("path",{d:"M414.791 271.858h-71.005l-18.477 40.284h-26.963l82.07-176.28 79.17 176.28h-27.392l-17.403-40.284Zm-10.205-23.525-24.599-56.396-25.782 56.396h50.381Z"}),(0,a.createElement)("path",{d:"M480.319 146.282H505.348V312.141H480.319z"})))))))},edit:function e(t){var r,o=t.attributes,i=t.setAttributes,v=(0,s.useInstanceId)(e),d="urlslab-".concat(P,"-input-").concat(v),m=function(e){var t,r=e.moduleSlug,n=c((0,a.useState)(),2),o=n[0],i=n[1];return(0,a.useEffect)((function(){j(r).then((function(e){i(e)}))}),[r]),o&&null!==(t=Object.keys(o))&&void 0!==t&&t.length,{moduleStatus:o,activateModule:function(e){(function(e,t){return S.apply(this,arguments)})(e,{active:!0}).then((function(e){return e.json()})).then((function(e){return i(e)}))}}}({moduleSlug:x}),b=m.moduleStatus,y=m.activateModule,g=c((0,h.useState)([]),2),w=g[0],O=g[1],I=c((0,h.useState)([]),2),_=I[0],C=I[1];(0,h.useEffect)((function(){(function(e,t,r){return E.apply(this,arguments)})("generator/shortcode",{sorting:[{dir:"ASC"}],filters:[],rows_per_page:500}).then((function(e){if(e.ok)return e.json()})).then((function(e){O(e),i({shortcodeObject:e.filter((function(e){return Number(e.shortcode_id)===o.shortcodeId}))[0]})}))}),[o.shortcodeId,i]),(0,h.useEffect)((function(){var e;_.length&&i({shortcodeId:null===(e=_[0])||void 0===e?void 0:e.value})}),[i,_]);var k=(0,h.useMemo)((function(){var e=null==w?void 0:w.filter((function(e){return o.shortcodeVideo?"V"===e.shortcode_type:"S"===e.shortcode_type})).map((function(e){return{label:e.shortcode_name,value:e.shortcode_id}}));return C(e),e}),[o.shortcodeVideo,w]),A=(0,h.useCallback)((function(e){var t=w.filter((function(t){return Number(t.shortcode_id)===e}))[0];i({shortcodeId:e}),i({shortcodeObject:t})}),[w,i]);return(0,a.createElement)(a.Fragment,null,b&&(null==b?void 0:b.active)&&(0,a.createElement)(p.InspectorControls,{key:"setting"},(0,a.createElement)(f.PanelBody,{title:(0,u.__)("AI Content Options","urlslab"),initialOpen:!0},(0,a.createElement)(f.ToggleControl,{label:(0,u.__)("Is Video Content","urlslab"),checked:o.shortcodeVideo,onChange:function(e){i({shortcodeVideo:e}),i({shortcodeVideoId:""})}}),(null==_?void 0:_.length)>0&&(0,a.createElement)(f.ComboboxControl,{label:(0,u.__)("Select AI Content Shortcode","urlslab"),value:o.shortcodeId,options:_,onChange:function(e){return A(e)},onFilterValueChange:function(e){return C(k.filter((function(t){return t.label.toLowerCase().startsWith(e.toLowerCase())})))}}),o.shortcodeVideo&&(0,a.createElement)(f.TextControl,{label:(0,u.__)("Video ID","urlslab"),help:(0,u.__)("Insert valid ID of YouTube video","urlslab"),value:o.shortcodeVideoId,onChange:function(e){return i({shortcodeVideoId:e})}}))),(0,a.createElement)("div",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},(0,p.useBlockProps)({className:l()("urlslab-block","urlslab-block-".concat(P),"components-placeholder")})),(0,a.createElement)("label",{htmlFor:d,className:"components-placeholder__label"},(0,u.__)("AI Content","urlslab")),(0,a.createElement)("div",{className:"urlslab-fullwidth-wrapper"},b&&null!=b&&b.active?Object.keys(o.shortcodeObject||{}).length>0&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,a.createElement)("strong",null,"Shortcode inserted:")),(0,a.createElement)("div",null,o.shortcodeVideo?o.shortcodeVideoId?(0,a.createElement)("strong",null,'[urlslab-generator id="',o.shortcodeId,'" videoid="',o.shortcodeVideoId,'"]'):(0,a.createElement)("strong",{className:"error"},"Video ID is not entered!!!"):(0,a.createElement)("strong",null,'[urlslab-generator id="',o.shortcodeId,'"]')),(0,a.createElement)("p",null,(0,a.createElement)("strong",null,"AI Content Promp:")),(0,a.createElement)("div",null,(0,a.createElement)("code",null,null===(r=o.shortcodeObject)||void 0===r?void 0:r.prompt))):b?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,u.__)("AI Content module in URLsLab is not activated. If you want to use this widget, activate it please.")),(0,a.createElement)(f.Button,{variant:"primary",text:(0,u.__)("Activate AI Content module"),onClick:function(){return y(x)}})):(0,a.createElement)(f.Spinner,null))))},save:function(){return null}})}()}();1 !function(){var e={184:function(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===c){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var c=t[n]={exports:{}};return e[n](c,c.exports,r),c.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.blocks;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,r,n){return o=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r),(r="symbol"==t(o)?o:String(o))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e;var o}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c,a,i=[],l=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=c.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=window.React,i=r(184),l=r.n(i),u=window.wp.i18n,s=window.wp.compose,h=window.wp.element,p=window.wp.blockEditor,d=window.wp.components;function v(e,t,r,n,o,c,a){try{var i=e[c](a),l=i.value}catch(e){return void r(e)}i.done?t(l):Promise.resolve(l).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var c=e.apply(t,r);function a(e){v(c,n,o,a,i,"next",e)}function i(e){v(c,n,o,a,i,"throw",e)}a(void 0)}))}}var m=window.regeneratorRuntime,b=r.n(m);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e){return O.apply(this,arguments)}function O(){return O=f(b().mark((function e(t){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1".concat(t?"/".concat(t):""),{method:"GET",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include"});case 3:return r=e.sent,e.abrupt("return",r);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),O.apply(this,arguments)}function j(){return j=f(b().mark((function e(t,r,n){var o;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1/".concat(t),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include",body:JSON.stringify(g({},r)),signal:null==n?void 0:n.signal});case 3:return o=e.sent,e.abrupt("return",o);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),j.apply(this,arguments)}var E=function(){var e=f(b().mark((function e(t){var r;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w("module/".concat(t)).then((function(e){return e}));case 2:if(!(r=e.sent).ok){e.next=5;break}return e.abrupt("return",r.json());case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function S(){return S=f(b().mark((function e(t,r){var n;return b().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(wpApiSettings.root+"urlslab/v1/module/".concat(t),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json","X-WP-Nonce":window.wpApiSettings.nonce},credentials:"include",body:JSON.stringify(r)});case 3:return n=e.sent,e.abrupt("return",n);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),S.apply(this,arguments)}function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var P="ai-content",_="urlslab-generator",x=JSON.parse('{"u2":"urlslab-blocks/ai-content"}');(0,e.registerBlockType)(x.u2,{icon:function(){return(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",fillRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"2",clipRule:"evenodd",viewBox:"0 0 48 48"},(0,a.createElement)("g",{transform:"scale(.88785 .91788)"},(0,a.createElement)("path",{fill:"none",d:"M0 0H54.063V52.295H0z"}),(0,a.createElement)("clipPath",{id:"a"},(0,a.createElement)("path",{d:"M0 0H54.063V52.295H0z"})),(0,a.createElement)("g",{clipPath:"url(#a)"},(0,a.createElement)("path",{fill:"none",d:"M33.139 71.738H511.5V554.5H33.139z",transform:"matrix(.10952 0 0 .10832 -3.63 -7.771) translate(7.653 .003)"}),(0,a.createElement)("g",{transform:"matrix(.10952 0 0 .10832 -3.63 -7.771) translate(7.141 -.205)"},(0,a.createElement)("clipPath",{id:"b"},(0,a.createElement)("path",{d:"M33.139 71.738H511.5V554.5H33.139z"})),(0,a.createElement)("g",{clipPath:"url(#b)"},(0,a.createElement)("path",{d:"M5385.86 466.265h1.14V273h-252v389h-305V273h-252v389h-304V273h-252v389h-294V273h-263v389h-294V273h-262v389l-.64-.002V746h.64v472h262V746h294v472h263V746h294v472h252V746h304v472h252V746h305v472h250.86V466.265ZM6499.12 3948h.88v-252h-389v-294h389v-262h-389v-294h389v-263h-389v-294h389v-262h-389v-294h389v-263h-.88v5.45H5565V1733h462v294h-462v262h462v294h-462v263h462v294h-462v262h462v294h-462v244.98h934.12v7.02ZM2741 3940.98V3696h-473v-294h473v-262h-473v-294h473v-263h-473v-294h473v-262h-473v-294h473v-257.55h-945V1733h388v294h-388v262h388v294h-388v263h388v294h-388v262h388v294h-388v244.98h945Zm2646 1009.18h-1.14V4211H5135v472h-305v-472h-252v472h-304v-472h-252v472h-294v-472h-263v472h-294v-472h-262l-.64 29.72V4618h.64v527h262v-378h294v378h263v-378h294v378h252v-378h304v378h252v-378h305v378h252v-194.84Z",transform:"matrix(.10157 0 0 -.09932 -148.481 582.385)"}),(0,a.createElement)("path",{d:"M100.454 128.324H479.35V518.842H100.454z",transform:"matrix(1.00901 0 0 1.00015 -19.43 -10.577)"}),(0,a.createElement)("path",{d:"M487.278 128.324c0-4.319-3.55-7.82-7.928-7.82H100.454c-4.378 0-7.927 3.501-7.927 7.82v390.518c0 4.319 3.549 7.82 7.927 7.82H479.35c4.378 0 7.928-3.501 7.928-7.82V128.324Zm-15.855 7.82v374.878H108.382V136.144h363.041Z",transform:"matrix(1.00901 0 0 1.00015 -19.43 -10.577)"}),(0,a.createElement)("g",{fill:"#fff",fillRule:"nonzero",transform:"matrix(1.06648 0 0 1.04286 -157.333 62.739)"},(0,a.createElement)("path",{d:"M414.791 271.858h-71.005l-18.477 40.284h-26.963l82.07-176.28 79.17 176.28h-27.392l-17.403-40.284Zm-10.205-23.525-24.599-56.396-25.782 56.396h50.381Z"}),(0,a.createElement)("path",{d:"M480.319 146.282H505.348V312.141H480.319z"})))))))},edit:function e(t){var r,o=t.attributes,i=t.setAttributes,v=(0,s.useInstanceId)(e),f="urlslab-".concat(P,"-input-").concat(v),m=function(e){var t,r=e.moduleSlug,n=c((0,a.useState)(),2),o=n[0],i=n[1];return(0,a.useEffect)((function(){E(r).then((function(e){i(e)}))}),[r]),o&&null!==(t=Object.keys(o))&&void 0!==t&&t.length,{moduleStatus:o,activateModule:function(e){(function(e,t){return S.apply(this,arguments)})(e,{active:!0}).then((function(e){return e.json()})).then((function(e){return i(e)}))}}}({moduleSlug:_}),b=m.moduleStatus,y=m.activateModule,g=c((0,h.useState)([]),2),w=g[0],O=g[1],x=c((0,h.useState)([]),2),I=x[0],k=x[1];(0,h.useEffect)((function(){(function(e,t,r){return j.apply(this,arguments)})("generator/shortcode",{sorting:[{dir:"ASC"}],filters:[],rows_per_page:500}).then((function(e){if(e.ok)return e.json()})).then((function(e){O(e),i({shortcodeObject:e.filter((function(e){return Number(e.shortcode_id)===o.shortcodeId}))[0]})}))}),[o.shortcodeId,i]),(0,h.useEffect)((function(){var e,t;!I.length||null!==(e=Object.keys(o.shortcodeObject||{}))&&void 0!==e&&e.length||i({shortcodeId:null===(t=I[0])||void 0===t?void 0:t.value})}),[I,o.shortcodeObject,i]);var C=(0,h.useMemo)((function(){var e=null==w?void 0:w.filter((function(e){return o.shortcodeVideo?"V"===e.shortcode_type:"S"===e.shortcode_type})).map((function(e){return{label:e.shortcode_name,value:e.shortcode_id}}));return k(e),e}),[o.shortcodeVideo,w]),A=(0,h.useCallback)((function(e){var t=w.filter((function(t){return Number(t.shortcode_id)===e}))[0];i({shortcodeId:e}),i({shortcodeObject:t})}),[w,i]);return(0,a.createElement)(a.Fragment,null,b&&(null==b?void 0:b.active)&&(0,a.createElement)(p.InspectorControls,{key:"setting"},(0,a.createElement)(d.PanelBody,{title:(0,u.__)("AI Content Options","urlslab"),initialOpen:!0},(0,a.createElement)(d.ToggleControl,{label:(0,u.__)("Is Video Content","urlslab"),checked:o.shortcodeVideo,onChange:function(e){i({shortcodeObject:{}}),i({shortcodeVideo:e}),i({shortcodeVideoId:""})}}),(null==I?void 0:I.length)>0&&(0,a.createElement)(d.ComboboxControl,{label:(0,u.__)("Select AI Content Shortcode","urlslab"),value:o.shortcodeId,options:I,onChange:function(e){return A(e)},onFilterValueChange:function(e){return k(C.filter((function(t){return t.label.toLowerCase().startsWith(e.toLowerCase())})))}}),o.shortcodeVideo&&(0,a.createElement)(d.TextControl,{label:(0,u.__)("Video ID","urlslab"),help:(0,u.__)("Insert valid ID of YouTube video","urlslab"),value:o.shortcodeVideoId,onChange:function(e){return i({shortcodeVideoId:e})}}))),(0,a.createElement)("div",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},(0,p.useBlockProps)({className:l()("urlslab-block","urlslab-block-".concat(P),"components-placeholder")})),(0,a.createElement)("label",{htmlFor:f,className:"components-placeholder__label"},(0,u.__)("AI Content","urlslab")),(0,a.createElement)("div",{className:"urlslab-fullwidth-wrapper"},b&&null!=b&&b.active?Object.keys(o.shortcodeObject||{}).length>0&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,u.__)("Shortcode inserted:"))),(0,a.createElement)("div",null,o.shortcodeVideo?o.shortcodeVideoId?(0,a.createElement)("strong",null,'[urlslab-generator id="',o.shortcodeId,'" videoid="',o.shortcodeVideoId,'"]'):(0,a.createElement)("strong",{className:"error"},(0,u.__)("Video ID is not entered!!!")):(0,a.createElement)("strong",null,'[urlslab-generator id="',o.shortcodeId,'"]')),(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,u.__)("AI Content Prompt:"))),(0,a.createElement)("div",null,(0,a.createElement)("code",null,null===(r=o.shortcodeObject)||void 0===r?void 0:r.prompt))):b?(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,u.__)("AI Content module in URLsLab is not activated. If you want to use this widget, activate it please.")),(0,a.createElement)(d.Button,{variant:"primary",text:(0,u.__)("Activate AI Content module"),onClick:function(){return y(_)}})):(0,a.createElement)(d.Spinner,null))))},save:function(){return null}})}()}(); -
urlslab/trunk/blocks/src/blocks/ai-content/edit.js
r3027290 r3028541 33 33 34 34 useEffect( () => { 35 if ( filteredOptions.length ) {35 if ( filteredOptions.length && ! Object.keys( attributes.shortcodeObject || {} )?.length ) { 36 36 setAttributes( { shortcodeId: filteredOptions[ 0 ]?.value } ); 37 37 } 38 }, [ setAttributes, filteredOptions ] );38 }, [ filteredOptions, attributes.shortcodeObject, setAttributes ] ); 39 39 40 40 const options = useMemo( () => { … … 71 71 checked={ attributes.shortcodeVideo } 72 72 onChange={ ( val ) => { 73 setAttributes( { shortcodeObject: {} } ); 73 74 setAttributes( { shortcodeVideo: val } ); 74 75 setAttributes( { shortcodeVideoId: '' } ); … … 125 126 ? Object.keys( attributes.shortcodeObject || {} ).length > 0 && 126 127 <> 127 <p><strong> Shortcode inserted:</strong></p>128 <p><strong>{ __( 'Shortcode inserted:' ) }</strong></p> 128 129 <div> 129 130 { attributes.shortcodeVideo 130 ? attributes.shortcodeVideoId ? <strong>[urlslab-generator id="{ attributes.shortcodeId }" videoid="{ attributes.shortcodeVideoId }"]</strong> : <strong className="error"> Video ID is not entered!!!</strong>131 ? attributes.shortcodeVideoId ? <strong>[urlslab-generator id="{ attributes.shortcodeId }" videoid="{ attributes.shortcodeVideoId }"]</strong> : <strong className="error">{ __( 'Video ID is not entered!!!' ) }</strong> 131 132 : <strong>[urlslab-generator id="{ attributes.shortcodeId }"]</strong> 132 133 } 133 134 </div> 134 135 135 <p><strong> AI Content Promp:</strong></p>136 <p><strong>{ __( 'AI Content Prompt:' ) }</strong></p> 136 137 <div> 137 138 <code>{ attributes.shortcodeObject?.prompt }</code> -
urlslab/trunk/includes/api/class-urlslab-api-security.php
r3027290 r3028541 55 55 ) 56 56 ); 57 register_rest_route( 58 self::NAMESPACE, 59 $base . '/add_to_csp_settings/(?P<violated_directive>[a-z\-]+)/(?P<blocked_url_id>[0-9]+)', 60 array( 61 array( 62 'methods' => WP_REST_Server::EDITABLE, 63 'callback' => array( $this, 'add_to_csp_settings' ), 64 'permission_callback' => array( 65 $this, 66 'add_to_csp_settings_permissions_check', 67 ), 68 'args' => array(), 69 ), 70 ) 71 ); 57 72 58 73 register_rest_route( … … 73 88 } 74 89 90 91 public function add_to_csp_settings_permissions_check( $request ) { 92 return current_user_can( 'activate_plugins' ) || current_user_can( self::CAPABILITY_ADMINISTRATION ) || current_user_can( 'administrator' ); 93 } 75 94 76 95 private function get_route_get_items(): array { … … 103 122 104 123 return new WP_REST_Response( $rows, 200 ); 124 } 125 126 public function add_to_csp_settings( $request ) { 127 $violated_directive = $request->get_param( 'violated_directive' ); 128 $blocked_url_id = $request->get_param( 'blocked_url_id' ); 129 $csp_violation = new Urlslab_Data_Csp( 130 array( 131 'violated_directive' => $violated_directive, 132 'blocked_url_id' => $blocked_url_id, 133 ), 134 false 135 ); 136 137 if ( ! $csp_violation->load() ) { 138 return new WP_Error( 'error', __( 'Failed to load item', 'urlslab' ), array( 'status' => 404 ) ); 139 } 140 141 /** @var Urlslab_Widget_Security $widget */ 142 $widget = Urlslab_User_Widget::get_instance()->get_widget( Urlslab_Widget_Security::SLUG ); 143 if ( $widget->add_to_csp_settings( $csp_violation ) ) { 144 return new WP_REST_Response( 145 array( 146 'message' => __( 'CSP settings enhanced', 'urlslab' ), 147 200, 148 ) 149 ); 150 } 151 152 return new WP_REST_Response( 153 array( 154 'message' => __( 'Failed to enhance the CSP settings, edit value manually in Settings section', 'urlslab' ), 155 400, 156 ) 157 ); 105 158 } 106 159 … … 159 212 } 160 213 161 return new WP_REST_Response( '', 200, $this->get_headers_no_cache() ); 214 return new WP_REST_Response( 215 array( 216 'message' => '', 217 200, 218 $this->get_headers_no_cache(), 219 ) 220 ); 162 221 } 163 222 -
urlslab/trunk/includes/class-urlslab-admin.php
r3025823 r3028541 175 175 null, 176 176 URLSLAB_PLUGIN_URL . 'admin/assets/urlslab-logo.png', 177 80177 2 178 178 ); 179 179 -
urlslab/trunk/includes/cron/class-urlslab-cron-convert-avif-images.php
r3027290 r3028541 176 176 $avif_file->set_fileid( $avif_file->get_fileid() ); // init file id 177 177 178 if ( ! $avif_file->get_file_pointer()->get_driver_object()->file_exists( $avif_file ) ) { 179 return null; 180 } 181 178 182 if ( $avif_file->insert() ) { 179 183 return $avif_file; -
urlslab/trunk/includes/cron/class-urlslab-cron-convert-webp-images.php
r3027290 r3028541 124 124 $webp_file->set_fileid( $webp_file->get_fileid() ); // init file id 125 125 126 if ( ! $webp_file->get_file_pointer()->get_driver_object()->file_exists( $webp_file ) ) { 127 return null; 128 } 129 126 130 if ( $webp_file->insert() ) { 127 131 return $webp_file; -
urlslab/trunk/includes/data/class-urlslab-data-serp-query.php
r3025823 r3028541 3 3 class Urlslab_Data_Serp_Query extends Urlslab_Data { 4 4 public const STATUS_NOT_PROCESSED = 'X'; 5 public const STATUS_PROCESSING = 'P';6 public const STATUS_PROCESSED = 'A';7 public const STATUS_ERROR = 'E';8 public const STATUS_SKIPPED = 'S';9 10 public const TYPE_USER = 'U';5 public const STATUS_PROCESSING = 'P'; 6 public const STATUS_PROCESSED = 'A'; 7 public const STATUS_ERROR = 'E'; 8 public const STATUS_SKIPPED = 'S'; 9 10 public const TYPE_USER = 'U'; 11 11 public const TYPE_SERP_RELATED = 'S'; 12 public const TYPE_SERP_FAQ = 'F';13 public const TYPE_GSC = 'C';14 15 public const VOLUME_STATUS_NEW = 'N';16 public const VOLUME_STATUS_ERROR = 'E';17 public const VOLUME_STATUS_PENDING = 'P';12 public const TYPE_SERP_FAQ = 'F'; 13 public const TYPE_GSC = 'C'; 14 15 public const VOLUME_STATUS_NEW = 'N'; 16 public const VOLUME_STATUS_ERROR = 'E'; 17 public const VOLUME_STATUS_PENDING = 'P'; 18 18 public const VOLUME_STATUS_FINISHED = 'F'; 19 19 20 public const INTENT_UNDEFINED = 'U';21 public const INTENT_OTHER = 'O';22 public const INTENT_QUESTION = 'Q';20 public const INTENT_UNDEFINED = 'U'; 21 public const INTENT_OTHER = 'O'; 22 public const INTENT_QUESTION = 'Q'; 23 23 public const INTENT_INFORMATIONAL = 'I'; 24 public const INTENT_COMMERCIAL = 'C';25 public const INTENT_NAVIGATIONAL = 'N';24 public const INTENT_COMMERCIAL = 'C'; 25 public const INTENT_NAVIGATIONAL = 'N'; 26 26 public const INTENT_TRANSCATIONAL = 'T'; 27 27 28 public const SCHEDULE_INTERVAL_DAILY = 'D';29 public const SCHEDULE_INTERVAL_WEEKLY = 'W';30 public const SCHEDULE_INTERVAL_MONTHLY = 'M';31 public const SCHEDULE_INTERVAL_YEARLY = 'Y';32 public const SCHEDULE_INTERVAL_ONCE = 'O';28 public const SCHEDULE_INTERVAL_DAILY = 'D'; 29 public const SCHEDULE_INTERVAL_WEEKLY = 'W'; 30 public const SCHEDULE_INTERVAL_MONTHLY = 'M'; 31 public const SCHEDULE_INTERVAL_YEARLY = 'Y'; 32 public const SCHEDULE_INTERVAL_ONCE = 'O'; 33 33 public const SCHEDULE_INTERVAL_SYSTEM_DEFAULT = ''; 34 34 35 public const LEVEL_HIGH = 'H';36 public const LEVEL_MEDIUM = 'M';37 public const LEVEL_LOW = 'L';35 public const LEVEL_HIGH = 'H'; 36 public const LEVEL_MEDIUM = 'M'; 37 public const LEVEL_LOW = 'L'; 38 38 public const LEVEL_DEFAULT = ''; 39 39 … … 41 41 return array( 42 42 self::TYPE_USER => __( 'User Defined', 'urlslab' ), 43 self::TYPE_ SERP_RELATED=> __( 'Search Console', 'urlslab' ),44 self::TYPE_SERP_ FAQ=> __( 'People also search for', 'urlslab' ),45 self::TYPE_ GSC=> __( 'People also ask', 'urlslab' ),43 self::TYPE_GSC => __( 'Search Console', 'urlslab' ), 44 self::TYPE_SERP_RELATED => __( 'People also search for', 'urlslab' ), 45 self::TYPE_SERP_FAQ => __( 'People also ask', 'urlslab' ), 46 46 ); 47 47 } … … 287 287 if ( 1 < strlen( $country_level ) ) { 288 288 $country_level = substr( $country_level, 0, 1 ); 289 } else if ( null == $country_level ) {289 } else if ( null == $country_level ) { 290 290 $country_level = ''; 291 291 } … … 400 400 if ( 'type' === $column ) { 401 401 return self::queryTypes(); 402 } else if ( 'status' === $column ) {402 } else if ( 'status' === $column ) { 403 403 return array( 404 404 self::STATUS_ERROR => __( 'Error', 'urlslab' ), … … 408 408 self::STATUS_SKIPPED => __( 'Skipped', 'urlslab' ), 409 409 ); 410 } else if ( 'intent' === $column ) {410 } else if ( 'intent' === $column ) { 411 411 return array( 412 412 self::INTENT_COMMERCIAL => __( 'Commercial', 'urlslab' ), … … 418 418 self::INTENT_UNDEFINED => __( 'Undefined', 'urlslab' ), 419 419 ); 420 } else if ( 'country_vol_status' === $column ) {420 } else if ( 'country_vol_status' === $column ) { 421 421 return array( 422 422 self::VOLUME_STATUS_NEW => __( 'New', 'urlslab' ), … … 425 425 self::VOLUME_STATUS_FINISHED => __( 'Finished', 'urlslab' ), 426 426 ); 427 } else if ( 'country_level' === $column ) {427 } else if ( 'country_level' === $column ) { 428 428 return array( 429 self::LEVEL_HIGH => __( 'High' ),430 self::LEVEL_MEDIUM => __( 'Medium' ),431 self::LEVEL_LOW => __( 'Low' ),432 self::LEVEL_DEFAULT => __( '-' ),429 self::LEVEL_HIGH => __( 'High' ), 430 self::LEVEL_MEDIUM => __( 'Medium' ), 431 self::LEVEL_LOW => __( 'Low' ), 432 self::LEVEL_DEFAULT => __( '-' ), 433 433 ); 434 } else if ( 'schedule_interval' === $column ) {434 } else if ( 'schedule_interval' === $column ) { 435 435 return array( 436 436 self::SCHEDULE_INTERVAL_DAILY => __( 'Daily', 'urlslab' ), … … 472 472 473 473 474 475 474 $wpdb->query( 476 475 $wpdb->prepare( 477 'UPDATE ' . URLSLAB_SERP_QUERIES_TABLE . // phpcs:ignore476 'UPDATE ' . URLSLAB_SERP_QUERIES_TABLE . // phpcs:ignore 478 477 ' qq 479 478 INNER JOIN ( … … 487 486 COUNT(m.url_id) AS internal_links 488 487 FROM ' . URLSLAB_SERP_QUERIES_TABLE . // phpcs:ignore 489 ' q LEFT JOIN ' . URLSLAB_SERP_POSITIONS_TABLE . $first_gsc_join . // phpcs:ignore490 ' LEFT JOIN ' . URLSLAB_SERP_URLS_TABLE . // phpcs:ignore488 ' q LEFT JOIN ' . URLSLAB_SERP_POSITIONS_TABLE . $first_gsc_join . // phpcs:ignore 489 ' LEFT JOIN ' . URLSLAB_SERP_URLS_TABLE . // phpcs:ignore 491 490 ' u ON p.url_id=u.url_id 492 491 LEFT JOIN ' . URLSLAB_SERP_POSITIONS_TABLE . $second_gsc_join . // phpcs:ignore 493 ' LEFT JOIN ' . URLSLAB_SERP_URLS_TABLE . // phpcs:ignore492 ' LEFT JOIN ' . URLSLAB_SERP_URLS_TABLE . // phpcs:ignore 494 493 ' cu ON cp.url_id=cu.url_id 495 494 LEFT JOIN ' . URLSLAB_KEYWORDS_TABLE . // phpcs:ignore … … 524 523 if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_DAILY, 0, 1 ) === $interval ) { 525 524 return 86400; 526 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_WEEKLY, 0, 1 ) === $interval ) {525 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_WEEKLY, 0, 1 ) === $interval ) { 527 526 return 86400 * 7; 528 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_MONTHLY, 0, 1 ) === $interval ) {527 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_MONTHLY, 0, 1 ) === $interval ) { 529 528 return 86400 * 30; 530 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_YEARLY, 0, 1 ) === $interval ) {529 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_YEARLY, 0, 1 ) === $interval ) { 531 530 return 86400 * 365; 532 531 } else { … … 547 546 if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_DAILY, 0, 1 ) === $interval ) { 548 547 return Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_DAILY; 549 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_WEEKLY, 0, 1 ) === $interval ) {548 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_WEEKLY, 0, 1 ) === $interval ) { 550 549 return Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_DAILY; //for weekly we use daily 551 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_MONTHLY, 0, 1 ) === $interval ) {550 } else if ( substr( Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_MONTHLY, 0, 1 ) === $interval ) { 552 551 return Urlslab_Vendor\OpenAPI\Client\Model\DomainDataRetrievalSerpApiSearchRequest::NOT_OLDER_THAN_WEEKLY; //for monthly we use weekly 553 552 } -
urlslab/trunk/includes/driver/class-urlslab-driver-file.php
r3027290 r3028541 74 74 75 75 if ( false !== strpos( $file->get_url(), $upload_dir['baseurl'] ) ) { 76 return $upload_dir['basedir'] . substr( substr( $file->get_url(), strlen( $upload_dir['baseurl'] ) ), 0, - strlen( $file->get_filename() ) );76 return $upload_dir['basedir'] . substr( substr( $file->get_url(), strlen( $upload_dir['baseurl'] ) ), 0, -strlen( $file->get_filename() ) ); 77 77 } 78 78 … … 91 91 $file_path = $upload_dir['basedir'] . $relative_path; 92 92 } else { 93 $file_path = $upload_dir['path'] . '/' . $file->get_filehash() . '_' . $file->get_filename(); 93 if ( ! empty( $file->get_filehash() ) ) { 94 $file_path = $upload_dir['path'] . '/' . $file->get_filehash() . '_' . $file->get_filename(); 95 } else { 96 return ''; 97 } 94 98 } 95 99 … … 103 107 104 108 public function create_url( Urlslab_Data_File $file ): string { 105 return wp_upload_dir()['url'] . '/' . $file->get_filehash() . '_' . $file->get_filename(); 109 if ( ! empty( $file->get_filehash() ) ) { 110 111 return wp_upload_dir()['url'] . '/' . $file->get_filehash() . '_' . $file->get_filename(); 112 } 113 114 return wp_upload_dir()['url'] . '/' . $file->get_filename(); 106 115 } 107 116 … … 109 118 $filename = $this->get_upload_file_name( $file_obj ); 110 119 111 return false !== $filename;120 return ! empty( $filename ) && file_exists( $filename ); 112 121 } 113 122 } -
urlslab/trunk/includes/driver/class-urlslab-driver.php
r3027290 r3028541 24 24 self::DRIVER_LOCAL_FILE, 25 25 ); 26 private static array $system_url_paths = array(); 26 27 27 28 public function get_existing_local_file( $url ) { 28 // Get the WordPress base directory. 29 $wp_base_dir = ABSPATH; 30 31 // Parse the URL to get the path. 32 $parsed_url = parse_url( $url ); 33 $url_path = $parsed_url['path'] ?? ''; 34 35 // Convert to a local path. 36 $local_path = realpath( $wp_base_dir . $url_path ); 37 38 // Check if the path is within our WordPress installation 39 if ( strpos( $local_path, $wp_base_dir ) !== 0 ) { 40 // The file is outside the WordPress directory and is considered invalid or potentially harmful. 29 try { 30 $url_obj = new Urlslab_Url( $url, true ); 31 } catch ( Exception $e ) { 41 32 return false; 42 33 } 43 34 44 // Check if the file exists and is not a directory. 45 if ( is_file( $local_path ) ) { 46 return $local_path; 35 if ( empty( self::$system_url_paths ) ) { 36 self::$system_url_paths = array(); 37 self::$system_url_paths[ wp_get_upload_dir()['basedir'] ] = new Urlslab_Url( wp_get_upload_dir()['baseurl'], true ); 38 self::$system_url_paths[ WP_PLUGIN_DIR ] = new Urlslab_Url( WP_PLUGIN_URL, true ); 39 self::$system_url_paths[ WPMU_PLUGIN_DIR ] = new Urlslab_Url( WPMU_PLUGIN_URL, true ); 40 self::$system_url_paths[ WP_CONTENT_DIR ] = new Urlslab_Url( WP_CONTENT_URL, true ); 41 if ( defined( 'WP_SITEURL' ) ) { 42 self::$system_url_paths[ ABSPATH ] = new Urlslab_Url( WP_SITEURL, true ); 43 } 44 } 45 46 foreach ( self::$system_url_paths as $system_dir => $system_url_obj ) { 47 if ( $url_obj->get_domain_id() === $system_url_obj->get_domain_id() && strpos( $url_obj->get_url_path(), $system_url_obj->get_url_path() ) === 0 ) { 48 $url_path = substr( $url_obj->get_url_path(), strlen( $system_url_obj->get_url_path() ) ); 49 50 return realpath( $system_dir . $url_path ); 51 } 47 52 } 48 53 … … 173 178 } 174 179 175 if ( ! $file->get_file_pointer()->load() ) {180 if ( ! $file->get_file_pointer()->load() || ! $file->get_file_pointer()->get_driver_object()->file_exists( $file ) ) { 176 181 if ( $this->save_file_to_storage( $file, $file_name ) ) { 177 182 //create pointer … … 238 243 } 239 244 245 if ( Urlslab_User_Widget::get_instance()->get_activated_widgets( Urlslab_Widget_Redirects::SLUG ) && Urlslab_User_Widget::get_instance()->get_widget( Urlslab_Widget_Redirects::SLUG )->get_option( Urlslab_Widget_Redirects::SETTING_NAME_IMG_EMPTY_ON_404 ) ) { 246 $file_size = filesize( $local_tmp_file ); 247 if ( 1024 > $file_size ) { 248 $content = file_get_contents( $local_tmp_file ); 249 if ( Urlslab_Widget_Redirects::EMPTY_GIF_CONTENT == $content || Urlslab_Widget_Redirects::EMPTY_PNG_CONTENT == $content ) { 250 unlink( $local_tmp_file ); 251 252 return ''; 253 } 254 } 255 } 256 240 257 return $local_tmp_file; 241 258 } -
urlslab/trunk/includes/tool/class-urlslab-tool-config.php
r3025823 r3028541 79 79 80 80 public static function get_config_file_name() { 81 if ( ! function_exists( 'WP_Filesystem' ) ) {81 if ( ! function_exists( 'WP_Filesystem' ) && is_file( ABSPATH . '/wp-admin/includes/file.php' ) ) { 82 82 require_once ABSPATH . '/wp-admin/includes/file.php'; 83 83 WP_Filesystem(); … … 86 86 global $wp_filesystem; 87 87 88 if ( file_exists( $wp_filesystem->abspath() . 'wp-config.php' ) ) { 89 return $wp_filesystem->abspath() . 'wp-config.php'; 90 } else if ( file_exists( dirname( $wp_filesystem->abspath() ) . '/wp-config.php' ) ) { 91 return dirname( $wp_filesystem->abspath() ) . '/wp-config.php'; 88 if ( $wp_filesystem ) { 89 if ( file_exists( $wp_filesystem->abspath() . 'wp-config.php' ) ) { 90 return $wp_filesystem->abspath() . 'wp-config.php'; 91 } else if ( file_exists( dirname( $wp_filesystem->abspath() ) . '/wp-config.php' ) ) { 92 return dirname( $wp_filesystem->abspath() ) . '/wp-config.php'; 93 } 92 94 } 93 95 -
urlslab/trunk/includes/tool/class-urlslab-tool-htaccess.php
r3027290 r3028541 34 34 35 35 public function get_htaccess_file_name() { 36 if ( ! function_exists( 'WP_Filesystem' ) ) { 36 if ( file_exists( ABSPATH . 'wp-config.php' ) ) { 37 return ABSPATH . '.htaccess'; 38 } else if ( file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { 39 return dirname( ABSPATH ) . '/.htaccess'; 40 } 41 42 if ( ! function_exists( 'WP_Filesystem' ) && is_file( ABSPATH . '/wp-admin/includes/file.php' ) ) { 37 43 require_once ABSPATH . '/wp-admin/includes/file.php'; 38 44 WP_Filesystem(); … … 41 47 global $wp_filesystem; 42 48 43 if ( file_exists( $wp_filesystem->abspath() . 'wp-config.php' ) ) { 44 return $wp_filesystem->abspath() . '.htaccess'; 45 } else if ( file_exists( dirname( $wp_filesystem->abspath() ) . '/wp-config.php' ) ) { 46 return dirname( $wp_filesystem->abspath() ) . '/.htaccess'; 49 if ( $wp_filesystem ) { 50 if ( file_exists( $wp_filesystem->abspath() . 'wp-config.php' ) ) { 51 return $wp_filesystem->abspath() . '.htaccess'; 52 } else if ( file_exists( dirname( $wp_filesystem->abspath() ) . '/wp-config.php' ) ) { 53 return dirname( $wp_filesystem->abspath() ) . '/.htaccess'; 54 } 47 55 } 48 56 … … 83 91 } 84 92 $file_name = $this->get_htaccess_file_name(); 85 $fp = fopen( $file_name . '.lock', 'w' ); 93 $fp = @fopen( $file_name . '.lock', 'w' ); 94 $result = false; 86 95 if ( $fp ) { 87 96 if ( flock( $fp, LOCK_EX ) ) { -
urlslab/trunk/includes/widget/class-urlslab-widget-cache.php
r3027290 r3028541 303 303 $file_path = $this->get_page_cache_file_name( $url_obj->get_domain_name(), $url_obj->get_url_path() ); 304 304 305 if ( ! function_exists( 'WP_Filesystem' ) ) {305 if ( ! function_exists( 'WP_Filesystem' ) && is_file( ABSPATH . '/wp-admin/includes/file.php' ) ) { 306 306 require_once ABSPATH . '/wp-admin/includes/file.php'; 307 307 WP_Filesystem(); … … 429 429 430 430 public function invalidate_old_cache() { 431 if ( ! function_exists( 'WP_Filesystem' ) ) {431 if ( ! function_exists( 'WP_Filesystem' ) && is_file( ABSPATH . '/wp-admin/includes/file.php' ) ) { 432 432 require_once ABSPATH . '/wp-admin/includes/file.php'; 433 433 WP_Filesystem(); … … 435 435 /** @var WP_Filesystem_Base $wp_filesystem */ 436 436 global $wp_filesystem; 437 $dir_name = wp_get_upload_dir()['basedir'] . '/urlslab/page/'; 438 //get list of directories in $dir_name 439 $dir_list = glob( $dir_name . '*', GLOB_ONLYDIR | GLOB_NOSORT ); 440 foreach ( $dir_list as $dir ) { 441 if ( preg_match( '/\/(\d+)$/', $dir, $matches ) ) { 442 if ( is_numeric( $matches[1] ) && $matches[1] < $this->get_option( self::SETTING_NAME_CACHE_VALID_FROM ) ) { 443 $wp_filesystem->delete( $dir, true ); 437 if ( $wp_filesystem ) { 438 $dir_name = wp_get_upload_dir()['basedir'] . '/urlslab/page/'; 439 //get list of directories in $dir_name 440 $dir_list = glob( $dir_name . '*', GLOB_ONLYDIR | GLOB_NOSORT ); 441 foreach ( $dir_list as $dir ) { 442 if ( preg_match( '/\/(\d+)$/', $dir, $matches ) ) { 443 if ( is_numeric( $matches[1] ) && $matches[1] < $this->get_option( self::SETTING_NAME_CACHE_VALID_FROM ) ) { 444 $wp_filesystem->delete( $dir, true ); 445 } 444 446 } 445 447 } -
urlslab/trunk/includes/widget/class-urlslab-widget-media-offloader.php
r3027290 r3028541 58 58 // speed: Default value 6. Accepted values are int the range of 0 (slowest) through 10 (fastest). Integers outside the 0-10 range are clamped. 59 59 public const SETTING_DEFAULT_AVIF_SPEED = 1; 60 public const SETTING_NAME_MEDIA_CACHE_EXPIRE_TIME = 'urlslab_media_cache_expire';61 60 62 61 public const SETTING_NAME_IMAGE_RESIZING = 'urlslab_img_resize'; … … 147 146 false, 148 147 null, 149 'main'150 );151 152 $this->add_option_definition(153 self::SETTING_NAME_MEDIA_CACHE_EXPIRE_TIME,154 31536000,155 true,156 function () {157 return __( 'Cache Expiration', 'urlslab' );158 },159 function () {160 return __( 'Specify caching duration for images in the browser or CDN.', 'urlslab' );161 },162 self::OPTION_TYPE_LISTBOX,163 function () {164 return array(165 3600 => __( 'One hour', 'urlslab' ),166 28800 => __( 'Eight hours', 'urlslab' ),167 86400 => __( 'One day', 'urlslab' ),168 604800 => __( 'One week', 'urlslab' ),169 2592000 => __( 'One moth', 'urlslab' ),170 7776000 => __( 'Three months', 'urlslab' ),171 15552000 => __( 'Six months', 'urlslab' ),172 31536000 => __( 'One year', 'urlslab' ),173 0 => __( 'No cache', 'urlslab' ),174 );175 },176 function ( $value ) {177 return is_numeric( $value ) && 0 <= $value;178 },179 148 'main' 180 149 ); … … 1116 1085 } 1117 1086 1118 private function schedule_missing_images( array $urls ) { 1087 private function schedule_missing_images( array $urls ): void { 1088 if ( empty( $urls ) ) { 1089 return; 1090 } 1091 1119 1092 $save_internal = $this->get_option( self::SETTING_NAME_SAVE_INTERNAL ); 1120 1093 $save_external = $this->get_option( self::SETTING_NAME_SAVE_EXTERNAL ); … … 1253 1226 @header( 'Content-Disposition: inline; filename="' . $file->get_filename() . '"' ); 1254 1227 @header( 'Content-Transfer-Encoding: binary' ); 1255 @header( 'Content-length: ' . strlen( $content) );1228 @header( 'Content-length: ' . $file->get_filesize() ); 1256 1229 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 1257 1230 flush(); -
urlslab/trunk/includes/widget/class-urlslab-widget-redirects.php
r3025823 r3028541 2 2 3 3 class Urlslab_Widget_Redirects extends Urlslab_Widget { 4 public const SLUG = 'redirects';5 public const SETTING_NAME_LOGGING = 'urlslab_redir_log';6 public const SETTING_NAME_LOG_HISTORY_MAX_TIME = 'urlslab_redir_log_max_time';7 public const SETTING_NAME_LOG_HISTORY_MAX_ROWS = 'urlslab_redir_log_max_rows';8 public const SETTING_NAME_DEFAULT_REDIRECT_URL = 'urlslab_redir_default_url';4 public const SLUG = 'redirects'; 5 public const SETTING_NAME_LOGGING = 'urlslab_redir_log'; 6 public const SETTING_NAME_LOG_HISTORY_MAX_TIME = 'urlslab_redir_log_max_time'; 7 public const SETTING_NAME_LOG_HISTORY_MAX_ROWS = 'urlslab_redir_log_max_rows'; 8 public const SETTING_NAME_DEFAULT_REDIRECT_URL = 'urlslab_redir_default_url'; 9 9 public const SETTING_NAME_DEFAULT_REDIRECT_URL_IMAGE = 'urlslab_redir_default_url_image'; 10 10 11 public const CACHE_GROUP = 'Urlslab_Widget_Redirects';12 const SETTING_NAME_AI_REDIRECTS = 'urlslab_redir_ai_redirects';13 const SETTING_NAME_MIN_404_COUNT = 'urlslab_redir_min_404_count';11 public const CACHE_GROUP = 'Urlslab_Widget_Redirects'; 12 const SETTING_NAME_AI_REDIRECTS = 'urlslab_redir_ai_redirects'; 13 const SETTING_NAME_MIN_404_COUNT = 'urlslab_redir_min_404_count'; 14 14 const SETTING_NAME_IMG_EMPTY_ON_404 = 'urlslab_redir_img_on_404'; 15 15 const SETTING_NAME_REDIRECT_TO_HTTPS = 'urlslab-cache-redirect-to-https'; … … 17 17 const NONWWW_TO_WWW = 'nw'; 18 18 const WWW_TO_NONWWW = 'wn'; 19 public const EMPTY_GIF_CONTENT = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x90\x00\x00\xff\x00\x00\x00\x00\x00\x21\xf9\x04\x05\x10\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x04\x01\x00\x3b"; 20 public const EMPTY_PNG_CONTENT = "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x01\x00\x00\x00\x01\x01\x03\x00\x00\x00\x25\xdb\x56\xca\x00\x00\x00\x03\x50\x4c\x54\x45\x00\x00\x00\xa7\x7a\x3d\xda\x00\x00\x00\x01\x74\x52\x4e\x53\x00\x40\xe6\xd8\x66\x00\x00\x00\x0a\x49\x44\x41\x54\x08\xd7\x63\x60\x00\x00\x00\x02\x00\x01\xe2\x21\xbc\x33\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"; 19 21 20 22 public function get_widget_labels(): array { … … 658 660 if ( preg_match( '/\.gif/i', $_SERVER['REQUEST_URI'] ) ) { 659 661 @header( 'Content-Type: image/gif' ); 660 die( "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x90\x00\x00\xff\x00\x00\x00\x00\x00\x21\xf9\x04\x05\x10\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x04\x01\x00\x3b" );662 die( self::EMPTY_GIF_CONTENT ); // phpcs:ignore 661 663 } 662 664 @header( 'Content-Type: image/png' ); 663 die( "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x01\x00\x00\x00\x01\x01\x03\x00\x00\x00\x25\xdb\x56\xca\x00\x00\x00\x03\x50\x4c\x54\x45\x00\x00\x00\xa7\x7a\x3d\xda\x00\x00\x00\x01\x74\x52\x4e\x53\x00\x40\xe6\xd8\x66\x00\x00\x00\x0a\x49\x44\x41\x54\x08\xd7\x63\x60\x00\x00\x00\x02\x00\x01\xe2\x21\xbc\x33\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82" );665 die( self::EMPTY_PNG_CONTENT ); // phpcs:ignore 664 666 } 665 667 } -
urlslab/trunk/includes/widget/class-urlslab-widget-security.php
r3025823 r3028541 54 54 ); 55 55 56 public function add_to_csp_settings( Urlslab_Data_Csp $csp_violation ): bool { 57 switch ( $csp_violation->get_violated_directive() ) { 58 case 'script-src': 59 $setting_name = self::SETTING_NAME_CSP_SCRIPT; 60 break; 61 case 'script-src-elem': 62 $setting_name = self::SETTING_NAME_CSP_ELEM; 63 break; 64 case 'script-src-attr': 65 $setting_name = self::SETTING_NAME_CSP_SCR_ATTR; 66 break; 67 case 'style-src': 68 $setting_name = self::SETTING_NAME_CSP_STYLE; 69 break; 70 case 'style-src-elem': 71 $setting_name = self::SETTING_NAME_CSP_SRC_ELEM; 72 break; 73 case 'style-src-attr': 74 $setting_name = self::SETTING_NAME_CSP_SRC_ATTR; 75 break; 76 case 'img-src': 77 $setting_name = self::SETTING_NAME_CSP_IMG; 78 break; 79 case 'font-src': 80 $setting_name = self::SETTING_NAME_CSP_FONT; 81 break; 82 case 'connect-src': 83 $setting_name = self::SETTING_NAME_CSP_CONNECT; 84 break; 85 case 'media-src': 86 $setting_name = self::SETTING_NAME_CSP_MEDIA; 87 break; 88 case 'object-src': 89 $setting_name = self::SETTING_NAME_CSP_OBJECT; 90 break; 91 case 'child-src': 92 $setting_name = self::SETTING_NAME_CSP_CHILD; 93 break; 94 case 'frame-src': 95 $setting_name = self::SETTING_NAME_CSP_FRAME; 96 break; 97 case 'manifest-src': 98 $setting_name = self::SETTING_NAME_CSP_MANIFEST; 99 break; 100 case 'worker-src': 101 $setting_name = self::SETTING_NAME_CSP_WORKER; 102 break; 103 case 'base-uri': 104 $setting_name = self::SETTING_NAME_CSP_BASE_URI; 105 break; 106 case 'form-action': 107 $setting_name = self::SETTING_NAME_CSP_ACTION; 108 break; 109 case 'default-src': 110 $setting_name = self::SETTING_NAME_CSP_DEFAULT; 111 break; 112 default: 113 return false; 114 } 115 116 $setting_values = explode( ' ', $this->get_option( $setting_name ) ); 117 $value = $csp_violation->get_blocked_url(); 118 switch ( $value ) { 119 case 'self': 120 $value = "'self'"; 121 break; 122 case 'unsafe-inline': 123 $value = "'unsafe-inline'"; 124 break; 125 case 'unsafe-eval': 126 $value = "'unsafe-eval'"; 127 break; 128 case 'unsafe-hashes': 129 $value = "'unsafe-hashes'"; 130 break; 131 case 'wasm-unsafe-eval': 132 $value = "'wasm-unsafe-eval'"; 133 break; 134 case 'strict-dynamic': 135 $value = "'strict-dynamic'"; 136 break; 137 case 'report-sample': 138 $value = "'report-sample'"; 139 break; 140 case 'inline-speculation-rules': 141 $value = "'inline-speculation-rules'"; 142 break; 143 case 'blob': 144 $value = 'blob:'; 145 break; 146 case 'data': 147 $value = 'data:'; 148 break; 149 default: 150 try { 151 $url = new Urlslab_Url( $value, true ); 152 $value = $url->get_domain_name(); 153 } catch ( Exception $e ) { 154 return false; 155 } 156 break; 157 } 158 159 if ( ! in_array( $value, $setting_values, true ) ) { 160 $setting_values[] = $value; 161 return $this->update_option( $setting_name, trim( implode( ' ', $setting_values ) ) ); 162 } 163 164 return false; 165 } 166 56 167 private static function is_valid_csp_value( $value ): bool { 57 168 // Split the directive value into parts to validate each source separately -
urlslab/trunk/readme.txt
r3027290 r3028541 5 5 Tested up to: 6.4 6 6 Requires PHP: 7.4 7 Stable tag: 2.120. 07 Stable tag: 2.120.1 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 144 144 == Changelog == 145 145 146 = 2.120.1 - 2024-01-30 = 147 148 * Experience a smoother user journey with our under-the-hood enhancements. 149 146 150 = 2.120.0 - 2024-01-26 = 147 151 -
urlslab/trunk/uninstall.php
r3025823 r3028541 68 68 } 69 69 70 $htaccess = new Urlslab_Tool_Htaccess(); 71 $htaccess->cleanup(); 72 Urlslab_Tool_Config::clear_advanced_cache(); 70 if ( file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { 71 $file_name = dirname( ABSPATH ) . '/.htaccess'; 72 } else { 73 $file_name = ABSPATH . '.htaccess'; 74 } 73 75 74 return;76 insert_with_markers( $file_name, 'URLSLAB', array() ); -
urlslab/trunk/urlslab.php
r3027290 r3028541 17 17 * Plugin URI: https://github.com/QualityUnit/wp-urlslab 18 18 * Description: URLsLab WordPress Plugin to optimize your website for search engines and enhance automatically content 19 * Version: 2.120. 019 * Version: 2.120.1 20 20 * Requires at least: 6.0 21 21 * Requires PHP: 7.4 … … 31 31 } 32 32 33 define( 'URLSLAB_VERSION', '2.120. 0' );33 define( 'URLSLAB_VERSION', '2.120.1' ); 34 34 define( 'URLSLAB_VERSION_SETTING', 'urlslab_ver' ); 35 35 define( 'URLSLAB_PLUGIN', __FILE__ ); -
urlslab/trunk/vendor_prefixed/composer/installed.php
r3027290 r3028541 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 915c2308fa0fe2310e8d1d01326031d97a07ca1d',6 'reference' => '004c8cb2280583798f651840b8005b0a58b7b3ea', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 915c2308fa0fe2310e8d1d01326031d97a07ca1d',16 'reference' => '004c8cb2280583798f651840b8005b0a58b7b3ea', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../',
Note: See TracChangeset
for help on using the changeset viewer.