Skip to content

Commit

Permalink
Fix: Fix typos in codebase (#2968)
Browse files Browse the repository at this point in the history
* Fix typos
  • Loading branch information
szepeviktor committed Apr 22, 2024
1 parent e992632 commit e40ceb3
Show file tree
Hide file tree
Showing 35 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ When referencing a namespaced class name in a type (for example in a `@param` or

### Code examples

Timber uses tabs for indentation, but you should always use spaces for indentation in code examples, because the resulting Markdown will have a more consistens styling.
Timber uses tabs for indentation, but you should always use spaces for indentation in code examples, because the resulting Markdown will have a more consistent styling.

The `@example` tag allows you add code examples to your DocBlocks, including fenced code blocks:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ You can find the code for Timber 1 on the [1.x branch](https://github.com/timber
* [**TutsPlus**](https://code.tutsplus.com/articles/kick-start-wordpress-development-with-twig-introduction--cms-24781) A guide to getting started by [@ahmadawais](https://github.com/ahmadawais)

## Reporting Security Issues
To disclose a security issue to our team, please submit a report via [Github](https://github.com/timber/timber/security).
To disclose a security issue to our team, please submit a report via [GitHub](https://github.com/timber/timber/security).

## Support
Please post on [StackOverflow under the "Timber" tag](https://stackoverflow.com/questions/tagged/timber). Please use GitHub issues _only_ for specific bugs, feature requests and other types of issues.
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If you discover a security vulnerability within Timber, please submit your repor
Please do not discuss any vulnerabilities (even resolved ones) without express consent.

### Submit your report
When you've found a security issue that abides by the rules and scope of this project, please submit the report to us via [Github](https://github.com/timber/timber/security/advisories/new). In your report, make sure to include a detailed guide on how to reproduce the issue.
When you've found a security issue that abides by the rules and scope of this project, please submit the report to us via [GitHub](https://github.com/timber/timber/security/advisories/new). In your report, make sure to include a detailed guide on how to reproduce the issue.

### After your submission
We will make a best effort to meet the following response targets for security reports:
Expand Down
2 changes: 1 addition & 1 deletion docs/v1/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Underneath this text you will find an extensive list with guides and the reasons

* Guide: [How do I switch over from the plugin version to the Composer based version of Timber?](https://timber.github.io/docs/v1/getting-started/switch-to-composer/)
* Backstory: [Why we are dropping support for the plugin in the first place](https://github.com/timber/timber/pull/2005)
* Github issue: [Road to Timber 2.0](https://github.com/timber/timber/issues/2741)
* GitHub issue: [Road to Timber 2.0](https://github.com/timber/timber/issues/2741)

### ~~Via WordPress.org (easy)~~

Expand Down
2 changes: 1 addition & 1 deletion docs/v1/getting-started/switch-to-composer.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ We want to make sure that you are running the latest version of the Timber plugi
### 3. Disable the Timber plugin
Once you are sure that you are running the latest version of the Timber plugin, you can disable it. This will make sure that the plugin is not loaded anymore and does not interfere with the Composer based version of Timber.

Please note that you website will throw erros at this point, as there is no Timber available. This will be fixed in the next two steps.
Please note that you website will throw errors at this point, as there is no Timber available. This will be fixed in the next two steps.

### 4. Install the latest 1.x version of Timber via Composer
Now that the plugin is disabled, you can install the latest 1.x version of Timber via Composer. You can do this by navigating to your site's active theme folder inside your terminal and then running the following command:
Expand Down
2 changes: 1 addition & 1 deletion docs/v1/guides/escapers.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This all follows the WordPress (and greater development philosophy) to:

Background on KSES. KSES is a recursive acronym for `KSES Kills Evil Scripts`. It's goal is to ensure only "allowed" HTML element names, attribute names and attribute values plus only sane HTML entities in the string. Allowed is based on a configuration.

This uses ths internal WordPress method that sanitize content for allowed HTML tags for post content. The configuration used can be found by running ` wp_kses_allowed_html( 'post' );` [WordPress Documentation](https://codex.wordpress.org/Function_Reference/wp_kses_post)
This uses the internal WordPress method that sanitize content for allowed HTML tags for post content. The configuration used can be found by running ` wp_kses_allowed_html( 'post' );` [WordPress Documentation](https://codex.wordpress.org/Function_Reference/wp_kses_post)

**Twig**

Expand Down
2 changes: 1 addition & 1 deletion docs/v1/guides/gutenberg.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Next, you you have to create your `render_callback()` function:
* This is the callback that displays the block.
*
* @param array $block The block settings and attributes.
* @param string $content The block content (emtpy string).
* @param string $content The block content (empty string).
* @param bool $is_preview True during AJAX preview.
*/
function my_acf_block_render_callback( $block, $content = '', $is_preview = false ) {
Expand Down
2 changes: 1 addition & 1 deletion docs/v2/guides/class-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ add_filter('timber/menuitem/class', function ($class, $item, $menu) {
}, 10, 3);
```

In the above example, the MenuItem class filter receives the default `Timber\MenuItem` class name, the WordPress menu item (which is an instance of `WP_Post`) and the `Timber\Menu` object that the item is assigend to. You should be able to decide which class to use based on these parameters. This example demonstrates how you can use a custom class (`MenuItemPrimary`) when the parent menu has a (custom) class of `MenuPrimary`.
In the above example, the MenuItem class filter receives the default `Timber\MenuItem` class name, the WordPress menu item (which is an instance of `WP_Post`) and the `Timber\Menu` object that the item is assigned to. You should be able to decide which class to use based on these parameters. This example demonstrates how you can use a custom class (`MenuItemPrimary`) when the parent menu has a (custom) class of `MenuPrimary`.

Here’s another example where you would use a different class if the menu item is in a menu assigned to the `secondary` menu location.

Expand Down
2 changes: 1 addition & 1 deletion docs/v2/guides/date-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ $datetime = date_create_immutable_from_format(
$timestamp = $datetime->getTimestamp();
```

When the date string already includes the timezone, like when you use the `DATE_ATOM` format, then you don’t need to pass a timezone. When it doesn’t, you may have to pass it, dependening on how you manage/use your dates.
When the date string already includes the timezone, like when you use the `DATE_ATOM` format, then you don’t need to pass a timezone. When it doesn’t, you may have to pass it, depending on how you manage/use your dates.

If you stored your dates *with* a certain timezone applied, then you will have to create them with a timezone. You can do this by passing `wp_timezone()` as the third parameter.

Expand Down
6 changes: 3 additions & 3 deletions docs/v2/upgrade-guides/2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ After that, you can follow the [Upgrade to 2.0 guide](https://timber.github.io/d

## Initializing Timber

Up until now, you had to initialize Timber by instantiating a new object of the `Timber\Timber` class. The constructor of that class is now protected and you’ll run into an error (`Call to protected Timber\Timber::__construct() from invalid context`) if you try to intialize Timber with it.
Up until now, you had to initialize Timber by instantiating a new object of the `Timber\Timber` class. The constructor of that class is now protected and you’ll run into an error (`Call to protected Timber\Timber::__construct() from invalid context`) if you try to initialize Timber with it.

**🚫 Before**

Expand Down Expand Up @@ -1480,7 +1480,7 @@ If you’ve used `timber/term/meta` before, you might have to switch to `timer/t
The following filters were **removed** without a replacement:

- `Timber\PostClassMap` – use the [Post Class Map](https://timber.github.io/docs/v2/guides/class-maps/#the-post-class-map) instead.
- `timber/get_posts/mirror_wp_get_posts` – This filter was used so that `Timber::get_posts()` mimicks the behavior of WordPress’s `get_posts()` function. We removed it because `Timber::get_posts()` is the new official API. If you want the same behavior, there are [arguments that you can pass to this function](https://timber.github.io/docs/v2/guides/posts#differences-from-wp-cores-get_posts).
- `timber/get_posts/mirror_wp_get_posts` – This filter was used so that `Timber::get_posts()` mimics the behavior of WordPress’s `get_posts()` function. We removed it because `Timber::get_posts()` is the new official API. If you want the same behavior, there are [arguments that you can pass to this function](https://timber.github.io/docs/v2/guides/posts#differences-from-wp-cores-get_posts).
- `timber_post_getter_get_posts` – Removed because the `Timber\PostGetter` class doesn’t exist anymore.
- `timber/class/posts_iterator` – Removed because the `Timber\PostCollection` class doesn’t exist anymore. Use custom `Post::setup()` and `Post::teardown()` methods instead. Read more about this in the [Better compatibility with plugins section](#better-compatibility-with-plugins).

Expand Down Expand Up @@ -1508,7 +1508,7 @@ We also integrated sideloading images in the new `Timber::get_external_image()`

## Escaping

While Twig has escaping enabled by default, Timber doesn’t automatically enable espacing for Twig. To enable autoescaping in Timber 1.x, you would use `Timber::$autoescape = true`. The value `true` was deprecated for Twig 2.0, you now have to use `html` or [another auto-escaping strategy](https://twig.symfony.com/doc/2.x/api.html#environment-options) instead. You’ll need to use the `timber/twig/environment/options` filter:
While Twig has escaping enabled by default, Timber doesn’t automatically enable escaping for Twig. To enable autoescaping in Timber 1.x, you would use `Timber::$autoescape = true`. The value `true` was deprecated for Twig 2.0, you now have to use `html` or [another auto-escaping strategy](https://twig.symfony.com/doc/2.x/api.html#environment-options) instead. You’ll need to use the `timber/twig/environment/options` filter:

```php
add_filter('timber/twig/environment/options', function ($options) {
Expand Down
6 changes: 3 additions & 3 deletions src/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Attachment extends Post
public $abs_url;

/**
* Attachement metadata.
* Attachment metadata.
*
* @var array Attachment metadata.
*/
Expand Down Expand Up @@ -212,7 +212,7 @@ public function caption(): ?string
/**
* Gets the raw filesize in bytes.
*
* Use the `size_format` filter to format the raw size into a human readable size («1 MB» intead of «1048576»)
* Use the `size_format` filter to format the raw size into a human readable size («1 MB» instead of «1048576»)
*
* @api
* @since 2.0.0
Expand Down Expand Up @@ -350,7 +350,7 @@ public function pathinfo()
*/
protected function metadata(?string $key = null)
{
// We haven't retrived the metadata yet because it's wasn't needed until now.
// We haven't retrieved the metadata yet because it's wasn't needed until now.
if (!isset($this->metadata)) {
// Cache it so we don't have to retrieve it again.
$this->metadata = (array) \wp_get_attachment_metadata($this->ID);
Expand Down
2 changes: 1 addition & 1 deletion src/CoreEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected function fetch_meta($field_name = '', $args = [], $apply_filters = tru
// Fetch values. Auto-fetches all values if $field_name is empty.
$object_meta = \get_metadata($object_type, $this->ID, $field_name, true);

// Mimick $single argument when fetching all meta values.
// Mimic $single argument when fetching all meta values.
if (empty($field_name) && \is_array($object_meta)) {
$object_meta = \array_map(function ($meta) {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/MenuFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected function get_menu_class($term, $args): string
$class = $class ?? Menu::class;

/**
* Filters the menu class based on your custom criterias.
* Filters the menu class based on your custom criteria.
*
* Maybe the location is not appropriate in some cases. This filter will allow you to filter the class
* on whatever data is available.
Expand Down
2 changes: 1 addition & 1 deletion src/Factory/PostFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected function is_image(WP_Post $post)
{
$src = \get_attached_file($post->ID);
$mimes = \wp_get_mime_types();
// Add mime types that Timber recongizes as images, regardless of config
// Add mime types that Timber recognizes as images, regardless of config
$mimes['svg'] = 'image/svg+xml';
$mimes['webp'] = 'image/webp';
$check = \wp_check_filetype(PathHelper::basename($src), $mimes);
Expand Down
4 changes: 2 additions & 2 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected static function handle_transient_locking($slug, $callback, $transient_
* ```php
*
* add_filter( 'timber/transient/force_transient_mycustumslug', function($force) {
* if(false == something_special_has_occured()){
* if(false == something_special_has_occurred()){
* return false;
* }
*
Expand Down Expand Up @@ -711,7 +711,7 @@ public static function wp_list_filter($list, $args, $operator = 'AND')
* Converts a WP object (WP_Post, WP_Term) into its
* equivalent Timber class (Timber\Post, Timber\Term).
*
* If no match is found the function will return the inital argument.
* If no match is found the function will return the initial argument.
*
* @param mixed $obj WP Object
* @return mixed Instance of equivalent Timber object, or the argument if no match is found
Expand Down
2 changes: 1 addition & 1 deletion src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function choose_template($templates)
foreach ($templates as $template) {
// Remove any whitespace around the template name
$template = \trim($template);
// Use the Twig loader to test for existance
// Use the Twig loader to test for existence
if ($loader->exists($template)) {
// Return name of existing template
return $template;
Expand Down
2 changes: 1 addition & 1 deletion src/LocationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function get_calling_script_dir($offset = 0)

/**
* returns an array of the directory inside themes that holds twig files
* @return array the names of directores, ie: array('__MAIN__' => ['templats', 'views']);
* @return array the names of directories, ie: array('__MAIN__' => ['templates', 'views']);
*/
public static function get_locations_theme_dir()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function setup()
global $post;
global $wp_query;

// Mimick WordPress behavior to improve compatibility with third party plugins.
// Mimic WordPress behavior to improve compatibility with third party plugins.
$wp_query->in_the_loop = true;

if (!$this->wp_object) {
Expand Down Expand Up @@ -809,7 +809,7 @@ public function import_field($field_name)
* {# Some stuff here #}
* </article>
* ```
* @return string a space-seperated list of classes
* @return string a space-separated list of classes
*/
public function post_class($class = '')
{
Expand Down Expand Up @@ -840,7 +840,7 @@ public function post_class($class = '')
* </article>
* ```
*
* @return string a space-seperated list of classes
* @return string a space-separated list of classes
*/
public function css_class($class = '')
{
Expand Down
2 changes: 1 addition & 1 deletion src/Timber.php
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ public static function compile($filenames, $data = [], $expires = false, $cache_
/**
* Filters the compiled result before it is returned in `Timber::compile()`.
*
* It adds the posibility to filter the output ready for render.
* It adds the possibility to filter the output ready for render.
*
* @since 2.0.0
*
Expand Down
4 changes: 2 additions & 2 deletions src/URLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public static function unpreslashit($path)
}

/**
* This will evaluate wheter a URL is at an aboslute location (like http://example.org/whatever)
* This will evaluate whether a URL is at an absolute location (like http://example.org/whatever)
*
* @param string $path
* @return boolean true if $path is an absolute url, false if relative.
Expand Down Expand Up @@ -460,7 +460,7 @@ private static function is_internal_content($url)
* Otherwise, false.
*
* @api
* @param string $url URL to evalute.
* @param string $url URL to evaluate.
* @return bool
*/
public static function is_external(string $url): bool
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/collection-pagination.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% for page in posts.pagination.pages %}
{% if page.current %}
<li class="pagination-list-item pagination-page">{{ page.title }}</li>
<li class="pagination-list-item pagination-seperator">of</li>
<li class="pagination-list-item pagination-separator">of</li>
{% endif %}
{% if loop.last %}
<li class="pagination-list-item pagination-page">{{ page.title }}</li>
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testAttachmentByExtension()
$this->assertEquals(Attachment::class, get_class($attachments[6]));
}

public function testAttachmentWithExtentionFilter()
public function testAttachmentWithExtensionFilter()
{
// Add support for "uploading" WEBP images.
$this->add_filter_temporarily('upload_mimes', function ($types) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-comment-avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function testAvatarSimple()
if (strstr($avatar, '?')) {
list($url, $params) = explode('?', $avatar);
$default_url = $theme_url . $default_url;
# you get back the absoulte url to default in the avatar url?
# you get back the absolute url to default in the avatar url?
$this->assertEquals($params, "d=$default_url&amp;s=32");
}
# you get back url?
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-context.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class TestTimberContext extends Timber_UnitTestCase
{
/**
* This throws an infite loop if memorization isn't working
* This throws an infinite loop if memorization isn't working
*/
public function testContextLoop()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/test-timber-image-multisite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function tear_down()
TestTimberMultisite::clear();
}

public function testSubDomainImageLocaion()
public function testSubDomainImageLocation()
{
if (!is_multisite()) {
$this->markTestSkipped('Test is only for Multisite');
Expand All @@ -23,7 +23,7 @@ public function testSubDomainImageLocaion()
$this->assertFalse($is_external);
}

public function testSubDirectoryImageLocaion()
public function testSubDirectoryImageLocation()
{
if (!is_multisite()) {
$this->markTestSkipped('Test is only for Multisite');
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ public function testImageDeletionSimilarNames()
Timber::compile('assets/image-test.twig', $data);
$this->assertFileExists($arch_regular);
$this->assertFileExists($arch_2night);
//Delte the regular arch image
//Delete the regular arch image
Timber\ImageHelper::delete_generated_files($file);
//The child of the regular arch image should be like
//poof-be-gone
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-integration-acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function testACFFormatValue()
$this->assertEquals('Murder Spagurders are dangerous sneks.', $string);
}

public function testACFTranformImage()
public function testACFTransformImage()
{
$field_name = 'my_image_meta';
$this->register_field($field_name, 'image');
Expand Down
2 changes: 1 addition & 1 deletion tests/test-timber-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function testNavMenuFilters()
self::_createTestMenu();

$this->add_filter_temporarily('wp_nav_menu_objects', function ($menu_items) {
// Be carefull with indexes, they are strings here
// Be careful with indexes, they are strings here
$menu_items['9']->current = true;
$menu_items['9']->classes = array_merge((array) $menu_items[8]->classes, ['current-menu-item', 'my-custom-item-class']);
return $menu_items;
Expand Down

0 comments on commit e40ceb3

Please sign in to comment.