Giter Site home page Giter Site logo

rareloop / lumberjack Goto Github PK

View Code? Open in Web Editor NEW
365.0 20.0 34.0 165 KB

Lumberjack is a powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code.

Home Page: https://lumberjack.rareloop.com

License: MIT License

PHP 47.35% CSS 0.60% Twig 52.05%
lumberjack mvc wordpress twig timber php wordpress-framework wordpress-development wordpress-theme wordpress-library

lumberjack's People

Contributors

adamtomat avatar chadanuk avatar jeromegamez avatar joelambert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lumberjack's Issues

Wrong class on the WordPress Controllers documentation?

What are the steps to reproduce this issue?

Sorry, I would submit this as a PR whoever I'm not being able to get to docs in git, maybe its a Gitbook thing.

In the WordPress Controllers documentation, the TimberResponse class is being called with:
use App\Http\Responses\TimberResponse;

In my environment at least that doesn't work, and it needs to be:
use Rareloop\Lumberjack\Http\Responses\TimberResponse;

Thanks!

Undefined Illuminate classes

The package has several use statements for Illuminate classes, like Illuminate\Contracts\Support\Arrayable, Illuminate\Support\Collection, Illuminate\Support\Arr. These references should be defined, or the correct packags added to composer.json.

Wrong repo - see Rareloop/lumberjack-core#3 instead :-)

PHP8 Compatibility

With some hosts now forcing, and perhaps rightfully so, PHP8 on hosted applications it has become something you can't get around.

Unfortunately Lumberjack is still throwing fatal errors when you try to run it over PHP8.

The one immediately apparent for me is:

Fatal error: During inheritance of SessionHandlerInterface: Uncaught ErrorException: Return type of Rareloop\Lumberjack\Session\FileSessionHandler::open($savePath, $sessionName) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in

Looking at the project activity I've noticed that the last commit was in 2021, more than 1 year ago. There is no announcement about the project being abandoned, so one has to wonder if it will continued to be maintained.

Could the authors provide some context here so people know what to expect?

pass cache time to TimberResponse?

In Timber we can pass a cache time

Timber::render( 'single.twig', $context, 600 );

is there an equivalent with

return new TimberResponse('single.twig', $context);

thanks
J

Custom post type translatable labels not working

Thanks for creating lumberjack. This is the first time we use it and I've run into a problem with translations. We register custom post type as show in the documentation:

return [
    'register' => [
        App\PostTypes\Offer::class,
    ],
];

The custom post type is registert and we can use it in the admin and have an archive and detail view.

In the getPostTypeConfig we try to translate the labels off the custom post type:

protected static function getPostTypeConfig()
{
    return [
        'public' => true,
        'show_in_rest' => true,
        'capability_type' => 'page',
        'has_archive' => true,
        'query_var' => true,
        'label'  => __('Offers', 'text-domain'),
        'labels' => [
            'name' => __('Offers', 'text-domain'),
            'singular_name' => __('Offer', 'text-domain'),
        ],
    ];
}

In poedit we can create a .po file in the language folder. In the functions.php we load the text domain like so:

add_action('after_setup_theme', function () {
    load_theme_textdomain('text-domain', get_template_directory() . '/languages');
});

If checked the loaded paths and the textdomain path is correct. But still the labels aren't translated. After some testing with displaying translated text in several places and in different actions. I've discovered that if I put the translation in a init action it get translated. The CustomPostTypesServiceProvider register the custom post type not in action. If I wrap the post type register in an init action, the labels get translation. Here is my quick and dirty fix for the CustomPostTypesServiceProvider:

public function boot(Config $config)
{
    add_action('init', function () use ($config) {
        $postTypesToRegister = $config->get('posttypes.register');

        foreach ($postTypesToRegister as $postType) {
            $postType::register();
        }
    });
}

Is there any possible way of register the post type in the proper action hook? So that the translation is working.

What versions of software are you using?

Operating System: MacOS 11.5

PHP Version: 7.4.1

Lumberjack Version: 5.0

posts function should set correct postType?

Hi,

I'm wondering why you don't set the postType like this when calling posts, the same way you do with query? did i miss something. It didn't seem to work properly for me without it.

public static function posts($args = null) {
    // set the correct post type
    $args = array_merge($args, ['post_type' => static::$postType]);

    return Timber::get_posts($args, get_called_class());
}

thanks
J

Custom Taxonomy support in Lumberjack

Is there or will there be custom taxonomy support in Lumberjack? I haven't been able to register or use them at all in lumberjack, and there seems to be no documentation regarding this at all...

Internal server error when running site with MAMP in CGI Mode (Individual PHP version for every host)

I'm sure I won't be the only one running trying to run Lumberjack with MAMP but after installing and activating the theme the only thing I could access was the wordpress backend, trying to access the site thew an internal server error, here's the error apache threw:

FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.1.12.fcgi" aborted: error parsing headers: duplicate header 'content-type', referer: http://lumberjack/wp/wp-admin/

Turning CGI mode off (Identical PHP version for all hosts) resolved the issue.

Request with a dot (".") inside a Custom Route paramter returns a 404 (not found) exception

Hi there,

we are encountering an error when we put dots (".") in our route parameters. Is it allowed to do that?

What are the steps to reproduce this issue?

  1. Define a custom Route in Lumberjack, with a Route Parameter
  2. Pass a route paramter which contains a dot

`
Router::get('posts/{id}', function($id) {

});
Call URL
/posts/a.b.c
`

What happens?

Server returns 404

What were you expecting to happen?

Server returns the correct page

What versions of software are you using?

Operating System: Debian Buster

PHP Version: PHP 7.4

Lumberjack Version: 5.0.0

Thank you for your support!

Lumberjack doesn't see archive-{post_type}.php with proper controller class

What are the steps to reproduce this issue?

  1. Add WooCommerce
  2. Create archive-product.php file
  3. Create ArchiveProductController class in this file
  4. Go to /product-category/some-category/

What happens?
Lumberjack doesn't see archive-product.php, it is looking for archive.php or index.php. It's not in line with the templatee hierarchy (please look at https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-post-types)

What were you expecting to happen?
Lumberjack should looking for archive-product.php and ArchiveProductController class.

What versions of software are you using?

Operating System: Win10, Apache (XAMMP)

PHP Version: 7.2

Lumberjack Version: latest

php 8.0.0 not compatible with v4 (composer issue)

If this is a feature request, explain why it should be added. Specific use-cases are best.

For bug reports, please provide as much relevant info as possible.

What are the steps to reproduce this issue?

  1. run with php 8.0.0
  2. install project with your guides : lumberjack-bedrock new my-site
    3.open in development mode like: http://my-site:8888

What happens?

  1. go to url and see message : Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". (i don't find witch dependencies need php 8.1.0)
  2. if you install php 8.1.0 in dashboard there where notice from wordpress core, who is not ready to start with this php version
  3. in php 8.1.0 there where twig error in front end

What were you expecting to happen?

Any logs, error output, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?

What versions of software are you using?

**Operating System:osx 12.6.2

**PHP Version:8.0.0

**Lumberjack Version:v4

Enqueue Assets

Hi, finally got the time to start experimenting with the new Lumberjack version and right away I'm getting a little confused about something really simple.

My apologies if this is not the best channel to ask this question, but how do you approach triggering methods that need to happen at specific moments of WordPress lifecycle, like enqueuing assets for example?

I've done it by adding a new assets.php file where I then setup the regular WP hooks, but I'm getting the feeling this is not the proper way to do it with Lumberjack, could you clarify please?

Incomplete theme

So this is a little weird to me.

You've built a great theme and it's clearly one of the most elegant implementations of Timber with Bedrock, etc... but the theme is incomplete.

For example, how do you suggest enqueueing js and css? Do you suggest webpack for building?

I can't see any of that in there, so there's a lot I still have to wire together myself.

So any recommendations on what you think works best with Lumberjack?!

A

Access correct pagination information when using the Query Builder

Not sure if I'm missing something in the docs, but I couldn't locate an answer to this on the site.

Can't seem to be able to get pagination to work properly when using the query builder.

With a query like:

  $query = Post::builder()->limit(9);
  $context['posts'] = $query->get();

I've went on to try accessing posts.pagination, that didn't worked, and lastly tried to build out the pagination object using Timber's own method by passing that QueryBuilder params, like this:

  $query = Post::builder()->limit(9);
  $context['posts'] = $query->get();
  $context['pagination'] = Timber::get_pagination($query->getParameters());

This, while creating a pagination object, does not seem to interact with the query from Lumberjack, as navigating to different pages has no effect on the posts being listed (always shows the posts from page 1).

When using Timber's default query methods, as follows, pagination works properly:

   $queryArgs = array(
      'post_type' => 'post',
      'posts_per_page' => 9,
      'paged' => get_query_var('paged') ?: 1,
    );
    $context['posts'] = new \Timber\PostQuery($queryArgs);

Am I missing obvious here?
Thank you!

[bug] site stop working after install wp-browser

For bug reports, please provide as much relevant info as possible.

What are the steps to reproduce this issue?

  1. create a new site
  2. install wp-browser by running composer require --dev lucatume/wp-browser

What happens?

My website stop working and have error:
image

What versions of software are you using?

Operating System: Windows

PHP Version: 7.4

Lumberjack Version: 5.0.0

QueryBuilder - Collection error after installing Intervention/ImageCache

  • install intervention/image and intervention/imagecache with composer

=> observe error with QueryBuilder

(PHP 8.0)

Rareloop\Lumberjack\QueryBuilder::get(): Return value must be of type 
Tightenco\Collect\Support\Collection, Illuminate\Support\Collection returned

in QueryBuilder.php line 177
at RegisterExceptionHandler->handleException(object(TypeError))

presumably related to tighten/collect#92

Twig dump error?

What are the steps to reproduce this issue?

Use dump() in any .twig file.

What happens?

The dumped data is not formatted in a colorful way like if you dump it in a php file.

What versions of software are you using?

Operating System: MacOS 12.3.1.

PHP Version: 8.0

Lumberjack Version: 5.0.0

Screenshot 2022-05-18 at 7 12 42

It should be like this:

Screenshot 2022-05-18 at 7 13 09

Thanks! :)

lumberjack-bedrock permission error while cloning Bedrock repository

What are the steps to reproduce this issue?

  1. composer global require rareloop/lumberjack-bedrock-installer
  2. lumberjack-bedrock -v new mysite

What happens?

Permission error. lumberjack-bedrock is unable to clone Bedrock repository.

What were you expecting to happen?

For lumberjack-bedrock to create a new Lumberjack site.

Any logs, error output, etc?

Checking out Bedrock
Install failed
Symfony\Component\Process\Exception\ProcessFailedException: The command "git clone --depth=1 '[email protected]:roots/bedrock.git' '/Users/andrew/devilbox/data/www/dev/htdocs/rosefarms/dev/rosefamily' && rm -rf '/Users/andrew/devilbox/data/www/dev/htdocs/rosefarms/dev/rosefamily/.git'" failed.

Exit Code: 128(Invalid exit argument)

Working directory: /Users/andrew/devilbox/data/www/dev/htdocs/rosefarms/dev

Error Output:
================
Cloning into '/Users/andrew/devilbox/data/www/dev/htdocs/rosefarms/dev/rosefamily'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What versions of software are you using?

Operating System: macOS High Sierra 10.13.6

PHP Version: PHP 7.1.16

How can I return a 404 Not Found error from my product controller?

Hello, I'm trying to figure out the best way to return a 404 error from my product controller. This would happen when the product route matches but there is no product post matching the slug. I've looked through the documentation and some of the Lumberjack source code and haven't found a solution. What is the best way to return a 404 error from inside a controller?

Deprecation warning for Timber\Helper::function_wrapper()

Emitted from lumberjack/src/Core/Site.php

$data['wp_title'] = TimberHelper::function_wrapper('wp_title', ['|', false, 'right']);

Instead, we can reference the Timber FunctionWrapper directly as suggested by the deprecation warning.

use Timber\FunctionWrapper as TimberFunctionWrapper;
$data['wp_title'] = new TimberFunctionWrapper('wp_title', ['|', false, 'right']);

WooCommerce products in Lumberjack

Hello, I'm trying to figure out how to use Lumberjack with WooCommerce. I created a Product post type in Lumberjack, but when I implement the required getPostType and getPostTypeConfig methods it breaks WooCommerce because it seems to override the product post type WooCommerce had already set up. What is the best way to implement custom logic for an already-existing product post type?

Popularity

Hello!

What do you see as the main cause of only 146 stars here on GitHub, not hundreds or thousands?
Maybe the number of serious developers working with WordPress? Or Themosis?
What do you think?

Post Type not registering

What are the steps to reproduce this issue?

I'm basically following the steps described on the new documentation for a Bedrock environment, and got stuck in the part where we register a new post type.

I've added the Product class exactly as described in the docs, with the two required methods, and proceeded to register the class in config\posttypes.php.

I've confirmed the Products class is called during the application runtime, but still no product post type available in the admin.

I'm probably missing something, wondering if you could point me help understand what.

What versions of software are you using?

Operating System: OSX

PHP Version: 7.2.5

Lumberjack Version: Core is version 3.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.