当前位置: 首页>>代码示例>>PHP>>正文


PHP PerchUtil类代码示例

本文整理汇总了PHP中PerchUtil的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil类的具体用法?PHP PerchUtil怎么用?PHP PerchUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PerchUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set

 public function set($file, $namespace, $default_fields = false)
 {
     $Perch = Perch::fetch();
     // called to make sure constants are defined.
     if ($file && substr($file, -5) !== '.html') {
         $file .= '.html';
     }
     $this->namespace = $namespace;
     if (strpos($file, '~') !== false) {
         $local_file = PerchUtil::file_path(PERCH_PATH . '/addons/apps/' . substr($file, strpos($file, '~') + 1));
         $user_file = PerchUtil::file_path(PERCH_TEMPLATE_PATH . substr($file, strpos($file, 'templates') + 9));
     } else {
         $local_file = PerchUtil::file_path(PERCH_PATH . '/addons/apps/' . $this->app_id . '/templates/' . $file);
         $user_file = PerchUtil::file_path(PERCH_TEMPLATE_PATH . '/' . $file);
     }
     if (file_exists($user_file)) {
         $template_file = $user_file;
     } else {
         $template_file = $local_file;
     }
     $this->Template = new PerchTemplate($template_file, $namespace, $relative_path = false);
     $this->Template->enable_encoding();
     $this->Template->apply_post_processing = true;
     if ($default_fields) {
         $this->Template->append($default_fields);
     }
     $this->file = $this->Template->file;
     return $this->Template->status;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:29,代码来源:PerchAPI_Template.class.php

示例2: 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();
}
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:26,代码来源:feathers.php

示例3: 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;
 }
开发者ID:pete-naish,项目名称:4hair,代码行数:29,代码来源:albumlist.class.php

示例4: 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));
}
开发者ID:scottbrabazon,项目名称:scottbrabazon.com,代码行数:27,代码来源:runtime.php

示例5: 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;
 }
开发者ID:RootStudio,项目名称:Perch-Locator,代码行数:33,代码来源:RootLocator_Geocoder.class.php

示例6: 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);
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:34,代码来源:PerchContent_NavGroup.class.php

示例7: 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;
 }
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:31,代码来源:PerchMailChimp_Import.class.php

示例8: 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');
     }
 }
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:25,代码来源:PerchMailChimp_Lists.class.php

示例9: 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;
 }
开发者ID:amillionmonkeys,项目名称:perchd,代码行数:35,代码来源:PerchMembers_Authenticator_native.class.php

示例10: _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');
     }
 }
开发者ID:nilsmielke,项目名称:frwssr-Blog,代码行数:26,代码来源:runtime.php

示例11: 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;
 }
开发者ID:snavebelac,项目名称:Perch-Fieldtype-Member-Tags,代码行数:25,代码来源:membertags.class.php

示例12: 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;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:28,代码来源:PerchRepeater.class.php

示例13: userProperty

 /**
  * Return property from the userAccountData json store
  * with an optional default for missing values
  *
  * @param $key
  * @param null $default
  * @return null
  */
 public function userProperty($key, $default = null)
 {
     $accountData = PerchUtil::json_safe_decode($this->userAccountData(), true);
     if (isset($accountData[$key]) && $accountData[$key]) {
         return $accountData[$key];
     }
     return $default;
 }
开发者ID:drewm,项目名称:Perch-Activity-Log,代码行数:16,代码来源:JwActivityLog_Action.class.php

示例14: 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;
 }
开发者ID:connor-baer,项目名称:waterford-website,代码行数:8,代码来源:PerchMailchimp_Campaign.class.php

示例15: icons

 /**
  * Return a list of icon files as an array
  *
  * @return array
  */
 public function icons()
 {
     $return = array();
     foreach ($this->iconMap as $event => $filename) {
         $return[$event] = PerchUtil::file_path($this->api->app_path() . '/' . $this->icon_dir . '/' . $filename . $this->icon_ext);
     }
     return $return;
 }
开发者ID:drewm,项目名称:Perch-Activity-Log,代码行数:13,代码来源:JwActivityLog_EventIconsTrait.php


注:本文中的PerchUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。