"; var $home_number_of_displays = 1; var $inap_excerpts_displayed = 0; function init() { if (function_exists('load_plugin_textdomain')) { load_plugin_textdomain('adman', 'wp-content/plugins/adman'); } } function wp_head() { if (!is_feed()) { echo(""); } } function admin_menu() { add_submenu_page('options-general.php', __('AdMan'), __('AdMan'), 5, __FILE__, array($this, 'plugin_menu')); } function the_excerpt_inap($content = '') { if (class_exists('INAP_Post') && is_home() && !is_feed() && $this->inap_excerpts_displayed == 0 && get_option('adman_adcode_home')) { $content = stripslashes(get_option('adman_adcode_home')) . $content; $this->inap_excerpts_displayed++; } return $content; } function the_content($content = '') { if (is_single() || (class_exists('INAP_Post') && $_REQUEST['type'] == "content")) { global $wp_query; $post = $wp_query->get_queried_object(); $adman_disable = get_post_meta($post->ID, 'adman_disable', false); if ($adman_disable) { return $content; } if (get_option('adman_adcode')) { if (strpos($content, $this->adPattern) === false) { $middle = intval(strlen($content) / 2); $positions = $this->get_occurrences($content, "
"); $positions = array_merge($positions, $this->get_occurrences($content, "")); $positions = array_merge($positions, $this->get_occurrences($content, "")); $positions = array_merge($positions, $this->get_occurrences($content, "")); $positions = array_merge($positions, $this->get_occurrences($content, "")); $deviations = array(); foreach ($positions as $pos) { $diff = abs($pos - $middle); $deviations[$diff] = $pos; } ksort($deviations); $final = array_shift($deviations); if ($final > 0) { $content = substr($content, 0, $final - 1) . stripslashes(get_option('adman_adcode')) . substr($content, $final); } else { $content = stripslashes(get_option('adman_adcode')) . $content; } } else { $content = str_replace($this->adPattern, stripslashes(get_option('adman_adcode')), $content); } } if (get_option('adman_adcode_beginning')) { $content = stripslashes(get_option('adman_adcode_beginning')) . $content; } if (get_option('adman_adcode_after')) { $content = $content . stripslashes(get_option('adman_adcode_after')); } } else if (is_home() && !is_feed() && $this->home_number_of_displays > 0 && get_option('adman_adcode_home')) { $this->home_number_of_displays--; $content = stripslashes(get_option('adman_adcode_home')) . $content; } return $content; } function get_occurrences($content, $what) { $result = array(); $pos = 0; while($pos !== false) { $pos = strpos($content, $what, $pos); if ($pos === false) { return $result; } $pos += strlen($what) + 1; array_push($result, $pos); if ($pos >= strlen($content)) { return $result; } } return $result; } function edit_action($id) { $adman_edit = $_POST["adman_edit"]; if (isset($adman_edit) && !empty($adman_edit)) { $adman_disable = $_POST["adman_disable"]; delete_post_meta($id, 'adman_disable'); if (isset($adman_disable) && !empty($adman_disable)) { add_post_meta($id, 'adman_disable', $adman_disable); } } } function edit_form_action() { global $post; $post_id = $post; if (is_object($post_id)) { $post_id = $post_id->ID; } $disable_adman = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'adman_disable', false))); ?>| /> | |
here..') ?>