init_lang();
$this->load_options();
add_action('save_post', array($this, 'save_postdata'));
add_action('do_meta_boxes', array($this, 'add_custom_box'), 15, 2);
add_action('admin_menu', array($this, 'modify_menu'));
}
public static function activate() {
parent::activate();
}
public static function deactivate() {
parent::deactivate();
}
public static function uninstall() {
parent::uninstall();
}
function save_postdata($post_id) {
if (!wp_verify_nonce($_REQUEST['wp_noextrenallinks_noncename'], plugin_basename(__FILE__))) {
return $post_id;
}
if ('page' == $_REQUEST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} else {
if (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
}
update_post_meta($post_id, 'wp_noextrenallinks_mask_links', $_REQUEST['wp_noextrenallinks_mask_links']);
}
function add_custom_box($page, $context) {
add_meta_box('wp_noextrenallinks_sectionid1', __('Link masking for this post', 'affiliate-tools'),
array($this, 'inner_custom_box1'),
'post', 'advanced');
add_meta_box('wp_noextrenallinks_sectionid1', __('Link masking for this post', 'affiliate-tools'),
array($this, 'inner_custom_box1'),
'page', 'advanced');
}
function inner_custom_box1() {
global $post;
echo '';
$mask = get_post_meta($post->ID, 'wp_noextrenallinks_mask_links', true);
if ($mask === '')
$mask = 0;
echo '' . __('Use default policy from plugin settings', 'affiliate-tools') . '
' . __('Don`t mask links', 'affiliate-tools');
}
function update() {
if ( isset($_REQUEST['options']) ) {
if (
! isset( $_POST['aff_tools_nonce_field'] )
|| ! wp_verify_nonce( $_POST['aff_tools_nonce_field'], 'submit_aff_tools_options' )
) {
wp_die( '