"itemListElement" => $breadcrumbItems
];
return (object) [
'name' => $this->name,
'data' => json_encode($structuredData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
];
}
/**
* Recupera gli elementi del breadcrumb
*/
private function getBreadcrumbItems(): array {
if (empty($this->data)) return [];
return array_map(function ($item, $index) {
return [
'@type' => 'ListItem',
'position' => $index + 1,
'name' => $item['label'], // Uso 'label' invece di 'name'
'item' => home_url() . $item['url'] ?? null
];
}, $this->data, array_keys($this->data));
}
}
"Object of class WP_Error could not be converted to string"
return (object) [
'name' => $this->name,
'data' => json_encode($structuredData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
];
}
/**
* Recupera gli elementi del breadcrumb
*/
private function getBreadcrumbItems(): array {
if (empty($this->data)) return [];
return array_map(function ($item, $index) {
return [
'@type' => 'ListItem',
'position' => $index + 1,
'name' => $item['label'], // Uso 'label' invece di 'name'
'item' => home_url() . $item['url'] ?? null
];
}, $this->data, array_keys($this->data));
}
}
public function __construct($post_id, $data = null) {
// Rimuove i breadcrumb di Yoast
add_action('wp', [get_called_class(), 'removeBreadcrumb']);
$this->data = $data["breadcrumbs"] ?? [];
$this->post_id = $post_id;
}
/**
* Rimuove il breadcrumb generato da Yoast SEO
*/
public static function removeBreadcrumb() {
add_filter('wpseo_breadcrumb_links', '__return_false');
}
/**
* Genera i dati strutturati per il breadcrumb
*/
public function getData() {
$breadcrumbItems = $this->getBreadcrumbItems();
$structuredData = empty($breadcrumbItems) ? [] : [
"@context" => "https://schema.org",
"@type" => "BreadcrumbList",
"itemListElement" => $breadcrumbItems
];
return (object) [
'name' => $this->name,
'data' => json_encode($structuredData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
];
}
/**
* Recupera gli elementi del breadcrumb
*/
private function getBreadcrumbItems(): array {
if (empty($this->data)) return [];
return array_map(function ($item, $index) {
return [
'StructuredData',
'Credits',
'Newsletter',
'Canonical',
'Meta',
'MetaTags',
];
}
/**
* Get data from all the components in the
* $components list
*/
private function setComponents() {
foreach($this->components as $component) {
$component = __NAMESPACE__ .'\\Post\Components\\'. $component;
$component_instance = (new $component( $this->post->id , $this->data ) )->getData();
$this->data[$component_instance->name] = $component_instance->data;
}
}
/**
* questa parte deve essere applicata al content
*
* filter the embeds and removes width attributes
*
* va aggiunto ? comunque in content
*//*
protected function removeWidthAttributes(){
$content = $this->data['post']['content'];
$patterns = [
'/width\s*=\s*".*?"/i',
'/height\s*=\s*".*?"/i',
function __construct($post, $postTemplate = 'Single') {
parent::__construct();
$this->post = $post;
// assign the post template (default is 'Single')
$this->postTemplate = $this->postTemplateFactory($postTemplate);
// init the post template
// (includes content details as well)
$this->setPost();
// set the components list into property
// $components
$this->initComponents();
// add all the default components
$this->setComponents();
}
/**
* Writes the basic page info
*/
protected function setPageData(){
$this->data = [
'type' => 'single_post',
'area' => 'learn',
'infinite' => 'true'
];
}
/**
* Add the post info to data
*/
protected function setPost() {
<?php
namespace HTML\ViewModel;
/**
* Set data common to all the single contents
*/
class SingleSoftware extends Single {
function __construct($post, $postTemplate = 'SingleDownload') {
parent::__construct($post, $postTemplate);
}
/**
* Writes the basic page info
*/
protected function setPageData() {
$this->data = [
'type' => 'single_software',
'area' => 'download',
'infinite' => 'true'
];
}
/**
* set the list of the components
* override this to add or remove components
*/
protected function initComponents() {
$this->components = [
'Author',
'Taxonomies',
'Adv',
'Software\BreadcrumbsPrimarySoftware',
<?php
use HTML\ViewModel\SingleSoftware;
use Timber\Timber;
if (have_posts()) {
$os = ( isset( $_GET['os']) );
$nl = ( isset( $_GET['nl']) );
// load data
$single = ( new SingleSoftware($posts[0], 'SingleSplittedContent') )->getData();
//var_dump($single);
$single['current_os'] = $os ? $_GET['os'] : '';
$single['predownload_url'] = $os ? $single['canonical'] . "?os=".$_GET['os'] : '';
$template = $nl ? 'single-predownload-nl.twig' : ($os ? 'single-predownload.twig' : 'single-download.twig');
Timber::render( $template, $single );
}
?>
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
"/data/websites/htmlit/web/app/themes/htmlit/single-software.php"
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
"/data/websites/htmlit/web/wp/wp-includes/template-loader.php"
<?php
/** WordPress view bootstrapper */
define('WP_USE_THEMES', true);
require __DIR__ . '/wp/wp-blog-header.php';
"/data/websites/htmlit/web/wp/wp-blog-header.php"
Key | Value |
SERVER_SOFTWARE | "nginx/1.26.2"
|
REQUEST_URI | "/software/palette-tune/"
|
USER | "nginx"
|
HOME | "/var/lib/nginx"
|
HTTP_REFERER | "https://download.staging.html.it/software/palette-tune"
|
HTTP_ACCEPT_ENCODING | "gzip, br, zstd, deflate"
|
HTTP_USER_AGENT | "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
|
HTTP_ACCEPT | "*/*"
|
HTTP_CONNECTION | "close"
|
HTTP_X_FORWARDED_FOR | "18.191.150.186"
|
HTTP_HOST | "download.staging.html.it"
|
HTTP_X_FORWARDED_PORT | "443"
|
HTTP_X_FORWARDED_PROTO | "https"
|
REDIRECT_STATUS | "200"
|
SERVER_NAME | "download.staging.html.it"
|
SERVER_PORT | "443"
|
SERVER_ADDR | "10.50.50.197"
|
REMOTE_PORT | "34188"
|
REMOTE_ADDR | "10.50.50.12"
|
GATEWAY_INTERFACE | "CGI/1.1"
|
HTTPS | "on"
|
REQUEST_SCHEME | "https"
|
SERVER_PROTOCOL | "HTTP/1.0"
|
DOCUMENT_ROOT | "/data/websites/htmlit/web"
|
DOCUMENT_URI | "/index.php"
|
SCRIPT_NAME | "/index.php"
|
CONTENT_LENGTH | "" |
CONTENT_TYPE | "" |
REQUEST_METHOD | "GET"
|
QUERY_STRING | "" |
SCRIPT_FILENAME | "/data/websites/htmlit/web/index.php"
|
FCGI_ROLE | "RESPONDER"
|
PHP_SELF | "/index.php"
|
REQUEST_TIME_FLOAT | 1739918093.6924
|
REQUEST_TIME | 1739918093
|
DB_NAME | "htmlit"
|
DB_USER | "htmlitUSR"
|
DB_PASSWORD | "Html.IT.P4ss"
|
DB_HOST | "localhost"
|
DB_PREFIX | "wp_html_"
|
WP_REDIS_HOST | "10.50.50.20"
|
WP_REDIS_PASSWORD | "Bl4z3M3d14"
|
WP_REDIS_PORT | "6379"
|
WP_REDIS_TIMEOUT | "1"
|
WP_REDIS_READ_TIMEOUT | "1"
|
WP_REDIS_DATABASE | "4"
|
WP_ENV | "staging"
|
WP_HOME | "https://staging.html.it"
|
WP_SITEURL | "https://staging.html.it/wp"
|
WP_POST_REVISIONS | "0"
|
WP_DEBUG | "true"
|
AUTH_KEY | "u6._>z_ninMX;2(@or{76a|&h}60<.O9ct1vb/k873R],pN{!PcJ;8,uJz}^^@,["
|
SECURE_AUTH_KEY | "gq2=@KGv2dNdCa9Y,O<IapD]qg1c],EweAhkRHz[qy#ADV,4</=yG;:_ED0SF&p^"
|
LOGGED_IN_KEY | ");RTvb(qm&^NzW=V9&`_dry7YP]s{w<M-45>?!s_sPLgN83;632E{eOHthd>pir&"
|
NONCE_KEY | "My2V(Pb!JB!*D4KY2%J){uJ%R>Gq^KGo[wO_M@cTVn(:M;66,3&nImQ:*[>j7NAg"
|
AUTH_SALT | "_B=BH>[M<`g*`BRsoVQKHrLTs.)xO(4mGsN96XTD;8swiS:Kq:kfBsM2U$ke:^`m"
|
SECURE_AUTH_SALT | "x<(bcI]nb]OkroHL#tBE]K8Sf}t3uq=*Spc=2[/>#zG[];Y.b{$*x1y/iWf-ieeE"
|
LOGGED_IN_SALT | "tCZ<vpK^CMV%wZ:r/d[O.cCdxjerA$5#sE^dx|>:cOd#d51B/q[CY[W?sCkVO$!g"
|
NONCE_SALT | "R,{`xn/7rg?jD|/W&[BK^Rc;^CcNzT(m&dnQ@>J0yz2UcC<&ZRYHdr98Z)gi4,Uq"
|
ACF_PRO_KEY | "b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5"
|
GENERIC_TMS_TAG | "//tms.triboomedia.it/utag/triboo/own-html.it/dev/utag.js"
|
GMAPS_API | "AIzaSyCCjf88TJRrIP9HKu2SjR_fRjOkOomnomA"
|
GTM_TAG | "GTM-NJ9VC8"
|
OFFERS_POST_TYPE | "news"
|
OFFERS_LIMIT | "2000"
|
SITE_SPECIAL_TAXONOMY | "tagalert"
|
SITE_FEATURED_CUSTOM_FIELD | "_featured"
|
COOKIE_DOMAIN | "html.it"
|
FORCE_SSL_ADMIN | "false"
|
WP_ALLOW_MULTISITE | "false"
|
Key | Value |
DB_NAME | "htmlit"
|
DB_USER | "htmlitUSR"
|
DB_PASSWORD | "Html.IT.P4ss"
|
DB_HOST | "localhost"
|
DB_PREFIX | "wp_html_"
|
WP_REDIS_HOST | "10.50.50.20"
|
WP_REDIS_PASSWORD | "Bl4z3M3d14"
|
WP_REDIS_PORT | "6379"
|
WP_REDIS_TIMEOUT | "1"
|
WP_REDIS_READ_TIMEOUT | "1"
|
WP_REDIS_DATABASE | "4"
|
WP_ENV | "staging"
|
WP_HOME | "https://staging.html.it"
|
WP_SITEURL | "https://staging.html.it/wp"
|
WP_POST_REVISIONS | "0"
|
WP_DEBUG | "true"
|
AUTH_KEY | "u6._>z_ninMX;2(@or{76a|&h}60<.O9ct1vb/k873R],pN{!PcJ;8,uJz}^^@,["
|
SECURE_AUTH_KEY | "gq2=@KGv2dNdCa9Y,O<IapD]qg1c],EweAhkRHz[qy#ADV,4</=yG;:_ED0SF&p^"
|
LOGGED_IN_KEY | ");RTvb(qm&^NzW=V9&`_dry7YP]s{w<M-45>?!s_sPLgN83;632E{eOHthd>pir&"
|
NONCE_KEY | "My2V(Pb!JB!*D4KY2%J){uJ%R>Gq^KGo[wO_M@cTVn(:M;66,3&nImQ:*[>j7NAg"
|
AUTH_SALT | "_B=BH>[M<`g*`BRsoVQKHrLTs.)xO(4mGsN96XTD;8swiS:Kq:kfBsM2U$ke:^`m"
|
SECURE_AUTH_SALT | "x<(bcI]nb]OkroHL#tBE]K8Sf}t3uq=*Spc=2[/>#zG[];Y.b{$*x1y/iWf-ieeE"
|
LOGGED_IN_SALT | "tCZ<vpK^CMV%wZ:r/d[O.cCdxjerA$5#sE^dx|>:cOd#d51B/q[CY[W?sCkVO$!g"
|
NONCE_SALT | "R,{`xn/7rg?jD|/W&[BK^Rc;^CcNzT(m&dnQ@>J0yz2UcC<&ZRYHdr98Z)gi4,Uq"
|
ACF_PRO_KEY | "b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5"
|
GENERIC_TMS_TAG | "//tms.triboomedia.it/utag/triboo/own-html.it/dev/utag.js"
|
GMAPS_API | "AIzaSyCCjf88TJRrIP9HKu2SjR_fRjOkOomnomA"
|
GTM_TAG | "GTM-NJ9VC8"
|
OFFERS_POST_TYPE | "news"
|
OFFERS_LIMIT | "2000"
|
SITE_SPECIAL_TAXONOMY | "tagalert"
|
SITE_FEATURED_CUSTOM_FIELD | "_featured"
|
COOKIE_DOMAIN | "html.it"
|
FORCE_SSL_ADMIN | "false"
|
WP_ALLOW_MULTISITE | "false"
|