本文整理汇总了PHP中PerchUtil::count方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::count方法的具体用法?PHP PerchUtil::count怎么用?PHP PerchUtil::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_inputs
public function render_inputs($details = array())
{
if (!class_exists('PerchGallery_Albums')) {
require_once PerchUtil::file_path(PERCH_PATH . '/addons/apps/perch_gallery/PerchGallery_Albums.class.php');
require_once PerchUtil::file_path(PERCH_PATH . '/addons/apps/perch_gallery/PerchGallery_Album.class.php');
}
$id = $this->Tag->input_id();
$val = '';
if (isset($details[$id]) && $details[$id] != '') {
$json = $details[$id];
$val = $json['albumSlug'];
}
$API = new PerchAPI(1, 'perch_gallery');
$Albums = new PerchGallery_Albums($API);
$albums = $Albums->return_all();
$opts = array();
$opts[] = array('label' => '', 'value' => '');
if (PerchUtil::count($albums)) {
foreach ($albums as $Album) {
$opts[] = array('label' => $Album->albumTitle(), 'value' => $Album->albumSlug());
}
}
if (PerchUtil::count($opts)) {
$s = $this->Form->select($id, $opts, $val);
} else {
$s = '-';
}
return $s;
}
示例2: get_index
public function get_index($items)
{
if (PerchUtil::count($items) && PerchUtil::count($this->tags)) {
$index = array();
foreach ($this->tags as $Tag) {
$FieldType = PerchFieldTypes::get($Tag->type(), false, $Tag);
foreach ($items as $item) {
foreach ($item as $key => $val) {
if ($key == $Tag->id()) {
$field_index = $FieldType->get_index($val);
if (PerchUtil::count($field_index)) {
foreach ($field_index as $field_index_item) {
if ($key == $field_index_item['key']) {
$indexing_key = $this->id() . '.' . $key;
} else {
$indexing_key = $this->id() . '.' . $key . '.' . $field_index_item['key'];
}
$index[] = array('key' => $indexing_key, 'value' => $field_index_item['value']);
}
}
}
}
}
}
return $index;
}
return false;
}
示例3: render_inputs
public function render_inputs($details = array())
{
$id = $this->Tag->input_id();
$val = '';
if (isset($details[$id]) && $details[$id] != '') {
$json = $details[$id];
$val = $json['tag'];
}
$DB = PerchDB::fetch();
$sql = 'SELECT * FROM ' . PERCH_DB_PREFIX . 'members_tags ORDER BY tagDisplay';
$memberTags = $DB->get_rows($sql);
$opts = array();
$opts[] = array('label' => '', 'value' => '');
if (PerchUtil::count($memberTags)) {
foreach ($memberTags as $memberTag) {
$opts[] = array('label' => $memberTag['tagDisplay'], 'value' => $memberTag['tag']);
}
}
if (PerchUtil::count($opts)) {
$s = $this->Form->select($id, $opts, $val);
} else {
$s = '-';
}
return $s;
}
示例4: form_login
public function form_login($SubmittedForm)
{
$email = isset($SubmittedForm->data['email']) ? $SubmittedForm->data['email'] : false;
$clear_pwd = isset($SubmittedForm->data['password']) ? $SubmittedForm->data['password'] : false;
if (!$email || !$clear_pwd) {
PerchUtil::debug('Email or password not send.', 'error');
return false;
}
$sql = 'SELECT * FROM ' . $this->table . ' WHERE memberAuthType=\'native\' AND memberEmail=' . $this->db->pdb($email) . ' AND memberStatus=\'active\' AND (memberExpires IS NULL OR memberExpires>' . $this->db->pdb(date('Y-m-d H:i:s')) . ') LIMIT 1';
$result = $this->db->get_row($sql);
if (PerchUtil::count($result)) {
if (strlen($clear_pwd) > 72) {
return false;
}
$stored_password = $result['memberPassword'];
// check which type of password - default is portable
if (defined('PERCH_NONPORTABLE_HASHES') && PERCH_NONPORTABLE_HASHES) {
$portable_hashes = false;
} else {
$portable_hashes = true;
}
$Hasher = new PasswordHash(8, $portable_hashes);
if ($Hasher->CheckPassword($clear_pwd, $stored_password)) {
PerchUtil::debug('Password is ok.', 'auth');
$user_row = $this->verify_user('native', $result['memberAuthID']);
return $user_row;
} else {
PerchUtil::debug('Password failed to match.', 'auth');
return false;
}
} else {
PerchUtil::debug('User not found.', 'auth');
}
return false;
}
示例5: import
public function import()
{
$MailChimpAPI = $this->get_api_instance();
$lists = $MailChimpAPI->get("lists");
if ($MailChimpAPI->success()) {
if (isset($lists['lists']) && PerchUtil::count($lists['lists'])) {
$all_lists = $lists['lists'];
foreach ($all_lists as $list) {
$data = $this->map_fields($list);
if (!$this->remote_list_exists_locally($list['id'])) {
PerchUtil::debug('Importing list: ' . $list['id']);
$this->create($data);
} else {
$Lists = new PerchMailChimp_Lists($this->api);
$List = $Lists->get_one_by('listMailChimpID', $list['id']);
if ($List) {
$List->update($data);
}
}
}
}
} else {
PerchUtil::debug($MailChimpAPI->getLastResponse(), 'error');
}
}
示例6: perch_get_javascript
function perch_get_javascript($opts = false, $return = false)
{
$feathers = PerchSystem::get_registered_feathers();
$out = '';
if (PerchUtil::count($feathers)) {
$count = PerchUtil::count($feathers);
$i = 0;
$components = array();
foreach ($feathers as $feather) {
$classname = 'PerchFeather_' . $feather;
$Feather = new $classname($components);
$out .= $Feather->get_javascript($opts, $i, $count);
$components = $Feather->get_components();
$i++;
}
}
// Inject script when authed
if (isset($_COOKIE['cmsa'])) {
$out .= PerchSystem::get_helper_js();
}
if ($return) {
return $out;
}
echo $out;
PerchUtil::flush_output();
}
示例7: to_array
public function to_array($template_ids = false)
{
$out = parent::to_array();
if (PerchUtil::count($template_ids) && in_array('campaignURL', $template_ids)) {
$out['campaignURL'] = $this->campaignURL();
}
return $out;
}
示例8: expire_all
public static function expire_all()
{
$files = glob(PerchUtil::file_path(PERCH_RESFILEPATH . '/perch_blog.*.cache'));
if (PerchUtil::count($files)) {
foreach ($files as $filename) {
unlink($filename);
}
}
}
示例9: __construct
public function __construct($args)
{
if (PerchUtil::count($args)) {
$this->event = array_shift($args);
$this->subject = array_shift($args);
$this->args = $args;
$Users = new PerchUsers();
$this->user = $Users->get_current_user();
}
}
示例10: update_all_in_set
public function update_all_in_set()
{
$Categories = new PerchCategories_Categories();
$categories = $Categories->get_by('setID', $this->id());
if (PerchUtil::count($categories)) {
foreach ($categories as $Cat) {
$Cat->update_meta(false);
}
}
}
示例11: parse_string
/**
* Parse a string of entered tags (e.g. "this, that, the other") into an array of tags
* @param [type] $str [description]
* @return [type] [description]
*/
public function parse_string($str)
{
$tags = explode(',', $str);
$out = array();
if (PerchUtil::count($tags)) {
foreach ($tags as $tag) {
$out[] = array('tag' => PerchUtil::urlify(trim($tag)), 'tagDisplay' => trim($tag));
}
}
return $out;
}
示例12: perch_content_custom
function perch_content_custom($key = null, $opts = array(), $return = false)
{
if ($key === null) {
return ' ';
}
if (isset($opts['skip-template']) && $opts['skip-template'] == true) {
$return = true;
$postpro = false;
if (isset($opts['return-html']) && $opts['return-html']) {
$postpro = true;
}
} else {
$postpro = true;
}
if (isset($opts['split-items']) && $opts['split-items'] == true) {
$return = true;
}
if (isset($opts['pagination_var'])) {
$opts['pagination-var'] = $opts['pagination_var'];
}
$Content = PerchContent::fetch();
$out = $Content->get_custom($key, $opts);
// Post processing - if there are still <perch:x /> tags
if ($postpro) {
if (is_array($out)) {
// return-html
if (isset($out['html'])) {
if (strpos($out['html'], '<perch:') !== false) {
$Template = new PerchTemplate();
$out['html'] = $Template->apply_runtime_post_processing($out['html']);
}
}
// split-items
if (PerchUtil::count($out) && !isset($out['html'])) {
$Template = new PerchTemplate();
foreach ($out as &$html_item) {
if (strpos($html_item, '<perch:') !== false) {
$html_item = $Template->apply_runtime_post_processing($html_item);
}
}
}
} else {
if (strpos($out, '<perch:') !== false) {
$Template = new PerchTemplate();
$out = $Template->apply_runtime_post_processing($out);
}
}
}
if ($return) {
return $out;
}
echo $out;
PerchUtil::flush_output();
}
示例13: get_stored_users_unique
/**
* Fetch the unique stored users from the database and
* decode the stored user data.
*
* @return array
*/
public function get_stored_users_unique()
{
$return = array();
$sql = "SELECT `userAccountData` FROM " . $this->table . " GROUP BY `userAccountID` ORDER BY `actionDateTime` DESC";
$results = $this->db->get_rows($sql);
if (PerchUtil::count($results)) {
foreach ($results as $row) {
$return[] = PerchUtil::json_safe_decode($row['userAccountData'], true);
}
}
return $return;
}
示例14: migrate_users
/**
* Shift all users of this role over to the new role given.
*
* @param string $new_roleID
* @return void
* @author Drew McLellan
*/
public function migrate_users($new_roleID)
{
$Users = new PerchUsers();
$users = $Users->get_by_role($this->id());
$data = array();
$data['roleID'] = $new_roleID;
if (PerchUtil::count($users)) {
foreach ($users as $User) {
$User->update($data);
}
}
return true;
}
示例15: to_array
public function to_array($template_ids = false)
{
$out = parent::to_array();
if (PerchUtil::count($template_ids) && in_array('campaignURL', $template_ids)) {
$out['campaignURL'] = $this->campaignURL();
}
$Lists = new PerchMailChimp_Lists($this->api);
$List = $Lists->find((int) $this->listID());
if ($List) {
$out = array_merge($out, $List->to_array());
}
return $out;
}