';
foreach ((array) $wp_settings_fields[$page][$section] as $field) {
$sanitizedID = str_replace('[', '', $field['id'] );
$sanitizedID = str_replace(']', '', $sanitizedID );
if ( strpos($field['callback'],'header') !== false && !adsensei_is_excluded(array('help') ) ) {
echo '
' . $field['title'] .'';
}
}
echo '';
}
/**
* Check if current page is excluded
*
* @param array $pages
* @return boolean
*/
function adsensei_is_excluded($pages){
if (isset($_GET['tab'])){
$currentpage = $_GET['tab'];
if (isset($currentpage) && in_array($currentpage, $pages))
return true;
}
}
function adsensei_do_settings_fields($page, $section) {
global $wp_settings_fields;
$header = false;
$firstHeader = false;
if (!isset($wp_settings_fields[$page][$section]))
return;
// Check first if any callback header registered
foreach ((array) $wp_settings_fields[$page][$section] as $field) {
strpos($field['callback'],'header') !== false ? $header = true : $header = false;
if ($header === true)
break;
}
foreach ((array) $wp_settings_fields[$page][$section] as $field) {
$sanitizedID = str_replace('[', '', $field['id'] );
$sanitizedID = str_replace(']', '', $sanitizedID );
// Check if header has been created previously
if (strpos($field['callback'],'header') !== false && $firstHeader === false) {
echo '';
echo '
';
if ($header === true){
echo '
';
}
}
/**
* If title is one of these entries do not show it
*/
function adsensei_is_excluded_title($string){
$haystack = array('ad1','ad2','ad3','ad4','ad5','ad6','ad7','ad8','ad9','ad10',
'ad1_widget',
'ad2_widget',
'ad3_widget',
'ad4_widget',
'ad5_widget',
'ad6_widget',
'ad7_widget',
'ad8_widget',
'ad9_widget',
'ad10_widget',
'vi_header',
'vi_signup'
);
if (in_array($string, $haystack)){
return true;
}
return false;
}
/**
* Options Page New
*
* Renders the options page contents.
*
* @since 2.0
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_options_page_new() {
global $adsensei_options;
wp_enqueue_style('adsensei-admin-ad-style', ADSENSEI_PLUGIN_URL.'admin/assets/js/dist/style.css');
wp_enqueue_style('adsensei-material-ui-font', 'https://fonts.googleapis.com/icon?family=Material+Icons');
$get_ip = get_option('add_blocked_ip') ? get_option('add_blocked_ip') : 0 ;
$get_e_p_p_p = '20';
if(is_user_logged_in()){
$current_user = get_current_user_id();
}
if( is_user_logged_in() && $current_user){
$user_info = get_user_meta($current_user);
if( isset($user_info['edit_post_per_page']) ){
$get_specific_user_meta = $user_info['edit_post_per_page'];
// get edit_post_per_page
$get_e_p_p_p = implode("",$get_specific_user_meta);
}
else{
$get_specific_user_meta = '20' ;
}
}
$ajax_call = admin_url( 'admin-ajax.php' );
$get_admin_url = admin_url('admin.php');
$get_activated_data = is_plugin_active('sitepress-multilingual-cms/sitepress.php') ? is_plugin_active('sitepress-multilingual-cms/sitepress.php') : 0 ;
$data = array(
'adsensei_plugin_url' => ADSENSEI_PLUGIN_URL,
'rest_url' => esc_url_raw( rest_url() ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'is_amp_enable' => function_exists('is_amp_endpoint') ? true : false,
'is_bbpress_exist' => class_exists( 'bbPress' )? true : false,
'is_newsPapertheme_exist' => class_exists( 'tagdiv_config' )? true : false,
'adsensei_get_ips' => $get_ip,
'ajax_url' => $ajax_call,
'num_of_ads_to_display' => $get_e_p_p_p,
'get_admin_url' => $get_admin_url,
'wpml_activation' => $get_activated_data
);
$data = apply_filters('adsensei_localize_filter',$data,'adsensei_localize_data');
wp_register_script( 'adsensei-admin-ad-script', ADSENSEI_PLUGIN_URL . 'admin/assets/js/dist/adminscript.js', array( 'wp-i18n' ), ADSENSEI_VERSION );
wp_localize_script( 'adsensei-admin-ad-script', 'adsensei_localize_data', $data );
wp_enqueue_script('adsensei-admin-ad-script');
echo '';
echo ''.adsensei_get_debug_messages().'
';
}
/**
* Options Page
*
* Renders the options page contents.
*
* @since 1.0
* @return void
*/
function adsensei_version_switch(){
$adsensei_mode = get_option('adsensei-mode');
if($adsensei_mode == 'new'){
update_option('adsensei-mode','old');
}else{
update_option('adsensei-mode','new');
}
echo '';
}
/**
* Options Page
*
* Renders the options page contents.
*
* @since 1.0
* @global $adsensei_options Array of all the ADSENSEI Options
* @return void
*/
function adsensei_options_page() {
global $adsensei_options;
$active_tab = isset( $_GET[ 'tab' ] ) && array_key_exists( $_GET['tab'], adsensei_get_settings_tabs() ) ? $_GET[ 'tab' ] : 'general';
ob_start();
?>
$tab_name ) {
$tab_url = esc_url(add_query_arg( array(
'settings-updated' => false,
'tab' => $tab_id
) ));
$active = $active_tab == $tab_id ? ' adsensei-nav-tab-active' : '';
echo '';
echo esc_html( $tab_name );
echo '';
}
?>
WPAdsensei 2.0 has the better User interface
We have improved the WPAdsensei and made it better than ever! Step into the future with one-click!
';
var_dump($adsensei_options);
echo '';
}
}
/**
* Render social buttons
*
* @return void
*/
function adsensei_render_social(){
ob_start()?>