$options = new Options();
$options->set( 'isRemoteEnabled', true );
// instantiate and use the dompdf class
$dompdf = new Dompdf( $options );
$stream_context = stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
),
)
);
$dompdf->setHttpContext( $stream_context );
$context = Timber::get_context();
$post = new Timber\Post( $_GET['id'] );
$post->content = preg_replace( '#<div(.*?)class="wp-block-spacer">(.*?)</div>#', '', $post->get_content() );
$context['post'] = $post;
$context['stylesheet'] = get_stylesheet_directory_uri() . '/dist/css/pdf.css';
$context['pdfPageIntro'] = get_stylesheet_directory_uri() . '/src/images/pdf-page-intro.png';
$context['logo'] = get_stylesheet_directory_uri() . '/src/images/pdf-aber-logo.png';
$context['employeeBenefits'] = get_stylesheet_directory_uri() . '/src/images/employee-benefits.png';
$html = Timber::compile( 'pdf-download.twig', $context );
$dompdf->loadHtml( $html );
// (Optional) Setup the paper size and orientation
$dompdf->setPaper( 'A4', 'portrait' );
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$options = new Options();
$options->set( 'isRemoteEnabled', true );
// instantiate and use the dompdf class
$dompdf = new Dompdf( $options );
$stream_context = stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
),
)
);
$dompdf->setHttpContext( $stream_context );
$context = Timber::get_context();
$post = new Timber\Post( $_GET['id'] );
$post->content = preg_replace( '#<div(.*?)class="wp-block-spacer">(.*?)</div>#', '', $post->get_content() );
$context['post'] = $post;
$context['stylesheet'] = get_stylesheet_directory_uri() . '/dist/css/pdf.css';
$context['pdfPageIntro'] = get_stylesheet_directory_uri() . '/src/images/pdf-page-intro.png';
$context['logo'] = get_stylesheet_directory_uri() . '/src/images/pdf-aber-logo.png';
$context['employeeBenefits'] = get_stylesheet_directory_uri() . '/src/images/employee-benefits.png';
$html = Timber::compile( 'pdf-download.twig', $context );
$dompdf->loadHtml( $html );
// (Optional) Setup the paper size and orientation
$dompdf->setPaper( 'A4', 'portrait' );
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
}
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;
}
<?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';
}
<?php
ini_set( 'display_errors', 1 );
ini_set( 'display_startup_errors', 1 );
error_reporting( E_ALL );
// WordPress view bootstrapper
define( 'WP_USE_THEMES', true );
require './wordpress/wp-blog-header.php';
Key | Value |
SERVER_SOFTWARE | nginx/1.20.2 |
REQUEST_URI | /pdf-download/ |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_PORT | 3306 |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_PROTO | tcp |
DATABASE_URL | mysql://mysql:5afd5818a9c38acd@dokku-mysql-staging:3306/staging |
HOSTNAME | 019a11bd8427 |
PHP_INI_DIR | /etc/php7 |
SHLVL | 1 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_ADDR | 172.17.0.2 |
PORT | 443 |
HOME | /root |
DOKKU_MYSQL_STAGING_PORT | tcp://172.17.0.2:3306 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_PASSWORD | 5afd5818a9c38acd |
DOKKU_MYSQL_STAGING_PORT_3306_TCP | tcp://172.17.0.2:3306 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_PORT | 33060 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_VERSION | 5.7.28-1debian9 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_PROTO | tcp |
DOKKU_PROXY_SSL_PORT | 443 |
DOKKU_MYSQL_STAGING_NAME | /clever_montalcini/dokku-mysql-staging |
DOKKU_MYSQL_STAGING_ENV_MYSQL_USER | mysql |
DOKKU_APP_RESTORE | 1 |
COMPOSER_ALLOW_SUPERUSER | 1 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP | tcp://172.17.0.2:33060 |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
DOKKU_MYSQL_STAGING_ENV_MYSQL_DATABASE | staging |
MAGICK_HOME | /usr |
DOKKU_DOCKERFILE_PORTS | 443/tcp 80/tcp |
DOKKU_PROXY_PORT_MAP | http:80:443 https:443:443 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_MAJOR | 5.7 |
PWD | /var/www/html |
DOKKU_LETSENCRYPT_EMAIL | stefan@poweredbycoffee.co.uk |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_ADDR | 172.17.0.2 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_ROOT_PASSWORD | d2a609121b2c9651 |
DYNO | web.1 |
DOKKU_MYSQL_STAGING_ENV_GOSU_VERSION | 1.7 |
HTTP_ACCEPT_ENCODING | br,gzip |
HTTP_ACCEPT_LANGUAGE | en-US,en;q=0.5 |
HTTP_ACCEPT | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 |
HTTP_USER_AGENT | CCBot/2.0 (https://commoncrawl.org/faq/) |
HTTP_X_REQUEST_START | 1685241957.222 |
HTTP_X_FORWARDED_PORT | 443 |
HTTP_X_FORWARDED_FOR | 18.207.240.77 |
HTTP_X_FORWARDED_PROTO | https |
HTTP_HOST | staging.aber.pbc.io |
HTTP_CONNECTION | Keep-Alive |
REDIRECT_STATUS | 200 |
SERVER_NAME | _ |
SERVER_PORT | 443 |
SERVER_ADDR | 172.17.0.4 |
REMOTE_PORT | 33384 |
REMOTE_ADDR | 172.17.0.1 |
GATEWAY_INTERFACE | CGI/1.1 |
HTTPS | on |
REQUEST_SCHEME | https |
SERVER_PROTOCOL | HTTP/1.1 |
DOCUMENT_ROOT | ******************** |
DOCUMENT_URI | /index.php |
SCRIPT_NAME | /index.php |
CONTENT_LENGTH | |
CONTENT_TYPE | |
REQUEST_METHOD | GET |
QUERY_STRING | |
SCRIPT_FILENAME | ****************************** |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1685241957.224 |
REQUEST_TIME | 1685241957 |
WP_ENV | ******* |
DB_NAME | ******* |
DB_USER | ***** |
DB_PASSWORD | **************** |
DB_HOST | ************************ |
WP_HOME | *************************** |
WP_SITEURL | ************************************* |
GOOGLE_MAPS_KEY |
Key | Value |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_PORT | 3306 |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_PROTO | tcp |
DATABASE_URL | mysql://mysql:5afd5818a9c38acd@dokku-mysql-staging:3306/staging |
HOSTNAME | 019a11bd8427 |
PHP_INI_DIR | /etc/php7 |
SHLVL | 1 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_ADDR | 172.17.0.2 |
PORT | 443 |
HOME | /root |
DOKKU_MYSQL_STAGING_PORT | tcp://172.17.0.2:3306 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_PASSWORD | 5afd5818a9c38acd |
DOKKU_MYSQL_STAGING_PORT_3306_TCP | tcp://172.17.0.2:3306 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_PORT | 33060 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_VERSION | 5.7.28-1debian9 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP_PROTO | tcp |
DOKKU_PROXY_SSL_PORT | 443 |
DOKKU_MYSQL_STAGING_NAME | /clever_montalcini/dokku-mysql-staging |
DOKKU_MYSQL_STAGING_ENV_MYSQL_USER | mysql |
DOKKU_APP_RESTORE | 1 |
COMPOSER_ALLOW_SUPERUSER | 1 |
DOKKU_MYSQL_STAGING_PORT_33060_TCP | tcp://172.17.0.2:33060 |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
DOKKU_MYSQL_STAGING_ENV_MYSQL_DATABASE | staging |
MAGICK_HOME | /usr |
DOKKU_DOCKERFILE_PORTS | 443/tcp 80/tcp |
DOKKU_PROXY_PORT_MAP | http:80:443 https:443:443 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_MAJOR | 5.7 |
PWD | /var/www/html |
DOKKU_LETSENCRYPT_EMAIL | stefan@poweredbycoffee.co.uk |
DOKKU_MYSQL_STAGING_PORT_3306_TCP_ADDR | 172.17.0.2 |
DOKKU_MYSQL_STAGING_ENV_MYSQL_ROOT_PASSWORD | d2a609121b2c9651 |
DYNO | web.1 |
DOKKU_MYSQL_STAGING_ENV_GOSU_VERSION | 1.7 |
HTTP_ACCEPT_ENCODING | br,gzip |
HTTP_ACCEPT_LANGUAGE | en-US,en;q=0.5 |
HTTP_ACCEPT | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 |
HTTP_USER_AGENT | CCBot/2.0 (https://commoncrawl.org/faq/) |
HTTP_X_REQUEST_START | 1685241957.222 |
HTTP_X_FORWARDED_PORT | 443 |
HTTP_X_FORWARDED_FOR | 18.207.240.77 |
HTTP_X_FORWARDED_PROTO | https |
HTTP_HOST | staging.aber.pbc.io |
HTTP_CONNECTION | Keep-Alive |
REDIRECT_STATUS | 200 |
SERVER_NAME | _ |
SERVER_PORT | 443 |
SERVER_ADDR | 172.17.0.4 |
REMOTE_PORT | 33384 |
REMOTE_ADDR | 172.17.0.1 |
SERVER_SOFTWARE | nginx/1.20.2 |
GATEWAY_INTERFACE | CGI/1.1 |
HTTPS | on |
REQUEST_SCHEME | https |
SERVER_PROTOCOL | HTTP/1.1 |
DOCUMENT_ROOT | /var/www/html/public |
DOCUMENT_URI | /index.php |
REQUEST_URI | /pdf-download/ |
SCRIPT_NAME | /index.php |
CONTENT_LENGTH | |
CONTENT_TYPE | |
REQUEST_METHOD | GET |
QUERY_STRING | |
SCRIPT_FILENAME | /var/www/html/public/index.php |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1685241957.224 |
REQUEST_TIME | 1685241957 |
WP_ENV | ******* |
DB_NAME | ******* |
DB_USER | ***** |
DB_PASSWORD | **************** |
DB_HOST | ************************ |
WP_HOME | *************************** |
WP_SITEURL | ************************************* |
GOOGLE_MAPS_KEY |