| @@ -6,8 +6,10 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Timetics\Base; |
| 9 | 9 | |
| 10 | +defined( 'ABSPATH' ) || exit; | |
| 11 | + | |
| 10 | 12 | use Timetics\Base\ForwardCalls; |
| 11 | 13 | |
| 12 | 14 | /** |
| 13 | 15 | * Class Post Model |
| @@ -46,9 +48,10 @@ | ||
| 46 | 48 | if ( isset( $this->data[$name] ) ) { |
| 47 | 49 | return $this->data[$name]; |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | - throw new \Exception( sprintf( __( 'Undefined property %s', 'timetics' ), $name ) ); | |
| 52 | + /* translators: %s: Property name */ | |
| 53 | + throw new \Exception( sprintf( esc_html__( 'Undefined property %s', 'timetics' ), esc_attr( $name ) ) ); | |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | 56 | /** |
| 54 | 57 | * Set dynamic property |
| @@ -59,9 +62,10 @@ | ||
| 59 | 62 | * @return void |
| 60 | 63 | */ |
| 61 | 64 | public function __set( $key, $value ) { |
| 62 | 65 | if ( ! isset( $this->data[$key] ) ) { |
| 63 | - throw new \Exception( sprintf( __( 'Undefined property %s', 'timetics' ), $key ) ); | |
| 66 | + /* translators: %s: Property name */ | |
| 67 | + throw new \Exception( sprintf( esc_html__( 'Undefined property %s', 'timetics' ), esc_attr( $key ) ) ); | |
| 64 | 68 | } |
| 65 | 69 | |
| 66 | 70 | $this->data[$key] = $value; |
| 67 | 71 | } |
| @@ -158,8 +162,9 @@ | ||
| 158 | 162 | ]; |
| 159 | 163 | |
| 160 | 164 | if ( $meta ) { |
| 161 | 165 | $meta['relation'] = 'AND'; |
| 166 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Meta query is necessary for filtering posts by meta fields | |
| 162 | 167 | $args['meta_query'] = $meta; |
| 163 | 168 | } |
| 164 | 169 | |
| 165 | 170 | $posts = get_posts( $args ); |