PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.41
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.41
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
wp-data-access / WPDataAccess / Plugin_Table_Models / WPDA_Publisher_Model.php

WPDA_Publisher_Model.php in WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards 5.5.41, at WPDataAccess/Plugin_Table_Models/WPDA_Publisher_Model.php

90 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
5 *
6 * @package WPDataAccess\Plugin_Table_Models
7 */
8 namespace WPDataAccess\Plugin_Table_Models;
9
10 use WPDataAccess\WPDA;
11 use WPDataAccess\Connection\WPDADB;
12 /**
13 * Class WPDA_Publisher_Model
14 *
15 * Model for plugin table 'publisher'
16 *
17 * @author Peter Schulz
18 * @since 2.6.0
19 */
20 class WPDA_Publisher_Model extends WPDA_Plugin_Table_Base_Model {
21 const BASE_TABLE_NAME = 'wpda_publisher';
22
23 // Old plugin table name: do NOT change!
24 /**
25 * Return the data table for a specific publication id
26 *
27 * @param int $pub_id Publication id
28 *
29 * @return bool|array
30 */
31 public static function get_publication( $pub_id ) {
32 global $wpdb;
33 $dataset = $wpdb->get_results(
34 $wpdb->prepare(
35 'SELECT * FROM `%1s` WHERE pub_id = %d',
36 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
37 array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_id)
38 ),
39 // db call ok; no-cache ok.
40 'ARRAY_A'
41 );
42 // phpcs:ignore Standard.Category.SniffName.ErrorCode
43 return ( 1 === $wpdb->num_rows ? $dataset : false );
44 }
45
46 /**
47 * Return the publication for a specific publication name
48 *
49 * @param int $pub_name Publication name
50 *
51 * @return bool|array
52 */
53 public static function get_publication_by_name( $pub_name ) {
54 global $wpdb;
55 $dataset = $wpdb->get_results(
56 $wpdb->prepare(
57 'SELECT * FROM `%1s` WHERE pub_name = %s',
58 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
59 array(WPDA::remove_backticks( self::get_base_table_name() ), $pub_name)
60 ),
61 // db call ok; no-cache ok.
62 'ARRAY_A'
63 );
64 // phpcs:ignore Standard.Category.SniffName.ErrorCode
65 return ( 1 === $wpdb->num_rows ? $dataset : false );
66 }
67
68 public static function get_publication_list() {
69 global $wpdb;
70 return $wpdb->get_results(
71 $wpdb->prepare(
72 'SELECT * FROM `%1s` ORDER BY pub_name',
73 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
74 array(WPDA::remove_backticks( self::get_base_table_name() ))
75 ),
76 // db call ok; no-cache ok.
77 'ARRAY_A'
78 );
79 // phpcs:ignore Standard.Category.SniffName.ErrorCode
80 }
81
82 public static function get_temporary_table_from_custom_query( $database, $query ) {
83 $response = array(
84 'data' => array(),
85 'msg' => '',
86 );
87 }
88
89 }
90