GithubHelp home page GithubHelp logo

widoz / template-loader Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 84 KB

A WordPress template loader to use within your plugin

License: GNU General Public License v2.0

PHP 100.00%
wordpress template loader oop psr php template-loader

template-loader's People

Contributors

widoz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

template-loader's Issues

Introduce Interface to unbind from \stdClass

Creating an interface will allow us to pass every type of instance instead of manipulate objects to obtain the properties values.

In this way the loader will be indipendently by the data type and the view will be able to use any kind of data.

namespace TemplateLoader;

interface TemplateData {}

Plugin class create issues when used as composer package

The plugin path will not be correctly if the template loader is used as composer package.

So, remove the Plugin class and introduce an additional arguments to the contructor for Loader that will be the plugin directory path.

public function __construct($slug, DataStorage $storage, $templatePath = null, $pluginPath = '')
    {
        $this->slug        = Sanitizer::sanitizeSlugRegExp($slug);
        $this->data        = null;
        $this->dataStorage = $storage;
        $this->pluginPath  = $pluginPath;

        $this->setTemplatePath($templatePath);
    }

then in pluginFilePath 

...
} elseif (is_string($tmplPath)) {
            $pluginPath = untrailingslashit($this->pluginPath);
            $tmplPath   = ltrim($tmplPath, '/');
            $path       = Sanitizer::sanitizePath("{$pluginPath}/{$tmplPath}");
        }

...
``` 

Check for unneeded methods.

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.