本文整理汇总了PHP中BxDolService类的典型用法代码示例。如果您正苦于以下问题:PHP BxDolService类的具体用法?PHP BxDolService怎么用?PHP BxDolService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BxDolService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: response
public function response($oAlert)
{
if ('bx_albums_files' == $oAlert->sUnit && 'file_deleted' == $oAlert->sAction) {
BxDolService::call($this->MODULE, 'delete_file_associations', array($oAlert->iObject));
}
parent::response($oAlert);
}
示例2: getBlockCode_ActionList
function getBlockCode_ActionList()
{
$sCode = null;
$sMainPrefix = $this->oConfig->getMainPrefix();
bx_import('BxDolSubscription');
$oSubscription = BxDolSubscription::getInstance();
$aButton = $oSubscription->getButton($this->iProfileId, $sMainPrefix, '', (int) $this->aFileInfo['medID']);
$sCode .= $oSubscription->getData();
$aReplacement = array('favorited' => $this->aFileInfo['favorited'] == false ? '' : 'favorited', 'featured' => (int) $this->aFileInfo['Featured'], 'featuredCpt' => '', 'approvedCpt' => '', 'approvedAct' => '', 'moduleUrl' => BX_DOL_URL_ROOT . $this->oConfig->getBaseUri(), 'fileUri' => $this->aFileInfo['medUri'], 'iViewer' => $this->iProfileId, 'ID' => (int) $this->aFileInfo['medID'], 'Owner' => (int) $this->aFileInfo['medProfId'], 'OwnerName' => $this->aFileInfo['NickName'], 'AlbumUri' => $this->aFileInfo['albumUri'], 'sbs_' . $sMainPrefix . '_title' => $aButton['title'], 'sbs_' . $sMainPrefix . '_script' => $aButton['script'], 'shareCpt' => $this->oModule->isAllowedShare($this->aFileInfo) ? _t('_Share') : '', 'downloadCpt' => $this->oModule->isAllowedDownload($this->aFileInfo) ? _t('_Download') : '');
if (isAdmin($this->iProfileId)) {
$sMsg = $aReplacement['featured'] > 0 ? 'un' : '';
$aReplacement['featuredCpt'] = _t('_' . $sMainPrefix . '_action_' . $sMsg . 'feature');
}
if ($this->oModule->isAllowedApprove($this->aFileInfo)) {
$sMsg = '';
$iAppr = 1;
if ($this->aFileInfo['Approved'] == 'approved') {
$sMsg = 'de';
$iAppr = 0;
}
$aReplacement['approvedCpt'] = _t('_' . $sMainPrefix . '_admin_' . $sMsg . 'activate');
$aReplacement['approvedAct'] = $iAppr;
}
$aReplacement['repostCpt'] = $aReplacement['repostScript'] = '';
if (BxDolRequest::serviceExists('wall', 'get_repost_js_click')) {
$sCode .= BxDolService::call('wall', 'get_repost_js_script');
$aReplacement['repostCpt'] = _t('_Repost');
$aReplacement['repostScript'] = BxDolService::call('wall', 'get_repost_js_click', array($this->iProfileId, $sMainPrefix, 'add', (int) $this->aFileInfo['medID']));
}
$sActionsList = $GLOBALS['oFunctions']->genObjectsActions($aReplacement, $sMainPrefix);
if (is_null($sActionsList)) {
return '';
}
return $sCode . $sActionsList;
}
示例3: getCode
/**
* Get menu code.
* @return string
*/
public function getCode()
{
$aMenuItemSelected = $this->_getSelectedMenuItem();
if (isset($aMenuItemSelected['set_name']) && 'sys_site' == $aMenuItemSelected['set_name'] && 'home' == $aMenuItemSelected['name']) {
return '';
}
$this->_addJsCss();
$oMenuSubmenu = BxDolMenu::getObjectInstance($this->_sObjectSubmenu);
$aVars = array('object' => $this->_sObject, 'id' => 'bx-menu-submenu-menu', 'title' => $aMenuItemSelected['title'], 'link' => BxDolPermalinks::getInstance()->permalink($aMenuItemSelected['link']), 'popup' => $oMenuSubmenu ? BxTemplFunctions::getInstance()->transBox('bx-menu-submenu-menu', '<div class="bx-def-padding">' . $oMenuSubmenu->getCode() . '</div>', true) : '', 'bx_if:menu' => array('condition' => $oMenuSubmenu, 'content' => array()), 'bx_if:image' => array('condition' => false !== strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon_url' => $aMenuItemSelected['icon'])), 'bx_if:icon' => array('condition' => false === strpos($aMenuItemSelected['icon'], '.'), 'content' => array('icon' => $aMenuItemSelected['icon'])), 'bx_repeat:menus' => array());
$aMenus = $this->getSubmenuParams($aMenuItemSelected);
foreach ($aMenus as $aMenu) {
$sPopupContent = '';
if (isset($aMenu['object']) && ($oMenu = BxDolMenu::getObjectInstance($aMenu['object']))) {
$sPopupContent = $oMenu->getCode();
} elseif (isset($aMenu['service']) && is_array($aMenu['service'])) {
$sPopupContent = BxDolService::call($aMenu['service']['module'], $aMenu['service']['method'], isset($aMenu['service']['params']) ? $aMenu['service']['params'] : array(), isset($aMenu['service']['class']) ? $aMenu['service']['class'] : 'Module');
}
if (!$sPopupContent) {
continue;
}
$aVars['bx_repeat:menus'][] = array('id' => $aMenu['id'], 'icon' => $aMenu['icon'], 'popup' => BxTemplFunctions::getInstance()->transBox($aMenu['id'], '<div class="bx-def-padding">' . $sPopupContent . '</div>', true));
}
if (!$aVars['bx_repeat:menus'] && (!$oMenuSubmenu || !$aMenuItemSelected)) {
return '';
}
$sMenu = $this->_oTemplate->parseHtmlByName($this->_aObject['template'], $aVars);
return $this->_oTemplate->parseHtmlByName('menu_main_submenu_wrapper.html', array('menu' => $sMenu));
}
示例4: getWidgets
protected function getWidgets($sPage, $aWidgets)
{
$oTemplate = BxDolStudioTemplate::getInstance();
$aParseVars = array('url_root' => BX_DOL_URL_ROOT, 'url_studio' => BX_DOL_URL_STUDIO, 'url_studio_icons' => BX_DOL_URL_STUDIO_BASE . 'images/icons/');
$aTmplVars = array();
foreach ($aWidgets as $aWidget) {
$aTmplVarsActions = array();
if (!$this->isEnabled($aWidget) && !empty($aWidget['cnt_actions'])) {
$aService = unserialize($aWidget['cnt_actions']);
$aActions = BxDolService::call($aService['module'], $aService['method'], array_merge(array($aWidget), $aService['params']), $aService['class']);
foreach ($aActions as $aAction) {
$sActionIcon = $aAction['icon'];
$bActionIcon = strpos($sActionIcon, '.') === false;
if (!$bActionIcon) {
$sActionIcon = $oTemplate->getIconUrl($sActionIcon);
}
$sCaption = _t($aAction['caption']);
$aTmplVarsActions[] = array('caption' => $sCaption, 'url' => !empty($aAction['url']) ? $oTemplate->parseHtmlByContent($aAction['url'], $aParseVars, array('{', '}')) : 'javascript:void(0)', 'bx_if:show_click' => array('condition' => !empty($aAction['click']), 'content' => array('content' => 'javascript:' . $aAction['click'])), 'bx_if:action_icon' => array('condition' => $bActionIcon, 'content' => array('icon' => $sActionIcon, 'caption' => $sCaption)), 'bx_if:action_image' => array('condition' => !$bActionIcon, 'content' => array('icon_url' => $sActionIcon, 'caption' => $sCaption)));
}
}
$sIcon = $this->getIcon($aWidget);
$bIcon = strpos($sIcon, '.') === false;
$sNotices = !empty($this->aWidgetsNotices[$aWidget['id']]) ? $this->aWidgetsNotices[$aWidget['id']] : '';
$aTmplVars[] = array('id' => $aWidget['id'], 'url' => !empty($aWidget['url']) ? $oTemplate->parseHtmlByContent($aWidget['url'], $aParseVars, array('{', '}')) : 'javascript:void(0)', 'bx_if:show_click_icon' => array('condition' => !empty($aWidget['click']), 'content' => array('content' => 'javascript:' . $aWidget['click'])), 'bx_if:show_click_link' => array('condition' => !empty($aWidget['click']), 'content' => array('content' => 'javascript:' . $aWidget['click'])), 'bx_if:show_notice' => array('condition' => !empty($sNotices), 'content' => array('content' => $sNotices)), 'bx_if:show_actions' => array('condition' => !empty($aTmplVarsActions), 'content' => array('bx_repeat:actions' => $aTmplVarsActions)), 'bx_if:icon' => array('condition' => $bIcon, 'content' => array('icon' => $sIcon)), 'bx_if:image' => array('condition' => !$bIcon, 'content' => array('icon_url' => $sIcon)), 'caption' => _t($aWidget['caption']), 'widget_disabled_class' => !$this->isEnabled($aWidget) ? 'bx-std-widget-icon-disabled' : '', 'widget_bookmarked_class' => (int) $aWidget['bookmark'] == 1 ? 'bx-std-widget-icon-bookmarked' : '', 'widget_styles' => isset($_COOKIE['bx_studio_bookmark']) && (int) $_COOKIE['bx_studio_bookmark'] == 1 && (int) $aWidget['bookmark'] != 1 ? 'display:none;' : '');
}
return $oTemplate->parseHtmlByName('widgets.html', array('bx_repeat:widgets' => $aTmplVars));
}
示例5: service
function service($aToken)
{
if (!isAdmin($aToken['user_id'])) {
$this->errorOutput(403, 'access_denied', 'Only admin can access service endpoint');
return false;
}
bx_login($aToken['user_id'], false, false);
$sUri = bx_get('uri');
$sMethod = bx_get('method');
if (!($aParams = bx_get('params'))) {
$aParams = array();
} elseif (is_string($aParams) && preg_match('/^a:[\\d+]:\\{/', $aParams)) {
$aParams = @unserialize($aParams);
}
if (!is_array($aParams)) {
$aParams = array($aParams);
}
if (!($sClass = bx_get('class'))) {
$sClass = 'Module';
}
if (!BxDolRequest::serviceExists($sUri, $sMethod, $sClass)) {
$this->errorOutput(404, 'not_found', 'Service was not found');
return false;
}
$mixedRet = BxDolService::call($sUri, $sMethod, $aParams, $sClass);
$this->output(array('uri' => $sUri, 'method' => $sMethod, 'data' => $mixedRet));
}
示例6: uninstall
function uninstall($aParams)
{
if (BxDolRequest::serviceExists('wall', 'update_handlers')) {
BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false));
}
return parent::uninstall($aParams);
}
示例7: uploadImage
function uploadImage($sUser, $sPwd, $sAlbum, $binImageData, $iDataLength, $sTitle, $sTags, $sDesc)
{
if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, 'BX_PHOTOS_ADD', true)) {
return new xmlrpcval("fail access");
}
// write tmp file
$sTmpFilename = BX_DIRECTORY_PATH_ROOT . "tmp/" . time() . '_' . $iId;
$f = fopen($sTmpFilename, "wb");
if (!$f) {
return new xmlrpcval("fail fopen");
}
if (!fwrite($f, $binImageData, (int) $iDataLength)) {
fclose($f);
return new xmlrpcval("fail write");
}
fclose($f);
// upload
$aFileInfo = array();
$aFileInfo['medTitle'] = process_db_input($sTitle, BX_TAGS_STRIP, BX_SLASHES_NO_ACTION);
$aFileInfo['medDesc'] = process_db_input($sDesc, BX_TAGS_VALIDATE, BX_SLASHES_NO_ACTION);
$aFileInfo['medTags'] = process_db_input($sTags, BX_TAGS_STRIP, BX_SLASHES_NO_ACTION);
$aFileInfo['Categories'] = array(process_db_input($sAlbum, BX_TAGS_STRIP, BX_SLASHES_NO_ACTION));
$aFileInfo['album'] = process_db_input($sAlbum, BX_TAGS_STRIP, BX_SLASHES_NO_ACTION);
$isUpdateThumb = (int) db_value("SELECT `Avatar` FROM `Profiles` WHERE `ID` = '{$iId}' LIMIT 1") ? false : true;
if (BxDolService::call('photos', 'perform_photo_upload', array($sTmpFilename, $aFileInfo, $isUpdateThumb), 'Uploader')) {
return new xmlrpcval("ok");
} else {
return new xmlrpcval("fail upload");
}
}
示例8: response
public function response($oAlert)
{
if ($this->MODULE == $oAlert->sUnit && 'commentPost' == $oAlert->sAction) {
BxDolService::call($this->MODULE, 'trigger_comment_post', array($oAlert->iObject, $oAlert->aExtras['comment_author_id'], $oAlert->aExtras['comment_id']));
}
parent::response($oAlert);
}
示例9: blockFiles
function blockFiles(&$aData)
{
$iEntryId = $aData['id'];
$aReadyMedia = array();
if ($iEntryId) {
$aReadyMedia = $GLOBALS['oBxStoreModule']->_oDb->getFiles($iEntryId, true);
}
if (!$aReadyMedia) {
return '';
}
$aVars = array('bx_repeat:files' => array());
$sCurrencySign = getParam('pmt_default_currency_sign');
foreach ($aReadyMedia as $r) {
$iMediaId = $r['media_id'];
$a = BxDolService::call('files', 'get_file_array', array($iMediaId), 'Search');
if (!$a['date']) {
continue;
}
bx_import('BxTemplFormView');
$oForm = new BxTemplFormView(array());
$aInputBtnDownload = array('type' => 'submit', 'name' => 'bx_store_download', 'value' => _t('_bx_store_download'), 'attrs' => array('onclick' => "window.open ('" . BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . "download/{$r['id']}','_self');"));
$aVars['bx_repeat:files'][] = array('id' => $iMediaId, 'title' => $a['title'], 'icon' => $a['file'], 'price' => $sCurrencySign . ' ' . $r['price'], 'for_group' => sprintf(_t('_bx_store_for_group'), $GLOBALS['oBxStoreModule']->getGroupName($r['allow_purchase_to'])), 'date' => defineTimeInterval($a['date']), 'bx_if:purchase' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedPurchase($r), 'content' => array('btn_purchase' => BxDolService::call('payment', 'get_add_to_cart_link', array($r['author_id'], $this->_oConfig->getId(), $r['id'], 1)))), 'bx_if:download' => array('condition' => $GLOBALS['oBxStoreModule']->isAllowedDownload($r), 'content' => array('btn_download' => $oForm->genInputButton($aInputBtnDownload))));
}
if (!$aVars['bx_repeat:files']) {
return '';
}
return $this->parseHtmlByName('block_files', $aVars);
}
示例10: uploadImage
function uploadImage($sUser, $sPwd, $sAlbum, $binImageData, $iDataLength, $sTitle, $sTags, $sDesc)
{
if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, 'BX_PHOTOS_ADD', true)) {
return new xmlrpcval("fail access");
}
// write tmp file
$sTmpFilename = BX_DIRECTORY_PATH_ROOT . "tmp/" . time() . '_' . $iId;
$f = fopen($sTmpFilename, "wb");
if (!$f) {
return new xmlrpcval("fail fopen");
}
if (!fwrite($f, $binImageData, (int) $iDataLength)) {
fclose($f);
return new xmlrpcval("fail write");
}
fclose($f);
// upload
$aFileInfo = array();
$aFileInfo['medTitle'] = $sTitle;
$aFileInfo['medDesc'] = $sDesc;
$aFileInfo['medTags'] = $sTags;
$aFileInfo['Categories'] = array($sAlbum);
$aFileInfo['album'] = $sAlbum;
if (BxDolService::call('photos', 'perform_photo_upload', array($sTmpFilename, $aFileInfo, 0, $iId), 'Uploader')) {
return new xmlrpcval("ok");
} else {
return new xmlrpcval("fail upload");
}
}
示例11: getBlockCode_ViewImage
function getBlockCode_ViewImage()
{
$sSiteUrl = $this->_aSite['url'];
$aFile = BxDolService::call('photos', 'get_photo_array', array($this->_aSite['photo'], 'file'), 'Search');
$sImage = $aFile['no_image'] ? '' : $aFile['file'];
// BEGIN STW INTEGRATION
if (getParam('bx_sites_account_type') != 'No Automated Screenshots') {
if ($sImage == '') {
$aSTWOptions = array();
bx_sites_import('STW');
$sThumbHTML = getThumbnailHTML($sSiteUrl, $aSTWOptions, false, false);
}
}
// END STW INTEGRATION
$sVote = '';
if (strncasecmp($sSiteUrl, 'http://', 7) !== 0 && strncasecmp($sSiteUrl, 'https://', 8) !== 0) {
$sSiteUrl = 'http://' . $sSiteUrl;
}
if ($this->_oConfig->isVotesAllowed() && $this->_oSites->oPrivacy->check('rate', $this->_aSite['id'], $this->_oSites->iOwnerId)) {
bx_import('BxTemplVotingView');
$oVotingView = new BxTemplVotingView('bx_sites', $this->_aSite['id']);
if ($oVotingView->isEnabled()) {
$sVote = $oVotingView->getBigVoting();
}
}
$sContent = $this->_oTemplate->parseHtmlByName('view_image.html', array('title' => $this->_aSite['title'], 'site_url' => $sSiteUrl, 'site_url_view' => $this->_aSite['url'], 'bx_if:is_image' => array('condition' => $sThumbHTML == false, 'content' => array('image' => $sImage ? $sImage : $this->_oTemplate->getImageUrl('no-image-thumb.png'))), 'bx_if:is_thumbhtml' => array('condition' => $sThumbHTML != '', 'content' => array('thumbhtml' => $sThumbHTML)), 'vote' => $sVote, 'view_count' => $this->_aSite['views']));
return array($sContent, array(), array(), false);
}
示例12: response
public function response($oAlert)
{
if ('profile' != $oAlert->sUnit || 'delete' != $oAlert->sAction || !isset($oAlert->aExtras['delete_with_content']) || !$oAlert->aExtras['delete_with_content']) {
return;
}
BxDolService::call($this->MODULE, 'delete_entities_by_author', array($oAlert->iObject));
}
示例13: response
/**
* Overwtire the method of parent class.
*
* @param BxDolAlerts $oAlert an instance of alert.
*/
function response($oAlert)
{
$sKey = $oAlert->sUnit . '_' . $oAlert->sAction;
$iCommentId = 0;
switch ($oAlert->sAction) {
case 'delete':
case 'delete_poll':
case 'delete_post':
$this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject);
return;
case 'commentPost':
if (!isset($oAlert->aExtras['comment_id']) || (int) $oAlert->aExtras['comment_id'] == 0) {
return;
}
$iCommentId = (int) $oAlert->aExtras['comment_id'];
break;
case 'commentRemoved':
if (!isset($oAlert->aExtras['comment_id']) || (int) $oAlert->aExtras['comment_id'] == 0) {
return;
}
$this->_oModule->_oDb->deleteActivityByObject($oAlert->sUnit, $oAlert->iObject, (int) $oAlert->aExtras['comment_id']);
return;
}
// call defined method;
if (!is_array($this->aInternalHandlers) || !array_key_exists($sKey, $this->aInternalHandlers)) {
return;
}
if (!BxDolRequest::serviceExists($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'])) {
return;
}
// define functions parameters;
$aParams = array('action' => $oAlert->sAction, 'object_id' => $oAlert->iObject, 'sender_id' => $oAlert->iSender, 'extra_params' => $oAlert->aExtras);
$aResult = BxDolService::call($this->aInternalHandlers[$sKey]['module_uri'], $this->aInternalHandlers[$sKey]['module_method'], $aParams);
if (empty($aResult)) {
return;
}
// create new event;
// define recipent id;
$iRecipientId = isset($aResult['recipient_id']) ? $aResult['recipient_id'] : $oAlert->iObject;
if (isset($aResult['spy_type']) && $aResult['spy_type'] == 'content_activity' && $iRecipientId == $oAlert->iSender) {
$iRecipientId = 0;
}
$iEventId = 0;
if ($oAlert->iSender || !$oAlert->iSender && $this->_oModule->_oConfig->bTrackGuestsActivites) {
$iEventId = $this->_oModule->_oDb->createActivity($oAlert->sUnit, $oAlert->sAction, $oAlert->iObject, $iCommentId, $oAlert->iSender, $iRecipientId, $aResult);
}
if (!$iEventId) {
return;
}
// try to define all profile's friends;
$aFriends = getMyFriendsEx($oAlert->iSender);
if (empty($aFriends) || !is_array($aFriends)) {
return;
}
// attach event to friends;
foreach ($aFriends as $iFriendId => $aItems) {
$this->_oModule->_oDb->attachFriendEvent($iEventId, $oAlert->iSender, $iFriendId);
}
}
示例14: response
public function response($oAlert)
{
if ('system' != $oAlert->sUnit || 'before_send_mail' != $oAlert->sAction || 'on' != getParam('bx_smtp_on')) {
return;
}
$a = $oAlert->aExtras;
$a['override_result'] = BxDolService::call('bx_smtp', 'send', array($a['email'], $a['subject'], $a['body'], $a['header'], $a['params'], $a['html'], $a['recipient']));
}
示例15: uninstall
function uninstall($aParams)
{
if (BxDolRequest::serviceExists('spy', 'update_handlers')) {
BxDolService::call('spy', 'update_handlers', array($this->_aConfig['home_uri'], false));
}
$this->updateEmailTemplatesExceptions();
return parent::uninstall($aParams);
}