protected function init_wpml_integration()
 {
     WPV_WPML_Integration_Embedded::init();
 }
    /**
     * Get link to Translation Editor in WPML Translation Management.
     *
     * If WPML and WPML Translation Management is active, this method will generate an URL to page for editing
     * translation of this CT. If no such translation exists yet, it will be created when the page is loaded.
     *
     * Requires WPML Core and WPML TM plugins to be active.
     *
     * @param string $language_code Code of the language CT should be translated into.
     * @return null|string URL or null if it cannot be obtained.
     * @since 1.10
     */
    function get_wpml_tm_link( $language_code ) {

        // Fail if there's no trid or WPML TM is not active
        $trid = $this->wpml_trid;
        if( 0 == $trid ) {
            return null;
        }
        $wpv_wpml_integration = WPV_WPML_Integration_Embedded::get_instance();
        if( ! $wpv_wpml_integration->is_wpml_tm_loaded() ) {
            return null;
        }

        $job_id = apply_filters(
            'wpml_translation_job_id',
            null,
            array( 'trid' => $trid, 'language_code' => $language_code )
        );

        if( $job_id ) {
            $url = add_query_arg(
                array(
                    'page' => 'wpml-translation-management/menu/translations-queue.php',
                    'job_id' => $job_id
                ),
                admin_url( 'admin.php' )
            );
        } else {
            $url = add_query_arg(
                array(
                    'page' => 'wpml-translation-management/menu/translations-queue.php',
                    'trid' => $trid,
                    'language_code' => $language_code,
                    'source_language_code' => apply_filters( 'wpml_default_language', '' )
                ),
                admin_url( 'admin.php ')
            );
        }
        return esc_url( $url );
    }
Example #3
0
 /**
  * Get the instance of the singleton (and create it if it doesn't exist yet).
  *
  * @return WPV_WPML_Integration_Embedded
  * @since 1.10
  */
 public static function get_instance() {
     if( null == self::$instance ) {
         self::$instance = new WPV_WPML_Integration_Embedded();
     }
     return self::$instance;
 }
Example #4
0
 protected function __construct() { parent::__construct(); }