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,46 @@
<?php #comp-page builds: premium
/**
* Updates for altering the table used to store statistics data.
* Adds new columns and renames existing ones in order to add support for the new social buttons.
*/
class SocialLockerUpdate020006 extends Factory325_Update {
public function install() {
global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
$tablefields = $wpdb->get_results("DESCRIBE {$wpdb->prefix}so_tracking");
if ( count($tablefields) > 0 ) {
$names = array();
foreach($tablefields as $column) {
$names[] = $column->Field;
}
if ( in_array('LikeCount', $names) ) {
// renames the old columns to save data after chaning the table
$sql = "ALTER TABLE {$wpdb->prefix}so_tracking
CHANGE LikeCount facebook_like_count INT(11) NOT NULL DEFAULT 0,
CHANGE TweetCount twitter_tweet_count INT(11) NOT NULL DEFAULT 0,
CHANGE PlusCount google_plus_count INT(11) NOT NULL DEFAULT 0,
CHANGE TimerCount timer_count INT(11) NOT NULL DEFAULT 0,
CHANGE CrossCount cross_count INT(11) NOT NULL DEFAULT 0,
CHANGE TotalCount total_count INT(11) NOT NULL DEFAULT 0,
ADD facebook_share_count INT(11) NOT NULL DEFAULT 0,
ADD twitter_follow_count INT(11) NOT NULL DEFAULT 0,
ADD google_share_count INT(11) NOT NULL DEFAULT 0,
ADD linkedin_share_count INT(11) NOT NULL DEFAULT 0";
$result = $wpdb->query($sql);
if ( $result === false ) {
$wpdb->show_errors();
$wpdb->print_error();
exit;
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
<?php
/**
* Changes names of options because since the 3th version we introduced a new agreement of names.
*
* @since 3.0.0
*/
class SocialLockerUpdate030009 extends Factory325_Update {
public function install() {
global $wpdb;
$args = array(
'posts_per_page' => -1,
'orderby' => 'post_date',
'post_type' => 'social-locker',
'post_status' => 'publish'
);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* Adds a new column 'na_count'.
*
* @since 3.7.2
*/
class SocialLockerUpdate030701 extends Factory325_Update {
public function install() {
global $wpdb;
$sql = "
CREATE TABLE {$wpdb->prefix}so_tracking (
ID BIGINT(20) NOT NULL AUTO_INCREMENT,
AggregateDate DATE NOT NULL,
PostID BIGINT(20) NOT NULL,
total_count INT(11) NOT NULL DEFAULT 0,
na_count INT(11) NOT NULL DEFAULT 0,
facebook_like_count INT(11) NOT NULL DEFAULT 0,
twitter_tweet_count INT(11) NOT NULL DEFAULT 0,
google_plus_count INT(11) NOT NULL DEFAULT 0,
timer_count INT(11) NOT NULL DEFAULT 0,
cross_count INT(11) NOT NULL DEFAULT 0,
facebook_share_count INT(11) NOT NULL DEFAULT 0,
twitter_follow_count INT(11) NOT NULL DEFAULT 0,
google_share_count INT(11) NOT NULL DEFAULT 0,
linkedin_share_count INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (ID),
KEY IX_wp_so_tracking_PostID (PostID),
UNIQUE KEY UK_wp_so_tracking (AggregateDate,PostID)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
}

View File

@@ -0,0 +1,15 @@
<?php
/**
* Options got new names.
*
* @since 4.0.0
*/
class SocialLockerUpdate040000 extends Factory325_Update {
public function install() {
$activator = new OPanda_Activation( $this->plugin );
$activator->activate();
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Re-creating the leads table, adding the fields table for leads, adds the option 'opanda_catch_leads' for lockers.
*
* @since 1.0.7
*/
class SocialLockerUpdate040008 extends Factory325_Update {
public function install() {
$done = get_option('opanda_upgrade_010007', false);
if ( $done ) return;
update_option('opanda_upgrade_010007', true);
// adds new fields to the table of leads and create a table for lead fields
$activator = new OPanda_Activation( $this->plugin );
$activator->activate();
// adds the option 'opanda_catch_leads'
$lockers = get_posts(array(
'post_type' => OPANDA_POST_TYPE,
'numberposts' => -1
));
foreach( $lockers as $locker ) {
add_post_meta( $locker->ID, 'opanda_catch_leads', 1);
}
// importing old data from the table of leads
// - copying the data between fields
global $wpdb;
$wpdb->query('UPDATE ' . $wpdb->prefix . 'opanda_leads SET lead_referer = lead_post_url, lead_email_confirmed = lead_confirmed, lead_subscription_confirmed = lead_confirmed');
// - copying the social profile urls
$results = $wpdb->get_results('SELECT ID, lead_social_profile FROM ' . $wpdb->prefix . 'opanda_leads' );
$fields = array();
foreach( $results as $row ) {
if ( empty( $row->lead_social_profile) ) continue;
if ( preg_match( '/facebook/i', $row->lead_social_profile) ) {
$fields[] = array( $row->ID, 'facebookUrl', $row->lead_social_profile );
} elseif ( preg_match( '/twitter/i', $row->lead_social_profile) ) {
$fields[] = array( $row->ID, 'twitterUrl', $row->lead_social_profile );
} elseif ( preg_match( '/google/i', $row->lead_social_profile) ) {
$fields[] = array( $row->ID, 'googleUrl', $row->lead_social_profile );
} elseif ( preg_match( '/linkedin/i', $row->lead_social_profile) ) {
$fields[] = array( $row->ID, 'linkedinUrl', $row->lead_social_profile );
}
}
if ( !empty( $fields ) ){
$sql = 'INSERT INTO ' . $wpdb->prefix . 'opanda_leads_fields (lead_id,field_name,field_value) VALUES ';
$values = array();
foreach( $fields as $row ) {
$values[] = $wpdb->prepare('(%d,%s,%s)', $row[0], $row[1], $row[2]);
}
$sql .= implode(',', $values);
$wpdb->query($sql);
}
$wpdb->query('ALTER TABLE ' . $wpdb->prefix . 'opanda_leads DROP COLUMN lead_post_url, DROP COLUMN lead_confirmed, DROP COLUMN lead_catcher, DROP COLUMN lead_catcher_data, DROP COLUMN lead_social_profile');
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Re-creating the leads table, adding the fields table for leads, adds the option 'opanda_catch_leads' for lockers.
*
* @since 4.1.2
*/
class SocialLockerUpdate040102 extends Factory325_Update {
public function install() {
// updating the options Terms of Use and Privacy Policy
$pageTermsOfUse = get_option('opanda_terms_of_use', false);
$pagePrivacyPolicy = get_option('opanda_privacy_policy', false);
if ( !empty( $pageTermsOfUse ) ) {
add_option('opanda_terms_of_use_page', $pageTermsOfUse);
add_option('opanda_terms_use_pages', true);
}
if ( !empty( $pagePrivacyPolicy ) ) {
add_option('opanda_privacy_policy_page', $pagePrivacyPolicy);
add_option('opanda_terms_use_pages', true);
}
delete_option('opanda_terms_of_use');
delete_option('opanda_privacy_policy');
add_option('opanda_terms_enabled', 1);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Re-creating the leads table, adding the fields table for leads, adds the option 'opanda_catch_leads' for lockers.
*
* @since 4.1.2
*/
class SocialLockerUpdate040105 extends Factory325_Update {
public function install() {
$lockers = get_posts(array(
'post_type' => OPANDA_POST_TYPE,
'meta_key' => 'opanda_item',
'meta_value' => 'social-locker',
'numberposts' => -1
));
foreach( $lockers as $locker ) {
$url = get_post_meta( $locker->ID, 'opanda_common_url', true );
if ( empty( $url ) ) continue;
$facebookUrl = get_post_meta( $locker->ID, 'opanda_facebook_like_url', true );
$twitterUrl = get_post_meta( $locker->ID, 'opanda_twitter_tweet_url', true );
$googleUrl = get_post_meta( $locker->ID, 'opanda_google_plus_url', true );
if ( empty( $facebookUrl ) ) update_post_meta( $locker->ID, 'opanda_facebook_like_url', $url );
if ( empty( $twitterUrl ) ) update_post_meta( $locker->ID, 'opanda_twitter_tweet_url', $url );
if ( empty( $googleUrl ) ) update_post_meta( $locker->ID, 'opanda_google_plus_url', $url );
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Re-creating the leads table, adding the fields table for leads, adds the option 'opanda_catch_leads' for lockers.
*
* @since 4.1.2
*/
class SocialLockerUpdate040109 extends Factory325_Update {
public function install() {
// adds the option 'opanda_catch_leads'
$lockers = get_posts(array(
'post_type' => OPANDA_POST_TYPE,
'numberposts' => -1
));
foreach( $lockers as $locker ) {
$itemType = get_post_meta($locker->ID, 'opanda_item', true);
if ( 'email-locker' !== $itemType ) continue;
$requireName = get_post_meta($locker->ID, 'opanda_subscribe_name', true);
add_post_meta( $locker->ID, 'opanda_form_type', empty( $requireName ) ? 'email-form' : 'name-email-form' );
}
// updaing the database
global $wpdb;
$sql = "
CREATE TABLE {$wpdb->prefix}opanda_leads_fields (
lead_id int(10) UNSIGNED NOT NULL,
field_name varchar(255) NOT NULL,
field_value text NOT NULL,
field_custom bit(1) NOT NULL DEFAULT b'0',
KEY IDX_wp_opanda_leads_fields_field_name (field_name),
UNIQUE KEY UK_wp_opanda_leads_fields (lead_id,field_name)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Re-creating the leads table, adding the fields table for leads, adds the option 'opanda_catch_leads' for lockers.
*
* @since 4.1.2
*/
class SocialLockerUpdate040307 extends Factory325_Update {
public function install() {
// updaing the database
global $wpdb;
$leads = "
CREATE TABLE {$wpdb->prefix}opanda_leads (
ID int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
lead_display_name varchar(255) DEFAULT NULL,
lead_name varchar(100) DEFAULT NULL,
lead_family varchar(100) DEFAULT NULL,
lead_email varchar(50) NOT NULL,
lead_date int(11) NOT NULL,
lead_email_confirmed int(1) NOT NULL DEFAULT 0 COMMENT 'email',
lead_subscription_confirmed int(1) NOT NULL DEFAULT 0 COMMENT 'subscription',
lead_ip varchar(45) DEFAULT NULL,
lead_item_id int(11) DEFAULT NULL,
lead_post_id int(11) DEFAULT NULL,
lead_item_title varchar(255) DEFAULT NULL,
lead_post_title varchar(255) DEFAULT NULL,
lead_referer text DEFAULT NULL,
lead_confirmation_code varchar(32) DEFAULT NULL,
lead_temp text DEFAULT NULL,
PRIMARY KEY (ID),
UNIQUE KEY lead_email (lead_email)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($leads);
}
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* Updates options.
* @since 5.2.0
*/
class SocialLockerUpdate050200 extends Factory325_Update {
public function install() {
$termsEnabled = get_option('opanda_terms_enabled', 1);
update_option('opanda_privacy_enabled', $termsEnabled ? 1 : 0);
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Updates options.
* @since 5.2.0
*/
class SocialLockerUpdate050505 extends Factory325_Update {
public function install() {
$facebookAppId = get_option('opanda_facebook_appid');
if ( !empty( $facebookAppId ) ) {
update_option('opanda_facebook_app_id', $facebookAppId );
delete_option('opanda_facebook_appid');
}
$twitterConsumerKey = get_option('opanda_twitter_consumer_key');
if ( !empty( $twitterConsumerKey ) ) {
update_option('opanda_twitter_social_app_consumer_key', $twitterConsumerKey );
update_option('opanda_twitter_signin_app_consumer_key', $twitterConsumerKey );
delete_option('opanda_twitter_consumer_key');
}
$twitterConsumerSecret = get_option('opanda_twitter_consumer_secret');
if ( !empty( $twitterConsumerSecret ) ) {
update_option('opanda_twitter_social_app_consumer_secret', $twitterConsumerKey );
update_option('opanda_twitter_signin_app_consumer_secret', $twitterConsumerKey );
delete_option('opanda_twitter_consumer_secret');
}
}
}