Home » AppMagic for WP – Common Functions

AppMagic for WP – Common Functions

In the \Mbx\System namespace you may find useful:

This value is always available in the API as $data[‘uid’].

function WprGetUserId()

Recursively removes dir and contents

function MbxRemoveDir($dir)

Sends an HTML email. $recipients can be a string if single or an array of addresses. Any valid address format.

function HtmlMail($recipients, $subject, $message)


$send = HtmlMail('user@domain', 'My html email', '
<h1>hello world</h1>

');

Creates a settings system table for your module.$setting is your FeatureModule name. Useful in installers. Compatible with admin page settings system.

function CreateSettingsTable($setting, $drop = FALSE)

Deletes a settings table. Useful in uninstallers.

function DeleteSettingsTable($setting)

Sometimes you may want to update a single module setting from code instead of the form.

function InsertUpdateSetting($module, $setting, $value)

When your module runs you will want to get the settings. This returns an associative array.

function GetModuleConfig($module, $keys_only = FALSE)

// For instance
$mod_config = \Mbx\System\GetModuleConfig('SiteMap');

In the \Mbx\DataStore namespace

Gets a \Mbx\DataDtore\MbxPdo instance. External refers to an secondary database. In order to use external listings use WPR_USING_EXTERNAL_DB

function MbxGetDb($using_external = FALSE)

// For instance
if($data['tablename'] == 'listingsdb')
        $db = \Mbx\DataStore\MbxGetDb(WPR_USING_EXTERNAL_DB);
    else 
        $db = \Mbx\DataStore\MbxGetDb();

Name of author

Name: Mike Morris