Commit Graph

23 Commits

Author SHA1 Message Date
Scott Taylor
4f814ec9ae Protect newlines inside of CDATA. This was breaking things, notably inline JS that used comments for HTML standards compat.
* Tokenize newlines in `WP_Embed::autoembed()` before running `->autoembed_callback()`
* Tokenize newlines with placeholders in `wpautop()` 
* Introduce `wp_html_split()` to DRY the RegEx from `wp_replace_in_html_tags()` and `do_shortcodes_in_html_tags()`

Adds unit tests.

Props miqrogroove, kitchin, azaozz.
Fixes #33106.


git-svn-id: https://develop.svn.wordpress.org/trunk@33469 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-28 23:02:04 +00:00
Gary Pendergast
7b41adf712 Shortcodes: Improve the reliablity of shortcodes inside HTML tags.
Props miqrogroove.

See #15694.



git-svn-id: https://develop.svn.wordpress.org/trunk@33359 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-22 05:14:50 +00:00
John Blackbourn
063637755b Allow shortcode parameter names (attributes) to contain dashes.
Props aaroncampbell, tyxla, izem
Fixes #9405


git-svn-id: https://develop.svn.wordpress.org/trunk@33118 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 23:58:49 +00:00
Scott Taylor
ee4e5c4b35 Check is_callable() in do_shortcode_tag(), not add_shortcode().
Add a `_doing_it_wrong()` in `do_shortcode_tag()` when `is_callable()` is `false`.

Props aaroncampbell.
See #32445.


git-svn-id: https://develop.svn.wordpress.org/trunk@32867 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 21:32:31 +00:00
Scott Taylor
a3f2743f9a Add missing doc blocks to shortcodes.php.
See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32624 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-27 19:39:00 +00:00
Dominik Schilling (ocean90)
b0d6757918 Use HTTPS URLs for codex.wordpress.org.
see #27115.

git-svn-id: https://develop.svn.wordpress.org/trunk@32116 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-12 21:28:58 +00:00
Drew Jaynes (DrewAPicture)
032ec0d24a Remove a stray period introduced in [31242].
Props SergeyBiryukov.
See #31048.


git-svn-id: https://develop.svn.wordpress.org/trunk@31245 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-19 08:46:24 +00:00
Drew Jaynes (DrewAPicture)
73780fdd32 Add more complete documentation for parameters, globals, and return values to the DocBlocks for remove_shortcode(), shortcode_exists(), and do_shortcode().
Props SergeyBiryukov.
Fixes #31048.


git-svn-id: https://develop.svn.wordpress.org/trunk@31243 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-19 08:39:10 +00:00
Drew Jaynes (DrewAPicture)
596412fb0b Ensure both parameters and the return for has_shortcode() are fully documented.
Props cais, SergeyBiryukov
See #31048.


git-svn-id: https://develop.svn.wordpress.org/trunk@31242 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-19 08:35:05 +00:00
Scott Taylor
865185903b There are some random add_action() and add_filter() calls littered around some files in wp-includes/. These should be moved to wp-includes/default-filters.php with the rest of the registered hooks. It seems like this was the best practice for awhile and then we randomly stopped. This file loads way before any of the includes, so the hooks will be registered for any request that loads WordPress, even SHORTINIT - a lot of the hooks registered won't run anyways (that's already the case).
See #30947.


git-svn-id: https://develop.svn.wordpress.org/trunk@31168 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 16:39:39 +00:00
Scott Taylor
da9057fd6d Use && instead of and in the 3 places where and was used.
See #30799.


git-svn-id: https://develop.svn.wordpress.org/trunk@31099 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 21:11:46 +00:00
Drew Jaynes (DrewAPicture)
76699122d0 Ensure inline code is markdown-escaped as such, HTML tags are removed from summaries, and that code snippets in descriptions are properly indented.
Affects DocBlocks for the following core elements:
* Backtick-escape HTML tags in several argument descriptions for `wp_link_pages()`
* Remove an HTML tag from the summary for `prepend_attachment()`
* Backtick-escape inline code in the description for `get_extended()`
* Backtick-escape inline code in the description for `get_post_type_labels()`
* Various markdown formatting in the description for `add_rewrite_endpoint()`
* Markdown-indent a code snippet in the file header for wp-includes/shortcodes.php
* Markdown-indent code snippets in the description for `add_shortcode()

Props rarst.
See #30473.


git-svn-id: https://develop.svn.wordpress.org/trunk@30545 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 06:14:03 +00:00
Drew Jaynes (DrewAPicture)
3cc10d77a0 Remove redundant and erroneous @uses tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.


git-svn-id: https://develop.svn.wordpress.org/trunk@30105 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 01:04:55 +00:00
Scott Taylor
23f7f53be2 The joys of wptexturize():
* Revert parts of [28773] and [28727] and [29748].
* Do not crash PHP. Make the shortcode quantifier possessive to avoid backtracks.
* Reduce backtracking in long HTML comments by 100x.
* Do not ignore unclosed HTML comments.
* Do not break unregistered shortcodes, e.g. `[hello attr="value"]`.
* Do not break HTML in shortcode attributes, e.g. `[hello attr="<"]`.
* Do not match for shortcodes when there is extra whitespace, e.g. `[ hello ]`.
* Add unit tests to show #12690 was not fully resolved.
* Tested PHP 5.2.4, 5.2.13, 5.4.32, and 5.5.8.

Adds/modifies unit tests.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29781 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 04:06:54 +00:00
Scott Taylor
606cd967f6 wptexturize() improvements:
* Expand the `wptexturize()` RegEx to include the list of registered shortcodes.
* Avoid backtracking after `[` chars by not filtering params in registered shortcodes. This will cause escaped shortcodes and their params to become texturized if not registered.
* Registered shortcode params will never be texturized, even when escaped.
* Move all tests involving unregistered shortcodes to a new and improved unit.
* Update one test involving HTML within shortcode params.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29748 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-17 15:13:24 +00:00
Scott Taylor
753a60c709 After [29197], use ! empty() instead of isset(). Don't call has_shortcode() internally twice if it's true.
Props kovshenin.
Fixes #26343.


git-svn-id: https://develop.svn.wordpress.org/trunk@29207 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-17 17:37:51 +00:00
Scott Taylor
17d67d93e7 Make has_shortcode() recursive/work for nested shortcodes.
Adds unit test.

Props katzwebdesign.
Fixes #26343.


git-svn-id: https://develop.svn.wordpress.org/trunk@29197 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-16 22:04:08 +00:00
Scott Taylor
e9f929443f Update the inline docs for add_shortcode() to eliminate suggestion to use extract().
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28413 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 03:27:17 +00:00
Andrew Nacin
c2dd5d4a75 Bail early from shortcode functions if no delimiter is present.
This is a significant performance improvement for processing content without shortcodes, and only the slightest hit when content contains shortcodes (which must then undergo processing anyway). Performance results on the ticket.

props TobiasBg.
fixes #23855.


git-svn-id: https://develop.svn.wordpress.org/trunk@27394 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 07:10:46 +00:00
Drew Jaynes
bd39e26032 First there were two, and now there are three -- in the @since versions that came before and that shall be. And so it will be, says nacin.
Props JustinSainton, SergeyBiryukov, DrewAPicture.
Fixes #26713.


git-svn-id: https://develop.svn.wordpress.org/trunk@26868 602fd350-edb4-49c9-b593-d223f7449a82
2013-12-24 18:56:05 +00:00
Ryan Boren
30f822b8ee Pinking shears
git-svn-id: https://develop.svn.wordpress.org/trunk@25880 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-23 14:37:54 +00:00
Sergey Biryukov
d60cbb399e Inline documentation for hooks in wp-includes/shortcodes.php.
props natejacobs.
see #25229.

git-svn-id: https://develop.svn.wordpress.org/trunk@25423 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-13 09:01:20 +00:00
Andrew Nacin
b43712e0f7 New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory.
 * New task runner (Grunt), configured to copy a built WordPress to build/.
 * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js.
 * Remove Akismet external from develop.svn. Still exists in core.svn.
 * Drop minified files from src/. The build process will now generate these.

props koop.
see #24976.

and see http://wp.me/p2AvED-1AI.



git-svn-id: https://develop.svn.wordpress.org/trunk@25001 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-07 05:25:25 +00:00