403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/wp-seopress-pro/src/JsonSchemas/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/wp-seopress-pro/src/JsonSchemas/Video.php
<?php

namespace SEOPressPro\JsonSchemas;

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

use SEOPress\Helpers\RichSnippetType;
use SEOPress\JsonSchemas\Image;
use SEOPress\JsonSchemas\Organization;
use SEOPress\Models\GetJsonData;
use SEOPressPro\Models\JsonSchemaValue;

class Video extends JsonSchemaValue implements GetJsonData {
    const NAME = 'video';

    const ALIAS = ['videos'];

    protected function getName() {
        return self::NAME;
    }

    /**
     * @since 4.6.0
     *
     * @return array
     *
     * @param array $schemaManual
     */
    protected function getVariablesForManualSnippet($schemaManual) {
        $keys = [
            'type' => '_seopress_pro_rich_snippets_type',
            'name' => '_seopress_pro_rich_snippets_videos_name',
            'description' => '_seopress_pro_rich_snippets_videos_description',
            'thumbnailUrl' => '_seopress_pro_rich_snippets_videos_img',
            'imgWidth' => '_seopress_pro_rich_snippets_videos_img_width',
            'imgHeight' => '_seopress_pro_rich_snippets_videos_img_height',
            'duration' => '_seopress_pro_rich_snippets_videos_duration',
            'url' => '_seopress_pro_rich_snippets_videos_url',
            'published_date' => '_seopress_pro_rich_snippets_videos_date_posted',
        ];
        $variables = [];

        foreach ($keys as $key => $value) {
            $variables[$key] = isset($schemaManual[$value]) ? $schemaManual[$value] : '';
        }

        return $variables;
    }

    /**
     * @since 4.6.0
     *
     * @param array $context
     *
     * @return array
     */
    public function getJsonData($context = null) {
        $data = $this->getArrayJson();

        $typeSchema = isset($context['type']) ? $context['type'] : RichSnippetType::MANUAL;

        $variables = [];

        switch ($typeSchema) {
            case RichSnippetType::MANUAL:
                $schemaManual = $this->getCurrentSchemaManual($context);

                if (null === $schemaManual) {
                    return $data;
                }

                $variables = $this->getVariablesForManualSnippet($schemaManual);
                break;
        }

        if(isset($variables['published_date']) && !empty($variables['published_date'])){
            $variables['uploadDate'] = $variables['published_date'];
        }
        else if (isset($context['post']->ID)) {
            $variables['uploadDate'] = get_the_date('c', $context['post']->ID);
        }

        if (isset($variables['duration']) && ! empty($variables['duration'])) {
            $time = explode(':', $variables['duration']);
            $sec = isset($time[2]) ? intval($time[2]) : 00;
            $min = isset($time[0]) && isset($time[1]) ? intval($time[0]) * 60.0 + intval($time[1]) * 1.0 : '00:00';

            $variables['duration'] = sprintf('PT%sM%sS', $min, $sec);
        }

        if (isset($variables['url'])) {
            $variables['contentUrl'] = $variables['embedUrl'] = $variables['url'];
        }

        $schema = seopress_get_service('JsonSchemaGenerator')->getJsonFromSchema(Organization::NAME, $context, ['remove_empty' => true]);
        if (count($schema) > 1 && isset($schema['@type']) && 'none' !== $schema['@type']) {
            $data['publisher'] = $schema;

            $logo = seopress_pro_get_service('OptionPro')->getArticlesPublisherLogo();
            if ( ! empty($logo)) {
                $variablesContext = [
                    'url' => $logo,
                    'width' => seopress_pro_get_service('OptionPro')->getArticlesPublisherLogoWidth(),
                    'height' => seopress_pro_get_service('OptionPro')->getArticlesPublisherLogoHeight(),
                ];
                $contextWithVariables = $context;
                $contextWithVariables['variables'] = $variablesContext;

                $schema = seopress_get_service('JsonSchemaGenerator')->getJsonFromSchema(Image::NAME, $contextWithVariables, ['remove_empty' => true]);
                if (count($schema) > 1) {
                    $data['publisher']['logo'] = $schema;
                }
            }
        }

        $data = seopress_get_service('VariablesToString')->replaceDataToString($data, $variables);

        return apply_filters('seopress_pro_get_json_data_video', $data, $context);
    }

    public function cleanValues($data) {
        if (isset($data['publisher']['@context'])) {
            unset($data['publisher']['@context']);
        }

        if (isset($data['publisher']['@type']) && $data['publisher']['@type'] !== 'Organization') {
            if (isset($data['publisher']['logo'])) {
                unset($data['publisher']['logo']);
            }
        }

        return parent::cleanValues($data);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit