<commit_before><?php 
/*
 * Copyright 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 

// Add the osapi directory to the include path
set_include_path(get_include_path() . PATH_SEPARATOR . '../src');

// Require the osapi library
require_once "osapi.php";

// Allow users to select which test they would like to run from the querystring
if (isSet($_REQUEST["test"])) {
  $test = $_REQUEST["test"];
} else {
  $test = 'XRDS'; 
}

$osapi = false;
$strictMode = true;
$userId = '@me';
$appId = '@app';

// Select the appropriate test and initialize
switch ($test) {
  case 'XRDS':
    $localUserId = 1;
    $storage = new osapiFileStorage('/tmp/osapi/');
    $provider = new osapiXrdsProvider('http://www.partuza.nl/', $storage);
    $auth = osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '6f0e1a11ac45caed32d699f9e92ae959', $storage, $provider, $localUserId);
    $osapi = new osapi($provider, $auth);
    break;
  case 'partuza':
    $localUserId = 1;
    $provider = new osapiPartuzaProvider();
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaRest':
    $localUserId = 1;
    $provider = new osapiPartuzaProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaLocal':
    $localUserId = 1;
    $osapi = new osapi($provider = new osapiLocalPartuzaProvider(), osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaLocalRest':
    $localUserId = 1;
    $provider = new osapiLocalPartuzaProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'plaxo':
    $localUserId = 1;
    $osapi = new osapi($provider = new osapiPlaxoProvider(), osapiOAuth3Legged::performOAuthLogin('anonymous', '', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'orkut':
    $userId = '03067092798963641994';
    $osapi = new osapi(new osapiOrkutProvider(), new osapiOAuth2Legged("orkut.com:623061448914", "uynAeXiWTisflWX99KU1D2q5", '03067092798963641994'));
    break;
  case 'orkutRest':
    $userId = '03067092798963641994';
    $provider = new osapiOrkutProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, new osapiOAuth2Legged("orkut.com:623061448914", "uynAeXiWTisflWX99KU1D2q5", '03067092798963641994'));
    break;
  case 'myspace':
    $userId = '439607992';
    $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged("http://dev.gain.resource.com", "7ebda6dee096455889bdab23ddacdfae", '439607992'));
}

$script_name = $_SERVER["SCRIPT_NAME"];
$tests = Array(
    "myspace"   => "MySpace", 
    "orkut"     => "orkut", 
    "orkutRest" => "orkut (REST)",
    "partuza"   => "Partuza",
    "plaxo"     => "Plaxo"
);

$links = Array();
foreach ($tests as $value => $name) {
  if ($value == $test) {
    $links[] = "<strong>$name</strong>";
  } else {
    $links[] = "<a href='$script_name?test=$value'>$name</a>";
  }
}

?>

<p>Run this sample using data from: <?= implode($links, ", ") ?> </p>
<commit_msg>Changed local user id so that the same result set wouldn't be cached for all users (which is pretty scary\!)<commit_after><?php 
/*
 * Copyright 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 

// Add the osapi directory to the include path
set_include_path(get_include_path() . PATH_SEPARATOR . '../src');

// Require the osapi library
require_once "osapi.php";

// Allow users to select which test they would like to run from the querystring
if (isSet($_REQUEST["test"])) {
  $test = $_REQUEST["test"];
} else {
  $test = 'XRDS'; 
}

$osapi = false;
$strictMode = true;
$userId = '@me';
$appId = '@app';

// Select the appropriate test and initialize
switch ($test) {
  case 'XRDS':
    $localUserId = session_id();
    $storage = new osapiFileStorage('/tmp/osapi/');
    $provider = new osapiXrdsProvider('http://www.partuza.nl/', $storage);
    $auth = osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '6f0e1a11ac45caed32d699f9e92ae959', $storage, $provider, $localUserId);
    $osapi = new osapi($provider, $auth);
    break;
  case 'partuza':
    $localUserId = session_id();
    $provider = new osapiPartuzaProvider();
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaRest':
    $localUserId = session_id();
    $provider = new osapiPartuzaProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>ca<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaLocal':
    $localUserId = session_id();
    $osapi = new osapi($provider = new osapiLocalPartuzaProvider(), osapiOAuth3Legged::performOAuthLogin('<PASSWORD>', '<PASSWORD>ca<PASSWORD>', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'partuzaLocalRest':
    $localUserId = session_id();
    $provider = new osapiLocalPartuzaProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, osapiOAuth3Legged::performOAuthLogin('<PASSWORD>d9-afe4-c6e6c8e6eec4', '6f0e1a11ac45caed32d699f9e92ae959', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'plaxo':
    $localUserId = session_id();
    $osapi = new osapi($provider = new osapiPlaxoProvider(), osapiOAuth3Legged::performOAuthLogin('anonymous', '', new osapiFileStorage('/tmp/osapi/'), $provider, $localUserId));
    break;
  case 'orkut':
    $userId = '03067092798963641994';
    $osapi = new osapi(new osapiOrkutProvider(), new osapiOAuth2Legged("orkut.com:623061448914", "uynAeXiWTisflWX99KU1D2q5", '03067092798963641994'));
    break;
  case 'orkutRest':
    $userId = '03067092798963641994';
    $provider = new osapiOrkutProvider();
    $provider->rpcEndpoint = null;
    $osapi = new osapi($provider, new osapiOAuth2Legged("orkut.com:623061448914", "uynAeXiWTisflWX99KU1D2q5", '03067092798963641994'));
    break;
  case 'myspace':
    $userId = '439607992';
    $osapi = new osapi(new osapiMySpaceProvider(), new osapiOAuth2Legged("http://dev.gain.resource.com", "7ebda6dee096455889bdab23ddacdfae", '439607992'));
}

$script_name = $_SERVER["SCRIPT_NAME"];
$tests = Array(
    "myspace"   => "MySpace", 
    "orkut"     => "orkut", 
    "orkutRest" => "orkut (REST)",
    "partuza"   => "Partuza",
    "plaxo"     => "Plaxo"
);

$links = Array();
foreach ($tests as $value => $name) {
  if ($value == $test) {
    $links[] = "<strong>$name</strong>";
  } else {
    $links[] = "<a href='$script_name?test=$value'>$name</a>";
  }
}

?>

<p>Run this sample using data from: <?= implode($links, ", ") ?> </p>

{'fraction_non_alphanumeric': 0.15524169000365273, 'fraction_numerical': 0.047607451601120176, 'mean_word_length': 4.591558883594282, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3195114', 'n_tokens_mistral': 3008, 'n_tokens_neox': 2826, 'n_words': 671}