本文整理汇总了PHP中PSU::is_wpid方法的典型用法代码示例。如果您正苦于以下问题:PHP PSU::is_wpid方法的具体用法?PHP PSU::is_wpid怎么用?PHP PSU::is_wpid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSU
的用法示例。
在下文中一共展示了PSU::is_wpid方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWpid
function testWpid()
{
$this->assertTrue(PSU::is_wpid('p0intless'), 'good wpid (default flags)');
$this->assertFalse(PSU::is_wpid('t0intless'), 'bad initial char (default flags)');
$this->assertFalse(PSU::is_wpid('p0intlss'), 'short wpid (default flags)');
$this->assertFalse(PSU::is_wpid('p0intlessss'), 'long wpid (default flags)');
$this->assertFalse(PSU::is_wpid('paintless'), 'missing number (default flags)');
$this->assertTrue(PSU::is_wpid('p0intless', PSU::MATCH_WPID), 'good wpid (wpid flag)');
$this->assertFalse(PSU::is_wpid('t0intless', PSU::MATCH_WPID), 'bad initial char (wpid flag)');
$this->assertFalse(PSU::is_wpid('p0intlss', PSU::MATCH_WPID), 'short wpid (wpid flag)');
$this->assertFalse(PSU::is_wpid('p0intlessss', PSU::MATCH_WPID), 'long wpid (wpid flag)');
$this->assertFalse(PSU::is_wpid('paintless', PSU::MATCH_WPID), 'missing number (wpid flag)');
$this->assertTrue(PSU::is_wpid('t0intless', PSU::MATCH_TEMPID), 'good tempid (tempid flag)');
$this->assertFalse(PSU::is_wpid('p0intless', PSU::MATCH_TEMPID), 'bad initial char (tempid flag)');
$this->assertFalse(PSU::is_wpid('t0intlss', PSU::MATCH_TEMPID), 'short wpid (tempid flag)');
$this->assertFalse(PSU::is_wpid('t0intlessss', PSU::MATCH_TEMPID), 'long wpid (tempid flag)');
$this->assertFalse(PSU::is_wpid('taintless', PSU::MATCH_TEMPID), 'missing number (tempid flag)');
$this->assertTrue(PSU::is_wpid('p0intless', PSU::MATCH_BOTH), 'good wpid (both flag)');
$this->assertTrue(PSU::is_wpid('t0intless', PSU::MATCH_BOTH), 'good tempid (both flag)');
$this->assertFalse(PSU::is_wpid('z0intless', PSU::MATCH_BOTH), 'bad wpid (both flag)');
$this->assertFalse(PSU::is_wpid('p0intlss', PSU::MATCH_BOTH), 'short wpid (both flag)');
$this->assertFalse(PSU::is_wpid('t0intlss', PSU::MATCH_BOTH), 'short tempid (both flag)');
$this->assertFalse(PSU::is_wpid('p0intlessss', PSU::MATCH_BOTH), 'long wpid (both flag)');
$this->assertFalse(PSU::is_wpid('t0intlessss', PSU::MATCH_BOTH), 'long tempid (both flag)');
$this->assertFalse(PSU::is_wpid('paintless', PSU::MATCH_BOTH), 'missing wpid number (both flag)');
$this->assertFalse(PSU::is_wpid('taintless', PSU::MATCH_BOTH), 'missing tempid number (both flag)');
}
示例2: loader_preflight
public function loader_preflight($identifier)
{
if (!PSU::is_wpid($identifier, PSU::MATCH_TEMPID)) {
return false;
}
$this->person->identifier = $identifier;
$this->person->wpid = $this->person->wp_id = $identifier;
$this->person->identifier_type = 'relationship-tempid';
return true;
}
示例3: loader_preflight
public function loader_preflight($identifier)
{
if (PSU::is_wpid($identifier)) {
$this->person->identifier_type = 'wp_id';
$this->person->wp_id = $this->person->wpid = $identifier;
if ($this->_get_userdatabylogin($identifier)) {
return true;
}
} elseif ($this->person->wp_id) {
if ($this->_get_userdatabylogin($this->person->wp_id)) {
return true;
}
}
return false;
}
示例4: die
IDMObject::authN();
if (!IDMObject::authZ('role', 'myplymouth')) {
die('no access');
}
echo '<pre>';
PSU::get()->portal = PSU::db('portal_dev');
$sql = "SELECT DISTINCT wpid1 FROM relsearch WHERE substr(wpid1, 1, 1) <> 't'";
$wpids = PSU::db('portal')->GetCol($sql);
$sql = "SELECT DISTINCT wp_id FROM usertabs WHERE wp_id != 0 AND substr(wp_id, 1, 1) <> 't'";
$wpids2 = PSU::db('portal')->GetCol($sql);
$wpids = array_merge($wpids, $wpids2);
$wpids = array_unique($wpids);
sort($wpids);
if (!$_GET['simple']) {
echo "// append ?simple=1 to url to hide names\n\n";
}
foreach ($wpids as $wpid) {
$p = new PSUPerson($wpid);
if ($_GET['simple'] == 1) {
if ($p->wp_email) {
echo $p->wp_email . ", ";
}
} else {
if (PSU::is_wpid($wpid, PSU::MATCH_TEMPID)) {
printf("%30s [%s] %s\n", "", $wpid, $p->wp_email);
} else {
printf("%30s [%s] %s\n", $p->first_name . " " . $p->last_name, $wpid, $p->wp_email);
}
}
$p->destroy();
}
示例5: relationships
/**
* Return all relationships, or the relationships between this person and another person.
* If you need to filter by status, use MyRelationships::get().
*
* @param $wpid
* @return MyRelationship|array MyRelationship object, or array of MyRelationship objects
* @sa MyRelationships::get()
*/
public function relationships($identifier = null)
{
$wpid = $relid = null;
if (PSU::is_wpid($identifier, PSU::MATCH_BOTH)) {
$wpid = $identifier;
} elseif (ctype_digit($identifier) || is_int($identifier)) {
$relid = $identifier;
}
if ($wpid) {
if (isset($this->relationships[$wpid])) {
return $this->_relationship($wpid);
}
return $f = false;
}
if ($relid) {
foreach ($this->relationships as $wpid => $id_or_myr) {
if (!$id_or_myr instanceof MyRelationship) {
if ($relid == $id_or_myr) {
return $this->_relationship($wpid);
}
} elseif ($relid == $id_or_myr->id) {
return $id_or_myr;
}
}
return $f = false;
}
//
// returning all relationships; make sure they are populated
//
foreach ((array) $this->relationships as $wpid => $id) {
// touch each
$this->_relationship($wpid);
}
return $this->relationships;
}
示例6: array
require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_tab.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_channel.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_admin.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/MyPortal.class.php';
require_once 'PSUModels/Model.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/MyValues.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/ChannelForm.class.php';
require_once $GLOBALS['BASE_DIR'] . '/includes/TabForm.class.php';
require_once 'MyRelationships.class.php';
/*******************[End Common Includes]**********************/
/*******************[Authentication Stuff]*****************/
IDMObject::authN();
// get rid of cas cruft in url
if (isset($_GET['ticket'])) {
PSU::redirect($GLOBALS['BASE_URL'] . '/');
}
/*******************[End Authentication Stuff]*****************/
$GLOBALS['identifier'] = PSU::is_wpid($_SESSION['username']) ? $_SESSION['username'] : $_SESSION['wp_id'];
// session namespace for portal variables
if (!isset($_SESSION['portal'])) {
$_SESSION['portal'] = array();
}
//session alert if logged in as portalord
if ($_SESSION['generic_user_type'] == 'portalord') {
$_SESSION['messages'][] = 'You are currently logged in as PortaLord. <a href="' . $GLOBALS['BASE_URL'] . '/admin/unset-type">Resume your session</a>';
}
if (!$GLOBALS['identifier']) {
$_SESSION['errors'][] = 'You are logged in as the default user! ANYTHING you do will be done for EVERY DEFAULT LAYOUT!';
}
//end if
MyController::delegate();
示例7: getPersonAttributes
/**
* getPersonAttributes
*
* Get attributes assigned to a specific person.
*
* @since version 1.1.1
* @access public
* @param int $pidm the person's pid
* @param int|string $attribute optional. an attribute to filter for
* @param int $filter_type include or exclude $attribute. Use IDM_INCLUDE or IDM_EXCLUDE
* @param boolean $current whether or not only currently active attributes should be returned
*/
function getPersonAttributes($pidm, $attribute = false, $filter_type = self::IDM_INCLUDE, $current = true)
{
// wpid-only has not attributes
if (PSU::is_wpid($pidm)) {
return array();
}
// setup possible where clause to filter on attributes
$attr_sql = '';
if ($attribute) {
if ($filter_type == self::IDM_INCLUDE) {
$filter = '=';
} else {
$filter = '!=';
}
//end else
$attribute = $this->getAttributeId($attribute);
$attr_sql = "AND type_id {$filter} {$attribute}";
}
//end if
$current_sql = '';
if ($current) {
$current_sql = 'AND sysdate >= start_date AND (sysdate <= (end_date+1) OR end_date IS NULL)';
}
//end if
// build the sql statement
$sql = "SELECT *\n\t\t\t\t\t\t\tFROM {$this->table['person_attribute']}\n\t\t\t\t\t\t WHERE 1=1\n\t\t\t\t\t\t\t\t\t {$current_sql}\n\t\t\t\t\t\t\t\t\t {$attr_sql}\n\t\t\t\t\t\t\t\t\t AND pidm = :pidm";
// array to hold our massaged query set
$data = $this->initTypeArray();
$result = $this->db->GetAll($sql, array('pidm' => $pidm));
if ($result === false) {
return false;
}
//end if
// sql succeeded, update
foreach ($result as $row) {
$attribute_type = $this->getAttributeName($row['type_id']);
$data[$attribute_type][$row['attribute']] = $row;
unset($data[$row['attribute']]['attribute']);
}
//end foreach
return $data;
}