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


PHP ElggObject::__construct方法代码示例

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


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

示例1:

 /**
  * Construct hjFrom
  */
 function __construct($guid = null)
 {
     parent::__construct($guid);
     if (!$guid) {
         $this->setDefaults();
     }
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:10,代码来源:hjForm.php

示例2: __construct

 /**
  * Loads the plugin by GUID or path.
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must point it to an actual plugin GUID or location.
  *
  * @param mixed $plugin The GUID of the ElggPlugin object or the path of
  *                      the plugin to load.
  */
 public function __construct($plugin)
 {
     if (!$plugin) {
         throw new PluginException(elgg_echo('PluginException:NullInstantiated'));
     }
     // ElggEntity can be instantiated with a guid or an object.
     // @todo plugins w/id 12345
     if (is_numeric($plugin) || is_object($plugin)) {
         parent::__construct($plugin);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         $plugin_path = elgg_get_plugins_path();
         // not a full path, so assume an id
         // use the default path
         if (strpos($plugin, $plugin_path) !== 0) {
             $plugin = $plugin_path . $plugin;
         }
         // path checking is done in the package
         $plugin = sanitise_filepath($plugin);
         $this->path = $plugin;
         $path_parts = explode('/', rtrim($plugin, '/'));
         $plugin_id = array_pop($path_parts);
         $this->pluginID = $plugin_id;
         // check if we're loading an existing plugin
         $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
         $existing_guid = null;
         if ($existing_plugin) {
             $existing_guid = $existing_plugin->guid;
         }
         // load the rest of the plugin
         parent::__construct($existing_guid);
     }
 }
开发者ID:nachopavon,项目名称:Elgg,代码行数:42,代码来源:ElggPlugin.php

示例3: __construct

 /**
  * Creates a new plugin from path
  *
  * @note Internal: also supports database objects
  *
  * @warning Unlike other \ElggEntity objects, you cannot null instantiate
  *          \ElggPlugin. You must provide the path to the plugin directory.
  *
  * @param string $path The absolute path of the plugin
  *
  * @throws PluginException
  */
 public function __construct($path)
 {
     if (!$path) {
         throw new \PluginException("ElggPlugin cannot be null instantiated. You must pass a full path.");
     }
     if (is_object($path)) {
         // database object
         parent::__construct($path);
         $this->path = _elgg_services()->config->getPluginsPath() . $this->getID();
         _elgg_cache_plugin_by_id($this);
         return;
     }
     if (is_numeric($path)) {
         // guid
         // @todo plugins with directory names of '12345'
         throw new \InvalidArgumentException('$path cannot be a GUID');
     }
     $this->initializeAttributes();
     // path checking is done in the package
     $path = sanitise_filepath($path);
     $this->path = $path;
     $path_parts = explode('/', rtrim($path, '/'));
     $plugin_id = array_pop($path_parts);
     $this->title = $plugin_id;
     // check if we're loading an existing plugin
     $existing_plugin = elgg_get_plugin_from_id($plugin_id);
     if ($existing_plugin) {
         $this->load($existing_plugin->guid);
     }
     _elgg_cache_plugin_by_id($this);
 }
开发者ID:elgg,项目名称:elgg,代码行数:43,代码来源:ElggPlugin.php

示例4: __construct

 public function __construct($guid = null)
 {
     if ($guid && !is_object($guid)) {
         // Loading entities via __construct(GUID) is deprecated, so we give it the entity row and the
         // attribute loader will finish the job. This is necessary due to not using a custom
         // subtype (see above).
         $guid = get_entity_as_row($guid);
     }
     parent::__construct($guid);
 }
开发者ID:nlybe,项目名称:elgg-sharemaps,代码行数:10,代码来源:Drawmap.php

示例5: __construct

 /**
  * Class constructor
  *
  * @param integer  $guid The object guid
  * @param integer  $user_guid The users guid
  * @param string   $description The description (reason) for these points
  */
 public function __construct($guid = null, $user_guid = null, $description = null)
 {
     parent::__construct($guid);
     if ($guid) {
         return true;
     }
     if (!($user = get_entity($user_guid))) {
         return false;
     }
     $this->attributes['owner_guid'] = $user_guid;
     $this->attributes['container_guid'] = $user_guid;
     $this->attributes['description'] = $description;
 }
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:20,代码来源:Groupuserpoint.php

示例6: __construct

 /**
  * Loads the plugin by GUID or path.
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must point it to an actual plugin GUID or location.
  *
  * @param mixed $plugin The GUID of the ElggPlugin object or the path of
  *                      the plugin to load.
  */
 public function __construct($plugin)
 {
     if (!$plugin) {
         throw new PluginException(elgg_echo('PluginException:NullInstantiated'));
     }
     // ElggEntity can be instantiated with a guid or an object.
     // @todo plugins w/id 12345
     if (is_numeric($plugin) || is_object($plugin)) {
         parent::__construct($plugin);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         $plugin_path = elgg_get_plugins_path();
         // not a full path, so assume an id
         // use the default path
         if (strpos($plugin, $plugin_path) !== 0) {
             $plugin = $plugin_path . $plugin;
         }
         // path checking is done in the package
         $plugin = sanitise_filepath($plugin);
         $this->path = $plugin;
         $path_parts = explode('/', rtrim($plugin, '/'));
         $plugin_id = array_pop($path_parts);
         $this->pluginID = $plugin_id;
         // check if we're loading an existing plugin
         $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
         $existing_guid = null;
         if ($existing_plugin) {
             $existing_guid = $existing_plugin->guid;
         }
         // load the rest of the plugin
         parent::__construct($existing_guid);
     }
     // We have to let the entity load so we can manipulate it with the API.
     // If the path is wrong or would cause an exception, catch it,
     // disable the plugin, and emit an error.
     try {
         $this->package = new ElggPluginPackage($this->path, false);
         $this->manifest = $this->package->getManifest();
     } catch (Exception $e) {
         // we always have to allow the entity to load.
         elgg_log("Failed to load {$this->guid} as a plugin. " . $e->getMessage(), 'WARNING');
         $this->errorMsg = $e->getmessage();
     }
 }
开发者ID:rasul,项目名称:Elgg,代码行数:53,代码来源:ElggPlugin.php

示例7: __construct

 /**
  * Creates a new plugin from path
  *
  * @internal also supports database objects
  *
  * @warning Unlike other ElggEntity objects, you cannot null instantiate
  *          ElggPlugin. You must provide the path to the plugin directory.
  *
  * @param string $path The absolute path of the plugin
  *
  * @throws PluginException
  */
 public function __construct($path)
 {
     if (!$path) {
         throw new PluginException("ElggPlugin cannot be null instantiated. You must pass a full path.");
     }
     if (is_object($path)) {
         // database object
         parent::__construct($path);
         $this->path = elgg_get_plugins_path() . $this->getID();
     } else {
         if (is_numeric($path)) {
             // guid
             // @todo plugins with directory names of '12345'
             elgg_deprecated_notice("Use elgg_get_plugin_from_id() to load a plugin.", 1.9);
             parent::__construct($path);
             $this->path = elgg_get_plugins_path() . $this->getID();
         } else {
             $mod_dir = elgg_get_plugins_path();
             // not a full path, so assume a directory name and use the default path
             if (strpos($path, $mod_dir) !== 0) {
                 elgg_deprecated_notice("You should pass a full path to ElggPlugin.", 1.9);
                 $path = $mod_dir . $path;
             }
             // path checking is done in the package
             $path = sanitise_filepath($path);
             $this->path = $path;
             $path_parts = explode('/', rtrim($path, '/'));
             $plugin_id = array_pop($path_parts);
             $this->pluginID = $plugin_id;
             // check if we're loading an existing plugin
             $existing_plugin = elgg_get_plugin_from_id($this->pluginID);
             $existing_guid = null;
             if ($existing_plugin) {
                 $existing_guid = $existing_plugin->guid;
             }
             // load the rest of the plugin
             parent::__construct($existing_guid);
         }
     }
     _elgg_cache_plugin_by_id($this);
 }
开发者ID:tjcaverly,项目名称:Elgg,代码行数:53,代码来源:ElggPlugin.php

示例8: __construct

 public function __construct($guid = null)
 {
     parent::__construct($guid);
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:4,代码来源:ProfileManagerCustomField.php

示例9: __construct

 /**
  * Loads an \ElggFile entity.
  *
  * @param \stdClass $row Database result or null for new \ElggFile
  */
 public function __construct($row = null)
 {
     parent::__construct($row);
     // Set default filestore
     $this->filestore = $this->getFilestore();
 }
开发者ID:thehereward,项目名称:Elgg,代码行数:11,代码来源:ElggFile.php

示例10:

 function __construct()
 {
     parent::__construct();
 }
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:4,代码来源:elggMan.php


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