Giter Site home page Giter Site logo

wpbones / wpbones Goto Github PK

View Code? Open in Web Editor NEW
109.0 11.0 24.0 1.34 MB

WordPress framework for Laravel developers

Home Page: https://wpbones.vercel.app/

License: GNU General Public License v3.0

PHP 100.00%
wordpress wordpress-plugin wordpress-theme wordpress-development laravel wordpress-boilerplate wordpress-php-library php7 wp-bones wordpress-plugin-boilerplate

wpbones's Introduction

wpbones's People

Contributors

dansleboby avatar gfazioli avatar jacquestvanzuydam avatar manudoni 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

wpbones's Issues

Migrate not creating table

Migrate not creating table on deactuvating/activating plugin
here's my code

<?php

use CDEHotel\WPBones\Database\Migrations\Migration;

class room extends Migration
{

  public function up()
  {
    $this->create( "CREATE TABLE {$this->tablename} (
      id integer(11)  NOT NULL auto_increment,
      name varchar(250) NOT NULL default '',
      roomtype integer(11)  NOT NULL,
      ) {$this->charsetCollate};" );
  }

}

php bones retrun Error establishing a database connection

after installing wp bones reactjs version . i execute php bones from terminal and i get

<title>Database Error</title> <style type="text/css"> html { background: #f1f1f1; } body { background: #fff; border: 1px solid #ccd0d4; color: #444; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; margin: 2em auto; padding: 1em 2em; max-width: 700px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); } h1 { border-bottom: 1px solid #dadada; clear: both; color: #666; font-size: 24px; margin: 30px 0 0 0; padding: 0; padding-bottom: 7px; } #error-page { margin-top: 50px; } #error-page p, #error-page .wp-die-message { font-size: 14px; line-height: 1.5; margin: 25px 0 20px; } #error-page code { font-family: Consolas, Monaco, monospace; } ul li { margin-bottom: 10px; font-size: 14px ; } a { color: #0073aa; } a:hover, a:active { color: #006799; } a:focus { color: #124964; -webkit-box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8); box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8); outline: none; } .button { background: #f3f5f6; border: 1px solid #016087; color: #016087; display: inline-block; text-decoration: none; font-size: 13px; line-height: 2; height: 28px; margin: 0; padding: 0 10px 1px; cursor: pointer; -webkit-border-radius: 3px; -webkit-appearance: none; border-radius: 3px; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;
                    vertical-align: top;
            }

            .button.button-large {
                    line-height: 2.30769231;
                    min-height: 32px;
                    padding: 0 12px;
            }

            .button:hover,
            .button:focus {
                    background: #f1f1f1;
            }

            .button:focus {
                    background: #f3f5f6;
                    border-color: #007cba;
                    -webkit-box-shadow: 0 0 0 1px #007cba;
                    box-shadow: 0 0 0 1px #007cba;
                    color: #016087;
                    outline: 2px solid transparent;
                    outline-offset: 0;
            }

            .button:active {
                    background: #f3f5f6;
                    border-color: #7e8993;
                    -webkit-box-shadow: none;
                    box-shadow: none;
            }

                    </style>

Error establishing a database connection

Issues with Deployed Plugin

Describe the bug
When the plugin is deployed using the php bones deploy <path-name>, the deployed plugin's size is more than 30MB which is insane.

To Reproduce
Steps to reproduce the behavior:

  1. run php bones deploy <path-name>
  2. Right click the deployed folder.
  3. Get shocked.

Expected behavior
It shouldn't exceed more than 4MB in size.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: NA
  • Version: 0.9.50

running php bones command does not show any output to console

Describe the bug
running php bones command does not show any output to console

To Reproduce
Steps to reproduce the behavior:

  1. download latest version of wordpress
  2. clone any branch (i.e. demo, master, boilerplate) in wp-content/plugins directory
  3. run php bones command in terminal
  4. it does not show any output

Expected behavior
it should show output as in wiki

Screenshots
image

Add message to redirect

How to add message to redirects

heres my sample code

    if($_POST!=null){
        $p = $_POST;
        $type  = new Roomtype();
        $type->name = $p['name'];
        $type->price = $p['price'];
        $type->maxpax = $p['maxpax'];
        $type->children = $p['children'];
        $type->adult = $p['adult'];
        $type->details = $p['details'];
        $type->save();
    }
    $this->redirect(get_admin_url().'admin.php?page=cdehotel_cde_roomtypes');
  }

is there a way to do it like ?

 return redirect('dashboard')->with('status', 'Profile updated!');

Error with cli Bones

Thank you very much for your work.
I'm testing your framework, and I have this problem when I try to run the "php bones" commands.
I think my problem may be the PHP version, I'm using PHP 7.
You could help me please.

image

Can't find docs on processing forms with routes.

Hi I'm digging your plugin so far!

Now we want to show some custom forms on the front end. Is there a way to set form action to controller routes to process the form data? Couldn't find any other example in the docs other than options.

Thanks in advance!

Activation and Deactivation does not work

I want to check for Woocommerce while activating my plugin. How can I put this check in activation hook? I tried to tweak the activation.php file but it does not return anything.
I tried this as well

function activate()
{
	if (!class_exists('woocommerce')) {
		deactivate_plugins(plugin_basename(__FILE__));
		wp_die(__('Please install and activate WooCommerce first. Click the Back button in your browser to continue.'));
	}
}

Is there a way that I can check this via my controllers and call those functions in my activation.php and deactivation.php files?

Controller - Model Connectivity?

Okay - now either I am missing out something really simple or WP Bones doesn't have a solid way to interact with the "migrations" it is creating?

How do I make a Controller - Model connection just like Laravel in WP Bones plugin? That is like, really important.

Issue include view on shortcode

Is it possible to include a view (along with passing variables to it), attach it to a variable, but not render it. I would like to then attach the view variable to an email.

Example:
$formDataEmail = HabitatOaklandPlugin()->view( 'emails.service-request-form' )->with( [ 'form_data' => $form_data, 'has_error' => $has_error ] ); $message = $mgClient->sendMessage($domain, array( 'from' => '', 'to' => '', 'subject' => Subject', 'html' => $formDataEmail ));
Right now, it will show the view on the page which I don't want to happen. Thank you.

sidebar menu entries disappears by changing namaspace through php bones rename command

when we change namespace by php bones rename command the sidebar menu disappears once we undo the renaming (i.e. default namespace ) the menu appears again.

Steps to reproduce the behavior:

  1. install wp kirk demo version
  2. rename the plugin by php bones rename "some name"
  3. refresh the wp admin and menu is gone
  4. rename plugin back to default
  5. the menu appears again

Expected behavior
rename commad should be fixed

image
image

Check get options with "." or "/"

in the WordPressOption class, we split the options by "." and not by "/"

check the method get, set and delete

  public function get( $path, $default = "" )
  {
    $keys = explode( ".", $path );

    $current = $this->_value;

    foreach ( $keys as $key ) {

      if ( ! isset( $current[ $key ] ) ) {
        return $default;
      }

      if ( is_object( $current[ $key ] ) ) {
        $current = (array) $current[ $key ];
      }
      else {
        $current = $current[ $key ];
      }
    }

    return $current;
  }

How to call a model?

I'm new to MVC . im getting this error

Fatal error: Class 'WPKirk\WPBones\Database\Model' not found in C:\Ampps\www\plugindev\wp-content\plugins\cdemvc\plugin\Http\Controllers\Model\room.php on line 7

heres my model

namespace WPKirk\Http\Controllers\Model;

use WPKirk\WPBones\Database\Model;

class room extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'rooms';

    /**
     * Get the table associated with the model.
     *
     * @return string
     */
    public function getTable()
    {
        global $wpdb;

        return $wpdb->prefix . preg_replace('/[[:<:]]' . $wpdb->prefix . '/', '', parent::getTable(), 1);
    }

    public function test(){
      return "hello";
    }
}

and my controller

<?php

namespace WPKirk\Http\Controllers;

use WPKirk\Http\Controllers\Controller;
use WPKirk\Http\Controllers\Model\room;

class RoomsController extends Controller
{


  public function index()
  {

    $r = new room();
    return WPKirk()->view( 'rooms.index' );
  }

Sanitizing inputs

Hi , I would like to know if i would be able to use the Laravel validation like here.
It would be great if you could point me in the right direction on how to sanitize my inputs with wpbones.

Parse error: syntax error, unexpected ';', expecting identifier (T_STRING)

I get the following error when I add routes to my config/routes.php:

Parse error: syntax error, unexpected ';', expecting identifier (T_STRING) in /usr/share/nginx/html/wp/wp-content/plugins/buster-wp/vendor/wpbones/wpbones/src/Foundation/Plugin.php(612) : runtime-created function on line 1

This is what my routes file looks like.

I'm not sure if there is something wrong with my routes, or if there is an issue in Plugin.php?

WPBannerize()

Hello! Going through the code of this framework I found the following:

wp_enqueue_script($this->slug . Str::slug($file),
--
380 | WPBannerize()->js . '/' . $file,

May someone explain to what this method WPBannerize refers?

Add the ability to run a generic query

Is your feature request related to a problem? Please describe.
would be great to improve the QueryBuilder in order to provide a generic query method to execute any query

Describe the solution you'd like
something like that

DB::table('users')->query('SELECT ....')->run();

Error on using Relationships

Cant get through relationship.

Heres my controller

  namespace CDEHotel\Http\Controllers\Rooms;

use CDEHotel\Http\Controllers\Controller;


use Illuminate\Support\Facades\DB;
use CDEHotel\Http\Model\Room;
use CDEHotel\Http\Model\Roomtype;

class typeController extends Controller
{

public function index()
  {
    $r = Roomtype::find(1)->Rooms;
    $data = Room::all();
    return CDEHotel()->view( 'rooms.type' );
  }

My model

namespace CDEHotel\Http\Model;
use Illuminate\Database\Eloquent\Model;


class Roomtype extends Model
{
    protected $table = 'roomtype';
    public $timestamps = false;

    public function Rooms()
    {
        return $this->hasMany('Room', 'id');
    }

    public function Discount()
    {
        return $this->hasMany('Discount', 'roomtype');
    }

    public function getTable()
    {
        global $wpdb;

        return $wpdb->prefix . preg_replace('/[[:<:]]' . $wpdb->prefix . '/', '', parent::getTable(), 1);
    }

}

Error message
Fatal error: Uncaught Error: Class 'Room' not found in C:\Ampps\www\wp\wp-content\plugins\cdeHotelBooking\vendor\illuminate\database\Eloquent\Concerns\HasRelationships.php on line 720

Error: Class 'Room' not found in C:\Ampps\www\wp\wp-content\plugins\cdeHotelBooking\vendor\illuminate\database\Eloquent\Concerns\HasRelationships.php on line 720

last 3 call stack

12 | 1.0829 | 25985440 | CDEHotel\Http\Model\Roomtype->Rooms( ) | ...\HasAttributes.php:411
13 | 1.0829 | 25985440 | CDEHotel\Http\Model\Roomtype->hasMany( ) | ...\Roomtype.php:14
14 | 1.0830 | 25985440 | CDEHotel\Http\Model\Roomtype->newRelatedInstance( ) | ...\HasRelationships.php:327

Eloquent Problems!

The problem:-
Trying to use the eloquent's "find" function.
eg: RoomType::find( 1 );

  • This results in the wrong table name. It appends extra "wp_" to the table name.
  • When you try to update the model after "finding" it, it throws this error.
    PHP Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'real.wp_wp_wp_roomtypes' doesn't exist in...

As you can see, it appended "wp_" twice here.

Any help would be appreciated.
Thanks.

namespace command error

I tried changing namespace but im getting error:

�[38;5;213m
Unknown command! Use --help for commands list
�[0m

Heres the command

php bones namespace anyname

im using Command Prompt on windows 10

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.