本文整理汇总了PHP中self::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP self::initialize方法的具体用法?PHP self::initialize怎么用?PHP self::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromNative
public static function fromNative(\DateInterval $native)
{
$interval = new self();
$interval->native = $native;
$interval->initialize();
return $interval;
}
示例2: newFromTitle
/**
* Factory function
*/
public static function newFromTitle($title)
{
$evt = new self();
$evt->mOriginTitle = $title;
$evt->initialize();
return $evt;
}
示例3: newItem
public static function newItem($trackerId)
{
$obj = new self();
$obj->info = array();
$obj->definition = Tracker_Definition::get($trackerId);
$obj->initialize();
return $obj;
}
示例4: create
/**
* @param string $path_
* @param string $storage_
* @param string[] $schema_
*
* @return \Components\Media_Store
*/
public static function create($path_, $storage_, array $schema_)
{
$instance = new self($path_);
$instance->initialize();
@file_put_contents($instance->path . '/' . self::NAME_MANIFEST, json_encode(['storage' => $storage_, 'schema' => $schema_]));
$instance->load();
Cache::set('components/media/store/' . md5($path_), serialize($instance));
return $instance;
}
示例5: getInstanceFromValues
/**
* Function to get the instance of Vtiger Link Model from the given array of key-value mapping
* @param <Array> $valueMap
* @return Vtiger_Link_Model instance
*/
public static function getInstanceFromValues($valueMap)
{
$linkModel = new self();
$linkModel->initialize($valueMap);
// To set other properties for Link Model
foreach ($valueMap as $property => $value) {
if (!isset($linkModel->{$property})) {
$linkModel->{$property} = $value;
}
}
return $linkModel;
}
示例6: createUser
/**
* Create a new instance
*
* @param ApplicationUserId $id
* @param string $name
* @param string $language
*
* @return SourcedUser
*/
public static function createUser(ApplicationUserId $id, $name, $language)
{
$user = new self();
$user->initialize($id, $name, $language);
return $user;
}
示例7: listAll
static function listAll($module=false, $asc=true) {
global $adb;
$instances = Array();
$result = false;
if ($module) {
if ($asc)
$result = $adb->pquery('SELECT * FROM vtiger_modtracker_basic
WHERE module=? ORDER BY id', Array($module));
else
$result = $adb->pquery('SELECT * FROM vtiger_modtracker_basic
WHERE module=? ORDER BY id DESC', Array($module));
}
if ($result && $adb->num_rows($result)) {
for ($index = 0; $index < $adb->num_rows($result); ++$index) {
$rowmap = $adb->fetch_array($result);
$instance = new self();
$instance->initialize($rowmap);
$instances[] = $instance;
}
}
return $instances;
}
示例8: instance
/**
* Singleton to ensure that Content Types is only loaded once.
*
* @since 1.0.0
* @access public
* @static
*
* @see wpct()
*
* @return WPCT|WP_Error The Content Types instance or an error object if it failed to initialize.
*/
public static function instance()
{
static $instance = null;
if (null === $instance) {
$status = self::check_requirements();
if (is_wp_error($status)) {
$instance = $status;
add_action('admin_notices', array(__CLASS__, 'admin_error_notice'));
} else {
$main_file = __FILE__;
list($is_mu_plugin, $basedir_relative) = self::detect_library_mode($main_file);
$instance = new self($main_file, $is_mu_plugin, $basedir_relative);
$action = $is_mu_plugin ? 'muplugins_loaded' : 'plugins_loaded';
if (did_action($action)) {
$instance->initialize();
} else {
add_action($action, array($instance, 'initialize'));
}
}
}
return $instance;
}
示例9: getAllForModule
/**
* Get all block instances associated with the module
* @param Vtiger_Module Instance of the module
*/
static function getAllForModule($moduleInstance)
{
global $adb;
$instances = false;
$query = "SELECT * FROM vtiger_blocks WHERE tabid=? ORDER BY sequence";
$queryParams = array($moduleInstance->id);
$result = $adb->pquery($query, $queryParams);
for ($index = 0; $index < $adb->num_rows($result); ++$index) {
$instance = new self();
$instance->initialize($adb->fetch_array($result), $moduleInstance);
$instances[] = $instance;
}
return $instances;
}
示例10: getInstanceFromFieldId
public static function getInstanceFromFieldId($fieldId, $moduleTabId)
{
$db = PearDatabase::getInstance();
if (is_string($fieldId)) {
$fieldId = array($fieldId);
}
$query = 'SELECT * FROM vtiger_field WHERE fieldid IN (' . generateQuestionMarks($fieldId) . ') AND tabid=?';
$result = $db->pquery($query, array($fieldId, $moduleTabId));
$fieldModelList = array();
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$row = $db->query_result_rowdata($result, $i);
$fieldModel = new self();
$fieldModel->initialize($row);
$fieldModelList[] = $fieldModel;
}
return $fieldModelList;
}
示例11: findModule
/**
* Loads a module object by name.
* The only difference with exists() is that the $module parameter will be
* assigned the found module.
*
* @param string $moduleName The name of the module to find (ex: content)
* @param mixed $module This parameter will receive the found module object
* @param array|string
* Either an array of path or a single path string. These will be
* used as additionnal locations that will be looked into
* @param boolean $showError
* If true an error will be shown if the module it not found.
* @return eZModule The eZModule object, or null if the module wasn't found
* @see exists()
*/
static function findModule($moduleName, $module = null, $pathList = null, $showError = false)
{
if ($pathList === null) {
$pathList = array();
} else {
if (!is_array($pathList)) {
$pathList = array($pathList);
}
}
$searchPathList = self::globalPathList();
if ($searchPathList === null) {
$searchPathList = array();
}
$searchPathList = array_merge($searchPathList, $pathList);
$triedList = array();
$triedDirList = array();
$foundADir = false;
foreach ($searchPathList as $path) {
$dir = "{$path}/{$moduleName}";
$file = "{$dir}/module.php";
if (file_exists($file)) {
if ($module === null) {
$module = new self($path, $file, $moduleName, false);
} else {
$module->initialize($path, $file, $moduleName, false);
}
return $module;
} else {
if (!file_exists($dir)) {
$triedDirList[] = $dir;
} else {
$foundADir = true;
$triedList[] = $dir;
}
}
}
$msg = "Could not find module named '{$moduleName}'";
if ($foundADir) {
$msg = "\nThese directories had a directory named '{$moduleName}' but did not contain the module.php file:\n" . implode(", ", $triedList) . "\n" . "This usually means it is missing or has a wrong name.";
if (count($triedDirList) > 0) {
$msg .= "\n\nThese directories were tried too but none of them exists:\n" . implode(', ', $triedDirList);
}
} else {
if (count($triedDirList) > 0) {
$msg .= "\nThese directories were tried but none of them exists:\n" . implode(", ", $triedDirList);
}
}
if ($showError) {
eZDebug::writeWarning($msg);
}
return null;
}
示例12: getAllByType
/**
* Get all the link related to module based on type
* @param Integer Module ID
* @param mixed String or List of types to select
* @param Map Key-Value pair to use for formating the link url
*/
static function getAllByType($tabid, $type = false, $parameters = false)
{
global $adb;
self::__initSchema();
$multitype = false;
if ($type) {
// Multiple link type selection?
if (is_array($type)) {
$multitype = true;
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')', array($adb->flatten_array($type)));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')', array($tabid, $adb->flatten_array($type)));
}
} else {
// Single link type selection
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype=?', array($type));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype=?', array($tabid, $type));
}
}
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=?', array($tabid));
}
$strtemplate = new Vtiger_StringTemplate();
if ($parameters) {
foreach ($parameters as $key => $value) {
$strtemplate->assign($key, $value);
}
}
$instances = array();
if ($multitype) {
foreach ($type as $t) {
$instances[$t] = array();
}
}
while ($row = $adb->fetch_array($result)) {
$instance = new self();
$instance->initialize($row);
if ($parameters) {
$instance->linkurl = $strtemplate->merge($instance->linkurl);
$instance->linkicon = $strtemplate->merge($instance->linkicon);
}
if ($multitype) {
$instances[$instance->linktype][] = $instance;
} else {
$instances[] = $instance;
}
}
return $instances;
}
示例13: getAllForModule
/**
* Get all block instances associated with the module
* @param Vtiger_Module Instance of the module
*/
static function getAllForModule($moduleInstance)
{
global $adb;
$instances = false;
/** START 大熊追加 151217 ***/
//ユーザごとの部署の取得
$query_users = "SELECT `division` FROM `vtiger_users`";
$query_users .= " WHERE TRUE ";
$query_users .= " AND `id` = {$_SESSION['authenticated_user_id']} ";
$result_users = $adb->pquery($query_users);
$row_users = $adb->fetch_array($result_users);
$division_name = $row_users['division'];
/** END 大熊追加 151217 ***/
# $query = "SELECT * FROM vtiger_blocks WHERE tabid=? ORDER BY sequence";
/** START 大熊追加 151217 ***/
$query = " SELECT * FROM vtiger_blocks WHERE tabid=? ";
switch ($division_name) {
case '101:求人広告':
$query .= " AND `blocklabel` NOT IN ('WS', 'SC') ";
break;
case '202:Webコミュ':
$query .= " AND `blocklabel` NOT IN ('HR', 'SC') ";
break;
case '201:風評コンサル':
$query .= " AND `blocklabel` NOT IN ('HR', 'SC') ";
break;
case '203:サロコン':
$query .= " AND `blocklabel` NOT IN ('HR', 'WS') ";
break;
}
//End switch
$query .= " ORDER BY sequence ";
/** END 大熊追加 151217 ***/
$queryParams = array($moduleInstance->id);
$result = $adb->pquery($query, $queryParams);
for ($index = 0; $index < $adb->num_rows($result); ++$index) {
$instance = new self();
$instance->initialize($adb->fetch_array($result), $moduleInstance);
$instances[] = $instance;
}
return $instances;
}
示例14: createGame
/**
* Create a new instance
*
* @param MiniGameId $id
* @param string $word
* @return Hangman
*/
public static function createGame(MiniGameId $id, $word)
{
$hangman = new self();
$hangman->initialize($id, $word);
return $hangman;
}
示例15: getInstance
/**
* Get instance of menu by label
* @param String Menu label
*/
static function getInstance($value)
{
global $adb;
$query = false;
$instance = false;
if (Vtiger_Utils::isNumber($value)) {
$query = "SELECT * FROM vtiger_parenttab WHERE parenttabid=?";
} else {
$query = "SELECT * FROM vtiger_parenttab WHERE parenttab_label=?";
}
$result = $adb->pquery($query, array($value));
if ($adb->num_rows($result)) {
$instance = new self();
$instance->initialize($adb->fetch_array($result));
}
return $instance;
}