本文整理汇总了PHP中PerchUtil::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::debug方法的具体用法?PHP PerchUtil::debug怎么用?PHP PerchUtil::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
public function __call($method, $arguments)
{
if (isset($this->details[$method])) {
return $this->details[$method];
} else {
// check for Author details
if (substr($method, 0, 6) == 'author') {
if (!$this->Author) {
$this->_load_author();
}
if (is_object($this->Author)) {
return $this->Author->{$field}();
}
}
// look in dynamic fields
$dynamic_fields = PerchUtil::json_safe_decode($this->postDynamicFields(), true);
if (isset($dynamic_fields[$method])) {
return $dynamic_fields[$method];
}
// try database
PerchUtil::debug('Looking up missing property ' . $method, 'notice');
if (isset($this->details[$this->pk])) {
$sql = 'SELECT ' . $method . ' FROM ' . $this->table . ' WHERE ' . $this->pk . '=' . $this->db->pdb($this->details[$this->pk]);
$this->details[$method] = $this->db->get_value($sql);
return $this->details[$method];
}
}
return false;
}
示例2: get_processed
public function get_processed($raw = false)
{
PerchUtil::debug($raw);
$html = '<div id="simona_piechart_' . $raw['chart_id'] . '" style="min-height: 60px;"></div>';
$is3d = $raw['is3d'] ? 'true' : 'false';
$r = '<script type="text/javascript">/* <![CDATA[ */ ';
$r .= <<<EOT
if (typeof CMSPieChart =='undefined') {
var CMSPieChart={};
CMSPieChart.charts=[];
document.write('<scr'+'ipt type="text\\/javascript" src="{$this->_location}js/simona_piechart_public.js"><'+'\\/sc'+'ript>');
}
CMSPieChart.charts.push({
'chart_id':'simona_piechart_{$raw['chart_id']}',
'title':'{$raw['title']}',
'data':'{$raw['data']}',
'width':'{$raw['width']}',
'height':'{$raw['height']}',
'is3d':{$is3d},
});
EOT;
$r .= '/* ]]> */';
$r .= '</script>';
$out = $html . $r;
return $out;
}
示例3: update_tree_position
public function update_tree_position($pageID, $parentID, $order = false)
{
PerchUtil::debug('updating tree position');
$sql = 'SELECT * FROM ' . PERCH_DB_PREFIX . 'navigation_pages
WHERE groupID=' . $this->db->pdb((int) $this->id()) . ' AND pageID=' . $this->db->pdb((int) $parentID) . '
LIMIT 1';
$parentPage = $this->db->get_row($sql);
$data = array();
$data['pageParentID'] = $parentID;
if ($order === false) {
if (is_array($parentPage)) {
$sql = 'SELECT MAX(pageOrder) FROM ' . PERCH_DB_PREFIX . 'navigation_pages WHERE pageParentID=' . $this->db->pdb((int) $parentID);
} else {
$sql = 'SELECT MAX(pageOrder) FROM ' . PERCH_DB_PREFIX . 'navigation_pages WHERE pageParentID=0';
}
$max = $this->db->get_count($sql);
$max = (int) $max + 1;
} else {
$data['pageOrder'] = $order;
}
if (is_array($parentPage)) {
$data['pageDepth'] = (int) $parentPage['pageDepth'] + 1;
$data['pageTreePosition'] = $parentPage['pageTreePosition'] . '-' . str_pad($data['pageOrder'], 3, '0', STR_PAD_LEFT);
} else {
PerchUtil::debug('Could not find parent page');
$data['pageDepth'] = 1;
$data['pageTreePosition'] = '000-' . str_pad($data['pageOrder'], 3, '0', STR_PAD_LEFT);
}
$sql = 'SELECT navpageID FROM ' . PERCH_DB_PREFIX . 'navigation_pages
WHERE groupID=' . $this->db->pdb((int) $this->id()) . ' AND pageID=' . $this->db->pdb((int) $pageID) . '
LIMIT 1';
$pk = $this->db->get_value($sql);
$this->db->update(PERCH_DB_PREFIX . 'navigation_pages', $data, 'navpageID', $pk);
}
示例4: geocode
/**
* @param string $address
* @param int $limit
*
* @return $this
*/
public function geocode($address, $limit = 1)
{
try {
$this->addresses = $this->geocoder->limit($limit)->geocode($address);
} catch (\Geocoder\Exception\NoResult $ex) {
$this->errorKey = 'no_results';
$this->error = RootLocator_Errors::noResults();
PerchUtil::debug(sprintf('Locator: %s', $ex->getMessage()), 'error');
} catch (\Geocoder\Exception\HttpError $ex) {
$this->errorKey = 'http_error';
$this->error = RootLocator_Errors::httpError();
PerchUtil::debug(sprintf('Locator: %s', $ex->getMessage()), 'error');
} catch (\Geocoder\Exception\InvalidCredentials $ex) {
$this->errorKey = 'invalid_credentials';
$this->error = RootLocator_Errors::invalidCredentials();
PerchUtil::debug(sprintf('Locator: %s', $ex->getMessage()), 'error');
} catch (\Geocoder\Exception\QuotaExceeded $ex) {
$this->errorKey = 'quota_exceeded';
$this->error = RootLocator_Errors::quotaExceeded();
PerchUtil::debug(sprintf('Locator: %s', $ex->getMessage()), 'error');
} catch (Exception $ex) {
$this->errorKey = 'unknown';
$this->error = RootLocator_Errors::unknown();
PerchUtil::debug(sprintf('Locator: %s', $ex->getMessage()), 'error');
}
return $this;
}
示例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: _compile_stylesheet
private function _compile_stylesheet($file)
{
PerchUtil::debug('Compiling SASS file: ' . $file, 'notice');
if (!$this->_site_path) {
$login_path_parts = explode('/', PERCH_LOGINPATH);
$path_parts = explode(DIRECTORY_SEPARATOR, PERCH_PATH);
foreach ($login_path_parts as $part) {
if ($part != '') {
array_pop($path_parts);
}
}
$path = implode(DIRECTORY_SEPARATOR, $path_parts);
$this->_site_path = $path;
}
$compiled_name = PerchUtil::file_path(PERCH_RESFILEPATH . '/' . $this->_get_compiled_name($file));
include_once 'SassParser.php';
$syntax = substr($file, -4, 4);
$options = array('style' => 'expanded', 'cache' => FALSE, 'syntax' => $syntax, 'debug' => FALSE, 'callbacks' => array('warn' => 'warn', 'debug' => 'debug'));
// Execute the compiler.
$parser = new SassParser($options);
try {
file_put_contents($compiled_name, $parser->toCss(PerchUtil::file_path($this->_site_path . $file)));
} catch (Exception $e) {
PerchUtil::debug($e->getMessage(), 'error');
}
}
示例7: 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;
}
示例8: run
public function run()
{
$result = false;
switch ($this->importType()) {
case 'subscribers':
$Subscribers = new PerchMailChimp_Subscribers($this->api);
$result = $Subscribers->import_next($this);
break;
case 'campaigns':
$Campaigns = new PerchMailChimp_Campaigns($this->api);
$result = $Campaigns->import_next($this);
break;
case 'webhooks':
$Webhooks = new PerchMailChimp_Webhooks($this->api);
$result = $Webhooks->import_next($this);
break;
}
if ($result && $result['result'] == 'success') {
if ($result['count'] < $this->importCount()) {
// looks like that's all the pages, so self-delete.
PerchUtil::debug('Result count is ' . $result['count']);
PerchUtil::debug('Import count is ' . $this->importCount());
PerchUtil::debug('Deleting.');
$this->delete();
return;
}
$this->update(['importOffset' => $this->importOffset() + $this->importCount()]);
return $result;
}
return $result;
}
示例9: perch_forms_form_handler
function perch_forms_form_handler($SubmittedForm)
{
if ($SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'perch_forms');
$Forms = new PerchForms_Forms($API);
$formKey = $SubmittedForm->id;
$Form = $Forms->find_by_key($formKey);
if (!is_object($Form)) {
$data = array();
$data['formKey'] = $formKey;
$data['formTemplate'] = $SubmittedForm->templatePath;
$data['formOptions'] = PerchUtil::json_safe_encode(array('store' => true));
$attrs = $SubmittedForm->get_form_attributes();
if ($attrs->label()) {
$data['formTitle'] = $attrs->label();
} else {
$data['formTitle'] = PerchUtil::filename($formKey, false);
}
$Form = $Forms->create($data);
}
if (is_object($Form)) {
$Form->process_response($SubmittedForm);
}
}
$Perch = Perch::fetch();
PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
示例10: perch_mailchimp_form_handler
function perch_mailchimp_form_handler($SubmittedForm)
{
if ($SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'perch_mailchimp');
$Subscribers = new PerchMailChimp_Subscribers($API);
$Subscribers->subscribe_from_form($SubmittedForm);
}
$Perch = Perch::fetch();
PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
示例11: listing_form_handler
function listing_form_handler($SubmittedForm)
{
if ($SubmittedForm->formID == 'listing' && $SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'listing');
$Listings = new Listings($API);
$Listings->receive_new_listing($SubmittedForm);
}
$Perch = Perch::fetch();
PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
示例12: perch_members_form_handler
function perch_members_form_handler($SubmittedForm)
{
if ($SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'perch_members');
switch ($SubmittedForm->formID) {
case 'login':
$PerchMembers_Auth = new PerchMembers_Auth($API);
if (!$PerchMembers_Auth->handle_login($SubmittedForm)) {
$SubmittedForm->throw_error('login');
}
break;
case 'profile':
$Session = PerchMembers_Session::fetch();
if ($Session->logged_in && $Session->get('token') == $SubmittedForm->data['token']) {
$Members = new PerchMembers_Members($API);
if (is_object($Members)) {
$Member = $Members->find($Session->get('memberID'));
}
if (is_object($Member)) {
$Member->update_profile($SubmittedForm);
$PerchMembers_Auth = new PerchMembers_Auth($API);
$PerchMembers_Auth->refresh_session_data($Member);
}
} else {
$SubmittedForm->throw_error('login');
}
break;
case 'register':
$Members = new PerchMembers_Members($API);
$Members->register_with_form($SubmittedForm);
break;
case 'reset':
$Members = new PerchMembers_Members($API);
$Members->reset_member_password($SubmittedForm);
break;
case 'password':
$Session = PerchMembers_Session::fetch();
if ($Session->logged_in && $Session->get('token') == $SubmittedForm->data['token']) {
$Members = new PerchMembers_Members($API);
if (is_object($Members)) {
$Member = $Members->find($Session->get('memberID'));
}
if (is_object($Member)) {
$Member->change_password($SubmittedForm);
}
} else {
$SubmittedForm->throw_error('login');
}
break;
}
}
$Perch = Perch::fetch();
PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}
示例13: delete
public function delete()
{
if ($this->clean_resources && !$this->resourceInLibrary()) {
$Perch = Perch::fetch();
$bucket = $Perch->get_resource_bucket($this->resourceBucket());
$file_path = PerchUtil::file_path($bucket['file_path'] . '/' . $this->resourceFile());
if (file_exists($file_path) && !is_dir($file_path)) {
unlink($file_path);
PerchUtil::debug('Deleting resource: ' . $file_path);
}
}
return parent::delete();
}
示例14: attempt_install
public function attempt_install()
{
PerchUtil::debug('Attempting app installation: ' . $this->api->app_id);
$sql = 'SHOW TABLES LIKE "' . $this->table . '"';
$result = $this->db->get_value($sql);
if ($result == false) {
$activation_file = PerchUtil::file_path(PERCH_PATH . '/addons/apps/' . $this->api->app_id . '/activate.php');
if (file_exists($activation_file)) {
$API = $this->api;
return include $activation_file;
}
}
return false;
}
示例15: perch_comments_form_handler
function perch_comments_form_handler($SubmittedForm)
{
if ($SubmittedForm->formID == 'comment' && $SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'perch_comments');
$Comments = new PerchComments_Comments($API);
$Comments->receive_new_comment($SubmittedForm);
}
if ($SubmittedForm->formID == 'vote' && $SubmittedForm->validate()) {
$API = new PerchAPI(1.0, 'perch_comments');
$Comments = new PerchComments_Comments($API);
$Comments->receive_new_vote($SubmittedForm);
}
$Perch = Perch::fetch();
PerchUtil::debug($Perch->get_form_errors($SubmittedForm->formID));
}