1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Please Help Me With: Cannot Modify Header Error

Discussion in 'HTML & Website Design' started by locals, Nov 14, 2015.

  1. #1
    I have this code and every time I change
    
    home_url('/')."job/
    
    Code (markup):
    to
    SEMrush
    
    home_url('/')."listing/
    
    Code (markup):
    I get the error
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/.../inc/jobs-filters.php:1)
    
    Code (markup):

    
    <?php
    
    function wpjobusSubmitJobsFilter() {
    
          if ( isset( $_POST['wpjobusSubmitJobsFilter_nonce'] ) && wp_verify_nonce( $_POST['wpjobusSubmitJobsFilter_nonce'], 'wpjobusSubmitJobsFilter_html' ) ) {
    
              global $wpdb, $td_companies_per_page, $td_total_companies, $td_total_pages, $td_current_page, $wpjobus_companies;
    
            $td_companies_per_page = 18;
    
            $td_total_companies = 0;
    
            $td_current_page = $_POST['companies_current_page'];
    
              $companies_map_block = $_POST['companies_map_block'];
    
              // Job Presence Filter
              $td_job_presence_type = $_POST['job_presence_type'];
            $td_job_presence_type_all = $_POST['job_presence_type_all'];
    
            $stringOriginal = '';
            $stringOriginalCount = 0;
    
            if($td_job_presence_type_all == 1) {
    
                global $redux_demo; 
                for ($i = 0; $i < count($redux_demo['job-type']); $i++) {
    
                    if($stringOriginalCount != 0) {
                        $stringOriginalCountPrim = " OR ";
                    } else {
                        $stringOriginalCountPrim = "";
                    }
    
                    $stringOriginal .= $stringOriginalCountPrim."m.meta_value = '". $redux_demo['job-type'][$i] ."'";
    
                    $stringOriginalCount++;
    
                }
    
            } else {
    
                for ($countQ = 0; $countQ < count($td_job_presence_type); $countQ++) { 
    
                    if(!empty($td_job_presence_type[$countQ])) { 
    
                        if($stringOriginalCount != 0) {
                            $stringOriginalCountPrim = " OR ";
                        } else {
                            $stringOriginalCountPrim = "";
                        }
    
                        $stringOriginal .= $stringOriginalCountPrim."m.meta_value = '". $td_job_presence_type[$countQ] ."'";
    
                        $stringOriginalCount++;
    
                    }
    
                 }
    
            }
    
            if(!empty($stringOriginal)) {
    
                $string = "AND m.meta_key = 'wpjobus_job_type'  AND (" . $stringOriginal . ")";
    
            } else {
    
                $string = "";
    
            }
            // End Job Presence Filter
    
            // Job Career Level Filter
              $td_job_career_level = $_POST['job_career_level'];
            $td_job_career_level_all = $_POST['job_career_level_all'];
    
            $stringOriginalLevel = '';
            $stringOriginalLevelCount = 0;
    
            if($td_job_career_level_all == 1) {
    
                global $redux_demo; 
                for ($i = 0; $i < count($redux_demo['resume_career_level']); $i++) {
    
                    if($stringOriginalLevelCount != 0) {
                        $stringOriginalLevelCountPrim = " OR ";
                    } else {
                        $stringOriginalLevelCountPrim = "";
                    }
    
                    $stringOriginalLevel .= $stringOriginalLevelCountPrim."m2.meta_value = '". $redux_demo['resume_career_level'][$i] ."'";
    
                    $stringOriginalLevelCount++;
    
                }
    
            } else {
    
                for ($countQ = 0; $countQ < count($td_job_career_level); $countQ++) { 
    
                    if(!empty($td_job_career_level[$countQ])) { 
    
                        if($stringOriginalLevelCount != 0) {
                            $stringOriginalLevelCountPrim = " OR ";
                        } else {
                            $stringOriginalLevelCountPrim = "";
                        }
    
                        $stringOriginalLevel .= $stringOriginalLevelCountPrim."m2.meta_value = '". $td_job_career_level[$countQ] ."'";
    
                        $stringOriginalLevelCount++;
    
                    }
    
                 }
    
            }
    
            if(!empty($stringOriginalLevel)) {
    
                $stringLevel = "AND m2.meta_key = 'job_career_level'  AND (" . $stringOriginalLevel . ")";
    
            } else {
    
                $stringLevel = "";
    
            }
            // End Job Career Level Filter
    
            // Job Career Level Filter
              $td_job_location = $_POST['company_location'];
            $td_job_location_all = $_POST['company_location_all'];
    
            $stringOriginalLocation = '';
            $stringOriginalLocationCount = 0;
    
            if($td_job_location_all == 1) {
    
                global $redux_demo; 
                for ($i = 0; $i < count($redux_demo['resume-locations']); $i++) {
    
                    if($stringOriginalLocationCount != 0) {
                        $stringOriginalLocationCountPrim = " OR ";
                    } else {
                        $stringOriginalLocationCountPrim = "";
                    }
    
                    $stringOriginalLocation .= $stringOriginalLocationCountPrim."m3.meta_value = '". $redux_demo['resume-locations'][$i] ."'";
    
                    $stringOriginalLocationCount++;
    
                }
    
            } else {
    
                for ($countQ = 0; $countQ < count($td_job_location); $countQ++) { 
    
                    if(!empty($td_job_location[$countQ])) { 
    
                        if($stringOriginalLocationCount != 0) {
                            $stringOriginalLocationCountPrim = " OR ";
                        } else {
                            $stringOriginalLocationCountPrim = "";
                        }
    
                        $stringOriginalLocation .= $stringOriginalLocationCountPrim."m3.meta_value = '". $td_job_location[$countQ] ."'";
    
                        $stringOriginalLocationCount++;
    
                    }
    
                 }
    
            }
    
            if(!empty($stringOriginalLocation)) {
    
                $stringLocation = "AND m3.meta_key = 'job_location'  AND (" . $stringOriginalLocation . ")";
    
            } else {
    
                $stringLocation = "";
    
            }
            // End Job Career Level Filter
    
            // Job Presence Filter
              $job_presence = $_POST['company_presence'];
            $job_presence_all = $_POST['filters_presence_all'];
    
            $stringOriginalPresence = '';
            $stringOriginalPresenceCount = 0;
    
            if($job_presence_all == 1) {
    
                global $redux_demo; 
                for ($i = 0; $i < count($redux_demo['job_presence_type']); $i++) {
    
                    if($stringOriginalPresenceCount != 0) {
                        $stringOriginalPresenceCountPrim = " OR ";
                    } else {
                        $stringOriginalPresenceCountPrim = "";
                    }
    
                    $stringOriginalPresence .= $stringOriginalPresenceCountPrim."m4.meta_value = '". $redux_demo['job_presence_type'][$i] ."'";
    
                    $stringOriginalPresenceCount++;
    
                }
    
            } else {
    
                for ($countQ = 0; $countQ < count($job_presence); $countQ++) { 
    
                    if(!empty($job_presence[$countQ])) { 
    
                        if($stringOriginalPresenceCount != 0) {
                            $stringOriginalPresenceCountPrim = " OR ";
                        } else {
                            $stringOriginalPresenceCountPrim = "";
                        }
    
                        $stringOriginalPresence .= $stringOriginalPresenceCountPrim."m4.meta_value = '". $job_presence[$countQ] ."'";
    
                        $stringOriginalPresenceCount++;
    
                    }
    
                 }
    
            }
    
            if(!empty($stringOriginalPresence)) {
    
                $stringPresence = "AND m4.meta_key = 'job_presence_type'  AND (" . $stringOriginalPresence . ")";
    
            } else {
    
                $stringPresence = "";
    
            }
            // End Job Presence Filter
    
            // Job Experience Years Filter
              $comp_est_year = $_POST['comp_est_year'];
    
            if(!empty($comp_est_year)) {
    
                $stringEstYear = "AND m5.meta_key = 'job_years_of_exp' AND m5.meta_value >= ".$comp_est_year."";
    
            } else {
    
                $stringEstYear = "";
    
            }
            // End Experience Years Filter
    
            // Job Salary Filter
            $comp_min_team = $_POST['comp_min_team'];
            $comp_max_team = $_POST['comp_max_team'];
    
            if(!empty($comp_min_team)) {
    
                $string_comp_min_team = "AND m6.meta_key = 'wpjobus_job_remuneration_raw' AND m6.meta_value >= ".$comp_min_team."";
    
            } else {
    
                $string_comp_min_team = "";
    
            }
    
            if(!empty($comp_max_team)) {
    
                $string_comp_max_team = "AND m7.meta_key = 'wpjobus_job_remuneration_raw' AND m7.meta_value <= ".$comp_max_team."";
    
            } else {
    
                $string_comp_max_team = "";
    
            }
            // End Salary Filter
    
            // Keyword search filter
            $keyword = $_POST['comp_keyword'];
    
            if(!empty($keyword)) {
    
                $stringKeyword = "AND (m11.meta_key = 'wpjobus_job_fullname' AND m11.meta_value LIKE '%" . $keyword . "%')";
    
            } else {
    
                $stringKeyword = "";
    
            }
            // End keyword search filter
    
    
            $wpjobus_companies = $wpdb->get_results( "SELECT DISTINCT p.ID
                                                    FROM  `{$wpdb->prefix}posts` p
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m ON p.ID = m.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m2 ON p.ID = m2.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m3 ON p.ID = m3.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m4 ON p.ID = m4.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m5 ON p.ID = m5.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m6 ON p.ID = m6.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m7 ON p.ID = m7.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m8 ON p.ID = m8.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m9 ON p.ID = m9.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m10 ON p.ID = m10.post_id
                                                    LEFT JOIN  `{$wpdb->prefix}postmeta` m11 ON p.ID = m11.post_id
                                                    WHERE p.post_type =  'job'
                                                    AND p.post_status =  'publish'
                                                    ".$string."
                                                    ".$stringLevel."
                                                    ".$stringLocation."
                                                    ".$stringPresence."
                                                    ".$stringEstYear."
                                                    ".$string_comp_min_team."
                                                    ".$string_comp_max_team."
                                                    ".$stringKeyword."
                                                    ORDER BY  `p`.`ID` DESC");
    
    
    
              if($companies_map_block == 0) {
    
                ?>
    
                <ul id="companies-block-list-ul">
    
                <?php
                             
                foreach($wpjobus_companies as $company) { 
                    $td_total_companies++;
                }
    
                $td_total_pages = ceil($td_total_companies/$td_companies_per_page);
                $current_pos = -1;
                $current_element_id = 0; 
    
                foreach($wpjobus_companies as $q) { 
    
                    $current_pos++;
    
                    if($td_current_page == 1) {
                        $start_loop = 0;
                    } else {
                        $start_loop = ($td_current_page - 1) * $td_companies_per_page;
                    }
    
                    $end_loop = $td_current_page * $td_companies_per_page;
    
                    if($current_pos >= $start_loop && $current_pos <= ($end_loop-1)) {
    
                        $current_element_id++;
    
                        $company_id = $q->ID;
    
                        $td_result_company_date = get_the_date("Y-m-d h:m:s", $company_id );
                                           
                        $wpjobus_job_fullname = esc_attr(get_post_meta($company_id, 'wpjobus_job_fullname',true));
    
                        $wpjobus_job_longitude = get_post_meta($company_id, 'wpjobus_job_longitude',true);
                        $wpjobus_job_latitude = get_post_meta($company_id, 'wpjobus_job_latitude',true);
    
                        $td_job_company = esc_attr(get_post_meta($company_id, 'job_company',true));
                        $wpjobus_company_fullname = esc_attr(get_post_meta($td_job_company, 'wpjobus_company_fullname',true));
                        $wpjobus_company_profile_picture = esc_attr(get_post_meta($td_job_company, 'wpjobus_company_profile_picture',true));
    
                        $td_job_location = esc_attr(get_post_meta($company_id, 'job_location',true));
    
                ?> 
    
                        <li id="<?php echo $current_element_id; ?>">
    
                            <a href="<?php $companylink = home_url('/')."listing/".$company_id; echo $companylink; ?>">
    
                                <div class="company-holder-block">
    
                                    <span class="company-list-icon">
                                        <span class="helper"></span>
                                        <img src="<?php echo $wpjobus_company_profile_picture; ?>" alt="<?php echo $wpjobus_job_fullname; ?>" />
                                    </span>
    
                                    <span class="company-list-name-block" style="max-width: 380px;">
                                        <span class="company-list-name"><?php echo $wpjobus_job_fullname; ?></span>
                                        <span class="company-list-location"><i class="fa fa-briefcase"></i><?php echo $wpjobus_company_fullname; ?><i class="fa fa-map-marker" style="margin-left: 10px;"></i><?php echo $td_job_location; ?><i class="fa fa-calendar-o" style="margin-left: 10px;"></i><?php echo human_time_diff( strtotime($td_result_company_date), current_time('timestamp') ) . ' '; _e( 'ago', 'themesdojo' ); ?>
                                        </span>
                                    </span>
    
                                    <span class="company-list-view-profile">
    
                                        <span class="company-view-profile">
                                            <span class="company-view-profile-title-holder">
                                                <span class="company-view-profile-title"><?php _e( 'View', 'themesdojo' ); ?></span>
                                                <span class="company-view-profile-subtitle"><?php _e( 'Job Offer', 'themesdojo' ); ?></span>
                                            </span>
                                            <i class="fa fa-eye"></i>
                                        </span>
    
                                    </span>
    
                                    <span class="company-list-badges" style="margin-top: 19px;">
    
                                        <?php
    
                                            global $redux_demo;
                                            $colorState = 0;
    
                                            if(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][0] ) {
                                                $colorState = 1;
                                                $color = "#16a085";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][1] ) {
                                                $colorState = 1;
                                                $color = "#3498db";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][2] ) {
                                                $colorState = 1;
                                                $color = "#e74c3c";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][3] ) {
                                                $colorState = 1;
                                                $color = "#1abc9c";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][4] ) {
                                                $colorState = 1;
                                                $color = "#8e44ad";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][5] ) {
                                                $colorState = 1;
                                                $color = "#9b59b6";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][6] ) {
                                                $colorState = 1;
                                                $color = "#34495e";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][7] ) {
                                                $colorState = 1;
                                                $color = "#e67e22";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][8] ) {
                                                $colorState = 1;
                                                $color = "#e74c3c";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][9] ) {
                                                $colorState = 1;
                                                $color = "#16a085";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][10] ) {
                                                $colorState = 1;
                                                $color = "#2980b9";
                                            } elseif(($wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true)) == $redux_demo['job-type'][11] ) {
                                                $colorState = 1;
                                                $color = "#2ecc71";
                                            }
    
                                        ?>
    
                                        <span class="job-offers-post-badge" style="max-width: 220px; <?php if($colorState ==1) { ?>background-color: <?php echo $color; ?>; border: solid 2px <?php echo $color; ?>;<?php } ?>">
                                            <span class="job-offers-post-badge-job-type" style="width: 110px; <?php if($colorState ==1) { ?>color: <?php echo $color; ?>;<?php } ?>"><?php echo $wpjobus_job_type = get_post_meta($company_id, 'wpjobus_job_type',true); ?></span>
                                            <span class="job-offers-post-badge-amount"><?php echo $wpjobus_job_remuneration = get_post_meta($company_id, 'wpjobus_job_remuneration',true); ?></span>
                                            <span class="job-offers-post-badge-amount-per">/<?php echo $wpjobus_job_remuneration_per = get_post_meta($company_id, 'wpjobus_job_remuneration_per',true); ?></span>
                                        </span>
    
                                    </span>
    
                                </div>
    
                            </a>
    
                        </li>
    
                    <?php } } ?>
    
                </ul>
    
                <?php if($current_element_id == 0) { ?>
    
                    <div class="full"><h4><?php _e( 'Well, it looks like there are no results matching your criterias.', 'themesdojo' ); ?></h4></div>
    
                <?php }
    
                if($td_total_pages > 1) {  
    
                    $wpcook_pagination = array(
                         'base' => @add_query_arg('page','%#%'),
                         'format' => '',
                         'total' => $td_total_pages,
                         'current' => $td_current_page,
                         'prev_next' => true,
                         'prev_text'    => __('« Previous', 'themesdojo'),
                         'next_text'    => __('Next »', 'themesdojo'),
                         'type' => 'plain',
                         );
    
                    $wpcook_pagination['base'] = '#%#%';
    
                    if( !empty($wp_query->query_vars['s']) )
                        $wpcook_pagination['add_args'] = array('s'=>get_query_var('s'));
    
                        echo '<div class="pagination">' . paginate_links(esc_url_raw($wpcook_pagination)) . '</div>'; 
                }
    
                $response = ob_get_contents();
    
            } elseif($companies_map_block == 1) {
    
                ?>
    
                <script type="text/javascript">
                var mapDiv,
                    map,
                    infobox;
                jQuery(document).ready(function($) {
    
                    mapDiv = $("#wpjobus-main-map");
                    mapDiv.height(500).gmap3({
                        map: {
                            options: {
                                "draggable": true
                                ,"mapTypeControl": true
                                ,"mapTypeId": google.maps.MapTypeId.ROADMAP
                                ,"scrollwheel": false
                                ,"panControl": true
                                ,"rotateControl": false
                                ,"scaleControl": true
                                ,"streetViewControl": true
                                ,"zoomControl": true
                                <?php global $redux_demo; $map_style = $redux_demo['map-style']; if(!empty($map_style)) { ?>,"styles": <?php echo $map_style; ?> <?php } ?>
                            }
                        }
                        ,marker: {
                            values: [
    
                <?php
                             
                foreach($wpjobus_companies as $company) { 
                    $td_total_companies++;
                }
    
                $td_total_pages = ceil($td_total_companies/$td_companies_per_page);
                $current_pos = -1;
                $current_element_id = 0; 
    
                foreach($wpjobus_companies as $q) { 
    
                    $current_pos++;
    
                    if($td_current_page == 1) {
                        $start_loop = 0;
                    } else {
                        $start_loop = ($td_current_page - 1) * $td_companies_per_page;
                    }
    
                    $end_loop = $td_current_page * $td_companies_per_page;
    
                    if($current_pos >= $start_loop && $current_pos <= ($end_loop-1)) {
    
                        $current_element_id++;
    
                        $company_id = $q->ID;
    
                        $td_result_company_date = $q->post_date;
                                           
                        $wpjobus_job_fullname = esc_attr(get_post_meta($company_id, 'wpjobus_job_fullname',true));
    
                        $td_job_company = esc_attr(get_post_meta($company_id, 'job_company',true));
                        $wpjobus_company_fullname = esc_attr(get_post_meta($td_job_company, 'wpjobus_company_fullname',true));
                        $wpjobus_company_profile_picture = esc_attr(get_post_meta($td_job_company, 'wpjobus_company_profile_picture',true));
    
                        $td_job_location = esc_attr(get_post_meta($company_id, 'job_location',true));
    
                        $iconPath = get_template_directory_uri() .'/images/icon-job.png';
    
                        $wpjobus_job_longitude = get_post_meta($company_id, 'wpjobus_job_longitude',true);
                        $wpjobus_job_latitude = get_post_meta($company_id, 'wpjobus_job_latitude',true);
    
                        if(!empty($wpjobus_job_longitude)) {
    
                ?> 
    
                        {
    
                        latLng: [<?php echo $wpjobus_job_latitude; ?>,<?php echo $wpjobus_job_longitude; ?>],
                        options: {
                            icon: "<?php echo $iconPath; ?>",
                            shadow: "<?php echo get_template_directory_uri() ?>/images/shadow.png",
                        },
                        data: '<div class="marker-holder"><div class="marker-content"><div class="marker-image"><span class="helper"></span><img src="<?php echo $wpjobus_company_profile_picture; ?>" /></div><div class="marker-info-holder"><div class="marker-info"><div class="marker-info-title"><?php echo $wpjobus_job_fullname; ?></div><div class="marker-info-link"><a href="<?php $companylink = home_url('/')."listing/".$company_id; echo $companylink; ?>"><?php _e( "View Job Offer", "themesdojo" ); ?></a></div></div></div><div class="arrow-down"></div><div class="close"></div></div></div>'
    
                    }
                ,
    
                    <?php } } } ?>
    
                ],
                            options:{
                                draggable: false
                            },
                            cluster:{
                                radius: 20,
                                // This style will be used for clusters with more than 0 markers
                                0: {
                                    content: "<div class='cluster cluster-1'>CLUSTER_COUNT</div>",
                                    width: 62,
                                    height: 62
                                },
                                // This style will be used for clusters with more than 20 markers
                                20: {
                                    content: "<div class='cluster cluster-2'>CLUSTER_COUNT</div>",
                                    width: 82,
                                    height: 82
                                },
                                // This style will be used for clusters with more than 50 markers
                                50: {
                                    content: "<div class='cluster cluster-3'>CLUSTER_COUNT</div>",
                                    width: 102,
                                    height: 102
                                },
                                events: {
                                    click: function(cluster) {
                                        map.panTo(cluster.main.getPosition());
                                        map.setZoom(map.getZoom() + 2);
                                    }
                                }
                            },
                            events: {
                                click: function(marker, event, context){
                                    map.panTo(marker.getPosition());
    
                                    var ibOptions = {
                                       pixelOffset: new google.maps.Size(-125, -88),
                                       alignBottom: true
                                    };
    
                                    infobox.setOptions(ibOptions)
    
                                    infobox.setContent(context.data);
                                    infobox.open(map,marker);
    
                                    // if map is small
                                    var iWidth = 260;
                                    var iHeight = 300;
                                    if((mapDiv.width() / 2) < iWidth ){
                                        var offsetX = iWidth - (mapDiv.width() / 2);
                                        map.panBy(offsetX,0);
                                    }
                                    if((mapDiv.height() / 2) < iHeight ){
                                        var offsetY = -(iHeight - (mapDiv.height() / 2));
                                        map.panBy(0,offsetY);
                                    }
    
                                }
                            }
                        }
                    },"autofit");
    
                    map = mapDiv.gmap3("get");
                   infobox = new InfoBox({
                      pixelOffset: new google.maps.Size(-50, -65),
                      closeBoxURL: '',
                      enableEventPropagation: true
                   });
                   mapDiv.delegate('.infoBox .close','click',function () {
                      infobox.close();
                   });
    
                   if (Modernizr.touch){
                      map.setOptions({ draggable : false });
                       var draggableClass = 'inactive';
                       var draggableTitle = "Activate map";
                       var draggableButton = $('<div class="draggable-toggle-button '+draggableClass+'">'+draggableTitle+'</div>').appendTo(mapDiv);
                       draggableButton.click(function () {
                          if($(this).hasClass('active')){
                              $(this).removeClass('active').addClass('inactive').text("Activate map");
                              map.setOptions({ draggable : false });
                          } else {
                              $(this).removeClass('inactive').addClass('active').text("Deactivate map");
                              map.setOptions({ draggable : true });
                          }
                       });
                   }
    
                });
                </script>
    
                <?php
    
                $response = ob_get_contents();
            }
    
    
        } else {
    
            $response = 0;
    
          }
    
          die(); // this is required to return a proper result
    
    }
    add_action( 'wp_ajax_wpjobusSubmitJobsFilter', 'wpjobusSubmitJobsFilter' );
    add_action( 'wp_ajax_nopriv_wpjobusSubmitJobsFilter', 'wpjobusSubmitJobsFilter' );
    
    
    Code (markup):
    Thank you for any help provided
     
    Solved! View solution.
    locals, Nov 14, 2015 IP
    SEMrush
  2. imuncutno1

    imuncutno1 Well-Known Member

    Messages:
    603
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    170
    #2
    Hi there,
    I don't know what is this...
    However, I never have such a problem because I unzipped a zip file inside a folder.
    A folder opened once you unzipped, you need to unzip second time or third time. Just to make sure no zip file is left in a folder.
    Suggest to check whether the same.
    Have a great day!
     
    imuncutno1, Nov 14, 2015 IP
  3. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #3
    wow, okay... this was great help for something. But sadly, your answer has nothing to do with php and I obviously knew how to get the file out of a zip because it has already been uploaded/installed
     
    locals, Nov 14, 2015 IP
  4. imuncutno1

    imuncutno1 Well-Known Member

    Messages:
    603
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    170
    #4
    Ok, just see how.
    But I also sometimes do a Googling by pasting this into Google Search.
    Warning: Cannot modify header information - headers already sent by (output started at /home/.../inc/jobs-filters.php:1
    Hopefully, experts are able to help from here.
     
    imuncutno1, Nov 14, 2015 IP
  5. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #5
    Thank you... I also have 3x as many postings as you and have also referred people to google over the last 10 years of being on this forum. Please stop getting your post count up with worthless posts. Thank you.
     
    locals, Nov 14, 2015 IP
  6. #6
    Hi
    The only thing I could think of is "probably" because you've edited the file with an text-editor which auto adds a BOM to it?
     
    hdewantara, Nov 14, 2015 IP
    locals likes this.
  7. ketting00

    ketting00 Well-Known Member

    Messages:
    754
    Likes Received:
    27
    Best Answers:
    3
    Trophy Points:
    128
    #7
    Problem like this mostly has to do with the session. It hard to tell unless you check all the functions involved, for wordpress typically check your functions.php file. It may be in other files as well.

    And if I were to write those codes I would rewrite elseif statement to switch statement. It helps you understand what are you trying to do better.

    For loops are slow, try to use them sparingly.

    Just my 2 cents.
     
    ketting00, Nov 15, 2015 IP
    locals likes this.
  8. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #8
    Thanks HD, I read something about saving files and them adding the BOM thing, but I just use filezilla and notepad.

    Ketting, I agree with you, I think I have narrowed it down to do with the code below, but I don't understand what exactly these do or how to copy and paste what I need to in order to get around the error.


    
    
       ob_start();
    
    ob_get_contents();
    
    
    Code (markup):
     
    locals, Nov 15, 2015 IP
  9. kk5st

    kk5st Prominent Member

    Messages:
    3,499
    Likes Received:
    377
    Best Answers:
    29
    Trophy Points:
    335
    #9
    Notepad may be adding the BOM. If the character encoding is 'Unicode', it does (or did when I was silly enough to run Win). Set the character encoding to 'utf-8', which should work correctly.
     
    kk5st, Nov 16, 2015 IP
    locals likes this.
  10. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #10
    Thank you, let me try this
     
    locals, Nov 16, 2015 IP
  11. ketting00

    ketting00 Well-Known Member

    Messages:
    754
    Likes Received:
    27
    Best Answers:
    3
    Trophy Points:
    128
    #11
    Interesting, @locals can you tell us the result.

    I save data as unicode encoding with Notepad from time to time. This was done when I encode my javascript in utf-16. It works fine so far.
     
    ketting00, Nov 16, 2015 IP
  12. kk5st

    kk5st Prominent Member

    Messages:
    3,499
    Likes Received:
    377
    Best Answers:
    29
    Trophy Points:
    335
    #12
    The BOM is only troublesome in older IEs, or maybe new also, due to it kicking IE into quirks mode where it acts as if it were IE≤6.

    The BOM should cause no issues for js files. You do keep your javascript out of the html, right?

    //edit: Why would you use utf-16 anyway? Not criticizing, just wondering. ~g

    cheers,

    gary
     
    kk5st, Nov 16, 2015 IP
  13. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #13
    OKAY!! Thank you to EVERYONE who helped me get through this. I am able to use this wonderful theme now that the files are being saved "properly"

    How I narrowed it down, besides with using everyone's help that posted to this thread, I simply saved the file after only adding the word "TEST" to "Job Offer" so I wasn't changing any real code, well when it gave me the error, I knew it was how the file was being saved, just like how everyone had mentioned.

    I have to be honest, I was a little against the idea that it could be how the file was being saved after closing out the changed file and saving it using filezilla and notepad. Because there has never been a problem before (in 12 years), but something was doing it.

    It turns out that there is absolutely nothing wrong with the file or files for the theme. But for some reason, this particular file has to be saved as ANSI.

    So what I did was dragged it to desktop, edited the file, and then clicked save as - the first time I tried UNICODE because it was already on UTF-8 and UNICODE gave me a bunch of Chinese letters, so next I saved it as ANSI and uploaded it into filezilla... and what do you know?? I do not have any issues with the HEADERS ALREADY SENT and the website is working PERFECTLY with my additions and changes.

    Thank you to everyone who assisted me with getting this fixed!

    Thank you to both of you, you both were right on target.

     
    Last edited by a moderator: Aug 9, 2017
    locals, Nov 16, 2015 IP
  14. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,635
    Likes Received:
    1,971
    Best Answers:
    249
    Trophy Points:
    515
    #14
    It's why I stopped using notepad and switched between replacements; first I used win32pad, but it has some issues with character encodings, I've tried notepad++, editplus, crimson editor, etc, etc... but I've finally settled on Flo's Notepad 2.

    http://www.flos-freeware.ch/notepad2.html

    It adds JUST enough functionality like proper control of character encoding and newline methodology, without bloating it out with features I don't want (like "live editing" or tabbed editing) or at least lets me turn off things that just plain piss me off (like the illegible acid trip known as colour syntax highlighting).

    Oh, and since you mentioned filezilla, some advice? LOCK that bugger into binary transfers only. The ASCII or auto-detect WILL bite you in the ass sooner or later. (edit->settings->transfers->file types->default transfer type)

    Usually when you have a "headers already sent" error you need to look for ANYTHING that's an echo or even just blank lines before the <?php that contains your header calls. Even a newline before the <?php can trip this problem as that counts as output. In this case you had the hardest of them all to track down; someone set you up the BOM.

    Of course being turdpress (I'm assuming with that home_url nonsense) it's wasting time doing things that probably shouldn't have been done in the first place -- all part of it's "insecure by design" methodology and why it even bit you in the backside in the first place.
     
    deathshadow, Nov 16, 2015 IP
  15. ketting00

    ketting00 Well-Known Member

    Messages:
    754
    Likes Received:
    27
    Best Answers:
    3
    Trophy Points:
    128
    #15
    The reason is purely saving space. As @locals experienced the compressed data appears as Chinese characters.

    The JS file compressed as UTF-16 are more compact than you minifying UTF-8 characters. The decode is as fast as normal execution.

    I do this when I want to process and send huge data at fastest speed possible or obfuscate my code.

    I do not do the obfuscate now since I mostly store script on the server and load it dynamically and now that http2/nginx allows continuous bidirectional data flow. [in beta stage]
     
    ketting00, Nov 16, 2015 IP
    deathshadow likes this.
  16. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,635
    Likes Received:
    1,971
    Best Answers:
    249
    Trophy Points:
    515
    #16
    Yup, as nice as UTF-8 is for languages based on latin characters, particularly if the majority of your content can be stated in the bottom 7 bits of ASCII, the moment you get into 90% of your characters being 3 or even 4 bytes in length as UTF-8, that's why UTF-16 is the wiser choice as it can be a 33% to 50% reduction in document size.... just as when if all your text is English and fits into ASCII7, UTF-8 is half the size of UTF-16.
     
    deathshadow, Nov 16, 2015 IP
  17. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #17
    @deathshadow what exactly does this mean in laymans terms :D
    does this allow brute force attacks on my files??
     
    locals, Nov 16, 2015 IP
  18. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,635
    Likes Received:
    1,971
    Best Answers:
    249
    Trophy Points:
    515
    #18
    Nothing of the sort -- There are two major transfer types in FTP, 7 bit and 8 bit. The older 7 bit format, often called "ASCII" only supports the bottom 7 bits of the character set. In THEORY filezilla has proper auto-detection of this but I've had it fail once or twice. IF it fails the result can be catastrophic if you are actually using characters outside those first 128 ASCII characters as it will completely mangle the file. The 8 bit "binary" method is always safe. Though it IS a hair slower...

    I've also had the ASCII settiing change the line-feed methodology of files. PROPER files should have CR/LF, but older Mac files are LF only, older PC files are CR only -- it's a headache.

    If you force it to binary instead of auto, it will leave the original file intact an not try to play with or restrict the values of things. Honestly the non-binary setting REALLY should have stopped existing the day we stopped trying to send things to DEC mainframes.

    Just be thankful we don't have to play with 6 or 18 bit character encoding anymore. Those were fun times... Translating Dec sixbit to ASCII and vice-versa. Laughably DEC six-bit character encoding and limitations is why e-mails still use base64, and why people who call base64 a "native" format or prefer it for communcations are pretty much full of ****; it's a relic from the 1970's, not some bleeding edge communication or encryption tech. It's called base64 not because it's 64 bit, but because you are encoding your 8 bit data in a 6 bit (64 value) namespace.

    Security / attack prevention has nothing to do with it, forcing binary just makes it less likely filezilla will mangle existing text files. If you ever deal with text files written on older macs, load and save on PC then load on mac and boom, there's twice as many line-feeds, that's your most likely culprit.

    Can drive you nuts if you don't know why it's happening, and it's better to just avoid that headache in the first place.
     
    Last edited: Nov 16, 2015
    deathshadow, Nov 16, 2015 IP
  19. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #19
    I see, thank you for the well informed explanation of what was referenced. I was able to learn something and it even made me laugh a couple times.

    Thanks again.
     
    locals, Nov 17, 2015 IP
  20. locals

    locals Well-Known Member

    Messages:
    1,677
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    153
    #20
    Okay I am back, can someone help me add an "Else" part to this "If" part? I am having trouble because it is made into 2 parts and I am a little confused as to where I can fit some code in.

    
    <input type="checkbox" name="job-categories[<?php echo $i; ?>]" value="<?php echo $redux_demo['resume-industries'][$i]; ?>" style="float: left; width: auto;" <?php if(!empty($user_job_categories)) { if (in_array($redux_demo['resume-industries'][$i], $user_job_categories[0])) { ?> checked="checked" <?php } } ?> ><?php echo $redux_demo['resume-industries'][$i]; ?>
    
    Code (markup):
    The error I am getting is:
    
    Warning: in_array() expects parameter 2 to be array, string given in
    
    Code (markup):

    If the box is checked, everything is fine... if it is not fixed I get this error. I have also tried to add $strict = FALSE but that does not work.


    thanks again!
     
    locals, Nov 18, 2015 IP