class-comment.php
5 months ago
class-join.php
4 months ago
class-meta.php
5 months ago
class-post.php
5 months ago
class-taxonomy.php
5 months ago
class-term-description.php
4 months ago
class-term.php
5 months ago
class-user.php
5 months ago
class-term-description.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SearchRegex\Sql\Join; |
| 4 | |
| 5 | use SearchRegex\Sql; |
| 6 | |
| 7 | /** |
| 8 | * Joins term_taxonomy table for description column |
| 9 | */ |
| 10 | class Term_Description extends Join { |
| 11 | /** |
| 12 | * Constructor |
| 13 | * |
| 14 | * @param string $column Column name. |
| 15 | */ |
| 16 | public function __construct( $column ) { |
| 17 | $this->column = $column; |
| 18 | } |
| 19 | |
| 20 | public function get_select() { |
| 21 | global $wpdb; |
| 22 | |
| 23 | return new Sql\Select\Select( Sql\Value::table( $wpdb->prefix . 'term_taxonomy' ), Sql\Value::column( 'description' ) ); |
| 24 | } |
| 25 | |
| 26 | public function get_from() { |
| 27 | global $wpdb; |
| 28 | |
| 29 | return new Sql\From( Sql\Value::safe_raw( sprintf( 'INNER JOIN %sterm_taxonomy AS tt ON (%sterms.term_id = tt.term_id)', $wpdb->prefix, $wpdb->prefix ) ) ); |
| 30 | } |
| 31 | |
| 32 | public function get_join_column() { |
| 33 | return 'tt.description'; |
| 34 | } |
| 35 | |
| 36 | public function get_join_value( $value ) { |
| 37 | return "$value"; |
| 38 | } |
| 39 | |
| 40 | public function get_table() { |
| 41 | return ''; |
| 42 | } |
| 43 | } |
| 44 |