Пример #1
0
 public function __construct()
 {
     parent::__construct('string');
     if (isset($this->pllm->options['default_lang']) && 'automatic' == Lingotek_Model::get_profile_option('upload', 'string', $this->pllm->get_language($this->pllm->options['default_lang']))) {
         add_action('updated_option', array(&$this, 'updated_option'));
     }
 }
Пример #2
0
 public function save_term($term_id, $tt_id, $taxonomy)
 {
     if (!$this->model->is_translated_taxonomy($taxonomy)) {
         return;
     }
     if (!isset($_REQUEST['import'])) {
         parent::save_term($term_id, $tt_id, $taxonomy);
         if ('automatic' == Lingotek_Model::get_profile_option('upload', $taxonomy, $this->model->get_term_language($term_id)) && $this->lgtm->can_upload('term', $term_id)) {
             $this->lgtm->upload_term($term_id, $taxonomy);
         }
     }
 }
Пример #3
0
 public function is_automatic_upload()
 {
     return 'automatic' == Lingotek_Model::get_profile_option('upload', get_post_type($this->source), $this->get_source_language(), false, $this->source);
 }
Пример #4
0
 public function is_automatic_download($locale)
 {
     return 'automatic' == Lingotek_Model::get_profile_option('download', $this->type, $this->get_source_language(), $this->pllm->get_language($locale), $this->source);
 }
Пример #5
0
 public function is_automatic_upload()
 {
     return 'automatic' == Lingotek_Model::get_profile_option('upload', 'string', $this->get_source_language());
 }
Пример #6
0
 public function save_post($post_id, $post, $update)
 {
     if ($this->can_save_post_data($post_id, $post, true)) {
         $document = $this->lgtm->get_group('post', $post_id);
         // updated post
         if ($document && $post_id == $document->source && $this->post_hash_has_changed($post)) {
             $document->source_edited();
             if ($document->is_automatic_upload() && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status)) {
                 $this->lgtm->upload_post($post_id);
             }
         }
     }
     if (!$this->model->is_translated_post_type($post->post_type)) {
         return;
     }
     // new post
     if (!isset($_REQUEST['import'])) {
         parent::save_post($post_id, $post, $update);
         if (!wp_is_post_revision($post_id) && 'auto-draft' != $post->post_status && Lingotek_Group_Post::is_valid_auto_upload_post_status($post->post_status) && 'automatic' == Lingotek_Model::get_profile_option('upload', $post->post_type, $this->model->get_post_language($post_id), false, $post_id) && !(isset($_POST['action']) && 'heartbeat' == $_POST['action']) && $this->lgtm->can_upload('post', $post_id)) {
             $this->lgtm->upload_post($post_id);
         }
     }
 }
Пример #7
0
 public function add_attachment($post_id)
 {
     if ($this->model->is_translated_post_type('attachment') && 'automatic' == Lingotek_Model::get_profile_option('upload', 'attachment', $this->model->get_post_language($post_id)) && $this->lgtm->can_upload('post', $post_id)) {
         $this->lgtm->upload_post($post_id);
     }
 }