• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Extension类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Extension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: testSetsGetsProperties

 public function testSetsGetsProperties()
 {
     $instance = new Extension(static::$name, static::$file, static::$type, static::$client, static::$group);
     self::assertEquals('plg_system_test', $instance->getName());
     self::assertEquals('some_file.zip', $instance->getFile()->getName());
     self::assertEquals('plugin', $instance->getType());
     self::assertEquals(null, $instance->getClient());
     self::assertEquals('system', $instance->getGroup());
 }
开发者ID:vikijel,项目名称:joomla-extensions-packager,代码行数:9,代码来源:ExtensionTest.php


示例12: register

 /**
  * Register component
  */
 public function register($base_path)
 {
     if (!file_exists($base_path) && !is_dir($base_path)) {
         throw new ExtensionException(sprintf('path %s not exists', $base_path));
     }
     if (!isset($this->base_path)) {
         $this->base_path = $base_path;
     }
     $this->component = basename($base_path);
     $this->component_name = $this->component;
     $this->registerLanguage();
     $this->registerFiles(['model', 'view', 'controller', 'table'], $base_path);
     $this->registerRoutes();
     $this->includeInitialize();
     if ($this->base_path == $base_path) {
         $pluginArchitecture = Extension::get('plugin');
         $pluginArchitecture->register($this->base_path);
     }
     $hmvc_base_path = $base_path . DIRECTORY_SEPARATOR . 'components';
     if (file_exists($hmvc_base_path) && is_dir($hmvc_base_path)) {
         $this->register($hmvc_base_path);
     }
 }
开发者ID:cyan-framework,项目名称:cms,代码行数:26,代码来源:component.php


示例13:

Extension::enabling(function (Extension $extension) {
    // Before an extension is enabled
});
Extension::enabled(function (Extension $extension) {
    // After an extension is enabled
});
Extension::disabling(function (Extension $extension) {
    // Before an extension is disabled
});
Extension::disabled(function (Extension $extension) {
    // After an extension is disabled
});
Extension::upgrading(function (Extension $extension) {
    // Before an extension is upgraded
});
Extension::upgraded(function (Extension $extension) {
    // After an extension is upgraded
});
/*
|--------------------------------------------------------------------------
| Miscellaneous Hooks
|--------------------------------------------------------------------------
|
| Hooks for all other parts of Platform.
|
*/
if (class_exists('Page')) {
    Page::rendering(function (Page $page) {
        // Page is rendering, return an array of additional data
    });
}
开发者ID:c27cochran,项目名称:citysnapshot,代码行数:31,代码来源:hooks.php


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: 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


示例19: add

 public static function add()
 {
     parent::add();
     self::$facebook_app_id = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app id: ", "[app_id]");
     self::$facebook_api_secret = Installer::getComposerEvent()->getIO()->ask(":: enter your facebook app secret: ", "[app_secret]");
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[app_id]", self::getFacebookAppId());
     File::replaceContent(Installer::getRootDirConfig() . self::getConfigfile(), "[api_secret]", self::getFacebookApiSecret());
     File::addContent(Installer::getRootDirTheme() . "Includes/Footer.ss", "<% include FacebookLoginLink %>", "SilverStripe</a></small>");
     Installer::getComposerEvent()->getIO()->write(":: added facebookconnect extension");
 }
开发者ID:helpfulrobot,项目名称:hpmewes-silverstripe-install,代码行数:10,代码来源:FacebookConnectExtension.php


示例20: takeAttributeFromDOM

 /**
  * Given a DOMNode representing an attribute, tries to map the data into
  * instance members.  If no mapping is defined, the name and value are
  * stored in an array.
  *
  * @param DOMNode $attribute The DOMNode attribute needed to be handled
  */
 protected function takeAttributeFromDOM($attribute)
 {
     switch ($attribute->localName) {
         case 'value':
             $this->_value = $attribute->nodeValue;
             break;
         default:
             parent::takeAttributeFromDOM($attribute);
     }
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:17,代码来源:AttendeeType.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ExtensionManager类代码示例发布时间:2022-05-23
下一篇:
PHP Expression类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap