$saved
*/
function icl_quote_get_step_two($saved) {
global $sitepress, $iclTranslationManagement, $wpdb;
$iclTranslationManagement->init();
$cf_settings = $iclTranslationManagement->settings['custom_fields_translation'];
$rows = array();
$add = 0;
$types = get_post_types('', 'objects');
foreach ($types as $name => $type) {
if (in_array($name, array('attachment', 'revision', 'nav_menu_item'))) {
continue;
}
$source_code = $saved['from'] == $sitepress->get_default_language() ? 'IS NULL' : "= '" . $saved['from'] . "'";
$posts = $wpdb->get_results("SELECT p.ID, p.post_title, p.post_content
FROM {$wpdb->prefix}posts p
JOIN {$wpdb->prefix}icl_translations t
WHERE p.post_type = '" . $name . "'
AND t.element_type = 'post_" . $name . "'
AND t.element_id = p.ID
AND t.language_code = '" . $saved['from'] . "'
AND p.post_status = 'publish'
");
$rows[$name]['ID'] = $name;
$rows[$name]['title'] = $type->label;
if (empty($posts)) {
$rows[$name]['words'] = 0;
$rows[$name]['num'] = 0;
continue;
}
$rows[$name]['words'] = 0;
foreach ($posts as $post) {
$meta_count = 0;
if (!empty($cf_settings)) {
foreach ($cf_settings as $meta_key => $translate) {
if ($translate == 2) {
$meta = get_post_meta($post->ID, $meta_key, true);
if (is_string($meta)) {
$meta_count += str_word_count(strip_tags(
$meta));
}
} else {
unset($cf_settings[$meta_key]);
}
}
}
$add = $meta_count + str_word_count(strip_tags($post->post_title)) + str_word_count(strip_tags($post->post_content));
$rows[$name]['words'] += $add;
}
$rows[$name]['num'] = count($posts);
}
?>
To get the word count of specific documents, use the %sTranslation Dashboard%s.',
'sitepress'), '', ''); ?>
$true) {
$wc_description[] = $saved['description'][$ID]['num'] . ' '
. $saved['description'][$ID]['title'] . ' with '
. $saved['description'][$ID]['words'] . ' words';
}
?>