Permalink
Browse files

Final Draft

  • Loading branch information...
Tubebaum committed Jun 15, 2012
1 parent f2bd5a6 commit 6f527f6fca9b8608453ce75e7e24064140a8f902
View
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<buildpath>
- <buildpathentry kind="src" path=""/>
- <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
-</buildpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path=""/>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+</buildpath>
View
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="">
- <attributes>
- <attribute name="provider" value="org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
- <attributes>
- <attribute name="hide" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
- <classpathentry kind="output" path=""/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="">
+ <attributes>
+ <attribute name="provider" value="org.eclipse.wst.jsdt.web.core.internal.project.ModuleSourcePathProvider"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-include_path=0;/gallery
+eclipse.preferences.version=1
+include_path=0;/gallery
View
@@ -1,18 +1,18 @@
-<?php
-require_once("kalturaConfig.php");
-require_once('php5/KalturaClient.php');
-$config = new KalturaConfiguration(PARTNER_ID);
-$config->serviceUrl = 'http://www.kaltura.com/';
-$client = new KalturaClient($config);
-$ks = $client->generateSession(ADMIN_SECRET, USER_ID, KalturaSessionType::ADMIN, PARTNER_ID);
-$client->setKs($ks);
-$tagArray = unserialize(file_get_contents(TAG_CACHE));
-$tags = explode(',', $_REQUEST["tags"]);
-//Adds each new tag to the tags cache
-foreach($tags as $tag) {
- $tag = strtolower(trim($tag));
- if(!array_key_exists($tag, $tagArray) && $tag !== "") {
- $tagArray[$tag] = 0;
- }
-}
+<?php
+require_once("kalturaConfig.php");
+require_once('php5/KalturaClient.php');
+$config = new KalturaConfiguration(PARTNER_ID);
+$config->serviceUrl = 'http://www.kaltura.com/';
+$client = new KalturaClient($config);
+$ks = $client->generateSession(ADMIN_SECRET, USER_ID, KalturaSessionType::ADMIN, PARTNER_ID);
+$client->setKs($ks);
+$tagArray = unserialize(file_get_contents(TAG_CACHE));
+$tags = explode(',', $_REQUEST["tags"]);
+//Adds each new tag to the tags cache
+foreach($tags as $tag) {
+ $tag = strtolower(trim($tag));
+ if(!array_key_exists($tag, $tagArray) && $tag !== "") {
+ $tagArray[$tag] = 0;
+ }
+}
file_put_contents(TAG_CACHE, serialize($tagArray));
View
@@ -1,96 +1,96 @@
-<?php
-require_once("kalturaConfig.php");
-$cachetime = 5 * 60; //Cache time is 5 minutes
-//Only updates the Existing Tags list every time the cache time expires
-if (!file_exists(TAG_CACHE) || (time() - $cachetime > filemtime(TAG_CACHE))) {
- require_once('php5/KalturaClient.php');
- $config = new KalturaConfiguration(PARTNER_ID);
- $config->serviceUrl = 'http://www.kaltura.com/';
- $client = new KalturaClient($config);
- $ks = $client->generateSession(ADMIN_SECRET, USER_ID, KalturaSessionType::ADMIN, PARTNER_ID);
- $client->setKs($ks);
-
- $pager = new KalturaFilterPager();
- $pageSize = 500;
- $pager->pageSize = $pageSize;
- $lastCreatedAt = 0;
- $lastEntryIds = "";
- $cont = true;
- while($cont) {
- $filter = new KalturaMediaEntryFilter();
- $filter->orderBy = "-createdAt";
- if($lastCreatedAt != 0)
- $filter->createdAtLessThanOrEqual = $lastCreatedAt;
- if($lastEntryIds != "")
- $filter->idNotIn = $lastEntryIds;
- $results = $client->media->listAction($filter, $pager);
- if(count($results->objects) == 0) {
- $cont = false;
- }
- $entryIds = "";
- foreach($results->objects as $entry) {
- $tags = explode(',', $entry->tags);
- foreach ($tags as $tag) {
- $tag = trim($tag);
- if ($tag == "") continue;
- //If the tag has already been discovered, increment its frequency
- if (isset($tagArray[$tag]))
- ++$tagArray[$tag];
- //Otherwise, add the new tag to the array
- else
- $tagArray[$tag] = 1;
-
- if($lastCreatedAt != $entry->createdAt)
- $lastEntryIds = "";
- if($lastEntryIds != "")
- $lastEntryIds .= ",";
- $lastEntryIds .= $entry->id;
- $lastCreatedAt = $entry->createdAt;
- }
- }
- }
-// $filter = new KalturaMediaEntryFilter();
-// $filter->orderBy = KalturaMediaEntryOrderBy::CREATED_AT_DESC;
-// $pager->pageIndex = 1;
-// $results = $client->media->listAction($filter, $pager);
-// $count = $results->totalCount;
-// $endPage = (int)($count / $pageSize);
-// $endPage += ($count % $pageSize == 0) ? 0 : 1;
-// $tagArray = array();
-// //Stores each tag name as its own index and keeps a tally of how many times that tag is found
-// for($pageNum = 1; $pageNum <= $endPage; ++$pageNum) {
-// $pager->pageIndex = $pageNum;
-// if($pageNum > 1)
-// $results = $client->media->listAction($filter, $pager);
-// foreach ($results->objects as $entry) {
-// $tags = explode(',', $entry->tags);
-// foreach ($tags as $tag) {
-// $tag = trim($tag);
-// if ($tag == "") continue;
-// //If the tag has already been discovered, increment its frequency
-// if (isset($tagArray[$tag]))
-// ++$tagArray[$tag];
-// //Otherwise, add the new tag to the array
-// else
-// $tagArray[$tag] = 1;
-// }
-// }
-// }
- //Stores the array of tags in a file that can be retrieved immediately for faster loading time
- $tagArrayString = serialize($tagArray);
- file_put_contents(TAG_CACHE, $tagArrayString);
- //Creates a string of every tag and its respective frequeny and returns it
- $tagString = "";
- foreach($tagArray as $tag => $tagCount) $tagString .= $tag.' ('.$tagCount.'), ';
- echo substr($tagString, 0, -2);
-}
-//If the cache time has not passed yet, do not recreate the tag array
-//Instead use the array that has been stored
-else {
- $tagString = file_get_contents(TAG_CACHE);
- $tagArray = unserialize($tagString);
- //Creates a string of every tag and its respective frequeny and returns it
- $tagString = "";
- foreach($tagArray as $tag => $tagCount) $tagString .= $tag.' ('.$tagCount.'), ';
- echo substr($tagString, 0, -2);
+<?php
+require_once("kalturaConfig.php");
+$cachetime = 5 * 60; //Cache time is 5 minutes
+//Only updates the Existing Tags list every time the cache time expires
+if (!file_exists(TAG_CACHE) || (time() - $cachetime > filemtime(TAG_CACHE))) {
+ require_once('php5/KalturaClient.php');
+ $config = new KalturaConfiguration(PARTNER_ID);
+ $config->serviceUrl = 'http://www.kaltura.com/';
+ $client = new KalturaClient($config);
+ $ks = $client->generateSession(ADMIN_SECRET, USER_ID, KalturaSessionType::ADMIN, PARTNER_ID);
+ $client->setKs($ks);
+
+ $pager = new KalturaFilterPager();
+ $pageSize = 500;
+ $pager->pageSize = $pageSize;
+ $lastCreatedAt = 0;
+ $lastEntryIds = "";
+ $cont = true;
+ while($cont) {
+ $filter = new KalturaMediaEntryFilter();
+ $filter->orderBy = "-createdAt";
+ if($lastCreatedAt != 0)
+ $filter->createdAtLessThanOrEqual = $lastCreatedAt;
+ if($lastEntryIds != "")
+ $filter->idNotIn = $lastEntryIds;
+ $results = $client->media->listAction($filter, $pager);
+ if(count($results->objects) == 0) {
+ $cont = false;
+ }
+ $entryIds = "";
+ foreach($results->objects as $entry) {
+ $tags = explode(',', $entry->tags);
+ foreach ($tags as $tag) {
+ $tag = trim($tag);
+ if ($tag == "") continue;
+ //If the tag has already been discovered, increment its frequency
+ if (isset($tagArray[$tag]))
+ ++$tagArray[$tag];
+ //Otherwise, add the new tag to the array
+ else
+ $tagArray[$tag] = 1;
+
+ if($lastCreatedAt != $entry->createdAt)
+ $lastEntryIds = "";
+ if($lastEntryIds != "")
+ $lastEntryIds .= ",";
+ $lastEntryIds .= $entry->id;
+ $lastCreatedAt = $entry->createdAt;
+ }
+ }
+ }
+// $filter = new KalturaMediaEntryFilter();
+// $filter->orderBy = KalturaMediaEntryOrderBy::CREATED_AT_DESC;
+// $pager->pageIndex = 1;
+// $results = $client->media->listAction($filter, $pager);
+// $count = $results->totalCount;
+// $endPage = (int)($count / $pageSize);
+// $endPage += ($count % $pageSize == 0) ? 0 : 1;
+// $tagArray = array();
+// //Stores each tag name as its own index and keeps a tally of how many times that tag is found
+// for($pageNum = 1; $pageNum <= $endPage; ++$pageNum) {
+// $pager->pageIndex = $pageNum;
+// if($pageNum > 1)
+// $results = $client->media->listAction($filter, $pager);
+// foreach ($results->objects as $entry) {
+// $tags = explode(',', $entry->tags);
+// foreach ($tags as $tag) {
+// $tag = trim($tag);
+// if ($tag == "") continue;
+// //If the tag has already been discovered, increment its frequency
+// if (isset($tagArray[$tag]))
+// ++$tagArray[$tag];
+// //Otherwise, add the new tag to the array
+// else
+// $tagArray[$tag] = 1;
+// }
+// }
+// }
+ //Stores the array of tags in a file that can be retrieved immediately for faster loading time
+ $tagArrayString = serialize($tagArray);
+ file_put_contents(TAG_CACHE, $tagArrayString);
+ //Creates a string of every tag and its respective frequeny and returns it
+ $tagString = "";
+ foreach($tagArray as $tag => $tagCount) $tagString .= $tag.' ('.$tagCount.'), ';
+ echo substr($tagString, 0, -2);
+}
+//If the cache time has not passed yet, do not recreate the tag array
+//Instead use the array that has been stored
+else {
+ $tagString = file_get_contents(TAG_CACHE);
+ $tagArray = unserialize($tagString);
+ //Creates a string of every tag and its respective frequeny and returns it
+ $tagString = "";
+ foreach($tagArray as $tag => $tagCount) $tagString .= $tag.' ('.$tagCount.'), ';
+ echo substr($tagString, 0, -2);
}
View
@@ -1,5 +1,5 @@
-<?php
-define("PARTNER_ID",xxxx);
-define("ADMIN_SECRET",'xxxx');
-define("USER_ID",'tagsManager');
+<?php
+define("PARTNER_ID",xxxx);
+define("ADMIN_SECRET",'xxxx');
+define("USER_ID",'tagsManager');
define("TAG_CACHE", 'tagArray.txt');
Oops, something went wrong.

0 comments on commit 6f527f6

Please sign in to comment.