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,20 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 10:55 AM
*/
/**
* Base Collection
*/
module.exports = Backbone.Collection.extend( {
/**
* helper function to get the last item of a collection
*
* @return Backbone.Model
*/
last: function () {
return this.at( this.size() - 1 );
}
} );

View File

@@ -0,0 +1,33 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 10:56 AM
*/
var base = require( './base' ),
BreadcrumbLink = require( '../models/breadcrumb-link' );
/**
* Breadcrumb links collection
*/
module.exports = base.extend( {
model: Backbone.Model.extend( {
defaults: {
hash: '',
label: ''
}
} ),
/**
* helper function allows adding items to the collection easier
*
* @param {string} route
* @param {string} label
*/
add_page: function ( route, label ) {
var _model = new BreadcrumbLink( {
hash: route,
label: label
} );
return this.add( _model );
}
} );

View File

@@ -0,0 +1,21 @@
(function ( $ ) {
//DOM ready
$( function () {
var ThriveAbAdmin = window.ThriveAbAdmin || {},
router = require( './router' );
Backbone.emulateHTTP = true;
ThriveAbAdmin.router = new router();
ThriveAbAdmin.router.init_breadcrumbs();
Backbone.history.stop();
Backbone.history.start();
if ( ! Backbone.history.fragment ) {
ThriveAbAdmin.router.navigate( '#dashboard', {trigger: true} );
}
} );
})( jQuery );

View File

@@ -0,0 +1,36 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 11:00 AM
*/
/**
* BreadcrumbLink model
*/
module.exports = Backbone.Model.extend( {
defaults: {
ID: '',
hash: '',
label: '',
full_link: false
},
/**
* we pass only hash and label, and build the ID based on the label
*
* @param {object} att
*/
initialize: function ( att ) {
if ( ! this.get( 'ID' ) ) {
this.set( 'ID', att.label.split( ' ' ).join( '' ).toLowerCase() );
}
this.set( 'full_link', att.hash.match( /^http/ ) );
},
/**
*
* @returns {String}
*/
get_url: function () {
return this.get( 'full_link' ) ? this.get( 'hash' ) : ('#' + this.get( 'hash' ));
}
} );

View File

@@ -0,0 +1,127 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 9:51 AM
*/
var BreadcrumbsCollection = require( './collections/breadcrumbs' ),
BreadcrumbsView = require( './views/breadcrumbs' ),
DashboardView = require( './views/dashboard' );
(function ( $ ) {
module.exports = Backbone.Router.extend( {
view: null,
$el: $( '#tab-admin-dashboard-wrapper' ),
routes: {
'dashboard': 'dashboard'
},
breadcrumbs: {
col: null,
view: null
},
/**
* init the breadcrumbs collection and view
*/
init_breadcrumbs: function () {
this.breadcrumbs.col = new BreadcrumbsCollection();
this.breadcrumbs.view = new BreadcrumbsView( {
collection: this.breadcrumbs.col
} )
},
/**
* set the current page - adds the structure to breadcrumbs and sets the new document title
*
* @param {string} section page hierarchy
* @param {string} label current page label
*
* @param {Array} [structure] optional the structure of the links that lead to the current page
*/
set_page: function ( section, label, structure ) {
this.breadcrumbs.col.reset();
structure = structure || {};
/* Thrive Dashboard is always the first element */
this.breadcrumbs.col.add_page( ThriveAbAdmin.dash_url, ThriveAbAdmin.t.Thrive_Dashboard, true );
_.each( structure, _.bind( function ( item ) {
this.breadcrumbs.col.add_page( item.route, item.label );
}, this ) );
/**
* last link - no need for route
*/
this.breadcrumbs.col.add_page( '', label );
/* update the page title */
var $title = $( 'head > title' );
if ( ! this.original_title ) {
this.original_title = $title.html();
}
$title.html( label + ' &lsaquo; ' + this.original_title );
},
/**
* dashboard route callback
*/
dashboard: function () {
this.set_page( 'dashboard', ThriveAbAdmin.t.Dashboard );
var self = this;
TVE_Dash.showLoader();
if ( this.view ) {
this.view.remove();
}
jQuery.ajax( {
cache: false,
url: ThriveAbAdmin.ajax.url,
method: 'POST',
dataType: 'json',
data: {
route: 'testsforadmin',
action: ThriveAbAdmin.ajax.action,
custom: ThriveAbAdmin.ajax.controller_action,
nonce: ThriveAbAdmin.ajax.nonce
}
} ).done( function ( response ) {
self.view = new DashboardView( {
running_tests: new Backbone.Collection( response.running_tests ),
completed_tests: new Backbone.Collection( response.completed_tests ),
dashboard_stats: response.dashboard_stats
} );
self.$el.html( self.view.render().$el );
if ( ThriveAbAdmin.license.gp && ThriveAbAdmin.license.show_lightbox) {
TVE_Dash.modal( TVE_Dash.views.LicenseModal, {
model: {
title: 'Thrive Optimize',
license_class: 'grace-period',
product_class: 'tab',
license_link: ThriveAbAdmin.license.link,
grace_time: ThriveAbAdmin.license.grace_time
},
className: 'tvd-modal tvd-license-modal tvd-modal-grace-period',
width: '950px',
'max-width': '950px',
} );
} else if ( ThriveAbAdmin.license.exp && ! ThriveAbAdmin.license.gp ) {
TVE_Dash.modal( TVE_Dash.views.LicenseModal, {
model: {
title: 'Thrive Optimize',
license_class: 'expired',
product_class: 'tab',
license_link: ThriveAbAdmin.license.link
},
className: 'tvd-modal tvd-license-modal tvd-modal-expired',
no_close: true,
width: '950px',
dismissible: false,
'max-width': '950px',
} );
$( '#tab-admin-dashboard-wrapper' ).replaceWith( $('#tab-admin-dashboard-wrapper').clone() );
}
TVE_Dash.hideLoader();
} );
}
} );
})( jQuery );

View File

@@ -0,0 +1,31 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 11:03 AM
*/
/**
* breadcrumbs view - renders breadcrumb links
*/
(function ( $ ) {
module.exports = Backbone.View.extend( {
el: $( '#tab-breadcrumbs-wrapper' )[0],
template: TVE_Dash.tpl( 'breadcrumbs' ),
/**
* setup collection listeners
*/
initialize: function () {
this.$title = $( 'head > title' );
this.original_title = this.$title.html();
this.listenTo( this.collection, 'change', this.render );
this.listenTo( this.collection, 'add', this.render );
},
/**
* render the html
*/
render: function () {
this.$el.empty().html( this.template( {links: this.collection} ) );
}
} );
})( jQuery );

View File

@@ -0,0 +1,91 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 2:17 PM
*/
var TestListView = require( './test-list' ),
TestPagination = require( './test-pagination' );
module.exports = Backbone.View.extend( {
template: TVE_Dash.tpl( 'dashboard' ),
events: {
'keyup .tab-running-search-input': 'search_tests',
'keyup .tab-completed-search-input': 'search_tests'
},
running_test_pagination: null,
completed_test_pagination: null,
initialize: function ( args ) {
this.running_tests = args.running_tests;
this.completed_tests = args.completed_tests;
this.dashboard_stats = args.dashboard_stats;
this.listenTo( this.completed_tests, 'remove', function () {
this.completed_test_pagination.changePage();
}, this );
},
render: function () {
this.$el.html( this.template( {stats: this.dashboard_stats} ) );
this.render_running_tests();
this.render_completed_tests();
return this;
},
render_running_tests: function () {
var running_test_list = new TestListView( {
template_item: TVE_Dash.tpl( 'running-test-item' ),
template_no_item: TVE_Dash.tpl( 'running-test-no-item' ),
template_no_search_item: TVE_Dash.tpl( 'running-test-no-search-item' ),
el: this.$el.find( '.tab-running-test-items-list' ),
collection: this.running_tests
} );
this.running_test_pagination = new TestPagination( {
collection: this.running_tests,
view: running_test_list,
el: this.$el.find( '.tab-running-pagination' )
} );
this.running_test_pagination.changePage();
},
render_completed_tests: function () {
var completed_test_list = new TestListView( {
template_item: TVE_Dash.tpl( 'completed-test-item' ),
template_no_item: TVE_Dash.tpl( 'completed-test-no-item' ),
template_no_search_item: TVE_Dash.tpl( 'completed-test-no-search-item' ),
el: this.$el.find( '.tab-completed-test-items-list' ),
collection: this.completed_tests
} );
this.completed_test_pagination = new TestPagination( {
collection: this.completed_tests,
view: completed_test_list,
el: this.$el.find( '.tab-completed-pagination' )
} );
this.completed_test_pagination.changePage();
},
search_tests: function ( e ) {
var search = jQuery( e.target ).val(),
pagination;
if ( e.currentTarget.className.indexOf( 'running' ) !== - 1 ) {
pagination = this.running_test_pagination;
} else if ( e.currentTarget.className.indexOf( 'completed' ) !== - 1 ) {
pagination = this.completed_test_pagination;
} else {
return;
}
pagination.changePage( null, {
page: 1,
search_by: search
} );
}
} );

View File

@@ -0,0 +1,69 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 4:55 PM
*/
var delete_test_modal = require( './../../modals/delete' );
module.exports = Backbone.View.extend( {
template: '',
tagName: 'tr',
events: {
'click .tab-delete-test': 'delete_test'
},
initialize: function ( attr ) {
this.template = attr.template;
},
render: function () {
this.$el.html( this.template( {model: this.model} ) );
return this;
},
delete_test: function () {
if ( this.model.get( 'status' ) !== 'completed' ) {
return;
}
TVE_Dash.modal( delete_test_modal, {
submit: _.bind( function () {
TVE_Dash.showLoader();
var self = this;
jQuery.ajax( {
cache: false,
url: ThriveAbAdmin.ajax.url,
method: 'POST',
dataType: 'json',
data: {
id: this.model.get( 'id' ),
page_id: this.model.get( 'page_id' ),
route: 'deletecompletedtestadmin',
action: ThriveAbAdmin.ajax.action,
custom: ThriveAbAdmin.ajax.controller_action,
nonce: ThriveAbAdmin.ajax.nonce
}
} ).done( function ( response ) {
if ( response.success ) {
self.collection.remove( self.model );
TVE_Dash.success( response.text );
} else {
TVE_Dash.err( response.text );
}
TVE_Dash.hideLoader();
} );
}, this ),
title: '',
description: TVE_Dash.sprintf( ThriveAbAdmin.t.about_to_delete_variation, ['<strong>' + this.model.get( 'title' ) + '</strong>'] ),
btn_yes_txt: ThriveAbAdmin.t.yes,
btn_no_txt: ThriveAbAdmin.t.no,
'max-width': '20%',
width: '20%'
} );
}
} );

View File

@@ -0,0 +1,51 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 1:31 PM
*/
var TestItemView = require( './test-item' );
module.exports = Backbone.View.extend( {
template: '',
events: {},
initialize: function ( attr ) {
this.template_item = attr.template_item;
this.template_no_item = attr.template_no_item;
this.template_no_search_item = attr.template_no_search_item;
this.collection = attr.collection;
},
render: function ( collection, c_source ) {
var c = this.collection;
this.$el.empty();
if ( typeof collection !== 'undefined' ) {
c = new Backbone.Collection( collection );
}
if ( c.length === 0 ) {
var _no_results_template = this.template_no_item();
if ( c_source === 'search_by' ) {
_no_results_template = this.template_no_search_item();
}
this.$el.html( _no_results_template );
} else {
c.each( this.renderOne, this );
}
return this;
},
renderOne: function ( item ) {
var view = new TestItemView( {
template: this.template_item,
collection: this.collection,
model: item
} );
this.$el.append( view.render().$el );
}
} );

View File

@@ -0,0 +1,124 @@
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 1/16/2018
* Time: 5:24 PM
*/
module.exports = Backbone.View.extend( {
template: TVE_Dash.tpl( 'pagination' ),
events: {
'click a.page': 'changePage',
'change .tab-items-per-page': 'changeItemPerPage'
},
currentPage: 1,
pageCount: 1,
itemsPerPage: 10,
total_items: 0,
collection: null,
params: null,
view: null,
initialize: function ( options ) {
this.collection = options.collection;
this.view = options.view;
},
changeItemPerPage: function ( event ) {
this.itemsPerPage = jQuery( event.target ).val();
this.changePage( null, {page: 1} );
},
changePage: function ( event, args ) {
var data = {
itemsPerPage: this.itemsPerPage
};
/* Set the current page of the pagination. This can be changed by clicking on a page or by just calling this method with params */
if ( event && typeof event.currentTarget !== 'undefined' ) {
data.page = jQuery( event.currentTarget ).attr( 'value' );
} else if ( args && typeof args.page !== 'undefined' ) {
data.page = parseInt( args.page );
} else {
data.page = this.currentPage;
}
/* just to make sure */
if ( data.page < 1 ) {
data.page = 1;
}
/* Parse args sent to pagination */
if ( typeof args !== 'undefined' ) {
/* When "per page" filter changes, those values are not sent so we save them in the view so we can have them for later */
if ( typeof args.search_by !== 'undefined' ) {
this.search_by = args.search_by;
}
}
/* In case we've saved this before */
data.search_by = this.search_by ? this.search_by.toLowerCase() : '';
if ( typeof this.view != 'undefined' && this.view != null ) {
/* Prepare params for pagination render */
this.updateParams( data.page, this.collection.length );
var currentCollection = this.collection.clone(),
from = (this.currentPage - 1) * this.itemsPerPage,
collectionSlice,
removeIds = [],
c_source = '';
if ( typeof currentCollection.comparator !== 'undefined' ) {
currentCollection.sort();
}
if ( data.search_by ) {
currentCollection.each( function ( model ) {
var title = model.get( 'title' ).toLowerCase(),
goal_pages = JSON.stringify( model.get( 'goal_pages' ) ).toLowerCase(),
page_title = model.get( 'page_title' ).toLowerCase();
if ( title.indexOf( data.search_by ) === - 1 && goal_pages.indexOf( data.search_by ) === - 1 && page_title.indexOf( data.search_by ) === - 1 ) {
removeIds.push( model );
}
} );
for ( var i in removeIds ) {
currentCollection.remove( removeIds[i] );
}
c_source = 'search_by';
}
collectionSlice = currentCollection.chain().rest( from ).first( this.itemsPerPage ).value();
/* render sliced view collection */
this.view.render( collectionSlice, c_source );
/* render pagination */
this.render();
}
return false;
},
updateParams: function ( page, total ) {
this.currentPage = page;
this.total_items = total;
this.pageCount = Math.ceil( this.total_items / this.itemsPerPage );
},
setupParams: function ( page ) {
this.currentPage = page;
this.total_items = this.collection.length;
this.pageCount = Math.ceil( this.total_items / this.itemsPerPage );
},
render: function () {
this.$el.html( this.template( {
currentPage: parseInt( this.currentPage ),
pageCount: parseInt( this.pageCount ),
total_items: parseInt( this.total_items ),
itemsPerPage: parseInt( this.itemsPerPage )
} ) );
TVE_Dash.materialize( this.$el );
return this;
}
} );