$value){ if (isset($_POST[$key])){ $ops[$key] = $_POST[$key]; } } extract_text_args('ad_code_random_', $ops, 1, 5, ADINJ_AD_PATH.'/ad_random_'); extract_text_args('ad_code_top_', $ops, 1, 5, ADINJ_AD_PATH.'/ad_top_'); extract_text_args('ad_code_bottom_', $ops, 1, 5, ADINJ_AD_PATH.'/ad_bottom_'); extract_text_args('ad_code_random_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_random_alt_'); extract_text_args('ad_code_top_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_top_alt_'); extract_text_args('ad_code_bottom_alt_', $ops, 1, 2, ADINJ_AD_PATH.'/ad_bottom_alt_'); extract_text_args('ad_referrers', $ops); extract_text_args('blocked_ips', $ops); adinj_update_options($ops); if ($ops['ad_insertion_mode'] == 'mfunc') { adinj_write_config_file(); } break; case 'Reset to Default': adinj_checkNonce(); adinj_update_options(adinj_default_options()); break; case 'Delete settings from DB': adinj_checkNonce(); delete_option('adinj_options'); case 'Delete widget settings from DB': adinj_checkNonce(); delete_option('widget_adinj'); // TODO add option to delete ads files as well break; } } function extract_text_args($name, &$ops, $start=NULL, $end=NULL, $save_path_stem=NULL){ if ($start === NULL){ if (isset($_POST[$name])){ $ops[$name] = stripslashes($_POST[$name]); if ($save_path_stem != NULL){ write_ad_to_file($ops[$name], $save_path_stem.'1.txt'); } } } else { for ($i = $start; $i<=$end; ++$i){ if (isset($_POST[$name.$i])){ $ops[$name.$i] = stripslashes($_POST[$name.$i]); if ($save_path_stem != NULL){ write_ad_to_file($ops[$name.$i], $save_path_stem.$i.'.txt'); } } } } } // Test reminder: These generated functions won't exist until the first save // so be careful if adding any new ones - they might not exist yet, but could // still be referenced by adshow. function adinj_write_config_file(){ $ops = adinj_options(); if ($ops['ad_insertion_mode'] != 'mfunc') return; $sevisitors_only = adinj_ticked('sevisitors_only')?'true':'false'; $referrer_list = adinj_quote_list('ad_referrers'); $block_ips = adinj_ticked('block_ips')?'true':'false'; $ip_list = adinj_quote_list('blocked_ips'); // TODO $block_keywords = adinj_ticked('block_keywords')?'true':'false'; $keyword_list = adinj_quote_list('blocked_keywords'); $debug_mode = adinj_ticked('debug_mode')?'true':'false'; // TODO remove these from config file later... $rnd_func = adinj_add_tags(NULL, 'rnd_', 'adinj_config_add_tags_rnd'); $top_func = adinj_add_tags(NULL, 'top_', 'adinj_config_add_tags_top'); $bottom_func = adinj_add_tags(NULL, 'bottom_', 'adinj_config_add_tags_bottom'); $config = << CONFIG; adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640); } function adinj_write_file($path, $content, $permission){ $ops = adinj_options(); global $adinj_warning_msg_filewrite; $dir = dirname($path); if (!@file_exists($dir)){ if (!@mkdir($dir, 0750)){ @mkdir($dir, 0755) or $adinj_warning_msg_filewrite .= "
Warning: could not create dir: ".$dir.". Please create it manually and try again."; } } $handle = @fopen($path, "w"); if (strlen($content) > 0){ @fwrite($handle, $content) or $adinj_warning_msg_filewrite .= "
Warning: could not write to file: $path"; } @fclose($handle); if (@file_exists($path)){ adinj_chmod($path, $permission); } } function adinj_chmod($path, $permission){ global $adinj_warning_msg_chmod; $oldperm = substr(decoct(@fileperms($path)), -3); $newperm = decoct($permission); if ($newperm == $oldperm) return; @chmod($path, $permission) or $adinj_warning_msg_chmod .= "
Warning: chmod $permission " . "on $path failed. Current permissions: $oldperm
Try manually updating the permission if problems occur."; } function adinj_get_logo(){ return 'reviewmylife'; } function adinj_options_page(){ if (isset($_POST['adinj_action'])){ adinj_save_options(); } adinj_upgrade_db_if_necessary(); $ops = adinj_options(); echo '
'; if (adinj_problem_with_wpminify_check()){ echo '

'; echo adinj_get_problem_with_wpminify_message(); echo '

'; } echo '

Ad Injection ' . adinj_get_version() . adinj_get_logo() . '

'; adinj_top_message_box(); adinj_admin_tabs(); echo '
'; wp_nonce_field('_adinj_form'); echo '
'; switch( $_GET[ 'tab' ] ) { case "adrotation": require_once(ADINJ_PATH . '/ui-tab-adrotation.php'); adinj_side_info_box(); echo '
'; adinj_tab_adrotation(); break; case "main": default: require_once(ADINJ_PATH . '/ui-tab-main.php'); adinj_side_status_box(); adinj_side_info_box(); echo '
'; adinj_tab_main(); break; } echo ''; echo ' '; } function adinj_top_message_box(){ $ops = adinj_options(); if (isset($_POST['adinj_action'])) { echo '

'; echo 'All settings saved: '; if (is_plugin_active('wp-super-cache/wp-cache.php')) { echo "You might need to clear your WP Super Cache cache for the settings to take effect."; } else { echo "If you are using a caching plugin you might need to delete its cache for any changes to take effect."; } echo ''; if ($ops['ad_insertion_mode']=='mfunc'){ global $adinj_warning_msg_filewrite; if (!empty($adinj_warning_msg_filewrite)){ echo $adinj_warning_msg_filewrite; echo "
Workaround: If you are unable to fix these errors you will have to switch to a direct insertion mode (however dynamic features won't work if you are using a caching plugin)."; } } global $adinj_warning_msg_chmod; if (!empty($adinj_warning_msg_chmod)){ echo '
Info: Some warnings were generated by chmod. See the debugging section for more info.'; } if ($ops['ads_enabled'] != 'on'){ echo '
Warning: Ads are not enabled. You need to turn the ads on for everyone to see them.'; } echo '

'; } else { echo '

'; echo "21st January 2011: This is a big update introducing support for split testing / ad rotation. And also 'alternate content' as well as other fixes and updates. I've done my best to test this update but as the update is big there is a risk of problems. Please contact me ASAP if you spot any bugs, or odd behaviour via the ".'feedback form.'; echo '

'; } } function adinj_side_info_box(){ ?>

Info

More Ad Injection information

Coming in 2011

  • Per ad control over which categories and tags the ads are shown in.
  • Extra ad locations.

Important!

You are responsible for making sure the ad settings and positioning you define are in compliance with your ad provider's terms of service! Failure to do so could get you banned by them!

Beta version

This plugin has only only recently been released. I'm actively listening to your feedback and fixing any problems, and adding new features that you request. Please let me know if you like the plugin too!

More by this author

'; echo ''; } // From WP Super cache function adinj_admin_tabs( $current = 0 ) { global $wp_db_version; if ( $current == 0 ) { if ( isset( $_GET[ 'tab' ] ) ) { $current = $_GET[ 'tab' ]; } else { $current = 'main'; } } $tabs = array( 'main' => __( 'Main', 'ad-injection' ), 'adrotation' => __( 'Ad pool: (Rotation / A:B Testing / Alternate content)', 'ad-injection' ) ); $links = array(); foreach( $tabs as $tab => $name ) { if ( $current == $tab ) { $links[] = "$name"; } else { $links[] = "$name"; } } echo ''; } function adinj_postbox_start($title, $anchor, $width='650px'){ $ops = adinj_options(); ?>
' />

'; } function adinj_get_status($name){ $ops = adinj_options(); $status[] = 'black'; $status[] = 'Error...'; if ($name == 'global'){ if ($ops['exclude_home'] == 'on' && $ops['exclude_page'] == 'on' && $ops['exclude_single'] == 'on' && $ops['exclude_archive'] == 'on'){ $status[0] = 'red'; $status[1] = 'excluded from all'; return $status; } $val = $ops['ads_enabled']; if ($val == 'on'){ $status[0] = 'green'; $status[1] = $val; } else if ($val == 'off' || $val == ''){ $status[0] = 'red'; $status[1] = $val; } else if ($val == 'test'){ $status[0] = 'orange'; $status[1] = 'test mode'; } } else if ($name == 'random'){ $count = adinj_count_live_ads('ad_code_random_', $ops); if ($count == 0){ $status[0] = 'red'; $status[1] = 'no ads defined'; return $status; } $val = $ops['max_num_of_ads']; if ($val == '0'){ $status[0] = 'red'; } else { $status[0] = 'green'; } $status[1] = 'single/page: ' . $val . ' #'; } else if ($name == 'random_home'){ $val = $ops['max_num_of_ads_home_page']; if ($val == 0){ $status[0] = 'red'; } else { $status[0] = 'green'; } $status[1] = 'home: ' . $val .' #'; } else if ($name == 'random_pool'){ $count = adinj_count_live_ads('ad_code_random_', $ops); $status[0] = $count == 0 ? 'red' : 'green'; $status[1] = "ad pool: " . $count." #"; } else if ($name == 'top_pool'){ $count = adinj_count_live_ads('ad_code_top_', $ops); $status[0] = $count == 0 ? 'red' : 'green'; $status[1] = "ad pool: " . $count." #"; } else if ($name == 'bottom_pool'){ $count = adinj_count_live_ads('ad_code_bottom_', $ops); $status[0] = $count == 0 ? 'red' : 'green'; $status[1] = "ad pool: " . $count." #"; } else if ($name == 'random_alt_pool'){ $count = adinj_count_live_ads('ad_code_random_alt_', $ops); $status[1] = "alt pool: " . $count." #"; } else if ($name == 'top_alt_pool'){ $count = adinj_count_live_ads('ad_code_top_alt_', $ops); $status[1] = "alt pool: " . $count." #"; } else if ($name == 'bottom_alt_pool'){ $count = adinj_count_live_ads('ad_code_bottom_alt_', $ops); $status[1] = "alt pool: " . $count." #"; } else if ($name == 'topad'){ $count = adinj_count_live_ads('ad_code_top_', $ops); if ($count == 0){ $status[0] = 'red'; $status[1] = 'no ad defined'; return $status; } $val = $ops['top_ad_if_longer_than']; if (adinj_disabled($val)){ $status[0] = 'red'; $status[1] = 'off'; } else { $status[0] = 'green'; $status[1] = 'on'; } } else if ($name == 'bottomad'){ $count = adinj_count_live_ads('ad_code_bottom_', $ops); if ($count == 0){ $status[0] = 'red'; $status[1] = 'no ad defined'; return $status; } $val = $ops['bottom_ad_if_longer_than']; if (adinj_disabled($val)){ $status[0] = 'red'; $status[1] = 'off'; } else { $status[0] = 'green'; $status[1] = 'on'; } } else if ($name == 'widgets'){ if ($ops['widget_exclude_home'] == 'on' && $ops['widget_exclude_page'] == 'on' && $ops['widget_exclude_single'] == 'on' && $ops['widget_exclude_archive'] == 'on'){ $status[0] = 'red'; $status[1] = 'exclude from all'; } else { $status[1] = 'see widgets screen'; } } else if ($name == 'mode'){ $status[1] = $ops['ad_insertion_mode']; } else if ($name == 'restrictions'){ if ($ops['ad_insertion_mode'] == 'direct_static'){ $status[1] = 'n/a for direct static'; return $status; } $status[1] = ""; if ($ops['sevisitors_only'] == 'on'){ $status[1] .= 'referrer'; } if ($ops['block_ips'] == 'on' && !empty($ops['blocked_ips'])){ $status[1] .= ' ip'; } } else if ($name == 'debugging'){ $val = $ops['debug_mode']; if ($val == 'on'){ $status[0] = 'green'; $status[1] = 'on'; } else { $status[0] = 'red'; $status[1] = 'off'; } } return $status; } // This is for 'exclude' options so 'on' is red. function adinj_green_or_red_dot($option){ $ops = adinj_options(); if ($ops[$option] == 'on'){ return adinj_dot('red'); } else { return adinj_dot('green'); } } function adinj_dot($colour){ return ''; } function adinj_selection_box($name, $values, $type=NULL, $options=NULL, $selected_value_name=NULL){ echo ""; } function adinj_condition_table($name, $description, $type){ $options = adinj_options(); ?>

Comma separated list of
"; adinj_selection_box($prefix.'align', array(ADINJ_DISABLED, 'left', 'center', 'right', 'float left', 'float right', 'rand lcr', 'rand float lr', 'rand all')); echo "
"; _e("Clear (CSS)", 'adinj'); echo "
"; adinj_selection_box($prefix.'clear', array(ADINJ_DISABLED, 'left', 'right', 'both')); echo "
"; adinj_add_margin_top_bottom_options($prefix); } function adinj_add_margin_top_bottom_options($prefix, $options=NULL, $topname=NULL, $bottomname=NULL){ $tname = $prefix.'margin_top'; $bname = $prefix.'margin_bottom'; $tdefault = NULL; $bdefault = NULL; if ($topname != NULL){ $tname = $topname; $tdefault = "margin_top"; } if ($bottomname != NULL){ $bname = $bottomname; $bdefault = "margin_bottom"; } _e("Margin top", 'adinj'); echo "
"; adinj_selection_box($tname, array(ADINJ_DISABLED, 0, 1, 2, 3, 4, 5, 7, 10, 15, 20, 30), "(px)", $options, $tdefault); echo "
"; _e("Margin bottom", 'adinj'); echo "
"; adinj_selection_box($bname, array(ADINJ_DISABLED, 0, 1, 2, 3, 4, 5, 7, 10, 15, 20, 30), "(px)", $options, $bdefault); } function adinj_add_padding_top_bottom_options($prefix, $options=NULL, $topname=NULL, $bottomname=NULL){ $tname = $prefix.'padding_top'; $bname = $prefix.'padding_bottom'; $tdefault = NULL; $bdefault = NULL; if ($topname != NULL){ $tname = $topname; $tdefault = "padding_top"; } if ($bottomname != NULL){ $bname = $bottomname; $bdefault = "padding_bottom"; } _e("Padding top", 'adinj'); echo "
"; adinj_selection_box($tname, array(ADINJ_DISABLED, 0, 1, 2, 3, 4, 5, 7, 10, 15, 20, 30), "(px)", $options, $tdefault); echo "
"; _e("Padding bottom", 'adinj'); echo "
"; adinj_selection_box($bname, array(ADINJ_DISABLED, 0, 1, 2, 3, 4, 5, 7, 10, 15, 20, 30), "(px)", $options, $bdefault); } function adinj_get_version(){ $plugin_data=get_plugin_data(ADINJ_PATH . '/ad-injection.php'); return $plugin_data['Version']; } function adinj_problem_with_wpminify_check(){ $wpm_options = get_option('wp_minify'); if ($wpm_options['enable_html'] == true && is_plugin_active('wp-super-cache/wp-cache.php')){ return true; } return false; } function adinj_get_problem_with_wpminify_message(){ return 'Problem: Ad Injection will not work if WP Minify is set to minify HTML whilst WP Super Cache is enabled.
Solution: Go to the WP Minify settings page and untick "Enable HTML Minification".'; } function adinj_init_warning() { if (stripos($_SERVER["PHP_SELF"], 'plugins.php') !== false){ echo '

Ad Injection needs configuring: Go to the settings page to configure and enable your ads.

'; } // TODO add option to disable message without having to go to settings. } function adinj_compatibility_checks() { if (stripos($_SERVER["PHP_SELF"], 'ad-injection') !== false){ $wpm_options = get_option('wp_minify'); if ($wpm_options['enable_html'] == true){ echo '

'; echo adinj_get_problem_with_wpminify_message(); echo '

'; } } } ////////////////////////////////////////////////////////////////////////////// function adinj_percentage_split($name_stem, $num, $ops, $total=NULL){ // for old db - TODO delete later if (adinj_db_version($ops) == 1){ if ($num == 1) return '100%'; return '0%'; } if ($total == NULL){ $total = adinj_total_split($name_stem, $ops); } $name = $name_stem.$num; $namesplit = $name.'_split'; $percent = 0; if (!empty($ops[$name])){ if ($total == 0){ $percent = 0; } else { if (!empty($ops[$namesplit])){ $percent = ($ops[$namesplit] / $total) * 100; } } } $percent = number_format($percent, 1).'%'; return $percent; } function adinj_total_split($name_stem, $ops){ $total = 0; for ($i=1; $i<=10; ++$i){ $split = $name_stem.$i.'_split'; if (!empty($ops[$name_stem.$i]) && is_numeric($ops[$split]) && $ops[$split] > 0){ $total += $ops[$split]; } } return $total; } function adinj_count_live_ads($name_stem, $ops){ $total = 0; for ($i=1; $i<=10; ++$i){ $split = $name_stem.$i.'_split'; if (!empty($ops[$name_stem.$i]) && is_numeric($ops[$split]) && $ops[$split] > 0){ $total += 1; } } return $total; } ////////////////////////////////////////////////////////////////////////////// // Hopefully run on install and upgrade function adinj_activate_hook(){ $ops = adinj_options(); if(empty($ops)){ // 1st Install. adinj_install_db(); } else { // Upgrade check. adinj_upgrade_db_if_necessary(); } } function adinj_install_db(){ $new_options = adinj_default_options(); // Dynamic defaults. if (!is_plugin_active('wp-super-cache/wp-cache.php')){ $new_options['ad_insertion_mode'] = 'direct_dynamic'; } adinj_update_options($new_options); if ($new_options['ad_insertion_mode'] == 'mfunc'){ // Create config file. adinj_write_config_file(); } } function adinj_upgrade_db(){ $stored_options = adinj_options(); $new_options = adinj_default_options(); $stored_dbversion = adinj_db_version($stored_options); $new_dbversion = adinj_db_version($new_options); // 1. Copy existing options to new array. Use default as a baseline, // and then overwrite default with the saved ones. foreach ($new_options as $key => $value){ if (array_key_exists($key, $stored_options)){ $new_options[$key] = $stored_options[$key]; } } // 2. Upgrade options if necessary. if ($stored_dbversion == 1){ // Copy this to new setting if (adinj_ticked('first_paragraph_ad')){ $new_options['start_from_paragraph'] = 1; } // This previously wan't configured correctly $new_options['block_ips'] = 'on'; } // 3. Bump up db version number. $new_options['db_version'] = $new_dbversion; // 4. Save upgraded options. adinj_update_options($new_options); // 5. Update config file. if ($new_options['ad_insertion_mode'] == 'mfunc'){ // Update config file adinj_write_config_file(); } } // If the options in the database are out of sync with our default options // then the database options will need upgrading function adinj_options_need_upgrading($stored_options){ $default_options = adinj_default_options(); foreach ($default_options as $key => $value){ if (!array_key_exists($key, $stored_options)){ return true; } } foreach ($stored_options as $key => $value){ if (!array_key_exists($key, $default_options)){ return true; } } return false; } // All these stored in a single DB option row function adinj_default_options(){ return array( // Global settings 'ads_enabled' => 'off', 'ads_on_page_older_than' => '0', 'exclude_home' => '', 'exclude_page' => '', 'exclude_single' => '', 'exclude_archive' => '', 'global_category_condition_mode' => ADINJ_ONLY_SHOW_IN, 'global_category_condition_entries' => '', 'global_tag_condition_mode' => ADINJ_ONLY_SHOW_IN, 'global_tag_condition_entries' => '', // Random ads 'ad_code_random_1' => '', 'ad_code_random_2' => '', 'ad_code_random_3' => '', 'ad_code_random_4' => '', 'ad_code_random_5' => '', 'ad_code_random_1_split' => '100', 'ad_code_random_2_split' => '100', 'ad_code_random_3_split' => '100', 'ad_code_random_4_split' => '100', 'ad_code_random_5_split' => '100', 'ad_code_random_alt_1' => '', 'ad_code_random_alt_2' => '', 'ad_code_random_alt_1_split' => '100', 'ad_code_random_alt_2_split' => '100', 'max_num_of_ads' => '2', // single posts and pages 'no_random_ads_if_shorter_than' => '100', 'one_ad_if_shorter_than' => '500', 'two_ads_if_shorter_than' => '1000', 'three_ads_if_shorter_than' => ADINJ_RULE_DISABLED, 'top_ad_if_longer_than' => ADINJ_RULE_DISABLED, 'bottom_ad_if_longer_than' => ADINJ_RULE_DISABLED, 'rnd_align' => ADINJ_DISABLED, 'rnd_clear' => ADINJ_DISABLED, 'rnd_margin_top' => '3', 'rnd_margin_bottom' => '3', 'rnd_padding_top' => ADINJ_DISABLED, //TODO 'rnd_padding_bottom' => ADINJ_DISABLED, //TODO 'first_paragraph_ad' => '', // TODO delete 'start_from_paragraph' => ADINJ_DISABLED, //TODO 'multiple_ads_at_same_position' => '', 'rnd_category_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'rnd_category_condition_entries' => '', //TODO 'rnd_tag_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'rnd_tag_condition_entries' => '', //TODO // Home page specific random ads 'max_num_of_ads_home_page' => '3', // Top ads 'ad_code_top_1' => '', 'ad_code_top_2' => '', 'ad_code_top_3' => '', 'ad_code_top_4' => '', 'ad_code_top_5' => '', 'ad_code_top_1_split' => '100', 'ad_code_top_2_split' => '100', 'ad_code_top_3_split' => '100', 'ad_code_top_4_split' => '100', 'ad_code_top_5_split' => '100', 'ad_code_top_alt_1' => '', 'ad_code_top_alt_2' => '', 'ad_code_top_alt_1_split' => '100', 'ad_code_top_alt_2_split' => '100', 'top_align' => ADINJ_DISABLED, 'top_clear' => ADINJ_DISABLED, 'top_margin_top' => '3', 'top_margin_bottom' => '3', 'top_padding_top' => ADINJ_DISABLED, //TODO 'top_padding_bottom' => ADINJ_DISABLED, //TODO 'top_category_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'top_category_condition_entries' => '', //TODO 'top_tag_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'top_tag_condition_entries' => '', //TODO // Bottom ads 'ad_code_bottom_1' => '', 'ad_code_bottom_2' => '', 'ad_code_bottom_3' => '', 'ad_code_bottom_4' => '', 'ad_code_bottom_5' => '', 'ad_code_bottom_1_split' => '100', 'ad_code_bottom_2_split' => '100', 'ad_code_bottom_3_split' => '100', 'ad_code_bottom_4_split' => '100', 'ad_code_bottom_5_split' => '100', 'ad_code_bottom_alt_1' => '', 'ad_code_bottom_alt_2' => '', 'ad_code_bottom_alt_1_split' => '100', 'ad_code_bottom_alt_2_split' => '100', 'bottom_align' => ADINJ_DISABLED, 'bottom_clear' => ADINJ_DISABLED, 'bottom_margin_top' => '3', 'bottom_margin_bottom' => '3', 'bottom_padding_top' => ADINJ_DISABLED, //TODO 'bottom_padding_bottom' => ADINJ_DISABLED, //TODO 'bottom_category_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'bottom_category_condition_entries' => '', //TODO 'bottom_tag_condition_mode' => ADINJ_ONLY_SHOW_IN, //TODO 'bottom_tag_condition_entries' => '', //TODO // widgets 'widget_exclude_home' => '', 'widget_exclude_page' => '', 'widget_exclude_single' => '', 'widget_exclude_archive' => '', // dynamic features 'sevisitors_only' => 'off', 'ad_referrers' => '.google., .bing., .yahoo., .ask., search?, search., /search/', 'block_ips' => 'on', //TODO 'blocked_ips' => '', 'block_keywords' => 'off', //TODO 'blocked_keywords' => '', //TODO 'ad_insertion_mode' => 'mfunc', // ui main tab 'ui_global_hide' => 'false', 'ui_random_hide' => 'false', 'ui_topad_hide' => 'false', 'ui_bottomad_hide' => 'false', 'ui_widgets_hide' => 'false', 'ui_restrictions_hide' => 'false', 'ui_debugging_hide' => 'true', 'ui_docs_hide' => 'false', 'ui_testads_hide' => 'false', // ui ad rotation tab 'ui_multiple_random_hide' => 'false', 'ui_multiple_top_hide' => 'false', 'ui_multiple_bottom_hide' => 'false', // debug 'debug_mode' => '', // version // _ = before split testing // 2 = split testing support 'db_version' => ADINJ_DB_VERSION ); } function adinj_getdefault($option){ $default_options = adinj_default_options(); return "(default: " . $default_options[$option] . ")"; } function write_ad_to_file($ad, $ad_path){ adinj_write_file($ad_path, $ad, 0640); } function adinj_init_hook() { $ops = adinj_options(); if ($ops['ads_enabled'] != 'on') { add_action('admin_notices', 'adinj_init_warning'); } } // init add_action('init', 'adinj_init_hook'); // Config links add_action('admin_menu', 'adinj_admin_menu_hook'); add_filter('plugin_action_links', 'adinj_options_link_hook', 10, 2); // digits = priority, num args ?>