Commit cf29351e authored by jcnventura's avatar jcnventura

Coder fixes

parent fdec22c5
......@@ -20,7 +20,7 @@ function print_main_settings() {
$print_css = variable_get('print_css', PRINT_CSS_DEFAULT);
// Check that the stylesheet path is indeed valid and relative to base_path()
if (!empty($print_css)) {
$css_path = dirname($_SERVER['SCRIPT_FILENAME']) .'/'. strtr($print_css, array('%t' => drupal_get_path('theme', variable_get('theme_default', 'garland'))));
$css_path = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . strtr($print_css, array('%t' => drupal_get_path('theme', variable_get('theme_default', 'garland'))));
if (!is_file($css_path) || !is_readable($css_path)) {
drupal_set_message(t("File %file is not readable by the web server.", array('%file' => $css_path)), 'warning', FALSE);
}
......@@ -38,7 +38,7 @@ function print_main_settings() {
'#size' => 60,
'#maxlength' => 250,
'#description' => t('The path to your custom print cascading stylesheet, if any. The path provided must be relative to the base path. When none is specified, the default module CSS file is used.') . '<br />' .
t('Macros: %t (path to theme: "%theme")', array('%theme' => drupal_get_path('theme', variable_get('theme_default', 'bartik')))) . '<br />'.
t('Macros: %t (path to theme: "%theme")', array('%theme' => drupal_get_path('theme', variable_get('theme_default', 'bartik')))) . '<br />' .
t('Requires the <em>administer site configuration</em> permission.'),
'#disabled' => !user_access('administer site configuration'),
);
......
......@@ -22,7 +22,7 @@ function print_install() {
* Implements hook_enable().
*/
function print_enable() {
$t = get_t();
$t = get_t();
// Module weight
db_update('system')
......
......@@ -453,7 +453,7 @@ function _print_friendly_urls($url = 0) {
*/
function _print_url_list_enabled($node, $format = PRINT_HTML_FORMAT) {
if (!isset($node->type)) {
return TRUE;
return TRUE;
}
switch ($format) {
......
......@@ -12,7 +12,7 @@
* Implements hook_enable().
*/
function print_mail_enable() {
$t = get_t();
$t = get_t();
// Module weight
db_update('system')
......@@ -151,5 +151,5 @@ function print_mail_update_7000(&$sandbox) {
),
);
update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
}
update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
}
......@@ -12,7 +12,7 @@
* Implements hook_enable().
*/
function print_pdf_enable() {
$t = get_t();
$t = get_t();
// Module weight
db_update('system')
......
......@@ -596,8 +596,8 @@ function print_pdf_link_allowed($args) {
function _print_pdf_wkhtmltopdf_version() {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
$descriptor = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$cmd = realpath($print_pdf_pdf_tool) ." --version";
$cmd = realpath($print_pdf_pdf_tool) . ' --version';
$process = proc_open($cmd, $descriptor, $pipes, NULL, NULL);
if (is_resource($process)) {
$out = preg_match('!.*?(\d+\.\d+\.\d+).*$!m', stream_get_contents($pipes[1]), $matches);
......
......@@ -122,7 +122,7 @@ function _print_pdf_file_access_images($html) {
$html = preg_replace($pattern, $replacement, $html);
}
$pattern = "!(<img\s[^>]*?src\s*?=\s*?['\"]?)${base_url}/(?:(?:index.php)?\?q=)?(?:${lang}/)?([^>]*?>)!is";
$replacement = '$1file://'. dirname($_SERVER['SCRIPT_FILENAME']) .'/$2';
$replacement = '$1file://' . dirname($_SERVER['SCRIPT_FILENAME']) . '/$2';
$html = preg_replace($pattern, $replacement, $html);
return $html;
......@@ -332,10 +332,10 @@ function _print_pdf_wkhtmltopdf($print, $html, $filename) {
// 0.10.0 beta2 identifies itself as 0.9.9
if (version_compare($version, '0.9.9', '>=')) {
$print_pdf_wkhtmltopdf_options = '--disable-local-file-access '. $print_pdf_wkhtmltopdf_options;
$print_pdf_wkhtmltopdf_options = '--disable-local-file-access ' . $print_pdf_wkhtmltopdf_options;
}
elseif (version_compare($version, '0.9.6', '>=')) {
$print_pdf_wkhtmltopdf_options = '--disallow-local-file-access '. $print_pdf_wkhtmltopdf_options;
$print_pdf_wkhtmltopdf_options = '--disallow-local-file-access ' . $print_pdf_wkhtmltopdf_options;
}
else {
drupal_goto($print['url']);
......
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