admin
7 years ago
api
7 years ago
deprecated
7 years ago
donors
7 years ago
emails
7 years ago
forms
7 years ago
gateways
7 years ago
libraries
7 years ago
payments
7 years ago
actions.php
7 years ago
ajax-functions.php
7 years ago
class-give-async-process.php
8 years ago
class-give-background-updater.php
7 years ago
class-give-cache.php
7 years ago
class-give-cli-commands.php
8 years ago
class-give-comment.php
7 years ago
class-give-cron.php
8 years ago
class-give-db-donor-meta.php
8 years ago
class-give-db-donors.php
7 years ago
class-give-db-form-meta.php
8 years ago
class-give-db-logs-meta.php
8 years ago
class-give-db-logs.php
7 years ago
class-give-db-meta.php
7 years ago
class-give-db-payment-meta.php
7 years ago
class-give-db-sequential-ordering.php
7 years ago
class-give-db-sessions.php
7 years ago
class-give-db.php
8 years ago
class-give-donate-form.php
8 years ago
class-give-donor-wall-widget.php
7 years ago
class-give-donor.php
7 years ago
class-give-email-access.php
8 years ago
class-give-html-elements.php
7 years ago
class-give-license-handler.php
7 years ago
class-give-logging.php
8 years ago
class-give-readme-parser.php
8 years ago
class-give-roles.php
8 years ago
class-give-scripts.php
7 years ago
class-give-session.php
7 years ago
class-give-stats.php
8 years ago
class-give-template-loader.php
8 years ago
class-give-tooltips.php
8 years ago
class-give-translation.php
8 years ago
class-notices.php
7 years ago
country-functions.php
8 years ago
currency-functions.php
7 years ago
error-tracking.php
8 years ago
filters.php
7 years ago
formatting.php
7 years ago
import-functions.php
7 years ago
install.php
7 years ago
login-register.php
8 years ago
misc-functions.php
7 years ago
plugin-compatibility.php
8 years ago
post-types.php
8 years ago
price-functions.php
7 years ago
process-donation.php
7 years ago
shortcodes.php
7 years ago
template-functions.php
8 years ago
user-functions.php
7 years ago
class-give-db-payment-meta.php
96 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Payment Meta DB class |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Classes/DB Payment Meta |
| 7 | * @copyright Copyright (c) 2016, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 2.0 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Class Give_DB_Payment_Meta |
| 19 | * |
| 20 | * This class is for interacting with the payment meta database table. |
| 21 | * |
| 22 | * @since 2.0 |
| 23 | */ |
| 24 | class Give_DB_Payment_Meta extends Give_DB_Meta { |
| 25 | /** |
| 26 | * Post type |
| 27 | * |
| 28 | * @since 2.0 |
| 29 | * @access protected |
| 30 | * @var bool |
| 31 | */ |
| 32 | protected $post_type = 'give_payment'; |
| 33 | |
| 34 | /** |
| 35 | * Meta type |
| 36 | * |
| 37 | * @since 2.0 |
| 38 | * @access protected |
| 39 | * @var bool |
| 40 | */ |
| 41 | protected $meta_type = 'donation'; |
| 42 | |
| 43 | /** |
| 44 | * Give_DB_Payment_Meta constructor. |
| 45 | * |
| 46 | * @access public |
| 47 | * @since 2.0 |
| 48 | */ |
| 49 | public function __construct() { |
| 50 | /* @var WPDB $wpdb */ |
| 51 | global $wpdb; |
| 52 | |
| 53 | // @todo: We leave $wpdb->paymentmeta for backward compatibility, use $wpdb->donationmeta instead. We can remove it after 2.1.3. |
| 54 | $wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix . 'give_donationmeta'; |
| 55 | $this->version = '1.0'; |
| 56 | |
| 57 | // Backward compatibility. |
| 58 | if ( ! give_has_upgrade_completed( 'v220_rename_donation_meta_type' ) ) { |
| 59 | $this->meta_type = 'payment'; |
| 60 | $wpdb->paymentmeta = $wpdb->donationmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta'; |
| 61 | } |
| 62 | |
| 63 | $this->register_table(); |
| 64 | |
| 65 | parent::__construct(); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Get table columns and data types. |
| 70 | * |
| 71 | * @access public |
| 72 | * @since 2.0 |
| 73 | * |
| 74 | * @return array Columns and formats. |
| 75 | */ |
| 76 | public function get_columns() { |
| 77 | return array( |
| 78 | 'meta_id' => '%d', |
| 79 | "{$this->meta_type}_id" => '%d', |
| 80 | 'meta_key' => '%s', |
| 81 | 'meta_value' => '%s', |
| 82 | ); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * check if custom meta table enabled or not. |
| 87 | * |
| 88 | * @since 2.0 |
| 89 | * @access protected |
| 90 | * @return bool |
| 91 | */ |
| 92 | protected function is_custom_meta_table_active() { |
| 93 | return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
| 94 | } |
| 95 | } |
| 96 |