当前位置: 首页>>代码示例>>PHP>>正文


PHP instantiate函数代码示例

本文整理汇总了PHP中instantiate函数的典型用法代码示例。如果您正苦于以下问题:PHP instantiate函数的具体用法?PHP instantiate怎么用?PHP instantiate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了instantiate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCitationOutputFilterInstance

 /**
  * Retrieve the citation output filter that will be
  * used to transform citations.
  * @return TemplateBasedFilter
  */
 function getCitationOutputFilterInstance()
 {
     $citationOutputFilterName = $this->getData('citationOutputFilterName');
     assert(!is_null($citationOutputFilterName));
     list($inputTypeDescription, $outputTypeDescription) = $this->getCitationOutputFilterTypeDescriptions();
     $filterGroup = PersistableFilter::tempGroup($inputTypeDescription, $outputTypeDescription);
     return instantiate($citationOutputFilterName, 'TemplateBasedFilter', null, null, $filterGroup);
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:13,代码来源:TemplateBasedReferencesListFilter.inc.php

示例2: get_callable

/**
 * get_callable() is used to retrieve a PHP callable from a specification.
 * 
 * P framework allows callables to be anything that passes is_callable()
 * or anything in the form "Class->method"
 *
 * @param callable|string $specification
 * @param array|\ArrayAccess $parameters
 * @return \callable
 */
function get_callable($specification, $parameters = array())
{
    if (is_callable($specification)) {
        return $specification;
    } elseif (is_instantiable($specification)) {
        return instantiate($specification, $parameters);
    }
    throw new \InvalidArgumentException('Provided specification cannot become callable');
}
开发者ID:pframework,项目名称:p,代码行数:19,代码来源:functions.php

示例3: instantiate

 /**
  * Get the supported meta-data schema (lazy load)
  * @return MetadataSchema
  */
 function &getMetadataSchema()
 {
     // Lazy-load the meta-data schema if this has
     // not been done before.
     if (is_null($this->_metadataSchema)) {
         $this->_metadataSchema =& instantiate($this->getMetadataSchemaName(), 'MetadataSchema');
         assert(is_object($this->_metadataSchema));
     }
     return $this->_metadataSchema;
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:14,代码来源:MetadataDataObjectAdapter.inc.php

示例4: fatalError

 /**
  * Retrieve a reference to the specified DAO.
  * @param $name string the class name of the requested DAO
  * @param $dbconn ADONewConnection optional
  * @return DAO
  */
 function &getDAO($name, $dbconn = null)
 {
     $daos =& DAORegistry::getDAOs();
     if (!isset($daos[$name])) {
         // Import the required DAO class.
         $application =& PKPApplication::getApplication();
         $className = $application->getQualifiedDAOName($name);
         if (!$className) {
             fatalError('Unrecognized DAO ' . $name . '!');
         }
         // Only instantiate each class of DAO a single time
         $daos[$name] =& instantiate($className, array('DAO', 'XMLDAO'));
         if ($dbconn != null) {
             $daos[$name]->setDataSource($dbconn);
         }
     }
     return $daos[$name];
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:24,代码来源:DAORegistry.inc.php

示例5: fatalError

 /**
  * Retrieve a reference to the specified DAO.
  * @param $name string the class name of the requested DAO
  * @param $dbconn ADONewConnection optional
  * @return DAO
  */
 function &getDAO($name, $dbconn = null)
 {
     $daos =& DAORegistry::getDAOs();
     if (!isset($daos[$name])) {
         // Import the required DAO class.
         $application =& PKPApplication::getApplication();
         $className = $application->getQualifiedDAOName($name);
         if (!$className) {
             fatalError('Unrecognized DAO ' . $name . '!');
         }
         // Only instantiate each class of DAO a single time
         $daos[$name] =& instantiate($className, array('DAO', 'XMLDAO'));
         if ($dbconn != null) {
             // FIXME Needed by installer but shouldn't access member variable directly
             $daos[$name]->_dataSource = $dbconn;
         }
     }
     return $daos[$name];
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:25,代码来源:DAORegistry.inc.php

示例6: explode

 /**
  * Takes a plain text type descriptor, identifies the namespace
  * and instantiates the corresponding type description object.
  *
  * @param $typeDescription string A plain text type description.
  *
  *  Type descriptions consist of two parts:
  *  * a type namespace
  *  * a type name (optionally including parameters like cardinality, etc.)
  *
  *  Example:
  *    primitive::string[5]
  *    -> namespace: primitive - type name: string[5]
  *
  *  Each namespace will be mapped to one subclass of the TypeDescription
  *  class which will then be responsible to parse the given type name.
  *
  * @return TypeDescription or null if the type description is invalid.
  */
 function &instantiateTypeDescription($typeDescription)
 {
     $nullVar = null;
     // Identify the namespace
     $typeDescriptionParts = explode('::', $typeDescription);
     if (count($typeDescriptionParts) != 2) {
         return $nullVar;
     }
     // Map the namespace to a type description class
     $typeDescriptionClass = $this->_namespaceMap($typeDescriptionParts[0]);
     if (is_null($typeDescriptionClass)) {
         return $nullVar;
     }
     // Instantiate and return the type description object
     $typeDescriptionObject =& instantiate($typeDescriptionClass, 'TypeDescription', null, null, $typeDescriptionParts[1]);
     if (!is_object($typeDescriptionObject)) {
         return $nullVar;
     }
     return $typeDescriptionObject;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:39,代码来源:TypeDescriptionFactory.inc.php

示例7: XML_HTMLSax

 /**
  * Constructs XML_HTMLSax selecting concrete StateParser subclass
  * depending on PHP version being used as well as setting the default
  * NullHandler for all callbacks<br />
  * @access public
  */
 function XML_HTMLSax()
 {
     if (version_compare(phpversion(), '4.3', 'ge')) {
         $this->state_parser = instantiate('XML_HTMLSax_StateParser_Gtet430', $this);
     } else {
         $this->state_parser = instantiate('XML_HTMLSax_StateParser_Lt430', $this);
     }
     $nullhandler = instantiate('XML_HTMLSax_NullHandler');
     $this->set_object($nullhandler);
     $this->set_element_handler('DoNothing', 'DoNothing');
     $this->set_data_handler('DoNothing');
     $this->set_pi_handler('DoNothing');
     $this->set_jasp_handler('DoNothing');
     $this->set_escape_handler('DoNothing');
 }
开发者ID:freebasic,项目名称:fbwikka,代码行数:21,代码来源:HTMLSax.php

示例8: installFilterTemplates

 /**
  * Installs filter template entries into the filters table.
  * FIXME: Move this to plug-in installation when moving filters to plug-ins, see #5157.
  */
 function installFilterTemplates()
 {
     // Filters are supported on PHP5+ only.
     if (!checkPhpVersion('5.0.0')) {
         return true;
     }
     $filterDao =& DAORegistry::getDAO('FilterDAO');
     $filtersToBeInstalled = array('lib.pkp.classes.citation.lookup.crossref.CrossrefNlmCitationSchemaFilter', 'lib.pkp.classes.citation.lookup.pubmed.PubmedNlmCitationSchemaFilter', 'lib.pkp.classes.citation.lookup.worldcat.WorldcatNlmCitationSchemaFilter', 'lib.pkp.classes.citation.parser.freecite.FreeciteRawCitationNlmCitationSchemaFilter', 'lib.pkp.classes.citation.parser.paracite.ParaciteRawCitationNlmCitationSchemaFilter', 'lib.pkp.classes.citation.parser.parscit.ParscitRawCitationNlmCitationSchemaFilter', 'lib.pkp.classes.citation.parser.regex.RegexRawCitationNlmCitationSchemaFilter', 'lib.pkp.classes.citation.output.abnt.NlmCitationSchemaAbntFilter', 'lib.pkp.classes.citation.output.apa.NlmCitationSchemaApaFilter', 'lib.pkp.classes.citation.output.mla.NlmCitationSchemaMlaFilter', 'lib.pkp.classes.citation.output.vancouver.NlmCitationSchemaVancouverFilter', 'lib.pkp.classes.importexport.nlm.PKPSubmissionNlmXmlFilter');
     import('lib.pkp.classes.citation.output.PlainTextReferencesListFilter');
     foreach ($filtersToBeInstalled as $filterToBeInstalled) {
         // Instantiate filter.
         $filter =& instantiate($filterToBeInstalled, 'Filter');
         // Install citation output filters as non-configurable site-wide filter instances.
         if (is_a($filter, 'NlmCitationSchemaCitationOutputFormatFilter') || is_a($filter, 'PKPSubmissionNlmXmlFilter')) {
             $filter->setIsTemplate(false);
             // Check whether the filter instance has been
             // installed before.
             $existingFilters =& $filterDao->getObjectsByClass($filterToBeInstalled, 0, false);
             // Install other filter as configurable templates.
         } else {
             $filter->setIsTemplate(true);
             // Check whether the filter template has been
             // installed before.
             $existingFilters =& $filterDao->getObjectsByClass($filterToBeInstalled, 0, true);
         }
         // Guarantee idempotence.
         if ($existingFilters->getCount()) {
             continue;
         }
         // Install the filter or template.
         $filterDao->insertObject($filter, 0);
         // If this is a citation output filter then also install a corresponding references list filter.
         if (is_a($filter, 'NlmCitationSchemaCitationOutputFormatFilter')) {
             // Only Vancouver Style listings require numerical ordering.
             if (is_a($filter, 'NlmCitationSchemaVancouverFilter')) {
                 $ordering = REFERENCES_LIST_ORDERING_NUMERICAL;
             } else {
                 $ordering = REFERENCES_LIST_ORDERING_ALPHABETICAL;
             }
             // Instantiate the filter.
             $referencesListFilter = new PlainTextReferencesListFilter($filter->getDisplayName(), $filter->getClassName(), $ordering);
             $referencesListFilter->setIsTemplate(false);
             // Install the filter.
             $filterDao->insertObject($referencesListFilter, 0);
             unset($referencesListFilter);
         }
         unset($filter);
     }
     // Composite filters are more complex to install because they
     // need to be constructed first:
     // 1) Check and install the ISBNdb filter template.
     $alreadyInstalled = false;
     $existingTemplatesFactory =& $filterDao->getObjectsByClass('lib.pkp.classes.filter.GenericSequencerFilter', 0, true);
     $existingTemplates =& $existingTemplatesFactory->toArray();
     foreach ($existingTemplates as $existingTemplate) {
         $subFilters =& $existingTemplate->getFilters();
         if (count($subFilters) != 2) {
             continue;
         }
         if (!(isset($subFilters[1]) && is_a($subFilters[1], 'IsbndbNlmCitationSchemaIsbnFilter'))) {
             continue;
         }
         if (!(isset($subFilters[2]) && is_a($subFilters[2], 'IsbndbIsbnNlmCitationSchemaFilter'))) {
             continue;
         }
         $alreadyInstalled = true;
         break;
     }
     if (!$alreadyInstalled) {
         // Instantiate the filter as a configurable template.
         $isbndbTransformation = array('metadata::lib.pkp.classes.metadata.nlm.NlmCitationSchema(CITATION)', 'metadata::lib.pkp.classes.metadata.nlm.NlmCitationSchema(CITATION)');
         import('lib.pkp.classes.filter.GenericSequencerFilter');
         $isbndbFilter = new GenericSequencerFilter('ISBNdb', $isbndbTransformation);
         $isbndbFilter->setIsTemplate(true);
         // Instantiate and add the NLM-to-ISBN filter.
         import('lib.pkp.classes.citation.lookup.isbndb.IsbndbNlmCitationSchemaIsbnFilter');
         $nlmToIsbnFilter = new IsbndbNlmCitationSchemaIsbnFilter();
         $isbndbFilter->addFilter($nlmToIsbnFilter);
         // Instantiate and add the ISBN-to-NLM filter.
         import('lib.pkp.classes.citation.lookup.isbndb.IsbndbIsbnNlmCitationSchemaFilter');
         $isbnToNlmFilter = new IsbndbIsbnNlmCitationSchemaFilter();
         $isbndbFilter->addFilter($isbnToNlmFilter);
         // Add the settings mapping.
         $isbndbFilter->setSettingsMapping(array('apiKey' => array('seq' . $nlmToIsbnFilter->getSeq() . '_apiKey', 'seq' . $isbnToNlmFilter->getSeq() . '_apiKey'), 'isOptional' => array('seq' . $nlmToIsbnFilter->getSeq() . '_isOptional', 'seq' . $isbnToNlmFilter->getSeq() . '_isOptional')));
         // Persist the composite filter.
         $filterDao->insertObject($isbndbFilter, 0);
     }
     // 3) Check and install the NLM XML 2.3 output filter.
     $alreadyInstalled = false;
     $existingTemplatesFactory =& $filterDao->getObjectsByClass('lib.pkp.classes.filter.GenericSequencerFilter', 0, false);
     $existingTemplates =& $existingTemplatesFactory->toArray();
     foreach ($existingTemplates as $existingTemplate) {
         $subFilters =& $existingTemplate->getFilters();
         if (count($subFilters) != 2) {
             continue;
         }
//.........这里部分代码省略.........
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:101,代码来源:Installer.inc.php

示例9: str_replace

 /**
  * Get the (validated) RPC service endpoint from the request.
  * If no such RPC service endpoint can be constructed then the method
  * returns null.
  * @param $request PKPRequest the request to be routed
  * @return callable an array with the handler instance
  *  and the handler operation to be called by call_user_func().
  */
 function &getRpcServiceEndpoint(&$request)
 {
     if ($this->_rpcServiceEndpoint === false) {
         // We have not yet resolved this request. Mark the
         // state variable so that we don't try again next
         // time.
         $this->_rpcServiceEndpoint = $nullVar = null;
         //
         // Component Handler
         //
         // Retrieve requested component handler
         $component = $this->getRequestedComponent($request);
         if (empty($component)) {
             return $nullVar;
         }
         // Construct the component handler file name and test its existence.
         $component = 'controllers.' . $component;
         $componentFileName = str_replace('.', '/', $component) . '.inc.php';
         switch (true) {
             case file_exists($componentFileName):
                 break;
             case file_exists('lib/pkp/' . $componentFileName):
                 $component = 'lib.pkp.' . $component;
                 break;
             default:
                 // Request to non-existent handler
                 return $nullVar;
         }
         // We expect the handler to be part of one
         // of the following packages:
         $allowedPackages = array('controllers', 'lib.pkp.controllers');
         // Retrieve requested component operation
         $op = $this->getRequestedOp($request);
         assert(!empty($op));
         // A handler at least needs to implement the
         // following methods:
         $requiredMethods = array($op, 'authorize', 'validate', 'initialize');
         $componentInstance =& instantiate($component, 'PKPHandler', $allowedPackages, $requiredMethods);
         if (!is_object($componentInstance)) {
             return $nullVar;
         }
         //
         // Callable service endpoint
         //
         // Construct the callable array
         $this->_rpcServiceEndpoint = array($componentInstance, $op);
     }
     return $this->_rpcServiceEndpoint;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:57,代码来源:PKPComponentRouter.inc.php

示例10: _getDaoDelegate

 /**
  * Return the requested SubmissionFileDAODelegate.
  * @param $fileImplementation string the class name of
  *  a file implementation that the requested delegate
  *  should serve.
  * @return SubmissionFileDAODelegate
  */
 private function _getDaoDelegate($fileImplementation)
 {
     // Normalize the file implementation name.
     $fileImplementation = strtolower_codesafe($fileImplementation);
     // Did we already instantiate the requested delegate?
     if (!isset($this->_delegates[$fileImplementation])) {
         // Instantiate the requested delegate.
         $delegateClasses = $this->getDelegateClassNames();
         assert(isset($delegateClasses[$fileImplementation]));
         $delegateClass = $delegateClasses[$fileImplementation];
         $this->_delegates[$fileImplementation] = instantiate($delegateClass, 'SubmissionFileDAODelegate', null, null, $this);
     }
     // Return the delegate.
     return $this->_delegates[$fileImplementation];
 }
开发者ID:energylevels,项目名称:pkp-lib,代码行数:22,代码来源:PKPSubmissionFileDAO.inc.php

示例11: fatalError

 /**
  * Instantiate a plugin.
  *
  * This method can be called statically.
  *
  * @param $category string
  * @param $categoryDir string
  * @param $file string
  * @param $classToCheck string set null to maintain pre-2.3.x backwards compatibility
  * @return Plugin
  */
 function &_instantiatePlugin($category, $categoryDir, $file, $classToCheck = null)
 {
     if (!is_null($classToCheck) && !preg_match('/[a-zA-Z0-9]+/', $file)) {
         fatalError('Invalid product name "' . $file . '"!');
     }
     $pluginPath = "{$categoryDir}/{$file}";
     $plugin = null;
     // Try the plug-in wrapper first for backwards
     // compatibility.
     $pluginWrapper = "{$pluginPath}/index.php";
     if (file_exists($pluginWrapper)) {
         $plugin = (include $pluginWrapper);
         if ($classToCheck) {
             assert(is_a($plugin, $classToCheck));
         }
     } else {
         // Try the well-known plug-in class name next.
         $pluginClassName = ucfirst($file) . ucfirst($category) . 'Plugin';
         $pluginClassFile = $pluginClassName . '.inc.php';
         if (file_exists("{$pluginPath}/{$pluginClassFile}")) {
             // Try to instantiate the plug-in class.
             $pluginPackage = 'plugins.' . $category . '.' . $file;
             $plugin =& instantiate($pluginPackage . '.' . $pluginClassName, $pluginClassName, $pluginPackage, 'register');
         }
     }
     // Make sure that the plug-in inherits from the right class.
     if (is_object($plugin)) {
         assert(is_a($plugin, 'Plugin'));
     } else {
         assert(is_null($plugin));
     }
     return $plugin;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:44,代码来源:PluginRegistry.inc.php

示例12: assert

 /**
  * Instantiates the given class from the given
  * package
  * @param $packageName string
  * @param $className string
  * @return object
  */
 function &instantiateClass($packageName, $className)
 {
     assert(!empty($packageName) && !empty($className));
     $object =& instantiate($packageName . '.' . $className, $className);
     return $object;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:13,代码来源:ClassTypeDescription.inc.php

示例13: instantiate

 /**
  * @see TemplateBasedReferencesListFilter::getCitationOutputFilterInstance()
  */
 function &getCitationOutputFilterInstance()
 {
     $citationOutputFilterName = $this->getData('citationOutputFilterName');
     $nlmCitationOutputFilter =& instantiate($citationOutputFilterName, 'NlmCitationSchemaCitationOutputFormatFilter');
     return $nlmCitationOutputFilter;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:9,代码来源:PlainTextReferencesListFilter.inc.php

示例14: foreach

$image->descriptionHtmlSyndicated = FEED_DESCRIPTION_HTML;
$rss->image = $image;
$n = (int) $n;
// get feed items
// To optimize memory usage, we should load the minimum items. But, we must load
// more than what we need, because we may have no rights on some items.
// Twice the number we need is just an arbitrary value!!! (2*$n)
if ($comments = $this->LoadRecentComments(2 * $n)) {
    $c = 0;
    foreach ($comments as $comment) {
        if (!$this->HasAccess('comment_read', $comment['page_tag'])) {
            continue;
        }
        $c++;
        #$item = new FeedItem();
        $item = instantiate('FeedItem');
        $item->title = $comment['page_tag'];
        $item->link = str_replace('&amp;', '&', $this->Href('', $comment['page_tag'], 'show_comments=1') . '#comment_' . $comment['id']);
        // @@@ ^ uses &amp;amp; in all formats - this is FC escaping the &amp; that Href() outputs
        // WARNING: the double escape comes from the use of htmlspecialchars()
        // see also recentchanges.xml.php
        $item->date = date('r', strtotime($comment['time']));
        $item->description = 'By ' . $comment['user'] . ': ' . $comment['comment'] . "\n";
        // @@@ ^ JW: should link to actual comment, or (maybe) the page that has the comment
        /*
        http://dublincore.org/documents/1999/07/02/dces/
        Element: Source
        
          Name:        Source
          Identifier:  Source
          Definition:  A Reference to a resource from which the present resource
开发者ID:freebasic,项目名称:fbwikka,代码行数:31,代码来源:comments.xml.php

示例15: instantiate

 /**
  * Construct a new configured filter instance (transformation).
  * @param $filterClassName string a fully qualified class name
  * @param $inputType string
  * @param $outputType string
  * @return Filter
  */
 function &_newDataObject($filterClassName, $inputType, $outputType)
 {
     // Instantiate the filter
     $filter =& instantiate($filterClassName, 'Filter');
     if (!is_object($filter)) {
         fatalError('Error while instantiating class "' . $filterClassName . '" as filter!');
     }
     // Set input/output data types (transformation type).
     // NB: This will raise a fatal error if the transformation is not
     // supported by this filter.
     $filter->setTransformationType($inputType, $outputType);
     return $filter;
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:20,代码来源:FilterDAO.inc.php


注:本文中的instantiate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。