function __construct()
 {
     $this->options = WPSEO_Options::get_all();
     global $ect_wpseo_front, $easy_translation_manager_plugin;
     $default_languash = etm_tools_retrive_options('default_language');
     if ($easy_translation_manager_plugin->show_lang_status and $easy_translation_manager_plugin->selectede_lang != $default_languash) {
         $this->selectede_lang = $easy_translation_manager_plugin->selectede_lang;
     }
     if ($this->selectede_lang != '') {
         add_action('wp_head', array($this, 'head'), 1);
         add_filter('wp_title', array($this, 'title'), 20, 3);
         add_filter('thematic_doctitle', array($this, 'title'), 20);
     }
 }
 function pop_handle_save11($temp)
 {
     $values = array();
     $get_option_data = etm_tools_retrive_options();
     if (!empty($_POST) && (empty($_POST['default_language']) || empty($_POST['lang_' . $_POST['default_language']]))) {
         foreach ($_POST as $tmp_key => $tmp_data) {
             if (isset($_POST[$tmp_key]) && !empty($_POST[$tmp_key]) && !empty($tmp_data) && substr($tmp_key, 0, 5) == 'lang_' && strlen($tmp_key) == 7) {
                 if (!in_array(substr($tmp_key, -2), $values)) {
                     $get_option_data['default_language'] = substr($tmp_key, -2);
                     break;
                 }
             }
         }
     }
     if (empty($_POST['default_language_wp_etm']) || empty($_POST['lang_' . $_POST['default_language_wp_etm']])) {
         $get_option_data['default_language_wp_etm'] = $get_option_data['default_language'];
     }
     if (isset($_POST['flag_sort']) && !empty($_POST['flag_sort'])) {
         $values = $_POST['flag_sort'];
         foreach ($values as $tmp_key => $tmp_data) {
             if (isset($_POST['lang_' . $tmp_data]) && empty($_POST['lang_' . $tmp_data])) {
                 unset($values[$tmp_key]);
             }
         }
         $values = array_values($values);
         foreach ($_POST as $tmp_key => $tmp_data) {
             if (isset($_POST[$tmp_key]) && !empty($_POST[$tmp_key]) && substr($tmp_key, 0, 5) == 'lang_') {
                 if (!in_array(substr($tmp_key, -2), $values)) {
                     $values[] = substr($tmp_key, -2);
                 }
             }
         }
         $values = array_values($values);
         $get_option_data['flag_sort'] = $values;
     }
     if (isset($_POST['domain_list']) && !empty($_POST['domain_list'])) {
         $get_domain_list = $_POST['domain_list'];
         $return_array = array();
         foreach ($get_domain_list as $tmp_key => $tmp_data) {
             if (isset($_POST['lang_' . $tmp_key]) && !empty($_POST['lang_' . $tmp_key])) {
                 $return_array[$tmp_data] = $tmp_key;
             }
         }
         $get_option_data['domain_list_fast'] = $return_array;
     }
     update_option('etm_options', $get_option_data);
 }
 function __construct()
 {
     global $wpseo_front, $easy_translation_manager_plugin;
     $options = get_wpseo_options();
     $default_languash = etm_tools_retrive_options('default_language');
     if ($easy_translation_manager_plugin->show_lang_status and $easy_translation_manager_plugin->selectede_lang != $default_languash) {
         $this->selectede_lang = $easy_translation_manager_plugin->selectede_lang;
     }
     if ($this->selectede_lang != '') {
         remove_action('wp_head', array($wpseo_front, 'head'), 1, 1);
         remove_filter('wp_title', array($wpseo_front, 'title'), 10, 3);
         add_action('wp_head', array(&$this, 'head'), 1, 1);
         add_filter('wp_title', array(&$this, 'title'), 10, 3);
         if (isset($options['forcerewritetitle']) && $options['forcerewritetitle']) {
             remove_action('wp_footer', array($wpseo_front, 'flush_cache'));
             add_action('wp_footer', array(&$this, 'flush_cache'));
         }
     }
 }
function etm_when_wp_is_loaded()
{
    global $wpdb, $userdata, $wpseo_sitemaps;
    $wp_version_is_3_3 = etm_tools_version_check();
    $Header2 = '';
    $button2 = '';
    if (!empty($_REQUEST['status']) && $_REQUEST['status'] == 'save') {
        update_post_meta($_REQUEST['tmp_id'], 'ect_tran_content_' . $_REQUEST['tmp_lang'], $_REQUEST['translatede_body']);
        update_post_meta($_REQUEST['tmp_id'], 'ect_tran_title_' . $_REQUEST['tmp_lang'], $_REQUEST['translatede_header']);
        update_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_focuskw_' . $_REQUEST['tmp_lang'], $_REQUEST['tran_focuskw']);
        update_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_title_' . $_REQUEST['tmp_lang'], $_REQUEST['tran_title']);
        update_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_metadesc_' . $_REQUEST['tmp_lang'], $_REQUEST['tran_metadesc']);
        if (substr($_REQUEST['tran_permalink'], -1) != '/') {
            $_REQUEST['tran_permalink'] .= '/';
        }
        update_post_meta($_REQUEST['tmp_id'], 'ect_tran_permalink_' . $_REQUEST['tmp_lang'], $_REQUEST['tran_permalink']);
        update_post_meta($_REQUEST['tmp_id'], 'etm_content_excerpts_' . $_REQUEST['tmp_lang'], $_REQUEST['content_excerpts']);
        update_post_meta($_REQUEST['tmp_id'], 'etm_attachment_image_alt_' . $_REQUEST['tmp_lang'], $_REQUEST['attachment_image_alt']);
        $response = array('R' => 'OK', 'MSG' => 'Your translation has been saved.', 'INFOCON' => 1);
    } else {
        if (!empty($_REQUEST['status']) && $_REQUEST['status'] == 'delete') {
            delete_post_meta($_REQUEST['tmp_id'], 'ect_tran_content_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], 'ect_tran_title_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_focuskw_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_title_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_metadesc_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], 'ect_tran_permalink_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], 'etm_content_excerpts_' . $_REQUEST['tmp_lang']);
            delete_post_meta($_REQUEST['tmp_id'], 'etm_attachment_image_alt_' . $_REQUEST['tmp_lang']);
            $response = array('R' => 'OK', 'MSG' => 'Translation has been deleted');
        } else {
            $content = '';
            $sqldatalang = etm_languages_flags($_REQUEST['tmp_lang']);
            $langed_string = '<img style="float: left;padding-left: 10px;padding-top: 4px;" src="' . etm_tools_create_icons_url($sqldatalang['icon'], 2) . '" ><div style="float: left; padding-left: 10px; padding-top: 3px;"><h2 style="padding-top:0px">Translate to ' . $sqldatalang['org_name'] . ' (' . $sqldatalang['english_name'] . ')</h2></div>';
            $translations_header = get_post_meta($_REQUEST['tmp_id'], 'ect_tran_title_' . $_REQUEST['tmp_lang'], true);
            $translations_body = get_post_meta($_REQUEST['tmp_id'], 'ect_tran_content_' . $_REQUEST['tmp_lang'], true);
            $default_permalink = get_permalink($_REQUEST['tmp_id']);
            $ect_tran_permalink = get_post_meta($_REQUEST['tmp_id'], 'ect_tran_permalink_' . $_REQUEST['tmp_lang'], true);
            if (empty($translations_header)) {
                $translations_header = '';
            }
            if (empty($translations_body)) {
                $translations_body = '';
            }
            if ($wp_version_is_3_3) {
                $post_data = get_post($_REQUEST['tmp_id']);
            } else {
                $post_data = wp_get_single_post($_REQUEST['tmp_id']);
            }
            $default_header = $post_data->post_title;
            $default_body = $post_data->post_content;
            if ((!empty($default_header) || !empty($default_body)) && (current_user_can('etm_translate_' . $_REQUEST['tmp_type']) || current_user_can('manage_options'))) {
                $content .= '<div style="float:left;padding-top:10px"><input type="submit" onClick="deletePopOpControl(\'' . $_REQUEST['tmp_id'] . '\',\'' . $_REQUEST['tmp_lang'] . '\',\'' . $_REQUEST['tmp_type'] . '\')" value="Delete" class="button-secondary" name="Delete"></div>';
            }
            $content .= '<div style="float:right;padding-top:10px">';
            if (!etm_tools_version_check()) {
                $content .= '<input type="submit" value="HTML MODE" onclick="switch_html_preview(\'pp_readonly_content\',\'pp_translate_content\',this);" class="button-secondary">';
            }
            //Seo system
            $seo_plugin_by_yoast = etm_tools_retrive_options('seo_plugin_by_yoast');
            if (defined('WPSEO_VERSION') && !empty($seo_plugin_by_yoast)) {
                $content .= '<input style=" margin-left: 5px;margin-right: 20px;" type="submit" onClick="etm_switch_seo(\'#etm_table_1\',\'#etm_table_2\')" value="SEO" class="button-primary">';
                $button2 = '<input style="float:right;margin-left: 5px;" type="submit" onClick="etm_switch_seo(\'#etm_table_2\',\'#etm_table_1\')" value="Back" class="button-primary">';
                $Header2 = '<img style="float: left;padding-left: 10px;padding-top: 4px;" src="' . etm_tools_create_icons_url($sqldatalang['icon'], 2) . '" ><div style="float: left; padding-left: 10px; padding-top: 3px;"><h2 style="padding-top:0px">SEO to ' . $sqldatalang['org_name'] . ' (' . $sqldatalang['english_name'] . ')</h2></div>';
            }
            $_yoast_wpseo_focuskw = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_focuskw', true);
            $_yoast_wpseo_title = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_title', true);
            $_yoast_wpseo_metadesc = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_metadesc', true);
            $_tran_focuskw = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_focuskw_' . $_REQUEST['tmp_lang'], true);
            $_tran_title = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_title_' . $_REQUEST['tmp_lang'], true);
            $_tran_metadesc = get_post_meta($_REQUEST['tmp_id'], '_yoast_wpseo_metadesc_' . $_REQUEST['tmp_lang'], true);
            // Extra system
            $content .= '<input style=" margin-left: 5px;margin-right: 20px;" type="submit" onClick="etm_switch_seo(\'#etm_table_1\',\'#etm_table_3\')" value="Extra " class="button-primary">';
            $button3 = '<input style="float:right;margin-left: 5px;" type="submit" onClick="etm_switch_seo(\'#etm_table_3\',\'#etm_table_1\')" value="Back" class="button-primary">';
            $Header3 = '<img style="float: left;padding-left: 10px;padding-top: 4px;" src="' . etm_tools_create_icons_url($sqldatalang['icon'], 2) . '" ><div style="float: left; padding-left: 10px; padding-top: 3px;"><h2 style="padding-top:0px">Extra to ' . $sqldatalang['org_name'] . ' (' . $sqldatalang['english_name'] . ')</h2></div>';
            $post_default_content_excerpts = $post_data->post_excerpt;
            $post_default_media_alternate_text = get_post_meta($_REQUEST['tmp_id'], '_wp_attachment_image_alt', true);
            $post_translatede_content_excerpts = get_post_meta($_REQUEST['tmp_id'], 'etm_content_excerpts_' . $_REQUEST['tmp_lang'], true);
            $post_translatedet_media_alternate_text = get_post_meta($_REQUEST['tmp_id'], 'etm_attachment_image_alt_' . $_REQUEST['tmp_lang'], true);
            $content .= '<input style=" margin-left: 5px;margin-right: 20px;" type="submit" onClick="copiePopOpControl(\'#post_default_header\',\'#post_translatede_header\')" value="Copy text" class="button-secondary" name="Cancel"><input type="submit" onClick="cancelPopOpControl()" value="Cancel" class="button-secondary" name="Cancel">';
            if (current_user_can('etm_translate_' . $_REQUEST['tmp_type']) || current_user_can('manage_options')) {
                $content .= '<input onClick="savePopOpControl(\'' . $_REQUEST['tmp_id'] . '\',\'' . $_REQUEST['tmp_lang'] . '\',\'#translations_inputtext\',\'' . $_REQUEST['tmp_type'] . '\',\'#post_translatede_header\',\'#translatede_body\')" type="submit" class="button-primary" value="Save" name="Save">';
            }
            $content .= '</div>';
            $tmp = etm_languages_flags($_REQUEST['tmp_lang']);
            if (!empty($tmp['rtl']) && $tmp['rtl']) {
                $dir = 'rtl';
            } else {
                $dir = 'ltr';
            }
            $response = array('R' => 'OK', 'DIR' => $dir, 'RETURNDATA' => $content, 'langed_string' => $langed_string, 'default_header' => $default_header, 'translations_header' => $translations_header, 'default_body' => $default_body, 'translations_body' => $translations_body, 'buttons' => $content, 'buttons2' => $button2, 'yoast_wpseo_focuskw' => $_yoast_wpseo_focuskw, 'yoast_wpseo_title' => $_yoast_wpseo_title, 'yoast_wpseo_metadesc' => $_yoast_wpseo_metadesc, 'tran_focuskw' => $_tran_focuskw, 'tran_title' => $_tran_title, 'tran_metadesc' => $_tran_metadesc, 'default_heade2' => $Header2, 'tran_permalink' => $ect_tran_permalink, 'default_permalink' => $default_permalink, 'header_extra_post' => $Header3, 'post_default_content_excerpts' => $post_default_content_excerpts, 'post_translatede_content_excerpts' => $post_translatede_content_excerpts, 'post_default_media_alternate_text' => $post_default_media_alternate_text, 'post_translatedet_media_alternate_text' => $post_translatedet_media_alternate_text, 'post_buttons3' => $button3);
        }
    }
    die(json_encode($response));
}
} else {
    if (!empty($post_type_array['single_list_function']) && function_exists($post_type_array['single_list_function'])) {
        $data_array = $post_type_array['single_list_function'];
    }
}
$obj_data = (object) array();
$obj_data->interval = etm_tools_retrive_options('limit_interval');
$obj_data->page = 0;
$obj_data->sort_col = etm_tools_retrive_options('sort_single_list_' . $etm_tag);
$obj_data->sort_dir = etm_tools_retrive_options('sort_single_list_direction_' . $etm_tag);
$obj_data->retrive_fn = $data_array;
$obj_data->etm_folder = $etm_folder;
$obj_data->post_tag = $etm_tag;
$createTable = new unrealhuman_shower();
$createTable->setup_table($obj_data);
if (etm_tools_retrive_options('hide_auther') and !empty($post_type_array['etm_columns_single'])) {
    foreach ($post_type_array['etm_columns_single'] as $key => $tmp_data) {
        if ($tmp_data['backtitle'] == 'auther') {
            $post_type_array['etm_columns_single'][$key]['backtitle'] = 'autherDeativate';
        }
    }
}
if (count($check_pieces) > 0 && $check_pieces[0] == 'meta') {
    $createTable->set_table_data($post_type_array['etm_columns_meta'], $data_array);
} else {
    $createTable->set_table_data($post_type_array['etm_columns_single'], $data_array);
    $createTable->setup_seach_bar(0, $check_pieces[0], $check_pieces[0], false, $_POST['sort_type'], $_POST['sort_dir']);
}
if (!empty($post_type_array['etm_button_single_function'])) {
    $createTable->set_button($post_type_array['etm_button_single_function']);
}
 function handle_addons_load()
 {
     //-- nexgt gen gallery compat fix.
     if (defined('NGG_PLUGIN')) {
         rh_register_php('options-panel', EASY_TRANSLATION_MANAGER_OPTIONPANEL . 'options-panel/class.PluginOptionsPanelModule.php', '2.3.2');
     }
     //---
     $upload_dir = wp_upload_dir();
     $addons_path = $upload_dir['basedir'] . '/easy-translation-manager/';
     $addons_url = $upload_dir['baseurl'] . '/easy-translation-manager/';
     $addons = etm_tools_retrive_options('addons');
     if (is_array($addons) && !empty($addons)) {
         define('ETM_ADDON_PATH', $addons_path);
         define('ETM_ADDON_URL', $addons_url);
         foreach ($addons as $addon) {
             try {
                 @(include_once $addons_path . $addon);
             } catch (Exception $e) {
                 $current = etm_tools_retrive_options($this->options_varname);
                 $current = is_array($current) ? $current : array();
                 $current['addons'] = is_array($current['addons']) ? $current['addons'] : array();
                 //----
                 $current['addons'] = array_diff($current['addons'], array($addon));
                 update_option($this->options_varname, $current);
             }
         }
     }
 }
        }
    }
    $createTables->set_table_data($post_type_array['etm_columns_group_tags'], $data_array);
    echo $createTables->init(1);
    $etm_folder = 'category';
    $obj_data = (object) array();
    $data_array = '';
    if (!empty($post_type_array['group_list_function_tags']) && function_exists($post_type_array['group_list_function_tags'])) {
        $data_array = $post_type_array['group_list_function_tags'];
    }
    $obj_data->interval = etm_tools_retrive_options('limit_interval');
    $obj_data->page = 0;
    $obj_data->sort_col = etm_tools_retrive_options('sort_single_list_' . $etm_tag);
    $obj_data->sort_dir = etm_tools_retrive_options('sort_single_list_direction_' . $etm_tag);
    $obj_data->retrive_fn = $data_array;
    $obj_data->etm_folder = $etm_folder;
    $obj_data->post_tag = $etm_tag;
    if (etm_tools_retrive_options('hide_auther')) {
        foreach ($post_type_array['etm_columns_group_tags'] as $key => $tmp_data) {
            if ($tmp_data['backtitle'] == 'auther') {
                $post_type_array['etm_columns_group_tags'][$key]['backtitle'] = 'autherDeativate';
            }
        }
    }
    $createTables = new unrealhuman_shower();
    $createTables->setup_table($obj_data);
    $createTables->setup_title_description('<div class="etm_icon etm_icon_9"></div><span><h2>' . __('Post Categories', 'etm') . '</h2></span>', __('Choose the Post Category you want to translate.', 'etm'));
    $createTables->set_table_data($post_type_array['etm_columns_group_tags'], $data_array);
    echo $createTables->init(2);
}
die;
 /**
  * Build a sub-sitemap for a specific post type -- example.com/post_type-sitemap.xml
  *
  * @param string $post_type Registered post type's slug
  */
 function build_post_type_map($post_type)
 {
     global $wpseo_sitemaps;
     $options = get_wpseo_options();
     if (isset($options['post_types-' . $post_type . '-not_in_sitemap']) && $options['post_types-' . $post_type . '-not_in_sitemap'] || in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) {
         $this->bad_sitemap = true;
         $wpseo_sitemaps->set_bad_sitemap(true);
         return;
     }
     $output = '';
     $front_id = get_option('page_on_front');
     if (!$front_id && $post_type == 'post') {
         $output .= $wpseo_sitemaps->sitemap_url(array('loc' => home_url('/'), 'pri' => 1, 'chf' => 'daily'));
     } else {
         if ($front_id && $post_type == 'post') {
             $page_for_posts = get_option('page_for_posts');
             if ($page_for_posts) {
                 $output .= $wpseo_sitemaps->sitemap_url(array('loc' => get_permalink($page_for_posts), 'pri' => 1, 'chf' => 'daily'));
             }
         }
     }
     if (function_exists('get_post_type_archive_link')) {
         $archive = get_post_type_archive_link($post_type);
         if ($archive) {
             $output .= $wpseo_sitemaps->sitemap_url(array('loc' => $archive, 'pri' => 0.8, 'chf' => 'weekly', 'mod' => $wpseo_sitemaps->get_last_modified($post_type)));
         }
     }
     global $wpdb;
     $join_filter = '';
     $join_filter = apply_filters('wpseo_typecount_join', $join_filter, $post_type);
     $where_filter = '';
     $where_filter = apply_filters('wpseo_typecount_where', $where_filter, $post_type);
     $typecount = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->posts} {$join_filter} WHERE post_status = 'publish' AND post_password = '' AND post_type = '{$post_type}' {$where_filter}");
     if ($typecount == 0 && empty($archive)) {
         $this->bad_sitemap = true;
         $wpseo_sitemaps->set_bad_sitemap(true);
         return;
     }
     // Let's flush the object cache so we're not left with garbage from other plugins
     wp_cache_flush();
     $stackedurls = array();
     $steps = 25;
     $n = (int) get_query_var('sitemap_n');
     $offset = $n > 1 ? ($n - 1) * 1000 : 0;
     $total = $offset + 1000;
     if ($total > $typecount) {
         $total = $typecount;
     }
     // We grab post_date, post_name, post_author and post_status too so we can throw these objects into get_permalink, which saves a get_post call for each permalink.
     while ($total > $offset) {
         $join_filter = '';
         $join_filter = apply_filters('wpseo_posts_join', $join_filter, $post_type);
         $where_filter = '';
         $where_filter = apply_filters('wpseo_posts_where', $where_filter, $post_type);
         $posts = $wpdb->get_results("SELECT ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt\n\t\t\tFROM {$wpdb->posts} {$join_filter}\n\t\t\tWHERE post_status = 'publish'\n\t\t\tAND\tpost_password = ''\n\t\t\tAND post_type = '{$post_type}'\n\t\t\t{$where_filter}\n\t\t\tORDER BY post_modified ASC\n\t\t\tLIMIT {$steps} OFFSET {$offset}");
         $offset = $offset + $steps;
         $etm_current_data = etm_tools_retrive_aktiv_languages();
         $etm_tag_string = etm_tools_retrive_options('GP_name');
         $etm_permalinktilladelse = etm_tools_retrive_options('use_permalink');
         $etm_default_lang = etm_tools_retrive_options('default_language');
         $etm_tag_array = '';
         if (!empty($etm_tag_string)) {
             $etm_tag_array = explode('|', $etm_tag_string);
             $etm_tag_string = '';
         }
         foreach ($posts as $p) {
             $p->post_type = $post_type;
             $p->post_status = 'publish';
             $p->filter = 'sample';
             $runethrowlang = array();
             $runethrowlang[] = '';
             if ($post_type == 'post' || $post_type == 'page') {
                 $tmp_meta_data = '';
                 $tmp_meta_data = get_post_custom($p->ID);
                 foreach ($etm_current_data as $etm_lang_key => $etm_lang_data) {
                     $_tran_focuskw = '';
                     $_tran_title = '';
                     $_tran_metadesc = '';
                     $translations_header = '';
                     $translations_body = '';
                     $translations_permalink = '';
                     $_tran_focuskw = $tmp_meta_data['_yoast_wpseo_focuskw_' . $etm_lang_key][0];
                     $_tran_title = $tmp_meta_data['_yoast_wpseo_title_' . $etm_lang_key][0];
                     $_tran_metadesc = $tmp_meta_data['_yoast_wpseo_metadesc_' . $etm_lang_key][0];
                     $translations_header = $tmp_meta_data['ect_tran_title_' . $etm_lang_key][0];
                     $translations_body = $tmp_meta_data['ect_tran_content_' . $etm_lang_key][0];
                     $translations_permalink = $tmp_meta_data['ect_tran_permalink_' . $etm_lang_key][0];
                     if ($translations_permalink == '/' || !$etm_permalinktilladelse) {
                         $translations_permalink = '';
                     }
                     if (!empty($_tran_focuskw) || !empty($_tran_title) || !empty($_tran_metadesc) || !empty($translations_header) || !empty($translations_body)) {
                         $etm_tag_string = '';
                         $etm_permalin_string = '';
                         if (!empty($etm_tag_array) && empty($translations_permalink)) {
                             foreach ($etm_tag_array as $temp_dat) {
                                 if (!empty($etm_tag_string)) {
                                     $etm_tag_string .= '&';
                                 }
                                 $etm_tag_string .= $temp_dat . '=' . $etm_lang_key;
                             }
                         } else {
                             if (!empty($translations_permalink)) {
                                 $etm_permalin_string = $translations_permalink;
                             }
                         }
                         if (!empty($etm_tag_string)) {
                             $runethrowlang[$etm_lang_key]->url = $etm_tag_string;
                             $runethrowlang[$etm_lang_key]->permalink = 'false';
                         } else {
                             if (!empty($etm_permalin_string)) {
                                 $runethrowlang[$etm_lang_key]->url = $etm_permalin_string;
                                 $runethrowlang[$etm_lang_key]->permalink = 'true';
                             }
                         }
                     }
                 }
             }
             unset($tmp_meta_data);
             unset($_tran_focuskw);
             unset($_tran_title);
             unset($_tran_metadesc);
             unset($translations_header);
             unset($translations_body);
             unset($translations_permalink);
             foreach ($runethrowlang as $etm_translatede_key => $etm_translatede_data) {
                 if (wpseo_get_value('meta-robots-noindex', $p->ID) && wpseo_get_value('sitemap-include', $p->ID) != 'always') {
                     continue;
                 }
                 if (wpseo_get_value('sitemap-include', $p->ID) == 'never') {
                     continue;
                 }
                 if (wpseo_get_value('redirect', $p->ID) && strlen(wpseo_get_value('redirect', $p->ID)) > 0) {
                     continue;
                 }
                 $url = array();
                 $url['mod'] = isset($p->post_modified_gmt) && $p->post_modified_gmt != '0000-00-00 00:00:00' ? $p->post_modified_gmt : $p->post_date_gmt;
                 $url['chf'] = 'weekly';
                 $url['loc'] = get_permalink($p);
                 if (!empty($etm_translatede_data) && $etm_translatede_data->permalink == 'true') {
                     if (!empty($etm_translatede_data->url)) {
                         $url['loc'] = trailingslashit(get_option('siteurl')) . $etm_translatede_data->url;
                     }
                 } else {
                     if (!empty($etm_translatede_data)) {
                         $pieces = explode("?", $url['loc']);
                         if (count($pieces) > 1) {
                             $url['loc'] = $url['loc'] . '&' . $etm_translatede_data->url;
                         } else {
                             $url['loc'] = $url['loc'] . '?' . $etm_translatede_data->url;
                         }
                     }
                 }
                 $canonical = wpseo_get_value('canonical', $p->ID);
                 if ($canonical && $canonical != '' && $canonical != $url['loc']) {
                     continue;
                 } else {
                     if (isset($options['trailingslash']) && $options['trailingslash'] && $p->post_type != 'post') {
                         $url['loc'] = trailingslashit($url['loc']);
                     }
                 }
                 $pri = wpseo_get_value('sitemap-prio', $p->ID);
                 if (is_numeric($pri)) {
                     $url['pri'] = $pri;
                 } elseif ($p->post_parent == 0 && $p->post_type == 'page') {
                     $url['pri'] = 0.8;
                 } else {
                     $url['pri'] = 0.6;
                 }
                 if ($p->ID == $front_id) {
                     $url['pri'] = 1.0;
                 }
                 $url['images'] = array();
                 if (preg_match_all('/<img [^>]+>/', $p->post_content, $matches)) {
                     foreach ($matches[0] as $img) {
                         // FIXME: get true caption instead of alt / title
                         if (preg_match('/src=("|\')([^"|\']+)("|\')/', $img, $match)) {
                             $src = $match[2];
                             if (strpos($src, 'http') !== 0) {
                                 if ($src[0] != '/') {
                                     continue;
                                 }
                                 $src = get_bloginfo('url') . $src;
                             }
                             if ($src != esc_url($src)) {
                                 continue;
                             }
                             if (isset($url['images'][$src])) {
                                 continue;
                             }
                             $image = array();
                             if (preg_match('/title=("|\')([^"\']+)("|\')/', $img, $match)) {
                                 $image['title'] = str_replace(array('-', '_'), ' ', $match[2]);
                             }
                             if (preg_match('/alt=("|\')([^"\']+)("|\')/', $img, $match)) {
                                 $image['alt'] = str_replace(array('-', '_'), ' ', $match[2]);
                             }
                             $url['images'][$src] = $image;
                         }
                     }
                 }
                 if (preg_match_all('/\\[gallery/', $p->post_content, $matches)) {
                     $attachments = get_children(array('post_parent' => $p->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image'));
                     foreach ($attachments as $att_id => $attachment) {
                         $src = wp_get_attachment_image_src($att_id, 'large', false);
                         $src = $src[0];
                         $image = array();
                         if ($alt = get_post_meta($att_id, '_wp_attachment_image_alt', true)) {
                             $image['alt'] = $alt;
                         }
                         $image['title'] = $attachment->post_title;
                         $url['images'][$src] = $image;
                     }
                 }
                 $url['images'] = apply_filters('wpseo_sitemap_urlimages', $url['images'], $p->ID);
                 if (!in_array($url['loc'], $stackedurls)) {
                     $output .= $wpseo_sitemaps->sitemap_url($url);
                     $stackedurls[] = $url['loc'];
                 }
             }
             // Clear the post_meta and the term cache for the post, as we no longer need it now.
             wp_cache_delete($p->ID, 'post_meta');
             // clean_object_term_cache( $p->ID, $post_type );
         }
     }
     if (empty($output)) {
         $this->bad_sitemap = true;
         $wpseo_sitemaps->set_bad_sitemap(true);
         return;
     }
     $this->sitemap = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" ';
     $this->sitemap .= 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ';
     $this->sitemap .= 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
     $this->sitemap .= $output . '</urlset>';
     $wpseo_sitemaps->set_sitemap($this->sitemap);
 }