Changeset 748


Ignore:
Timestamp:
11/24/12 03:37:47 (2 years ago)
Author:
ofer
Message:

Fix for #237 (should enable language selection when autotranslate is off), also attempt to add those boxes to custom post types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/wp/transposh_postpublish.php

    r745 r748  
    3535        $this->transposh = &$transposh; 
    3636        // we'll only do something if so configured to do 
    37         // wrong - fix this! :) 
    3837        if ($this->transposh->options->enable_autoposttranslate) { 
    3938            add_action('edit_post', array(&$this, 'on_edit')); 
    40             // add_action('publish_post',array(&$this, 'on_publish')); 
    41             add_action('admin_menu', array(&$this, 'on_admin_menu')); 
    42         } 
     39        } 
     40        add_action('admin_menu', array(&$this, 'on_admin_menu')); 
    4341    } 
    4442 
     
    4846    function on_admin_menu() { 
    4947        //add our metaboxs to the post and publish pages 
    50         tp_logger('adding metaboxes'); 
    51         add_meta_box('transposh_postpublish', __('Transposh', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_postpublish_box"), 'post', 'side', 'core'); 
    52         add_meta_box('transposh_postpublish', __('Transposh', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_postpublish_box"), 'page', 'side', 'core'); 
    53         add_meta_box('transposh_setlanguage', __('Set post language', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_setlanguage_box"), 'post', 'advanced', 'core'); 
    54         add_meta_box('transposh_setlanguage', __('Set page language', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_setlanguage_box"), 'page', 'advanced', 'core'); 
     48        tp_logger('adding metaboxes for admin pages/post/custom', 4); 
     49        $post_types = get_post_types(); 
     50        foreach ($post_types as $post_type) { 
     51            if (in_array($post_type, array('attachment', 'revision', 'nav_menu_item'))) 
     52                    continue; 
     53            tp_logger($post_type, 5); 
     54            if ($this->transposh->options->enable_autoposttranslate) { 
     55                add_meta_box('transposh_postpublish', __('Transposh', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_postpublish_box"), $post_type, 'side', 'core'); 
     56            } 
     57            add_meta_box('transposh_setlanguage', __('Set post language', TRANSPOSH_TEXT_DOMAIN), array(&$this, "transposh_setlanguage_box"), $post_type, 'advanced', 'core'); 
     58        } 
    5559        if (!isset($_GET['post'])) return; 
    5660        if (get_post_meta($_GET['post'], 'transposh_can_translate', true)) { // do isdefined stuff 
Note: See TracChangeset for help on using the changeset viewer.