code
stringlengths 17
247k
| docstring
stringlengths 30
30.3k
| func_name
stringlengths 1
89
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
153
| url
stringlengths 51
209
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
function getTrackTopics ()
{
$a = unserialize($_COOKIE['track_topics']);
if (!is_array($a)) return array ();
return $a;
} | returns array with viewed topics | getTrackTopics | php | boonex/dolphin.pro | modules/boonex/forum/classes/Forum.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/Forum.php | MIT |
function isNewTopic ($topic_id, $topic_last_time, $user_last_time)
{
$a = $this->getTrackTopics ();
if ($a[$topic_id] && $topic_last_time > $a[$topic_id])
return 1;
else if ($a[$topic_id])
return 0;
if (!$user_last_time) return 1;
if ($topic_last_time > $user_last_time) return 1;
return 0;
} | detect new topic by last topic update time and user activity and cookies | isNewTopic | php | boonex/dolphin.pro | modules/boonex/forum/classes/Forum.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/Forum.php | MIT |
function updateCurrentUserActivity ()
{
$u = $this->getLoginUser ();
if (!$u) return;
$this->fdb->updateUserActivity ($u);
} | updates current user last activity time | updateCurrentUserActivity | php | boonex/dolphin.pro | modules/boonex/forum/classes/Forum.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/Forum.php | MIT |
function getRow($query, $bindings = [], $arr_type = PDO::FETCH_ASSOC)
{
return BxDolDb::getInstance()->getRow($query, $bindings, $arr_type);
} | execute sql query and return one row result
@param $query
@param $bindings
@param int $arr_type
@return array | getRow | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function getOne($query, $bindings = [])
{
return BxDolDb::getInstance()->getOne($query, $bindings);
} | execute sql query and return one value result
@param $query
@param $bindings
@return mixed | getOne | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function getFirstRow($query, $bindings = [], $arr_type = PDO::FETCH_ASSOC)
{
return BxDolDb::getInstance()->getFirstRow($query, $bindings, $arr_type);
} | execute sql query and return the first row of result
and keep $array type and poiter to all data
@param string $query
@param array $bindings
@param int $arr_type
@return array | getFirstRow | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function getNextRow()
{
return BxDolDb::getInstance()->getNextRow();
} | return next row of pointed last getFirstRow calling data | getNextRow | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function getNumRows($res = null)
{
return BxDolDb::getInstance()->getAffectedRows($res);
} | return number of affected rows in current mysql result
@param PDOStatement $res
@return int | getNumRows | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function query($query, $bindings = [])
{
return BxDolDb::getInstance()->query($query, $bindings);
} | execute any query return number of rows affected/false
@param $query
@param $bindings
@return int | query | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function getAll($query, $bindings = [], $arr_type = PDO::FETCH_ASSOC)
{
return BxDolDb::getInstance()->getAll($query, $bindings, $arr_type);
} | execute sql query and return table of records as result
@param $query
@param $bindings
@param int $arr_type
@return array | getAll | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxDb.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxDb.php | MIT |
function checkEncoding ()
{
$encodings = array ();
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && ini_get('output_handler') != 'ob_gzhandler') {
$this->_sEnc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
$this->_bGzip = true;
}
} | check if client browser supports gzip | checkEncoding | php | boonex/dolphin.pro | modules/boonex/forum/classes/BxJsGzipLoader.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/BxJsGzipLoader.php | MIT |
function log ($s)
{
global $gConf;
if (strlen ($gConf['dir']['error_log'])) {
$fp = @fopen ($gConf['dir']['error_log'], "a");
if ($fp) {
@fwrite ($fp, date ('Y-m-d H:i:s', time ()) . "\t$s\n");
@fclose ($fp);
}
}
if($gConf['debug'])
$this->displayError($s);
$this->_error = $s;
} | set error string for the object | log | php | boonex/dolphin.pro | modules/boonex/forum/classes/Mistake.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/forum/classes/Mistake.php | MIT |
function serviceProfileBlock ($iProfileId)
{
$iProfileId = (int)$iProfileId;
$aProfile = getProfileInfo($iProfileId);
bx_import ('PageMain', $this->_aModule);
$o = new BxGroupsPageMain ($this);
$o->sUrlStart = getProfileLink($aProfile['ID']) . '?';
return $o->ajaxBrowse(
'user',
$this->_oDb->getParam('bx_groups_perpage_profile'),
array(),
process_db_input ($aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION),
true,
false
);
} | Profile block with user's groups
@param $iProfileId profile id
@return html to display on homepage in a block | serviceProfileBlock | php | boonex/dolphin.pro | modules/boonex/groups/classes/BxGroupsModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/groups/classes/BxGroupsModule.php | MIT |
function serviceProfileBlockJoined ($iProfileId)
{
$iProfileId = (int)$iProfileId;
$aProfile = getProfileInfo($iProfileId);
bx_import ('PageMain', $this->_aModule);
$o = new BxGroupsPageMain ($this);
$o->sUrlStart = $_SERVER['PHP_SELF'] . '?' . bx_encode_url_params($_GET, array('page'));
return $o->ajaxBrowse(
'joined',
$this->_oDb->getParam('bx_groups_perpage_profile'),
array(),
process_db_input ($aProfile['NickName'], BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION),
true,
false
);
} | Profile block with groups user joined
@param $iProfileId profile id
@return html to display on homepage in a block | serviceProfileBlockJoined | php | boonex/dolphin.pro | modules/boonex/groups/classes/BxGroupsModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/groups/classes/BxGroupsModule.php | MIT |
function check($sAction, $iObjectId, $iViewerId = 0)
{
if(empty($iViewerId))
$iViewerId = getLoggedId();
$aObject = $this->_oDb->getObjectInfo($this->getFieldAction($sAction), $iObjectId);
if(empty($aObject) || !is_array($aObject))
return true;
if($iViewerId == $aObject['owner_id'])
return true;
if($this->_oDb->isGroupMember($aObject['group_id'], $aObject['owner_id'], $iViewerId))
return true;
return $this->isDynamicGroupMember($aObject['group_id'], $aObject['owner_id'], $iViewerId, $iObjectId);
} | Check whether the viewer can make requested action.
@param string $sAction action name from 'sys_priacy_actions' table.
@param integer $iObjectId object ID the action to be performed with.
@param integer $iViewerId viewer ID.
@return boolean result of operation. | check | php | boonex/dolphin.pro | modules/boonex/simple_messenger/classes/BxSimpleMessengerPrivacy.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/simple_messenger/classes/BxSimpleMessengerPrivacy.php | MIT |
function getExtraJs($sType)
{
$sResult = "";
switch($sType) {
case 'orders':
$sResult = $this->_oOrders->getExtraJs();
break;
}
return $sResult;
} | Public Methods of Common Usage | getExtraJs | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtModule.php | MIT |
public function getInvoice($invoiceId, $apiKey=false) {
try {
if (!$apiKey)
$apiKey = $this->aBpOptions['apiKey'];
$response = $this->_curl('https://bitpay.com/api/invoice/'.$invoiceId, $apiKey);
if (is_string($response))
return $response; // error
$response['posData'] = json_decode($response['posData'], true);
$response['posData'] = $response['posData']['d'];
return $response;
}
catch (Exception $e) {
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . $e->getMessage());
return 'Error: ' . $e->getMessage();
}
} | Retrieves an invoice from BitPay. $options can include 'apiKey'
@param string $invoiceId, boolean $apiKey
@return mixed $json
@throws Exception $e | getInvoice | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
function getCurrencyList() {
$currencies = array();
$rate_url = 'https://bitpay.com/api/rates';
try {
$clist = json_decode(file_get_contents($rate_url),true);
foreach($clist as $key => $value)
$currencies[$value['code']] = $value['name'];
return $currencies;
}
catch (Exception $e) {
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . $e->getMessage());
return 'Error: ' . $e->getMessage();
}
} | Retrieves a list of all supported currencies
and returns associative array.
@param none
@return array $currencies
@throws Exception $e | getCurrencyList | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
protected function _verifyNotification() {
try {
$this->_log('Notification received: ' . date("m.d.y H:i:s"));
$post = file_get_contents("php://input");
if(!$post) {
$this->_log('Error: No post data');
return false;
}
$json = json_decode($post, true);
$this->_log('-- Data: ' . $post);
$this->_log($json);
if(is_string($json))
return false;
if(!array_key_exists('posData', $json)) {
$this->_log('Error: No posData');
return false;
}
$json['posData'] = json_decode($json['posData'], true);
if(empty($json['posData']) || !is_array($json['posData'])) {
$this->_log('Error: Empty posData');
return false;
}
return $json;
}
catch (Exception $e) {
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . $e->getMessage());
return false;
}
} | Call from your notification handler to convert $_POST data to an object containing invoice data
@param boolean $apiKey
@return mixed $json
@throws Exception $e | _verifyNotification | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
protected function _verifyPosData($aPosData) {
if(!$this->aBpOptions['verifyPos']) {
if(empty($aPosData['d']) || !is_array($aPosData['d'])) {
$this->_log('Error: Payment data cannot be found.');
return false;
}
return $aPosData['d'];
}
if($this->_hash(serialize($aPosData['d']), $this->aBpOptions['apiKey']) != $aPosData['h']) {
$this->_log('Error: Authentication failed (bad posData hash).');
return false;
}
return $aPosData['d'];
} | Call from your notification handler to verify posData
@param array $aPosData
@return boolean | _verifyPosData | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
protected function _decodeResponse($response) {
try {
if (empty($response) || !(is_string($response)))
return array('error' => 'BxPmtBitPay::_decodeResponse expects a string parameter.');
return json_decode($response, true);
}
catch (Exception $e) {
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . $e->getMessage());
return array('error' => $e->getMessage());
}
} | Decodes JSON response and returns
associative array.
@param string $response
@return array $arrResponse
@throws Exception $e | _decodeResponse | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
protected function _curl($url, $apiKey, $post = false) {
if(!isset($url) || trim($url) == '' || !isset($apiKey) || trim($apiKey) == '') {
// Invalid parameter specified
if($this->aBpOptions['useLogging'])
$this->_log('Error: You must supply non-empty url and apiKey parameters.');
return array('error' => 'You must supply non-empty url and apiKey parameters.');
}
try {
$curl = curl_init();
$length = 0;
if ($post) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$length = strlen($post);
}
$uname = base64_encode($apiKey);
if($uname) {
$header = array(
'Content-Type: application/json',
'Content-Length: ' . $length,
'Authorization: Basic ' . $uname,
);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_PORT, 443);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // verify certificate
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // check existence of CN and verify that it matches hostname
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
$responseString = curl_exec($curl);
if($responseString == false) {
$response = array('error' => curl_error($curl));
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . curl_error($curl));
}
else {
$response = json_decode($responseString, true);
if (!$response) {
$response = array('error' => 'invalid json: '.$responseString);
if($this->aBpOptions['useLogging'])
$this->_log('Error - Invalid JSON: ' . $responseString);
}
}
curl_close($curl);
return $response;
}
else {
curl_close($curl);
if($this->aBpOptions['useLogging'])
$this->_log('Invalid data found in apiKey value passed to Bitpay::curl method. (Failed: base64_encode(apikey))');
return array('error' => 'Invalid data found in apiKey value passed to Bitpay::curl method. (Failed: base64_encode(apikey))');
}
}
catch (Exception $e) {
@curl_close($curl);
if($this->aBpOptions['useLogging'])
$this->_log('Error: ' . $e->getMessage());
return array('error' => $e->getMessage());
}
} | Handles post/get to BitPay via curl.
@param string $url, string $apiKey, boolean $post
@return mixed $response
@throws Exception $e | _curl | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
protected function _log($contents) {
try {
if(isset($this->aBpOptions['logFile']) && $this->aBpOptions['logFile'] != '') {
$file = $this->aBpOptions['logFile'];
}
else {
// Fallback to using a default logfile name in case the variable is
// missing or not set.
$file = dirname(__FILE__) . '/bplog.txt';
}
file_put_contents($file, date('m-d H:i:s').": ", FILE_APPEND);
if (is_array($contents))
$contents = var_export($contents, true);
else if (is_object($contents))
$contents = json_encode($contents);
file_put_contents($file, $contents."\n", FILE_APPEND);
}
catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
} | Writes $contents to a log file specified in the bp_options file or, if missing,
defaults to a standard filename of 'bplog.txt'.
@param mixed $contents
@return
@throws Exception $e | _log | php | boonex/dolphin.pro | modules/boonex/payment/classes/BxPmtBitPay.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/payment/classes/BxPmtBitPay.php | MIT |
function getThumbnailHTML($sUrl, $aOptions, $sAttribAlt = false, $sAttribClass = false, $sAttribStyle = false)
{
$sImageTag = false;
if (ACCOUNT_TYPE != 'No Automated Screenshots') {
$aOptions = _generateOptions($aOptions);
$sImageTag = _getThumbnailPaid($sUrl, $aOptions, $sAttribAlt, $sAttribClass, $sAttribStyle);
}
return $sImageTag;
} | Gets the thumbnail for the specified website, stores it in the cache, and then returns the
HTML for loading the image. This handles the ShrinkTheWeb javascript loader for free basic
accounts. | getThumbnailHTML | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function saveAccountInfo()
{
$aArgs['stwaccesskeyid'] = ACCESS_KEY;
$aArgs['stwu'] = SECRET_KEY;
$sRequestUrl = 'http://images.shrinktheweb.com/account.php';
$sRemoteData = bx_file_get_contents($sRequestUrl, $aArgs);
$aResponse = _getAccXMLResponse($sRemoteData);
if ($aResponse['stw_response_status'] == 'Success') {
$GLOBALS['oBxSitesModule']->_oDb->addAccountInfo(ACCESS_KEY, $aResponse);
}
return $aResponse;
} | Get Account XML response and save it into database | saveAccountInfo | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getThumbnail($sUrl, $aOptions)
{
// create cache directory if it doesn't exist
_createCacheDirectory();
$aOptions = _generateOptions($aOptions);
$aArgs = _generateRequestArgs($aOptions);
// Try to grab the thumbnail
$iCacheDays = CACHE_DAYS + 0;
if ($iCacheDays >= 0 && $aOptions['Embedded'] != 1) {
$aArgs['stwurl'] = $sUrl;
$sImageUrl = _getCachedThumbnail($aArgs);
} else {
// Get raw image data
unset($aArgs['stwu']); // ONLY on "Advanced" method requests!! (not allowed on embedded)
$aArgs['stwembed'] = 1;
$aArgs['stwurl'] = $sUrl;
$sImageUrl = urldecode("http://images.shrinktheweb.com/xino.php?".http_build_query($aArgs,'','&'));
}
return $sImageUrl;
} | Gets the thumbnail for the specified website, stores it in the cache, and then returns the
relative path to the cached image. | _getThumbnail | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _generateRequestArgs($aOptions)
{
// Get all the options from the database for the thumbnail
$aArgs['stwaccesskeyid'] = ACCESS_KEY;
$aArgs['stwu'] = SECRET_KEY;
$aArgs['stwver'] = VER;
// Allowing internal links?
if (INSIDE_PAGES) {
$aArgs['stwinside'] = 1;
}
// If SizeCustom is specified and widescreen capturing is not activated,
// then use that size rather than the size stored in the settings
if (!$aOptions['FullSizeCapture'] && !$aOptions['WidescreenY']) {
// Do we have a custom size?
if ($aOptions['SizeCustom']) {
$aArgs['stwxmax'] = $aOptions['SizeCustom'];
} else {
$aArgs['stwsize'] = $aOptions['Size'];
}
}
// Use fullsize capturing?
if ($aOptions['FullSizeCapture']) {
$aArgs['stwfull'] = 1;
if ($aOptions['SizeCustom']) {
$aArgs['stwxmax'] = $aOptions['SizeCustom'];
} else {
$aArgs['stwxmax'] = 120;
}
if ($aOptions['MaxHeight']) {
$aArgs['stwymax'] = $aOptions['MaxHeight'];
}
}
// Change native resolution?
if ($aOptions['NativeResolution']) {
$aArgs['stwnrx'] = $aOptions['NativeResolution'];
if ($aOptions['WidescreenY']) {
$aArgs['stwnry'] = $aOptions['WidescreenY'];
if ($aOptions['SizeCustom']) {
$aArgs['stwxmax'] = $aOptions['SizeCustom'];
} else {
$aArgs['stwxmax'] = 120;
}
}
}
// Wait after page load in seconds
if ($aOptions['Delay']) {
$aArgs['stwdelay'] = intval($aOptions['Delay']) <= 45 ? intval($aOptions['Delay']) : 45;
}
// Use Refresh On-Demand?
if ($aOptions['RefreshOnDemand']) {
$aArgs['stwredo'] = 1;
}
// Use another image quality percent %
if ($aOptions['Quality']) {
$aArgs['stwq'] = intval($aOptions['Quality']);
}
// Use custom messages?
if (CUSTOM_MSG_URL) {
$aArgs['stwrpath'] = CUSTOM_MSG_URL;
}
return $aArgs;
} | generate the request arguments | _generateRequestArgs | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getCachedThumbnail($aArgs = null)
{
$aArgs = is_array($aArgs) ? $aArgs : array();
// Use arguments to work out the target filename
$sFilename = _generateHash($aArgs).'.jpg';
$sFile = THUMBNAIL_DIR . $sFilename;
$sReturnName = false;
// Work out if we need to update the cached thumbnail
$iForceUpdate = $aArgs['stwredo'] ? true : false;
if ($iForceUpdate || _cacheFileExpired($sFile)) {
// if quota limit has reached return the QUOTA_IMAGE
if (_checkLimitReached(THUMBNAIL_DIR . QUOTA_IMAGE)) {
$sFilename = QUOTA_IMAGE;
// if bandwidth limit has reached return the BANDWIDTH_IMAGE
} else if (_checkLimitReached(THUMBNAIL_DIR . BANDWIDTH_IMAGE)) {
$sFilename = BANDWIDTH_IMAGE;
// if WAY OVER the limits (i.e. request is ignored by STW) return the NO_RESPONSE_IMAGE
} else if (_checkLimitReached(THUMBNAIL_DIR . NO_RESPONSE_IMAGE)) {
$sFilename = NO_RESPONSE_IMAGE;
} else {
// check if the thumbnail was captured
$aImage = _checkWebsiteThumbnailCaptured($aArgs);
switch ($aImage['status']) {
case 'save': // download the image to local path
_downloadRemoteImageToLocalPath($aImage['url'], $sFile);
break;
case 'nosave': // dont save the image but return the url
return $aImage['url'];
break;
case 'quota_exceed': // download the image to local path for locking requests
$sFilename = QUOTA_IMAGE;
$sFile = THUMBNAIL_DIR . $sFilename;
_downloadRemoteImageToLocalPath($aImage['url'], $sFile);
break;
case 'bandwidth_exceed': // download the image to local path for locking requests
$sFilename = BANDWIDTH_IMAGE;
$sFile = THUMBNAIL_DIR . $sFilename;
_downloadRemoteImageToLocalPath($aImage['url'], $sFile);
break;
default: // otherwise return the status
return $aImage['status'];
}
}
}
$sFile = THUMBNAIL_DIR . $sFilename;
// Check if file exists
if (file_exists($sFile)) {
$sReturnName = THUMBNAIL_URI . $sFilename;
}
return $sReturnName;
} | Get a thumbnail, caching it first if possible. | _getCachedThumbnail | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _downloadRemoteImageToLocalPath($sRemoteUrl, $sFile)
{
$sRemoteData = bx_file_get_contents($sRemoteUrl, array());
// Only save data if we managed to get the file content
if ($sRemoteData) {
if ($oFile = fopen($sFile, "w+")) {
fputs($oFile, $sRemoteData);
fclose($oFile);
}
} else {
// Try to delete file if download failed
if (file_exists($sFile)) {
@unlink($sFile);
}
return false;
}
return true;
} | Method to get image at the specified remote Url and attempt to save it to the specifed local path | _downloadRemoteImageToLocalPath | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getNoResponseImage($sUrl, $aOptions)
{
// create cache directory if it doesn't exist
_createCacheDirectory();
$aOptions = _generateOptions($aOptions);
$aArgs['stwaccesskeyid'] = 'accountproblem';
if ($aOptions['SizeCustom']) {
$aArgs['stwxmax'] = $aOptions['SizeCustom'];
} else {
$aArgs['stwsize'] = $aOptions['Size'];
}
$sRequestUrl = 'http://images.shrinktheweb.com/xino.php';
$sRemoteData = bx_file_get_contents($sRequestUrl, $aArgs);
if ($sRemoteData != '') {
$aResponse = _getXMLResponse($sRemoteData);
if (!$aResponse['exists'] && $aResponse['thumbnail'] != '') {
$sImageUrl = $aResponse['thumbnail'];
$sFilename = NO_RESPONSE_IMAGE;
$sFile = THUMBNAIL_DIR . $sFilename;
$isDownloaded = _downloadRemoteImageToLocalPath($sImageUrl, $sFile);
if ($isDownloaded == true) {
return THUMBNAIL_URI . $sFilename;
}
}
}
return false;
} | Gets the account problem image and returns the relative path to the cached image | _getNoResponseImage | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _checkLimitReached($sFile)
{
// file is not existing
if (!file_exists($sFile)) {
return false;
}
// is file older then 6 hours?
$iCutoff = time() - (3600 * 6);
if (filemtime($sFile) <= $iCutoff) {
@unlink($sFile);
return false;
}
// file is existing and not expired!
return true;
} | Check if the limit reached image is existing, if so return true
return false if there is no image existing or the limit reached file is
older then 6 hours | _checkLimitReached | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _createCacheDirectory()
{
// Create cache directory if it doesn't exist
if (!file_exists(THUMBNAIL_DIR)) {
@mkdir(THUMBNAIL_DIR, 0777, true);
} else {
// Try to make the directory writable
@chmod(THUMBNAIL_DIR, 0777);
}
} | Create the cache directory if it doesn't exist | _createCacheDirectory | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _generateHash($aArgs)
{
/* $sPrehash = $aArgs['stwfull'] ? 'a' : 'c';
$sPrehash .= $aArgs['stwxmax'].'x'.$aArgs['stwymax'];
if ($aArgs['stwnrx']) {
$sPrehash .= 'b'.$aArgs['stwnrx'].'x'.$aArgs['stwnry'];
}
$sPrehash .= $aArgs['stwinside'];*/
$aReplace = array('http', 'https', 'ftp', '://');
$sUrl = str_replace($aReplace, '', $aArgs['stwurl']);
// return md5($sPrehash.$aArgs['stwsize'].$aArgs['stwq'].$sUrl);
return md5($sUrl);
} | Generate the hash for the thumbnail | _generateHash | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getXMLResponse($sResponse)
{
if (extension_loaded('simplexml')) { // If simplexml is available, we can do more stuff!
$oDOM = new DOMDocument;
$oDOM->loadXML($sResponse);
$sXML = simplexml_import_dom($oDOM);
$sXMLLayout = 'http://www.shrinktheweb.com/doc/stwresponse.xsd';
// Pull response codes from XML feed
$aResponse['stw_response_status'] = $sXML->children($sXMLLayout)->Response->ResponseStatus->StatusCode; // HTTP Response Code
$aResponse['stw_action'] = $sXML->children($sXMLLayout)->Response->ThumbnailResult->Thumbnail[1]; // ACTION
$aResponse['stw_response_code'] = $sXML->children($sXMLLayout)->Response->ResponseCode->StatusCode; // STW Error Response
$aResponse['stw_last_captured'] = $sXML->children($sXMLLayout)->Response->ResponseTimestamp->StatusCode; // Last Captured
$aResponse['stw_quota_remaining'] = $sXML->children($sXMLLayout)->Response->Quota_Remaining->StatusCode; // New Reqs left for today
$aResponse['stw_bandwidth_remaining'] = $sXML->children($sXMLLayout)->Response->Bandwidth_Remaining->StatusCode; // New Reqs left for today
$aResponse['stw_category_code'] = $sXML->children($sXMLLayout)->Response->CategoryCode->StatusCode; // Not yet implemented
$aResponse['thumbnail'] = $sXML->children($sXMLLayout)->Response->ThumbnailResult->Thumbnail[0]; // Image Location (alt method)
} else {
// LEGACY SUPPPORT
$aResponse['stw_response_status'] = _getLegacyResponse('ResponseStatus', $sRemoteData);
$aResponse['stw_response_code'] = _getLegacyResponse('ResponseCode', $sRemoteData);
// check remaining quota
$aResponse['stw_quota_remaining'] = _getLegacyResponse('Quota_Remaining', $sRemoteData);
// check remaining bandwidth
$aResponse['stw_bandwidth_remaining'] = _getLegacyResponse('Bandwidth_Remaining', $sRemoteData);
// get thumbnail and status
$aThumbnail = _getThumbnailStatus($sRemoteData);
$aResponse = array_merge($aResponse, $aThumbnail);
}
if ($aResponse['stw_action'] == 'delivered') {
$aResponse['exists'] = true;
} else {
$aResponse['exists'] = false;
}
if ($aResponse['stw_action'] == 'fix_and_retry') {
$aResponse['problem'] = true;
} else {
$aResponse['problem'] = false;
}
if ($aResponse['stw_action'] == 'noretry' && !$aResponse['exists']) {
$aResponse['error'] = true;
} else {
$aResponse['error'] = false;
}
// if we use the advanced api for free account we get an invalid request
if ($aResponse['stw_response_code'] == 'INVALID_REQUEST') {
$aResponse['invalid'] = true;
} else {
$aResponse['invalid'] = false;
}
// if our domain or IP is not listed in the account's "Allowed Referrers" AND "Lock to Account" is enabled, then we get this error
if ($aResponse['stw_response_code'] == 'LOCK_TO_ACCOUNT') {
$aResponse['locked'] = true;
} else {
$aResponse['locked'] = false;
}
return $aResponse;
} | store the XML response in an array and generate status bits | _getXMLResponse | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _cacheFileExpired($sFile)
{
// Use setting to check age of files.
$iCacheDays = CACHE_DAYS + 0;
// dont update image once it is cached
if ($iCacheDays == 0 && file_exists($sFile)) {
return false;
// check age of file and if file exists return false, otherwise recache the file
} else {
$iCutoff = time() - (3600 * 24 * $iCacheDays);
return (!file_exists($sFile) || filemtime($sFile) <= $iCutoff);
}
} | Determine if specified file has expired from the cache | _cacheFileExpired | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getArrayValue($aArray, $sKey, $isReturnSpace = false)
{
if ($aArray && isset($aArray[$sKey])) {
return $aArray[$sKey];
}
// If returnSpace is true, then return a space rather than nothing at all
if ($isReturnSpace) {
return ' ';
} else {
return false;
}
} | Safe method to get the value from an array using the specified key | _getArrayValue | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function _getAccXMLResponse($sResponse)
{
if (extension_loaded('simplexml')) { // If simplexml is available, we can do more stuff!
$oDOM = new DOMDocument;
$oDOM->loadXML($sResponse);
$sXML = simplexml_import_dom($oDOM);
$sXMLLayout = 'http://www.shrinktheweb.com/doc/stwacctresponse.xsd';
// Pull response codes from XML feed
$aResponse['stw_response_status'] = $sXML->children($sXMLLayout)->Response->Status->StatusCode; // Response Code
$aResponse['stw_account_level'] = $sXML->children($sXMLLayout)->Response->Account_Level->StatusCode; // Account level
// check for enabled upgrades
$aResponse['stw_inside_pages'] = $sXML->children($sXMLLayout)->Response->Inside_Pages->StatusCode; // Inside Pages
$aResponse['stw_custom_size'] = $sXML->children($sXMLLayout)->Response->Custom_Size->StatusCode; // Custom Size
$aResponse['stw_full_length'] = $sXML->children($sXMLLayout)->Response->Full_Length->StatusCode; // Full Length
$aResponse['stw_refresh_ondemand'] = $sXML->children($sXMLLayout)->Response->Refresh_OnDemand->StatusCode; // Refresh OnDemand
$aResponse['stw_custom_delay'] = $sXML->children($sXMLLayout)->Response->Custom_Delay->StatusCode; // Custom Delay
$aResponse['stw_custom_quality'] = $sXML->children($sXMLLayout)->Response->Custom_Quality->StatusCode; // Custom Quality
$aResponse['stw_custom_resolution'] = $sXML->children($sXMLLayout)->Response->Custom_Resolution->StatusCode; // Custom Resolution
$aResponse['stw_custom_messages'] = $sXML->children($sXMLLayout)->Response->Custom_Messages->StatusCode; // Custom Messages
} else {
// LEGACY SUPPPORT
$aResponse['stw_response_status'] = _getLegacyResponse('Status', $sRemoteData);
$aResponse['stw_account_level'] = _getLegacyResponse('Account_Level', $sRemoteData); // Account level
// check for enabled upgrades
$aResponse['stw_inside_pages'] = _getLegacyResponse('Inside_Pages', $sRemoteData); // Inside Pages
$aResponse['stw_custom_size'] = _getLegacyResponse('Custom_Size', $sRemoteData); // Custom Size
$aResponse['stw_full_length'] = _getLegacyResponse('Full_Length', $sRemoteData); // Full Length
$aResponse['stw_refresh_ondemand'] = _getLegacyResponse('Refresh_OnDemand', $sRemoteData); // Refresh OnDemand
$aResponse['stw_custom_delay'] = _getLegacyResponse('Custom_Delay', $sRemoteData); // Custom Delay
$aResponse['stw_custom_quality'] = _getLegacyResponse('Custom_Quality', $sRemoteData); // Custom Quality
$aResponse['stw_custom_resolution'] = _getLegacyResponse('Custom_Resolution', $sRemoteData); // Custom Resolution
$aResponse['stw_custom_messages'] = _getLegacyResponse('Custom_Messages', $sRemoteData); // Custom Messages
}
return $aResponse;
} | store the Account XML response in an array | _getAccXMLResponse | php | boonex/dolphin.pro | modules/boonex/sites/classes/BxSitesSTW.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/sites/classes/BxSitesSTW.php | MIT |
function actionStart()
{
if (isLogged())
$this->_redirect ($this -> _oConfig -> sDefaultRedirectUrl);
if (!$this->_oConfig->sApiID || !$this->_oConfig->sApiSecret || !$this->_oConfig->sApiUrl) {
$sCode = MsgBox( _t('_bx_dolphcon_profile_error_api_keys') );
$this->_oTemplate->getPage(_t('_bx_dolphcon'), $sCode);
}
else {
// define redirect URL to the remote Dolphin site
$sUrl = bx_append_url_params($this->_oConfig->sApiUrl . 'auth', array(
'response_type' => 'code',
'client_id' => $this->_oConfig->sApiID,
'redirect_uri' => $this->_oConfig->sPageHandle,
'scope' => $this->_oConfig->sScope,
'state' => $this->_genCsrfToken(),
));
$this->_redirect($sUrl);
}
} | Redirect to remote Dolphin site login form
@return n/a/ - redirect or HTML page in case of error | actionStart | php | boonex/dolphin.pro | modules/boonex/dolphin_connect/classes/BxDolphConModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/dolphin_connect/classes/BxDolphConModule.php | MIT |
function serviceMakeAvatarFromImage ($sImg)
{
if (!$this->_iProfileId)
return false;
if (!file_exists($sImg))
return false;
$sImagePath = BX_AVA_DIR_TMP . '_' . $this->_iProfileId . BX_AVA_EXT;
$o =& BxDolImageResize::instance();
$o->removeCropOptions ();
$o->setJpegOutput (true);
$o->setSize (BX_AVA_W, BX_AVA_W);
$o->setSquareResize (true);
if (IMAGE_ERROR_SUCCESS != $o->resize($sImg, $sImagePath))
return false;
return $this->_addAvatar ($sImagePath, true);
} | make avatar from particular image, also it makes it square
@param $sImg path to the image
@return true on success or false on error | serviceMakeAvatarFromImage | php | boonex/dolphin.pro | modules/boonex/avatar/classes/BxAvaModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/avatar/classes/BxAvaModule.php | MIT |
function serviceMakeAvatarFromImageUrl ($sImgUrl)
{
if (!$this->_iProfileId)
return false;
$s = bx_file_get_contents ($sImgUrl);
if (!$s)
return false;
$sImagePath = BX_AVA_DIR_TMP . '_' . $this->_iProfileId . BX_AVA_EXT;
if (!file_put_contents($sImagePath, $s))
return false;
return $this->serviceMakeAvatarFromImage($sImagePath);
} | make avatar from image url, also it makes it square
@param $sImg url to the image
@return true on success or false on error | serviceMakeAvatarFromImageUrl | php | boonex/dolphin.pro | modules/boonex/avatar/classes/BxAvaModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/avatar/classes/BxAvaModule.php | MIT |
function serviceMakeAvatarFromSharedPhotoAuto ($iSharedPhotoId)
{
if (!$this->_iProfileId)
return false;
$aImageFile = BxDolService::call('photos', 'get_photo_array', array((int)$iSharedPhotoId, 'file'), 'Search');
if (!$aImageFile)
return false;
return $this->serviceMakeAvatarFromImage($aImageFile['path']);
} | get image from photos module and make avatar from it
also it makes it square
@param $iSharedPhotoId photo id from photos module
@return true on success or false on error | serviceMakeAvatarFromSharedPhotoAuto | php | boonex/dolphin.pro | modules/boonex/avatar/classes/BxAvaModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/avatar/classes/BxAvaModule.php | MIT |
function serviceCropTool ($aParams)
{
if (!$aParams || !is_array($aParams)) {
return _t('_bx_ava_msg_error_occured');
}
if (!file_exists($aParams['dir_image'])) {
return _t ('_bx_ava_no_crop_image');
}
bx_import('BxDolImageResize');
$aSizes = BxDolImageResize::getImageSize ($aParams['dir_image']);
$aVars = array (
'url_img' => $aParams['url_image'],
'img_width' => $aSizes['w'] ? $aSizes['w'] : 0,
'img_height' => $aSizes['h'] ? $aSizes['h'] : 0,
'action' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri(),
);
return $this->_oTemplate->parseHtmlByName ('crop_tool', $aVars);
} | Returns crop image html, it consists of image for cropping, cropping preview and descriptions
@param $aParams
dir_image - image path
url_image - image url
@returns error message string of html string | serviceCropTool | php | boonex/dolphin.pro | modules/boonex/avatar/classes/BxAvaModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/avatar/classes/BxAvaModule.php | MIT |
function serviceGetWallPost ($aEvent)
{
$aProfile = getProfileInfo($aEvent['owner_id']);
if(empty($aProfile))
return array('perform_delete' => true);
if($aProfile['Status'] != 'Active')
return "";
$sCss = '';
if($aEvent['js_mode'])
$sCss = $this->_oTemplate->addCss('wall_post.css', true);
else
$this->_oTemplate->addCss('wall_post.css');
$sOwner = getNickName((int)$aEvent['owner_id']);
$sTxtWallObject = _t('_bx_ava_wall_object');
return array(
'title' => _t('_bx_ava_wall_title_' . $aEvent['action'], $sOwner, $sTxtWallObject),
'description' => '',
'content' => $sCss . $this->_oTemplate->parseHtmlByName('wall_post', array(
'cpt_user_name' => $sOwner,
'cpt_added_new' => _t('_bx_ava_wall_' . $aEvent['action']),
'cpt_object' => $sTxtWallObject,
'post_id' => $aEvent['id'],
))
);
} | Html to display on profile wall, when user uploads new avatar
@param $aEvent - wall event parameters
@return html to post on profile's wall | serviceGetWallPost | php | boonex/dolphin.pro | modules/boonex/avatar/classes/BxAvaModule.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/avatar/classes/BxAvaModule.php | MIT |
public function get ($aData)
{
switch ($this->_sObject) {
case 'bx_photos_thumb_2x':
return BxDolService::call('photos', 'profile_photo', array($aData['ID'], 'browse'), 'Search');
case 'bx_photos_thumb':
case 'bx_photos_icon_2x':
return BxDolService::call('photos', 'profile_photo', array($aData['ID'], 'thumb'), 'Search');
case 'bx_photos_icon':
return BxDolService::call('photos', 'profile_photo', array($aData['ID'], 'icon'), 'Search');
}
return parent::get($aData);
} | Get member avatar from profile photos | get | php | boonex/dolphin.pro | modules/boonex/photos/classes/BxPhotosMemberInfo.php | https://github.com/boonex/dolphin.pro/blob/master/modules/boonex/photos/classes/BxPhotosMemberInfo.php | MIT |
public function setCustomConf ($s)
{
$this->_sConfCustom = $s;
} | Set custom TinyMCE configuration option | setCustomConf | php | boonex/dolphin.pro | templates/base/scripts/BxBaseEditorTinyMCE.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseEditorTinyMCE.php | MIT |
function showBlockCover( $sCaption, $bNoDB = false )
{
global $p_arr;
$bProfileOwner = isLogged() && $p_arr['ID'] == getLoggedId();
$sProfileNickname = getNickName($p_arr['ID']);
$sProfileThumbnail = '';
$sProfileThumbnail2x = '';
$sProfileThumbnailHref = '';
$bProfileThumbnail = false;
$bProfileThumbnailHref = false;
$aProfileThumbnail = BxDolService::call('photos', 'profile_photo', array($p_arr['ID'], 'browse', 'full'), 'Search');
if(!empty($aProfileThumbnail) && is_array($aProfileThumbnail)) {
$sProfileThumbnail = $aProfileThumbnail['file_url'];
$sProfileThumbnailHref = $aProfileThumbnail['view_url'];
$bProfileThumbnail = true;
$bProfileThumbnailHref = true;
$aProfileThumbnail2x = BxDolService::call('photos', 'profile_photo', array($p_arr['ID'], 'browse2x', 'full'), 'Search');
if(!empty($aProfileThumbnail2x) && is_array($aProfileThumbnail2x))
$sProfileThumbnail2x = $aProfileThumbnail['file_url'];
}
if($bProfileOwner && BxDolRequest::serviceExists('photos', 'get_manage_profile_photo_url')) {
$sProfileThumbnailHref = BxDolService::call('photos', 'get_manage_profile_photo_url', array($p_arr['ID'], 'profile_album_name'));
$bProfileThumbnailHref = !empty($sProfileThumbnailHref);
}
$sProfileCoverHref = '';
$bProfileCoverHref = false;
if(BxDolRequest::serviceExists('photos', 'profile_cover', 'Search')) {
$sProfileCoverHref = BxDolService::call('photos', 'profile_cover', array($p_arr['ID'], 'file'), 'Search');
$bProfileCoverHref = !empty($sProfileCoverHref);
}
$sProfileCoverChangeHref = '';
$bProfileCoverChangeHref = false;
if($bProfileOwner && BxDolRequest::serviceExists('photos', 'get_album_uploader_url')) {
$sProfileCoverChangeHref = BxDolService::call('photos', 'get_album_uploader_url', array($p_arr['ID'], 'profile_cover_album_name'));
$bProfileCoverChangeHref = !empty($sProfileCoverChangeHref);
}
bx_import('BxDolMemberInfo');
$o = BxDolMemberInfo::getObjectInstance('sys_status_message');
$sProfileStatus = $o ? $o->get($p_arr) : '';
$sBackground = '';
$sBackgroundClass = '';
if($bProfileCoverHref) {
$sBackground = $sProfileCoverHref;
$sBackgroundClass = ' sys-pcb-cover';
}
else if($bProfileThumbnail) {
$sBackground = $sProfileThumbnail;
$sBackgroundClass = ' sys-pcb-thumbnail';
}
$aTmplVarsMenu = array();
$aMenuItems = $GLOBALS['oTopMenu']->getSubItems();
foreach($aMenuItems as $aMenuItem)
$aTmplVarsMenu[] = array(
'href' => $aMenuItem['Link'],
'bx_if:show_onclick' => array(
'condition' => !empty($aMenuItem['Onclick']),
'content' => array(
'onclick' => $aMenuItem['Onclick']
)
),
'bx_if:show_target' => array(
'condition' => !empty($aMenuItem['Target']),
'content' => array(
'target' => $aMenuItem['Target']
)
),
'caption' => _t($aMenuItem['Caption'])
);
$sContent = $GLOBALS['oSysTemplate']->parseHtmlByName('profile_cover.html', array(
'background_class' => $sBackgroundClass,
'bx_if:show_background' => array(
'condition' => !empty($sBackground),
'content' => array(
'background' => $sBackground
)
),
'bx_if:show_actions' => array(
'condition' => $bProfileOwner,
'content' => array(
'bx_if:show_action_thumbnail' => array(
'condition' => $bProfileThumbnailHref,
'content' => array(
'href_upload_thumbnail' => $sProfileThumbnailHref
),
),
'bx_if:show_action_cover' => array(
'condition' => $bProfileCoverChangeHref,
'content' => array(
'href_upload' => $sProfileCoverChangeHref,
)
)
)
),
'bx_if:show_thumbnail_image' => array(
'condition' => $bProfileThumbnail,
'content' => array(
'thumbnail_href' => $sProfileThumbnailHref,
'thumbnail' => $sProfileThumbnail,
'thumbnail2x' => $sProfileThumbnail2x,
)
),
'bx_if:show_thumbnail_letter_text' => array(
'condition' => !$bProfileThumbnail && !$bProfileThumbnailHref,
'content' => array(
'letter' => mb_substr($sProfileNickname, 0, 1)
)
),
'bx_if:show_thumbnail_letter_link' => array(
'condition' => !$bProfileThumbnail && $bProfileThumbnailHref,
'content' => array(
'thumbnail_href' => $sProfileThumbnailHref,
'letter' => mb_substr($sProfileNickname, 0, 1)
)
),
'nickname' => $sProfileNickname,
'status' => $sProfileStatus,
'bx_repeat:menu_items' => $aTmplVarsMenu,
));
return array($sContent, array(), array(), true);
} | * @description : function will generate profiles's cover
* @param : $sCaption (string) caption of returned block
* @param : $bNoDB (boolean) if isset this param block will return with design box
* @return : HTML presentation data | showBlockCover | php | boonex/dolphin.pro | templates/base/scripts/BxBaseProfileGenerator.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseProfileGenerator.php | MIT |
function showBlockActionsMenu( $sCaption, $bNoDB = false )
{
global $p_arr;
/*
if( (!$iMemberID or !$iViewedMemberID) or ($iMemberID == $iViewedMemberID) )
return null;
*/
$sActions = $GLOBALS['oFunctions']->getProfileViewActions($p_arr['ID'], 'Profile');
if ($bNoDB)
return $sActions;
else
echo DesignBoxContent( _t( $sCaption ), $sActions, 1 );
} | * @description : function will generate user's actions
* @param : $sCaption (string) caption of returned block
* @param : $bNoDB (boolean) if isset this param block will return with design box
* @return : HTML presentation data | showBlockActionsMenu | php | boonex/dolphin.pro | templates/base/scripts/BxBaseProfileGenerator.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseProfileGenerator.php | MIT |
function getCmtsInit ()
{
$this->getExtraJs();
$this->getExtraCss();
$aParams = array(
'sObjName' => $this->_sJsObjName,
'sBaseUrl' => BX_DOL_URL_ROOT,
'sSystem' => $this->getSystemName(),
'sSystemTable' => $this->_aSystem['table_cmts'],
'iAuthorId' => $this->_getAuthorId(),
'iObjId' => $this->getId(),
'sOrder' => $this->getOrder(),
'sDefaultErrMsg' => _t('_Error occured'),
'sConfirmMsg' => _t('_Are_you_sure'),
'sAnimationEffect' => $this->_aSystem['animation_effect'],
'sAnimationSpeed' => $this->_aSystem['animation_speed'],
'isEditAllowed' => $this->isEditAllowed() || $this->isEditAllowedAll() ? 1 : 0,
'isRemoveAllowed' => $this->isRemoveAllowed() || $this->isRemoveAllowedAll() ? 1 : 0,
'iAutoHideRootPostForm' => $this->iAutoHideRootPostForm,
'iGlobAllowHtml' => $this->iGlobAllowHtml == 1 ? 1 : 0,
'iSecsToEdit' => (int)$this->getAllowedEditTime(),
'oCmtElements' => $this->_aCmtElements
);
return $GLOBALS['oSysTemplate']->_wrapInTagJsCode("var " . $this->_sJsObjName . " = new BxDolCmts(" . json_encode($aParams) . ");");
} | Get initialization section of comments box
@return string | getCmtsInit | php | boonex/dolphin.pro | templates/base/scripts/BxBaseCmtsView.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseCmtsView.php | MIT |
function _getImageShared($aImageInfo, $sType = 'thumb')
{
return BxDolService::call('photos', 'get_image', array($aImageInfo, $sType), 'Search');
} | Get image of the specified type by image id
@param $aImageInfo image info array with the following info
$aImageInfo['Avatar'] - photo id, NOTE: it not relatyed to profiles avataras module at all
@param $sImgType image type | _getImageShared | php | boonex/dolphin.pro | templates/base/scripts/BxBaseFunctions.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseFunctions.php | MIT |
function sysImage($sImg, $sClassAdd = '', $sAlt = '', $sAttr = '', $sImageType = false, $iSize = 16)
{
if (!$sImg)
return '';
if ($sClassAdd)
$sClassAdd = ' ' . $sClassAdd;
if (false === strpos($sImg, '.')) // return vector icon
return '<i class="sys-icon ' . $sImg . $sClassAdd . '" alt="' . bx_html_attribute($sAlt) . '" ' . $sAttr . '></i>';
// return pixel icon
switch ($sImageType) {
case 'icon':
$sImg = $this->getTemplateIcon($sImg);
break;
case 'image':
$sImg = $this->getTemplateImage($sImg);
break;
}
return '<img src="' . $sImg . '" class="' . $sClassAdd . '" alt="' . bx_html_attribute($sAlt) . '" ' . $sAttr . ' border="0" width="' . $iSize . '" height="' . $iSize . '" />';
} | Generate code for system icon, depending on $sImg name it returns vector or pixel icon.
Vector icon is determined by missing dot sign in the name.
@param $sImg - system icon filename, full path to custom icon, or vector icon name
@param $sClassAdd - add these classes to the icon
@param $sAlt - alt text for pixel icon or title text for vector icon
@param $sAttr - custom attributes string
@param $sImageType - pixel image type to automatically get full path to the icon: icon, image or empty string
@return ready to use HTML code with icon, it is <img ... /> - in case of pixel icon; <i class="sys-icon ..." ...></i> - in cace of vector icon | sysImage | php | boonex/dolphin.pro | templates/base/scripts/BxBaseFunctions.php | https://github.com/boonex/dolphin.pro/blob/master/templates/base/scripts/BxBaseFunctions.php | MIT |
public function __construct()
{
$this->initializeSerializer();
} | Constructor to initialize static properties | __construct | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function __wakeup()
{
$this->initializeSerializer();
} | Wakeup method to initialize static properties | __wakeup | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function getQueries()
{
$endpoint = $this->getEndpoint(QueryEndpoint::NAME);
return $endpoint->getBool();
} | Returns queries inside BoolQuery instance.
@return BoolQuery | getQueries | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function setQueryParameters(array $parameters)
{
$this->setEndpointParameters(QueryEndpoint::NAME, $parameters);
return $this;
} | Sets query endpoint parameters.
@param array $parameters
@return $this | setQueryParameters | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function setEndpointParameters($endpointName, array $parameters)
{
/** @var AbstractSearchEndpoint $endpoint */
$endpoint = $this->getEndpoint($endpointName);
$endpoint->setParameters($parameters);
return $this;
} | Sets parameters to the endpoint.
@param string $endpointName
@param array $parameters
@return $this | setEndpointParameters | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function addPostFilter(BuilderInterface $filter, $boolType = BoolQuery::MUST, $key = null)
{
$this
->getEndpoint(PostFilterEndpoint::NAME)
->addToBool($filter, $boolType, $key);
return $this;
} | Adds a post filter to search.
@param BuilderInterface $filter Filter.
@param string $boolType Example boolType values:
- must
- must_not
- should.
@param string $key
@return $this. | addPostFilter | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function getPostFilters()
{
$endpoint = $this->getEndpoint(PostFilterEndpoint::NAME);
return $endpoint->getBool();
} | Returns queries inside BoolFilter instance.
@return BoolQuery | getPostFilters | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function setPostFilterParameters(array $parameters)
{
$this->setEndpointParameters(PostFilterEndpoint::NAME, $parameters);
return $this;
} | Sets post filter endpoint parameters.
@param array $parameters
@return $this | setPostFilterParameters | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function addHighlight($highlight)
{
$this->getEndpoint(HighlightEndpoint::NAME)->add($highlight);
return $this;
} | Allows to highlight search results on one or more fields.
@param Highlight $highlight
@return $this. | addHighlight | php | ongr-io/ElasticsearchDSL | src/Search.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Search.php | MIT |
public function getParameter($name)
{
return $this->parameters[$name];
} | Returns one parameter by it's name.
@param string $name
@return array|string|int|float|bool|\stdClass | getParameter | php | ongr-io/ElasticsearchDSL | src/ParametersTrait.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/ParametersTrait.php | MIT |
public function getParameters()
{
return $this->parameters;
} | Returns an array of all parameters.
@return array | getParameters | php | ongr-io/ElasticsearchDSL | src/ParametersTrait.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/ParametersTrait.php | MIT |
protected function processArray(array $array = [])
{
return array_merge($array, $this->parameters);
} | Returns given array merged with parameters.
@param array $array
@return array | processArray | php | ongr-io/ElasticsearchDSL | src/ParametersTrait.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/ParametersTrait.php | MIT |
public function has($name)
{
return isset($this->bag[$name]);
} | Checks if builder exists by a specific name.
@param string $name Builder name.
@return bool | has | php | ongr-io/ElasticsearchDSL | src/BuilderBag.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/BuilderBag.php | MIT |
private function getPathType()
{
switch ($this->getType()) {
case 'nested':
$type = 'path';
break;
case 'parent':
$type = 'type';
break;
default:
$type = null;
}
return $type;
} | Returns 'path' for nested and 'type' for parent inner hits
@return null|string | getPathType | php | ongr-io/ElasticsearchDSL | src/InnerHit/NestedInnerHit.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/InnerHit/NestedInnerHit.php | MIT |
public static function get($type)
{
if (!array_key_exists($type, self::$endpoints)) {
throw new \RuntimeException('Endpoint does not exist.');
}
return new self::$endpoints[$type]();
} | Returns a search endpoint instance.
@param string $type Type of endpoint.
@return SearchEndpointInterface
@throws \RuntimeException Endpoint does not exist. | get | php | ongr-io/ElasticsearchDSL | src/SearchEndpoint/SearchEndpointFactory.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/SearchEndpoint/SearchEndpointFactory.php | MIT |
public function has($key)
{
return array_key_exists($key, $this->container);
} | Checks if builder with specific key exists.
@param string $key Key to check if it exists in container.
@return bool | has | php | ongr-io/ElasticsearchDSL | src/SearchEndpoint/AbstractSearchEndpoint.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/SearchEndpoint/AbstractSearchEndpoint.php | MIT |
public function getPath()
{
return $this->path;
} | Returns path this query is set for.
@return string | getPath | php | ongr-io/ElasticsearchDSL | src/Query/Joining/NestedQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Joining/NestedQuery.php | MIT |
public function addShape($field, $type, array $coordinates, $relation = self::INTERSECTS, array $parameters = [])
{
// TODO: remove this in the next major version
if (is_array($relation)) {
$parameters = $relation;
$relation = self::INTERSECTS;
trigger_error('$parameters as parameter 4 in addShape is deprecated', E_USER_DEPRECATED);
}
$filter = array_merge(
$parameters,
[
'type' => $type,
'coordinates' => $coordinates,
]
);
$this->fields[$field] = [
'shape' => $filter,
'relation' => $relation,
];
} | Add geo-shape provided filter.
@param string $field Field name.
@param string $type Shape type.
@param array $coordinates Shape coordinates.
@param string $relation Spatial relation.
@param array $parameters Additional parameters. | addShape | php | ongr-io/ElasticsearchDSL | src/Query/Geo/GeoShapeQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Geo/GeoShapeQuery.php | MIT |
public function addPreIndexedShape(
$field,
$id,
$type,
$index,
$path,
$relation = self::INTERSECTS,
array $parameters = []
) {
// TODO: remove this in the next major version
if (is_array($relation)) {
$parameters = $relation;
$relation = self::INTERSECTS;
trigger_error('$parameters as parameter 6 in addShape is deprecated', E_USER_DEPRECATED);
}
$filter = array_merge(
$parameters,
[
'id' => $id,
'type' => $type,
'index' => $index,
'path' => $path,
]
);
$this->fields[$field] = [
'indexed_shape' => $filter,
'relation' => $relation,
];
} | Add geo-shape pre-indexed filter.
@param string $field Field name.
@param string $id The ID of the document that containing the pre-indexed shape.
@param string $type Name of the index where the pre-indexed shape is.
@param string $index Index type where the pre-indexed shape is.
@param string $relation Spatial relation.
@param string $path The field specified as path containing the pre-indexed shape.
@param array $parameters Additional parameters. | addPreIndexedShape | php | ongr-io/ElasticsearchDSL | src/Query/Geo/GeoShapeQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Geo/GeoShapeQuery.php | MIT |
public function __construct(BuilderInterface $query, array $parameters = [])
{
$this->query = $query;
$this->setParameters($parameters);
} | Accepts one of fuzzy, prefix, term range, wildcard, regexp query.
@param BuilderInterface $query
@param array $parameters | __construct | php | ongr-io/ElasticsearchDSL | src/Query/Span/SpanMultiTermQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Span/SpanMultiTermQuery.php | MIT |
public function add(BuilderInterface $query, $type = self::MUST, $key = null)
{
if (!in_array($type, [self::MUST, self::MUST_NOT, self::SHOULD, self::FILTER])) {
throw new \UnexpectedValueException(sprintf('The bool operator %s is not supported', $type));
}
if (!$key) {
$key = bin2hex(random_bytes(30));
}
$this->container[$type][$key] = $query;
return $key;
} | Add BuilderInterface object to bool operator.
@param BuilderInterface $query Query add to the bool.
@param string $type Bool type. Example: must, must_not, should.
@param string $key Key that indicates a builder id.
@return string Key of added builder.
@throws \UnexpectedValueException | add | php | ongr-io/ElasticsearchDSL | src/Query/Compound/BoolQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/BoolQuery.php | MIT |
public function addFieldValueFactorFunction(
$field,
$factor,
$modifier = 'none',
BuilderInterface $query = null,
$missing = null
) {
$function = [
'field_value_factor' => array_filter([
'field' => $field,
'factor' => $factor,
'modifier' => $modifier,
'missing' => $missing
]),
];
$this->applyFilter($function, $query);
$this->functions[] = $function;
return $this;
} | Creates field_value_factor function.
@param string $field
@param float $factor
@param string $modifier
@param BuilderInterface $query
@param mixed $missing
@return $this | addFieldValueFactorFunction | php | ongr-io/ElasticsearchDSL | src/Query/Compound/FunctionScoreQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/FunctionScoreQuery.php | MIT |
private function applyFilter(array &$function, BuilderInterface $query = null)
{
if ($query) {
$function['filter'] = $query->toArray();
}
} | Modifier to apply filter to the function score function.
@param array $function
@param BuilderInterface $query | applyFilter | php | ongr-io/ElasticsearchDSL | src/Query/Compound/FunctionScoreQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/FunctionScoreQuery.php | MIT |
public function addDecayFunction(
$type,
$field,
array $function,
array $options = [],
BuilderInterface $query = null,
$weight = null
) {
$function = array_filter(
[
$type => array_merge(
[$field => $function],
$options
),
'weight' => $weight,
]
);
$this->applyFilter($function, $query);
$this->functions[] = $function;
return $this;
} | Add decay function to function score. Weight and query are optional.
@param string $type
@param string $field
@param array $function
@param array $options
@param BuilderInterface $query
@param int $weight
@return $this | addDecayFunction | php | ongr-io/ElasticsearchDSL | src/Query/Compound/FunctionScoreQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/FunctionScoreQuery.php | MIT |
public function addWeightFunction($weight, BuilderInterface $query = null)
{
$function = [
'weight' => $weight,
];
$this->applyFilter($function, $query);
$this->functions[] = $function;
return $this;
} | Adds function to function score without decay function. Influence search score only for specific query.
@param float $weight
@param BuilderInterface $query
@return $this | addWeightFunction | php | ongr-io/ElasticsearchDSL | src/Query/Compound/FunctionScoreQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/FunctionScoreQuery.php | MIT |
public function addSimpleFunction(array $function)
{
$this->functions[] = $function;
return $this;
} | Adds custom simple function. You can add to the array whatever you want.
@param array $function
@return $this | addSimpleFunction | php | ongr-io/ElasticsearchDSL | src/Query/Compound/FunctionScoreQuery.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Query/Compound/FunctionScoreQuery.php | MIT |
public function __construct($name)
{
$this->setName($name);
} | Inner aggregations container init.
@param string $name | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/AbstractAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/AbstractAggregation.php | MIT |
private function createBuilderBag()
{
return new BuilderBag();
} | Creates BuilderBag new instance.
@return BuilderBag | createBuilderBag | php | ongr-io/ElasticsearchDSL | src/Aggregation/AbstractAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/AbstractAggregation.php | MIT |
public function setKeyed($keyed)
{
$this->keyed = $keyed;
return $this;
} | Sets if result buckets should be keyed.
@param bool $keyed
@return DateRangeAggregation | setKeyed | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/DateRangeAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/DateRangeAggregation.php | MIT |
public function __construct($name, $path = null)
{
parent::__construct($name);
$this->setPath($path);
} | Inner aggregations container init.
@param string $name
@param string $path | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/NestedAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/NestedAggregation.php | MIT |
public function __construct($name, $field = null, $ranges = [])
{
parent::__construct($name);
$this->setField($field);
foreach ($ranges as $range) {
if (is_array($range)) {
$from = isset($range['from']) ? $range['from'] : null;
$to = isset($range['to']) ? $range['to'] : null;
$this->addRange($from, $to);
} else {
$this->addMask($range);
}
}
} | Inner aggregations container init.
@param string $name
@param string $field
@param array $ranges | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/Ipv4RangeAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/Ipv4RangeAggregation.php | MIT |
public function __construct($name, $field = null, $interval = null, $format = null)
{
parent::__construct($name);
$this->setField($field);
$this->setInterval($interval);
$this->setFormat($format);
} | Inner aggregations container init.
@param string $name
@param string $field
@param string $interval | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/DateHistogramAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/DateHistogramAggregation.php | MIT |
public function __construct($name, $field, $buckets = null, $format = null)
{
parent::__construct($name);
$this->setField($field);
if ($buckets) {
$this->addParameter('buckets', $buckets);
}
if ($format) {
$this->addParameter('format', $format);
}
} | Inner aggregations container init.
@param string $name
@param string $field
@param int $buckets
@param string $format | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/AutoDateHistogramAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/AutoDateHistogramAggregation.php | MIT |
public function __construct(
$name,
$field = null,
$interval = null,
$minDocCount = null,
$orderMode = null,
$orderDirection = self::DIRECTION_ASC,
$extendedBoundsMin = null,
$extendedBoundsMax = null,
$keyed = null
) {
parent::__construct($name);
$this->setField($field);
$this->setInterval($interval);
$this->setMinDocCount($minDocCount);
$this->setOrder($orderMode, $orderDirection);
$this->setExtendedBounds($extendedBoundsMin, $extendedBoundsMax);
$this->setKeyed($keyed);
} | Inner aggregations container init.
@param string $name
@param string $field
@param int $interval
@param int $minDocCount
@param string $orderMode
@param string $orderDirection
@param int $extendedBoundsMin
@param int $extendedBoundsMax
@param bool $keyed | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/HistogramAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/HistogramAggregation.php | MIT |
public function setMinDocCount($minDocCount)
{
$this->minDocCount = $minDocCount;
return $this;
} | Set limit for document count buckets should have.
@param int $minDocCount
@return $this | setMinDocCount | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/HistogramAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/HistogramAggregation.php | MIT |
protected function checkRequiredParameters($data, $required)
{
if (count(array_intersect_key(array_flip($required), $data)) !== count($required)) {
throw new \LogicException('Histogram aggregation must have field and interval set.');
}
} | Checks if all required parameters are set.
@param array $data
@param array $required
@throws \LogicException | checkRequiredParameters | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/HistogramAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/HistogramAggregation.php | MIT |
public function __construct($name, $field = null, $script = null)
{
parent::__construct($name);
$this->setField($field);
$this->setScript($script);
} | Inner aggregations container init.
@param string $name
@param string $field
@param string $script | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/TermsAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/TermsAggregation.php | MIT |
public function __construct($name, $field = null, $shardSize = null)
{
parent::__construct($name);
$this->setField($field);
$this->setShardSize($shardSize);
} | DiversifiedSamplerAggregation constructor.
@param string $name Aggregation name
@param string $field Elasticsearch field name
@param int $shardSize Shard size, by default it's 100 | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/DiversifiedSamplerAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/DiversifiedSamplerAggregation.php | MIT |
public function __construct($name, BuilderInterface $filter = null)
{
parent::__construct($name);
if ($filter !== null) {
$this->setFilter($filter);
}
} | Inner aggregations container init.
@param string $name
@param BuilderInterface $filter | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/FilterAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/FilterAggregation.php | MIT |
public function __construct($name, $field = null, $precision = null, $size = null, $shardSize = null)
{
parent::__construct($name);
$this->setField($field);
$this->setPrecision($precision);
$this->setSize($size);
$this->setShardSize($shardSize);
} | Inner aggregations container init.
@param string $name
@param string $field
@param int $precision
@param int $size
@param int $shardSize | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/GeoHashGridAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/GeoHashGridAggregation.php | MIT |
public function __construct($name, $filters = [], $anonymous = false)
{
parent::__construct($name);
$this->setAnonymous($anonymous);
foreach ($filters as $name => $filter) {
if ($anonymous) {
$this->addFilter($filter);
} else {
$this->addFilter($filter, $name);
}
}
} | Inner aggregations container init.
@param string $name
@param BuilderInterface[] $filters
@param bool $anonymous | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/FiltersAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/FiltersAggregation.php | MIT |
public function __construct($name, $field = null)
{
parent::__construct($name);
$this->setField($field);
} | Inner aggregations container init.
@param string $name
@param string $field | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Bucketing/MissingAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Bucketing/MissingAggregation.php | MIT |
public function __construct($name, $field = null, $sigma = null, $script = null)
{
parent::__construct($name);
$this->setField($field);
$this->setSigma($sigma);
$this->setScript($script);
} | Inner aggregations container init.
@param string $name
@param string $field
@param int $sigma
@param string $script | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/ExtendedStatsAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/ExtendedStatsAggregation.php | MIT |
public function __construct($name, $field = null, $percents = null, $script = null, $compression = null)
{
parent::__construct($name);
$this->setField($field);
$this->setPercents($percents);
$this->setScript($script);
$this->setCompression($compression);
} | Inner aggregations container init.
@param string $name
@param string $field
@param array $percents
@param string $script
@param int $compression | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/PercentilesAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/PercentilesAggregation.php | MIT |
public function __construct(
$name,
$initScript = null,
$mapScript = null,
$combineScript = null,
$reduceScript = null
) {
parent::__construct($name);
$this->setInitScript($initScript);
$this->setMapScript($mapScript);
$this->setCombineScript($combineScript);
$this->setReduceScript($reduceScript);
} | ScriptedMetricAggregation constructor.
@param string $name
@param mixed $initScript
@param mixed $mapScript
@param mixed $combineScript
@param mixed $reduceScript | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/ScriptedMetricAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/ScriptedMetricAggregation.php | MIT |
private function checkRequiredFields($fields)
{
if (!array_key_exists('field', $fields) && !array_key_exists('script', $fields)) {
throw new \LogicException('Cardinality aggregation must have field or script set.');
}
} | Checks if required fields are set.
@param array $fields
@throws \LogicException | checkRequiredFields | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/CardinalityAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/CardinalityAggregation.php | MIT |
public function __construct($name, $field = null, $values = null, $script = null, $compression = null)
{
parent::__construct($name);
$this->setField($field);
$this->setValues($values);
$this->setScript($script);
$this->setCompression($compression);
} | Inner aggregations container init.
@param string $name
@param string $field
@param array $values
@param string $script
@param int $compression | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/PercentileRanksAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/PercentileRanksAggregation.php | MIT |
public function __construct($name, $field = null, $wrapLongitude = true)
{
parent::__construct($name);
$this->setField($field);
$this->setWrapLongitude($wrapLongitude);
} | Inner aggregations container init.
@param string $name
@param string $field
@param bool $wrapLongitude | __construct | php | ongr-io/ElasticsearchDSL | src/Aggregation/Metric/GeoBoundsAggregation.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Metric/GeoBoundsAggregation.php | MIT |
protected function supportsNesting()
{
return false;
} | Metric aggregations does not support nesting.
@return bool | supportsNesting | php | ongr-io/ElasticsearchDSL | src/Aggregation/Type/MetricTrait.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Type/MetricTrait.php | MIT |
protected function supportsNesting()
{
return true;
} | Bucketing aggregations supports nesting.
@return bool | supportsNesting | php | ongr-io/ElasticsearchDSL | src/Aggregation/Type/BucketingTrait.php | https://github.com/ongr-io/ElasticsearchDSL/blob/master/src/Aggregation/Type/BucketingTrait.php | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.