本文整理汇总了PHP中KAutoloader类的典型用法代码示例。如果您正苦于以下问题:PHP KAutoloader类的具体用法?PHP KAutoloader怎么用?PHP KAutoloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KAutoloader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddWithCategories
/**
* Test the addition of a mediaEntry with proeprty "categories" set.
* @param string $categories
* @dataProvider provideData
*/
public function testAddWithCategories($categories)
{
$mediaEntry = new KalturaMediaEntry();
$mediaEntry->name = uniqid();
$mediaEntry->mediaType = KalturaMediaType::VIDEO;
$mediaEntry->categories = $categories;
$mediaEntry = $this->client->media->add($mediaEntry);
var_dump(KAutoloader::getClassFilePath(get_class($this->client)));
$categoryNames = explode(",", $categories);
foreach ($categoryNames as $categoryName) {
$filter = new KalturaCategoryFilter();
$filter->fullNameEqual = $categoryName;
$results = $this->client->category->listAction($filter);
$this->assertEquals(1, $results->totalCount, "Unexpected number of categories with fullname {$categoryName}.");
$catId = $results->objects[0]->id;
// Assert that the entry's "categoriesIds" property was updated properly.
$entryCatIds = explode(',', $mediaEntry->categoriesIds);
$this->assertTrue(in_array($catId, $entryCatIds), "Entry's categoriesIds property should containt category Id [{$catId}] for category [{$categoryName}]");
//Assert that a KalturaCategoryEntry object was created for the entry and each category it was associated with.
$catEntryFilter = new KalturaCategoryEntryFilter();
$catEntryFilter->categoryIdEqual = $catId;
$catEntryFilter->entryIdEqual = $mediaEntry->id;
try {
$res = $this->client->categoryEntry->listAction($catEntryFilter);
$this->assertGreaterThan(0, $res->totalCount > 0);
} catch (Exception $e) {
$this->assertEquals(0, 1, "Unexpected exception thrown - expected categoryEntry object for entry Id" . $mediaEntry->id . " and category Id {$catId}");
}
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:MediaServiceEntitlementTest.php
示例2: get
/**
* @param string $type
* @return KalturaTypeReflector
*/
static function get($type)
{
if (!self::$_enabled) {
return new KalturaTypeReflector($type);
}
if (!array_key_exists($type, self::$_loadedTypeReflectors)) {
$cachedDir = KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "typeReflector");
if (!is_dir($cachedDir)) {
mkdir($cachedDir);
chmod($cachedDir, 0755);
}
$cachedFilePath = $cachedDir . DIRECTORY_SEPARATOR . $type . ".cache";
$typeReflector = null;
if (file_exists($cachedFilePath)) {
$cachedData = file_get_contents($cachedFilePath);
$typeReflector = unserialize($cachedData);
}
if (!$typeReflector) {
$typeReflector = new KalturaTypeReflector($type);
$cachedData = serialize($typeReflector);
$bytesWritten = kFile::safeFilePutContents($cachedFilePath, $cachedData);
if (!$bytesWritten) {
$folderPermission = substr(decoct(fileperms(dirname($cachedFilePath))), 2);
error_log("Kaltura type reflector could not be saved to path [{$cachedFilePath}] type [{$type}] folder permisisons [{$folderPermission}]");
}
}
self::$_loadedTypeReflectors[$type] = $typeReflector;
}
return self::$_loadedTypeReflectors[$type];
}
示例3: __construct
/**
*
* Creates a new Kaltura test Object
* @param string $name
* @param array $data
* @param string $dataName
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$class = get_class($this);
if ($name) {
KalturaLog::info("_____________________________________ [{$class}] [{$name}] ___________________________________");
} else {
KalturaLog::info("__________________________________________ [{$class}] ______________________________________");
}
$testFilePath = KAutoloader::getClassFilePath($class);
$this->testFolder = dirname($testFilePath);
$this->inputs = $data;
KalturaLog::info("Loads config file [{$testFilePath}.ini]");
$this->config = new KalturaTestConfig("{$testFilePath}.ini");
$testConfig = $this->config->get('config');
if (!$testConfig) {
$testConfig = new Zend_Config(array('source' => KalturaTestSource::XML), true);
$this->config->config = $testConfig;
$this->config->saveToIniFile();
}
$this->dataSource = $testConfig->source;
$this->outputFolder = $testConfig->outputFolder;
if ($this->outputFolder && !is_dir($this->outputFolder)) {
KalturaLog::info("Creating folder output [{$this->outputFolder}]");
mkdir($this->outputFolder, 777, true);
}
}
示例4: cacheMap
static function cacheMap($servicePath, $cacheFilePath)
{
if (!is_dir($servicePath)) {
throw new Exception('Invalid directory [' . $servicePath . ']');
}
$servicePath = realpath($servicePath);
$serviceMap = array();
$classMap = KAutoloader::getClassMap();
$checkedClasses = array();
foreach ($classMap as $class => $classFilePath) {
$classFilePath = realpath($classFilePath);
if (strpos($classFilePath, $servicePath) === 0) {
$reflectionClass = new ReflectionClass($class);
if ($reflectionClass->isSubclassOf('KalturaBaseService')) {
$docComment = $reflectionClass->getDocComment();
$parser = new KalturaDocCommentParser($docComment);
$serviceId = strtolower($parser->serviceName);
$serviceMap[$serviceId] = $class;
}
}
$checkedClasses[] = $class;
}
$pluginServices = array();
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaServices');
foreach ($pluginInstances as $pluginName => $pluginInstance) {
$pluginServices = $pluginInstance->getServicesMap();
foreach ($pluginServices as $serviceName => $serviceClass) {
$serviceName = strtolower($serviceName);
$serviceId = "{$pluginName}_{$serviceName}";
$pluginServices[$serviceId] = $serviceClass;
$serviceMap[$serviceId] = $serviceClass;
}
}
$cachedFile = '';
$cachedFile .= '<?php' . PHP_EOL;
$cachedFile .= 'self::$services = ' . var_export($serviceMap, true) . ';' . PHP_EOL;
if (!is_dir(dirname($cacheFilePath))) {
mkdir(dirname($cacheFilePath), 0777);
}
file_put_contents($cacheFilePath, $cachedFile);
}
示例5: get
/**
* @param string $type
* @return KalturaTypeReflector
*/
static function get($type)
{
if (!self::$_enabled) {
return new KalturaTypeReflector($type);
}
if (!array_key_exists($type, self::$_loadedTypeReflectors)) {
$cachedDir = KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "typeReflector");
if (!is_dir($cachedDir)) {
mkdir($cachedDir);
}
$cachedFilePath = $cachedDir . DIRECTORY_SEPARATOR . $type . ".cache";
if (file_exists($cachedFilePath)) {
$cachedData = file_get_contents($cachedFilePath);
$typeReflector = unserialize($cachedData);
} else {
$typeReflector = new KalturaTypeReflector($type);
$cachedData = serialize($typeReflector);
file_put_contents($cachedFilePath, $cachedData);
}
self::$_loadedTypeReflectors[$type] = $typeReflector;
}
return self::$_loadedTypeReflectors[$type];
}
示例6: __construct
<?php
// AWS SDK PHP Client Library
require_once KAutoloader::buildPath(KALTURA_ROOT_PATH, 'vendor', 'aws', 'aws-autoloader.php');
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
use Aws\S3\Enum\CannedAcl;
/**
* Extends the 'kFileTransferMgr' class & implements a file transfer manager using the Amazon S3 protocol with Authentication Version 4.
* For additional comments please look at the 'kFileTransferMgr' class.
*
* @package infra
* @subpackage Storage
*/
class s3Mgr extends kFileTransferMgr
{
private $s3;
protected $filesAcl = CannedAcl::PRIVATE_ACCESS;
protected $s3Region = '';
// instances of this class should be created usign the 'getInstance' of the 'kFileTransferMgr' class
protected function __construct(array $options = null)
{
parent::__construct($options);
if ($options && isset($options['filesAcl'])) {
$this->filesAcl = $options['filesAcl'];
}
if ($options && isset($options['s3Region'])) {
$this->s3Region = $options['s3Region'];
}
// do nothing
$this->connection_id = 1;
示例7: Zend_Config_Ini
<?php
require_once __DIR__ . "/../../bootstrap.php";
KalturaLog::setContext("CLIENTS");
KalturaLog::debug(__FILE__ . " start");
$generatorPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator");
$generatorOutputPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "output");
$generatorConfigPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "config.ini");
$config = new Zend_Config_Ini($generatorConfigPath);
?>
<ul>
<?php
foreach ($config as $name => $item) {
if (!$item->get("public-download")) {
continue;
}
$outputFilePath = KAutoloader::buildPath($generatorOutputPath, $name . ".tar.gz");
$outputFileRealPath = realpath($outputFilePath);
if ($outputFileRealPath) {
print '<li>';
print '<a href="download.php?name=' . $name . '"> Download ' . $name . '</a>';
print '</li>';
}
}
?>
</ul>
<?php
KalturaLog::debug(__FILE__ . " end");
示例8: define
* limitations under the License.
*
* Modified by Akvelon Inc.
* 2014-06-30
* http://www.akvelon.com/contact-us
*/
/**
*
* @package Scheduler
*/
require_once "../infra/bootstrap_base.php";
require_once KALTURA_ROOT_PATH . '/infra/kConf.php';
require_once KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
define("KALTURA_BATCH_PATH", KALTURA_ROOT_PATH . "/batch");
// Autoloader - override the autoloader defaults
require_once KALTURA_INFRA_PATH . "/KAutoloader.php";
KAutoloader::setClassPath(array(KAutoloader::buildPath(KALTURA_ROOT_PATH, "infra", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "PHPMailer", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "phpseclib", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"), KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "*"), KAutoloader::buildPath(KALTURA_BATCH_PATH, "*")));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*", "batch", "*"));
KAutoloader::setIncludePath(array(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "ZendFramework", "library")));
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/batch/classMap.cache');
KAutoloader::register();
set_include_path(get_include_path() . PATH_SEPARATOR . KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "phpseclib"));
set_include_path(get_include_path() . PATH_SEPARATOR . KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "apps", "kaltura", "lib"));
// Logger
$loggerConfigPath = KALTURA_ROOT_PATH . "/configurations/logger.ini";
try {
$config = new Zend_Config_Ini($loggerConfigPath);
KalturaLog::initLog($config->batch);
KalturaLog::setContext("BATCH");
} catch (Zend_Config_Exception $ex) {
}
示例9: isset
<?php
require_once ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "bootstrap.php";
KalturaLog::setContext("CLIENTS");
KalturaLog::debug(__FILE__ . " start");
$requestedName = isset($_GET["name"]) ? $_GET['name'] : null;
if (!$requestedName) {
die("File not found");
}
$generatorOutputPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "output");
$generatorConfigPath = KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator", "config.ini");
$config = new Zend_Config_Ini($generatorConfigPath);
foreach ($config as $name => $item) {
if ($name === $requestedName && $item->get("public-download")) {
$fileName = $name . ".tar.gz";
$outputFilePath = KAutoloader::buildPath($generatorOutputPath, $fileName);
$outputFilePath = realpath($outputFilePath);
header("Content-disposition: attachment; filename={$fileName}");
kFile::dumpFile($outputFilePath, "application/gzip");
die;
}
}
die("File not found");
KalturaLog::debug(__FILE__ . " end");
示例10: init
/**
*
* Used to initialize the ui conf deployment like a bootstarp fiel
* @param unknown_type $conf_file_path
*/
public static function init($conf_file_path)
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "bootstrap_base.php";
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "kConf.php";
define("KALTURA_API_PATH", KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3");
// Autoloader
require_once KALTURA_INFRA_PATH . DIRECTORY_SEPARATOR . "KAutoloader.php";
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "lib", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "services", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "plugins", "*"));
// needed for testmeDoc
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator"));
// needed for testmeDoc
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/deploy/' . basename(__FILE__) . '.cache');
//KAutoloader::dumpExtra();
KAutoloader::register();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
date_default_timezone_set(kConf::get("date_default_timezone"));
// try
// {
$confObj = new Zend_Config_Ini($conf_file_path);
// }
// catch(Exception $ex)
// {
// echo 'Exiting on ERROR: '.$ex->getMessage().PHP_EOL;
// exit(1);
// }
return $confObj;
}
示例11: init
public static function init($conf_file_path)
{
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "infra" . DIRECTORY_SEPARATOR . "bootstrap_base.php";
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'kConf.php';
define("KALTURA_API_PATH", KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3");
// Autoloader
require_once KALTURA_INFRA_PATH . DIRECTORY_SEPARATOR . "KAutoloader.php";
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "propel", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "lib", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_API_PATH, "services", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "alpha", "plugins", "*"));
// needed for testmeDoc
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "plugins", "*"));
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "generator"));
// needed for testmeDoc
KAutoloader::setClassMapFilePath(kConf::get("cache_root_path") . '/deploy/classMap.cache');
//KAutoloader::dumpExtra();
KAutoloader::register();
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$conf = parse_ini_file($conf_file_path, true);
$confObj = new Zend_Config_Ini($conf_file_path);
return $confObj;
}
示例12: initClassMap
protected function initClassMap()
{
if ($this->_classMap !== null) {
return;
}
$classMapFileLocation = KAutoloader::getClassMapFilePath();
$this->_classMap = unserialize(file_get_contents($classMapFileLocation));
}
示例13: loadChildTypes
private function loadChildTypes(KalturaTypeReflector $typeReflector)
{
$typesDir = KALTURA_ROOT_PATH . DIRECTORY_SEPARATOR . "api_v3" . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR . "types" . DIRECTORY_SEPARATOR;
$typesDir = realpath($typesDir);
$classMapFileLcoation = KAutoloader::getClassMapFilePath();
$classMap = unserialize(file_get_contents($classMapFileLcoation));
foreach ($classMap as $class => $path) {
if (strpos($path, $typesDir) === 0) {
$reflector = new ReflectionClass($class);
if ($class == 'KalturaFileSyncFilter') {
continue;
}
if ($reflector->isSubclassOf($typeReflector->getType())) {
$classTypeReflector = KalturaTypeReflectorCacher::get($class);
if ($classTypeReflector) {
$this->loadTypesRecursive($classTypeReflector);
}
}
}
}
}
示例14: microtime
<?php
require_once "../../bootstrap.php";
KalturaLog::setContext("TESTME");
$type = $_GET["type"];
$bench_start = microtime(true);
KalturaLog::INFO(">------- api_v3 testme type [{$type}]-------");
function toArrayRecursive(KalturaPropertyInfo $propInfo)
{
return $propInfo->toArray(true);
}
$subClasses = array();
try {
KalturaTypeReflector::setClassInheritMapPath(KAutoloader::buildPath(kConf::get("cache_root_path"), "api_v3", "KalturaClassInheritMap.cache"));
if (!KalturaTypeReflector::hasClassInheritMapCache()) {
$config = new Zend_Config_Ini("../../config/testme.ini");
$indexConfig = $config->get('testme');
$include = $indexConfig->get("include");
$exclude = $indexConfig->get("exclude");
$excludePaths = $indexConfig->get("excludepaths");
$additional = $indexConfig->get("additional");
$clientGenerator = new DummyForDocsClientGenerator();
$clientGenerator->setIncludeOrExcludeList($include, $exclude, $excludePaths);
$clientGenerator->setAdditionalList($additional);
$clientGenerator->load();
$objects = $clientGenerator->getTypes();
KalturaTypeReflector::setClassMap(array_keys($objects));
}
$subClassesNames = KalturaTypeReflector::getSubClasses($type);
foreach ($subClassesNames as $subClassName) {
$subClass = new KalturaPropertyInfo($subClassName);
示例15: getClassFilePath
private function getClassFilePath($class)
{
$map = KAutoloader::getClassMap();
if (!isset($map[$class])) {
throw new Exception("File path was not found for [{$class}]");
}
return $map[$class];
}