Giter Site home page Giter Site logo

plugin's Introduction

Themosis framework

Build Status

The Themosis framework is a tool aimed to WordPress developers of any levels. But the better WordPress and PHP knowledge you have the easier it is to work with.

Themosis framework is a tool to help you develop websites and web applications faster using WordPress. Using an elegant and simple code syntax, Themosis framework helps you structure and organize your code and allows you to better manage and scale your WordPress websites and applications.

Installation

Please see the installation section of the Themosis documentation.

Development team

The framework was created by Julien Lambé, who continues to lead the development.

Contributing

Any help is appreciated. The project is open-source and we encourage you to participate. You can contribute to the project in multiple ways by:

  • Reporting a bug issue
  • Suggesting features
  • Sending a pull request with code fix or feature
  • Following the project on GitHub
  • Following us on Twitter: @Themosis
  • Sharing the project around your community

For details about contributing to the framework, please check the contribution guide.

License

The Themosis framework is open-source software licensed under GPL-2+ license.

plugin's People

Contributors

jlambe avatar ryanturnerwebdev avatar twmbx 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

plugin's Issues

Defining console commands

Is it possible to define console commands from within a plugin? And if so.. how?

The only way made this possible was by editing the themosis/themosis's App\Console\Kernel. But I would like the plugin to work independently.

Prototype code in wp_cli shell

Hi @jlambe again!

I try to prototype somehow code, before to write any file. But when try to use 'use statement', from Facade\User. Shell is exited with not message error or anything debug trace.

Are you try this form to prototype code.

Thanks!!

cant use blade theme engine

Hello!
when i create sample.blade.php in views folder this happen:
Warning: file_put_contents(\views\/c450af0719ef.........2d027adb895b.php): failed to open stream: No such file or directory in ...\wp-content\plugins\framework\vendor\illuminate\filesystem\Filesystem.php on line 122

sample.php and sample.twig is working

[BUG] Loading textdomain fails

Current code

Currently textdomains are loaded in the code here like so:

load_plugin_textdomain(
    $plugin->getHeader('text_domain'),
    false,
    $plugin->getPath(trim($plugin->getHeader('domain_path'), '\/'))
);

This doesn't work tho because the function load_plugin_textdomain makes use of the constant WP_PLUGIN_DIR and requires a relative path, not an absolute one like is given.

Fixed code

Here the last parameter uses a relative path:

load_plugin_textdomain(
    $plugin->getHeader('text_domain'),
    false,
    $plugin->getDirectory() .DS. trim($plugin->getHeader('domain_path'), '\/')
);

Dynamic function

We also had an issue that, when our plugin was installed as a must-use plugin, it wouldn't work since that requires the load_muplugin_textdomain function.
So we made our own function, based on the load_muplugin_textdomain function, that works when the plugin is installed as either a muplugin or regular plugin:

/**
 * Load text domain for the given Themosis plugin
 *
 * @param string $plugin
 * @return bool True on success, false on failure.
 */
function loadThemosisPluginTextDomain(string $plugin)
{
    $plugin = app("wp.plugin.{$plugin}");

    // get domain
    $domain = $plugin->getHeader('text_domain');
    $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
    
    // get path to .mo file
    $domain_path = trim($plugin->getHeader('domain_path'), '\/');
    $mofile = $domain . '-' . $locale . '.mo';
    $path = $plugin->getPath($domain_path .DS. $mofile);

    // load
    return load_textdomain($domain, $path);
}
loadThemosisPluginTextDomain('my-plugin');

Return a binary response

Hi,

I alm currently writing a plugin which generate a PDF file. I want to return the binary response with force download headers.

I was used to do in Symfony / Drupal something like :

    $response = new BinaryFileResponse($pdfFilePath);
    $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
    return $response;

I have seen in the core of the framework, that themosis only return content and not headers as headers are managed by WP.

// We only send back the content because, headers are already defined
// by WordPress internals.

Could you tell me what's the themosis way of struggling with headers in this use case ?

Thanks,

Load templates from plugin

Hello,

I would like to know how can I use templates from a custom plugin. I have a templates.config.php with the right prefix in resources/config but I don't know how to load it.
In the documentation we can find this line, but where can I use it ?
$templates = Config::get('com_domain_shop_templates');

Thank you !

Considerations on Themosis Plugin

What should one consider when creating a themosis plugin?
I would like to be theme independent, but keep all the logic and functionality inside plugins.

Thank you

Themosis 2.0 plugin autoloader

Hi,

I'm trying your new plugin's boilerplate in themosis 2.0, but files on the resources folder are not autoloaded.

How i must change the plugin's files ? Documentation for plugins is not updated.

Thank you !

Error

I installed the latest wordpress and get the next error:

Fatal error: Call to undefined function container() in /var/www/html/wpp/htdocs/content/plugins/name/plugin-name.php on line 81
Unhandled Exception

Message:

Call to undefined function container()
Location:

/var/www/html/wpp/htdocs/content/plugins/name/plugin-name.php on line 81

Documentation and error

Hi there. First of all, thanks for this great framework.
I'm trying to create a plugin leveraging themosis features, but i'm actually stuck on a problem.

What i did?

1 - Downloaded the plugin boilerplate to htdocs/content/plugins/my-plugin
2 - Edited filename to match folder name.
3 - Edited the file changing header values.
`/**

  • Plugin Name: CB-AUTO
  • Plugin URI: http://example.dev
  • Description: A plugin to manage everything.
  • Version: 1.0.0
  • Author: Pedro X.
  • Author URI: http:/example.dev
  • Text Domain: cb-auto
  • Domain Path: /languages
    */`

4- Edited when asked on that file eg:
defined('MY_PLUGIN_TD') ? MY_PLUGIN_TD : define('MY_PLUGIN_TD', 'cb-auto');
$vars = [ 'slug' => 'cb-auto', 'name' => 'cb-auto', 'namespace' => 'cbauto', 'config' => 'cb_auto', ];

5 - Renamed config files to:
cb-auto_loading.config.php
`<?php

/**

  • Plugin autoloading configuration.
    */
    return [
    'cbauto\Services\' => themosis_path('plugin.cbauto.resources').'providers',
    'cbauto\Controllers\' => themosis_path('plugin.cbauto.resources').'controllers'
    ];`

cb-auto_providers.config.php

`<?php

/**

  • Plugin services providers configuration.
    */
    return [
    cbauto\Services\RoutingService::class
    ];`

I see the plugin on my dashboard, but when i try to activate it i got the following error:

`Unhandled Exception

Message:

Call to undefined function container()
Location:

C:\xampp\htdocs\cbmanage\htdocs\content\plugins\cb-auto\cb-auto.php on line 81
Stack Trace:

#0 C:\xampp\htdocs\cbmanage\htdocs\cms\wp-admin\includes\plugin.php(1882): include()
#1 C:\xampp\htdocs\cbmanage\htdocs\cms\wp-admin\plugins.php(164): plugin_sandbox_scrape('cb-auto/cb-auto...')
#2 {main}`

Maybe it's a newbie question, but if you can provide me some guidance i will be really happy.

Thanks in advance,
Pedro

Don't see my plugin in Dashboard

Hey,

I create already create a first plugin and he is functional. But my second one isn't displayed in my Dashboard (plugins.php).
Someone could help me?

Prevent standard template loading on view

Hi,

I started to use themosis to create a new plugin in an existing wordpress website that uses a traditionnal template.

I was wondering if this is possible to prevent the loading of the standard template when we call a view in the controller.

Thanks

Got error when trying to activate the plugin using the Themosis 2.0 framework

Using this plugin boilerplate I tried to create a plugin using the following setup

bedrockstructure-themosisplugin-sagetheme - https://roots.io/bedrock/ (Bedrock is installed fine)

Inside the plugin main folder composer.json I added themosis framework as a dependency like that

"require": {
....
"themosis/framework": "2.0-beta2"
}

then inside the plugin folder I executed composer.install ==> all deps where installed inside the plugin's vendor folder but then when I try to "Activate" the plugin I get

image

this is how the vendor folder looks like

image

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.