$settings ) {
add_settings_section(
'adsensei_settings_' . $tab, __return_null(), '__return_false', 'adsensei_settings_' . $tab
);
foreach ( $settings as $option ) {
$name = isset( $option['name'] ) ? $option['name'] : '';
if($tab=='help' && $option['id'] == 'wpadsensei_support'){
add_settings_field(
'adsensei_settings[' . $option['id'] . ']', $name, 'wpadsensei_support_page_callback', 'adsensei_settings_' . $tab, 'adsensei_settings_' . $tab
);
}else{
add_settings_field(
'adsensei_settings[' . $option['id'] . ']', $name, function_exists( 'adsensei_' . $option['type'] . '_callback' ) ? 'adsensei_' . $option['type'] . '_callback' : 'adsensei_missing_callback', 'adsensei_settings_' . $tab, 'adsensei_settings_' . $tab, array(
'id' => isset( $option['id'] ) ? $option['id'] : null,
'desc' => !empty( $option['desc'] ) ? $option['desc'] : '',
'desc2' => !empty( $option['desc2'] ) ? $option['desc2'] : '',
'helper-desc' => !empty( $option['helper-desc'] ) ? $option['helper-desc'] : '',
'name' => isset( $option['name'] ) ? $option['name'] : null,
'section' => $tab,
'size' => isset( $option['size'] ) ? $option['size'] : null,
'options' => isset( $option['options'] ) ? $option['options'] : '',
'std' => isset( $option['std'] ) ? $option['std'] : '',
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
'textarea_rows' => isset( $option['textarea_rows'] ) ? $option['textarea_rows'] : ''
)
);
}
}
}
// Store adsense values
adsensei_store_adsense_args();
// Store AdSense value
//adsensei_fix_ad_not_shown();
// Creates our settings in the options table
register_setting( 'adsensei_settings', 'adsensei_settings', 'adsensei_settings_sanitize' );
}
add_action( 'admin_init', 'adsensei_register_settings' );
/**
* Retrieve the array of plugin settings
*
* @since 1.8
* @return array
*/
function adsensei_get_registered_settings() {
/**
* 'Whitelisted' ADSENSEI settings, filters are provided for each settings
* section to allow extensions and other plugins to add their own settings
*/
global $adsensei, $adsensei_options;
$vi_ads = array(
'id' => 'vi_header',
'name' => '' . __( 'vi ads', 'adsenseib30' ) . '',
'desc' => 'Native video ad units powered by video intelligence',
'type' => 'header'
);
$vi_ads_not_loggedin = array(
'id' => '',
'type' => ''
);
$vi_ads_final = ( false === $adsensei->vi->setRevenue() ) ? $vi_ads_not_loggedin : $vi_ads;
$adsensei_settings = array(
/** General Settings */
'general' => apply_filters( 'adsensei_settings_general', array(
array(
'id' => 'general_header',
'name' => '' . __( 'General & Position', 'adsenseib30' ) . '',
'desc' => __( '', 'adsenseib30' ),
'type' => 'header'
),
'maxads' => array(
'id' => 'maxads',
'name' => __( 'Limit Amount of ads:', 'adsenseib30' ),
'desc' => __( ' ads on a page.', 'adsenseib30' ),
'desc2' => sprintf( __( 'Read here to learn how many AdSense ads are allowed. If you are unsure set the value to unlimited.', 'adsenseib30' ), 'http://wpadsensei.com/google-adsense-allowed-number-ads/' ),
'type' => 'select',
'std' => 100,
'options' => array(
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8',
9 => '9',
10 => '10',
11 => '11',
12 => '12',
13 => '13',
14 => '14',
15 => '15',
16 => '16',
17 => '17',
18 => '18',
19 => '19',
20 => '20',
100 => 'Unlimited',
),
),
array(
'id' => 'ad_position',
'name' => __( 'Position - Default Ads', 'adsenseib30' ),
'desc' => __( 'Assign and activate ads on specific ad places', 'adsenseib30' ),
'type' => 'ad_position'
),
array(
'id' => 'visibility',
'name' => __( 'Visibility', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'visibility'
),
array(
"id" => "post_types",
"name" => __( "Post Types", "adsenseib30" ),
"desc" => __( "Select post types where ads are visible.", "adsenseib30" ),
"helper-desc" => __( "Select post types where ads are visible.", "adsenseib30" ),
"type" => "multiselect",
"options" => adsensei_get_post_types(),
"placeholder" => __( "Select Post Type", "adsenseib30" )
),
array(
'id' => 'hide_ajax',
'name' => __( 'Hide Ads From Ajax Requests', 'adsenseib30' ),
'desc' => __( 'If your site is using ajax based infinite loading it might happen that ads are loaded without any further post content. Disable this here.', 'adsenseib30' ),
'type' => 'checkbox'
),
array(
'id' => 'quicktags',
'name' => __( 'Quicktags', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'quicktags'
),
array(
'id' => 'adsTxtEnabled',
'name' => __( 'ads.txt - Automatic Creation', 'adsenseib30' ),
'desc' => __( 'Create an ads.txt file', 'adsenseib30' ),
"helper-desc" => sprintf(__( 'Allow WP ADSENSEI to generate automatically the ads.txt file in root of your website domain. After enabling and saving settings,'
. ' check if your ads.txt is correct by opening: %1$s Read here to learn more about ads.txt', 'adsenseib30' ),
get_site_url() . '/ads.txt',
'https://adsplugin.net/make-more-revenue-by-using-an-ads-txt-in-your-website-root-domain/'
),
'type' => 'checkbox'
),
array(
'id' => 'lazy_load_global',
'name' => __( 'Lazy Loading for Adsense', 'adsenseib30' ),
// 'desc' => __( 'Lazy Loading for Adsense', 'adsenseib30' ),
'type' => 'checkbox'
),
array(
'id' => 'quicktags',
'name' => __( 'Quicktags', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'quicktags'
),
$vi_ads_final,
array(
'id' => 'vi_signup',
'name' =>__( '', 'adsenseib30' ) . '',
'type' => 'vi_signup'
),
/* 'load_scripts_footer' => array(
'id' => 'load_scripts_footer',
'name' => __( 'JS Load Order', 'adsenseib30' ),
'desc' => __( 'Enable this to load all *.js files into footer. Make sure your theme uses the wp_footer() template tag in the appropriate place. Default: Disabled', 'adsenseib30' ),
'type' => 'checkbox'
), */
'adsense_header' => array(
'id' => 'adsense_header',
'name' => '' . __( 'Ads', 'adsenseib30' ) . '',
'desc' => '
' . __( 'Enter your ads below:
'
. '
'
. '
- AdSense for using AdSense Text & display Ads!
'
. '
- Plain Text / HTML / JS for all other ads! Caution: Adding AdSense code into Plain Text option can result in non-displayed ads!
', 'adsenseib30' )
. ''
. '
' . sprintf( __( 'Ads are not showing? Read the troubleshooting guide to find out how to resolve it.', 'adsenseib30' ), 'http://wpadsensei.com/docs/adsense-ads-are-not-showing/?utm_source=plugin&utm_campaign=wpadsensei-settings&utm_medium=website&utm_term=toplink' ) . ''
. ' Read this to find out the most effective AdSense banner sizes.
'
. '
' . __( 'Open All Ads', 'adsenseib30' ) . '
',
'type' => 'header'
),
array(
'id' => 'adsensei_ads',
'name' => __( '', 'adsenseib30' ),
'type' => 'ad_code'
),
array(
'id' => 'new_ad',
'name' => __( '', 'adsenseib30' ),
'type' => 'new_ad',
),
'widget_header' => array(
'id' => 'widget_header',
'name' => '' . __( 'Widget Ads', 'adsenseib30' ) . '',
'desc' => sprintf( __( 'After creating your ads here go to Appearance->Widgets and drag the WP ADSENSEI widget into place.', 'adsenseib30' ), admin_url() . 'widgets.php' ),
'type' => 'header'
),
'ad1_widget' => array(
'id' => 'ad1_widget',
'name' => __( 'Ad widget 1', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad2_widget' => array(
'id' => 'ad2_widget',
'name' => __( 'Ad widget 2', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad3_widget' => array(
'id' => 'ad3_widget',
'name' => __( 'Ad widget 3', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad4_widget' => array(
'id' => 'ad4_widget',
'name' => __( 'Ad widget 4', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad5_widget' => array(
'id' => 'ad5_widget',
'name' => __( 'Ad widget 5', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad6_widget' => array(
'id' => 'ad6_widget',
'name' => __( 'Ad widget 6', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad7_widget' => array(
'id' => 'ad7_widget',
'name' => __( 'Ad widget 7', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad8_widget' => array(
'id' => 'ad8_widget',
'name' => __( 'Ad widget 8', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad9_widget' => array(
'id' => 'ad9_widget',
'name' => __( 'Ad widget 9', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
'ad10_widget' => array(
'id' => 'ad10_widget',
'name' => __( 'Ad widget 10', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'adsense_widget',
'size' => 4
),
array(
'id' => 'plugin_header',
'name' => '' . __( 'Plugin Settings', 'adsenseib30' ) . '',
'desc' => __( '', 'adsenseib30' ),
'type' => 'header'
),
'priority' => array(
'id' => 'priority',
'name' => __( 'Load Priority', 'adsenseib30' ),
//'desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. Default: 20', 'adsenseib30' ),
'helper-desc' => __( 'Do not change this until you know what you are doing. Usually the default value 20 is working fine. Changing this value can lead to unexpected results like ads not showing or loaded on wrong order. Default: 20', 'adsenseib30' ),
'type' => 'number',
'size' => 'small',
'std' => 10
),
'create_settings' => array(
'id' => 'create_settings',
'name' => __( 'Remove menu button', 'adsenseib30' ),
//'desc' => __( 'Make the WPADSENSEI settings available from Settings->WPADSENSEI. This will remove the primary menu button from the admin sidebar', 'adsenseib30' ),
'desc' => __( 'Remove it' ),
'helper-desc' => __( 'Make the WPADSENSEI settings available from Settings->WPADSENSEI. This will remove the primary menu button from the admin sidebar', 'adsenseib30' ),
'type' => 'checkbox',
),
'disableAmpScript' => array(
'id' => 'disableAmpScript',
'name' => __( 'Disable AMP script', 'adsenseib30' ),
//'desc' => __( 'Make the WPADSENSEI settings available from Settings->WPADSENSEI. This will remove the primary menu button from the admin sidebar', 'adsenseib30' ),
'desc' => __( 'Disable AMP Scripts' ),
'helper-desc' => __( 'Disable duplicate AMP ad script integration if your AMP plugin is already loading the script https://cdn.ampproject.org/v0/amp-ad-0.1.js into your site', 'adsenseib30' ),
'type' => 'checkbox',
),
'uninstall_on_delete' => array(
'id' => 'uninstall_on_delete',
'name' => __( 'Delete Data on Uninstall?', 'adsenseib30' ),
//'desc' => __( 'Check this box if you would like Settings->WPADSENSEI to completely remove all of its data when the plugin is deleted.', 'adsenseib30' ),
'helper-desc' => __( 'Check this box if you would like Settings->WPADSENSEI to completely remove all of its data when the plugin is deleted.', 'adsenseib30' ),
'desc' => 'Delete data',
'type' => 'checkbox'
),
'hide_add_on_disableplugin' => array(
'id' => 'hide_add_on_disableplugin',
'name' => __( 'Hide Shortcode after Deactivate', 'adsenseib30' ),
//'desc' => __( 'Check this box if you would like Settings->WPADSENSEI to completely remove all of its data when the plugin is deleted.', 'adsenseib30' ),
'helper-desc' => __( 'Check this box if you would like to Hide [adsensei] shortcode from the content after deactivating the plugin.', 'adsenseib30' ),
'desc' => 'Hides [adsensei] shortcode from the content',
'type' => 'checkbox'
),
'debug_mode' => array(
'id' => 'debug_mode',
'name' => __( 'Debug mode', 'adsenseib30' ),
'desc' => __( 'Check this to not minify JavaScript and CSS files. This makes debugging much easier and is recommended setting for inspecting issues on your site', 'adsenseib30' ),
'type' => 'checkbox'
)
)
),
'extensions' => apply_filters( 'adsensei_settings_extension', array()
),
'addons' => apply_filters( 'adsensei_settings_addons', array(
'addons' => array(
'id' => 'addons',
'name' => __( '', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'addons'
),
)
),
'imexport' => apply_filters( 'adsensei_settings_imexport', array(
'imexport' => array(
'id' => 'imexport',
'name' => __( '', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'imexport'
)
)
),
'help' => apply_filters( 'adsensei_settings_help', array(
'support' => array(
'id' => 'wpadsensei_support',
'name' => __( 'Get help from our development team', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'header'
),
'systeminfo' => array(
'id' => 'systeminfo',
'name' => __( 'Systeminfo', 'adsenseib30' ),
'desc' => __( '', 'adsenseib30' ),
'type' => 'systeminfo'
)
)
)
);
return $adsensei_settings;
}
function adsensei_get_active_ads_data() {
global $adsensei_options;
// Return early
if (empty($adsensei_options['ads'])){
return 0;
}
// count valid ads
$i = 1;
foreach ( $adsensei_options['ads'] as $ads) {
$tmp = isset( $adsensei_options['ads']['ad' . $i]['code'] ) ? trim( $adsensei_options['ads']['ad' . $i]['code'] ) : '';
// id is valid if there is either the plain text field populated or the adsense ad slot and the ad client id
if( !empty( $tmp ) || (!empty( $adsensei_options['ads']['ad' . $i]['g_data_ad_slot'] ) && !empty( $adsensei_options['ads']['ad' . $i]['g_data_ad_client'] ) ) ) {
$adsArray[] = 'ad'.$i;
}
$i++;
}
return (isset($adsArray) && count($adsArray) > 0) ? $adsArray : 0;
}
add_action('wp_ajax_wpadsensei_ads_for_shortcode_data', 'wpadsensei_ads_for_shortcode_data');
function wpadsensei_ads_for_shortcode_data(){
$html = adsensei_get_active_ads_data();
echo json_encode($html);
wp_die();
}
add_action('wp_ajax_wpadsensei_ads_for_shortcode', 'wpadsensei_ads_for_shortcode');
function wpadsensei_ads_for_shortcode(){
if ( ! isset( $_POST['wpadsensei_security_nonce'] ) ){
return;
}
if ( !wp_verify_nonce( $_POST['wpadsensei_security_nonce'], 'adsensei_ajax_nonce' ) ){
return;
}
global $adsensei_options;
$html ='';
echo $html;
wp_die();
}
add_action('wp_ajax_wpadsensei_send_query_message', 'wpadsensei_send_query_message');
function wpadsensei_send_query_message(){
if ( ! isset( $_POST['wpadsensei_security_nonce'] ) ){
return;
}
if ( !wp_verify_nonce( $_POST['wpadsensei_security_nonce'], 'adsensei_ajax_nonce' ) ){
return;
}
$customer_type = 'Are you a premium customer ? No';
$message = sanitize_textarea_field($_POST['message']);
$email = sanitize_textarea_field($_POST['email']);
$premium_cus = sanitize_textarea_field($_POST['premium_cus']);
$user = wp_get_current_user();
if($premium_cus == 'yes'){
$customer_type = 'Are you a premium customer ? Yes';
}
$message = '
'.$message.'
'. $customer_type. '
query from WPAdsensei support tab User Website URL: '.site_url();
if($user){
$user_data = $user->data;
$user_email = $user_data->user_email;
if($email){
$user_email = $email;
}
//php mailer variables
$sendto = 'team@ampforwp.com';
$subject = "WPAdsensei Support ticket";
$headers[] = 'Content-Type: text/html; charset=UTF-8';
$headers[] = 'From: '. esc_attr($user_email);
$headers[] = 'Reply-To: ' . esc_attr($user_email);
// Load WP components, no themes.
$sent = wp_mail($sendto, $subject, $message, $headers);
if($sent){
echo json_encode(array('status'=>'t'));
}else{
echo json_encode(array('status'=>'f'));
}
}
wp_die();
}
/**
* return empty settings
* @return string empty one
*/
function adsensei_empty_callback() {
return '';
}
/**
* Settings Sanitization
*
* Adds a settings error (for the updated message)
* At some point this will validate input
*
* @since 0.9.0
*
* @param array $input The value input in the field
*
* @return string $input Sanitized value
*/
function adsensei_settings_sanitize( $input = array() ) {
global $adsensei_options;
if( empty( $_POST['_wp_http_referer'] ) ) {
return $input;
}
parse_str( $_POST['_wp_http_referer'], $referrer );
$settings = adsensei_get_registered_settings();
$tab = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
$input = $input ? $input : array();
$input = apply_filters( 'adsensei_settings_' . $tab . '_sanitize', $input );
// Loop through each setting being saved and pass it through a sanitization filter
foreach ( $input as $key => $value ) {
// Get the setting type (checkbox, select, etc)
$type = isset( $settings[$tab][$key]['type'] ) ? $settings[$tab][$key]['type'] : false;
if( $type ) {
// Field type specific filter
$input[$key] = apply_filters( 'adsensei_settings_sanitize_' . $type, $value, $key );
}
// General filter
$input[$key] = apply_filters( 'adsensei_settings_sanitize', $value, $key );
}
//wp_die(var_dump($input));
// Loop through the whitelist and unset any that are empty for the tab being saved
if( !empty( $settings[$tab] ) ) {
foreach ( $settings[$tab] as $key => $value ) {
// settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
if( is_numeric( $key ) ) {
$key = $value['id'];
}
if( empty( $input[$key] ) ) {
unset( $adsensei_options[$key] );
}
}
}
// Merge our new settings with the existing
$output = array_merge( $adsensei_options, $input );
add_settings_error( 'adsensei-notices', '', __( 'Settings updated.', 'adsenseib30' ), 'updated' );
return $output;
}
/**
* Sanitize all fields and remove whitespaces
*
* @since 1.5.3
* @param array $input The field value
* @return string $input Sanitizied value
*/
function adsensei_sanitize_general_field( $input ){
if (!is_array( $input )){
return trim($input);
}
return array_map('adsensei_sanitize_general_field', $input);
}
add_filter( 'adsensei_settings_sanitize', 'adsensei_sanitize_general_field' );
/**
* Sanitize text fields
*
* @since 1.8
* @param array $input The field value
* @return string $input Sanitizied value
*/
function adsensei_sanitize_text_field( $input ) {
return trim( $input );
}
add_filter( 'adsensei_settings_sanitize_text', 'adsensei_sanitize_text_field' );
/**
* Retrieve settings tabs
*
* @since 1.8
* @param array $input The field value
* @return string $input Sanitizied value
*/
function adsensei_get_settings_tabs() {
$settings = adsensei_get_registered_settings();
$tabs = array();
$tabs['general'] = __( 'General', 'adsenseib30' );
if( !empty( $settings['visual'] ) ) {
$tabs['visual'] = __( 'Visual', 'adsenseib30' );
}
if( !empty( $settings['extensions'] ) ) {
$tabs['extensions'] = __( 'Add-On Setting', 'adsenseib30' );
}
$tabs['imexport'] = __( 'Import/Export', 'adsenseib30' );
$tabs['help'] = __( 'Help', 'adsenseib30' );
return apply_filters( 'adsensei_settings_tabs', $tabs );
}
/**
* Header Callback
*
* Renders the header.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @return void
*/
function adsensei_header_callback( $args ) {
if( !empty( $args['desc'] ) ) {
echo $args['desc'];
} else {
echo ' ';
}
}
/**
* Checkbox Callback
*
* Renders checkboxes.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_checkbox_callback( $args ) {
global $adsensei_options;
$checked = isset( $adsensei_options[$args['id']] ) ? checked( 1, $adsensei_options[$args['id']], false ) : '';
$html = '';
$html .= '';
echo $html;
}
/**
* Checkbox Callback
*
* Renders checkboxes.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_checkbox_adsense_callback( $args ) {
global $adsensei_options;
$checked = isset( $adsensei_options[$args['id']] ) ? checked( 1, $adsensei_options[$args['id']], false ) : '';
$html = '';
$html .= '';
return $html;
}
/**
* Multicheck Callback
*
* Renders multiple checkboxes.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_multicheck_callback( $args ) {
global $adsensei_options;
if( !empty( $args['options'] ) ) {
foreach ( $args['options'] as $key => $option ):
if( isset( $adsensei_options[$args['id']][$key] ) ) {
$enabled = $option;
} else {
$enabled = NULL;
}
echo ' ';
echo ' ';
endforeach;
echo '
' . $args['desc'] . '
';
}
}
/**
* Radio Callback
*
* Renders radio boxes.
*
* @since 1.3.3
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_radio_callback( $args ) {
global $adsensei_options;
foreach ( $args['options'] as $key => $option ) :
$checked = false;
if( isset( $adsensei_options[$args['id']] ) && $adsensei_options[$args['id']] == $key )
$checked = true;
elseif( isset( $args['std'] ) && $args['std'] == $key && !isset( $adsensei_options[$args['id']] ) )
$checked = true;
echo ' ';
echo ' ';
endforeach;
echo '
' . $args['desc'] . '
';
}
/**
* Radio Callback for ad types
*
* Renders radio boxes for specific ads
*
* @since 1.2.7
* @param1 array $args Arguments passed by the setting
* @param2 id int ID of the ad
*
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_adtype_callback( $id, $args ) {
global $adsensei_options;
foreach ( $args['options'] as $key => $option ) :
$checked = false;
if( isset( $adsensei_options['ads'][$id]['ad_type'] ) && $adsensei_options['ads'][$id]['ad_type'] == $key )
$checked = true;
elseif( isset( $args['std'] ) && $args['std'] == $key && !isset( $adsensei_options['ads'][$id]['ad_type'] ) )
$checked = true;
echo ' ';
echo ' ';
endforeach;
echo '
' . $args['desc'] . '
';
}
/**
* Radio Callback for ad positions
*
* Renders radio boxes for left center right alignment
*
* @since 1.2.7
* @param1 array $args Arguments passed by the setting
* @param2 id int ID of the ad
*
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_adposition_callback( $id, $args ) {
global $adsensei_options;
foreach ( $args['options'] as $key => $option ) :
$checked = false;
if( isset( $adsensei_options['ads'][$id]['align'] ) && $adsensei_options['ads'][$id]['align'] == $key )
$checked = true;
elseif( isset( $args['std'] ) && $args['std'] == $key && !isset( $adsensei_options['ads'][$id]['align'] ) )
$checked = true;
if( $key == '3' ) {
echo ' ';
echo ' ';
} else {
echo ' ';
echo ' ';
}
endforeach;
}
/**
* Text Callback
*
* Renders text fields.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_text_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
echo $html;
}
/**
* Number Callback
*
* Renders number fields.
*
* @since 1.9
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_number_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$max = isset( $args['max'] ) ? $args['max'] : 999999;
$min = isset( $args['min'] ) ? $args['min'] : 0;
$step = isset( $args['step'] ) ? $args['step'] : 1;
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
echo $html;
}
/**
* Textarea Callback
*
* Renders textarea fields.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_textarea_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : '40';
$html = '';
$html .= '';
echo $html;
}
/**
* Password Callback
*
* Renders password fields.
*
* @since 1.3
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_password_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
echo $html;
}
/**
* Missing Callback
*
* If a function is missing for settings callbacks alert the user.
*
* @since 1.3.1
* @param array $args Arguments passed by the setting
* @return void
*/
function adsensei_missing_callback( $args ) {
echo '
';
printf( __( 'The callback function used for the %s setting is missing.', 'adsenseib30' ), $args['id'] );
echo '
';
}
/**
* Select Callback
*
* Renders select fields.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_select_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$html = '';
$html .= '';
$html .= ' ' . $args['desc2'];
echo $html;
}
/**
* AdSense Type Select Callback
*
* Renders Adsense adsense type fields.
*
* @since 1.0
* @param1 array $args Arguments passed by the setting
* @param2 int $id if od the ad
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_adense_select_callback( $id, $args ) {
global $adsensei_options;
if( isset( $adsensei_options['ads'][$id][$args['id']] ) )
$value = $adsensei_options['ads'][$id][$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = !empty( $args['size'] ) ? $args['size'] : 'adsensei-medium-size';
$htmlNew = '';
$htmlNew .= '';
echo $htmlNew;
}
/**
* Color select Callback
*
* Renders color select fields.
*
* @since 2.1.2
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_color_select_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$html = '#:';
$html .= '';
$html .= '';
echo $html;
}
/**
* Rich Editor Callback
*
* Renders rich editor fields.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @global $wp_version WordPress Version
*/
function adsensei_rich_editor_callback( $args ) {
global $adsensei_options, $wp_version;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
if( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
ob_start();
wp_editor( stripslashes( $value ), 'adsensei_settings_' . $args['id'], array('textarea_name' => 'adsensei_settings[' . $args['id'] . ']', 'textarea_rows' => $args['textarea_rows']) );
$html = ob_get_clean();
} else {
$html = '';
}
$html .= ' ';
echo $html;
}
/**
* Upload Callback
*
* Renders upload fields.
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_upload_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
$html .= '';
echo $html;
}
/**
* Color picker Callback
*
* Renders color picker fields.
*
* @since 1.6
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_color_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$default = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
echo $html;
}
/**
* Registers the Add-Ons field callback for WPADSENSEI Add-Ons
*
* @since 2.0.5
* @param array $args Arguments passed by the setting
* @return html
*/
function adsensei_addons_callback( $args ) {
$html = adsensei_add_ons_page();
echo $html;
}
/**
* Registers the im/export callback for WPADSENSEI
*
* @since 0.9.0
* @param array $args Arguments passed by the setting
* @return html
*/
function adsensei_imexport_callback( $args ) {
$html = adsensei_tools_import_export_display();
$html .= adsensei_import_quick_adsense_settings();
echo $html;
}
/**
* Registers the system info for WPADSENSEI
*
* @since 0.9.0
* @param array $args Arguments passed by the setting
* @return html
*/
function adsensei_systeminfo_callback( $args ) {
$html = adsensei_tools_sysinfo_display();
echo $html;
}
/**
* Registers the image upload field
*
* @since 1.0
* @param array $args Arguments passed by the setting
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_upload_image_callback( $args ) {
global $adsensei_options;
if( isset( $adsensei_options[$args['id']] ) )
$value = $adsensei_options[$args['id']];
else
$value = isset( $args['std'] ) ? $args['std'] : '';
$size = ( isset( $args['size'] ) && !is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$html = '';
$html .= '';
$html .= '';
echo $html;
}
/*
* Note Callback
*
* Show a note
*
* @since 2.2.8
* @param array $args Arguments passed by the setting
* @return void
*
*/
function adsensei_note_callback( $args ) {
global $adsensei_options;
$html = '';
echo $html;
}
/**
* Additional content Callback
* Adds several content text boxes selectable via jQuery easytabs()
*
* @param array $args
* @return string $html
* @scince 2.3.2
*/
function adsensei_add_content_callback( $args ) {
global $adsensei_options;
$html = '