Skip to content

Commit c91777c

Browse files
authored
Merge pull request #204 from Automattic/fix/phpcs
Fix phpcs
2 parents 6e370c0 + 782f870 commit c91777c

File tree

1 file changed

+201
-15
lines changed

1 file changed

+201
-15
lines changed

syntaxhighlighter.php

Lines changed: 201 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ function enqueue_block_editor_assets() {
341341
wp_enqueue_style(
342342
'syntaxhighlighter-blocks-css', // Handle.
343343
plugins_url( 'dist/blocks.editor.build.css', __FILE__ ),
344+
[],
344345
( ( defined( 'WP_DEBUG' ) && WP_DEBUG ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) )
345346
? filemtime( plugin_dir_path( __FILE__ ) . 'dist/blocks.editor.build.css' )
346347
: $this->pluginver
@@ -1410,7 +1411,12 @@ function settings_page() { ?>
14101411
<td>
14111412
<fieldset>
14121413
<legend class="hidden"><?php esc_html_e( 'Load All Brushes', 'syntaxhighlighter' ); ?></legend>
1413-
<label for="syntaxhighlighter-loadallbrushes"><input name="syntaxhighlighter_settings[loadallbrushes]" type="checkbox" id="syntaxhighlighter-loadallbrushes" value="1" <?php checked( $this->settings['loadallbrushes'], 1 ); ?> /> <?php wp_kses( _e( 'Always load all language files (for directly using <code>&lt;pre&gt;</code> tags rather than shortcodes). If left unchecked (default), then language files will only be loaded when needed. If unsure, leave this box unchecked.', 'syntaxhighlighter' ), array( 'code' => array(), 'br' => array() ) ); ?></label>
1414+
<label for="syntaxhighlighter-loadallbrushes">
1415+
<input name="syntaxhighlighter_settings[loadallbrushes]" type="checkbox" id="syntaxhighlighter-loadallbrushes" value="1" <?php checked( $this->settings['loadallbrushes'], 1 ); ?> />
1416+
<?php
1417+
echo wp_kses( __( 'Always load all language files (for directly using <code>&lt;pre&gt;</code> tags rather than shortcodes). If left unchecked (default), then language files will only be loaded when needed. If unsure, leave this box unchecked.', 'syntaxhighlighter' ), array( 'code' => array(), 'br' => array() ) );
1418+
?>
1419+
</label>
14141420
</fieldset>
14151421
</td>
14161422
</tr>
@@ -1546,20 +1552,200 @@ function settings_page() { ?>
15461552
<p><?php printf( __( 'These are the parameters you can pass to the shortcode and what they do. For the booleans (i.e. on/off), pass %1$s/%2$s or %3$s/%4$s.', 'syntaxhighlighter' ), '<code>true</code>', '<code>1</code>', '<code>false</code>', '<code>0</code>' ); ?></p>
15471553

15481554
<ul class="ul-disc">
1549-
<li><?php printf( esc_html_x( '%1$s or %2$s &#8212; The language syntax to highlight with. You can alternately just use that as the tag, such as <code>[php]code[/php]</code>. <a href="%3$s">Click here</a> for a list of valid tags (under &quot;aliases&quot;).', 'language parameter', 'syntaxhighlighter' ), '<code>lang</code>', '<code>language</code>', 'http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/' ); ?></li>
1550-
<li><?php printf( esc_html_x( '%s &#8212; Toggle automatic URL linking.', 'autolinks parameter', 'syntaxhighlighter' ), '<code>autolinks</code>' ); ?></li>
1551-
<li><?php printf( esc_html_x( '%s &#8212; Add an additional CSS class to the code box.', 'classname parameter', 'syntaxhighlighter' ), '<code>classname</code>' ); ?></li>
1552-
<li><?php printf( esc_html_x( '%s &#8212; Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.', 'collapse parameter', 'syntaxhighlighter' ), '<code>collapse</code>' ); ?></li>
1553-
<li><?php printf( esc_html_x( '%s &#8212; An interger specifying what number the first line should be (for the line numbering).', 'firstline parameter', 'syntaxhighlighter' ), '<code>firstline</code>' ); ?></li>
1554-
<li><?php printf( esc_html_x( '%s &#8212; Toggle the left-side line numbering.', 'gutter parameter', 'syntaxhighlighter' ), '<code>gutter</code>' ); ?></li>
1555-
<li><?php printf( esc_html_x( '%1$s &#8212; A comma-separated list of line numbers to highlight. You can also specify a range. Example: %2$s', 'highlight parameter', 'syntaxhighlighter' ), '<code>highlight</code>', '<code>2,5-10,12</code>' ); ?></li>
1556-
<li><?php printf( esc_html_x( "%s &#8212; Toggle highlighting any extra HTML/XML. Good for when you're mixing HTML/XML with another language, such as having PHP inside an HTML web page. The above preview has it enabled for example. This only works with certain languages.", 'htmlscript parameter', 'syntaxhighlighter' ), '<code>htmlscript</code>' ); ?></li>
1557-
<li><?php printf( esc_html_x( '%s &#8212; Toggle light mode which disables the gutter and toolbar all at once.', 'light parameter', 'syntaxhighlighter' ), '<code>light</code>' ); ?></li>
1558-
<li><?php printf( esc_html_x( '%s &#8212; Controls line number padding. Valid values are <code>false</code> (no padding), <code>true</code> (automatic padding), or an integer (forced padding).', 'padlinenumbers parameter', 'syntaxhighlighter' ), '<code>padlinenumbers</code>' ); ?></li>
1559-
<li><?php printf( esc_html_x( '%1$s (v3 only) &#8212; Sets some text to show up before the code. Very useful when combined with the %2$s parameter.', 'title parameter', 'syntaxhighlighter' ), '<code>title</code>', '<code>collapse</code>' ); ?></li>
1560-
<li><?php printf( esc_html_x( '%s &#8212; Toggle the toolbar (buttons in v2, the about question mark in v3)', 'toolbar parameter', 'syntaxhighlighter' ), '<code>toolbar</code>' ); ?></li>
1561-
<li><?php printf( esc_html_x( '%s (v2 only) &#8212; Toggle line wrapping.', 'wraplines parameter', 'syntaxhighlighter'), '<code>wraplines</code>' ); ?></li>
1562-
<li><?php printf( esc_html_x( '%s &#8212; Enable edit mode on double click.', 'quickcode parameter', 'syntaxhighlighter' ), '<code>quickcode</code>' ); ?></li>
1555+
<li>
1556+
<?php
1557+
echo wp_kses(
1558+
sprintf(
1559+
// translators: %1$s Lang parameter; %2$s Language parameter; %3$s Valid tags link.
1560+
_x(
1561+
'%1$s or %2$s &#8212; The language syntax to highlight with. You can alternately just use that as the tag, such as <code>[php]code[/php]</code>. <a href="%3$s">Click here</a> for a list of valid tags (under &quot;aliases&quot;).',
1562+
'language parameter',
1563+
'syntaxhighlighter'
1564+
),
1565+
'<code>lang</code>',
1566+
'<code>language</code>',
1567+
'http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/'
1568+
),
1569+
array(
1570+
'a' => array(
1571+
'href' => array(),
1572+
),
1573+
'code' => array(),
1574+
)
1575+
);
1576+
?>
1577+
</li>
1578+
<li>
1579+
<?php
1580+
printf(
1581+
// translators: %s Autolinks parameter.
1582+
esc_html_x(
1583+
'%s &#8212; Toggle automatic URL linking.',
1584+
'autolinks parameter',
1585+
'syntaxhighlighter'
1586+
),
1587+
'<code>autolinks</code>'
1588+
);
1589+
?>
1590+
</li>
1591+
<li>
1592+
<?php
1593+
printf(
1594+
// translators: %s Classname parameter.
1595+
esc_html_x(
1596+
'%s &#8212; Add an additional CSS class to the code box.',
1597+
'classname parameter',
1598+
'syntaxhighlighter'
1599+
),
1600+
'<code>classname</code>'
1601+
);
1602+
?>
1603+
</li>
1604+
<li>
1605+
<?php
1606+
printf(
1607+
// translators: %s Collapse parameter.
1608+
esc_html_x(
1609+
'%s &#8212; Toggle collapsing the code box by default, requiring a click to expand it. Good for large code posts.',
1610+
'collapse parameter',
1611+
'syntaxhighlighter'
1612+
),
1613+
'<code>collapse</code>'
1614+
);
1615+
?>
1616+
</li>
1617+
<li>
1618+
<?php
1619+
printf(
1620+
// translators: %s Firstline parameter.
1621+
esc_html_x(
1622+
'%s &#8212; An interger specifying what number the first line should be (for the line numbering).',
1623+
'firstline parameter',
1624+
'syntaxhighlighter'
1625+
),
1626+
'<code>firstline</code>'
1627+
);
1628+
?>
1629+
</li>
1630+
<li>
1631+
<?php
1632+
printf(
1633+
// translators: %s Gutter parameter.
1634+
esc_html_x(
1635+
'%s &#8212; Toggle the left-side line numbering.',
1636+
'gutter parameter',
1637+
'syntaxhighlighter'
1638+
),
1639+
'<code>gutter</code>'
1640+
);
1641+
?>
1642+
</li>
1643+
<li>
1644+
<?php
1645+
printf(
1646+
// translators: %1$s Highlight parameter; %2$s Example.
1647+
esc_html_x(
1648+
'%1$s &#8212; A comma-separated list of line numbers to highlight. You can also specify a range. Example: %2$s',
1649+
'highlight parameter',
1650+
'syntaxhighlighter'
1651+
),
1652+
'<code>highlight</code>',
1653+
'<code>2,5-10,12</code>'
1654+
);
1655+
?>
1656+
</li>
1657+
<li>
1658+
<?php
1659+
printf(
1660+
// translators: %s Htmlscript parameter.
1661+
esc_html_x(
1662+
"%s &#8212; Toggle highlighting any extra HTML/XML. Good for when you're mixing HTML/XML with another language, such as having PHP inside an HTML web page. The above preview has it enabled for example. This only works with certain languages.",
1663+
'htmlscript parameter',
1664+
'syntaxhighlighter'
1665+
),
1666+
'<code>htmlscript</code>'
1667+
);
1668+
?>
1669+
</li>
1670+
<li>
1671+
<?php
1672+
printf(
1673+
// translators: %s Light parameter.
1674+
esc_html_x(
1675+
'%s &#8212; Toggle light mode which disables the gutter and toolbar all at once.',
1676+
'light parameter',
1677+
'syntaxhighlighter'
1678+
),
1679+
'<code>light</code>'
1680+
);
1681+
?>
1682+
</li>
1683+
<li>
1684+
<?php
1685+
printf(
1686+
// translators: %s Padlinenumbers parameter.
1687+
esc_html_x(
1688+
'%s &#8212; Controls line number padding. Valid values are <code>false</code> (no padding), <code>true</code> (automatic padding), or an integer (forced padding).',
1689+
'padlinenumbers parameter',
1690+
'syntaxhighlighter'
1691+
),
1692+
'<code>padlinenumbers</code>'
1693+
);
1694+
?>
1695+
</li>
1696+
<li>
1697+
<?php
1698+
printf(
1699+
// translators: %1$s Title parameter; %2$s Collapse parameter.
1700+
esc_html_x(
1701+
'%1$s (v3 only) &#8212; Sets some text to show up before the code. Very useful when combined with the %2$s parameter.',
1702+
'title parameter',
1703+
'syntaxhighlighter'
1704+
),
1705+
'<code>title</code>',
1706+
'<code>collapse</code>'
1707+
);
1708+
?>
1709+
</li>
1710+
<li>
1711+
<?php
1712+
printf(
1713+
// translators: %s Toolbar parameter.
1714+
esc_html_x(
1715+
'%s &#8212; Toggle the toolbar (buttons in v2, the about question mark in v3)',
1716+
'toolbar parameter',
1717+
'syntaxhighlighter'
1718+
),
1719+
'<code>toolbar</code>'
1720+
);
1721+
?>
1722+
</li>
1723+
<li>
1724+
<?php
1725+
printf(
1726+
// translators: %s Wraplines parameter.
1727+
esc_html_x(
1728+
'%s (v2 only) &#8212; Toggle line wrapping.',
1729+
'wraplines parameter',
1730+
'syntaxhighlighter'
1731+
),
1732+
'<code>wraplines</code>'
1733+
);
1734+
?>
1735+
</li>
1736+
<li>
1737+
<?php
1738+
printf(
1739+
// translators: %s Quickcode parameter.
1740+
esc_html_x(
1741+
'%s &#8212; Enable edit mode on double click.',
1742+
'quickcode parameter',
1743+
'syntaxhighlighter'
1744+
),
1745+
'<code>quickcode</code>'
1746+
);
1747+
?>
1748+
</li>
15631749
</ul>
15641750

15651751
<p><?php esc_html_e( 'Some example shortcodes:', 'syntaxhighlighter' ); ?></p>

0 commit comments

Comments
 (0)