Giter VIP home page Giter VIP logo

quaco's People

Contributors

beumerr avatar cheiaych avatar ryanmarzec avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

x-n0 cheiaych

quaco's Issues

Merge 2 .htacces files into 1

The htaccess is used to redirect to users to the correct index.php where the bootstrapping will happen.

Location Main route Rewrite to Used for
scr/.htaccess /* scr/index.php Used to compile the theme that visitors will see
scr/admin/.htaccess /admin/* scr/admin/index.php Used to compile the admin panel

As you might have noticed in the table above, there are 2 htaccess files. It works like it should but its not a nice solution.. When changing root directory both files need to be edited which isn't very practical

Code a htaccess, located in the scr root folder that merges both htaccess files into 1.

Good luck ๐Ÿ˜ธ

Create hook architecture prototype

Hooks allow modules to execute code in between system actions like compiling the menu but also smaller functionality like title separators.

While some hooks are interesting for theme development, others are only used in the back-end

A module may hold information like this but other concepts might work to

[
   name => 'Post module',
   slug => 'post_module',
   description => 'Create and manage pages',
   parent_menu_slug => 'settings',
   user_level => 3,
  menu_order => 1
]

But as we are speaking right now there isn't anything coded so all architectural decisions are open.

The hook functionality will be fundamental part of the system

Create 1 load Class instead of 3 bootstrapper

Currently, there are 3 bootstrappers:

  1. src/index.php - used to compile the theme
  2. src/admin/index.php - used to compile the admin panel
  3. src/admin/inc/qc-load-xml.php - used to compile an XML requests

It would be a better solution to create 1 load Class which loads relevant data based on constructor attributes. Now there is a lot of maintaining to do when the start till end process changes a bit.

Create error handler Class

The error class should be located in: root/admin/inc/QC_error

Study this page to design error hierarchies.

Attributes used to create error:

  • function where error happens.
  • message of what went wrong.
    error version control will be a future feature

Class attributes:
public $errors = [];

Class methods:

  • usage_error - Call this function when used the wrong way
  • system_error - Call this function when system has error
  • draw_error - Display all errors

QC_panel.php

  • Add draw_error hook underneath tag

Change AJAX post request to get

Files needed:

  1. src/admin/assets/js/script.js - This file contains the JS with AJAX call function
  2. src/admin/inc/qc-load-xml.php - File that AJAX will call

In the function set_page_section from file 1:

  • Change the post type to GET instead of POST.
  • Send slug details in url instead of data.

In file 2:

  • change $_POST['slug] to $_GET['slug']

Create database class

Location: src/admin/classes/quaco-db.php

Requirements:

  • Use mysqli
  • Always prepare values

Tips:

Globals for db connection:

  • $db_name
  • $db_host
  • $db_pass
  • $db_charset

'*' = method contains parameters

Methodes:

  • constructor -> check / create connection to DB
  • get_last_id -> returns ID from last insert
  • _construct -> set db vars
  • db_connect -> Init db connection
  • prepare -> Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
    • placeholder_escape ->Generates and returns a placeholder escape string for use in queries
      returned by ::prepare()
    • add_placeholder_escape ->Adds a placeholder escape string, to escape anything that
      resembles a printf()
    • remove_placeholder_escape ->Removes the placeholder escape strings from a query.
  • get_var -> execute select query, returning 1 value *
  • get_row -> execute select query, returning row *
  • get_table -> execute select query, returning table *
  • delete -> execute delete query *
  • update -> execute update query *
  • insert -> execute insert query *
  • query -> execute any query *

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.