Commit 1e92a518 authored by jcnventura's avatar jcnventura

Coder fixes.

parent 1bc4e605
......@@ -352,7 +352,7 @@ function _print_rewrite_urls($matches) {
$path = "node/$path";
}
// 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
// still be usable inside the print page
......
......@@ -38,7 +38,7 @@ function print_mail_form($form, &$form_state) {
}
drupal_goto(PRINTMAIL_PATH . '/' . $path);
}
else if (ctype_digit($path_arr[1])) {
elseif (ctype_digit($path_arr[1])) {
if (drupal_lookup_path('source', $path)) {
// This is a numeric alias
$path = drupal_get_normal_path($path);
......@@ -200,7 +200,7 @@ function theme_print_mail_form($form) {
*/
function print_mail_form_validate($form, &$form_state) {
if (array_key_exists('cancel', $form_state['input'])) {
form_set_error(NULL,'',TRUE);
form_set_error(NULL, '', TRUE);
drupal_get_messages('error');
drupal_goto(preg_replace('!^book/export/html/!', 'node/', $form_state['values']['path']));
......@@ -241,7 +241,7 @@ function print_mail_form_validate($form, &$form_state) {
// In all fields, prevent insertion of custom headers
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');
}
}
......
......@@ -347,7 +347,7 @@ function _print_mail_access($permission) {
}
// If the destination page is not accessible, don't show the form
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) {
}
/**
* Implementation of hook_nollom_form_list().
*/
* Implements hook_nollom_form_list().
*/
function print_mail_mollom_form_list() {
$forms['print_mail_form'] = array(
'title' => t('Send page form'),
......@@ -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) {
switch ($form_id) {
case 'print_mail_form':
......
<?php
/**
* @file
* Views sort handler for the print_mail module
*
* Extend the default sort handler.
* Add a relationship with custom join to print's emailed counter
*/
......
......@@ -81,7 +81,7 @@ function drush_print_pdf_download($library) {
}
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.',
array('@file' => $filename, '@path' => $path)), 'warning');
array('@file' => $filename, '@path' => $path)), 'warning');
}
}
else {
......@@ -97,13 +97,13 @@ function drush_print_pdf_download($library) {
}
}
/**
/**
* Discover the correct URL of the package to download
*/
function _drush_print_pdf_download_url($library) {
$ret = FALSE;
switch (strtolower($library)) {
switch (drupal_strtolower($library)) {
case 'dompdf':
$ret = DOMPDF_DOWNLOAD_URI;
break;
......@@ -111,7 +111,7 @@ function _drush_print_pdf_download_url($library) {
$ret = TCPDF_DOWNLOAD_URI;
break;
case 'wkhtmltopdf':
switch (substr(php_uname('s'), 0, 3)) {
switch (drupal_substr(php_uname('s'), 0, 3)) {
case 'Lin':
$ret = (php_uname('m') == 'x86_64') ? WKHTMLTOPDF_AMD64_DOWNLOAD_URI : WKHTMLTOPDF_I386_DOWNLOAD_URI;
break;
......@@ -176,7 +176,7 @@ function _drush_print_pdf_download_extract($filename) {
* The path to the file to download
*
* @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.
*/
function _drush_print_pdf_download_file($download_url) {
......
......@@ -208,9 +208,9 @@ function print_pdf_requirements($phase) {
}
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)) {
$requirements['print_pdf_tool_'. $dir] = array(
$requirements['print_pdf_tool_' . $dir] = array(
'title' => $t('TCPDF directory'),
'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)),
......@@ -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)) {
$requirements['print_pdf_tool'] = array(
'title' => $t('wkhtmltopdf library'),
......
......@@ -108,7 +108,7 @@ function print_pdf_generate_html($print, $html, $filename = NULL) {
elseif (basename($print_pdf_pdf_tool) == 'tcpdf.php') {
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);
}
elseif ($filename) {
......@@ -136,6 +136,7 @@ function _print_pdf_file_access_images($html) {
// TODO: This needs to be rewritten from scratch for Drupal 7
$lang = '';
/*
TODO
switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
case LANGUAGE_NEGOTIATION_PATH:
......@@ -307,7 +308,7 @@ function _print_pdf_tcpdf($print, $html, $filename = NULL) {
$pdf->SetCreator(variable_get('site_name', 'Drupal'));
$pdf->SetTitle(html_entity_decode($print['title'], ENT_QUOTES, 'UTF-8'));
$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) {
$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