Commit c12566f6 authored by jcnventura's avatar jcnventura

Misc D7 updates

parent e79ee82e
......@@ -7,3 +7,4 @@ files[] = print.module
files[] = print.admin.inc
files[] = print.pages.inc
files[] = print.install
configure = admin/config/print
......@@ -3,7 +3,7 @@
/**
* @file
* Install file of the print module
* Install, update and uninstall functions for the print module.
*
* @ingroup print
*/
......@@ -22,8 +22,6 @@ function print_install() {
* Implements hook_uninstall().
*/
function print_uninstall() {
drupal_uninstall_schema('print');
variable_del('print_settings');
variable_del('print_sourceurl_settings');
variable_del('print_html_settings');
......@@ -74,11 +72,13 @@ function print_uninstall() {
*/
function print_schema() {
$schema['print_node_conf'] = array(
'description' => 'Printer-friendly version node-specific configuration settings',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The {node}.nid of the node.',
),
'link' => array(
'type' => 'int',
......@@ -86,6 +86,7 @@ function print_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link',
),
'comments' => array(
'type' => 'int',
......@@ -93,6 +94,7 @@ function print_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link in individual comments',
),
'url_list' => array(
'type' => 'int',
......@@ -100,17 +102,20 @@ function print_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show Printer-friendly URLs list',
),
),
'primary key' => array('nid'),
);
$schema['print_page_counter'] = array(
'description' => 'Printer-friendly version access counter',
'fields' => array(
'path' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'description' => 'Page path',
),
'totalcount' => array(
'type' => 'int',
......@@ -118,12 +123,14 @@ function print_schema() {
'not null' => TRUE,
'default' => 0,
'size' => 'big',
'description' => 'Number of page accesses',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Last access',
),
),
'primary key' => array('path'),
......
......@@ -86,10 +86,6 @@ define('PRINT_TYPE_FIELDS_WEIGHT', 30);
*/
function print_permission() {
return array(
'access print' => array(
'title' => t('Access the printer-friendly page'),
'description' => t('View the printer-friendly pages and the links to them in the original pages.'),
),
'administer print' => array(
'title' => t('Administer the module'),
'description' => t('Perform maintenance tasks for the print module.'),
......@@ -98,6 +94,10 @@ function print_permission() {
'title' => t('Node-specific configuration'),
'description' => t('Enable access to the per-node settings.'),
),
'access print' => array(
'title' => t('Access the printer-friendly page'),
'description' => t('View the printer-friendly pages and the links to them in the original pages.'),
),
);
}
......@@ -134,11 +134,12 @@ function print_preprocess_print_node(&$vars) {
$format = $vars['type'];
$type = $vars['node']->type;
template_preprocess_node($vars);
$vars['template_files'][] = "node";
$vars['template_files'][] = "node-$type";
$vars['template_files'][] = "print_node";
$vars['template_files'][] = "print_node_$format";
$vars['template_files'][] = "print_node_$format.node-$type";
$variables['theme_hook_suggestions'][] = "node";
$variables['theme_hook_suggestions'][] = "node__$type";
$variables['theme_hook_suggestions'][] = "print_node";
$variables['theme_hook_suggestions'][] = "print_node_$format";
$variables['theme_hook_suggestions'][] = "print_node_$format.node__$type";
}
/**
......@@ -147,10 +148,10 @@ function print_preprocess_print_node(&$vars) {
function print_preprocess_print_page(&$vars) {
$format = $vars['type'];
$type = $vars['node']->type;
$vars['template_files'][] = "print";
$vars['template_files'][] = "print.node-$type";
$vars['template_files'][] = "print_$format";
$vars['template_files'][] = "print_$format.node-$type";
$variables['theme_hook_suggestions'][] = "print";
$variables['theme_hook_suggestions'][] = "print.node__$type";
$variables['theme_hook_suggestions'][] = "print_$format";
$variables['theme_hook_suggestions'][] = "print_$format.node__$type";
}
/**
......
......@@ -275,7 +275,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
if (is_int($cid)) {
$url .= '#comment-$cid';
}
$retrieved_date = format_date(REQUEST_TIME, 'small');
$retrieved_date = format_date(REQUEST_TIME, 'short');
$print_text_retrieved = filter_xss(variable_get('print_text_retrieved', t('retrieved on %date')));
$retrieved = t($print_text_retrieved, array('%date' => $retrieved_date));
$print['printdate'] = $print_sourceurl_date ? " ($retrieved)" : '';
......@@ -296,7 +296,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
$print['submitted'] = t($print_text_by, array('%author' => $by_author));
$print_text_created = filter_xss(variable_get('print_text_created', t('Created %date')));
$created_datetime = format_date($node->created, 'small');
$created_datetime = format_date($node->created, 'short');
$print['created'] = t($print_text_created, array('%date' => $created_datetime));
}
else {
......@@ -629,7 +629,7 @@ function _print_generate_path($path, $format = PRINT_HTML_FORMAT, $teaser = FALS
$node->body = menu_execute_active_handler($path);
// It may happen that a drupal_not_found is called in the above call
if (preg_match('/404 Not Found/', drupal_get_headers()) == 1) {
if (preg_match('/404 Not Found/', drupal_get_http_header()) == 1) {
return FALSE;
}
......
......@@ -342,7 +342,7 @@ function print_mail_mail($key, &$message, $params) {
switch ($key) {
case 'sendpage':
$message['body'] = $params['body'];
$message['body'] = check_plain($params['body']);
$message['headers']['Content-Type'] = 'text/html; charset=utf-8';
break;
case 'sendlink':
......@@ -352,7 +352,7 @@ function print_mail_mail($key, &$message, $params) {
// Send HTML-only version if MIME library not present
if (!class_exists('Mail_mime')) {
$message['body'] = $sendlink_html;
$message['body'] = check_plain($sendlink_html);
$message['headers']['Content-Type'] = 'text/html; charset=utf-8';
break;
}
......@@ -379,7 +379,7 @@ function print_mail_mail($key, &$message, $params) {
}
// Store MIME message output in message array
$message['body'] = $mime->get($mime_params);
$message['body'] = check_plain($mime->get($mime_params));
$message['headers'] = $mime->headers($message['headers']);
// Strip special characters from Content-Type header
......
; $Id$
name = "Send by e-mail"
description = "Provides the capability to send the web page by e-mail"
dependencies[] = print
core=7.x
package = "Printer, e-mail and PDF versions"
dependencies[] = print
files[] = print_mail.module
files[] = print_mail.inc
files[] = print_mail.admin.inc
files[] = print_mail.install
configure = admin/config/print/email
......@@ -3,7 +3,7 @@
/**
* @file
* Install file of the print_mail module
* Install, update and uninstall functions for the print_mail module.
*
* @ingroup print
*/
......@@ -12,8 +12,6 @@
* Implements hook_uninstall().
*/
function print_mail_uninstall() {
drupal_uninstall_schema('print_mail');
variable_del('print_mail_settings');
variable_del('print_mail_show_link');
variable_del('print_mail_link_pos');
......@@ -45,11 +43,13 @@ function print_mail_uninstall() {
*/
function print_mail_schema() {
$schema['print_mail_node_conf'] = array(
'description' => 'Send by e-mail node-specific configuration settings',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The {node}.nid of the node.',
),
'link' => array(
'type' => 'int',
......@@ -57,6 +57,7 @@ function print_mail_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link',
),
'comments' => array(
'type' => 'int',
......@@ -64,6 +65,7 @@ function print_mail_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link in individual comments',
),
'url_list' => array(
'type' => 'int',
......@@ -71,17 +73,20 @@ function print_mail_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show Printer-friendly URLs list',
),
),
'primary key' => array('nid'),
);
$schema['print_mail_page_counter'] = array(
'description' => 'Send by e-mail version access counter',
'fields' => array(
'path' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'description' => 'Page path',
),
'totalcount' => array(
'type' => 'int',
......@@ -89,12 +94,14 @@ function print_mail_schema() {
'not null' => TRUE,
'default' => 0,
'size' => 'big',
'description' => 'Number of page accesses',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Last access',
),
'sentcount' => array(
'type' => 'int',
......@@ -102,12 +109,14 @@ function print_mail_schema() {
'not null' => TRUE,
'default' => 0,
'size' => 'big',
'description' => 'Number of sent emails',
),
'sent_timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Last e-mail sent',
),
),
'primary key' => array('path'),
......
......@@ -260,13 +260,7 @@ function _print_pdf_tools() {
return -1;
}
else {
// Instead of array_combine(), use this to maintain PHP4 compatibility
$tools2 = array();
foreach ($tools as $key => $val) {
$tools2[$val] = $val;
}
return $tools2;
return array_combine($tools, $tools);
}
}
......
; $Id$
name = "PDF version"
description = "Adds the capability to export pages as PDF."
dependencies[] = print
core=7.x
package = "Printer, e-mail and PDF versions"
dependencies[] = print
files[] = print_pdf.module
files[] = print_pdf.admin.inc
files[] = print_pdf.pages.inc
files[] = print_pdf.install
configure = admin/config/print/pdf
......@@ -3,7 +3,7 @@
/**
* @file
* Install file of the print_pdf module
* Install, update and uninstall functions for the print_pdf module.
*
* @ingroup print
*/
......@@ -12,8 +12,6 @@
* Implements hook_uninstall().
*/
function print_pdf_uninstall() {
drupal_uninstall_schema('print_pdf');
variable_del('print_pdf_settings');
variable_del('print_pdf_show_link');
variable_del('print_pdf_link_pos');
......@@ -47,11 +45,13 @@ function print_pdf_uninstall() {
*/
function print_pdf_schema() {
$schema['print_pdf_node_conf'] = array(
'description' => 'PDF version node-specific configuration settings',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The {node}.nid of the node.',
),
'link' => array(
'type' => 'int',
......@@ -59,6 +59,7 @@ function print_pdf_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link',
),
'comments' => array(
'type' => 'int',
......@@ -66,6 +67,7 @@ function print_pdf_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show link in individual comments',
),
'url_list' => array(
'type' => 'int',
......@@ -73,17 +75,20 @@ function print_pdf_schema() {
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
'description' => 'Show Printer-friendly URLs list',
),
),
'primary key' => array('nid'),
);
$schema['print_pdf_page_counter'] = array(
'description' => 'PDF version access counter',
'fields' => array(
'path' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'description' => 'Page path',
),
'totalcount' => array(
'type' => 'int',
......@@ -91,12 +96,14 @@ function print_pdf_schema() {
'not null' => TRUE,
'default' => 0,
'size' => 'big',
'description' => 'Number of page accesses',
),
'timestamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Last access',
),
),
'primary key' => array('path'),
......
......@@ -298,7 +298,7 @@ function _print_pdf_wkhtmltopdf($print, $html, $filename) {
$dpi = 96;
if (!empty($print_pdf_wkhtmltopdf_options)) {
$print_pdf_wkhtmltopdf_options = token_replace($print_pdf_wkhtmltopdf_options, 'node', $print['node']);
$print_pdf_wkhtmltopdf_options = token_replace($print_pdf_wkhtmltopdf_options, array('node' => $print['node']));
}
$descriptor = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment