本文整理汇总了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;
}