本文整理汇总了PHP中pb_backupbuddy::get_group方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy::get_group方法的具体用法?PHP pb_backupbuddy::get_group怎么用?PHP pb_backupbuddy::get_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy
的用法示例。
在下文中一共展示了pb_backupbuddy::get_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_setting
function add_setting($settings)
{
$default_settings = array('type' => '', 'name' => '', 'title' => '', 'tip' => '', 'css' => '', 'before' => '', 'after' => '', 'rules' => '', 'default' => '', 'options' => array(), 'orientation' => 'horizontal', 'classes' => '', 'row_class' => '');
$settings = array_merge($default_settings, $settings);
$this->_settings[] = $settings;
// Figure out defaults.
if ($settings['default'] != '') {
// Default was passed to add_setting().
$default_value = $settings['default'];
} else {
// No default explictly set.
if ($this->_savepoint !== false) {
if (is_array($this->_savepoint)) {
// Array of defaults was passed instead of savepoint.
$default_value = $this->_savepoint[$settings['name']];
} else {
// No defaults provided, seek them out in plugins options array.
// Default values are overwritten after a process() run with the latest data if a form was submitted.
$group = pb_backupbuddy::get_group($this->_savepoint);
if ($group === false) {
$default_value = '';
} else {
if (isset($group[$settings['name']])) {
// Default is defined.
$default_value = $group[$settings['name']];
} else {
// Default not defined.
$default_value = '';
}
}
}
// end finding defaults in plugin options.
} else {
// Custom mode without a savepoint provided so no default set unless passed to add_setting().
$default_value = '';
}
}
// Process adding form item for the setting based on type.
switch ($settings['type']) {
case 'text':
$this->_form->text($settings['name'], $default_value, $settings['rules']);
break;
case 'plaintext':
$this->_form->plaintext($settings['name'], $default_value);
break;
case 'color':
$this->_form->color($settings['name'], $default_value, $settings['rules']);
break;
case 'hidden':
$this->_form->hidden($settings['name'], $default_value, $settings['rules']);
break;
case 'wysiwyg':
$this->_form->wysiwyg($settings['name'], $default_value, $settings['rules'], $settings['settings']);
break;
case 'textarea':
$this->_form->textarea($settings['name'], $default_value, $settings['rules']);
break;
case 'select':
$this->_form->select($settings['name'], $settings['options'], $default_value, $settings['rules']);
break;
case 'password':
$this->_form->password($settings['name'], $default_value, $settings['rules']);
break;
case 'radio':
$this->_form->radio($settings['name'], $settings['options'], $default_value, $settings['rules']);
break;
case 'checkbox':
$this->_form->checkbox($settings['name'], $settings['options'], $default_value, $settings['rules']);
break;
case 'submit':
$this->_form->submit($settings['name'], 'DEFAULT');
// Submit button text is set in display_settings() param.
break;
case 'title':
$this->_form->title($settings['name'], $default_value, $settings['rules']);
// Submit button text is set in display_settings() param.
break;
default:
echo '{Error: Unknown settings type.}';
break;
}
// End switch().
}
示例2: ajax
public function ajax($actionb)
{
if ($actionb == 'save_images_list') {
// User modified the list of images in a group.
//echo '<pre>' . print_r( pb_backupbuddy::_POST(), true ) . '</pre>';
$images = explode(',', pb_backupbuddy::_POST('items'));
echo '<pre>' . print_r($images, true) . '</pre>';
// Prepare savepoint.
if ($this->_save_point != '') {
$savepoint_root = $this->_save_point;
// . '#';
} else {
$savepoint_root = '';
}
$image_root =& pb_backupbuddy::get_group($savepoint_root);
$image_root = array();
foreach ($images as $image_id) {
// Loop through each item in list.
//echo 'id: ' . $image_id . '<br>';
$image_defaults = pb_backupbuddy::settings(pb_backupbuddy::_POST('default_options_point'));
$image_defaults['id'] = $image_id;
$image_root[] = $image_defaults;
/*
//echo '<pre>' . print_r( $image_defaults, true ) . '</pre>';
// From old save_settings():
$savepoint_subsection = &pb_backupbuddy::$options;
$savepoint_levels = explode( '#', $savepoint_root );
foreach ( $savepoint_levels as $savepoint_level ) {
$savepoint_subsection = &$savepoint_subsection{$savepoint_level};
}
// Apply settings.
$savepoint_subsection[] = $image_defaults;
*/
}
//echo '<pre>' . print_r( $image_root, true ) . '</pre>';
pb_backupbuddy::save();
}
die;
}