Ejemplo n.º 1
0
             update_blog_option($destination, $lingotek_option, $source_options);
             $source_options = get_blog_option($source_site, 'lingotek_base_url');
             update_blog_option($destination, 'lingotek_base_url', $source_options);
         }
         //Updates the chosen option
         $lingotek_option = 'lingotek_' . $setting;
         $source_options = get_blog_option($source_site, $lingotek_option);
         update_blog_option($destination, $lingotek_option, $source_options);
     }
 }
 //Creates a new project based on the name of the selected site
 if (isset($_POST['new_project'])) {
     $options = get_blog_option($destination, 'lingotek_defaults');
     $client = new Lingotek_API();
     $title = htmlspecialchars_decode(get_blog_details($destination)->blogname, ENT_QUOTES);
     if ($new_id = $client->create_project($title, $community_id = get_blog_option($destination, 'lingotek_community'))) {
         $options['project_id'] = $new_id;
         // Adds correct callback URL for new project
         $args = array('callback_url' => add_query_arg('lingotek', 1, get_blog_details($destination)->siteurl));
         $response = $client->patch($client->get_api_url() . '/project/' . $new_id, $args);
         update_blog_option($destination, 'lingotek_defaults', $options);
     }
 }
 if (isset($_POST['preferences'])) {
     switch_to_blog($source_site);
     $preferences = Lingotek_Model::get_prefs();
     update_blog_option($destination, 'lingotek_prefs', $preferences);
     restore_current_blog();
 }
 if (isset($_POST['utility_set_default_language'])) {
     switch_to_blog($destination);
Ejemplo n.º 2
0
                $options[$key] = $_POST[$key];
            }
        }
        update_option('lingotek_defaults', $options);
        add_settings_error('lingotek_defaults', 'defaultgs', __('Your <i>Defaults</i> were sucessfully saved.', 'wp-lingotek'), 'updated');
        if (isset($_POST['update_callback'])) {
            $client = new Lingotek_API();
            if ($client->update_callback_url($options['project_id'])) {
                add_settings_error('lingotek_defaults', 'defaultgs', __('Your callback url was successfully updated.', 'wp-lingotek'), 'updated');
            }
        }
        //adds new project if text box is filled out
        if (!empty($_POST['new_project'])) {
            $client = new Lingotek_API();
            $title = stripslashes($_POST['new_project']);
            if ($new_id = $client->create_project($title, $community_id)) {
                add_settings_error('lingotek_defaults', 'defaultgs', __('Your new project was successfully created.', 'wp-lingotek'), 'updated');
                $this->set_community_resources($community_id);
                // updates the cache to include the newly created project
                $options['project_id'] = $new_id;
                update_option('lingotek_defaults', $options);
            }
        }
    }
    settings_errors();
}
$settings = $this->get_profiles_settings(true);
$options = get_option('lingotek_defaults');
// Code to determine which filter scenario will be displayed (Not configured, defaults, custom filters)
$primary_filter_id = array_search('*****@*****.**', $settings['primary_filter_id']['options']);
$secondary_filter_id = array_search('*****@*****.**', $settings['secondary_filter_id']['options']);