' . $elapp_plugin . ' ' . __('requires WordPress 3.7 or higher, and has been deactivated!', 'elapp') . '
';
$msg .= __('Please return to the ', 'elapp') . '' . __('WordPress Admin area', 'elapp') . ' ' . __('to upgrade WordPress and try again.', 'elapp');
wp_die($msg);
}
}
}
if (isset($_GET['activate']) && $_GET['activate'] == 'true') {
add_action('admin_init', 'elapp_require_wp_version');
}
// Assist24.it Room code (elapp.js)
//
function assist24_room_code() {
$options = get_option('elapp_options');
$elapp_enable = $options['elapp_enable'];
$elapp_id = $options['elapp_id'];
$elapp_custom = $options['elapp_custom'];
if ($elapp_enable) {
?>
' . __('Settings', 'elapp') .'';
array_unshift($links, $elapp_links);
}
return $links;
}
// rate plugin link
function add_elapp_links($links, $file) {
if ($file == plugin_basename(__FILE__)) {
$rate_url = 'http://wordpress.org/support/view/plugin-reviews/' . basename(dirname(__FILE__)) . '?rate=5#postform';
$links[] = 'Rate this plugin';
}
return $links;
}
add_filter('plugin_row_meta', 'add_elapp_links', 10, 2);
// delete plugin settings
function elapp_delete_plugin_options() {
delete_option('elapp_options');
}
if ($elapp_options['default_options'] == 1) {
register_uninstall_hook (__FILE__, 'elapp_delete_plugin_options');
}
// define default settings
register_activation_hook (__FILE__, 'elapp_add_defaults');
function elapp_add_defaults() {
$tmp = get_option('elapp_options');
if(($tmp['default_options'] == '1') || (!is_array($tmp))) {
$arr = array(
'default_options' => 0,
'elapp_id' => 'RMO-NNNN-ABCDEFGHIJKLMNOP',
'elapp_enable' => 0,
'elapp_location' => 'footer',
'elapp_custom' => '',
);
update_option('elapp_options', $arr);
}
}
// whitelist settings
add_action ('admin_init', 'elapp_init');
function elapp_init() {
register_setting('elapp_plugin_options', 'elapp_options', 'elapp_validate_options');
}
// sanitize and validate input
function elapp_validate_options($input) {
global $elapp_location;
if (!isset($input['default_options'])) $input['default_options'] = null;
$input['default_options'] = ($input['default_options'] == 1 ? 1 : 0);
if (!isset($input['elapp_enable'])) $input['elapp_enable'] = null;
$input['elapp_enable'] = ($input['elapp_enable'] == 1 ? 1 : 0);
$input['elapp_id'] = wp_filter_nohtml_kses($input['elapp_id']);
if (!isset($input['elapp_location'])) $input['elapp_location'] = null;
if (!array_key_exists($input['elapp_location'], $elapp_location)) $input['elapp_location'] = null;
// dealing with kses
global $allowedposttags;
$allowed_atts = array(
'align'=>array(), 'class'=>array(), 'id'=>array(), 'dir'=>array(), 'lang'=>array(), 'style'=>array(), 'label'=>array(), 'url'=>array(),
'xml:lang'=>array(), 'src'=>array(), 'alt'=>array(), 'name'=>array(), 'content'=>array(), 'http-equiv'=>array(), 'profile'=>array(),
'href'=>array(), 'property'=>array(), 'title'=>array(), 'rel'=>array(), 'type'=>array(), 'charset'=>array(), 'media'=>array(), 'rev'=>array(),
);
$allowedposttags['strong'] = $allowed_atts;
$allowedposttags['script'] = $allowed_atts;
$allowedposttags['style'] = $allowed_atts;
$allowedposttags['small'] = $allowed_atts;
$allowedposttags['span'] = $allowed_atts;
$allowedposttags['meta'] = $allowed_atts;
$allowedposttags['item'] = $allowed_atts;
$allowedposttags['base'] = $allowed_atts;
$allowedposttags['link'] = $allowed_atts;
$allowedposttags['abbr'] = $allowed_atts;
$allowedposttags['code'] = $allowed_atts;
$allowedposttags['div'] = $allowed_atts;
$allowedposttags['img'] = $allowed_atts;
$allowedposttags['h1'] = $allowed_atts;
$allowedposttags['h2'] = $allowed_atts;
$allowedposttags['h3'] = $allowed_atts;
$allowedposttags['h4'] = $allowed_atts;
$allowedposttags['h5'] = $allowed_atts;
$allowedposttags['ol'] = $allowed_atts;
$allowedposttags['ul'] = $allowed_atts;
$allowedposttags['li'] = $allowed_atts;
$allowedposttags['em'] = $allowed_atts;
$allowedposttags['p'] = $allowed_atts;
$allowedposttags['a'] = $allowed_atts;
$input['elapp_custom'] = wp_kses($input['elapp_custom'], $allowedposttags);
return $input;
}
// define dropdown options
$elapp_location = array(
'header' => array(
'value' => 'header',
'label' => __('Include code in the document head (via wp_head)', 'elapp')
),
'footer' => array(
'value' => 'footer',
'label' => __('Include code in the document footer (via wp_footer)', 'elapp')
),
);
// add the options page
add_action ('admin_menu', 'elapp_add_options_page');
function elapp_add_options_page() {
global $elapp_plugin;
add_options_page($elapp_plugin, 'A24 Plugin', 'manage_options', __FILE__, 'elapp_render_form');
}
// create the options page
function elapp_render_form() {
global $elapp_plugin, $elapp_options, $elapp_path, $elapp_homeurl, $elapp_version, $elapp_location; ?>