osc_category() – Gets current category osc_get_categories() – Gets the list of categories as a tree osc_field_toTree($item, $field) – If the result of toTree had the same format as items or comments, it would be the same as osc_field osc_category_field($field, $locale = ) – Gets the value of the category attribute osc_priv_count_categories() – Gets the number of […]
Category: Developers
Translate theme, plugin or Osclass
This guide demonstrates different ways of Translating and editing language files (.po and .mo), translations of themes, plugins and core. Free translation plugin – Make sure to check DeepL Translation Plugin that helps to translate whole Osclass, plugins and themes in few minutes for free! Translations are high-quality using advanced AI with very close performance […]
How to create child theme
A child theme is a theme that inherits the functionality of another theme, called the parent theme. Child themes allow you to modify, or add to the functionality of that parent theme. A child theme is the best, safest, and easiest way to modify an existing theme, whether you want to make a few tiny […]
How to create theme
Osclass allows you to use themes in order to change the appearance of your site and make it unique. This page will explain the process to create a theme for your site. Themes must be placed inside oc-content/themes/ folder. What is GUI? GUI is a fallback theme, included in Osclass, if you mess up and delete your themes […]
Updating your themes to Osclass 3.x
In Osclass 3.x we introduce some changes on theme’s information, which is located in <your_theme_folder>/index.php From this : <?php function yourtheme_theme_info() { return array( ‘name’ => ‘Your Theme’ ,’version’ => ‘1.0’ ,’description’ => ‘This is Your theme’ ,’author_name’ => ‘You’ ,’author_url’ => ‘http://www.example.com/’ ,’locations’ => array(‘header’, ‘footer’) ); } ?> To this : <?php /* Theme […]
Route functions
What are the routes for? You could extend Osclass with plugins, and sometimes you need to create a special page, for example to show more options to your users. In previous versions, the url will look like domain.tld/index.php?page=custom&file=your_plugin/page.php which isn’t the prettiest url you could see, and also the file path are visible which is […]
Enqueue functions
What are the Enqueue functions for? The enqueue functions are used for loading your javascript and css files. The reason they where added is becuse many plugins make use of javascript frameworks such as JQuery, JQuery-ui, and fancybox just to name a few. There is a high chance that these javascript files could be loaded […]
Administrator toolbar
At admin panel since osclass version 3.0, there is a toolbar which is visible around the admin panel, can have shortcuts to actions like: add a new listing, show pending updates, … Developers can add to the toolbar whatever they want, with hooks, and calling AdminToolbar functions like add_menu($array) AdminToolbar::newInstance()->add_menu( array(…) ); /** * Add […]
Administrator menus
Usualy plugin and themes needs to add menus in the Administrator panel for provide access to screens. The best way is adding a menu section in the Administration menu that allows the user to access the screens. There are some functions for manipulate the Administration Menu. Admin Menus hAdminMenu helper Add menu page to Administration […]
Database model and diagram
This diagram could be a bit difficult to understand at first and follow all the relations. To be able to use an interactive version of the same diagram, please use theMySQL Workbench and follow these steps. Download MySQL Workbench (it’s free and cross-platform!) Install it and open it Select Create EER Model From SQL Script Look for your file […]
Auto-update for your themes and plugins
In 3.0, we’ introduced an auto-upgrade system for plugins and theme, along with some neat features. To make your plugins and themes able to use this new feature, you need to use the Update URI param on the description of your creations. The Update URI should be unique per theme/plugin and reply a JSON response with the following format: […]
Global variables
~/oc-load.php Osclass load several global variables to work. ABS_PATH: LIB_PATH: THEMES_PATH: PLUGINS_PATH TRANSLATIONS_PATH OSCLASS_VERSION __OSC_LOADED__ __FROM_CRON__
Database debug mode
Note: This will have a performance impact on your site, so make sure to turn this off in your production site. OSC_DEBUG_DB – saves the database queries to an array and at the end of the execution the queries are displayed at the end the page. The information saves each query: the sql string, how […]
Debug mode (PHP, errors)
If you see Error 500 page on your site, you probably have PHP errors on background, but they are not visible. If you want to see these error messages, follow these instructions. Error messages must be also provided to support if you want to get help. Following lines should be placed with care into config.php […]
Coding style
This small guide is partly based in the coding style guide of Zend Framework. PHP Code Demarcation PHP code must always be delimited by the full-form, standard PHP tags: <?php ?> Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted (See General standards). Variables Vairables should […]
How to create osclass plugin
Osclass functionality could be extended via Plugins, refer to Plugins page to know more about plugins, this page is about to create them. Plugins files structure Each plugins should consist in one plugin folder, you can call it whatever you want, and one index.php file at least. You could add several files and libraries. Plugins use Hooks to trigger functions at several places […]
Hooks
A hook is a small piece of code that allows you to insert more code (plugin) in the middle of certain Osclass’ actions. Usage of hooks To use a hook add the following code to your plugin file : osc_add_hook(‘hook_name’, ‘function_name’, ‘priority’); Substitute ‘hook_name’ by the name of the hook you want to attach ‘function_name’, and […]