示例#1
0
function wp_insert_inpostads_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    if ($location == 'middle') {
        $data = wp_insert_sanitize_array($data[$location], array('status', 'ad_code_1', 'ad_code_2', 'ad_code_3', 'country_1', 'country_code_1', 'rules_exclude_home', 'rules_exclude_archives', 'rules_exclude_categories', 'rules_categories_exceptions', 'rules_exclude_search', 'rules_exclude_page', 'rules_page_exceptions', 'rules_exclude_post', 'rules_post_exceptions', 'styles', 'minimum_character_count', 'paragraph_buffer_count'));
    } else {
        $data = wp_insert_sanitize_array($data[$location], array('status', 'ad_code_1', 'ad_code_2', 'ad_code_3', 'country_1', 'country_code_1', 'rules_exclude_home', 'rules_exclude_archives', 'rules_exclude_categories', 'rules_categories_exceptions', 'rules_exclude_search', 'rules_exclude_page', 'rules_page_exceptions', 'rules_exclude_post', 'rules_post_exceptions', 'styles'));
    }
    $controls = array();
    $controls['status'] = wp_insert_get_control('tz-checkbox', false, $name . '[status]', $id . '-status', $data['status']);
    $controls['ad_code_1'] = wp_insert_get_control('textarea', false, $name . '[ad_code_1]', $id . '-ad_code_1', $data['ad_code_1'], 'Ad Code (Primary Network):');
    $controls['ad_code_2'] = wp_insert_get_control('textarea', false, $name . '[ad_code_2]', $id . '-ad_code_2', $data['ad_code_2'], 'Ad Code (Secondary Network):');
    $controls['ad_code_3'] = wp_insert_get_control('textarea', false, $name . '[ad_code_3]', $id . '-ad_code_3', $data['ad_code_3'], 'Ad Code (Tertiary Network):');
    $controls['country_1'] = wp_insert_get_control('popup', false, $name . '[country_1]', $id . '-country_1', $data['country_1'], 'Geo Targets', '', array('type' => 'countries'));
    $controls['country_code_1'] = wp_insert_get_control('textarea', false, $name . '[country_code_1]', $id . '-country_code_1', $data['country_code_1'], 'Ad Code', '', null, 'input widefat');
    $controls['rules_exclude_home'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_home]', $id . '-rules_exclude_home', $data['rules_exclude_home'], '', '', null, '', false);
    $controls['rules_home_instances'] = wp_insert_get_control('popup', false, $name . '[rules_home_instances]', $id . '-rules_home_instances', $data['rules_home_instances'], '', '', array('type' => 'instances'), '', false);
    $controls['rules_exclude_archives'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_archives]', $id . '-rules_exclude_archives', $data['rules_exclude_archives'], '', '', null, '', false);
    $controls['rules_archives_instances'] = wp_insert_get_control('popup', false, $name . '[rules_archives_instances]', $id . '-rules_archives_instances', $data['rules_archives_instances'], '', '', array('type' => 'instances'), '', false);
    $controls['rules_exclude_categories'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_categories]', $id . '-rules_exclude_categories', $data['rules_exclude_categories'], '', '', null, '', false);
    $controls['rules_categories_instances'] = wp_insert_get_control('popup', false, $name . '[rules_categories_instances]', $id . '-rules_categories_instances', $data['rules_categories_instances'], '', '', array('type' => 'instances'), '', false);
    $controls['rules_categories_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_categories_exceptions]', $id . '-rules_categories_exceptions', $data['rules_categories_exceptions'], '', '', array('type' => 'categories'), '', false);
    $controls['rules_exclude_search'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_search]', $id . '-rules_exclude_search', $data['rules_exclude_search'], '', '', null, '', false);
    $controls['rules_search_instances'] = wp_insert_get_control('popup', false, $name . '[rules_search_instances]', $id . '-rules_search_instances', $data['rules_search_instances'], '', '', array('type' => 'instances'), '', false);
    $controls['rules_exclude_page'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_page]', $id . '-rules_exclude_page', $data['rules_exclude_page'], '', '', null, '', false);
    $controls['rules_page_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_page_exceptions]', $id . '-rules_page_exceptions', $data['rules_page_exceptions'], '', '', array('type' => 'pages'), '', false);
    $controls['rules_exclude_post'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_post]', $id . '-rules_exclude_post', $data['rules_exclude_post'], '', '', null, '', false);
    $controls['rules_post_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_post_exceptions]', $id . '-rules_post_exceptions', $data['rules_post_exceptions'], '', '', array('type' => 'posts'), '', false);
    $controls['styles'] = wp_insert_get_control('textarea', false, $name . '[styles]', $id . '-styles', $data['styles'], 'Styles:');
    if ($location == 'middle') {
        $controls['minimum_character_count'] = wp_insert_get_control('text', false, $name . '[minimum_character_count]', $id . '-minimum_character_count', $data['minimum_character_count'], 'Minimum Character Count', 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.', null, 'input widefat');
        $controls['paragraph_buffer_count'] = wp_insert_get_control('text', false, $name . '[paragraph_buffer_count]', $id . '-paragraph_buffer_count', $data['paragraph_buffer_count'], 'Paragraph Buffer Count', 'Shows the ad after X number of Paragraphs.  If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.', null, 'input widefat');
    }
    echo $controls['status']['html'];
    $multiple_network_status = get_option('wp_insert_multiple_network_status');
    if ($multiple_network_status == 2 || $multiple_network_status == 1) {
        $controls['ad_code_3']['html'] = '<div style="display: none;">' . $controls['ad_code_3']['html'] . '</div>';
    }
    if ($multiple_network_status == 1) {
        $controls['ad_code_2']['html'] = '<div style="display: none;">' . $controls['ad_code_2']['html'] . '</div>';
    }
    $tabData = array(array('title' => 'Ad Code', 'content' => $controls['ad_code_1']['html'] . $controls['ad_code_2']['html'] . $controls['ad_code_3']['html']), array('title' => 'Rules', 'content' => wp_insert_inpostads_rules_content($controls)), array('title' => 'Geo Targeting', 'content' => '<p>' . $controls['country_1']['html'] . $controls['country_code_1']['html'] . '</p>'), array('title' => 'Styles', 'content' => $controls['styles']['html']));
    if ($location == 'middle') {
        array_push($tabData, array('title' => 'Settings', 'content' => $controls['minimum_character_count']['html'] . $controls['paragraph_buffer_count']['html']));
    }
    $controls['vtab'] = wp_insert_get_vtabs('vtab_' . $location, $tabData);
    echo $controls['vtab']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#2
0
function wp_insert_syntax_highlighting_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    $data = wp_insert_sanitize_array($data[$location], array('status'));
    $controls = array();
    $controls['status'] = wp_insert_get_control('tz-checkbox', false, $name . '[status]', $id . '-status', $data['status'], '', 'Syntax Highlighting support using Editarea 0.8.2 by <a target="_blank" href="http://www.cdolivet.com/index.php?page=editArea">Christophe Dolivet</a>');
    echo $controls['status']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#3
0
function wp_insert_templateads_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    $data = wp_insert_sanitize_array($data[$location], array('status', 'ad_code_1', 'ad_code_2', 'ad_code_3', 'country_1', 'country_code_1', 'rules_exclude_home', 'rules_exclude_archives', 'rules_exclude_categories', 'rules_categories_exceptions', 'rules_categories_post_exceptions', 'rules_exclude_search', 'rules_exclude_page', 'rules_page_exceptions', 'rules_exclude_post', 'rules_post_exceptions', 'styles'));
    $controls = array();
    $controls['status'] = wp_insert_get_control('tz-checkbox', false, $name . '[status]', $id . '-status', $data['status']);
    $controls['ad_code_1'] = wp_insert_get_control('textarea', false, $name . '[ad_code_1]', $id . '-ad_code_1', $data['ad_code_1'], 'Ad Code (Primary Network):', '', null, 'input widefat chitika');
    $controls['ad_code_2'] = wp_insert_get_control('textarea', false, $name . '[ad_code_2]', $id . '-ad_code_2', $data['ad_code_2'], 'Ad Code (Secondary Network):', '', null, 'input widefat chitika');
    $controls['ad_code_3'] = wp_insert_get_control('textarea', false, $name . '[ad_code_3]', $id . '-ad_code_3', $data['ad_code_3'], 'Ad Code (Tertiary Network):', '', null, 'input widefat chitika');
    $controls['country_1'] = wp_insert_get_control('popup', false, $name . '[country_1]', $id . '-country_1', $data['country_1'], 'Geo Targets', '', array('type' => 'countries'));
    $controls['country_code_1'] = wp_insert_get_control('textarea', false, $name . '[country_code_1]', $id . '-country_code_1', $data['country_code_1'], 'Ad Code', '', null, 'input widefat chitika');
    $controls['rules_exclude_home'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_home]', $id . '-rules_exclude_home', $data['rules_exclude_home'], '', '', null, '', false);
    $controls['rules_exclude_archives'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_archives]', $id . '-rules_exclude_archives', $data['rules_exclude_archives'], '', '', null, '', false);
    $controls['rules_exclude_categories'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_categories]', $id . '-rules_exclude_categories', $data['rules_exclude_categories'], '', '', null, '', false);
    $controls['rules_categories_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_categories_exceptions]', $id . '-rules_categories_exceptions', $data['rules_categories_exceptions'], '', '', array('type' => 'categories'), '', false);
    $controls['rules_categories_post_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_categories_post_exceptions]', $id . '-rules_categories_post_exceptions', $data['rules_categories_post_exceptions'], '', '', array('type' => 'categories'), '', false);
    $controls['rules_exclude_search'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_search]', $id . '-rules_exclude_search', $data['rules_exclude_search'], '', '', null, '', false);
    $controls['rules_exclude_page'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_page]', $id . '-rules_exclude_page', $data['rules_exclude_page'], '', '', null, '', false);
    $controls['rules_page_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_page_exceptions]', $id . '-rules_page_exceptions', $data['rules_page_exceptions'], '', '', array('type' => 'pages'), '', false);
    $controls['rules_exclude_post'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_post]', $id . '-rules_exclude_post', $data['rules_exclude_post'], '', '', null, '', false);
    $controls['rules_post_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_post_exceptions]', $id . '-rules_post_exceptions', $data['rules_post_exceptions'], '', '', array('type' => 'posts'), '', false);
    $post_types = get_post_types(array('public' => true, '_builtin' => false), 'names');
    if ($post_types) {
        foreach ($post_types as $post_type) {
            $controls['rules_exclude_cpt_' . $post_type] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_cpt_' . $post_type . ']', $id . '-rules_exclude_cpt_' . $post_type, $data['rules_exclude_cpt_' . $post_type], '', '', null, '', false);
        }
    }
    $controls['styles'] = wp_insert_get_control('textarea', false, $name . '[styles]', $id . '-styles', $data['styles'], 'Styles:');
    echo $controls['status']['html'];
    $multiple_network_status = get_option('wp_insert_multiple_network_status');
    if ($multiple_network_status == 2 || $multiple_network_status == 1) {
        $controls['ad_code_3']['html'] = '<div style="display: none;">' . $controls['ad_code_3']['html'] . '</div>';
    }
    if ($multiple_network_status == 1) {
        $controls['ad_code_2']['html'] = '<div style="display: none;">' . $controls['ad_code_2']['html'] . '</div>';
    }
    $tabData = array(array('title' => 'Code Snippet', 'content' => '<p class="codeSnippet"><label>Code to add to your theme files:</label><br /><code>&lt;?php if(function_exists("wp_template_ad")) { wp_template_ad("' . str_replace('templateads-', '', $location) . '"); } ?&gt;</code></p>'), array('title' => 'Ad Code', 'content' => $controls['ad_code_1']['html'] . $controls['ad_code_2']['html'] . $controls['ad_code_3']['html']), array('title' => 'Rules', 'content' => wp_insert_templateads_rules_content($controls)), array('title' => 'Geo Targeting', 'content' => '<p>' . $controls['country_1']['html'] . $controls['country_code_1']['html'] . '</p>'), array('title' => 'Styles', 'content' => $controls['styles']['html']));
    $controls['vtab'] = wp_insert_get_vtabs('vtab_' . $location, $tabData);
    echo $controls['vtab']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#4
0
function wp_insert_legal_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    $data = wp_insert_sanitize_array($data[$location], array('content', 'pages'));
    $controls = array();
    $controls['content'] = wp_insert_get_control('nicedit', false, $name . '[content]', $id . '-content', $data['content'], '', 'Leave the field empty to reset to the default content', null);
    $controls['pages'] = wp_insert_get_control('popup', false, $name . '[pages]', $id . '-pages', $data['pages'], 'Assign Page(s):', '', array('type' => 'pages'));
    $tabData = array(array('title' => 'Content', 'content' => $controls['content']['html']), array('title' => 'Assign Page(s)', 'content' => $controls['pages']['html']));
    $controls['vtab'] = wp_insert_get_vtabs('vtab_' . $location, $tabData);
    echo $controls['vtab']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#5
0
文件: codes.php 项目: WaitButWhy/www
function wp_insert_tracking_codes_wp_footer()
{
    $options = get_option('wp_insert_tracking_codes_options');
    $analytics = wp_insert_sanitize_array($options['analytics'], array('status', 'code'));
    if ($analytics['status'] && $analytics['code'] != '') {
        echo '<script type="text/javascript">';
        echo 'var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");';
        echo 'document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
        echo '</script>';
        echo '<script type="text/javascript">';
        echo 'var pageTracker = _gat._getTracker("' . $analytics['code'] . '");';
        echo 'pageTracker._trackPageview();';
        echo '</script>';
    }
    $footer = wp_insert_sanitize_array($options['footer'], array('status', 'code'));
    if ($footer['status']) {
        echo $footer['code'];
    }
}
示例#6
0
function wp_insert_tracking_codes_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    $data = wp_insert_sanitize_array($data[$location], array('status', 'code'));
    $controls = array();
    $controls['status'] = wp_insert_get_control('tz-checkbox', false, $name . '[status]', $id . '-status', $data['status']);
    if ($location == 'analytics') {
        $controls['code'] = wp_insert_get_control('text', false, $name . '[code]', $id . '-code', $data['code'], 'Google Analytics Tracker ID:', 'Your Google Analytics Tracker ID (XX-XXXXX-X)');
    } else {
        $controls['code'] = wp_insert_get_control('textarea', false, $name . '[code]', $id . '-code', $data['code'], 'Code:');
    }
    echo $controls['status']['html'];
    echo $controls['code']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#7
0
function wp_insert_adwidgets_content($post, $args)
{
    $location = $args['args']['location'];
    $data = $args['args']['data'];
    $id = $args['id'];
    $name = $args['args']['name'] . '[' . $location . ']';
    if (!isset($data[$location])) {
        $data[$location] = array();
    }
    $data = wp_insert_sanitize_array($data[$location], array('status', 'ad_code_1', 'ad_code_2', 'ad_code_3', 'country_1', 'country_code_1', 'rules_exclude_home', 'rules_exclude_archives', 'rules_exclude_categories', 'rules_categories_exceptions', 'rules_exclude_search', 'rules_exclude_page', 'rules_page_exceptions', 'rules_exclude_post', 'rules_post_exceptions', 'styles'));
    $controls = array();
    $controls['status'] = wp_insert_get_control('tz-checkbox', false, $name . '[status]', $id . '-status', $data['status']);
    $controls['ad_code_1'] = wp_insert_get_control('textarea', false, $name . '[ad_code_1]', $id . '-ad_code_1', $data['ad_code_1'], 'Ad Code (Primary Network):');
    $controls['ad_code_2'] = wp_insert_get_control('textarea', false, $name . '[ad_code_2]', $id . '-ad_code_2', $data['ad_code_2'], 'Ad Code (Secondary Network):');
    $controls['ad_code_3'] = wp_insert_get_control('textarea', false, $name . '[ad_code_3]', $id . '-ad_code_3', $data['ad_code_3'], 'Ad Code (Tertiary Network):');
    $controls['country_1'] = wp_insert_get_control('popup', false, $name . '[country_1]', $id . '-country_1', $data['country_1'], 'Geo Targets', '', array('type' => 'countries'));
    $controls['country_code_1'] = wp_insert_get_control('textarea', false, $name . '[country_code_1]', $id . '-country_code_1', $data['country_code_1'], 'Ad Code', '', null, 'input widefat');
    $controls['rules_exclude_home'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_home]', $id . '-rules_exclude_home', $data['rules_exclude_home'], '', '', null, '', false);
    $controls['rules_exclude_archives'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_archives]', $id . '-rules_exclude_archives', $data['rules_exclude_archives'], '', '', null, '', false);
    $controls['rules_exclude_categories'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_categories]', $id . '-rules_exclude_categories', $data['rules_exclude_categories'], '', '', null, '', false);
    $controls['rules_categories_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_categories_exceptions]', $id . '-rules_categories_exceptions', $data['rules_categories_exceptions'], '', '', array('type' => 'categories'), '', false);
    $controls['rules_exclude_search'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_search]', $id . '-rules_exclude_search', $data['rules_exclude_search'], '', '', null, '', false);
    $controls['rules_exclude_page'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_page]', $id . '-rules_exclude_page', $data['rules_exclude_page'], '', '', null, '', false);
    $controls['rules_page_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_page_exceptions]', $id . '-rules_page_exceptions', $data['rules_page_exceptions'], '', '', array('type' => 'pages'), '', false);
    $controls['rules_exclude_post'] = wp_insert_get_control('ip-checkbox', false, $name . '[rules_exclude_post]', $id . '-rules_exclude_post', $data['rules_exclude_post'], '', '', null, '', false);
    $controls['rules_post_exceptions'] = wp_insert_get_control('popup', false, $name . '[rules_post_exceptions]', $id . '-rules_post_exceptions', $data['rules_post_exceptions'], '', '', array('type' => 'posts'), '', false);
    $controls['styles'] = wp_insert_get_control('textarea', false, $name . '[styles]', $id . '-styles', $data['styles'], 'Styles:');
    echo $controls['status']['html'];
    $multiple_network_status = get_option('wp_insert_multiple_network_status');
    if ($multiple_network_status == 2 || $multiple_network_status == 1) {
        $controls['ad_code_3']['html'] = '<div style="display: none;">' . $controls['ad_code_3']['html'] . '</div>';
    }
    if ($multiple_network_status == 1) {
        $controls['ad_code_2']['html'] = '<div style="display: none;">' . $controls['ad_code_2']['html'] . '</div>';
    }
    $tabData = array(array('title' => 'Ad Code', 'content' => $controls['ad_code_1']['html'] . $controls['ad_code_2']['html'] . $controls['ad_code_3']['html']), array('title' => 'Rules', 'content' => wp_insert_adwidgets_rules_content($controls)), array('title' => 'Geo Targeting', 'content' => '<p>' . $controls['country_1']['html'] . $controls['country_code_1']['html'] . '</p>'), array('title' => 'Styles', 'content' => $controls['styles']['html']));
    $controls['vtab'] = wp_insert_get_vtabs('vtab_' . $location, $tabData);
    echo $controls['vtab']['html'];
    echo wp_insert_get_script_tag($controls);
}
示例#8
0
function wp_insert_get_table($args)
{
    $args = wp_insert_sanitize_array($args, array('id', 'class', 'style', 'rows'));
    $output = '<table' . ($args['id'] != '' ? ' id="' . $args['id'] . '"' : '') . ($args['class'] != '' ? ' class="' . $args['class'] . '"' : '') . ($args['style'] != '' ? ' style="' . $args['style'] . '"' : '') . '>';
    if (isset($args['rows']) && is_array($args['rows'])) {
        foreach ($args['rows'] as $row) {
            $row = wp_insert_sanitize_array($row, array('id', 'class', 'style', 'cells'));
            $output .= '<tr' . ($row['id'] != '' ? ' id="' . $row['id'] . '"' : '') . ($row['class'] != '' ? ' class="' . $row['class'] . '"' : '') . ($row['style'] != '' ? ' style="' . $row['style'] . '"' : '') . '>';
            if (isset($row['cells']) && is_array($row['cells'])) {
                foreach ($row['cells'] as $cell) {
                    $cell = wp_insert_sanitize_array($cell, array('type', 'colspan', 'id', 'class', 'style', 'content'));
                    if ($cell['type'] == '') {
                        $cell['type'] = 'td';
                    }
                    $output .= '<' . $cell['type'] . ($cell['colspan'] != '' ? ' colspan="' . $cell['colspan'] . '"' : '') . ($cell['id'] != '' ? ' id="' . $cell['id'] . '"' : '') . ($cell['class'] != '' ? ' class="' . $cell['class'] . '"' : '') . ($cell['style'] != '' ? ' style="' . $cell['style'] . '"' : '') . '>';
                    $output .= $cell['content'];
                    $output .= '</' . $cell['type'] . '>';
                }
            }
            $output .= '</tr>';
        }
    }
    $output .= '</table>';
    return $output;
}
示例#9
0
文件: status.php 项目: WaitButWhy/www
function wp_insert_get_ad_status($rules)
{
    if (!isset($rules)) {
        return false;
    }
    $rules = wp_insert_sanitize_array($rules, array('status', 'rules_exclude_home', 'rules_home_instances', 'rules_exclude_archives', 'rules_archives_instances', 'rules_exclude_categories', 'rules_categories_exceptions', 'rules_categories_instances', 'rules_exclude_search', 'rules_search_instances', 'rules_exclude_page', 'rules_page_exceptions', 'rules_exclude_post', 'rules_post_exceptions'));
    if (!$rules['status']) {
        return false;
    }
    global $wpInsertPostInstance;
    $page_details = wp_insert_get_page_details();
    switch ($page_details['type']) {
        case 'HOME':
            if ($rules['rules_exclude_home']) {
                return false;
            } else {
                if ($rules['rules_home_instances'] && in_array($wpInsertPostInstance, split(',', $rules['rules_home_instances']))) {
                    return false;
                }
            }
            break;
        case 'ARCHIVE':
            if ($rules['rules_exclude_archives']) {
                return false;
            } else {
                if ($rules['rules_archives_instances'] && in_array($wpInsertPostInstance, split(',', $rules['rules_archives_instances']))) {
                    return false;
                }
            }
            break;
        case 'CATEGORY':
            if ($rules['rules_exclude_categories']) {
                return false;
            } else {
                if ($rules['rules_categories_exceptions'] && in_array($page_details['ID'], split(',', $rules['rules_categories_exceptions']))) {
                    return false;
                } else {
                    if ($rules['rules_categories_instances'] && in_array($wpInsertPostInstance, split(',', $rules['rules_categories_instances']))) {
                        return false;
                    }
                }
            }
            break;
        case 'SEARCH':
            if ($rules['rules_exclude_search']) {
                return false;
            } else {
                if ($rules['rules_search_instances'] && in_array($wpInsertPostInstance, split(',', $rules['rules_search_instances']))) {
                    return false;
                }
            }
            break;
        case 'PAGE':
            if ($rules['rules_exclude_page']) {
                return false;
            } else {
                if ($rules['rules_page_exceptions'] && in_array($page_details['ID'], split(',', $rules['rules_page_exceptions']))) {
                    return false;
                }
            }
            break;
        case 'POST':
            if ($rules['rules_exclude_post']) {
                return false;
            } else {
                if ($rules['rules_post_exceptions'] && in_array($page_details['ID'], split(',', $rules['rules_post_exceptions']))) {
                    return false;
                } else {
                    if ($rules['rules_categories_post_exceptions'] && is_array($page_details['categories']) && count(array_intersect(array_unique($page_details['categories']), array_unique(split(',', $rules['rules_categories_post_exceptions'])))) > 0) {
                        return false;
                    }
                }
            }
            break;
        case 'CUSTOM':
            if ($rules['rules_exclude_cpt_' . $page_details['type_name']]) {
                return false;
            }
            break;
    }
    return true;
}