Commit 1e92a518 authored by jcnventura's avatar jcnventura

Coder fixes.

parent 1bc4e605
...@@ -352,7 +352,7 @@ function _print_rewrite_urls($matches) { ...@@ -352,7 +352,7 @@ function _print_rewrite_urls($matches) {
$path = "node/$path"; $path = "node/$path";
} }
// Printer-friendly URLs is on, so we need to make it absolute // Printer-friendly URLs is on, so we need to make it absolute
$newurl = url($path, array('fragment' => substr($url, 1), 'absolute' => TRUE)); $newurl = url($path, array('fragment' => drupal_substr($url, 1), 'absolute' => TRUE));
} }
// Because base href is the original page, change the link to // Because base href is the original page, change the link to
// still be usable inside the print page // still be usable inside the print page
......
...@@ -38,7 +38,7 @@ function print_mail_form($form, &$form_state) { ...@@ -38,7 +38,7 @@ function print_mail_form($form, &$form_state) {
} }
drupal_goto(PRINTMAIL_PATH . '/' . $path); drupal_goto(PRINTMAIL_PATH . '/' . $path);
} }
else if (ctype_digit($path_arr[1])) { elseif (ctype_digit($path_arr[1])) {
if (drupal_lookup_path('source', $path)) { if (drupal_lookup_path('source', $path)) {
// This is a numeric alias // This is a numeric alias
$path = drupal_get_normal_path($path); $path = drupal_get_normal_path($path);
...@@ -200,7 +200,7 @@ function theme_print_mail_form($form) { ...@@ -200,7 +200,7 @@ function theme_print_mail_form($form) {
*/ */
function print_mail_form_validate($form, &$form_state) { function print_mail_form_validate($form, &$form_state) {
if (array_key_exists('cancel', $form_state['input'])) { if (array_key_exists('cancel', $form_state['input'])) {
form_set_error(NULL,'',TRUE); form_set_error(NULL, '', TRUE);
drupal_get_messages('error'); drupal_get_messages('error');
drupal_goto(preg_replace('!^book/export/html/!', 'node/', $form_state['values']['path'])); drupal_goto(preg_replace('!^book/export/html/!', 'node/', $form_state['values']['path']));
...@@ -241,7 +241,7 @@ function print_mail_form_validate($form, &$form_state) { ...@@ -241,7 +241,7 @@ function print_mail_form_validate($form, &$form_state) {
// In all fields, prevent insertion of custom headers // In all fields, prevent insertion of custom headers
foreach ($form_state['values'] as $key => $string) { foreach ($form_state['values'] as $key => $string) {
if ( (substr($key, 0, 4) == 'fld_') && ((strpos($string, "\n") !== FALSE) || (strpos($string, "\r") !== FALSE)) ) { if ( (drupal_substr($key, 0, 4) == 'fld_') && ((strpos($string, "\n") !== FALSE) || (strpos($string, "\r") !== FALSE)) ) {
form_set_error($key, 'Found invalid character'); form_set_error($key, 'Found invalid character');
} }
} }
......
...@@ -347,7 +347,7 @@ function _print_mail_access($permission) { ...@@ -347,7 +347,7 @@ function _print_mail_access($permission) {
} }
// If the destination page is not accessible, don't show the form // If the destination page is not accessible, don't show the form
if (!($router_item = menu_get_item($path)) || (!$router_item['access'])) { if (!($router_item = menu_get_item($path)) || (!$router_item['access'])) {
$page_access = FALSE; $page_access = FALSE;
} }
} }
} }
...@@ -553,8 +553,8 @@ function print_mail_link_allowed($args) { ...@@ -553,8 +553,8 @@ function print_mail_link_allowed($args) {
} }
/** /**
* Implementation of hook_nollom_form_list(). * Implements hook_nollom_form_list().
*/ */
function print_mail_mollom_form_list() { function print_mail_mollom_form_list() {
$forms['print_mail_form'] = array( $forms['print_mail_form'] = array(
'title' => t('Send page form'), 'title' => t('Send page form'),
...@@ -564,8 +564,8 @@ function print_mail_mollom_form_list() { ...@@ -564,8 +564,8 @@ function print_mail_mollom_form_list() {
} }
/** /**
* Implementation of hook_mollom_form_info(). * Implemenents hook_mollom_form_info().
*/ */
function print_mail_mollom_form_info($form_id) { function print_mail_mollom_form_info($form_id) {
switch ($form_id) { switch ($form_id) {
case 'print_mail_form': case 'print_mail_form':
......
<?php <?php
/** /**
* @file
* Views sort handler for the print_mail module
*
* Extend the default sort handler. * Extend the default sort handler.
* Add a relationship with custom join to print's emailed counter * Add a relationship with custom join to print's emailed counter
*/ */
......
...@@ -81,7 +81,7 @@ function drush_print_pdf_download($library) { ...@@ -81,7 +81,7 @@ function drush_print_pdf_download($library) {
} }
else { else {
drush_log(dt('@file has been downloaded to @path, but extract failed. Check that you have the necessary program installed, and if necessary extract it manually.', drush_log(dt('@file has been downloaded to @path, but extract failed. Check that you have the necessary program installed, and if necessary extract it manually.',
array('@file' => $filename, '@path' => $path)), 'warning'); array('@file' => $filename, '@path' => $path)), 'warning');
} }
} }
else { else {
...@@ -97,13 +97,13 @@ function drush_print_pdf_download($library) { ...@@ -97,13 +97,13 @@ function drush_print_pdf_download($library) {
} }
} }
/** /**
* Discover the correct URL of the package to download * Discover the correct URL of the package to download
*/ */
function _drush_print_pdf_download_url($library) { function _drush_print_pdf_download_url($library) {
$ret = FALSE; $ret = FALSE;
switch (strtolower($library)) { switch (drupal_strtolower($library)) {
case 'dompdf': case 'dompdf':
$ret = DOMPDF_DOWNLOAD_URI; $ret = DOMPDF_DOWNLOAD_URI;
break; break;
...@@ -111,7 +111,7 @@ function _drush_print_pdf_download_url($library) { ...@@ -111,7 +111,7 @@ function _drush_print_pdf_download_url($library) {
$ret = TCPDF_DOWNLOAD_URI; $ret = TCPDF_DOWNLOAD_URI;
break; break;
case 'wkhtmltopdf': case 'wkhtmltopdf':
switch (substr(php_uname('s'), 0, 3)) { switch (drupal_substr(php_uname('s'), 0, 3)) {
case 'Lin': case 'Lin':
$ret = (php_uname('m') == 'x86_64') ? WKHTMLTOPDF_AMD64_DOWNLOAD_URI : WKHTMLTOPDF_I386_DOWNLOAD_URI; $ret = (php_uname('m') == 'x86_64') ? WKHTMLTOPDF_AMD64_DOWNLOAD_URI : WKHTMLTOPDF_I386_DOWNLOAD_URI;
break; break;
...@@ -176,7 +176,7 @@ function _drush_print_pdf_download_extract($filename) { ...@@ -176,7 +176,7 @@ function _drush_print_pdf_download_extract($filename) {
* The path to the file to download * The path to the file to download
* *
* @return string * @return string
* The filename that was downloaded, or NULL if the file could not be * The filename that was downloaded, or NULL if the file could not be
* downloaded. * downloaded.
*/ */
function _drush_print_pdf_download_file($download_url) { function _drush_print_pdf_download_file($download_url) {
......
...@@ -208,9 +208,9 @@ function print_pdf_requirements($phase) { ...@@ -208,9 +208,9 @@ function print_pdf_requirements($phase) {
} }
foreach (array('cache', 'images') as $dir) { foreach (array('cache', 'images') as $dir) {
$directory = dirname($print_pdf_pdf_tool) .'/'. $dir; $directory = dirname($print_pdf_pdf_tool) . '/' . $dir;
if (!is_dir($directory) || !is_writable($directory)) { if (!is_dir($directory) || !is_writable($directory)) {
$requirements['print_pdf_tool_'. $dir] = array( $requirements['print_pdf_tool_' . $dir] = array(
'title' => $t('TCPDF directory'), 'title' => $t('TCPDF directory'),
'value' => $t('Non-writable permissions'), 'value' => $t('Non-writable permissions'),
'description' => $t('You must change the %fontdir permissions to be writable, as dompdf requires write-access to that directory.', array('%fontdir' => $directory)), 'description' => $t('You must change the %fontdir permissions to be writable, as dompdf requires write-access to that directory.', array('%fontdir' => $directory)),
...@@ -219,7 +219,7 @@ function print_pdf_requirements($phase) { ...@@ -219,7 +219,7 @@ function print_pdf_requirements($phase) {
} }
} }
} }
elseif (substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') { elseif (drupal_substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
if (function_exists('is_executable') && !is_executable($print_pdf_pdf_tool)) { if (function_exists('is_executable') && !is_executable($print_pdf_pdf_tool)) {
$requirements['print_pdf_tool'] = array( $requirements['print_pdf_tool'] = array(
'title' => $t('wkhtmltopdf library'), 'title' => $t('wkhtmltopdf library'),
......
...@@ -108,7 +108,7 @@ function print_pdf_generate_html($print, $html, $filename = NULL) { ...@@ -108,7 +108,7 @@ function print_pdf_generate_html($print, $html, $filename = NULL) {
elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') { elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
return _print_pdf_tcpdf($print, $html, $filename); return _print_pdf_tcpdf($print, $html, $filename);
} }
elseif (substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') { elseif (drupal_substr(basename($print_pdf_pdf_tool, '.exe'), 0, 11) == 'wkhtmltopdf') {
return _print_pdf_wkhtmltopdf($print, $html, $filename); return _print_pdf_wkhtmltopdf($print, $html, $filename);
} }
elseif ($filename) { elseif ($filename) {
...@@ -136,6 +136,7 @@ function _print_pdf_file_access_images($html) { ...@@ -136,6 +136,7 @@ function _print_pdf_file_access_images($html) {
// TODO: This needs to be rewritten from scratch for Drupal 7 // TODO: This needs to be rewritten from scratch for Drupal 7
$lang = ''; $lang = '';
/* /*
TODO
switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) { switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
case LANGUAGE_NEGOTIATION_PATH_DEFAULT: case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
case LANGUAGE_NEGOTIATION_PATH: case LANGUAGE_NEGOTIATION_PATH:
...@@ -307,7 +308,7 @@ function _print_pdf_tcpdf($print, $html, $filename = NULL) { ...@@ -307,7 +308,7 @@ function _print_pdf_tcpdf($print, $html, $filename = NULL) {
$pdf->SetCreator(variable_get('site_name', 'Drupal')); $pdf->SetCreator(variable_get('site_name', 'Drupal'));
$pdf->SetTitle(html_entity_decode($print['title'], ENT_QUOTES, 'UTF-8')); $pdf->SetTitle(html_entity_decode($print['title'], ENT_QUOTES, 'UTF-8'));
$pdf->setPDFVersion('1.6'); $pdf->setPDFVersion('1.6');
$pdf->setFontSubsetting(variable_get('print_pdf_font_subsetting',FALSE)); $pdf->setFontSubsetting(variable_get('print_pdf_font_subsetting', FALSE));
if ($language->direction == LANGUAGE_RTL) { if ($language->direction == LANGUAGE_RTL) {
$pdf->setRTL(TRUE); $pdf->setRTL(TRUE);
......
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