本文整理汇总了PHP中Options::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::getOption方法的具体用法?PHP Options::getOption怎么用?PHP Options::getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::getOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOption
public function getOption($key)
{
if (null === $this->options) {
return null;
}
return $this->options->getOption($key);
}
示例2: extractPage
public function extractPage($pageID, $pageTitle, $pageSource)
{
$this->extractor->setPageURI($pageID);
if (!$this->extractor->isActive()) {
return $result = new ExtractionResult($pageID, $this->extractor->getLanguage(), $this->getExtractorID());
}
Timer::start($this->extractor->getExtractorID());
$result = $this->extractor->extractPage($pageID, $pageTitle, $pageSource);
Timer::stop($this->extractor->getExtractorID());
Timer::start('validation');
//$this->extractor->check();
if (Options::getOption('validateExtractors')) {
ValidateExtractionResult::validate($result, $this->extractor);
}
Timer::stop('validation');
Statistics::increaseCount($this->extractor->getExtractorID(), 'created_Triples', count($result->getTriples()));
Statistics::increaseCount('Total', 'created_Triples', count($result->getTriples()));
if ($this->extractor->isGenerateOWLAxiomAnnotations()) {
$triples = $result->getTriples();
if (count($triples) > 0) {
foreach ($triples as $triple) {
$triple->addDCModifiedAnnotation();
$triple->addExtractedByAnnotation($this->extractor->getExtractorID());
}
}
}
return $result;
}
示例3: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id = false)
{
if ($id === false) {
$model = new Picture();
} else {
$model = $this->loadModel($id);
}
$msg = '';
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Picture'])) {
$model->attributes = $_POST['Picture'];
$path = Options::getOption('imgPath') . '/' . date('Y') . '/' . date('m') . '/' . date('his') . '-';
$model->image = $path . CUploadedFile::getInstance($model, 'image');
if ($model->save()) {
$pathTo = $_SERVER['DOCUMENT_ROOT'] . $model->image;
}
$pathFrom = $_FILES['Picture']['tmp_name']['image'];
Controller::createPathUploadsNow();
if (!copy($pathFrom, $pathTo)) {
$msg = '<p style="color: red; margin: 5px; border: 1px solid red; text-align: center">Файл не был записан.</p>';
} else {
chmod($pathTo, 0777);
$msg = '<p style="color: green; margin: 5px; border: 1px solid green; text-align: center">Файл был записан.</p>';
}
}
$this->render('create', array('model' => $model, 'msg' => $msg));
}
示例4: plot
public static function plot()
{
$gnuscript = Options::getOption("harvester_gnu_script");
if (Options::getOption("useGnuplot")) {
system("gnuplot {$gnuscript}");
}
}
示例5: getDefaultConnection
public static function getDefaultConnection()
{
$dataSourceName = Options::getOption('Store.dsn');
$username = Options::getOption('Store.user');
$password = Options::getOption('Store.pw');
return new ODBC($dataSourceName, $username, $password);
}
示例6: myDefaultOdbcConnect
/**
* Not used in the release. But a convenience function for testing stuff.
*
*/
function myDefaultOdbcConnect()
{
$dataSourceName = Options::getOption('dsn');
$username = Options::getOption('user');
$password = Options::getOption('pw');
$con = myOdbcConnect($dataSourceName, $username, $password);
return $con;
}
示例7: value
protected function value($row)
{
if (!isset($this->language)) {
$this->language = Options::getOption('language');
}
$category = Util::getMediaWikiNamespace($this->language, MW_CATEGORY_NAMESPACE);
return $category . ":" . $row['page_title'];
}
示例8: __construct
public function __construct($language, $templateNameFilter, $templateDb, $parseHintToTripleGenerator, $mediaWikiUtil)
{
self::$wikiPageUsesTemplateUri = new URI(DB_WIKIPAGEUSESTEMPLATE, false);
$this->breadCrumbTransformer = new DefaultBreadCrumbTransformer();
$this->templateDb = $templateDb;
$this->templateNameFilter = $templateNameFilter;
$this->parseHintToTripleGenerator = $parseHintToTripleGenerator;
$this->mediaWikiUtil = $mediaWikiUtil;
//$this->defaultTripleGenerator = new DefaultTripleGenerator($language);
$this->allowUnmappedProperties = Options::getOption('allowUnmappedProperties');
}
示例9: __construct
public function __construct(URI $subject, $language)
{
$this->subject = $subject;
$this->language = $language;
$this->use = Options::getOption('Sparql.use');
if ($this->use == 'odbc') {
$this->odbc = ODBC::getDefaultConnection();
} else {
$this->sparqlEndpoint = SPARQLEndpoint::getDefaultEndpoint();
}
}
示例10: __construct
public function __construct($oaiId, $subject)
{
$this->subject = $subject;
//$this->subjectOAIidentifier = $subjectOAIidentifier;
// $this->language = $language;
$this->oaiId = $oaiId;
$this->log(INFO, "_construct: " . $this->oaiId . " " . $this->subject);
if (Options::getOption('LiveUpdateDestination.useHashForOptimization')) {
$this->odbc = ODBC::getDefaultConnection();
$this->hasHash = $this->_retrieveHashValues();
$this->active = true;
}
}
示例11: createPathUploadsNow
public static function createPathUploadsNow()
{
$target0 = $_SERVER['DOCUMENT_ROOT'] . Options::getOption('imgPath') . '/' . date('Y');
$target1 = $_SERVER['DOCUMENT_ROOT'] . Options::getOption('imgPath') . '/' . date('Y') . '/' . date('m');
if (!is_dir($target0)) {
mkdir($target0);
chmod($target0, 0777);
}
if (!is_dir($target1)) {
mkdir($target1);
chmod($target1, 0777);
}
}
示例12: start
/**
* Remember language, set URL of modified Wikipedia instance, init cURL,
* call start() on destinations.
* @param $language
* @return void
*/
public function start($language)
{
$this->language = $language;
$this->page_url_format = Options::getOption('AbstractExtractor.page_url_format');
if ($this->page_url_format == null || strlen($this->page_url_format) == 0) {
die('Please define AbstractExtractor.page_url_format in your option file, e.g. dbpedia.ini.');
}
$this->curl = curl_init();
if ($this->extraDestinationsGiven) {
$this->longDestination->start();
$this->shortDestination->start();
}
}
示例13: getPageID
private function getPageID($pageTitle, $PageSource, $Language)
{
if ($Language == "en" || false == Options::getOption('dependsOnEnglishLangLink')) {
return $pageTitle;
} else {
if (Options::getOption('dependsOnEnglishLangLink')) {
if (!preg_match("/\\[\\[en:(.*?)\\]\\]/", $PageSource, $match)) {
return false;
} else {
return str_replace(" ", "_", $match[1]);
/* underscores are allowed in links */
}
} else {
$this->log(ERROR, 'bad tail in ExtractionManager, getPageID');
}
}
}
示例14: accept
public function accept($extractionResult)
{
$model1 = ModelFactory::getDefaultModel(Options::getOption('graphURI'));
// RAP model
$count = 0;
foreach (new ArrayObject($extractionResult->getTriples()) as $triple) {
$count++;
$tripleString = explode(">", $triple->toString());
$s = str_replace("<", "", $tripleString[0]);
$p = str_replace("<", "", $tripleString[1]);
// $s = preg_replace("/<|>/","",$triple->getSubject());
// $p = preg_replace("/<|>/","",$triple->getPredicate());
$o = $tripleString[2];
$subject = new Resource($s);
$predicate = new Resource($p);
if (strpos($o, "<")) {
// echo "<br>" . $s. $p . $p;
if (!strpos($o, "^^")) {
// echo " a";
$o = str_replace("<", "", $o);
$object = new Resource($o);
} else {
// echo " b";
$pos = strpos($o, "^^");
$literal = substr($o, 0, $pos);
$object = new Literal($literal);
$object->setDatatype(substr($o, $pos + 3, strlen($o) - $pos - 3));
}
} else {
// $lang = "en";
if (preg_match("/(.*)(@)([a-zA-Z]+) \\.\$/", $o, $match)) {
$o = $match[1];
$lang = $match[3];
}
$object = new Literal($o, $lang);
}
$statement = new Statement($subject, $predicate, $object);
$model1->add($statement);
}
if ($count > 0) {
echo "<br><br><h3>" . $extractionResult->getExtractorID() . "</h3>";
echo $model1->writeAsHtmlTable();
}
}
示例15: __construct
public function __construct($uri, $doValidation = true)
{
Timer::start('URI::construct');
$this->doValidation = $doValidation && Options::getOption('dbpedia.useURIvalidation');
$this->uri = $uri;
Timer::stop('URI::construct');
//echo "a:$doValidation,b:".Options::getOption('dbpedia.useURIvalidation').", $uri\n";
/*
if ($doValidation && !(strpos($uri,'oai:')===0) ) {
//echo "validation of $uri\n{$this->validate($uri)}\n";
Timer::start('URI::construct::validate');
if(!$this->validate($uri)){
Timer::stop('URI::construct::validate');
Timer::stop('URI::construct');
throw new Exception('URI: Not a valid URI: '.$uri);
}
Timer::stop('URI::construct::validate');
}
*/
}