Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
const TCBSeoPlugin = require( './tcb-seo-plugin' );
module.exports = class TCBRankMathPlugin extends TCBSeoPlugin {
/**
* Init the custom fields
*/
init() {
this.content = '';
this.hooks();
this.fetchContent();
}
/**
* Hook into Rank Math App eco-system
*/
hooks() {
if ( window.wp && wp.hooks ) {
wp.hooks.addFilter( 'rank_math_content', 'rank-math', content => {
return this.content ? this.content : content;
}, 11 );
}
}
/**
* Fetch Post Content from TCB
*
* @param fetchedContent
*/
sendContent( fetchedContent ) {
if ( ! this.isEditedWithTar ) {
this.content = fetchedContent;
}
if ( typeof window.rankMathEditor !== 'undefined' ) {
rankMathEditor.refresh( 'content' );
}
}
afterFetch( response ) {
this.sendContent( response );
}
};

View File

@@ -0,0 +1,30 @@
( $ => {
module.exports = class TCBSeoPlugin {
/**
* Fetch Post Content from TCB
*/
fetchContent() {
$.ajax( {
url: ajaxurl,
type: 'post',
dataType: 'json',
data: {
post_id: TCB_Post_Edit_Data.post_id,
action: 'tve_get_seo_content'
}
} ).done( response => {
const $content = $( `<div>${response.content}</div>` );
/* Remove TTB headers and footers from SEO analysis */
$content.find( 'header#thrive-header, footer#thrive-footer, aside#theme-sidebar-section' ).remove();
this.isEditedWithTar = response.is_edited_with_tar;
this.afterFetch( $content[ 0 ].outerHTML );
} );
}
afterFetch() {
throw Error( 'Class should implement the afterFetch function' );
}
}
} )( jQuery );

View File

@@ -0,0 +1,44 @@
( $ => {
const TCBSeoPlugin = require( './tcb-seo-plugin' );
module.exports = class TCBYoastPlugin extends TCBSeoPlugin {
init() {
YoastSEO.app.registerPlugin( 'tcbYoastPlugin', {status: 'loading'} );
this.fetchContent();
}
sendContent( fetchedContent ) {
YoastSEO.app.pluginReady( 'tcbYoastPlugin' );
/**
* @param modification {string} The name of the filter
* @param callable {function} The callable
* @param pluginName {string} The plugin that is registering the modification.
* @param priority {number} (optional) Used to specify the order in which the callables
* associated with a particular filter are called. Lower numbers
* correspond with earlier execution.
*/
YoastSEO.app.registerModification( 'content', content => this.parseTCBContent( content, fetchedContent ), 'tcbYoastPlugin', 5 );
}
parseTCBContent( content, architectContent ) {
/* Remove empty tags because yoast kind fails on parse here */
if ( architectContent ) {
const contentSelector = '.tcb-style-wrap',
$content = $( `<div>${architectContent}</div>` ).find( contentSelector );
$content.find( '*:empty:not(img,input,br)' ).remove();
architectContent = $content.html();
}
return architectContent ? architectContent : content;
}
afterFetch( response ) {
this.sendContent( response );
}
}
} )( jQuery );

View File

@@ -0,0 +1,84 @@
( $ => {
const TCBYoastPlugin = require( './classes/tcb-yoast-plugin' ),
TCBRankMathPlugin = require( './classes/tcb-rankmath-plugin' ),
RankMathInstance = new TCBRankMathPlugin(),
YoastInstance = new TCBYoastPlugin();
window.TCBYoastPlugin = TCBYoastPlugin;
/**
* YoastSEO content analysis integration
*/
$( window ).on( 'YoastSEO:ready', () => {
YoastInstance.init();
} );
/**
* RankMath content analysis integration
*/
$( document ).ready( function () {
if ( typeof window.rankMath !== 'undefined' ) {
RankMathInstance.init();
}
} );
/**
*/
function show_loader() {
$( '#tcb-admin-page-loader' ).show();
}
$( function () {
const $document = $( document );
$document.on( 'click.tcb', '#tcb2-migrate-post', ( index, element ) => {
show_loader();
$.ajax( {
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
_nonce: TCB_Post_Edit_Data.admin_nonce,
post_id: TCB_Post_Edit_Data.post_id,
action: 'tcb_admin_ajax_controller',
route: 'migrate_post_content'
}
} ).done( function () {
location.href = element.getAttribute( 'data-edit' );
} ).fail( function ( jqXHR ) {
alert( 'ERROR: ' + jqXHR.responseText );
} );
} )
.on( 'click', '#tcb2-show-wp-editor', function () {
/**
* Enable the hidden input that will disable TCB editor when saving the post
*/
const $editlink = $document.find( '.tcb-enable-editor' ),
$postbox = $editlink.closest( '.postbox' );
$postbox.next( '.tcb-flags' ).find( 'input' ).prop( 'disabled', false );
$postbox.before( $editlink );
$postbox.remove();
$( 'body' ).removeClass( 'tcb-hide-wp-editor' );
} )
.on( 'click', '.tcb-enable-editor', function () {
$( 'body' ).addClass( 'tcb-hide-wp-editor' );
$.ajax( {
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
_nonce: TCB_Post_Edit_Data.admin_nonce,
post_id: this.getAttribute( 'data-id' ),
action: 'tcb_admin_ajax_controller',
route: 'enable_tcb'
}
} ).done( function () {
$( window ).off( 'beforeunload.edit-post' );
$( 'input#save-post' ).trigger( 'click' );
} );
} );
} );
} )( jQuery );

View File

@@ -0,0 +1,204 @@
( function ( $ ) {
const EDITOR_SELECTORS = '.editor-block-list__layout,.block-editor-block-list__layout';
const ThriveGutenbergSwitch = {
/**
* Check if we're using the block editor
*
* @return {boolean}
*/
isGutenbergActive() {
return typeof wp !== 'undefined' && typeof wp.blocks !== 'undefined';
},
init() {
this.coreEditor = wp.data.select( 'core/editor' );
this.$gutenberg = $( '#editor' );
this.$architectNotificationContent = $( '#thrive-gutenberg-switch' ).html();
this.$architectDisplay = $( '<div id="tar-display">' ).append( this.$architectNotificationContent );
this.$architectLauncher = this.$architectDisplay.find( '#thrive_preview_button' );
this.isPostBox = this.$architectNotificationContent.indexOf( 'postbox' ) !== - 1;
$( window ).on( 'storage.tcb', event => {
if ( this.coreEditor ) {
const currentPost = this.coreEditor.getCurrentPost();
let post;
try {
post = JSON.parse( event.originalEvent.newValue );
} catch ( e ) {
}
if ( post && post.ID && event.originalEvent.key === 'tve_post_options_change' && post.ID === Number( currentPost.id ) ) {
window.location.reload();
}
}
} );
wp.data.subscribe( () => {
if ( this.coreEditor ) {
const isSavingPost = this.coreEditor.isSavingPost(),
isAutosavingPost = this.coreEditor.isAutosavingPost();
if ( isSavingPost && ! isAutosavingPost ) {
const data = JSON.stringify( this.coreEditor.getCurrentPost() );
window.localStorage.setItem( 'tve_post_options_change', data );
}
}
/**
* On data subscribe check if our elements exists
*/
setTimeout( () => {
this.render();
}, 1 );
} );
},
render() {
const $postTitle = this.$gutenberg.find( '.editor-post-title' ),
$wpContent = this.$gutenberg.find( EDITOR_SELECTORS ).not( $postTitle.closest( EDITOR_SELECTORS ) );
let shouldBindEvents = false;
if ( this.isPostBox ) {
if ( ! $( '#tar-display' ).length ) {
if ( $postTitle.length ) {
if ( $postTitle[ 0 ].tagName === 'DIV' ) {
$postTitle.append( this.$architectDisplay );
} else {
$postTitle.after( this.$architectDisplay );
}
}
$wpContent.hide();
this.$gutenberg.find( '.editor-post-title__block' ).css( 'margin-bottom', '0' );
this.$gutenberg.find( '.editor-writing-flow__click-redirect,.block-editor-writing-flow__click-redirect' ).hide();
this.$gutenberg.find( '.edit-post-header-toolbar' ).css( 'visibility', 'hidden' );
shouldBindEvents = true;
}
} else if ( ! $( '#thrive_preview_button' ).length ) {
this.$gutenberg.find( '.edit-post-header-toolbar' ).append( this.$architectLauncher );
this.$architectLauncher.on( 'click', function () {
$wpContent.hide();
} );
this.$gutenberg.find( '.edit-post-header-toolbar' ).css( 'visibility', 'visible' );
shouldBindEvents = true;
}
/* So we can use saved styles */
$( '.editor-block-list__layout,.block-editor-block-list__layout' ).addClass( 'tcb-style-wrap' );
if ( shouldBindEvents ) {
this.bindEvents();
}
},
bindEvents() {
const self = this;
$( '#tcb2-show-wp-editor' ).on( 'click', function () {
const $editlink = self.$gutenberg.find( '.tcb-enable-editor' ),
$postbox = $editlink.closest( '.postbox' );
$.ajax( {
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
_nonce: TCB_Post_Edit_Data.admin_nonce,
post_id: this.getAttribute( 'data-id' ),
action: 'tcb_admin_ajax_controller',
route: 'disable_tcb'
}
} );
$postbox.next( '.tcb-flags' ).find( 'input' ).prop( 'disabled', false );
$postbox.remove();
self.$gutenberg.find( '.editor-block-list__layout,.block-editor-block-list__layout' ).show();
self.isPostBox = false;
self.render();
self.fixBlocksPreview();
} );
this.$architectLauncher.on( 'click', function () {
$.ajax( {
type: 'post',
url: ajaxurl,
dataType: 'json',
data: {
_nonce: TCB_Post_Edit_Data.admin_nonce,
post_id: this.getAttribute( 'data-id' ),
action: 'tcb_admin_ajax_controller',
route: 'change_post_status_gutenberg'
}
} )
} );
},
/**
* Fix block height once returning to gutenberg editor
*/
fixBlocksPreview() {
const blocks = document.querySelectorAll( '[data-type*="thrive"] iframe' ),
tveOuterHeight = function ( el ) {
if ( ! el ) {
return 0;
}
let height = el.offsetHeight;
const style = getComputedStyle( el );
height += parseInt( style.marginTop ) + parseInt( style.marginBottom );
return height;
};
Array.prototype.forEach.call( blocks, function ( iframe ) {
const iframeDocument = iframe.contentDocument;
iframe.style.setProperty(
'height',
''
);
iframe.parentNode.style.setProperty(
'height',
''
);
/**
* Fix countdown resizing
*/
Array.prototype.forEach.call( iframeDocument.body.querySelectorAll( '.tve-countdown' ), function ( countdown ) {
countdown.style.setProperty(
'--tve-countdown-size',
''
);
} );
const height = tveOuterHeight(
iframeDocument.body
);
iframe.style.setProperty(
'height',
height + 'px'
);
iframe.parentNode.style.setProperty(
'height',
height + 'px'
);
} );
}
};
$( function () {
if ( ThriveGutenbergSwitch.isGutenbergActive() ) {
ThriveGutenbergSwitch.init();
}
window.addEventListener( 'load', function () {
$( '.tcb-revert' ).on( 'click', function () {
if ( confirm( 'Are you sure you want to DELETE all of the content that was created in this landing page and revert to the theme page? \n If you click OK, any custom content you added to the landing page will be deleted.' ) ) {
location.href = location.href + '&tve_revert_theme=1&nonce=' + this.dataset.nonce;
$( '#editor' ).find( '.edit-post-header-toolbar' ).css( 'visibility', 'visible' );
}
} );
} );
} );
}( jQuery ) );