/**
  * Create and configure project (Translation Service)
  *
  * @param string $url
  * @param string $name
  * @param string $description
  * @param string $delivery
  *
  * @return bool
  * @throws TranslationProxy_Api_Error
  * @throws Exception
  */
 public function create($url, $name, $description, $delivery = 'xmlrpc')
 {
     global $sitepress;
     $networking = wpml_tm_load_tp_networking();
     $project_creation = new WPML_TP_Project_Creation($this, $sitepress, $networking, array('name' => $name, 'description' => $description, 'url' => $url, 'delivery_method' => $delivery, 'sitekey' => WP_Installer_API::get_site_key('wpml'), 'client_external_id' => WP_Installer_API::get_ts_client_id()));
     $response_project = $project_creation->run();
     $this->id = $response_project->id;
     $this->access_key = $response_project->accesskey;
     $this->ts_id = $response_project->ts_id;
     $this->ts_access_key = $response_project->ts_accesskey;
     if (isset($response_project->polling_method) && $response_project->polling_method !== $delivery) {
         $this->service->delivery_method = $response_project->polling_method;
     }
     return true;
 }
Exemplo n.º 2
0
/**
 * Teaser admin screen.
 */
function wpcf_access_teaser_admin_menu_page()
{
    $access_buy_link = 'http://wp-types.com/buy/?add-to-cart=38997&buy_now=1&utm_source=typesplugin&utm_medium=accessadmin&utm_term=Buy&utm_campaign=typesplugin';
    /**
     * get link by installer
     */
    if (class_exists('WP_Installer_API') && method_exists('WP_Installer_API', 'get_product_installer_link')) {
        $access_buy_link = WP_Installer_API::get_product_installer_link('toolset', 'access');
    }
    /**
     * show message
     */
    wpcf_add_admin_header(__('Access', 'wpcf'), 'icon-wpcf-access');
    echo '<div class="types-help"><div class="types-help-content"';
    echo '<p>' . sprintf(__('This screen shows a preview of %sAccess%s - the access control and roles management addon for Types.', 'wpcf'), '<strong><a href="http://wp-types.com/home/types-access/?utm_source=typesplugin&utm_medium=accessadmin&utm_term=Access&utm_campaign=typesplugin" target="_blank">', '</a></strong>') . '</p>' . '<p>' . __('Access lets you control what content types different users can read, edit and publish on your site and create custom roles.', 'wpcf') . '</p>' . '<p>' . sprintf(__('%sBuy Access%s to unlock this screen and add access control management to your site.', 'wpcf'), sprintf('<strong><a href="%s" target="_blank">', $access_buy_link), '</a></strong>') . '</p>' . '<p><a href="http://wp-types.com/home/types-access/?utm_source=typesplugin&utm_medium=accessadmin&utm_term=AccessFeatures&utm_campaign=typesplugin" class="button-primary" target="_blank">' . sprintf(__('Access Features') . '</a>&nbsp;<a href="%s" class="button-primary" target="_blank">', $access_buy_link) . __('Buy Access - $39 (USD)') . '</a>' . '</p>';
    echo '</div></div>';
    require_once WPCF_ACCESS_INC . '/admin-edit-access.php';
    wpcf_access_admin_edit_access(false);
    wpcf_add_admin_footer();
}
 private static function get_preferred_translation_service_from_installer()
 {
     return WP_Installer_API::get_preferred_ts();
 }