本文整理汇总了PHP中ClassRegistry::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassRegistry::getClass方法的具体用法?PHP ClassRegistry::getClass怎么用?PHP ClassRegistry::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassRegistry
的用法示例。
在下文中一共展示了ClassRegistry::getClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterFind
function afterFind($results)
{
if (empty($results)) {
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($results[$key]);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
/* Very hard to implement when the content types each have their own separate table with different columns for images */
$imagePath = '';
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true);
}
return $results;
}
示例2: __construct
function __construct()
{
parent::__construct();
Configure::write('Community.profileUrl', $this->profileUrl);
if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
$this->community = true;
$Menu = ClassRegistry::getClass('MenuModel');
$this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage');
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
}
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community');
}
// For JomSocial <= 2.1
if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) {
$this->default_thumb = 'components/com_community/assets/default_thumb.jpg';
}
$cache_key = 'jomsocial_config_' . md5(cmsFramework::getConfig('secret'));
$JSConfig = S2Cache::read($cache_key);
if (false == $JSConfig) {
// Read the JomSocial configuration to determine the storage location for avatars
$JSConfig = json_decode($this->query("SELECT params FROM #__community_config WHERE name = 'config'", 'loadResult'), true);
$JSConfigForJReviews = array('user_avatar_storage' => $JSConfig['user_avatar_storage'], 'storages3bucket' => $JSConfig['storages3bucket']);
S2Cache::write($cache_key, $JSConfigForJReviews);
}
$this->avatar_storage = $JSConfig['user_avatar_storage'];
$this->s3_bucket = $JSConfig['storages3bucket'];
Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
}
}
示例3: addFavorite
function addFavorite($results)
{
$listing_ids = array_keys($results);
if (!isset($this->Config)) {
App::import('Component', 'config', 'jreviews');
$this->Config = ClassRegistry::getClass('ConfigComponent');
}
if ($this->Config->favorites_enable) {
# Get favoured count
$query = "\n SELECT \n content_id AS listing_id, count(*) AS favored FROM #__jreviews_favorites AS Favorite\n\t\t\t WHERE \n Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t GROUP BY \n listing_id\n ";
$this->_db->setQuery($query);
$favored = $this->_db->loadAssocList('listing_id');
# Check if in user's favorites list
$User =& cmsFramework::getUser();
if ($User->id) {
$query = "\n SELECT \n Favorite.user_id, Favorite.content_id AS listing_id\n\t\t\t\t FROM \n #__jreviews_favorites AS Favorite\n\t\t\t\t WHERE \n Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t\t AND Favorite.user_id = " . $User->id;
$this->_db->setQuery($query);
$my_favorite = $this->_db->loadAssocList('listing_id');
}
foreach ($results as $key => $result) {
if (isset($favored[$result['Listing']['listing_id']]['favored'])) {
$results[$key]['Favorite']['favored'] = $favored[$result['Listing']['listing_id']]['favored'];
} else {
$results[$key]['Favorite']['favored'] = 0;
}
if (isset($my_favorite[$result['Listing']['listing_id']]['user_id'])) {
$results[$key]['Favorite']['my_favorite'] = 1;
} else {
$results[$key]['Favorite']['my_favorite'] = 0;
}
}
}
return $results;
}
示例4: afterSave
function afterSave($status)
{
if ($status) {
// Update vote count in review table
App::import('Model', 'review', 'jreviews');
$Review = ClassRegistry::getClass('ReviewModel');
$Review->updateVoteHelpfulCount($this->data['Vote']['review_id'], $this->data['Vote']['vote_yes']);
}
}
示例5: __construct
function __construct()
{
parent::__construct();
Configure::write('Community.profileUrl', $this->profileUrl);
if (file_exists(PATH_ROOT . 'components' . _DS . 'com_kunena' . _DS . 'kunena.php')) {
$this->community = true;
$Menu = ClassRegistry::getClass('MenuModel');
$this->menu_id = $Menu->getComponentMenuId('com_kunena');
}
}
示例6: afterDelete
function afterDelete($key, $values, $condition)
{
switch ($this->post['Discussion']['type']) {
case 'review':
App::import('Model', 'review', 'jreviews');
$Review = ClassRegistry::getClass('ReviewModel');
$Review->updatePostCount($this->post['Discussion']['review_id'], -1);
break;
}
}
示例7: afterFind
function afterFind($results)
{
if (empty($results)) {
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($results[$key]);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
$images = $result['Listing']['images'];
unset($results[$key]['Listing']['images']);
$results[$key]['Listing']['images'] = array();
$upload_dir = '';
// You can hard set an upload directory here and comment out the code below. e.g. ('/uploads')
//dynamically pull the directory information
if (!defined('RES_GENERAL_UPLOAD')) {
// initialyze resource Controller, this will set the RES_GENERAL_UPLOAD constant
require_once '..' . DS . 'administrator' . DS . 'components' . DS . 'com_resource' . DS . 'controllers' . DS . 'config.php';
ResControllerConfig::initialyze();
}
$upload_dir = RES_GENERAL_UPLOAD;
if ($images != '') {
if (@file_exists($upload_dir . DS . 'picture' . DS . $result['Listing']['user'] . DS . 'thumbnail_blog' . DS . $images)) {
$imagePath = $upload_dir . DS . 'picture' . DS . $result['Listing']['user'] . DS . 'thumbnail_blog' . DS . $images;
} else {
if (@file_exists($upload_dir . DS . 'picture' . DS . $result['Listing']['user'] . DS . $images)) {
$imagePath = $upload_dir . DS . 'picture' . DS . $result['Listing']['user'] . DS . $images;
}
}
} else {
// Put a noimage path here?
$imagePath = $upload_dir . DS . 'na.jpg';
// remember to put an na.jpg in your standard upload folder!
}
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true);
}
return $results;
}
示例8: __construct
function __construct()
{
parent::__construct();
Configure::write('Community.profileUrl', $this->profileUrl);
if (file_exists(PATH_ROOT . 'components' . _DS . 'com_comprofiler' . _DS . 'comprofiler.php')) {
$this->community = true;
$Menu = ClassRegistry::getClass('MenuModel');
$this->menu_id = $Menu->getComponentMenuId('com_comprofiler', true);
// 2nd parameter forces a LIKE '%com_comprofiler' query to find only the profile menu
Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
}
}
示例9: __construct
function __construct($app = 'jreviews')
{
parent::__construct();
if (!empty($this->helpers)) {
$this->app = $app;
App::import('Helper', $this->helpers, $this->app);
foreach ($this->helpers as $helper) {
$method_name = inflector::camelize($helper);
$class_name = $method_name . 'Helper';
if (!isset($this->loaded[$method_name])) {
$this->{$method_name} = ClassRegistry::getClass($class_name);
$this->loaded[$method_name] =& ${$method_name};
}
}
}
}
示例10: afterFind
function afterFind($results)
{
if (empty($results)) {
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($results[$key]);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
$imagePath = '';
$images = $this->getImage($result['Listing']['listing_id']);
$results[$key]['Listing']['images'] = array();
if ($images != '') {
if (@file_exists("media/com_hotproperty/images/thb/" . $images)) {
$imagePath = "media/com_hotproperty/images/thb/" . $images;
} elseif (@file_exists("components/com_hotproperty/img/thb/" . $images)) {
// v0.9
$imagePath = "components/com_hotproperty/img/thb/" . $images;
}
} else {
if (@file_exists('media/com_hotproperty/images/noimage_thb.png')) {
// Put a noimage path here?
$imagePath = "media/com_hotproperty/images/noimage_thb.png";
} elseif (@file_exists("components/com_hotproperty/img/thb/noimage.npg")) {
// v0.9
$imagePath = "components/com_hotproperty/img/thb/noimage.npg";
}
}
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true);
}
return $results;
}
示例11: afterFind
function afterFind($results)
{
if (empty($results)) {
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
$imagePath = '';
# Find the thumbnail path
$query = "\n SELECT \n jg_paththumbs \n FROM \n #__joomgallery_config\n LIMIT 1\n ";
$this->_db->setQuery($query);
$thumbnail_path = $this->_db->loadResult();
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
$result['Listing']['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($result);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
$images = $result['Listing']['images'];
unset($results[$key]['Listing']['images']);
$results[$key]['Listing']['images'] = array();
if ($images != '') {
if (file_exists($thumbnail_path . $result['Listing']['images_path'] . '/' . $images)) {
$imagePath = $thumbnail_path . $result['Listing']['images_path'] . '/' . $images;
}
} else {
// Put a noimage path here?
$imagePath = '';
//"components/com_virtuemart/shop_image/product/" . $images;
}
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true);
}
return $results;
}
示例12: array
function &getInstance()
{
static $instance = array();
if (!isset($instance[0]) || !$instance[0]) {
$instance[0] = new sef_jreviews();
require dirname(__FILE__) . DS . 'jreviews' . DS . 'framework.php';
App::import('Model', 'Menu', 'jreviews');
$instance[0]->__Menu = ClassRegistry::getClass('MenuModel');
// Read url param style setting from JReviews config cache file
$cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
$Config = S2Cache::read($cache_file);
$instance[0]->joomla_style_params = is_object($Config) and isset($Config->url_param_joomla) ? $Config->url_param_joomla : false;
$version = new JVersion();
$instance[0]->cmsVersion = $version->RELEASE;
}
return $instance[0];
}
示例13: afterFind
function afterFind($results)
{
if (empty($results) || defined('MVC_FRAMEWORK_ADMIN')) {
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($results[$key]);
}
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
$result['Listing']['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($result);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
$images = $result['Listing']['images'];
unset($results[$key]['Listing']['images']);
if ($images != '') {
$imagePath = $images;
}
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true, 'skipthumb' => true);
}
return $results;
}
示例14: afterFind
function afterFind($results)
{
if (empty($results)) {
return $results;
}
# Find Itemid for component
$Menu = ClassRegistry::getClass('MenuModel');
$menu_id = $Menu->getComponentMenuId($this->extension);
foreach ($results as $key => $result) {
// Process component menu id
$results[$key][$this->name]['menu_id'] = $menu_id;
// Process listing url
$results[$key][$this->name]['url'] = $this->listingUrl($results[$key]);
// Process criteria
if (isset($result['Criteria']['criteria']) && $result['Criteria']['criteria'] != '') {
$results[$key]['Criteria']['criteria'] = explode("\n", $result['Criteria']['criteria']);
}
if (isset($result['Criteria']['tooltips']) && $result['Criteria']['tooltips'] != '') {
$results[$key]['Criteria']['tooltips'] = explode("\n", $result['Criteria']['tooltips']);
}
if (isset($result['Criteria']['weights']) && $result['Criteria']['weights'] != '') {
$results[$key]['Criteria']['weights'] = explode("\n", $result['Criteria']['weights']);
}
// Process images
$images = $result['Listing']['images'];
unset($results[$key]['Listing']['images']);
$results[$key]['Listing']['images'] = array();
if ($images != '') {
if (@file_exists("components/com_virtuemart/shop_image/product/" . $images)) {
$imagePath = "components/com_virtuemart/shop_image/product/" . $images;
} else {
$imagePath = "components/com_virtuemart/shop_image/product/" . $images;
}
} else {
// Put a noimage path here?
$imagePath = '';
//"components/com_virtuemart/shop_image/product/" . $images;
}
$results[$key]['Listing']['images'][] = array('path' => $imagePath, 'caption' => $results[$key]['Listing']['title'], 'basepath' => true);
}
return $results;
}
示例15: __construct
function __construct()
{
parent::__construct();
Configure::write('Community.profileUrl', $this->profileUrl);
if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
$this->community = true;
$Menu = ClassRegistry::getClass('MenuModel');
$this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage');
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
}
if (!$this->menu_id) {
$this->menu_id = $Menu->getComponentMenuId('com_community');
}
// For JomSocial <= 2.1
if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) {
$this->default_thumb = 'components/com_community/assets/default_thumb.jpg';
}
Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
}
}