To manage your widget, go to Appearance -> Widgets to display your payment widget
Or you can logout:
Enter your email and password
get_widget_slug(),
__('AsoribaPayments', $this->get_widget_slug()),
array(
'classname' => $this->get_widget_slug().'-class',
'description' => __(
'Make Church Payments.',
$this->get_widget_slug()
)
)
);
// Register admin styles and scripts
add_action(
'admin_echo_styles',
array($this, 'register_admin_styles')
);
add_action(
'admin_enqueue_scripts',
array($this, 'register_admin_scripts')
);
// Register site styles and scripts
add_action(
'wp_enqueue_scripts',
array($this, 'register_widget_styles')
);
add_action(
'wp_enqueue_scripts',
array($this, 'register_widget_scripts')
);
}
/**
* Returns the widget slug.
*
* @return Plugin slug.
*/
public function get_widget_slug() {
return $this->widget_slug;
}
/**
* Outputs the content of the widget.
*
* @param array args The array of form elements
* @param array instance The current instance of the widget
*/
public function widget($args, $instance)
{
// Check if there is a cached output
$cache = wp_cache_get($this->get_widget_slug(), 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
return print $cache[$args['widget_id']];
}
extract($args, EXTR_SKIP);
$widget_output = $before_widget;
ob_start();
include(plugin_dir_path(__FILE__) . 'views/widget.php');
$widget_output .= ob_get_clean();
$widget_output .= $after_widget;
$cache[$args['widget_id']] = $widget_output;
wp_cache_set($this->get_widget_slug(), $cache, 'widget');
echo $widget_output;
}
/**
* Flushes the widget's cache.
*/
public function flush_widget_cache()
{
wp_cache_delete($this->get_widget_slug(), 'widget');
}
/**
* Processes the widget's options to be saved.
*
* @param array new_instance The new instance of values to be generated via the update.
* @param array old_instance The previous instance of values before the update.
*/
public function update($new_instance, $old_instance)
{
return array(
'title' => strip_tags($new_instance['title']),
'list_id' => strip_tags($new_instance['list_id']),
'include_name_fields' =>
strip_tags($new_instance['include_name_fields']),
'include_referral' => strip_tags($new_instance['include_referral']),
);
}
/**
* Generates the administration form for the widget.
*
* @param array instance The array of keys and values for the widget.
*/
public function form($instance)
{
$instance = wp_parse_args((array)$instance);
// Display the admin form
include(plugin_dir_path(__FILE__) . 'views/admin.php');
}
/**
* Loads the widget's text domain for localization and translation.
*/
public function widget_textdomain()
{
load_plugin_textdomain(
$this->get_widget_slug(),
false,
plugin_dir_path(__FILE__) . 'lang/'
);
}
/**
* Fired when the plugin is activated.
*
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
*/
public function activate($network_wide)
{
// TODO: Needed?
}
/**
* Fired when the plugin is deactivated.
*
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
*/
public function deactivate($network_wide)
{
// TODO: Needed?
}
/**
* Registers and enqueues admin-specific styles.
*/
public function register_admin_styles()
{
wp_enqueue_style(
$this->get_widget_slug() . '-admin-styles',
plugins_url('css/admin.css', __FILE__)
);
}
/**
* Registers and enqueues admin-specific JavaScript.
*/
public function register_admin_scripts()
{
wp_enqueue_script(
$this->get_widget_slug() . '-admin-script',
plugins_url('js/admin.js', __FILE__),
array('jquery')
);
}
/**
* Registers and enqueues widget-specific styles.
*/
public function register_widget_styles()
{
wp_enqueue_style(
$this->get_widget_slug() . '-widget-styles',
plugins_url('css/widget.css', __FILE__)
);
}
/**
* Registers and enqueues widget-specific scripts.
*/
public function register_widget_scripts()
{
wp_enqueue_script(
$this->get_widget_slug() . '-script',
plugins_url('js/widget.js', __FILE__),
array('jquery')
);
}
}
add_action('widgets_init', create_function('', 'register_widget("AsoribaPayments");'));
// var_dump(array_value_recursive('carrot', $arr)); // array(2) { [0]=> string(6) "carrot" [1]=> string(7) "carrot2" }
// var_dump(array_value_recursive('apple', $arr)); // null
// var_dump(array_value_recursive('baz', $arr)); // string(3) "baz"
// var_dump(array_value_recursive('candy', $arr)); // string(5) "candy"
// var_dump(array_value_recursive('pear', $arr)); // null