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 Redirect($ActionURL, $Params = null, $Method = "get", $Title = 'Redirect')
{
$RedirectCodeValue = RedirectCode($ActionURL, $Params, $Method, $Title);
if ($RedirectCodeValue !== false) {
echo $RedirectCodeValue;
}
} | Redirects browser to another URL, passing parameters through POST or GET
Actually just prints code, returned by RedirectCode (see RedirectCode) | Redirect | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function defineTimeInterval($iTime, $bAutoDateConvert = true, $bShort = false)
{
$iTimeDiff = time() - (int)$iTime;
if ($bAutoDateConvert && $iTimeDiff > 14 * 24 * 60 * 60) // don't show "ago" dates for more than 14 days
{
return getLocaleDate((int)$iTime);
}
return _format_when($iTimeDiff, $bShort);
} | Convert timestamp to "ago" date format
@param $iTime date/time stamp in seconds
@param $bAutoDateConvert automatically convert dates to full date format instead of "ago" format for old dates (older than 14 days)
@param $bShort use short format for relative time
@return formatted date string | defineTimeInterval | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_js_string($mixedInput, $iQuoteType = BX_ESCAPE_STR_AUTO)
{
$aUnits = array(
"\n" => "\\n",
"\r" => "",
);
if (BX_ESCAPE_STR_APOS == $iQuoteType) {
$aUnits["'"] = "\\'";
$aUnits['<script'] = "<scr' + 'ipt";
$aUnits['</script>'] = "</scr' + 'ipt>";
} elseif (BX_ESCAPE_STR_QUOTE == $iQuoteType) {
$aUnits['"'] = '\\"';
$aUnits['<script'] = '<scr" + "ipt';
$aUnits['</script>'] = '</scr" + "ipt>';
} else {
$aUnits['"'] = '"e;';
$aUnits["'"] = ''';
$aUnits["<"] = '<';
$aUnits[">"] = '>';
}
return str_replace(array_keys($aUnits), array_values($aUnits), $mixedInput);
} | Escapes string/array ready to pass to js script with filtered symbols like ', " etc
@param $mixedInput - string/array which should be filtered
@param $iQuoteType - string escaping method: BX_ESCAPE_STR_AUTO(default), BX_ESCAPE_STR_APOS or BX_ESCAPE_STR_QUOTE
@return converted string / array | bx_js_string | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_html_attribute($mixedInput)
{
$aUnits = array(
"\"" => """,
"'" => "'",
);
return str_replace(array_keys($aUnits), array_values($aUnits), $mixedInput);
} | Return input string/array ready to pass to html attribute with filtered symbols like ', " etc
@param mixed $mixedInput - string/array which should be filtered
@return converted string / array | bx_html_attribute | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_php_string_apos($mixedInput)
{
return str_replace("'", "\\'", $mixedInput);
} | Escapes string/array ready to pass to php script with filtered symbols like ', " etc
@param mixed $mixedInput - string/array which should be filtered
@return converted string / array | bx_php_string_apos | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function writeLog($sNewLineText = 'test')
{
$sFileName = BX_DIRECTORY_PATH_ROOT . 'tmp/log.txt';
if (is_writable($sFileName)) {
if (!$vHandle = fopen($sFileName, 'a')) {
echo "Unable to open ({$sFileName})";
}
if (fwrite($vHandle, $sNewLineText . "\r\n") === false) {
echo "Unable write to ({$sFileName})";
}
fclose($vHandle);
} else {
echo "{$sFileName} is not writeable";
}
} | perform write log into 'tmp/log.txt' (for any debug development)
@param $sNewLineText - New line debug text | writeLog | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_show_service_unavailable_error_and_exit($sMsg = false, $iRetryAfter = 86400)
{
header('HTTP/1.0 503 Service Unavailable', true, 503);
header('Retry-After: 600');
echo $sMsg ? $sMsg : 'Service temporarily unavailable';
exit;
} | Show HTTP 503 service unavailable error and exit | bx_show_service_unavailable_error_and_exit | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_proto($sUrl = BX_DOL_URL_ROOT)
{
return 0 === strncmp('https', $sUrl, 5) ? 'https' : 'http';
} | Returns current site protocol http:// or https:// | bx_proto | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_linkify($text, $sAttrs = '', $bHtmlSpecialChars = false)
{
if ($bHtmlSpecialChars) {
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
}
preg_match_all(BX_URL_RE, $text, $matches, PREG_OFFSET_CAPTURE);
$matches = $matches[0];
if ($i = count($matches)) {
$bAddNofollow = getParam('sys_antispam_add_nofollow') == 'on';
}
while ($i--) {
$url = $matches[$i][0];
if (!preg_match('@^https?://@', $url)) {
$url = 'http://' . $url;
}
if (strncmp(BX_DOL_URL_ROOT, $url, strlen(BX_DOL_URL_ROOT)) !== 0) {
if (false === stripos($sAttrs, 'target="_blank"'))
$sAttrs .= ' target="_blank" ';
if ($bAddNofollow && false === stripos($sAttrs, 'rel="nofollow"'))
$sAttrs .= ' rel="nofollow" ';
}
$text = substr_replace($text, '<a ' . $sAttrs . ' href="' . $url . '">' . $matches[$i][0] . '</a>',
$matches[$i][1], strlen($matches[$i][0]));
}
return $text;
} | Wrap in A tag links in TEXT string
@param $sHtmlOrig - text string without tags
@param $sAttrs - attributes string to add to the added A tag
@return string where all links are wrapped in A tag | bx_linkify | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function bx_gen_method_name($s, $sWordsDelimiter = '_')
{
return str_replace(' ', '', ucwords(str_replace($sWordsDelimiter, ' ', $s)));
} | Transform string to method name string, for example it changes 'some_method' string to 'SomeMethod' string
@param string where words are separated with underscore
@return string where every word begins with capital letter | bx_gen_method_name | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function getPostFieldIfSet($sField)
{
return (!isset($_POST[$sField])) ? null : $_POST[$sField];
} | Returns a field from $_POST array if it exists
To avoid having to do "if(isset($_POST['field']) && $_POST['field'])" multiple times
@param $sField
@return string | getPostFieldIfSet | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function getGetFieldIfSet($sField)
{
return (!isset($_GET[$sField])) ? null : $_GET[$sField];
} | Returns a field from $_GET array if it exists
To avoid having to do "if(isset($_GET['field']) && $_GET['field'])" multiple times
@param $sField
@return string | getGetFieldIfSet | php | boonex/dolphin.pro | inc/utils.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/utils.inc.php | MIT |
function getMemberMembershipInfo_current($iMemberId, $time = '')
{
$iMemberId = (int)$iMemberId;
$time = ($time == '') ? time() : (int)$time;
/**
* Fetch the last purchased/assigned membership that is still active for the given member.
* NOTE. Don't use cache here, because it's causing an error, if a number of memberrship levels are purchased at the same time.
* fromMemory returns the same DateExpires because buyMembership function is called in cycle in the same session.
*/
$aMemLevel = $GLOBALS['MySQL']->getRow("
SELECT `sys_acl_levels_members`.IDLevel as ID,
`sys_acl_levels`.Name as Name,
UNIX_TIMESTAMP(`sys_acl_levels_members`.DateStarts) as DateStarts,
UNIX_TIMESTAMP(`sys_acl_levels_members`.DateExpires) as DateExpires,
`sys_acl_levels_members`.`TransactionID` AS `TransactionID`
FROM `sys_acl_levels_members`
RIGHT JOIN Profiles
ON `sys_acl_levels_members`.IDMember = Profiles.ID
AND (`sys_acl_levels_members`.DateStarts IS NULL
OR `sys_acl_levels_members`.DateStarts <= FROM_UNIXTIME(?))
AND (`sys_acl_levels_members`.DateExpires IS NULL
OR `sys_acl_levels_members`.DateExpires > FROM_UNIXTIME(?))
LEFT JOIN `sys_acl_levels`
ON `sys_acl_levels_members`.IDLevel = `sys_acl_levels`.ID
WHERE Profiles.ID = ?
ORDER BY `sys_acl_levels_members`.DateStarts DESC
LIMIT 0, 1", [$time, $time, $iMemberId]);
/**
* no such member found
*/
if (!$aMemLevel || !count($aMemLevel)) {
//fetch info about Non-member membership
$aMemLevel = $GLOBALS['MySQL']->fromCache('sys_acl_levels' . MEMBERSHIP_ID_NON_MEMBER, 'getRow', "SELECT ID, Name FROM `sys_acl_levels` WHERE ID = ?", [MEMBERSHIP_ID_NON_MEMBER]);
if(!$aMemLevel || !count($aMemLevel)) {
//this should never happen, but just in case
echo "<br /><b>getMemberMembershipInfo()</b> fatal error: <b>Non-Member</b> membership not found.";
exit();
}
return $aMemLevel;
}
/**
* no purchased/assigned memberships for the member or all of them have expired -- the member is assumed to have Standard membership
*/
if(is_null($aMemLevel['ID'])) {
$aMemLevel = $GLOBALS['MySQL']->fromCache('sys_acl_levels' . MEMBERSHIP_ID_STANDARD, 'getRow', "SELECT ID, Name FROM `sys_acl_levels` WHERE ID = ?", [MEMBERSHIP_ID_STANDARD]);
if (!$aMemLevel || !count($aMemLevel)) {
//again, this should never happen, but just in case
echo "<br /><b>getMemberMembershipInfo()</b> fatal error: <b>Standard</b> membership not found.";
exit();
}
}
return $aMemLevel;
} | This is an internal function - do NOT use it outside of membership_levels.inc.php! | getMemberMembershipInfo_current | php | boonex/dolphin.pro | inc/membership_levels.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/membership_levels.inc.php | MIT |
function checkAction($iMemberId, $actionID, $performAction = false, $iForcedProfID = 0, $isCheckMemberStatus = true)
{
global $logged;
global $site;
//output array initialization
$result = array();
$arrLangFileParams = array();
$dateFormat = "F j, Y, g:i a"; //used when displaying error messages
//input validation
$iMemberId = (int)$iMemberId;
$actionID = (int)$actionID;
$performAction = $performAction ? true : false;
//get current member's membership information
$arrMembership = getMemberMembershipInfo($iMemberId, '', $isCheckMemberStatus);
$arrLangFileParams[CHECK_ACTION_LANG_FILE_MEMBERSHIP] = $arrMembership['Name'];
$arrLangFileParams[CHECK_ACTION_LANG_FILE_SITE_EMAIL] = $site['email'];
//profile active check
if($arrMembership['ID'] != MEMBERSHIP_ID_NON_MEMBER || $logged['admin'] || $logged['moderator']) {
$iDestID = $iMemberId;
if ( (isAdmin() || isModerator()) && $iForcedProfID>0) {
$iDestID = $iForcedProfID;
$performAction = false;
}
}
//get permissions for the current action
$resMembershipAction = db_res("
SELECT Name,
IDAction,
AllowedCount,
AllowedPeriodLen,
UNIX_TIMESTAMP(AllowedPeriodStart) as AllowedPeriodStart,
UNIX_TIMESTAMP(AllowedPeriodEnd) as AllowedPeriodEnd,
AdditionalParamValue
FROM `sys_acl_actions`
LEFT JOIN `sys_acl_matrix`
ON `sys_acl_matrix`.IDAction = `sys_acl_actions`.ID
AND `sys_acl_matrix`.IDLevel = {$arrMembership['ID']}
WHERE `sys_acl_actions`.ID = $actionID");
//no such action
if($resMembershipAction->rowCount() < 1) {
echo "<br /><b>checkAction()</b> fatal error. Unknown action ID: $actionID<br />";
exit();
}
$arrAction = $resMembershipAction->fetch();
$result[CHECK_ACTION_PARAMETER] = $arrAction['AdditionalParamValue'];
$arrLangFileParams[CHECK_ACTION_LANG_FILE_ACTION] = _t('_mma_' . str_replace(' ', '_', $arrAction['Name']));
//action is not allowed for the current membership
if(is_null($arrAction['IDAction'])) {
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_NOT_ALLOWED;
$result[CHECK_ACTION_MESSAGE] = _t_ext(CHECK_ACTION_MESSAGE_NOT_ALLOWED, $arrLangFileParams);
return $result;
}
//Check fixed period limitations if present (also for non-members)
if($arrAction['AllowedPeriodStart'] && time() < $arrAction['AllowedPeriodStart']) {
$arrLangFileParams[CHECK_ACTION_LANG_FILE_BEFORE] = date($dateFormat, $arrAction['AllowedPeriodStart']);
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_NOT_ALLOWED_BEFORE;
$result[CHECK_ACTION_MESSAGE] = _t_ext(CHECK_ACTION_MESSAGE_NOT_ALLOWED_BEFORE, $arrLangFileParams);
return $result;
}
if($arrAction['AllowedPeriodEnd'] && time() > $arrAction['AllowedPeriodEnd']) {
$arrLangFileParams[CHECK_ACTION_LANG_FILE_AFTER] = date($dateFormat, $arrAction['AllowedPeriodEnd']);
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_NOT_ALLOWED_AFTER;
$result[CHECK_ACTION_MESSAGE] = _t_ext(CHECK_ACTION_MESSAGE_NOT_ALLOWED_AFTER, $arrLangFileParams);
return $result;
}
//if non-member, allow action without performing further checks
if ($arrMembership['ID'] == MEMBERSHIP_ID_NON_MEMBER) {
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_ALLOWED;
return $result;
}
//check other limitations (for members only)
$allowedCnt = (int)$arrAction['AllowedCount']; //number of allowed actions
//if not specified or 0, number of
//actions is unlimited
$periodLen = (int)$arrAction['AllowedPeriodLen']; //period for AllowedCount in hours
//if not specified, AllowedCount is
//treated as total number of actions
//permitted
//number of actions is limited
if($allowedCnt > 0) {
//get current action info for the member
$actionTrack = db_res("SELECT ActionsLeft,
UNIX_TIMESTAMP(ValidSince) as ValidSince
FROM `sys_acl_actions_track`
WHERE IDAction = $actionID AND IDMember = $iMemberId");
$actionsLeft = $performAction ? $allowedCnt - 1 : $allowedCnt;
$validSince = time();
$actionTrack = $actionTrack->fetch();
//member is requesting/performing this action for the first time,
//and there is no corresponding record in sys_acl_actions_track table
if (!$actionTrack) {
//add action to sys_acl_actions_track table
db_res("
INSERT INTO `sys_acl_actions_track` (IDAction, IDMember, ActionsLeft, ValidSince)
VALUES ($actionID, $iMemberId, $actionsLeft, FROM_UNIXTIME($validSince))");
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_ALLOWED;
return $result;
}
//action record in sys_acl_actions_track table is out of date
$periodEnd = (int)$actionTrack['ValidSince'] + $periodLen * 3600; //ValidSince is in seconds, PeriodLen is in hours
if($periodLen > 0 && $periodEnd < time()) {
db_res("
UPDATE `sys_acl_actions_track`
SET ActionsLeft = $actionsLeft, ValidSince = FROM_UNIXTIME($validSince)
WHERE IDAction = $actionID AND IDMember = $iMemberId");
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_ALLOWED;
return $result;
}
//action record is up to date
$actionsLeft = (int)$actionTrack['ActionsLeft'];
//action limit reached for now
if($actionsLeft <= 0 ) {
$arrLangFileParams[CHECK_ACTION_LANG_FILE_LIMIT] = $allowedCnt;
$arrLangFileParams[CHECK_ACTION_LANG_FILE_PERIOD] = $periodLen;
$result[CHECK_ACTION_RESULT] = CHECK_ACTION_RESULT_LIMIT_REACHED;
$result[CHECK_ACTION_MESSAGE] = '<div style="width: 80%">' .
_t_ext(CHECK_ACTION_MESSAGE_LIMIT_REACHED, $arrLangFileParams) .
($periodLen > 0 ? _t_ext(CHECK_ACTION_MESSAGE_MESSAGE_EVERY_PERIOD, $arrLangFileParams) : '') .
'.</div>';
return $result;
}
if($performAction) {
$actionsLeft--;
db_res("
UPDATE `sys_acl_actions_track`
SET ActionsLeft = $actionsLeft
WHERE IDAction = $actionID AND IDMember = $iMemberId");
}
} | Checks if a given action is allowed for a given member and updates action information if the
action is performed.
@param int $iMemberId - ID of a member that is going to perform an action
@param int $actionID - ID of the action itself
@param boolean $performAction - if true, then action information is updated, i.e. action
is 'performed'
@return array( CHECK_ACTION_RESULT => CHECK_ACTION_RESULT_ constant,
CHECK_ACTION_MESSAGE => CHECK_ACTION_MESSAGE_ constant,
CHECK_ACTION_PARAMETER => additional action parameter (string) )
NOTES:
$result[CHECK_ACTION_MESSAGE] contains a message with detailed information about the result,
already processed by the language file
if $result[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED then this node contains
an empty string
The error messages themselves are stored in the language file. Additional variables are
passed to the languages.inc.php function _t_ext() as an array and can be used there in the form of
{0}, {1}, {2} ...
Additional variables passed to the lang. file on errors (can be used in error messages):
For all errors:
$arg0[CHECK_ACTION_LANG_FILE_ACTION] = name of the action
$arg0[CHECK_ACTION_LANG_FILE_MEMBERSHIP]= name of the current membership
CHECK_ACTION_RESULT_LIMIT_REACHED:
$arg0[CHECK_ACTION_LANG_FILE_LIMIT] = limit on number of actions allowed for the member
$arg0[CHECK_ACTION_LANG_FILE_PERIOD] = period that the limit is set for (in hours, 0 if unlimited)
CHECK_ACTION_RESULT_NOT_ALLOWED_BEFORE:
$arg0[CHECK_ACTION_LANG_FILE_BEFORE] = date/time since when the action is allowed
CHECK_ACTION_RESULT_NOT_ALLOWED_AFTER:
$arg0[CHECK_ACTION_LANG_FILE_AFTER] = date/time since when the action is not allowed
$result[CHECK_ACTION_PARAMETER] contains an additional parameter that can be considered
when performing the action (like the number of profiles to show in search result) | checkAction | php | boonex/dolphin.pro | inc/membership_levels.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/membership_levels.inc.php | MIT |
function getMembershipPrices($iMembershipId)
{
$iMembershipId = (int)$iMembershipId;
$result = array();
$resMemLevelPrices = db_res("SELECT Days, Price FROM `sys_acl_level_prices` WHERE IDLevel = $iMembershipId ORDER BY Days ASC");
while(list($days, $price) = $resMemLevelPrices->fetch()) {
$result[(int)$days] = (float)$price;
}
return $result;
} | Get pricing options for the given membership
@param int $iMembershipId - membership to get prices for
@return array( days1 => price1, days2 => price2, ...) - if no prices set, then just array() | getMembershipPrices | php | boonex/dolphin.pro | inc/membership_levels.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/membership_levels.inc.php | MIT |
function getMembershipInfo($iMembershipId)
{
$iMembershipId = (int)$iMembershipId;
$result = array();
$resMemLevels = db_res("SELECT Name, Active, Purchasable, Removable FROM `sys_acl_levels` WHERE ID = ?", [$iMembershipId]);
if($resMemLevels->rowCount() > 0) {
$result = $resMemLevels->fetch();
}
return $result;
} | Get info about a given membership
@param int $iMembershipId - membership to get info about
@return array( 'Name' => name,
'Active' => active,
'Purchasable' => purchasable,
'Removable' => removable) | getMembershipInfo | php | boonex/dolphin.pro | inc/membership_levels.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/membership_levels.inc.php | MIT |
function defineMembershipActions ($aActionsAll, $sPrefix = 'BX_')
{
$aActions = array ();
foreach ($aActionsAll as $sName)
if (!defined($sPrefix . strtoupper(str_replace(' ', '_', $sName))))
$aActions[] = $sName;
if (!$aActions)
return;
$sPlaceholders = implode(',', array_fill(0, count($aActions), '?'));
$res = db_res("SELECT `ID`, `Name` FROM `sys_acl_actions` WHERE `Name` IN({$sPlaceholders})", $aActions);
while ($r = $res->fetch()) {
define ($sPrefix . strtoupper(str_replace(' ', '_', $r['Name'])), $r['ID']);
}
} | Define action, during defining all names are translated the following way:
my action => BX_MY_ACTION
@param $aActions array of actions from sys_acl_actions table, with default array keys (starting from 0) and text values | defineMembershipActions | php | boonex/dolphin.pro | inc/membership_levels.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/membership_levels.inc.php | MIT |
function spacer( $width, $height )
{
return '<img src="' . BX_DOL_URL_ROOT . 'templates/base/images/spacer.gif" width="' . $width . '" height="' . $height . '" alt="" />';
} | Put spacer code
$width - width if spacer in pixels
$height - height of spacer in pixels | spacer | php | boonex/dolphin.pro | inc/design.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/design.inc.php | MIT |
function DesignProgressPos( $text, $width, $max_pos, $curr_pos, $progress_num = '1' )
{
$percent = ( $max_pos ) ? $curr_pos * 100 / $max_pos : $percent = 0;
return DesignProgress( $text, $width, $percent, $progress_num );
} | Put design progress bar code
$text - progress bar text
$width - width of progress bar in pixels
$max_pos - maximal position of progress bar
$curr_pos - current position of progress bar | DesignProgressPos | php | boonex/dolphin.pro | inc/design.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/design.inc.php | MIT |
function send_headers_page_changed()
{
$now = gmdate('D, d M Y H:i:s') . ' GMT';
header("Expires: $now");
header("Last-Modified: $now");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
} | Use this function in pages if you want to not cache it. | send_headers_page_changed | php | boonex/dolphin.pro | inc/design.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/design.inc.php | MIT |
function imageResize( $srcFilename, $dstFilename, $sizeX, $sizeY, $forceJPGOutput = false, $isSquare = false )
{
$o = BxDolImageResize::instance();
$o->removeCropOptions ();
$o->setJpegOutput ($forceJPGOutput);
$o->setSize ($sizeX, $sizeY);
if ($isSquare || (($sizeX == 32) && (32 == $sizeY)) || (($sizeX == 64) && (64 == $sizeY)))
$o->setSquareResize (true);
else
$o->setSquareResize (false);
return $o->resize($srcFilename, $dstFilename);
} | Resizes image given in $srcFilename to dimensions specified with $sizeX x $sizeY and
saves it to $dstFilename
@param string $srcFilename - source image filename
@param string $dstFilename - destination image filename
@param int $sizeX - width of destination image
@param int $sizeY - height of destination image
@param bool $forceJPGOutput - always make result in JPG format
@return int - zero on success, non-zero on fail | imageResize | php | boonex/dolphin.pro | inc/images.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/images.inc.php | MIT |
function applyWatermark( $srcFilename, $dstFilename, $wtrFilename, $wtrTransparency )
{
$o = BxDolImageResize::instance();
return $o->applyWatermark ($srcFilename, $dstFilename, $wtrFilename, $wtrTransparency);
} | Applies watermark to image given in $srcFilename with specified opacity and saves result
to $dstFilename
@param string $srcFilename - source image filename
@param string $dstFilename - destination image filename
@param string $wtrFilename - watermark filename
@param int $wtrTransparency - watermark transparency (from 0 to 100)
@return int - zero on success, non-zero on fail
NOTE: Source image should be in GIF, JPEG or PNG format
NOTE: if $wtrTransparency = 0 then no action will be done with source image
but if $wtrTransparency = 100 then watermark will fully override source image | applyWatermark | php | boonex/dolphin.pro | inc/images.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/images.inc.php | MIT |
function bx_admin_profile_ban_control($iProfileId, $bBan = true, $iDuration = 0)
{
$iProfileId = (int)$iProfileId;
$iDuration = 86400 * (!empty($iDuration) ? $iDuration : (int)getParam('ban_duration'));
if($bBan)
$sqlQuery = "REPLACE INTO `sys_admin_ban_list` SET `ProfID`='" . $iProfileId . "', `Time`='" . $iDuration . "', `DateTime`=NOW()";
else
$sqlQuery = "DELETE FROM `sys_admin_ban_list` WHERE `ProfID`='" . $iProfileId . "'";
return $GLOBALS['MySQL']->query($sqlQuery);
} | Add / delete profile to / from ban list table
@param int $iProfileId - id of member
@param boolean $bBan - add / delete member
@param integer $iDuration - ban duration (in days)
@return int / boolean - number of rows affected / false | bx_admin_profile_ban_control | php | boonex/dolphin.pro | inc/admin.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/admin.inc.php | MIT |
function bx_admin_profile_featured_control($iProfileId, $bFeature = TRUE)
{
$iProfileId = (int)$iProfileId;
$iFeatured = $bFeature ? 1 : 0;
if ($GLOBALS['MySQL']->query("UPDATE `Profiles` SET `Featured` = $iFeatured WHERE `ID` = $iProfileId"))
{
createUserDataFile($iProfileId);
return TRUE;
}
return FALSE;
} | Perform change of featured status with clearing profile(s) cache
@param int $iProfileId - profile id
@param boolean $bFeature - mark as featured / unfeatured
@return boolean - TRUE on success / FALSE on failure | bx_admin_profile_featured_control | php | boonex/dolphin.pro | inc/admin.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/admin.inc.php | MIT |
function isLogged()
{
return getLoggedId() != 0;
} | The following functions are needed to check whether user is logged in or not, active or not and get his ID. | isLogged | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function isMember($iId = 0)
{
return isRole(BX_DOL_ROLE_MEMBER, $iId);
} | The following functions are needed to check the ROLE of user. | isMember | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function GetMembershipStatus($memberID, $bOfferUpgrade = true, $bViewActions = true)
{
$ret = '';
$aMembership = getMemberMembershipInfo($memberID);
$sViewActions = $bViewActions ? "<a onclick=\"javascript:loadHtmlInPopup('explanation_popup', '" . BX_DOL_URL_ROOT . "explanation.php?explain=membership&type=" . $aMembership['ID'] . "');\" href=\"javascript:void(0);\">" . _t("_VIEW_MEMBERSHIP_ACTIONS") . "</a>" : "";
// Show colored membership name
if($aMembership['ID'] == MEMBERSHIP_ID_STANDARD) {
$ret .= $aMembership['Name'];
if($bOfferUpgrade && BxDolRequest::serviceExists('membership', 'get_upgrade_url'))
$sViewActions = _t('_MEMBERSHIP_UPGRADE_FROM_STANDARD', BxDolService::call('membership', 'get_upgrade_url')) . '<span class="sys-bullet"></span>' . $sViewActions;
$ret .= '<br />' . $sViewActions;
} else {
$ret .= '<font color="red">' . $aMembership['Name'] . '</font>';
$sExpiration = '';
if(!is_null($aMembership['DateExpires']))
$sExpiration = _t("_MEMBERSHIP_EXPIRES", defineTimeInterval($aMembership['DateExpires']));
else
$sExpiration = _t("_MEMBERSHIP_EXPIRES_NEVER");
$ret .= '<br />' . $sViewActions . '<span class="sys-bullet"></span>' . $sExpiration;
}
return $ret;
} | Print code for membership status
$memberID - member ID
$offer_upgrade - will this code be printed at [c]ontrol [p]anel | GetMembershipStatus | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function isProfileActive($iId = 0)
{
$aProfile = getProfileInfo($iId);
if($aProfile === false || empty($aProfile))
return false;
return $aProfile['Status'] == 'Active';
} | Check whether the requested profile is active or not. | isProfileActive | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function getFriendRequests($iID)
{
$iID = (int)$iID;
$sqlQuery = "SELECT count(*) FROM `sys_friend_list` WHERE `Profile` = {$iID} AND `Check` = '0'";
$iCount = (int)db_value($sqlQuery);
if ($iCount > 0) {
$sqlQuery = "SELECT count(*) FROM `sys_friend_list` as f LEFT JOIN `Profiles` as p ON p.`ID` = f.`ID` WHERE f.`Profile` = {$iID} AND f.`Check` = '0' AND p.`Status`='Active'";
$iCount = (int)db_value($sqlQuery);
}
return $iCount;
} | Get number of friend requests sent to the specified profile.
It doesn't count pending friend requests which was sent by specified profile.
@param $iID specified profile
@return number of friend requests | getFriendRequests | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function isFriendRequest($iId, $iProfileId)
{
$iId = (int)$iId;
$iProfileId = (int)$iProfileId;
return (int)db_value("SELECT count(*) FROM `sys_friend_list` WHERE `ID`='{$iId}' AND `Profile`='{$iProfileId}' AND `Check` = '0'") > 0;
} | Checks whether friend request is available.
@param int $iId - inviter ID
@param int $iProfileId - invited ID | isFriendRequest | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function bx_check_profile_visibility ($iViewedId, $iViewerId = 0, $bReturn = false)
{
global $logged, $site, $_page, $_page_cont, $p_arr;
// check if profile exists
if (!$iViewedId) {
if ($bReturn)
return false;
$GLOBALS['oSysTemplate']->displayPageNotFound ();
exit;
}
// check if viewer can view profile
$bPerform = $iViewedId == $iViewerId ? FALSE : TRUE;
$check_res = checkAction( $iViewerId, ACTION_ID_VIEW_PROFILES, $bPerform, $iViewedId );
if ($check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED
&& !$logged['admin'] && !$logged['moderator'] && $iViewerId != $iViewedId)
{
if ($bReturn)
return false;
$_page['header'] = "{$site['title']} "._t("_Member Profile");
$_page['header_text'] = "{$site['title']} "._t("_Member Profile");
$_page['name_index'] = 0;
$_page_cont[0]['page_main_code'] = MsgBox($check_res[CHECK_ACTION_MESSAGE]);
header("HTTP/1.0 403 Forbidden");
PageCode();
exit;
}
bx_import('BxTemplProfileGenerator');
$oProfile = new BxTemplProfileGenerator( $iViewedId );
$p_arr = $oProfile -> _aProfile;
// check if viewed member is active
if (!($p_arr['ID'] && ($logged['admin'] || $logged['moderator'] || $oProfile->owner || $p_arr['Status'] == 'Active'))) {
if ($bReturn)
return false;
header("HTTP/1.1 404 Not Found");
$GLOBALS['oSysTemplate']->displayMsg(_t("_Profile NA"));
exit;
}
// check privacy
if (!$logged['admin'] && !$logged['moderator'] && $iViewerId != $iViewedId) {
$oPrivacy = new BxDolPrivacy('Profiles', 'ID', 'ID');
if (!$oPrivacy->check('view', $iViewedId, $iViewerId)) {
if ($bReturn)
return false;
bx_import('BxDolProfilePrivatePageView');
$oProfilePrivateView = new BxDolProfilePrivatePageView($oProfile, $site, $dir);
$_page['name_index'] = 7;
$_page_cont[7]['page_main_code'] = $oProfilePrivateView->getCode();
header("HTTP/1.0 403 Forbidden");
PageCode();
exit;
}
}
if ($bReturn)
return true;
} | Check profile existing, membership/acl, profile status and privacy.
If some of visibility options are not allowed then appropritate page is shown and exit called.
@param $iViewedId viewed member id
@param $iViewerId viewer member id
@return nothing | bx_check_profile_visibility | php | boonex/dolphin.pro | inc/profiles.inc.php | https://github.com/boonex/dolphin.pro/blob/master/inc/profiles.inc.php | MIT |
function _checkUpdateMatchFields(&$aData)
{
// list of all matchable fields
$aAllMatchFields = array();
// temporary flag of member
$aData['UpdateMatch'] = false;
// get array of matching fields
$oMatchFields = new BxDolProfileFields(101);
$aMatchFields = $oMatchFields -> aArea[0]['Items'];
// get array of all fields
$oAllFields = new BxDolProfileFields(100);
$aAllFields = $oAllFields -> aArea[0]['Items'];
// find all matchable fields
foreach ($aMatchFields as $iFieldID => $aField) {
// put it to the list
$aAllMatchFields[$iFieldID] = $aField['Name'];
// get matched field too
$iNewFieldID = $aField['MatchField'];
$aNewField = $aAllFields[$iNewFieldID];
// and put it to the list too
$aAllMatchFields[$iNewFieldID] = $aNewField['Name'];
}
// also need to re-match if Status is changed
$aAllMatchFields[7] = 'Status';
//echoDbg($aAllMatchFields);
// check if one of updated fields is matchable
foreach ($aData as $sName => $sValue) {
//echo $sName . "\n";
if (in_array($sName, $aAllMatchFields)) {
$aData['UpdateMatch'] = true;
break; // if at least one of the fields is matchable then true
}
}
//echoDbg($aData);
} | Check if we need to update profile matching | _checkUpdateMatchFields | php | boonex/dolphin.pro | inc/classes/BxDolProfilesController.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolProfilesController.php | MIT |
static public function getObjectInstance($sObject)
{
if (isset($GLOBALS['bxDolClasses']['BxDolSiteMaps!'.$sObject]))
return $GLOBALS['bxDolClasses']['BxDolSiteMaps!'.$sObject];
$aSystems =& self::getSystems ();
if (!$aSystems || !isset($aSystems[$sObject]))
return false;
$aObject = $aSystems[$sObject];
if (!($sClass = $aObject['class_name']))
return false;
if (!empty($aObject['class_file']))
require_once(BX_DIRECTORY_PATH_ROOT . $aObject['class_file']);
else
bx_import($sClass);
$o = new $sClass($aObject);
return ($GLOBALS['bxDolClasses']['BxDolSiteMaps!'.$sObject] = $o);
} | Get sitemap object instance by object name
@param $sObject object name
@return object instance or false on error | getObjectInstance | php | boonex/dolphin.pro | inc/classes/BxDolSiteMaps.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolSiteMaps.php | MIT |
function delData($sKey)
{
$this->oMemcache->delete($sKey);
return true;
} | Delete cache from cache server
@param string $sKey - file name
@return result of the operation | delData | php | boonex/dolphin.pro | inc/classes/BxDolCacheMemcache.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheMemcache.php | MIT |
function isAvailable()
{
return $this->oMemcache == null ? false : true;
} | Check if memcache is available
@return boolean | isAvailable | php | boonex/dolphin.pro | inc/classes/BxDolCacheMemcache.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheMemcache.php | MIT |
function isInstalled()
{
return extension_loaded('memcache');
} | Check if memcache extension is loaded
@return boolean | isInstalled | php | boonex/dolphin.pro | inc/classes/BxDolCacheMemcache.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheMemcache.php | MIT |
function removeAllByPrefix ($s)
{
// not implemented for current cache
return false;
} | remove all data from cache by key prefix
@return true on success | removeAllByPrefix | php | boonex/dolphin.pro | inc/classes/BxDolCacheMemcache.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheMemcache.php | MIT |
function getSizeByPrefix ($s)
{
// not implemented for current cache
return false;
} | get size of cached data by name prefix | getSizeByPrefix | php | boonex/dolphin.pro | inc/classes/BxDolCacheMemcache.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheMemcache.php | MIT |
private function isDbZoneMatch ($iLevel, $sZone)
{
$sZone = process_db_input($sZone, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION);
return $this->oDb->getOne("SELECT `level` FROM `sys_dnsbluri_zones` WHERE `level` = $iLevel AND `zone` = '$sZone' LIMIT 1") ? true : false;
} | ************ private function ***************/ | isDbZoneMatch | php | boonex/dolphin.pro | inc/classes/BxDolDNSURIBlacklists.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolDNSURIBlacklists.php | MIT |
protected function _replaceMarkers ($s, $a)
{
if (empty($s) || empty($a) || !is_array($a))
return $s;
foreach ($a as $sKey => $sValue)
$s = str_replace('{' . $sKey . '}', $sValue, $s);
return $s;
} | Replace provided markers in string.
@param $s - string to replace markers in
@param $a - markers array
@return string with replaces markers | _replaceMarkers | php | boonex/dolphin.pro | inc/classes/BxDolSocialSharing.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolSocialSharing.php | MIT |
protected function _getLocaleFacebook ($sLocale)
{
$aLocales = $this->_getLocalesFacebook();
if (!isset($aLocales[$sLocale]))
return '';
return $sLocale;
} | Get most facebook locale for provided language code.
@param $sLang lang code
@return locale string or empty string if no lacale is found | _getLocaleFacebook | php | boonex/dolphin.pro | inc/classes/BxDolSocialSharing.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolSocialSharing.php | MIT |
function getBaseUri()
{
return $this->_sBaseUri;
} | Get base URI which depends on the Permalinks mechanism.
example /modules/?r=module_uri or /m/module_uri
@return string with base URI. | getBaseUri | php | boonex/dolphin.pro | inc/classes/BxDolConfig.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolConfig.php | MIT |
function alert()
{
bx_import('BxDolSubscription');
$oSubscription = BxDolSubscription::getInstance();
$oSubscription->send($this->sUnit, $this->sAction, $this->iObject, $this->aExtras);
if(isset($this->_aAlerts[$this->sUnit]) && isset($this->_aAlerts[$this->sUnit][$this->sAction]))
foreach($this->_aAlerts[$this->sUnit][$this->sAction] as $iHandlerId) {
$aHandler = $this->_aHandlers[$iHandlerId];
if(!empty($aHandler['file']) && !empty($aHandler['class']) && file_exists(BX_DIRECTORY_PATH_ROOT . $aHandler['file'])) {
if(!class_exists($aHandler['class']))
require_once(BX_DIRECTORY_PATH_ROOT . $aHandler['file']);
$oHandler = new $aHandler['class']();
$oHandler->response($this);
} else if(!empty($aHandler['eval'])) {
eval($aHandler['eval']);
}
}
} | Notifies the necessary handlers about the alert. | alert | php | boonex/dolphin.pro | inc/classes/BxDolAlerts.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolAlerts.php | MIT |
function getCommentsShort($sType)
{
return array(
'cmt_actions' => $this->getActions(0, $sType),
'cmt_object' => $this->getId(),
'cmt_addon' => $this->getCmtsInit()
);
} | get full comments block with initializations | getCommentsShort | php | boonex/dolphin.pro | inc/classes/BxDolTextCmts.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTextCmts.php | MIT |
function getData($sKey, $iTTL = false)
{
if(!file_exists($this->sPath . $sKey))
return null;
if ($iTTL > 0 && $this->_removeFileIfTtlExpired ($this->sPath . $sKey, $iTTL))
return null;
return file_get_contents($this->sPath . $sKey);
} | Get all data from the cache file.
@param string $sKey - file name
@param int $iTTL - time to live
@return the data is got from cache. | getData | php | boonex/dolphin.pro | inc/classes/BxDolCacheFileHtml.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCacheFileHtml.php | MIT |
static public function getObjectInstance($sObject = false)
{
if (!$sObject)
$sObject = getParam('sys_editor_default');
if (isset($GLOBALS['bxDolClasses']['BxDolEditor!'.$sObject]))
return $GLOBALS['bxDolClasses']['BxDolEditor!'.$sObject];
$aObject = BxDolEditorQuery::getEditorObject($sObject);
if (!$aObject || !is_array($aObject))
return false;
if (empty($aObject['override_class_name']))
return false;
$sClass = $aObject['override_class_name'];
if (!empty($aObject['override_class_file']))
require_once(BX_DIRECTORY_PATH_ROOT . $aObject['override_class_file']);
else
bx_import($sClass);
$o = new $sClass($aObject);
return ($GLOBALS['bxDolClasses']['BxDolEditor!'.$sObject] = $o);
} | Get editor object instance by object name
@param $sObject object name
@return object instance or false on error | getObjectInstance | php | boonex/dolphin.pro | inc/classes/BxDolEditor.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolEditor.php | MIT |
public function getWidth ($iViewMode)
{
// override this function in particular editor class
} | Get minimal width which is neede for editor for the provided view mode | getWidth | php | boonex/dolphin.pro | inc/classes/BxDolEditor.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolEditor.php | MIT |
public function attachEditor ($sSelector, $iViewMode, $bDynamicMode = false)
{
// override this function in particular editor class
} | Attach editor to HTML element, in most cases - textarea.
@param $sSelector - jQuery selector to attach editor to.
@param $iViewMode - editor view mode: BX_EDITOR_STANDARD, BX_EDITOR_MINI, BX_EDITOR_FULL
@param $bDynamicMode - is AJAX mode or not, the HTML with editor area is loaded synamically. | attachEditor | php | boonex/dolphin.pro | inc/classes/BxDolEditor.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolEditor.php | MIT |
protected function _addJsCss ($bDynamicMode = false)
{
// override this function in particular editor class
} | Add css/js files which are needed for editor display and functionality. | _addJsCss | php | boonex/dolphin.pro | inc/classes/BxDolEditor.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolEditor.php | MIT |
public static function getInstance($sClassName)
{
if(empty($sClassName))
return null;
if(isset($GLOBALS['bxDolClasses'][$sClassName]))
return $GLOBALS['bxDolClasses'][$sClassName];
else {
$aModule = db_arr("SELECT * FROM `sys_modules` WHERE INSTR('" . $sClassName . "', `class_prefix`)=1 LIMIT 1");
if(empty($aModule) || !is_array($aModule)) return null;
$sClassPath = BX_DIRECTORY_PATH_MODULES . $aModule['path'] . '/classes/' . $sClassName . '.php';
if(!file_exists($sClassPath)) return null;
require_once($sClassPath);
$GLOBALS['bxDolClasses'][$sClassName] = new $sClassName($aModule);
return $GLOBALS['bxDolClasses'][$sClassName];
}
} | Static method to get an instance of a module's class.
NOTE. The prefered usage is to get an instance of [ClassPrefix]Module class.
But if it's needed an instance of class which has constructor without parameters
or with one parameter(an array with module's info) it can be retrieved.
@param $sClassName module's class name. | getInstance | php | boonex/dolphin.pro | inc/classes/BxDolModule.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolModule.php | MIT |
function isLogged()
{
return isLogged();
} | Check whether user logged in or not.
@return boolean result of operation. | isLogged | php | boonex/dolphin.pro | inc/classes/BxDolModule.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolModule.php | MIT |
function getUserId()
{
return getLoggedId();
} | Get currently logged in user ID.
@return integer user ID. | getUserId | php | boonex/dolphin.pro | inc/classes/BxDolModule.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolModule.php | MIT |
function getUserPassword ()
{
return getLoggedPassword();
} | Get currently logged in user password.
@return string user password. | getUserPassword | php | boonex/dolphin.pro | inc/classes/BxDolModule.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolModule.php | MIT |
function getBaseUri ()
{
return BX_DOL_URL_ROOT . $this->oConfig->getBaseUri() . "calendar/";
} | return base calendar url
year and month will be added to this url automatically
so if your base url is /m/some_module/calendar/, it will be transormed to
/m/some_module/calendar/YEAR/MONTH, like /m/some_module/calendar/2009/3 | getBaseUri | php | boonex/dolphin.pro | inc/classes/BxDolTwigCalendar.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTwigCalendar.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 false;
if($aObject['group_id'] == BX_DOL_PG_HIDDEN)
return false;
if(isAdmin() || $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 | inc/classes/BxDolPrivacy.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolPrivacy.php | MIT |
function getFieldAction($sAction)
{
return 'allow_' . strtolower(str_replace(' ', '-', $sAction)) . '_to';
} | Get database field name for action.
@param string $sAction action name.
@return string with field name. | getFieldAction | php | boonex/dolphin.pro | inc/classes/BxDolPrivacy.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolPrivacy.php | MIT |
function isDynamicGroupMember($mixedGroupId, $iObjectOwnerId, $iViewerId, $iObjectId)
{
return false;
} | Check whethere viewer is a member of dynamic group.
@param mixed $mixedGroupId dynamic group ID.
@param integer $iObjectOwnerId object owner ID.
@param integer $iViewerId viewer ID.
@return boolean result of operation. | isDynamicGroupMember | php | boonex/dolphin.pro | inc/classes/BxDolPrivacy.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolPrivacy.php | MIT |
public static function isPrivacyPage()
{
return getParam('sys_ps_enable_create_group') == 'on' || getParam('sys_ps_enable_default_values') == 'on' || getParam('sys_ps_enabled_group_1') == 'on';
} | Static Method.
Check whether Privacy Group page/menu is available. | isPrivacyPage | php | boonex/dolphin.pro | inc/classes/BxDolPrivacy.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolPrivacy.php | MIT |
function getUnit (&$aData)
{
// override this func
return '';
} | deprecated
return html for data unit for some day, it is:
- icon 32x32 with link if data have associated image
- data title with link if data have no associated image | getUnit | php | boonex/dolphin.pro | inc/classes/BxDolCalendar.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCalendar.php | MIT |
function getBrowseUri ()
{
// override this func
return '';
} | return browse entries url
year and month and day will be added to this url automatically
so if your base url is /m/some_module/browse/calendar/, it will be transormed to
/m/some_module/browse/calendar/YEAR/MONTH/DAY, like /m/some_module/browse/calendar/2009/3/15 | getBrowseUri | php | boonex/dolphin.pro | inc/classes/BxDolCalendar.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCalendar.php | MIT |
function getEntriesNames ()
{
// override this func
return array(_t('_item'), _t('_items'));
} | return entries names in single and plural forms,
for example: ('event', 'events') or ('profile', 'profiles') | getEntriesNames | php | boonex/dolphin.pro | inc/classes/BxDolCalendar.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolCalendar.php | MIT |
function getUnit(&$aData)
{
//global $oFunctions;
$iProfileID = (int)$aData['ID'];
$sName = getNickName($iProfileID);
$sUrl = getProfileLink($iProfileID);
return <<<EOF
<div style="width:95%;">
<a title="{$sName}" href="{$sUrl}">{$sName}</a>
</div>
EOF;
} | return html for data unit for some day, it is:
- icon 32x32 with link if data have associated image
- data title with link if data have no associated image | getUnit | php | boonex/dolphin.pro | inc/classes/BxDolProfilesCalendar.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolProfilesCalendar.php | MIT |
static public function getObjectInstance($sObject)
{
if (isset($GLOBALS['bxDolClasses']['BxDolExport!'.$sObject]))
return $GLOBALS['bxDolClasses']['BxDolExport!'.$sObject];
$aSystems =& self::getSystems ();
if (!$aSystems || !isset($aSystems[$sObject]))
return false;
$aObject = $aSystems[$sObject];
if (!($sClass = $aObject['class_name']))
return false;
if (!empty($aObject['class_file']))
require_once(BX_DIRECTORY_PATH_ROOT . $aObject['class_file']);
else
bx_import($sClass);
$o = new $sClass($aObject);
return ($GLOBALS['bxDolClasses']['BxDolExport!'.$sObject] = $o);
} | Get export object instance by object name
@param $sObject object name
@return object instance or false on error | getObjectInstance | php | boonex/dolphin.pro | inc/classes/BxDolExport.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolExport.php | MIT |
public function export ($iProfileId)
{
return array(
'sql' => $this->exportSQL($iProfileId),
'files' => $this->exportFiles($iProfileId),
);
} | Generate export for current object and profile
@param $iProfileId - profile ID to export data for
@return array with 2 elements: 'files' and 'sql'
- files - array of files belonging to the user
- sql - SQL queries string | export | php | boonex/dolphin.pro | inc/classes/BxDolExport.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolExport.php | MIT |
public function exportFiles($iProfileId)
{
$a = array();
foreach ($this->_aTablesWithFiles as $sTableName => $aFields)
$a = array_merge($a, $this->_getFiles($sTableName, $aFields, $iProfileId));
return $a;
} | Generate files export for current object and profile
@param $iProfileId - profile ID to export data for
@return array of files with full paths | exportFiles | php | boonex/dolphin.pro | inc/classes/BxDolExport.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolExport.php | MIT |
public function exportSQL($iProfileId)
{
$s = '';
foreach ($this->_aTables as $sTableName => $mixedCond)
$s .= $this->_getRows($sTableName, $mixedCond, $iProfileId);
return $s;
} | Generate SQL export for current object and profile
@param $iProfileId - profile ID to export data for
@return string with SQL queries | exportSQL | php | boonex/dolphin.pro | inc/classes/BxDolExport.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolExport.php | MIT |
function serviceGetUploadersList()
{
return $this->oModule->_oConfig->getUploaderList();
} | Get array of available uploaders. | serviceGetUploadersList | php | boonex/dolphin.pro | inc/classes/BxDolFilesUploader.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolFilesUploader.php | MIT |
function serviceGetUploaderForm($aExtras)
{
return $this->GenMainAddFilesForm($aExtras);
} | Generate video upload main form
@param $aExtras - predefined album and category should appear here | serviceGetUploaderForm | php | boonex/dolphin.pro | inc/classes/BxDolFilesUploader.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolFilesUploader.php | MIT |
function bx_intervention_image_autoload($sClass)
{
$sClass = trim($sClass, '\\');
if (0 === strncmp('Intervention', $sClass, 12)) {
$sFile = BX_DIRECTORY_PATH_PLUGINS . 'intervention-image/' . str_replace('\\', '/', $sClass) . '.php';
if (file_exists($sFile))
require_once($sFile);
}
} | Autoload Intervention Image files | bx_intervention_image_autoload | php | boonex/dolphin.pro | inc/classes/BxDolImageResize.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolImageResize.php | MIT |
public static function instance()
{
if(!isset($GLOBALS['bxDolClasses'][__CLASS__]))
$GLOBALS['bxDolClasses'][__CLASS__] = new BxDolImageResize();
return $GLOBALS['bxDolClasses'][__CLASS__];
} | Get singleton instance of the class | instance | php | boonex/dolphin.pro | inc/classes/BxDolImageResize.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolImageResize.php | MIT |
function setAutoCrop ($b)
{
$this->_isAutoCrop = $b;
} | Crop image to destination size with filling whole area of destination size | setAutoCrop | php | boonex/dolphin.pro | inc/classes/BxDolImageResize.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolImageResize.php | MIT |
function getCurrLink($sCont)
{
$aCurrLink = explode('|', $sCont);
$aCurrLink[0] = $this->oPermalinks->permalink($aCurrLink[0]);
$sCont = implode( '|', $aCurrLink );
return $sCont;
} | Returns link in accordance with permalink settings | getCurrLink | php | boonex/dolphin.pro | inc/classes/BxDolMenu.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolMenu.php | MIT |
function setCustomBreadcrumbs ($a)
{
$this->aCustomBreadcrumbs = $a;
} | set custom breadcrumbs
@param $a breadcrumbs array, array keys are titles and array values are links, for example:
array(
_t('Item1') => 'http://item1.com/link',
_t('Item2') => 'http://item2.com/link',
)
NOTE: first element in breadcrumb is always 'Home', it is added automatically, so you don't need to add in this array | setCustomBreadcrumbs | php | boonex/dolphin.pro | inc/classes/BxDolMenu.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolMenu.php | MIT |
function init()
{
//--- Load injection's cache ---//
$oCache = $GLOBALS['MySQL']->getDbCacheObject();
$aInjections = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey($this->_sInjectionsCache));
if (null === $aInjections) {
$rInjections = db_res("SELECT `page_index`, `name`, `key`, `type`, `data`, `replace` FROM `" . $this->_sInjectionsTable . "` WHERE `active`='1'");
while($aInjection = $rInjections->fetch())
$aInjections['page_' . $aInjection['page_index']][$aInjection['key']][] = $aInjection;
$oCache->setData ($GLOBALS['MySQL']->genDbCacheKey($this->_sInjectionsCache), $aInjections);
}
$GLOBALS[$this->_sPrefix . 'Injections'] = isset($GLOBALS[$this->_sPrefix . 'Injections']) ? array_merge_recursive ($GLOBALS[$this->_sPrefix . 'Injections'], $aInjections) : $aInjections;
//--- Load page elements related static variables ---//
$GLOBALS[$this->_sPrefix . 'PageKeywords'] = array();
$GLOBALS[$this->_sPrefix . 'OG'] = array();
$GLOBALS[$this->_sPrefix . 'Js'] = array();
$GLOBALS[$this->_sPrefix . 'JsSystem'] = array();
$GLOBALS[$this->_sPrefix . 'Css'] = array();
$GLOBALS[$this->_sPrefix . 'CssSystem'] = array();
$GLOBALS[$this->_sPrefix . 'CssStyles'] = array();
$GLOBALS[$this->_sPrefix . 'CssAsync'] = array();
$this->setPageWidth(getParam('main_div_width'));
$this->setPageTitle('');
$this->setPageMainBoxTitle('');
$this->setPageDescription('');
} | Initialize template engine.
Note. The method is executed with the system, you shouldn't execute it in your subclasses. | init | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addLocation($sKey, $sLocationPath, $sLocationUrl)
{
$this->_aLocations[$sKey] = array(
'path' => $sLocationPath . BX_DOL_TEMPLATE_FOLDER_ROOT . DIRECTORY_SEPARATOR,
'url' => $sLocationUrl . BX_DOL_TEMPLATE_FOLDER_ROOT . '/'
);
} | Add location in array of locations.
Note. Location is the path/url to folder where 'templates' folder is stored.
@param string $sKey - location's unique key.
@param string $sLocationPath - location's path. For modules: '[path_to_dolphin]/modules/[vendor_name]/[module_name]/'
@param string $sLocationUrl - location's url. For modules: '[url_to_dolphin]/modules/[vendor_name]/[module_name]/' | addLocation | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function removeLocation($sKey)
{
if(isset($this->_aLocations[$sKey]))
unset($this->_aLocations[$sKey]);
} | Remove location from array of locations.
Note. Location is the path/url to folder where templates are stored.
@param string $sKey - location's unique key. | removeLocation | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addLocationJs($sKey, $sLocationPath, $sLocationUrl)
{
$this->_aLocationsJs[$sKey] = array(
'path' => $sLocationPath,
'url' => $sLocationUrl
);
} | Add JS location in array of JS locations.
Note. Location is the path/url to folder where JS files are stored.
@param string $sKey - location's unique key.
@param string $sLocationPath - location's path. For modules: '[path_to_dolphin]/modules/[vendor_name]/[module_name]/js/'
@param string $sLocationUrl - location's url. For modules: '[url_to_dolphin]/modules/[vendor_name]/[module_name]/js/' | addLocationJs | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function removeLocationJs($sKey)
{
if(isset($this->_aLocationsJs[$sKey]))
unset($this->_aLocationsJs[$sKey]);
} | Remove JS location from array of locations.
Note. Location is the path/url to folder where templates are stored.
@param string $sKey - JS location's unique key. | removeLocationJs | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getCode()
{
return isset($GLOBALS['iAdminPage']) && (int)$GLOBALS['iAdminPage'] == 1 ? BX_DOL_TEMPLATE_DEFAULT_CODE : $this->_sCode;
} | Get currently active template code.
@return string template's code. | getCode | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addJsTranslation($mixedKey)
{
if(is_string($mixedKey))
$mixedKey = array($mixedKey);
foreach($mixedKey as $sKey)
$GLOBALS['BxDolTemplateJsTranslations'][$sKey] = _t($sKey, '{0}', '{1}');
} | Add language translation for key in JS output.
@param mixed $mixedKey language key or an array of keys. | addJsTranslation | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function setOpenGraphInfo($a, $sNamespace = 'og')
{
$GLOBALS[$this->_sPrefix . 'OG'][$sNamespace] = array_merge(isset($GLOBALS[$this->_sPrefix . 'OG'][$sNamespace]) ? $GLOBALS[$this->_sPrefix . 'OG'][$sNamespace] : array(), $a);
} | Set page meta Open Graph info.
@param array $a open graph info, such as type, image, title, site_name
@param string $sNamespace namespace, by default 'og' | setOpenGraphInfo | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getTemplate($sName)
{
return $this->_aTemplates[$sName];
} | Get template, which was loaded earlier.
@see method this->loadTemplates and field this->_aTemplates
@param string $sName - template name.
@return string template's content. | getTemplate | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getIconPath($sName, $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH)
{
return $this->_getAbsoluteLocation('path', $this->_sFolderIcons, $sName, $sCheckIn);
} | Get absolute Path for the icon.
@param string $sName - icon's file name.
@param string $sCheckIn where the content would be searched(base, template, both)
@return string absolute path. | getIconPath | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getImagePath($sName, $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH)
{
return $this->_getAbsoluteLocation('path', $this->_sFolderImages, $sName, $sCheckIn);
} | Get absolute Path for the image.
@param string $sName - image's file name.
@param string $sCheckIn where the content would be searched(base, template, both)
@return string absolute path. | getImagePath | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function parseHtmlByName($sName, $aVariables, $mixedKeyWrapperHtml = null, $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH)
{
if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->beginTemplate($sName, $sRand = time().rand());
if (($sContent = $this->getCached($sName, $aVariables, $mixedKeyWrapperHtml, $sCheckIn)) !== false) {
if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->endTemplate($sName, $sRand, $sRet, true);
return $sContent;
}
$sRet = '';
if (($sContent = $this->getHtml($sName, $sCheckIn)) !== false)
$sRet = $this->_parseContent($sContent, $aVariables, $mixedKeyWrapperHtml);
if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->endTemplate($sName, $sRand, $sRet, false);
return $sRet;
} | Parse HTML template. Search for the template with accordance to it's file name.
@see allows to use cache.
@param string $sName - HTML file name.
@param array $aVariables - key/value pairs. key should be the same as template's key, but without prefix and postfix.
@param mixed $mixedKeyWrapperHtml - key wrapper(string value if left and right parts are the same, array(left, right) otherwise).
@param string $sCheckIn where the content would be searched(base, template, both)
@return string the result of operation. | parseHtmlByName | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function parseHtmlByTemplateName($sName, $aVariables, $mixedKeyWrapperHtml = null)
{
if(!isset($this->_aTemplates[$sName]) || empty($this->_aTemplates[$sName]))
return "";
return $this->_parseContent($this->_aTemplates[$sName], $aVariables, $mixedKeyWrapperHtml);
} | Parse earlier loaded HTML template.
@see Doesn't allow to use cache.
@param string $sName - template name.
@param array $aVariables - key/value pairs. Key should be the same as template's key, excluding prefix and postfix.
@return string the result of operation.
@see $this->_aTemplates | parseHtmlByTemplateName | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function parsePageByName($sName, $aVariables)
{
if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->beginPage($sName);
// add facebook meta tag
if ($sFbId = getParam('bx_facebook_connect_api_key'))
$this->setOpenGraphInfo(array('app_id' => $sFbId), 'fb');
$sContent = $this->parseHtmlByName($sName, $aVariables, $this->_sKeyWrapperHtml, BX_DOL_TEMPLATE_CHECK_IN_BOTH);
if(empty($sContent))
$sContent = $this->parseHtmlByName('default.html', $aVariables, $this->_sKeyWrapperHtml, BX_DOL_TEMPLATE_CHECK_IN_BOTH);
//--- Add CSS and JS at the very last ---//
if(strpos($sContent, '<bx_include_css_styles />') !== false)
$sContent = str_replace('<bx_include_css_styles />', $this->includeCssStyles(), $sContent);
if(strpos($sContent , '<bx_include_css />') !== false) {
if (!empty($GLOBALS['_page']['css_name'])) {
$this->addCss($GLOBALS['_page']['css_name']);
}
$sContent = str_replace('<bx_include_css />', $this->includeFiles('css', true) . $this->includeFiles('css'), $sContent);
}
if(strpos($sContent , '<bx_include_js />') !== false) {
if (!empty($GLOBALS['_page']['js_name'])) {
$this->addJs($GLOBALS['_page']['js_name']);
}
$sContent = str_replace('<bx_include_js />', $this->includeFiles('js', true) . $this->includeFiles('js') . $this->includeCssAsync(), $sContent);
}
if (isset($GLOBALS['bx_profiler'])) $GLOBALS['bx_profiler']->endPage($sContent);
return $sContent;
} | Parse page HTML template. Search for the page's template with accordance to it's file name.
@see allows to use cache.
@param string $sName - HTML file name.
@param array $aVariables - key/value pairs. key should be the same as template's key, but without prefix and postfix.
@return string the result of operation. | parsePageByName | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getTemplatesCacheObject ()
{
$sCacheEngine = getParam('sys_template_cache_engine');
$oCacheEngine = bx_instance('BxDolCache' . $sCacheEngine);
if(!$oCacheEngine->isAvailable())
$oCacheEngine = bx_instance('BxDolCacheFileHtml');
return $oCacheEngine;
} | Get cache object for templates
@return cache class instance | getTemplatesCacheObject | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function getCached($sName, &$aVariables, $mixedKeyWrapperHtml = null, $sCheckIn = BX_DOL_TEMPLATE_CHECK_IN_BOTH, $bEvaluate = true)
{
// initialization
if (!$this->_bCacheEnable)
return false;
$sAbsolutePath = $this->_getAbsoluteLocation('path', $this->_sFolderHtml, $sName, $sCheckIn);
if (empty($sAbsolutePath))
return false;
$oCacheEngine = $this->getTemplatesCacheObject ();
$isFileBasedEngine = $bEvaluate && method_exists($oCacheEngine, 'getDataFilePath');
// try to get cached content
$sCacheVariableName = "a";
$sCacheKey = $this->_getCacheFileName('html', $sAbsolutePath) . '.php';
if ($isFileBasedEngine)
$sCacheContent = $oCacheEngine->getDataFilePath($sCacheKey);
else
$sCacheContent = $oCacheEngine->getData($sCacheKey);
// recreate cache if it is empty
if ($sCacheContent === null && ($sContent = file_get_contents($sAbsolutePath)) !== false && ($sContent = $this->_compileContent($sContent, "\$" . $sCacheVariableName, 1, $aVariables, $mixedKeyWrapperHtml)) !== false) {
if (false === $oCacheEngine->setData($sCacheKey, $sContent))
return false;
if ($isFileBasedEngine)
$sCacheContent = $oCacheEngine->getDataFilePath($sCacheKey);
else
$sCacheContent = $sContent;
}
if ($sCacheContent === null)
return false;
// return simple cache content
if (!$bEvaluate)
return $sCacheContent;
// return evaluated cache content
ob_start();
$$sCacheVariableName = &$aVariables;
if ($isFileBasedEngine)
include($sCacheContent);
else
eval('?'.'>' . $sCacheContent);
$sContent = ob_get_clean();
return $sContent;
} | Get template from cache if it's enabled.
@param string $sName template name
@param string $aVariables key/value pairs. key should be the same as template's key, but without prefix and postfix.
@param mixed $mixedKeyWrapperHtml - key wrapper(string value if left and right parts are the same, array(0 => left, 1 => right) otherwise).
@param string $sCheckIn where the content would be searched(base, template, both)
@param boolean $bEvaluate need to evaluate the template or not.
@return string result of operation or false on failure. | getCached | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addJs($mixedFiles, $bDynamic = false)
{
return $this->_processFiles('js', 'add', $mixedFiles, $bDynamic);
} | Add JS file(s) to global output.
@param mixed $mixedFiles string value represents a single JS file name. An array - array of JS file names.
@param boolean $bDynamic in the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
@return boolean/string result of operation. | addJs | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addJsSystem($mixedFiles) {
return $this->_processFiles('js', 'add', $mixedFiles, false, true);
} | Add System JS file(s) to global output.
System JS files are the files which are attached to all pages. They will be cached separately from the others.
@param mixed $mixedFiles string value represents a single JS file name. An array - array of JS file names.
@param boolean $bDynamic in the dynamic mode JS file(s) are not included to global output, but are returned from the function directly.
@return boolean/string result of operation. | addJsSystem | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function deleteJs($mixedFiles)
{
return $this->_processFiles('js', 'delete', $mixedFiles);
} | Delete JS file(s) from global output.
@param mixed $mixedFiles string value represents a single JS file name. An array - array of JS file names.
@return boolean result of operation. | deleteJs | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function deleteJsSystem($mixedFiles) {
return $this->_processFiles('js', 'delete', $mixedFiles, false, true);
} | Delete System JS file(s) from global output.
@param mixed $mixedFiles string value represents a single JS file name. An array - array of JS file names.
@return boolean result of operation. | deleteJsSystem | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function _wrapInTagJs($sFile)
{
return "<script language=\"javascript\" type=\"text/javascript\" src=\"" . $sFile . "\"></script>";
} | Wrap an URL to JS file into JS tag.
@param string $sFile - URL to JS file.
@return string the result of operation. | _wrapInTagJs | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addCss($mixedFiles, $bDynamic = false)
{
return $this->_processFiles('css', 'add', $mixedFiles, $bDynamic);
} | Add CSS file(s) to global output.
@param mixed $mixedFiles string value represents a single CSS file name. An array - array of CSS file names.
@param boolean $bDynamic in the dynamic mode CSS file(s) are not included to global output, but are returned from the function directly.
@return boolean/string result of operation | addCss | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addCssAsync($mixedFiles)
{
if (!is_array($mixedFiles))
$mixedFiles = array($mixedFiles);
foreach ($mixedFiles as $sFile)
$GLOBALS[$this->_sPrefix . 'CssAsync'][] = $this->_getAbsoluteLocationCss('url', $sFile);
$this->addJs('loadCSS.js');
} | Add additional heavy css file (not very necessary) to load asynchronously for desktop browsers only
@param mixed $mixedFiles string value represents a single CSS file name. An array - array of CSS file names. | addCssAsync | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function includeCssAsync ()
{
if (empty($GLOBALS[$this->_sPrefix . 'CssAsync']))
return '';
$GLOBALS[$this->_sPrefix . 'CssAsync'] = array_unique($GLOBALS[$this->_sPrefix . 'CssAsync']);
$sList = '';
foreach ($GLOBALS[$this->_sPrefix . 'CssAsync'] as $sUrl)
$sList .= 'loadCSS("' . $sUrl . '", document.getElementById("bx_css_async"));';
// don't load css for mobile devices
return '
<script id="bx_css_async">
if(!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
' . $sList . '
}
</script>
';
} | Return script tag with special code to load async css.
This tag is added after js files list | includeCssAsync | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function addCssSystem($mixedFiles) {
return $this->_processFiles('css', 'add', $mixedFiles, false, true);
} | Add System CSS file(s) to global output.
System CSS files are the files which are attached to all pages. They will be cached separately from the others.
@param mixed $mixedFiles string value represents a single CSS file name. An array - array of CSS file names.
@return boolean/string result of operation | addCssSystem | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function deleteCss($mixedFiles)
{
return $this->_processFiles('css', 'delete', $mixedFiles);
} | Delete CSS file(s) from global output.
@param mixed $mixedFiles string value represents a single CSS file name. An array - array of CSS file names.
@return boolean result of operation. | deleteCss | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
function deleteCssSystem($mixedFiles){
return $this->_processFiles('css', 'delete', $mixedFiles, false, true);
} | Delete System CSS file(s) from global output.
@param mixed $mixedFiles string value represents a single CSS file name. An array - array of CSS file names.
@return boolean result of operation. | deleteCssSystem | php | boonex/dolphin.pro | inc/classes/BxDolTemplate.php | https://github.com/boonex/dolphin.pro/blob/master/inc/classes/BxDolTemplate.php | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.