function poll_for_translations($force = false)
 {
     global $sitepress_settings, $sitepress, $wpdb;
     if (!$force) {
         // Limit to once per hour
         $toffset = strtotime(current_time('mysql')) - @intval($sitepress_settings['last_picked_up']) - 3600;
         if ($toffset < 0 || $force) {
             return 0;
         }
     }
     $iclq = new ICanLocalizeQuery($sitepress_settings['site_id'], $sitepress_settings['access_key']);
     $pending = $iclq->cms_requests();
     $fetched = 0;
     if (!empty($pending)) {
         foreach ($pending as $doc) {
             if (empty($doc['cms_id'])) {
                 // it's a string
                 $target = $wpdb->get_var($wpdb->prepare("SELECT target FROM {$wpdb->prefix}icl_core_status WHERE rid=%d", $doc['id']));
                 $__ld = $sitepress->get_language_details($target);
                 $language = $this->server_languages_map($__ld['english_name']);
                 $ret = $this->process_translated_string($doc['id'], $language);
                 if ($ret) {
                     $fetched++;
                 }
             } else {
                 // decode cms_id
                 $int = preg_match('#(.+)_([0-9]+)_([^_]+)_([^_]+)#', $doc['cms_id'], $matches);
                 $_element_type = $matches[1];
                 $_element_id = $matches[2];
                 $_original_lang = $matches[3];
                 $_lang = $matches[4];
                 $trid = $sitepress->get_element_trid($_element_id, 'post_' . $_element_type);
                 $translation = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $_lang));
                 $ret = $this->add_translated_document($translation->translation_id, $doc['id']);
                 if ($ret) {
                     $fetched++;
                 }
             }
         }
     }
     $iclsettings['last_picked_up'] = strtotime(current_time('mysql'));
     $sitepress->save_settings($iclsettings);
     return $fetched;
 }