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


PHP Extension类代码示例

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


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

示例1: createExtensions

 public function createExtensions()
 {
     $Extension = new Extension();
     $this->AdminUsers = $Extension->create(array('name' => 'Admin::Users', 'is_core' => true, 'is_enabled' => true));
     $this->AdminPermissions = $Extension->create(array('name' => 'Admin::Permissions', 'is_core' => true, 'is_enabled' => true));
     $this->AdminRoles = $Extension->create(array('name' => 'Admin::Roles', 'is_core' => true, 'is_enabled' => true));
     $this->AdminDashboard = $Extension->create(array('name' => 'Admin::Dashboard', 'is_core' => true, 'is_enabled' => true));
     $this->AdminMenuTabs = $Extension->create(array('name' => 'Admin Menu Tabs', 'is_core' => true, 'is_enabled' => true));
 }
开发者ID:bermi,项目名称:admin,代码行数:9,代码来源:admin_plugin_installer.php

示例2: addExtension

 /**
  * @param array|string $synonyms
  * @param Extension $extension
  */
 public function addExtension($synonyms, Extension $extension)
 {
     if (!is_array($synonyms)) {
         $synonyms = array($synonyms);
     }
     foreach ($synonyms as $synonym) {
         $extension->init($this);
         $this->extensions[$synonym] = $extension;
     }
 }
开发者ID:enlitepro,项目名称:russell-interpreter,代码行数:14,代码来源:Interpreter.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     $this->errors = new MessageStack();
     $this->fields = array();
     $this->editing = $this->failed = false;
     $this->datasource = $this->handle = $this->status = $this->type = NULL;
     $this->types = array();
     foreach (new ExtensionIterator(ExtensionIterator::FLAG_TYPE, array('Data Source')) as $extension) {
         $path = Extension::getPathFromClass(get_class($extension));
         $handle = Extension::getHandleFromPath($path);
         if (Extension::status($handle) != Extension::STATUS_ENABLED) {
             continue;
         }
         if (!method_exists($extension, 'getDataSourceTypes')) {
             continue;
         }
         foreach ($extension->getDataSourceTypes() as $type) {
             $this->types[$type->class] = $type;
         }
     }
     if (empty($this->types)) {
         $this->alerts()->append(__('There are no Data Source types currently available. You will not be able to create or edit Data Sources.'), AlertStack::ERROR);
     }
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:25,代码来源:content.blueprintsdatasources.php

示例4: __construct

 public function __construct()
 {
     parent::__construct();
     // Validate request passes XSRF checks if extension is enabled.
     $status = Symphony::ExtensionManager()->fetchStatus(array("handle" => "xsrf_protection"));
     if (in_array(EXTENSION_ENABLED, $status) || in_array(EXTENSION_REQUIRES_UPDATE, $status)) {
         XSRF::validateRequest();
     }
 }
开发者ID:richadams,项目名称:xsrf_protection,代码行数:9,代码来源:extension.driver.php

示例5: refreshCache

 /**
  * Re-reads config and refreshes cache.
  *
  * @return  Yaml
  * @throws  Exception\LoaderException
  */
 protected function refreshCache()
 {
     $ext = new Extension();
     $ext->load();
     try {
         $yaml = Yaml::load(self::YAML_FILE);
     } catch (\Exception $e) {
         throw new Exception\LoaderException(sprintf('Could not load config. %s', $e->getMessage()));
     }
     $refSet = new \ReflectionMethod($yaml, 'set');
     $refSet->setAccessible(true);
     $before = clone $yaml;
     foreach ($ext as $key => $obj) {
         if (property_exists($obj, 'default') && (!$yaml->defined($key) || $yaml($key) === null)) {
             //Set defaults only in the case it is provided in the Extension.
             //Set defaults only if they are not overriden in config and not null.
             $refSet->invoke($yaml, $key, $obj->default);
         }
         //Checks if at least one from all parents is not required.
         $token = $key;
         while (strpos($token, '.')) {
             $token = preg_replace('/\\.[^\\.]+$/', '', $token);
             //Parent bag is not required
             if (!$ext->defined($token)) {
                 //And it is not defined in config
                 if (!$before->defined($token)) {
                     continue 2;
                 } else {
                     //check presence of nodes if it is defined in config
                     break;
                 }
             }
         }
         if (!$yaml->defined($key)) {
             //If, after all, value has not been defined in the Extension, it is considered as user error.
             throw new Exception\LoaderException(sprintf('Parameter "%s" must be defined in the config', $key));
         }
     }
     unset($before);
     //serialize yaml
     file_put_contents(self::YAML_CACHE_FILE, serialize($yaml));
     @chmod(self::YAML_CACHE_FILE, 0666);
     return $yaml;
 }
开发者ID:mheydt,项目名称:scalr,代码行数:50,代码来源:Loader.php

示例6: get_status

 public static function get_status($extension_id, $project_id)
 {
     if (is_numeric($extension_id) and is_numeric($project_id)) {
         $run_array = ProjectHasExtensionRun_Access::list_runs_by_extension_id_and_project_id($extension_id, $project_id);
         if (is_array($run_array) and count($run_array) >= 1) {
             $extension = new Extension($extension_id);
             $return = 1;
             foreach ($run_array as $key => $value) {
                 $status = $extension->get_run_status($value);
                 if ($status == 0 or $status == -1) {
                     $return = 0;
                 }
             }
             return $return;
         } else {
             return -1;
         }
     } else {
         return -1;
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:21,代码来源:project_extension.class.php

示例7: io_handler

 /**
  * @param string $alias
  * @throws BaseExtensionClassNotFoundException
  * @throws BaseExtensionFileNotFoundException
  */
 public static function io_handler($alias)
 {
     if ($_GET['extension']) {
         $extension = new Extension($_GET['extension']);
         $main_file = constant("EXTENSION_DIR") . "/" . $extension->get_folder() . "/" . $extension->get_main_file();
         $main_class = $extension->get_class();
         if (file_exists($main_file)) {
             require_once $main_file;
             if (class_exists($main_class)) {
                 $main_class::main();
             } else {
                 throw new BaseExtensionClassNotFoundException();
             }
         } else {
             throw new BaseExtensionFileNotFoundException();
         }
     } else {
         require_once "io/extension.io.php";
         ExtensionIO::home();
     }
 }
开发者ID:suxinde2009,项目名称:www,代码行数:26,代码来源:extension.request.php

示例8: generate

 public function generate($ext, $upool)
 {
     // Creation by daemon
     // Generate content
     $ext_obj = Extension::get($ext);
     if ($ext_obj == null) {
         $this->tournament->say("Extension {$ext} not found in booster generation");
         return false;
     }
     $this->fullcontent = $ext_obj->booster($upool);
     $this->summarize();
     $this->insert();
 }
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:13,代码来源:ws_booster.php

示例9: appendTo

 public function appendTo(SymphonyDOMElement $wrapper)
 {
     $this->layout->setAttribute('class', $this->class);
     ###
     # Delegate: LayoutPreGenerate
     # Description: Allows developers to access the layout content
     #			   before it is appended to the page.
     Extension::notify('LayoutPreGenerate', '/administration/', $this->layout);
     if ($wrapper->tagName == 'form') {
         $this->layout->setAttribute('id', 'layout');
     }
     $wrapper->appendChild($this->layout);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:13,代码来源:class.layout.php

示例10: __construct

 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $appId = Config::inst()->get('FacebookControllerExtension', 'app_id');
     $secret = Config::inst()->get('FacebookControllerExtension', 'api_secret');
     if (!$appId || !$secret) {
         return null;
     }
     FacebookSession::setDefaultApplication($appId, $secret);
     if (session_status() !== PHP_SESSION_ACTIVE) {
         Session::start();
     }
 }
开发者ID:wilr,项目名称:silverstripe-facebookconnect,代码行数:16,代码来源:FacebookControllerExtension.php

示例11: transferFromDOM

 public function transferFromDOM($node)
 {
     parent::transferFromDOM($node);
     $this->_rootNamespace = null;
     $this->_rootNamespaceURI = $node->namespaceURI;
     $this->_rootElement = $node->localName;
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:7,代码来源:Element.php

示例12: singleton

	static function add_to_class($class, $extensionClass, $args = null) {
		if(method_exists($class, 'extraDBFields')) {
			$extraStaticsMethod = 'extraDBFields';
		} else {
			$extraStaticsMethod = 'extraStatics';
		}

		$statics = singleton($extensionClass)->$extraStaticsMethod($class, $extensionClass);

		if ($statics) {
			Deprecation::notice('3.1.0', "$extraStaticsMethod deprecated. Just define statics on your extension, or use add_to_class");

			// TODO: This currently makes extraStatics the MOST IMPORTANT config layer, not the least
			foreach (self::$extendable_statics as $key => $merge) {
				if (isset($statics[$key])) {
					if (!$merge) Config::inst()->remove($class, $key);
					Config::inst()->update($class, $key, $statics[$key]);
				}
			}

			// TODO - remove this
			DataObject::$cache_has_own_table[$class]       = null;
			DataObject::$cache_has_own_table_field[$class] = null;
		}

		parent::add_to_class($class, $extensionClass, $args);
	}
开发者ID:redema,项目名称:sapphire,代码行数:27,代码来源:DataExtension.php

示例13: uninstall

 public function uninstall()
 {
     if (parent::uninstall() == true) {
         Symphony::Database()->query("DROP TABLE `tbl_fields_selectbox_link`");
         return true;
     }
     return false;
 }
开发者ID:brendo,项目名称:selectbox_link_field,代码行数:8,代码来源:extension.driver.php

示例14: setOwner

 function setOwner(Object $owner, $ownerBaseClass = null)
 {
     if (!$owner instanceof DataObject) {
         user_error(sprintf("DataObjectDecorator->setOwner(): Trying to decorate an object of class '%s' with '%s', \n\t\t\t\tonly Dataobject subclasses are supported.", get_class($owner), $this->class), E_USER_ERROR);
         return false;
     }
     parent::setOwner($owner, $ownerBaseClass);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:8,代码来源:DataObjectDecorator.php

示例15: addMiddlewareByClass

 public function addMiddlewareByClass($middlewareClass, $middlewareFile)
 {
     $this->extension->loadMiddleware($middlewareFile);
     /**
      * @var $middleware \MABI\Middleware
      */
     $middleware = new $middlewareClass();
     $this->addMiddleware($middleware);
 }
开发者ID:prolificinteractive,项目名称:mabi,代码行数:9,代码来源:Controller.php


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