本文整理匯總了PHP中MS_Plugin::set_modifier方法的典型用法代碼示例。如果您正苦於以下問題:PHP MS_Plugin::set_modifier方法的具體用法?PHP MS_Plugin::set_modifier怎麽用?PHP MS_Plugin::set_modifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MS_Plugin
的用法示例。
在下文中一共展示了MS_Plugin::set_modifier方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: process_item
/**
* Processes a single import command.
*
* @since 1.0.0
* @param array $item The import command.
*/
protected function process_item($item, $source)
{
$res = false;
lib2()->array->equip($item, 'task', 'data');
$task = $item['task'];
$data = $item['data'];
$model = MS_Factory::create('MS_Model_Import');
$model->source_key = $source;
// Set MS_STOP_EMAILS modifier to suppress any outgoing emails.
MS_Plugin::set_modifier('MS_STOP_EMAILS', true);
// Possible tasks are defined in ms-view-settings-import.js
switch ($task) {
case 'start':
lib2()->array->equip($item, 'clear');
$clear = lib2()->is_true($item['clear']);
$model->start($clear);
$res = true;
break;
case 'import-membership':
// Function expects an object, not an array!
$data = (object) $data;
$model->import_membership($data);
$res = true;
break;
case 'import-member':
// Function expects an object, not an array!
$data = (object) $data;
$model->import_member($data);
$res = true;
break;
case 'import-settings':
lib2()->array->equip($item, 'setting', 'value');
$setting = $item['setting'];
$value = $item['value'];
$model->import_setting($setting, $value);
$res = true;
break;
case 'done':
$model->done();
$res = true;
break;
}
/**
* After the import action was complated notify other objects and
* add-ons.
*
* @since 1.0.0
*/
do_action('ms_import_action_' . $task, $item);
return $res;
}