YaWK  24.1
Yet another WebKit
YAWK\plugin Class Reference

Handles the Plugin System. More...

Public Member Functions

 __construct ()
 plugin constructor. More...
 

Static Public Member Functions

static getIdByName ($db, $plugin)
 get requested plugin ID by given name More...
 
static getNameById ($db, $pluginId)
 get requested plugin name for given plugin ID More...
 

Public Attributes

 $activated
 
 $description
 
 $icon
 
 $id
 
 $name
 

Detailed Description

Handles the Plugin System.

Plugin class: handles some basic plugin functions

Handles plugin functions of YaWK. Plugins are bigger extensions than widgets. A plugin can handle any data from a mysql database. This is useful if your project needs more than just static pages, like a bulletin board, shop system, blog and so on. There are many Plugins done yet. See how the plugin system is organized:

  • system/plugins/pluginname/ = Plugin folder
  • system/plugins/pluginname/admin = Plugin Backend (view)
  • system/plugins/pluginname/classes = Plugin logic (controller)
  • system/plugins/pluginname/pluginname.php = Plugin Frontend (view)


If you need to build a custom extension, read the docs about the plugin system to understand how to fit it into YaWK. If you follow the Plugin's MVC structure, it is easy to integrate your own extensions into any project.

Example: <?php \YAWK\plugin::getPlugins(); ?> gets a list of all plugins, like its used in the backend in "Plugin" Menu.

This class covers backend functionality. See Methods Summary for Details!

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0

Definition at line 32 of file plugin.php.

Constructor & Destructor Documentation

◆ __construct()

YAWK\plugin::__construct ( )

plugin constructor.

Definition at line 48 of file plugin.php.

49  {
50  // ...
51  }

Member Function Documentation

◆ getIdByName()

static YAWK\plugin::getIdByName (   $db,
  $plugin 
)
static

get requested plugin ID by given name

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0
Parameters
object$dbdatabase
string$pluginplugin name
Returns
string|bool returns the plugin ID or false
Parameters
$db\YAWK\db $res

Definition at line 158 of file plugin.php.

159  { /** @param $db \YAWK\db $res */
160  if ($res = $db->query("SELECT id FROM {plugins} WHERE name ='".$plugin."'"))
161  { // fetch data from db
162  while ($row = mysqli_fetch_row($res))
163  { // return plugin ID
164  return $row['0'];
165  }
166  }
167  else
168  { // q failed, throw error
169  \YAWK\sys::setSyslog($db, 31, 1, "failed to get id of plugin $plugin ", 0, 0, 0, 0);
170  return \YAWK\alert::draw("danger", "Error!", "Could not get id of plugin: ".$plugin."","page=plugins","4800");
171  }
172  return false;
173  }
$plugin

References $db, $plugin, and $res.

◆ getNameById()

static YAWK\plugin::getNameById (   $db,
  $pluginId 
)
static

get requested plugin name for given plugin ID

Author
Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
Version
1.0.0
Parameters
object$dbdatabase
int$pluginIdaffected plugin ID
Returns
string|bool returns the name or false
Parameters
$db\YAWK\db $res

Definition at line 130 of file plugin.php.

131  { /** @param $db \YAWK\db $res */
132  if ($res = $db->query("SELECT name FROM {plugins} WHERE id = '" . $pluginId . "'"))
133  { // fetch data from db
134  while ($row = mysqli_fetch_row($res))
135  { // return plugin name
136  return $row['0'];
137  }
138  }
139  else
140  { // q failed
141  \YAWK\sys::setSyslog($db, 31, 1, "failed to get name of plugin $pluginId ", 0, 0, 0, 0);
142  return false;
143  }
144  // something else happened
145  return false;
146  }

References $db, and $res.

Referenced by YAWK\BACKEND\AdminLTE\drawHtmlContent().

Member Data Documentation

◆ $activated

YAWK\plugin::$activated
  • Parameters
    intplugin status ID

Definition at line 43 of file plugin.php.

◆ $description

YAWK\plugin::$description
  • Parameters
    stringplugin description

Definition at line 39 of file plugin.php.

◆ $icon

YAWK\plugin::$icon
  • Parameters
    stringplugin font awesome or glyph icon

Definition at line 41 of file plugin.php.

◆ $id

YAWK\plugin::$id
  • Parameters
    intplugin ID

Definition at line 35 of file plugin.php.

◆ $name

YAWK\plugin::$name
  • Parameters
    stringplugin name

Definition at line 37 of file plugin.php.


The documentation for this class was generated from the following file: