本文整理汇总了PHP中self::load方法的典型用法代码示例。如果您正苦于以下问题:PHP self::load方法的具体用法?PHP self::load怎么用?PHP self::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* @param string $pathName
* @param string $mode [r,w]
* @return static
*/
public static function create($pathName, $mode = self::MODE_READ)
{
$yaml = new self($pathName);
if ($mode == self::MODE_READ) {
$yaml->load();
} elseif ($mode == self::MODE_WRITE) {
try {
touch($pathName);
} catch (\ErrorException $e) {
throw new ApplicationException("Error creating file '{$pathName}'");
}
$yaml->load();
}
return $yaml;
}
示例2: store
/**
* @param bool $updateNulls
* @return bool
*/
public function store( $updateNulls = false )
{
global $_PLUGINS;
$new = ( $this->get( 'id' ) ? false : true );
$old = new self();
$this->set( 'type', preg_replace( '/[^-a-zA-Z0-9_.]/', '', $this->get( 'type' ) ) );
if ( ! $new ) {
$old->load( (int) $this->get( 'id' ) );
$_PLUGINS->trigger( 'activity_onBeforeUpdateHidden', array( &$this, $old ) );
} else {
$_PLUGINS->trigger( 'activity_onBeforeCreateHidden', array( &$this ) );
}
if ( ! parent::store( $updateNulls ) ) {
return false;
}
if ( ! $new ) {
$_PLUGINS->trigger( 'activity_onAfterUpdateHidden', array( $this, $old ) );
} else {
$_PLUGINS->trigger( 'activity_onAfterCreateHidden', array( $this ) );
}
return true;
}
示例3: set_password
/**
* crypt password
* Defines whether to use bcrypt or salted MD5
* @param $val
* @return string
*/
public function set_password($val)
{
$f3 = \Base::instance();
if (!$val) {
$userDetails = new self();
$userDetails->load(array('username = ?', $f3->get('POST.username')));
$val = $userDetails->password;
return $val;
} else {
$hash_engine = $f3->get('password_hash_engine');
switch ($hash_engine) {
case 'bcrypt':
$crypt = \Bcrypt::instance();
$val = $crypt->hash($val);
break;
case 'md5':
// fall-through
// fall-through
default:
$val = md5($val . $f3->get('password_md5_salt'));
break;
}
return $val;
}
}
示例4: isBlocked
public static function isBlocked()
{
$ip_block_model = new self();
$ip_block_model->setCond('ip = "' . $_SERVER['REMOTE_ADDR'] . '"');
$ip_block = $ip_block_model->load();
return !empty($ip_block);
}
示例5: store
/**
* @param bool $updateNulls
* @return bool
*/
public function store( $updateNulls = false )
{
global $_PLUGINS;
$new = ( $this->get( 'id' ) ? false : true );
$old = new self();
if ( ! $new ) {
$old->load( (int) $this->get( 'id' ) );
$_PLUGINS->trigger( 'gj_onBeforeUpdateNotification', array( &$this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onBeforeCreateNotification', array( &$this ) );
}
if ( ! parent::store( $updateNulls ) ) {
return false;
}
if ( ! $new ) {
$_PLUGINS->trigger( 'gj_onAfterUpdateNotification', array( $this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onAfterCreateNotification', array( $this ) );
}
return true;
}
示例6: store
/**
* @param bool $updateNulls
* @return bool
*/
public function store( $updateNulls = false )
{
global $_PLUGINS;
$new = ( $this->get( 'id' ) ? false : true );
$old = new self();
$this->set( 'date', $this->get( 'date', Application::Database()->getUtcDateTime() ) );
if ( ! $new ) {
$old->load( (int) $this->get( 'id' ) );
$_PLUGINS->trigger( 'gj_onBeforeUpdateAttendance', array( &$this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onBeforeCreateAttendance', array( &$this ) );
}
if ( ! parent::store( $updateNulls ) ) {
return false;
}
if ( ! $new ) {
$_PLUGINS->trigger( 'gj_onAfterUpdateAttendance', array( $this, $old ) );
} else {
$_PLUGINS->trigger( 'gj_onAfterCreateAttendance', array( $this ) );
}
return true;
}
示例7: collectDay
public static function collectDay($date)
{
$instance = new self();
$instance->load($date, 'date');
$instance->setDate($date);
$carts = Mage::getModel('adjcartalert/quotestat')->getCollection();
$carts->getSelect()->where('`cart_abandon_date` BETWEEN \'' . $instance->getDate() . '\' AND \'' . $instance->getDate() . '\' + INTERVAL 1 DAY');
$abandonedItemsNum = 0;
$abandonedCartsPrice = 0;
$recoveredCarts = 0;
$orderedItemsNum = 0;
$orderedCartsPrice = 0;
$orderedCarts = 0;
$letterStep = 0;
//$orderTime = 0;
$moduleCouponsUsed = 0;
foreach ($carts as $cart) {
$abandonedCartsPrice += $cart->getCartPrice();
$items = unserialize($cart->getCartItems());
foreach ($items as $item) {
$abandonedItemsNum += $item;
}
if ($cart->getRecoveryDate()) {
$recoveredCarts++;
}
if ($cart->getOrderDate()) {
$orderedCarts++;
$orderedCartsPrice += $cart->getOrderPrice();
$items = unserialize($cart->getOrderItems());
foreach ($items as $item) {
$orderedItemsNum += $item;
}
$letterStep += $cart->getAlertNumber();
}
if ($cart->getAlertCouponGenerated() != '' && $cart->getAlertCouponGenerated() == $cart->getOrderCouponUsed()) {
$moduleCouponsUsed++;
}
}
$instance->setAbandonedCartsNum(count($carts));
$instance->setAbandonedCartsPrice($abandonedCartsPrice);
$instance->setAbandonedItemsNum($abandonedItemsNum);
$instance->setRecoveredCartsNum($recoveredCarts);
$instance->setOrderedCartsNum($orderedCarts);
$instance->setOrderedCartsPrice($orderedCartsPrice);
$instance->setOrderedItemsNum($orderedItemsNum);
$instance->setOrderedItemsNum($orderedItemsNum);
$instance->setCouponsUsed($moduleCouponsUsed);
if ($orderedCarts) {
/*$orderTime = round($orderTime / $orderedCarts);
$orderTimeS = $orderTime % 60;
$orderTime = (int)$orderTime/60;
$orderTimeM = $orderTime % 60;
$orderTime = (int)$orderTime/60;
$instance->setAvBackTime($orderTime.':'.$orderTimeM.':'.$orderTimeS);*/
$instance->setTargetLetterStep($letterStep / $orderedCarts);
}
$instance->save();
}
示例8: 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;
}
示例9: factory
public static function factory($model)
{
$paths = static::service('paths');
$paths->setModel($model);
$relations = new self();
$relations->setRelationsTree($paths->relationsTree())->setRelationsTreeIndex($paths->relationsTreeIndex());
$relations->load();
return $relations;
}
示例10: getInstance
public static function getInstance($file)
{
static $instance;
if (!$instance) {
$instance = new self();
$instance->load($file);
}
return $instance;
}
示例11: getByName
/**
* @param $name
* @return Config
* @throws \Exception
*/
public static function getByName($name)
{
$pipe = new self();
$pipe->setName($name);
if (!is_readable($pipe->getConfigFile()) || !$pipe->load()) {
throw new \Exception("video thumbnail definition : " . $name . " does not exist");
}
return $pipe;
}
示例12: getByID
public static function getByID($avID)
{
$cav = new self();
$cav->load($avID);
if ($cav->getAttributeValueID() == $avID) {
return $cav;
}
return null;
}
示例13: getByName
/**
* @param $name
* @return Config
* @throws \Exception
*/
public static function getByName($name)
{
$letter = new self();
$letter->setName($name);
if (!$letter->load()) {
throw new \Exception("newsletter definition : " . $name . " does not exist");
}
return $letter;
}
示例14: getByHandle
public static function getByHandle($akHandle)
{
$ak = new self();
$ak->load($akHandle, 'akHandle');
if ($ak->getAttributeKeyID() < 1) {
$ak = -1;
}
return $ak;
}
示例15: getByName
/**
* @static
* @param $name
* @return Tool_Tag_Config
*/
public static function getByName($name)
{
$tag = new self();
$tag->setName($name);
if (!$tag->load()) {
throw new Exception("tag definition : " . $name . " does not exist");
}
return $tag;
}