Issues (2756)

user/pages/examplepage.php (2 issues)

1
<?php
2
3
// Make sure we're in YOURLS context
4
if( !defined( 'YOURLS_ABSPATH' ) ) {
5
	echo "Try using a URL without the /pages/ part";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Try using a URL without the /pages/ part does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
6
	die();
7
}
8
9
// Display page content. Any PHP, HTML and YOURLS function can go here.
10
$url = YOURLS_SITE . '/examplepage';
11
12
yourls_html_head( 'examplepage', 'Example page' );
13
14
?>
15
16
<p>This is an example page. Its URL is simply <?php echo $url; ?></p>
17
18
<?php
19
0 ignored issues
show
Blank line found at start of embedded PHP content
Loading history...
20
yourls_html_footer();
21
22