Commit graph

27 commits

Author SHA1 Message Date
Matias Benedetto
ea309e0924
Add figcaption escaping for image and video blocks (#745)
* add figcaption escaping for video and image blocks.

* update image block test and add video block test
2024-11-11 09:18:02 -03:00
Jeff Ong
512b9f80df
Process inner html of blocks when escaping text content (#719)
* WIP working to convert attributes and URLs.

* Ensure media is added to local.

* Use a list of tokens and sprintf to generate the formatted string.

* Only format the string if tokens are present.

* Update content with html test.

Update remaining tests with inner markup.

Try and fix tests.

Format tests.

* Remove whitespace.

* Process all attributes
Escape at the end.
Provide better translation note.

* Refactor token processing to its own class.

* Update tests with string replacements and translation.

* Check if % exists in the text and escape it.

* Add a test case for a localizing text that includes a %.

* Add new line at the end of translators note

* Reformat numbers in translators note

* Update test

* Move new line to theme-locale

* Handle self closing tags

* Refactor how new line is added

* Attempt to fix tests

* Attempt to fix tests again

---------

Co-authored-by: Grant Kinney <1699996+creativecoder@users.noreply.github.com>
Co-authored-by: Sarah Norris <sarah@sekai.co.uk>
Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
2024-10-23 14:06:06 -03:00
Jason Crist
33c5ff9ad4
Removed all of the code relating to 'folder management' of a theme. (#723) 2024-09-25 21:39:54 -03:00
tomoki shimomura
55a60de2cd
Fix Image URL Localization URI (#720)
* fix #714

* fix

* fix

* fix

* fix

* lint

---------

Co-authored-by: Madhu Dollu <madhusudhan.dollu@gmail.com>
2024-09-25 21:23:27 -03:00
Jeff Ong
cdede9a46c
Adds minimum WordPress version to theme metadata (#715)
* Add a field for required wordpress version.

* Add a minimum required version if none exists.

* Sanitize the requires_wp attribute.

* Use SelectControl instead of TextControl and rename attribute to requires_wp.

* Update includes/create-theme/theme-styles.php

Co-authored-by: Grant Kinney <creativecoder@users.noreply.github.com>

* Try generating the minimum versions instead.

* Ensure Required WP version is updated when readme is updated.

* Use current wordpress version if none is provided.

* Use a dynamic value for Requires at least when theme readme and style.css are created.

* Make variable names consistent.

* Check for empty string and use current wordpress version as fallback.

* Add minimum version to additional metadata panel.

---------

Co-authored-by: Grant Kinney <creativecoder@users.noreply.github.com>
2024-09-20 12:33:50 -04:00
Sarah Norris
8993439e59
Remove "Categories: hidden" from default pattern header (#718)
* Remove Categories: hidden from default pattern header

* Remove Categories: hidden from theme utils test
2024-09-13 10:50:12 +01:00
Matias Benedetto
4911a06cfb
Rename font assets when theme is saved and/or exported (#712)
* Rename font asset files when theme is saved or exported

* add and update tests

* test

* use sub-directories for each font family
2024-09-05 10:22:01 -03:00
Matias Benedetto
6973cf8690
Update escaping function (#683)
* Update escaping function

* update tests

* add method specific for attributes

* update tests

* Updates to only use wp_kses_post when strings contain html

* remove wp_kses_post as escaping function

* update tests

---------

Co-authored-by: Grant Kinney <hi@grant.mk>
2024-09-03 08:39:21 -03:00
Matias Benedetto
082be0b85d
Sanitize DOS (Windows) new line style on readme.txt (#681)
* sanitize windows new lines

* add tests
2024-07-03 17:59:42 +04:00
Vicente Canales
8d652184f2
Refactor theme fonts class for readability (#661)
* refactor theme fonts class for readability

* add test for src and url handling

* add more assertions to theme deactivation fn

* refactor missing array cast

* Update includes/create-theme/theme-fonts.php

Co-authored-by: Jason Crist <jcrist@pbking.com>

* re-add $user_settings

* add additional assertion

---------

Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-06-04 13:18:22 -04:00
Matias Benedetto
a621674bcd
Update escaping function (#665)
* update escaping function

* simplify check to know if the text is already escaped.
2024-06-03 12:44:14 +02:00
Matias Benedetto
ee38f2328c
Add image credits edit capabilities to the edit theme modal (#662)
* add image credits edit capabilities

* fix typo and add translation mark

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

---------

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
2024-06-03 11:18:53 +02:00
Jason Crist
485f8937de
Fixed font utilities to work with font sources as an (optional) array. (#645)
Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
2024-05-30 12:59:42 +02:00
Matias Benedetto
5470e489eb
Adds an endpoints that returns a list of font families used by a theme (#648)
* adds an endpoints that returns a list of font families used by a theme, including their style variants

* remove unwanted line

* move some logic into get_all_fonts

* Added get_fonts unit test

---------

Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-05-30 11:49:44 +02:00
Matias Benedetto
2f17e8cdee
handle font credits in the backend (#647) 2024-05-22 15:38:32 +02:00
Matias Benedetto
ca0851410b
Fix template texts localizing/escaping (#641)
Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-05-16 14:04:45 -04:00
Jason Crist
d3ffe65742
Use only major.minor version in 'Tested up to' field (#635)
Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
2024-05-16 11:37:47 -04:00
Matias Benedetto
424ebee3b1
Add prefix to the names in the PHP global namespace. (#628)
Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-05-14 07:27:30 -04:00
Matias Benedetto
7aed6ce339
Refactor Theme_Readme (readme.txt) PHP class (#626)
* refactor ThemeReadme class

* update phpunit tests config to make it more similar to core

* Add tests for ThemeReadme class public methods

* simplify copyright text creation

* Fix cloned theme reference to original theme

* updates comment

* Theme_Reade::update receives a parameter with the readme content.

* remove not so useful write method

* Moved readme data fetching logic from utils to readme class and fleshed it out to get all sections.

* Fetch and use the readme data in the metadata panel (for recomended plugins)

---------

Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-05-13 10:47:39 -03:00
Jason Crist
f3dc5c9f52
Allow spaces in slugs. Changed logic to correctly replace functions. Updated tests. (#622) 2024-05-10 07:55:20 -04:00
Jason Crist
d737bbab0e
Process group background image when saving theme (#586) 2024-04-25 08:03:30 -04:00
Jason Crist
3ba985d63c
fix/cover-block-content-stripped (#587) 2024-04-24 13:37:10 -04:00
Jason Crist
2fec3098b2
Fix/un transposed patterns (#567)
* Added tests to validate replacing theme namespace and refactored to support it
* Pass slug to patternize content when cloning theme
* Fixed creating of theme slug from name using no -'s to fix namespace swapping issue
2024-04-18 13:27:40 -04:00
Jason Crist
6ab7656bb5
Try/refactor editor UI (#563)
* Simplify top-level menu items

* Added Create Variation panel

* Moved Metadata editor to modal

* Simplified Create Panel
* Removed the 'export' option from the clone workflow

Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
Co-authored-by: Vicente Canales <1157901+vcanales@users.noreply.github.com>
2024-04-18 11:40:55 -04:00
Jason Crist
20bcc01052
Extracted any logic that may need to be tested from the api class (#522)
* Extracted any logic that may need to be tested from the api class

* Refactored to facilitate testing

* Refactored zip construction to use shared code with saving logic

* Consolidated template and css parsing logic for theme exporting

* removed queryID removal from query blocks

* Fixed the image processing so that the id is removed from inner content correctly

* Added tests that evaluate encoded patterns and test patterns created from templates with media

* Added taxQuery removal tests and fixed taxQuery attribute removal logic

* Refactored image/cover processing to more cleanly handle id classes

* Add test and fixed bugs around escaping <'s and >'s

* localized quote blocks

* Added localization processing to list, verse, table and media-text blocks

---------

Co-authored-by: Vicente Canales <vicente.canales@automattic.com>
Co-authored-by: Madhu Dollu <madhusudhan.dollu@gmail.com>
2024-03-27 09:41:01 -04:00
Jason Crist
99a35c5d99
Use CORE for Font Management (#518)
Co-authored-by: Vicente Canales <vicente.canales@automattic.com>
2024-03-22 06:48:47 -04:00
Vicente Canales
1545d48b45
Add integration tests (#393)
* Add and configure PHPUnit

Co-authored-by: Jason Crist <jcrist@pbking.com>
2024-03-11 12:48:34 -04:00