Commit 1c9c68be authored by jcnventura's avatar jcnventura

Fix #291816: Use CCK's 6.x release path for its CSS file

Update simpletest test for the 6.x-2.x series (compatible with Drupal 7)
Fix bug with visibility where the link was shown when no page was specified but the 'show only in listed pages' was selected
parent 79412733
......@@ -392,7 +392,7 @@ function _print_page_match($visibility, $pages) {
return !($visibility xor $page_match);
}
else {
return TRUE;
return !$visibility;
}
}
......
......@@ -162,7 +162,7 @@ function _print_var_generator($node, $message = NULL, $cid = NULL) {
}
// Add CCK's CSS file to properly display the fields
if (module_exists('content')) {
$css_files[] = base_path() . drupal_get_path('module', 'content') .'/content.css';
$css_files[] = base_path() . drupal_get_path('module', 'content') .'/theme/content.css';
}
// If we are sending a message via e-mail, the CSS must be embedded
......@@ -313,19 +313,19 @@ function _print_rewrite_urls($matches) {
$print_urls = variable_get('print_urls', PRINT_URLS_DEFAULT);
// first, split the html into the different tag attributes
$pattern = '/\s*(\w+\s*=\s*"(?:\\\"|[^"])*")\s*|\s*(\w+\s*=\s*\'(?:\\\'|[^\'])*\')\s*|\s*(\w+\s*=\s\w+)\s*|\s+/im';
$pattern = '!\s*(\w+\s*=\s*"(?:\\\"|[^"])*")\s*|\s*(\w+\s*=\s*\'(?:\\\'|[^\'])*\')\s*|\s*(\w+\s*=\s\w+)\s*|\s+!im';
$attribs = preg_split($pattern, $matches[1], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
foreach ($attribs as $key => $value) {
$attribs[$key] = preg_replace('/(\w)\s*=\s*(.*)/', '$1=$2', $value);
$attribs[$key] = preg_replace('!(\w)\s*=\s*(.*)!', '$1=$2', $value);
}
$size = count($attribs);
for ($i=1; $i < $size; $i++) {
// If the attribute is href or src, we may need to rewrite the URL in the value
if (preg_match('/^(?:href|src)\s*?=(.*)/i', $attribs[$i], $urls) > 0) {
if (preg_match('!^(?:href|src)\s*?=(.*)!i', $attribs[$i], $urls) > 0) {
$url = trim($urls[1], " \t\n\r\0\x0B\"'");
if (strpos($url, '://') || preg_match('/^mailto:.*?@.*?\..*?$/iu', $url)) {
if (strpos($url, '://') || preg_match('!^mailto:.*?@.*?\..*?$!iu', $url)) {
// URL is absolute, do nothing
$newurl = urldecode($url);
}
......@@ -348,13 +348,12 @@ function _print_rewrite_urls($matches) {
}
else {
// URL is relative, convert it into absolute URL
$clean_url = (bool)variable_get('clean_url', '0');
if ($url[0] == '/') {
// If it starts with '/' just append it to the server name
$newurl = $base_root .'/'. trim(urldecode($url), '/');
}
elseif ((!$clean_url) && (preg_match('/^(?:index.php)?\?q=/i', $url))) {
// If Clean URLs is disabled, and it starts with q=?, just prepend with the base URL
elseif (preg_match('!^(?:index.php)?\?q=!i', $url)) {
// If it starts with ?q=, just prepend with the base URL
$newurl = $base_url .'/'. trim(urldecode($url), '/');
}
else {
......
<?php
// $Id$
class PrintBasicTest extends DrupalTestCase {
class PrintBasicTest extends DrupalWebTestCase {
protected $web_user;
protected $getq;
function get_info() {
/**
* Implementation of getInfo().
*/
function getInfo() {
return array(
'name' => t('Printer-friendly pages basic tests'),
'desc' => t('Test basic Printer-friendly pages module functionality.'),
'group' => 'Printer-friendly pages',
'description' => t('Test basic Printer-friendly pages module functionality.'),
'group' => t('Printer-friendly pages'),
);
}
......@@ -17,6 +20,8 @@ class PrintBasicTest extends DrupalTestCase {
* Implementation of setUp().
*/
function setUp() {
parent::setUp();
// User to set up print.
// $this->web_user = $this->drupalCreateUserRolePerm(array('administer print'));
......@@ -25,8 +30,6 @@ class PrintBasicTest extends DrupalTestCase {
$this->getq = $_GET['q'];
$_GET['q'] = 'print/'. $_GET['q'];
parent::setUp();
}
/**
......@@ -53,14 +56,17 @@ class PrintBasicTest extends DrupalTestCase {
$url[1] = '#here';
$url[2] = '/relative/to/host';
$url[3] = 'relative/to/base';
$url[4] = 'index.php?q=sample/path';
$rel_url[0] = $url[0];
$rel_url[1] = $_GET['q'] .$url[1];
$rel_url[2] = $url[2];
$rel_url[3] = $url[3];
$rel_url[4] = $url[4];
$abs_url[0] = $url[0];
$abs_url[1] = $base_url .'/'. $this->getq . $url[1];
$abs_url[2] = $base_root . $url[2];
$abs_url[3] = $base_url .'/'. $url[3];
$abs_url[4] = $base_url .'/'. $url[4];
$size = count($url);
for ($i = 0; $i < $size; $i++) {
......
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